:root {
  --bg: #0b1020;
  --panel: rgba(255, 255, 255, 0.08);
  --panelBorder: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.66);
  --faint: rgba(255, 255, 255, 0.42);
  --accent: #6d5efc;
  --accent2: #00d4ff;
  --danger: #ff4d6d;
  --ok: #33d69f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}

html[data-theme="light"] {
  --bg: #f7f9ff;
  --panel: rgba(20, 30, 60, 0.11);
  --panelBorder: rgba(20, 30, 60, 0.18);
  --text: rgba(10, 12, 20, 0.92);
  --muted: rgba(10, 12, 20, 0.62);
  --faint: rgba(10, 12, 20, 0.42);
  --shadow: 0 18px 60px rgba(30, 40, 90, 0.22);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(1200px 800px at 10% 0%, rgba(109, 94, 252, 0.35), transparent 60%),
    radial-gradient(900px 700px at 90% 10%, rgba(0, 212, 255, 0.24), transparent 60%),
    radial-gradient(900px 700px at 40% 90%, rgba(51, 214, 159, 0.18), transparent 60%),
    linear-gradient(180deg, var(--bg), rgba(0, 0, 0, 0.06));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 22px;
  background: transparent;
  border-bottom: none;
}

.topTitle {
  font-size: 24px;
  font-weight: 850;
  letter-spacing: 0.4px;
  text-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.actions {
  position: absolute;
  right: 16px;
  top: 12px;
  transform: none;
  z-index: 20;
}

.container {
  width: 100%;
  margin: 0;
  padding: 10px 28px 160px;
  display: grid;
  gap: 18px;
}

.panel {
  width: min(1080px, 100%);
  margin: 0 auto;
  border: 1px solid var(--panelBorder);
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.panelHeader {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  margin-bottom: 14px;
}

.panelTitle {
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.2px;
}

.panelHint {
  font-size: 12px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

@media (max-width: 860px) {
  .container {
    padding: 8px 14px 24px;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

.field {
  display: grid;
  gap: 8px;
}

.label {
  font-size: 12px;
  color: var(--muted);
}

.codeBox {
  border: 1px solid var(--panelBorder);
  border-radius: 14px;
  padding: 11px 12px;
  background: rgba(0, 0, 0, 0.16);
}

html[data-theme="light"] .codeBox {
  background: rgba(255, 255, 255, 0.65);
}

.codeMuted {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--faint);
  user-select: all;
}

.input {
  border: 1px solid var(--panelBorder);
  background: rgba(0, 0, 0, 0.16);
  color: var(--text);
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
  font-size: 13px;
}

html[data-theme="light"] .input {
  background: rgba(255, 255, 255, 0.65);
}

.apiKeyInput::placeholder {
  color: rgba(160, 165, 190, 0.9);
}

html[data-theme="light"] .apiKeyInput::placeholder {
  color: rgba(120, 128, 155, 0.9);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  font-size: 12px;
  color: var(--muted);
  min-height: 18px;
}

.uploadCenter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 6px 0 2px;
}

.btnRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btnDanger {
  background: rgba(255, 77, 109, 0.14);
  border-color: rgba(255, 77, 109, 0.35);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.uploadField {
  width: min(920px, 100%);
}

#loginPage .panel,
#registerPage .panel {
  width: min(760px, 100%);
}

#loginPage .uploadField,
#registerPage .uploadField {
  width: min(560px, 100%);
}

#registerPage .grid {
  width: min(560px, 100%);
}

.fileInput {
  width: 100%;
}

.uploadCenter .label {
  text-align: left;
}

.uploadCenter .status {
  text-align: center;
}

.progressBox {
  width: min(720px, 100%);
  border: 1px solid var(--panelBorder);
  border-radius: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .progressBox {
  background: rgba(255, 255, 255, 0.55);
}

.progressTitle {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 8px;
}

.progressList {
  display: grid;
  gap: 8px;
}

.progressItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px dashed var(--panelBorder);
  border-radius: 14px;
  padding: 9px 10px;
}

.progressName {
  font-size: 12px;
  font-weight: 750;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progressState {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.progressStateDone {
  color: rgba(51, 214, 159, 0.98);
}

.progressStateErr {
  color: rgba(255, 77, 109, 0.96);
}

.btn {
  border: 1px solid var(--panelBorder);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 700;
  color: var(--text);
  background: rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="light"] .btn:hover {
  border-color: rgba(20, 30, 60, 0.24);
}

.btnPrimary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 34px rgba(0, 212, 255, 0.18);
}

.btnGhost {
  background: rgba(0, 0, 0, 0.16);
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 860px) {
  .cards {
    grid-template-columns: 1fr;
  }
}

.resultsRoot {
  display: grid;
  gap: 14px;
}

.chapterGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

@media (max-width: 980px) {
  .chapterGrid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .chapterGrid {
    grid-template-columns: 1fr;
  }
}

.chapterTile {
  border: 1px solid var(--panelBorder);
  background: rgba(0, 0, 0, 0.14);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 10px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

html[data-theme="light"] .chapterTile {
  background: rgba(255, 255, 255, 0.65);
}

.chapterTile:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-theme="light"] .chapterTile:hover {
  border-color: rgba(20, 30, 60, 0.24);
}

.chapterTileActive {
  border-color: rgba(0, 212, 255, 0.45);
  box-shadow: 0 18px 60px rgba(0, 212, 255, 0.12);
}

html[data-theme="light"] .chapterTileActive {
  border-color: rgba(0, 212, 255, 0.55);
  box-shadow: 0 18px 60px rgba(0, 212, 255, 0.14);
}

.chapterTileTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chapterTileTitle {
  font-size: 13px;
  font-weight: 850;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapterTileMeta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.chapterTileCount {
  font-family: var(--mono);
  font-weight: 850;
}

.chapterCards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 860px) {
  .chapterCards {
    grid-template-columns: 1fr;
  }
}

.chapterCard {
  width: 100%;
}

.chapterDetailWrap {
  display: flex;
  justify-content: center;
}

.chapterDetailPanel {
  width: min(980px, 100%);
}

.chapterCardBody {
  margin-top: 12px;
  border: 1px solid var(--panelBorder);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.10);
  display: grid;
  gap: 12px;
  width: 100%;
}

html[data-theme="light"] .chapterCardBody {
  background: rgba(255, 255, 255, 0.55);
}

.chapterBodyTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.chapterBodyTitle {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
}

#statusMount {
  position: absolute;
  left: 18px;
  top: 84px;
  z-index: 30;
  width: 280px;
}

