:root {
  --bg: #03070d;
  --bg2: #08131a;
  --fg: #d9ffe6;
  --muted: #88b59b;
  --card: #07141b;
  --card2: #0c1d28;
  --accent: #5dff97;
  --accent2: #17b86e;
  --line: #1f4c39;
  --tab: #10252f;
  --tab-active: #163345;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--fg);
  background:
    radial-gradient(circle at 10% 10%, rgba(93, 255, 151, 0.16), transparent 38%),
    radial-gradient(circle at 90% 0%, rgba(23, 184, 110, 0.12), transparent 30%),
    linear-gradient(180deg, var(--bg2) 0%, var(--bg) 100%);
}
.container {
  max-width: 1420px;
  margin: 24px auto 48px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 22px 40px rgba(1, 6, 14, 0.65);
}
h1 {
  margin-top: 0;
  color: var(--accent);
}
.brand-title {
  margin-bottom: 6px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  font-size: 24px;
}
.brand-subtitle {
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}
p { color: var(--muted); }
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.auth-form {
  display: grid;
  gap: 10px;
  max-width: 100%;
}
label {
  font-weight: 600;
  color: #a7d6bc;
  font-size: 13px;
}
input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  color: var(--fg);
  background: #061018;
  border-radius: 8px;
  padding: 8px 10px;
}
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  color: var(--fg);
  background: #061018;
  border-radius: 8px;
  padding: 8px 10px;
}
button {
  border: 0;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent2), var(--accent));
  color: #011107;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}
button.secondary {
  background: #163224;
  color: #d7ffe6;
}
button.danger {
  background: linear-gradient(135deg, #d43838, #ff6b6b);
  color: #2a0000;
}
.notice {
  border-radius: 8px;
  padding: 10px;
  border: 1px solid transparent;
}
.notice.error {
  background: rgba(255, 60, 60, 0.12);
  border-color: rgba(255, 60, 60, 0.35);
  color: #ffb4b4;
}
.notice.warning {
  background: rgba(255, 209, 92, 0.1);
  border-color: rgba(255, 209, 92, 0.35);
  color: #ffe6a1;
}
.notice.success {
  background: rgba(41, 224, 125, 0.1);
  border-color: rgba(41, 224, 125, 0.35);
  color: #aef0cb;
}
.table-wrap {
  margin-top: 14px;
  overflow: auto;
  border: 1px solid rgba(31, 76, 57, 0.6);
  border-radius: 12px;
  background: rgba(7, 20, 27, 0.85);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 8px 6px;
  white-space: nowrap;
}
th { color: #8effbe; }
h2 {
  margin-top: 4px;
  margin-bottom: 8px;
  color: #b2ffd0;
}
h3 {
  margin-top: 14px;
  color: #a4ffca;
}
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-form input[type="number"] {
  width: 90px;
}
.link-btn {
  display: inline-block;
  color: #8cffb9;
  text-decoration: none;
}
.link-btn:hover {
  text-decoration: underline;
}
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}
.card-mock {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: rgba(7, 20, 27, 0.75);
}
.card-mock ul {
  margin: 8px 0 0 18px;
  color: var(--muted);
}
.dashboard-body .container::before {
  content: "";
  position: absolute;
  pointer-events: none;
}
.panel-card {
  background:
    linear-gradient(180deg, rgba(12, 29, 40, 0.85) 0%, rgba(7, 20, 27, 0.9) 100%);
  border: 1px solid rgba(31, 76, 57, 0.8);
  border-radius: 14px;
  padding: 14px;
  margin-top: 12px;
}
.book-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}
.book-top-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(460px, 1.35fr);
  gap: 12px;
}
.upload-zone {
  align-self: start;
}
.result-zone {
  min-height: 680px;
}
.row-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.chrome-tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  margin: 14px 0 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  overflow-x: auto;
}
.chrome-tab {
  border: 1px solid var(--line);
  border-bottom: none;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  background: linear-gradient(180deg, var(--tab) 0%, #0b1c25 100%);
  color: #b7dfca;
  height: 42px;
  padding: 0 14px;
  white-space: nowrap;
}
.chrome-tab.active {
  background: linear-gradient(180deg, var(--tab-active) 0%, #102530 100%);
  color: #d6ffea;
  box-shadow: inset 0 0 0 1px rgba(93, 255, 151, 0.26);
}
.pipeline-progress {
  border: 1px solid rgba(31, 76, 57, 0.9);
  background: rgba(6, 16, 24, 0.8);
  border-radius: 12px;
  padding: 12px;
  margin-top: 6px;
}
.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.progress-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(18, 49, 36, 0.8);
  border: 1px solid rgba(31, 76, 57, 0.9);
}
.stop-form {
  margin: 0 0 8px;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #15a55f 0%, #66ff9f 100%);
  box-shadow: 0 0 16px rgba(93, 255, 151, 0.45);
  transition: width 0.4s ease;
}
.progress-stats {
  margin-top: 8px;
  color: #9ec1ae;
  font-size: 12px;
}
.status-chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(31, 76, 57, 0.8);
  color: #a6ffc9;
  background: rgba(12, 36, 24, 0.6);
  font-size: 12px;
  line-height: 1.1;
}
.max-h-table {
  max-height: 340px;
}
.chapter-links {
  display: grid;
  gap: 8px;
}
.chapter-links-large {
  margin-top: 10px;
  max-height: 590px;
  overflow: auto;
  padding-right: 6px;
}
.chapter-link {
  display: grid;
  grid-template-columns: 60px 1fr;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border: 1px solid rgba(31, 76, 57, 0.8);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(11, 33, 22, 0.75) 0%, rgba(7, 20, 27, 0.9) 100%);
  color: #d9ffe9;
  padding: 10px 12px;
}
.chapter-link:hover {
  border-color: rgba(93, 255, 151, 0.7);
  box-shadow: 0 0 0 1px rgba(93, 255, 151, 0.22);
}
.chapter-num {
  font-size: 12px;
  color: #9bd6b4;
  font-weight: 700;
}
.chapter-title {
  font-size: 13px;
  color: #e2fff0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1120px) {
  .container {
    margin: 8px;
    max-width: none;
    padding: 12px;
  }
  .book-top-grid,
  .book-grid {
    grid-template-columns: 1fr;
  }
  .result-zone {
    min-height: 0;
  }
  .chapter-links-large {
    max-height: 360px;
  }
}

@media (max-width: 700px) {
  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .chrome-tabs {
    margin-top: 8px;
  }
  .chrome-tab {
    height: 38px;
    padding: 0 10px;
    font-size: 12px;
  }
  .panel-card {
    padding: 10px;
  }
}
