:root {
  color-scheme: light;
  --bg: #eef3f7;
  --bg-top: #dde9f0;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --text: #17212f;
  --muted: #66758a;
  --line: #d7e0ea;
  --line-strong: #b7c5d4;
  --accent: #285e8f;
  --accent-dark: #1f4b72;
  --teal: #137a7f;
  --ok: #1d7a50;
  --warn: #986312;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(22, 35, 49, 0.10);
  --shadow-soft: 0 8px 22px rgba(22, 35, 49, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, var(--bg-top) 0, var(--bg) 300px, #f6f8fa 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
.download-btn,
.drop-zone,
select {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 52px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 52px;
  height: 62px;
  border: 2px solid rgba(40, 94, 143, 0.78);
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff 0%, #eef6fb 100%);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  border-left: 2px solid rgba(40, 94, 143, 0.65);
  border-bottom: 2px solid rgba(40, 94, 143, 0.65);
  background: #d8e8f2;
  border-radius: 0 5px 0 4px;
}

h1 {
  font-size: 30px;
  line-height: 1.16;
  font-weight: 730;
  letter-spacing: 0;
  color: #142235;
}

.topbar p {
  margin-top: 7px;
  color: #52647a;
  font-size: 14px;
}

.runtime-pill {
  flex: 0 0 auto;
  border: 1px solid rgba(40, 94, 143, 0.24);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--accent-dark);
  font-size: 13px;
  box-shadow: 0 6px 16px rgba(31, 75, 114, 0.08);
  backdrop-filter: blur(8px);
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.step {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(183, 197, 212, 0.9);
  background: rgba(255, 255, 255, 0.78);
  color: #607187;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 620;
  box-shadow: 0 6px 15px rgba(22, 35, 49, 0.04);
}

.step.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 20px rgba(40, 94, 143, 0.20);
}

.step.done {
  border-color: rgba(29, 122, 80, 0.28);
  background: rgba(29, 122, 80, 0.10);
  color: #176844;
}

.panel,
.status-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(215, 224, 234, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
  margin-bottom: 16px;
}

.hidden {
  display: none !important;
}

.drop-zone {
  position: relative;
  min-height: 292px;
  border: 1.5px dashed #a9b8c8;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(247, 250, 252, 0.98), rgba(241, 247, 250, 0.98));
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  text-align: center;
}

.drop-zone::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(215, 224, 234, 0.62);
  border-radius: 8px;
  pointer-events: none;
}

.drop-zone:hover,
.drop-zone.dragover,
.drop-zone:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: linear-gradient(180deg, #f4fbff, #edf7fb);
  box-shadow: inset 0 0 0 1px rgba(40, 94, 143, 0.16);
}

#file-input {
  display: none;
}

.drop-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 82px;
  border: 2px solid var(--accent);
  border-radius: 7px;
  background: #ffffff;
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 820;
  letter-spacing: 0;
  box-shadow: 0 12px 26px rgba(40, 94, 143, 0.14);
}

.drop-icon::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  border-radius: 0 5px 0 5px;
  background: #dfeef7;
}

.drop-main {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 720;
  color: #213044;
}

.drop-sub {
  color: var(--muted);
  font-size: 13px;
}

.file-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(29, 122, 80, 0.28);
  background: linear-gradient(180deg, rgba(239, 250, 245, 0.96), rgba(246, 252, 249, 0.96));
}

.file-card strong {
  display: block;
  word-break: break-all;
  color: #173528;
}

.file-card span {
  display: block;
  margin-top: 4px;
  color: #557060;
  font-size: 13px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head h2 {
  color: #152437;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 720;
}

.panel-head p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

select,
.outline-row input {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

select {
  height: 36px;
  padding: 0 9px;
}

.primary-btn,
.ghost-btn,
.download-btn,
.danger-btn {
  border-radius: 6px;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  font-weight: 650;
}

.primary-btn,
.download-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(40, 94, 143, 0.18);
}

.primary-btn:hover,
.download-btn:hover {
  background: var(--accent-dark);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.ghost-btn {
  background: #fff;
  border-color: rgba(40, 94, 143, 0.34);
  color: var(--accent-dark);
}

.ghost-btn:hover {
  background: #eef7fb;
}

.danger-btn {
  min-width: 36px;
  padding: 0 10px;
  background: #fff;
  border-color: rgba(180, 35, 24, 0.28);
  color: var(--danger);
  font-size: 12px;
}

.danger-btn:hover {
  background: #fff5f4;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.font-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13px;
}

.font-table th,
.font-table td {
  border-bottom: 1px solid #e6edf4;
  padding: 11px 12px;
  text-align: left;
}

.font-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8fb;
  color: #607187;
  font-size: 12px;
  font-weight: 720;
}

.font-table tr:last-child td {
  border-bottom: 0;
}

.font-table tbody tr:hover td {
  background: #f8fbfd;
}

.role {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: #eef2f6;
  color: #4a5b70;
  font-size: 12px;
  font-weight: 650;
}

.role.heading {
  background: #e6f4f6;
  color: #0f6870;
}

.role.body {
  background: #fff3d7;
  color: var(--warn);
}

.outline-list {
  max-height: 560px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.outline-row {
  display: grid;
  grid-template-columns: 86px minmax(180px, 1fr) 88px 42px;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border-bottom: 1px solid #e6edf4;
}

.outline-row:nth-child(odd) {
  background: #fbfdfe;
}

.outline-row:hover {
  background: #f4f9fc;
}

.outline-row:last-child {
  border-bottom: 0;
}

.outline-row input {
  min-width: 0;
  height: 36px;
  padding: 0 10px;
}

.outline-row .page-input {
  text-align: right;
}

.done-box {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 4px 0;
}

.done-box h2 {
  color: #173528;
}

.done-box p {
  color: var(--muted);
}

.download-btn {
  min-height: 40px;
  padding-inline: 18px;
}

.status-panel {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  color: #53667c;
  font-size: 13px;
  box-shadow: var(--shadow-soft);
}

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(19, 122, 127, 0.12);
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1120px);
    padding-top: 18px;
  }

  .topbar,
  .panel-head,
  .file-card {
    align-items: stretch;
    flex-direction: column;
  }

  .brand-block {
    align-items: flex-start;
  }

  .runtime-pill {
    align-self: flex-start;
  }

  h1 {
    font-size: 26px;
  }

  .steps {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel {
    padding: 16px;
  }

  .drop-zone {
    min-height: 240px;
  }

  .outline-row {
    grid-template-columns: 76px 1fr;
  }

  .outline-row .page-input,
  .outline-row .danger-btn {
    grid-column: auto;
  }
}