.statusSide {
  width: 400px;
  border: 1px solid var(--panelBorder);
  border-radius: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.10);
  position: relative;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-theme="light"] .statusSide {
  background: rgba(255, 255, 255, 0.55);
}

@media (max-width: 980px) {
  #statusMount {
    display: none;
  }

  .statusSide {
    display: none;
  }
}

#historyMount {
  position: absolute;
  left: 18px;
  top: 84px;
  z-index: 30;
  width: 320px;
  display: flex;
  justify-content: flex-start;
}

.historyToggleBtn {
  border: 1px solid var(--panelBorder);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.10);
  color: var(--text);
  cursor: pointer;
  user-select: none;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

html[data-theme="light"] .historyToggleBtn {
  background: rgba(255, 255, 255, 0.65);
}

.historyToggleBtn:hover {
  background: rgba(109, 94, 252, 0.14);
}

.historySide {
  width: 320px;
  border: 1px solid var(--panelBorder);
  border-radius: 16px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.10);
  position: absolute;
  left: 0;
  top: 44px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

html[data-theme="light"] .historySide {
  background: rgba(255, 255, 255, 0.55);
}

.historyHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.historyTitle {
  font-weight: 900;
  font-size: 12px;
  color: var(--muted);
}

.historyList {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
  max-height: min(620px, 72vh);
}

.historyItem {
  width: 100%;
  border: 1px solid var(--panelBorder);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.10);
  position: relative;
}

html[data-theme="light"] .historyItem {
  background: rgba(255, 255, 255, 0.55);
}

.historyOpenBtn {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  padding-right: 34px;
  margin: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.historyItemTitle {
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 4px;
}

.historyItemMeta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.historyDeleteBtn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #94a3b8;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.historyDeleteBtn:hover {
  transform: translateY(-1px) scale(1.04);
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
}

.historyPager {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}

.historyPagerInfo {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.historyPagerBtn {
  border: 1px solid var(--panelBorder);
  border-radius: 12px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.10);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

html[data-theme="light"] .historyPagerBtn {
  background: rgba(255, 255, 255, 0.55);
}

.historyPagerBtn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 980px) {
  #historyMount {
    display: none;
  }
}

.statusSideTabs {
  display: grid;
  gap: 8px;
}

.statusSideTab {
  width: 100%;
  border: 1px solid var(--panelBorder);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  text-align: left;
}

html[data-theme="light"] .statusSideTab {
  background: rgba(255, 255, 255, 0.65);
}

.statusTabActive {
  outline: 2px solid rgba(109, 94, 252, 0.55);
  outline-offset: 1px;
}

.statusSideLabel {
  font-size: 13px;
  font-weight: 850;
  color: var(--text);
}

.statusSideNum {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  color: var(--text);
}

.statusSideTabOk .statusSideNum {
  color: rgba(51, 214, 159, 0.98);
}

.statusSideTabWarn .statusSideNum {
  color: rgba(255, 210, 77, 0.98);
}

.statusSideTabBad .statusSideNum {
  color: rgba(255, 77, 109, 0.96);
}

.statusPanel {
  border: 1px solid var(--panelBorder);
  border-radius: 14px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.10);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(620px, 72vh);
}

html[data-theme="light"] .statusPanel {
  background: rgba(255, 255, 255, 0.55);
}

.statusPanelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.statusPanelTitle {
  font-weight: 900;
  font-size: 12px;
  color: var(--muted);
}

.statusPanelList {
  display: grid;
  gap: 8px;
  overflow: auto;
  padding-right: 4px;
  max-height: min(520px, 62vh);
}

.statusItem {
  width: 100%;
  text-align: left;
  border: 1px solid var(--panelBorder);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.10);
  cursor: pointer;
}

html[data-theme="light"] .statusItem {
  background: rgba(255, 255, 255, 0.55);
}

.statusItemTitle {
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 4px;
}

.statusItemMeta {
  font-size: 12px;
  color: var(--muted);
}

.statusSideHint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 2px 2px 0;
}

.statusSideFoot {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.statusSideCollapse {
  border: 1px solid var(--panelBorder);
  border-radius: 12px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.10);
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

html[data-theme="light"] .statusSideCollapse {
  background: rgba(255, 255, 255, 0.55);
}

.statusSideCollapse:hover {
  color: var(--text);
  background: rgba(109, 94, 252, 0.14);
}

.auditItemFocus {
  outline: 2px solid rgba(109, 94, 252, 0.55);
  outline-offset: 4px;
  border-radius: 14px;
}

.card {
  border: 1px solid var(--panelBorder);
  background: rgba(0, 0, 0, 0.14);
  border-radius: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
}

html[data-theme="light"] .card {
  background: rgba(255, 255, 255, 0.65);
}

.cardTop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cardTitle {
  font-weight: 800;
  font-size: 13px;
}

.pill {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--panelBorder);
  color: var(--muted);
}

.pillOk {
  color: rgba(51, 214, 159, 0.98);
  border-color: rgba(51, 214, 159, 0.35);
}

.pillMissing {
  color: rgba(255, 77, 109, 0.96);
  border-color: rgba(255, 77, 109, 0.35);
}

.meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.box {
  border: 1px dashed var(--panelBorder);
  border-radius: 14px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: rgba(0, 0, 0, 0.10);
}

.box pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.auditBox {
  display: grid;
  gap: 10px;
}

.chapterCardBody .auditBox {
  max-height: min(64vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  overscroll-behavior: contain;
}

.chapterCardBody .box,
.chapterCardBody .meta,
.chapterCardBody .auditMeta {
  color: rgba(0, 0, 0, 0.92) !important;
}

.chapterCardBody .box {
  background: rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .chapterCardBody .box {
  background: rgba(255, 255, 255, 0.95);
}

.chapterCardBody .auditTitle {
  color: rgba(0, 0, 0, 0.96) !important;
}

.chapterCardBody .box pre {
  color: rgba(0, 0, 0, 0.92) !important;
}

.chapterCardBody .box pre * {
  color: rgba(0, 0, 0, 0.92) !important;
}

.chapterCardBody .meta,
.chapterCardBody .meta span {
  color: rgba(0, 0, 0, 0.92) !important;
}

.auditItem {
  border: 1px dashed var(--panelBorder);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.08);
  position: relative;
  display: grid;
  gap: 8px;
}

html[data-theme="light"] .auditItem {
  background: rgba(255, 255, 255, 0.55);
}

.auditHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.auditTitle {
  font-size: 14px;
  font-weight: 750;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auditMeta {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.auditToggle {
  width: min(320px, 100%);
  justify-self: center;
}

.auditDetail pre {
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.auditBadge {
  border: 1px solid var(--panelBorder);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  font-family: var(--mono);
  white-space: nowrap;
}

.auditItem .auditBadge {
  position: absolute;
  right: 12px;
  top: 62%;
  transform: translateY(-50%);
}

.auditBadgeOk {
  color: rgba(51, 214, 159, 0.98);
  border-color: rgba(51, 214, 159, 0.35);
  background: rgba(51, 214, 159, 0.10);
}

.auditBadgeBad {
  color: rgba(255, 77, 109, 0.96);
  border-color: rgba(255, 77, 109, 0.35);
  background: rgba(255, 77, 109, 0.10);
}

.auditBadgeWarn {
  color: rgba(255, 210, 77, 0.98);
  border-color: rgba(255, 210, 77, 0.35);
  background: rgba(255, 210, 77, 0.10);
}

html[data-theme="light"] .box {
  background: rgba(255, 255, 255, 0.5);
}

html[data-theme="light"] .box,
html[data-theme="light"] .meta,
html[data-theme="light"] .auditMeta,
html[data-theme="light"] .auditTitle {
  color: rgba(0, 0, 0, 0.88);
}

.err {
  color: rgba(255, 77, 109, 0.96);
}

.footer {
  padding: 16px 0 26px;
  opacity: 0.95;
}

.footerInner {
  width: min(1080px, calc(100% - 36px));
  margin: 0 auto;
}

.footerText {
  font-size: 12px;
  color: var(--muted);
}

body.uploadPage {
  --panel: rgba(255, 255, 255, 0.46);
  --panelBorder: rgba(148, 163, 184, 0.28);
  --text: rgba(15, 23, 42, 0.96);
  --muted: rgba(15, 23, 42, 0.6);
  --faint: rgba(15, 23, 42, 0.42);
  --accent: #0f766e;
  --accent2: #14b8a6;
  --danger: #94a3b8;
  --ok: #10b981;
  --shadow: 0 24px 60px -36px rgba(15, 23, 42, 0.32);
  --radius: 22px;
  --history-column-width: 424px;
  justify-content: flex-start;
  color: var(--text);
  background:
    radial-gradient(circle at 0% 0%, rgba(237, 224, 249, 0.88) 0%, rgba(237, 224, 249, 0.2) 26%, transparent 48%),
    radial-gradient(circle at 100% 0%, rgba(209, 240, 253, 0.9) 0%, rgba(209, 240, 253, 0.22) 30%, transparent 58%),
    radial-gradient(circle at 18% 100%, rgba(220, 245, 236, 0.72) 0%, rgba(220, 245, 236, 0.12) 24%, transparent 48%),
    linear-gradient(180deg, #f8fbff 0%, #f2f7fc 44%, #f6f3fb 100%);
}

body.uploadPage:not(.history-open) {
  --history-column-width: 64px;
}

body.uploadPage .container {
  width: 100%;
  max-width: 1940px;
  margin: 0 auto;
  padding: 0 28px 96px;
  gap: 0;
}

body.uploadPage .uploadShell {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

body.uploadPage .pageActionBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  padding: 16px 0 0;
}

body.uploadPage.embedded-mode .pageActionBar {
  display: none;
}

body.uploadPage .portalBtn {
  min-height: 48px;
  padding: 11px 20px 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  box-shadow: 0 18px 44px -34px rgba(15, 23, 42, 0.3);
}

body.uploadPage .portalBtn::before {
  content: "←";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #ffffff;
  font-size: 14px;
  font-weight: 900;
}

body.uploadPage .portalBtn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.96);
}

body.uploadPage .themeBtn {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body.uploadPage .heroHeader {
  padding: 50px 0 64px;
}

body.uploadPage.embedded-mode .heroHeader {
  padding-top: 28px;
}

body.uploadPage .heroTitle {
  margin: 0;
  text-align: center;
  font-size: clamp(34px, 3.5vw, 56px);
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
  text-shadow: 0 12px 32px rgba(255, 255, 255, 0.32);
}

body.uploadPage .workspaceGrid {
  display: grid;
  grid-template-columns: var(--history-column-width) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

body.uploadPage .historyColumn {
  min-width: 0;
  padding-left: 48px;
}

body.uploadPage #historyMount {
  position: relative;
  width: 100%;
  min-height: 232px;
  overflow: visible;
}

body.uploadPage .historyToggleBtn {
  position: absolute;
  left: -44px;
  top: 116px;
  z-index: 2;
  width: 38px;
  height: 62px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(203, 213, 225, 0.95);
  background: rgba(255, 255, 255, 0.88);
  color: transparent;
  font-size: 0;
  line-height: 0;
  box-shadow: 0 18px 42px -34px rgba(15, 23, 42, 0.3);
  transform: none;
}

body.uploadPage .historyToggleBtn::before {
  content: "";
  display: block;
  width: 10px;
  height: 14px;
  background: #64748b;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
  transform-origin: center;
}

body.uploadPage:not(.history-open) .historyToggleBtn::before {
  transform: rotate(180deg);
}

body.uploadPage .historySide {
  position: relative;
  top: 0;
  left: 0;
  width: 100%;
  min-height: 196px;
  padding: 24px 18px 18px;
  border-radius: 18px;
  border: 1px solid rgba(191, 219, 254, 0.3);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 24px 56px -38px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(10px);
}

body.uploadPage:not(.history-open) .historySide[hidden] {
  display: none !important;
}

body.uploadPage .historyHead {
  justify-content: flex-start;
}

body.uploadPage .historyHead > div:last-child,
body.uploadPage #historyRefreshBtn,
body.uploadPage #historyHideBtn {
  display: none;
}

body.uploadPage .historyTitle {
  font-size: 22px;
  font-weight: 900;
  color: #0f172a;
}

body.uploadPage .historyList {
  gap: 12px;
  max-height: 480px;
  margin-top: 18px;
}

body.uploadPage .historyItem,
body.uploadPage .historyList .box {
  border-radius: 14px;
  border: 1px solid rgba(191, 219, 254, 0.28);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

body.uploadPage .historyItem {
  padding: 14px 14px 14px 14px;
}

body.uploadPage .historyItemTitle {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

body.uploadPage .historyItemMeta {
  font-size: 13px;
  line-height: 1.55;
  color: #64748b;
}

body.uploadPage .historyDeleteBtn {
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
}

body.uploadPage .historyPager {
  display: none;
}

body.uploadPage .uploadPanel {
  width: 100%;
  min-width: 0;
  padding: 28px 22px 22px;
  border-radius: 18px;
  border: 1px solid rgba(191, 219, 254, 0.32);
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 24px 56px -38px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(10px);
}

body.uploadPage .uploadPanelHeader {
  margin-bottom: 26px;
}

body.uploadPage .uploadPanelTitle {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
}

body.uploadPage .uploadPanelHint {
  font-size: 14px;
  color: rgba(15, 23, 42, 0.6);
}

body.uploadPage .uploadCenterWide {
  align-items: stretch;
  gap: 22px;
  padding: 0;
}

body.uploadPage .uploadDropShell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 146px;
  padding: 24px 26px;
  border: 2px dashed rgba(148, 163, 184, 0.42);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

body.uploadPage .uploadDropActive {
  border-color: rgba(20, 184, 166, 0.68);
  box-shadow: 0 18px 46px -36px rgba(20, 184, 166, 0.4);
  transform: translateY(-1px);
}

body.uploadPage .uploadDropReady {
  border-color: rgba(20, 184, 166, 0.52);
  box-shadow: 0 18px 46px -36px rgba(20, 184, 166, 0.32);
  background: rgba(255, 255, 255, 0.9);
}

body.uploadPage .uploadDropLead {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  color: rgba(148, 163, 184, 0.96);
  flex: 0 0 auto;
}

body.uploadPage .uploadDropIcon {
  width: 38px;
  height: 38px;
  color: rgba(148, 163, 184, 0.98);
}

body.uploadPage .uploadDropCopy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

body.uploadPage .uploadDropMeta {
  font-size: 14px;
  color: rgba(100, 116, 139, 0.88);
}

body.uploadPage .uploadDropTitle {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
}

body.uploadPage .uploadDropName {
  font-size: 14px;
  color: #0f766e;
  font-weight: 700;
  overflow-wrap: anywhere;
}

body.uploadPage .uploadBrowseBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 46px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 14px 32px -30px rgba(15, 23, 42, 0.28);
}

body.uploadPage .uploadBrowseBtn:hover {
  background: #f8fafc;
}

body.uploadPage .fileInputHidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

body.uploadPage .uploadFieldWide {
  width: 100%;
}

body.uploadPage .label {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
}

body.uploadPage .inputWide {
  width: 100%;
  min-height: 50px;
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.72);
  color: #0f172a;
  font-size: 15px;
}

body.uploadPage .inputWide::placeholder {
  color: rgba(100, 116, 139, 0.82);
}

body.uploadPage .btnRowWide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: 100%;
}

body.uploadPage .actionBtn {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 800;
}

body.uploadPage .btnPrimary {
  background: #f3f4f6;
  border-color: rgba(148, 163, 184, 0.35);
  color: #475569;
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.12);
}

body.uploadPage .btnDanger {
  background: #f3f4f6;
  border-color: rgba(148, 163, 184, 0.35);
  color: #64748b;
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.12);
}

body.uploadPage .actionBtn:hover:not(:disabled) {
  background: #e5e7eb;
  color: #334155;
  border-color: rgba(148, 163, 184, 0.5);
}

body.uploadPage .actionBtn:disabled {
  background: #f3f4f6;
  border-color: rgba(148, 163, 184, 0.28);
  color: rgba(100, 116, 139, 0.7);
  box-shadow: 0 6px 16px rgba(148, 163, 184, 0.08);
  opacity: 1;
}

body.uploadPage .statusWide {
  min-height: 22px;
  font-size: 14px;
  color: #475569;
  text-align: left;
}

body.uploadPage .progressBoxWide {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(191, 219, 254, 0.28);
  background: rgba(255, 255, 255, 0.6);
}

body.uploadPage .progressTitle {
  font-size: 14px;
  font-weight: 800;
  color: #334155;
}

body.uploadPage .progressItem {
  border-radius: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.8);
}

body.uploadPage .progressName {
  font-size: 14px;
  color: #0f172a;
}

body.uploadPage .progressState {
  color: #64748b;
}

body.uploadPage .resultsRoot {
  width: 100%;
  margin-top: 18px;
}

@media (max-width: 1180px) {
  body.uploadPage {
    --history-column-width: 1fr;
  }

  body.uploadPage .workspaceGrid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  body.uploadPage .historyColumn {
    order: 2;
    padding-left: 0;
  }

  body.uploadPage #historyMount {
    min-height: 0;
  }

  body.uploadPage .historyToggleBtn {
    position: relative;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    padding: 9px 14px;
    margin-bottom: 12px;
    transform: none;
    color: #0f172a;
    font-size: 14px;
  }

  body.uploadPage .historyToggleBtn::before,
  body.uploadPage:not(.history-open) .historyToggleBtn::before {
    content: none;
  }

  body.uploadPage .historySide {
    margin-top: 0;
  }
}

@media (max-width: 860px) {
  body.uploadPage .container {
    padding: 0 12px 56px;
  }

  body.uploadPage .pageActionBar {
    min-height: 72px;
    padding-top: 10px;
  }

  body.uploadPage .heroHeader {
    padding: 22px 0 28px;
  }

  body.uploadPage .heroTitle {
    font-size: 28px;
  }

  body.uploadPage .uploadPanel {
    padding: 18px 14px;
  }

  body.uploadPage .uploadDropShell {
    grid-template-columns: 1fr;
    justify-items: start;
    padding: 18px 16px;
  }

  body.uploadPage .uploadBrowseBtn,
  body.uploadPage .actionBtn {
    width: 100%;
  }

  body.uploadPage .btnRowWide {
    grid-template-columns: 1fr;
  }
}
