:root {
  color-scheme: dark;
  --void: #030708;
  --ink: #e8f5f3;
  --muted: #97acaa;
  --muted-2: #6f8584;
  --panel: rgba(5, 15, 17, 0.94);
  --panel-raised: rgba(7, 21, 23, 0.96);
  --line: rgba(42, 211, 219, 0.18);
  --line-strong: rgba(42, 211, 219, 0.42);
  --cyan: #47e6ee;
  --cyan-soft: #91f5f7;
  --green: #5ce0ae;
  --green2: #3dcf9c;
  --blue: #6b97ff;
  --amber: #f2c76d;
  --red: #f07878;
  --grid: rgba(40, 203, 211, 0.075);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --sans: "Noto Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--void); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 16% -8%, rgba(23, 131, 139, 0.2), transparent 32rem),
    radial-gradient(circle at 88% 14%, rgba(22, 88, 113, 0.15), transparent 30rem),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--void);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(180deg, rgba(49, 239, 240, 0.035), transparent 18rem);
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}

.agent-body {
  position: relative;
  isolation: isolate;
  animation: agent-grid-drift 28s ease-in-out infinite alternate;
}

.agent-body::before {
  z-index: -1;
  inset: -18%;
  opacity: .62;
  background:
    linear-gradient(112deg, transparent 30%, rgba(47, 227, 218, .025) 38%, rgba(71, 230, 238, .13) 48%, rgba(102, 151, 255, .07) 54%, transparent 66%);
  filter: blur(18px);
  mask-image: none;
  mix-blend-mode: screen;
  animation: agent-light-sweep 15s cubic-bezier(.45,.05,.22,.96) infinite alternate;
}

.agent-body::after {
  position: fixed;
  z-index: -1;
  inset: -14vw;
  content: "";
  pointer-events: none;
  opacity: .72;
  background:
    radial-gradient(circle at 20% 26%, rgba(37, 205, 185, .13), transparent 22%),
    radial-gradient(circle at 78% 34%, rgba(48, 128, 166, .12), transparent 25%),
    radial-gradient(ellipse at 54% 88%, rgba(24, 112, 106, .1), transparent 30%);
  filter: blur(12px);
  transform: translate3d(-1.5%, -1%, 0) scale(1.02);
  animation: agent-aurora-drift 22s ease-in-out infinite alternate;
}

@keyframes agent-grid-drift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to { background-position: 44px 18px, -34px 26px, 0 44px, 44px 0, 0 0; }
}

@keyframes agent-light-sweep {
  from { opacity: .28; transform: translate3d(-28%, -4%, 0) rotate(-2deg); }
  to { opacity: .74; transform: translate3d(27%, 3%, 0) rotate(2deg); }
}

@keyframes agent-aurora-drift {
  0% { opacity: .52; transform: translate3d(-2.5%, -1.5%, 0) scale(1.01); }
  48% { opacity: .76; transform: translate3d(1.5%, 1%, 0) scale(1.055); }
  100% { opacity: .62; transform: translate3d(3.5%, -1%, 0) scale(1.025); }
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 50;
  left: 16px;
  top: -60px;
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--cyan);
  color: #021012;
  font-weight: 800;
  transition: top 150ms ease;
}
.skip-link:focus { top: 16px; }

.agent-shell {
  width: min(1560px, calc(100% - 40px));
  margin: 22px auto 40px;
  animation: agent-rise 480ms cubic-bezier(.2,.8,.2,1) both;
}

@keyframes agent-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.agent-commandbar, .agent-panel, .intake-topbar {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.025);
}

.agent-commandbar::before, .agent-panel::before, .intake-topbar::before {
  position: absolute;
  top: 0;
  right: 8%;
  left: 8%;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(79, 234, 239, .7), transparent);
}

.agent-commandbar {
  min-height: 126px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 24px 28px;
  border-radius: 12px;
}

.agent-brand { display: flex; min-width: 0; align-items: center; gap: 17px; color: inherit; text-decoration: none; }
.agent-brand.compact { gap: 12px; }
.agent-brand.compact .agent-mark { width: 44px; height: 44px; }
.agent-brand.compact small { display: block; color: var(--cyan); font: 700 10px/1.2 var(--mono); letter-spacing: .18em; }
.agent-brand.compact strong { display: block; margin-top: 4px; font-size: 18px; }

.agent-mark {
  display: grid;
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  place-items: center;
  border: 1px solid rgba(80, 229, 234, .42);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(28, 81, 86, .22), rgba(0,0,0,.2));
  color: var(--cyan-soft);
  box-shadow: inset 0 0 28px rgba(46, 211, 219, .06), 0 0 28px rgba(46, 211, 219, .06);
}
.agent-mark svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.3; }

.agent-kicker, .agent-section-label {
  color: var(--cyan);
  font: 700 11px/1.2 var(--mono);
  letter-spacing: .19em;
  text-transform: uppercase;
}

.agent-brand h1 { margin: 7px 0 2px; font-size: clamp(26px, 3vw, 42px); line-height: 1; letter-spacing: -.035em; }
.agent-brand p { margin: 8px 0 0; color: var(--muted-2); font: 600 10px/1 var(--mono); letter-spacing: .19em; }

.agent-command-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 10px; }
.credit-balance { min-height: 38px; display: inline-flex; flex: 0 0 auto; align-items: baseline; gap: 7px; border-right: 1px solid rgba(71,230,238,.18); padding: 0 15px 0 2px; white-space: nowrap; }
.credit-balance small { color: #718786; font: 700 10px/1 var(--mono); letter-spacing: .06em; }
.credit-balance strong { color: var(--cyan-soft); font: 800 16px/1 var(--mono); font-variant-numeric: tabular-nums; }
.credit-balance[data-state="error"] strong { color: #6d7f7e; }

.service-state, .agent-identity {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(92, 224, 174, .26);
  border-radius: 7px;
  background: rgba(46, 123, 94, .1);
  padding: 7px 12px;
  color: #a1b6b4;
  white-space: nowrap;
}
.service-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px rgba(92,224,174,.85); }
.service-state strong { color: var(--green); font: 800 12px var(--mono); }
.service-state-degraded { border-color: rgba(242,199,109,.28); background: rgba(122,84,29,.12); }
.service-state-degraded i { background: var(--amber); box-shadow: 0 0 14px rgba(242,199,109,.72); }
.service-state-degraded strong { color: var(--amber); }
.agent-identity { display: grid; gap: 1px; border-color: var(--line); background: rgba(0,0,0,.22); color: var(--ink); line-height: 1.2; }
.agent-identity small { color: var(--muted); font: 700 9px var(--mono); letter-spacing: .16em; }

.agent-button, .actions a, .actions button, .button-link, .reader-controls button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 14px;
  text-decoration: none;
  cursor: pointer;
  font-weight: 750;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}
.agent-button:hover, .actions a:hover, .actions button:hover, .button-link:hover, .reader-controls button:hover { transform: translateY(-1px); }
.agent-button:disabled, .actions button:disabled { cursor: wait; opacity: .45; transform: none; }
.agent-button-primary { border-color: rgba(108, 155, 255, .75); background: linear-gradient(135deg, #658df3, #4772da); color: #020912; box-shadow: 0 9px 28px rgba(71,114,218,.23); }
.agent-button-primary:hover { background: linear-gradient(135deg, #78a0ff, #547fe7); }
.agent-button-secondary { border-color: rgba(82, 229, 234, .3); background: rgba(39, 155, 163, .15); color: var(--cyan-soft); }
.agent-button-ghost { border-color: rgba(255,255,255,.12); background: rgba(0,0,0,.22); color: #d6e0df; }
.agent-button-danger { border-color: rgba(240,120,120,.55); background: rgba(153,43,50,.25); color: #ffc8c8; }
.agent-button-wide { width: 100%; }

.agent-overview {
  display: grid;
  grid-template-columns: minmax(340px, .72fr) minmax(680px, 1.65fr);
  gap: 18px;
  margin-top: 18px;
}

.agent-panel { border-radius: 11px; padding: 22px; }
.agent-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.agent-panel-head h2, .delivery-title h2 { margin: 7px 0 0; font-size: 23px; line-height: 1.12; letter-spacing: -.025em; }
.agent-panel-head p { max-width: 620px; margin: 8px 0 0; color: var(--muted); }
.agent-index { color: rgba(73,228,234,.23); font: 800 28px/1 var(--mono); }
.agent-panel-copy { margin: -6px 0 18px; color: var(--muted); }
.composer-flow { display: grid; gap: 10px; margin-bottom: 12px; }
.composer-step { border: 1px solid var(--line); border-radius: 9px; background: rgba(0,4,5,.45); }
.composer-step-link { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 13px 14px; color: inherit; text-decoration: none; transition: border-color 140ms ease, background 140ms ease, transform 140ms ease; }
.composer-step-link:hover { transform: translateY(-1px); border-color: rgba(71,230,238,.48); background: rgba(23,104,109,.13); }
.composer-step-current { border-color: rgba(107,151,255,.32); background: linear-gradient(150deg, rgba(38,67,123,.13), rgba(0,4,5,.4) 38%); padding: 13px 14px 14px; }
.composer-step-heading { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 13px; }
.composer-step-number { display: grid; width: 35px; height: 35px; place-items: center; border: 1px solid rgba(71,230,238,.28); border-radius: 50%; color: var(--cyan); font: 800 10px/1 var(--mono); letter-spacing: .08em; }
.composer-step-current .composer-step-number { border-color: rgba(107,151,255,.48); color: #9bb7ff; }
.composer-step-copy { display: grid; min-width: 0; gap: 1px; }
.composer-step-copy small { color: var(--muted); font: 700 9px/1.25 var(--mono); letter-spacing: .14em; }
.composer-step-copy strong { color: var(--ink); font-size: 14px; }
.composer-step-copy em { overflow: hidden; color: var(--muted); font-size: 11px; font-style: normal; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.composer-step-arrow { color: var(--cyan); font: 700 19px/1 var(--mono); }
.agent-field.composer-text-field { margin: 12px 0 0; }
.agent-field, label { display: grid; gap: 7px; margin: 13px 0; color: #a8b9b7; font-size: 12px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid rgba(69, 212, 219, .18);
  border-radius: 7px;
  background: rgba(0, 4, 5, .68);
  padding: 10px 11px;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
textarea { min-height: 180px; resize: vertical; line-height: 1.6; }
.composer textarea { min-height: 286px; }
input::placeholder, textarea::placeholder { color: #3e5051; }
input:hover, select:hover, textarea:hover { border-color: rgba(69,212,219,.32); }
input:focus, select:focus, textarea:focus { border-color: var(--cyan); background: rgba(0,9,10,.86); box-shadow: 0 0 0 3px rgba(71,230,238,.08); outline: none; }
select option { background: #071113; color: var(--ink); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
fieldset { margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
legend { padding: 0 7px; color: var(--cyan-soft); font-weight: 800; }
.check { display: inline-flex; align-items: center; margin: 5px 16px 5px 0; }
.check input, .confirm input { width: auto; accent-color: var(--cyan); }

.intake-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; margin: 16px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.intake-preview p { margin: 0; background: rgba(3,11,13,.96); padding: 10px 12px; color: #bbcac8; }
.intake-preview strong { color: var(--cyan-soft); }
.creation-settings-preview { margin: 16px 0; border: 1px solid rgba(242,199,109,.26); border-radius: 8px; background: rgba(122,84,29,.08); padding: 12px 13px; }
.creation-settings-preview-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.creation-settings-preview-heading h3 { margin: 0; color: #f7e2ab; font-size: 14px; }
.creation-settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.creation-settings-grid > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; color: #d4c6a1; font-size: 13px; }
.creation-settings-grid strong { flex: 0 0 auto; color: #9e957c; font-size: 11px; }
.creation-settings-grid span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f7e2ab; }
.creation-settings-logo { grid-column: 1 / -1; }
.creation-settings-logo img { width: 72px; height: 36px; flex: 0 0 auto; margin-left: auto; border: 1px solid rgba(242,199,109,.22); border-radius: 4px; background: rgba(0,0,0,.18); object-fit: contain; }
.creation-settings-note { margin: 10px 0 0; color: #9e957c; font-size: 11px; line-height: 1.55; }

details { margin: 15px 0; border-top: 1px solid var(--line); padding-top: 12px; }
summary { color: var(--cyan-soft); cursor: pointer; font-weight: 800; }
.confirm { display: flex; align-items: flex-start; gap: 9px; border: 1px solid rgba(242,199,109,.18); border-radius: 7px; background: rgba(122,84,29,.1); padding: 11px; color: #c5ba98; }
.confirm input { margin-top: 3px; }
.settings-logo-toggle { display: flex; align-items: center; gap: 9px; margin: 8px 0 14px; color: var(--ink); font-weight: 750; }
.settings-logo-toggle input { width: auto; margin: 0; accent-color: var(--cyan); }
#brand-logo-preview { display: grid; grid-template-columns: 160px minmax(0,1fr); align-items: center; gap: 12px; margin: 12px 0; }
#brand-logo-preview[hidden] { display: none; }
#brand-logo-image { display: block; width: 160px; height: 96px; object-fit: contain; object-position: left center; }
#brand-logo-preview p { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.settings-report-option { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.settings-report-option .settings-logo-toggle { margin-bottom: 5px; }
.settings-report-option p { margin: 0 0 2px 27px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.message { min-height: 23px; margin: 12px 0 0; color: var(--amber); }
.message:empty { min-height: 8px; }


.agent-metrics { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 12px; }
.agent-metrics > div { display: flex; align-items: center; justify-content: space-between; min-height: 46px; border: 1px solid var(--line); border-radius: 7px; background: rgba(0,0,0,.2); padding: 8px 11px; }
.agent-metrics span { color: var(--muted); font: 700 10px var(--mono); letter-spacing: .08em; }
.agent-metrics strong { color: var(--cyan-soft); font: 800 18px var(--mono); }
.queue-summary { min-height: 26px; color: var(--muted); font-size: 12px; }

.task-list { display: grid; gap: 9px; max-height: 560px; overflow: auto; padding-right: 4px; scrollbar-color: rgba(71,230,238,.3) transparent; }
.task-card { position: relative; overflow: hidden; border: 1px solid rgba(50,199,207,.13); border-radius: 8px; background: rgba(0,5,6,.44); padding: 14px; transition: border-color 140ms ease, background 140ms ease; }
.task-card:hover { border-color: rgba(71,230,238,.28); background: rgba(9,28,30,.55); }
.task-card::before { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; content: ""; background: var(--muted-2); }
.task-card.is-running::before { background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.task-card.is-queued::before { background: var(--amber); }
.task-card.is-failed::before { background: var(--red); }
.task-primary { display: grid; grid-template-columns: minmax(130px,1fr) minmax(180px,1.2fr) auto; gap: 14px; align-items: center; }
.task-student { min-width: 0; }
.task-student strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.task-student span, .task-meta { color: var(--muted); font: 10px/1.5 var(--mono); }
.task-stage { min-width: 0; }
.task-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #b9c7c6; font-size: 12px; }
.task-stage-head b { color: var(--cyan-soft); font: 700 11px var(--mono); }

progress.progress { width: 100%; height: 5px; display: block; overflow: hidden; margin-top: 8px; border: 0; border-radius: 99px; background: #102023; appearance: none; }
progress.progress::-webkit-progress-bar { background: #102023; }
progress.progress::-webkit-progress-value { background: linear-gradient(90deg, #3f7fdb, var(--cyan)); border-radius: 99px; }
progress.progress::-moz-progress-bar { background: linear-gradient(90deg, #3f7fdb, var(--cyan)); border-radius: 99px; }

.status-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 70px; border: 1px solid rgba(255,255,255,.12); border-radius: 5px; padding: 5px 8px; font: 750 10px var(--mono); letter-spacing: .06em; }
.status-queued { border-color: rgba(242,199,109,.32); background: rgba(159,104,28,.12); color: var(--amber); }
.status-running { border-color: rgba(107,151,255,.38); background: rgba(58,88,164,.14); color: #9bb6ff; }
.status-published { border-color: rgba(92,224,174,.32); background: rgba(37,133,96,.12); color: var(--green); }
.status-failed { border-color: rgba(240,120,120,.36); background: rgba(150,47,54,.13); color: #ffaaaa; }
.failure { margin: 10px 0 0; border: 1px solid rgba(240,120,120,.18); border-radius: 6px; background: rgba(137,37,43,.1); padding: 8px 10px; color: #eaa0a0; font-size: 12px; }
.task-primary > .failure, .task-primary > .actions { grid-column: 1 / -1; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.actions a, .actions button { min-height: 32px; border-color: rgba(255,255,255,.12); background: rgba(0,0,0,.28); padding: 6px 9px; color: #c7d5d4; font-size: 11px; }
.actions a:hover, .actions button:hover { border-color: rgba(71,230,238,.4); color: var(--cyan-soft); }
.actions .delete { border-color: rgba(240,120,120,.22); color: #e99b9b; }
.actions .delete:hover { border-color: rgba(240,120,120,.55); color: #ffc0c0; }

.empty-state { min-height: 170px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted-2); text-align: center; }
.empty-state strong { display: block; margin-bottom: 4px; color: #708586; }

.delivery { margin-top: 18px; }
.report-library { min-width: 0; margin-top: 0; }
.delivery-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 16px; }
.delivery-title { display: flex; align-items: center; gap: 10px; }
.delivery-head p { margin: 7px 0 0; color: var(--muted); }
.delivery-tools { display: flex; align-items: flex-end; gap: 16px; }
.count-chip { border: 1px solid rgba(92,224,174,.3); border-radius: 5px; background: rgba(44,154,113,.12); padding: 2px 8px; color: var(--green); font: 800 11px var(--mono); }
.report-search { width: min(320px, 100%); margin: 0; }
.report-search input { height: 42px; padding-left: 14px; }
.report-table-head, .report-row { display: grid; grid-template-columns: minmax(0,1fr) 132px minmax(250px,auto); gap: 16px; align-items: center; }
.report-table-head { border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; background: rgba(33,118,124,.08); padding: 8px 28px 8px 13px; color: var(--muted); font: 700 10px var(--mono); letter-spacing: .07em; }
.report-condition-head, .report-student { display: grid; min-width: 0; grid-template-columns: 120px 42px 52px 72px 78px minmax(0,1fr); align-items: center; gap: 10px; }
.report-condition-head > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-list { overflow: hidden; border: 1px solid var(--line); border-radius: 0 0 8px 8px; }
.report-library .report-list { max-height: 610px; overflow-y: auto; scrollbar-color: rgba(71,230,238,.3) transparent; scrollbar-gutter: stable; }
.report-row { min-height: 64px; border-bottom: 1px solid rgba(46,188,196,.09); padding: 10px 13px; transition: background 140ms ease, box-shadow 140ms ease; }
.report-row:last-child { border-bottom: 0; }
.report-row:hover, .report-row:focus-within { background: rgba(52,187,194,.055); box-shadow: inset 2px 0 0 rgba(71,230,238,.38); }
.report-row:focus-visible { outline: 1px solid rgba(71,230,238,.5); outline-offset: -2px; }
.report-student { overflow: hidden; }
.report-student-name, .report-profile-value, .report-major-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.report-student-name { font-size: 15px; }
.report-profile-value { color: #adc1bf; font: 600 11px/1.5 var(--mono); }
.report-major-summary { color: var(--muted); font: 11px/1.5 var(--mono); }
.report-status { display: inline-flex; align-items: center; justify-content: center; width: fit-content; border: 1px solid rgba(240,120,120,.36); border-radius: 5px; background: rgba(150,47,54,.13); padding: 4px 8px; color: #ffaaaa; font: 750 10px/1.3 var(--mono); letter-spacing: .06em; }
.report-status.status-queued { border-color: rgba(242,199,109,.32); background: rgba(159,104,28,.12); color: var(--amber); }
.report-status.status-running { border-color: rgba(107,151,255,.38); background: rgba(58,88,164,.14); color: #9bb6ff; }
.report-status.status-published { border-color: rgba(92,224,174,.32); background: rgba(37,133,96,.12); color: var(--green); }
.report-status-block { display: grid; min-width: 0; justify-items: start; gap: 4px; }
.report-status-block small { max-width: 100%; color: var(--muted); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; white-space: normal; }
.report-row.is-queued { box-shadow: inset 2px 0 0 rgba(242,199,109,.34); }
.report-row.is-running { box-shadow: inset 2px 0 0 rgba(107,151,255,.5); }
.report-row.is-failed { box-shadow: inset 2px 0 0 rgba(240,120,120,.42); }
.report-profile-card { position: fixed; z-index: 80; display: none; width: min(520px,calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; border: 1px solid rgba(71,230,238,.32); border-radius: 9px; background: rgba(5,18,20,.985); padding: 15px 16px; color: var(--ink); pointer-events: auto; scrollbar-color: rgba(71,230,238,.38) transparent; box-shadow: 0 22px 65px rgba(0,0,0,.52), 0 0 0 1px rgba(10,40,42,.7); }
.report-profile-card.is-visible { display: block; }
.report-profile-card > strong { display: block; margin-bottom: 11px; color: var(--cyan-soft); font-size: 13px; }
.report-profile-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin: 0; }
.report-profile-card dl > div { min-width: 0; }
.report-profile-card dt { margin-bottom: 2px; color: var(--muted); font: 700 10px/1.4 var(--mono); letter-spacing: .04em; }
.report-profile-card dd { margin: 0; color: #dbe9e7; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.report-profile-card .report-profile-wide { grid-column: 1 / -1; border-top: 1px solid rgba(46,188,196,.1); padding-top: 9px; }
.report-time { color: var(--muted); font: 11px/1.5 var(--mono); }
.report-row .actions { flex-wrap: nowrap; }
.report-list > .empty-state { border: 0; border-radius: 0; }

.queue-compact { margin-top: 18px; padding: 14px 18px; }
.queue-compact-head { display: grid; grid-template-columns: minmax(320px,1fr) auto; align-items: center; gap: 24px; }
.queue-compact-title { display: grid; grid-template-columns: auto auto minmax(160px,1fr); align-items: baseline; gap: 12px; }
.queue-compact-title h2 { margin: 0; font-size: 17px; line-height: 1; }
.queue-compact .queue-summary { min-height: 0; margin: 0; }
.queue-compact .agent-metrics { grid-template-columns: repeat(4, minmax(84px,1fr)); margin: 0; }
.queue-compact .agent-metrics > div { min-height: 38px; padding: 6px 9px; }
.queue-compact .agent-metrics strong { font-size: 15px; }
.queue-compact .task-list:not(:empty) { grid-template-columns: repeat(auto-fit, minmax(430px,1fr)); max-height: 300px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.queue-compact.is-idle { background: rgba(4,13,15,.82); box-shadow: 0 14px 42px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.02); }
.queue-compact.is-idle .queue-summary { color: #597071; }
.queue-compact.is-idle .task-list { display: none; }

.delivery-queue { padding: 18px 20px; }
.delivery-queue .queue-compact-head { grid-template-columns: minmax(320px, .85fr) minmax(620px, 1.15fr); }
.delivery-queue .queue-compact-title { grid-template-columns: auto auto minmax(190px,1fr); }
.delivery-queue-metrics { display: grid; grid-template-columns: .72fr 1fr 1fr; gap: 8px; }
.delivery-queue-metrics > div {
  display: grid;
  min-height: 58px;
  align-content: center;
  gap: 3px;
  border: 1px solid rgba(71,230,238,.16);
  border-radius: 8px;
  background: rgba(2,10,12,.42);
  padding: 8px 13px;
}
.delivery-queue-metrics > div.is-primary { border-color: rgba(92,224,174,.3); background: rgba(31,112,83,.1); }
.delivery-queue-metrics span { color: var(--muted); font: 700 10px/1.3 var(--mono); letter-spacing: .08em; }
.delivery-queue-metrics strong { color: var(--cyan-soft); font-size: 14px; line-height: 1.35; }
.delivery-queue-metrics .is-primary strong { color: #a8f2d2; }
.delivery-queue .delivery-task-list:not(:empty) { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px,1fr)); gap: 9px; max-height: 300px; margin-top: 14px; border-top: 1px solid var(--line); overflow: auto; padding-top: 14px; }
.delivery-queue-card { display: grid; grid-template-columns: minmax(130px,.55fr) minmax(360px,1.45fr); align-items: center; gap: 18px; border: 1px solid rgba(50,199,207,.14); border-radius: 9px; background: rgba(4,14,16,.5); padding: 13px 15px; }
.delivery-queue-card.is-failed { border-color: rgba(240,120,120,.32); background: rgba(137,37,43,.12); }
.delivery-queue-student { display: grid; min-width: 0; gap: 3px; }
.delivery-queue-student span { color: #607a7b; font: 700 9px/1.3 var(--mono); letter-spacing: .11em; }
.delivery-queue-card.is-failed .delivery-queue-student span { color: #ffaaaa; }
.delivery-queue-student strong { overflow: hidden; color: var(--ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.delivery-queue-failure { min-width: 0; }
.delivery-queue-failure > strong { display: block; color: #ffd0d0; font-size: 12px; }
.delivery-queue-failure p { max-height: 4.5em; overflow: auto; margin: 5px 0 0; color: #eaa0a0; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.delivery-queue-details { display: grid; grid-template-columns: .7fr 1fr 1fr; gap: 8px; margin: 0; }
.delivery-queue-details > div { min-width: 0; border-left: 1px solid rgba(71,230,238,.12); padding-left: 12px; }
.delivery-queue-details dt { color: var(--muted); font: 700 9px/1.4 var(--mono); letter-spacing: .07em; }
.delivery-queue-details dd { margin: 3px 0 0; overflow: hidden; color: #c5d7d5; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.delivery-queue-details .is-primary dd { color: #a8f2d2; }

.agent-footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 4px 0; color: #354849; font: 700 9px var(--mono); letter-spacing: .13em; }

.agent-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 11px; background: #071012; padding: 24px; color: var(--ink); box-shadow: 0 30px 100px #000b; }
.agent-dialog::backdrop { background: rgba(0,5,6,.78); backdrop-filter: blur(5px); }
.agent-dialog h2 { margin: 8px 0 12px; }
.delete-dialog { border-color: rgba(240,120,120,.3); }
.agent-dialog .danger-copy { border-left: 2px solid var(--red); background: rgba(139,37,43,.1); padding: 10px 12px; color: #d99898; }
.settings-dialog { width: min(680px, calc(100% - 32px)); }
.intake-confirm-dialog { width: min(780px, calc(100% - 32px)); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.dialog-heading h2 { margin-bottom: 5px; font-size: 25px; line-height: 1.15; }
.dialog-heading p { max-width: 590px; margin: 0; color: var(--muted); font-size: 13px; }
.dialog-close { width: 36px; height: 36px; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.1); border-radius: 7px; background: rgba(0,0,0,.24); color: var(--muted); cursor: pointer; font-size: 23px; line-height: 1; }
.dialog-close:hover { border-color: var(--line-strong); color: var(--ink); }
.settings-logo-panel { margin-bottom: 0; background: rgba(0,0,0,.13); }
.settings-rule-panel { margin-bottom: 16px; }
.settings-rule-panel .settings-logo-toggle { margin-bottom: 5px; }
.settings-rule-panel p { margin: 0 0 2px 27px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.intake-confirm-dialog .intake-preview { margin-top: 20px; }
.intake-confirm-dialog .intake-preview p:nth-last-child(-n+2) { grid-column: 1 / -1; }
.report-charge-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 1px solid rgba(242,199,109,.26); border-radius: 8px; background: rgba(122,84,29,.1); padding: 11px 13px; }
.report-charge-summary > span { display: flex; align-items: baseline; gap: 10px; }
.report-charge-summary small { color: #9e957c; font: 700 10px/1 var(--mono); letter-spacing: .08em; }
.report-charge-summary strong { color: #f7e2ab; font-size: 14px; }
.report-charge-summary em { flex: 0 0 auto; border-left: 1px solid rgba(242,199,109,.26); padding-left: 12px; color: var(--amber); font: 800 10px/1 var(--mono); font-style: normal; letter-spacing: .08em; }
.high-cost-warning { display: grid; gap: 7px; margin-top: 16px; border: 1px solid rgba(240,120,120,.35); border-left: 3px solid var(--red); border-radius: 8px; background: rgba(139,37,43,.12); padding: 12px 13px; }
.high-cost-warning[hidden] { display: none; }
.high-cost-warning > strong { color: #ffb2a9; font-size: 15px; }
.high-cost-warning > p { margin: 0; color: #d8aaa5; font-size: 12px; line-height: 1.55; }
.high-cost-warning .confirm { margin-top: 2px; border-color: rgba(240,120,120,.22); background: rgba(139,37,43,.16); color: #f0c5c0; }
.intake-confirm-dialog .confirm { margin-top: 16px; }
#confirm-create-report:disabled { cursor: not-allowed; border-color: rgba(91,111,134,.34); background: linear-gradient(135deg, #34404d, #293541); color: #71818f; box-shadow: none; opacity: .72; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.dialog-actions .agent-button-primary { min-width: 154px; }

.hidden, .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; }
.hidden { display: none !important; }

/* Structured intake */
.intake-topbar { width: min(1120px, calc(100% - 40px)); min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 22px auto 0; border-radius: 11px; padding: 14px 18px; }
.topnav { display: flex; align-items: center; gap: 10px; }
.intake-shell { width: min(1120px, calc(100% - 40px)); margin: 18px auto 40px; }
.direct-intake { padding: 26px; }
.direct-intake form { margin-top: 12px; }
.direct-intake select[multiple] { min-height: 210px; }

/* Reader */
.reader-body {
  height: 100vh;
  min-height: 540px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(45, 93, 95, .23), transparent 43%),
    linear-gradient(180deg, #071113 0%, #020607 68%, #010303 100%);
}
.reader-body::after {
  position: fixed;
  z-index: 0;
  inset: 70px 0 0;
  content: "";
  pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0 74px, rgba(255,255,255,.012) 75px 76px);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.45), transparent 80%);
}
.reader-toolbar {
  position: relative;
  z-index: 20;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(170px, .8fr) minmax(220px, 1.3fr) minmax(520px, auto);
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(94, 231, 235, .2);
  background: rgba(2, 9, 11, .92);
  padding: 10px 18px;
  box-shadow: 0 16px 50px rgba(0,0,0,.38);
  backdrop-filter: blur(18px);
}
.reader-leading, .reader-controls { display: flex; align-items: center; gap: 7px; }
.reader-toolbar .back { color: var(--cyan-soft); text-decoration: none; font-weight: 800; white-space: nowrap; }
.reader-icon-button, .toc-heading button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(23,65,68,.22);
  color: var(--cyan-soft);
  cursor: pointer;
}
#toc-toggle { display: none; min-height: 36px; padding: 6px 10px; }
.reader-title-block { min-width: 0; display: flex; justify-content: center; }
.reader-artifact-switcher { max-width: 100%; display: inline-flex; align-items: center; gap: 3px; overflow-x: auto; border: 1px solid rgba(71,230,238,.18); border-radius: 8px; background: rgba(0,0,0,.28); padding: 3px; scrollbar-width: none; }
.reader-artifact-switcher::-webkit-scrollbar { display: none; }
.reader-artifact-tab { min-height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 5px; padding: 5px 12px; color: #93aaa8; text-decoration: none; font: 700 12px/1 var(--sans); white-space: nowrap; transition: border-color 140ms ease, background 140ms ease, color 140ms ease; }
.reader-artifact-tab:hover { border-color: rgba(71,230,238,.28); color: var(--cyan-soft); }
.reader-artifact-tab[aria-current="page"] { border-color: rgba(71,230,238,.5); background: rgba(38,130,135,.22); color: var(--cyan-soft); box-shadow: inset 0 0 18px rgba(71,230,238,.06); cursor: default; }
.reader-controls { justify-content: flex-end; }
.reader-controls button, .reader-controls .button-link {
  min-height: 36px;
  border-color: rgba(255,255,255,.12);
  background: rgba(0,0,0,.28);
  padding: 6px 10px;
  color: #d6e0df;
  white-space: nowrap;
}
.reader-controls button:hover, .reader-controls .button-link:hover { border-color: var(--line-strong); color: var(--cyan-soft); }
.reader-controls button:disabled { cursor: default; opacity: .3; transform: none; }
.reader-controls button[aria-pressed="true"] { border-color: rgba(71,230,238,.46); background: rgba(38,130,135,.18); color: var(--cyan-soft); }
.reader-page-jump { display: flex; align-items: center; gap: 5px; margin: 0; color: var(--muted); }
.reader-controls input { width: 56px; height: 36px; padding: 6px; text-align: center; }
.reader-layout { position: relative; z-index: 1; height: calc(100vh - 70px); display: grid; grid-template-columns: 276px minmax(0,1fr); }
.toc {
  position: relative;
  z-index: 12;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(5,17,19,.98), rgba(2,8,10,.98));
  padding: 22px 18px 34px;
  box-shadow: 16px 0 45px rgba(0,0,0,.2);
}
.toc-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.toc-heading button { display: none; width: 32px; height: 32px; font-size: 20px; }
.toc h2 { margin: 6px 0 11px; border-bottom: 1px solid var(--line); padding-bottom: 9px; font-size: 15px; }
.toc nav { display: grid; margin-bottom: 24px; }
.toc-front-matter { display: grid; gap: 3px; padding-bottom: 14px; }
.toc-section {
  position: relative;
  display: grid;
  gap: 6px;
  border-top: 1px solid rgba(71,230,238,.16);
  padding: 16px 0 18px;
}
.toc-section::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 38px;
  height: 1px;
  background: rgba(71,230,238,.62);
  box-shadow: 0 0 10px rgba(71,230,238,.18);
}
.toc-section-items { display: grid; gap: 3px; padding-left: 7px; }
.toc nav button {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: none;
  padding: 8px 7px;
  color: #879d9c;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.toc nav .toc-item .toc-page-number { color: var(--muted-2); font: 700 9px/1.5 var(--mono); }
.toc nav .toc-item strong { font: 600 12px/1.45 var(--sans); }
.toc nav button:hover, .toc nav button.active { border-color: rgba(71,230,238,.2); background: rgba(47,141,146,.1); color: var(--cyan-soft); }
.toc nav .toc-chapter {
  grid-template-columns: 31px minmax(0,1fr) 24px;
  align-items: center;
  gap: 9px;
  border-radius: 7px;
  padding: 10px 7px;
  color: #b8cac8;
  background: linear-gradient(90deg, rgba(38,130,135,.08), transparent 82%);
}
.toc-chapter-number { color: rgba(71,230,238,.78); font: 800 13px/1 var(--mono); letter-spacing: .04em; }
.toc-chapter-copy { min-width: 0; display: grid; gap: 3px; }
.toc-chapter-copy small { color: #4f6b6a; font: 700 7px/1 var(--mono); letter-spacing: .18em; }
.toc-chapter-copy strong { overflow: hidden; font: 700 12px/1.35 var(--sans); text-overflow: ellipsis; white-space: nowrap; }
.toc-chapter-page { color: #58706f; font: 700 9px/1 var(--mono); text-align: right; }
.toc-section.current > .toc-chapter { color: var(--cyan-soft); }
.toc-section.current > .toc-chapter .toc-chapter-copy small,
.toc-section.current > .toc-chapter .toc-chapter-page { color: #668986; }
.reader-body.reader-without-toc .reader-layout { grid-template-columns: 1fr; }
.reader-body.reader-without-toc .toc { display: none; }
.book {
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: minmax(0,1fr) auto;
  align-items: center;
  justify-items: center;
  padding: 24px 28px 14px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(73,116,116,.18), transparent 44%),
    linear-gradient(180deg, rgba(9,18,20,.3), rgba(1,4,5,.72));
  perspective: 2400px;
}
.reader-stage { position: relative; width: min(100%, 1540px); height: 100%; min-height: 0; overflow: hidden; display: grid; place-items: center; transition: opacity 180ms ease; }
.reader-zoom-surface {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform: translate3d(var(--reader-pan-x, 0), var(--reader-pan-y, 0), 0) scale(var(--reader-zoom, 1));
  transform-origin: 50% 50%;
  transition: transform 130ms cubic-bezier(.2,.72,.2,1);
  will-change: transform;
}
.reader-stage .flip-page { cursor: zoom-in; }
.reader-stage.is-zoomed { touch-action: none; }
.reader-stage.is-zoomed .flip-page { cursor: grab; }
.reader-stage.is-dragging .reader-zoom-surface { transition: none; }
.reader-stage.is-dragging .flip-page,
.reader-stage.is-dragging .flip-page-image { cursor: grabbing; }
.reader-zoom-hud {
  position: absolute;
  z-index: 20;
  top: 50%;
  right: 10px;
  width: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transform: translateY(-50%);
  border: 1px solid rgba(71,230,238,.28);
  border-radius: 12px;
  background: rgba(3,12,14,.9);
  padding: 9px 7px 8px;
  box-shadow: 0 12px 34px rgba(0,0,0,.42), inset 0 1px rgba(255,255,255,.035);
  color: var(--cyan-soft);
  backdrop-filter: blur(14px);
}
.reader-zoom-heading { color: #d9e8e6; font: 800 11px/1.2 var(--sans); letter-spacing: .04em; }
.reader-zoom-hud output { min-width: 48px; color: var(--cyan-soft); text-align: center; font: 800 13px/1 var(--mono); }
.reader-zoom-hud button {
  width: 74px;
  min-height: 32px;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  padding: 5px 6px;
  color: #bad0ce;
  cursor: pointer;
  font: 800 11px/1.1 var(--sans);
  text-align: left;
}
.reader-zoom-hud button span:first-child { color: var(--cyan-soft); font: 800 16px/1 var(--mono); text-align: center; }
.reader-zoom-hud button:hover { border-color: rgba(71,230,238,.34); background: rgba(71,230,238,.09); color: var(--cyan-soft); }
.reader-zoom-hud button:disabled { cursor: default; opacity: .38; transform: none; }
.reader-zoom-hud input[type="range"] { width: 72px; accent-color: #47e6ee; cursor: pointer; }
.reader-zoom-hud small { color: #809694; font: 700 9px/1.35 var(--sans); text-align: center; }
.reader-page-controls {
  width: 74px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 7px;
}
.reader-page-controls button {
  width: 100%;
  min-height: 39px;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 1px;
  padding: 4px 1px;
  font-size: 9px;
  text-align: center;
}
.reader-page-controls button span:first-child { font-size: 15px; }
.flipbook-host { position: relative; z-index: 1; isolation: isolate; width: min(100%, var(--book-comfort-width, 1280px)); max-height: 100%; transform: translateX(0); transition: transform 260ms cubic-bezier(.22,.72,.22,1); }
.book.cover-centered:not(.single-mode) .flipbook-host { transform: translateX(var(--book-cover-shift, 0px)); }
.book.cover-centered .flipbook-host::before { opacity: 0 !important; }
.flipbook-host::before {
  position: absolute;
  z-index: 8;
  top: var(--book-page-top, 2%);
  left: var(--book-spine-left, 50%);
  width: 34px;
  height: var(--book-page-height, 96%);
  content: "";
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(28,25,21,.12) 20%, rgba(13,11,9,.46) 46%, rgba(255,255,255,.18) 50%, rgba(18,15,12,.36) 55%, transparent);
  filter: blur(.25px);
  transition: opacity 180ms ease;
  mix-blend-mode: multiply;
}
.book[data-orientation="landscape"]:not(.single-mode) .flipbook-host::before { opacity: .74; }
.reader-stage.is-flipping .flipbook-host::before { opacity: .42; }
.book-fore-edge {
  position: absolute;
  z-index: 1;
  top: 2px;
  bottom: 2px;
  pointer-events: none;
  opacity: 0;
  border: 1px solid rgba(119,115,106,.28);
  transition: opacity 80ms ease;
}
.book-fore-edge.is-positioned { opacity: 1; }
.book-fore-edge-right {
  right: auto;
  left: calc(100% - 1px);
  border-left: 0;
  border-radius: 0 4px 4px 0;
  background:
    linear-gradient(90deg, rgba(70,66,58,.22), rgba(255,255,255,.1) 18%, transparent 52%, rgba(92,88,79,.2)),
    repeating-linear-gradient(90deg, #f7f4ec 0, #f7f4ec 1px, #cecac1 1px, #cecac1 2px, #fffdf8 2px, #fffdf8 4px);
  box-shadow: 8px 2px 15px rgba(0,0,0,.43), inset 2px 0 3px rgba(78,73,65,.24), inset -2px 0 2px rgba(255,255,255,.74);
  transform: perspective(320px) rotateY(-4deg) scaleX(var(--book-fore-edge-turn-scale, 1));
  transform-origin: left center;
}
.book-fore-edge-left {
  right: calc(100% - 1px);
  left: auto;
  border-right: 0;
  border-radius: 4px 0 0 4px;
  background:
    linear-gradient(90deg, rgba(92,88,79,.2), transparent 48%, rgba(255,255,255,.1) 82%, rgba(70,66,58,.22)),
    repeating-linear-gradient(90deg, #fffdf8 0, #fffdf8 2px, #cecac1 2px, #cecac1 3px, #f7f4ec 3px, #f7f4ec 4px);
  box-shadow: -8px 2px 15px rgba(0,0,0,.43), inset -2px 0 3px rgba(78,73,65,.24), inset 2px 0 2px rgba(255,255,255,.74);
  transform: perspective(320px) rotateY(4deg) scaleX(var(--book-fore-edge-turn-scale, 1));
  transform-origin: right center;
}
.book-fore-edge::before,
.book-fore-edge::after { position: absolute; right: 1px; left: 0; height: 2px; content: ""; background: rgba(255,255,255,.78); }
.book-fore-edge::before { top: 1px; box-shadow: 0 1px rgba(101,96,87,.24); }
.book-fore-edge::after { bottom: 1px; box-shadow: 0 -1px rgba(101,96,87,.22); }
/* 翻页时厚度条由 reader.js 按翻页进度连续压缩；翻动页会自然覆盖它。 */
.book.single-mode .flipbook-host { width: min(100%, var(--book-comfort-width, 700px)); }
.book.single-mode .flipbook-host::before { display: none; }
.flipbook { position: relative; z-index: 2; margin: auto; transform-style: preserve-3d; filter: drop-shadow(0 25px 35px rgba(0,0,0,.48)); }
.flip-page {
  position: relative;
  overflow: hidden;
  background: #f7f4ed;
  color: #183032;
  box-shadow: inset 0 0 0 1px rgba(33,46,42,.12);
}
.flip-page::before {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  width: 9%;
  content: "";
  pointer-events: none;
  opacity: .68;
  mix-blend-mode: multiply;
}
.flip-page.page-left::before { right: 0; background: linear-gradient(90deg, transparent, rgba(25,22,18,.3)); }
.flip-page.page-right::before { left: 0; background: linear-gradient(90deg, rgba(25,22,18,.28), transparent); }
.reader-stage[data-turn-direction="next"] .flip-page.--left:not(.--simple),
.reader-stage[data-turn-direction="previous"] .flip-page.--right:not(.--simple) {
  filter: drop-shadow(12px 9px 12px rgba(0,0,0,.38)) drop-shadow(0 -7px 8px rgba(255,255,255,.16));
}
.reader-stage[data-turn-direction="next"] .flip-page.--left:not(.--simple)::after,
.reader-stage[data-turn-direction="previous"] .flip-page.--right:not(.--simple)::after {
  background:
    linear-gradient(84deg, rgba(255,255,255,.34), transparent 20%, transparent 58%, rgba(28,24,19,.28) 91%, rgba(255,255,255,.44));
  mix-blend-mode: multiply;
}
.flip-page::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.1), rgba(255,255,255,.11) 1px, transparent 4.5%, transparent 95.5%, rgba(255,255,255,.16) calc(100% - 1px), rgba(0,0,0,.075));
  mix-blend-mode: multiply;
}
.flip-page-image { width: 100%; height: 100%; display: block; object-fit: fill; opacity: 0; transition: opacity 180ms ease; }
.flip-page.is-rendered .flip-page-image { opacity: 1; }
.flip-page-detail-canvas {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  pointer-events: none;
}
.flip-page.has-zoom-detail .flip-page-detail-canvas { opacity: 1; }
.pdf-link-layer { position: absolute; z-index: 7; inset: 0; pointer-events: none; }
.pdf-internal-link {
  position: absolute;
  display: block;
  min-width: 18px;
  min-height: 14px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  padding: 0;
  pointer-events: auto;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}
.pdf-internal-link:hover,
.pdf-internal-link:focus-visible {
  border-color: rgba(71,230,238,.72);
  outline: none;
  background: rgba(71,230,238,.12);
  box-shadow: 0 0 0 2px rgba(71,230,238,.1), 0 3px 12px rgba(0,0,0,.18);
}
.pdf-internal-link:active { background: rgba(71,230,238,.2); }
.flip-page-placeholder { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: linear-gradient(145deg, #f7f5ef, #e9e4d8); color: #78908a; }
.binding-loader {
  position: relative;
  width: 58px;
  height: 43px;
  display: block;
  perspective: 170px;
  filter: drop-shadow(0 5px 4px rgba(49,65,60,.12));
}
.binding-loader::after {
  position: absolute;
  right: 5px;
  bottom: 0;
  left: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(48,78,73,.13);
  content: "";
  filter: blur(3px);
  transform: scaleX(.82);
}
.binding-page {
  position: absolute;
  z-index: 2;
  top: 4px;
  width: 27px;
  height: 34px;
  border: 1px solid rgba(50,105,103,.3);
  background:
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(50,105,103,.11) 7px 8px),
    linear-gradient(145deg, #fffdf7, #e8e2d6);
  box-shadow: inset 0 0 8px rgba(80,73,58,.08);
}
.binding-page-left {
  right: 50%;
  border-radius: 5px 1px 1px 4px;
  transform: rotateY(8deg) rotateZ(-1.5deg);
  transform-origin: right center;
}
.binding-page-right {
  left: 50%;
  border-radius: 1px 5px 4px 1px;
  transform: rotateY(-8deg) rotateZ(1.5deg);
  transform-origin: left center;
}
.binding-page-turning {
  z-index: 3;
  left: 50%;
  border-radius: 1px 5px 4px 1px;
  opacity: 0;
  transform: rotateY(0deg) rotateZ(1.5deg);
  transform-origin: left center;
  backface-visibility: visible;
  animation: binding-page-turn 1.7s cubic-bezier(.55,.05,.28,.96) infinite;
}
.binding-spine {
  position: absolute;
  z-index: 5;
  top: 7px;
  left: 50%;
  width: 3px;
  height: 29px;
  border-radius: 3px;
  background: repeating-linear-gradient(180deg, #6f918b 0 3px, transparent 3px 7px);
  opacity: .72;
  transform: translateX(-50%);
  animation: binding-stitch-pulse 1.7s ease-in-out infinite;
}
.flip-page-placeholder small { font: 600 10px var(--sans); }
.flip-page.is-rendered .flip-page-placeholder { display: none; }
.flip-page.is-error .flip-page-placeholder { color: #a35c5c; }
.flip-page.is-error .binding-page-turning,
.flip-page.is-error .binding-spine { animation: none; }
.flip-page.is-error .binding-page-turning { opacity: .35; transform: rotateY(-38deg) rotateZ(1deg); }
.flip-page.is-error .binding-spine { background: #a35c5c; opacity: .55; }
.book-floor-shadow { position: absolute; z-index: 0; bottom: 1.7%; left: 50%; width: min(84%, 1220px); height: 10%; transform: translateX(-50%); border-radius: 50%; background: radial-gradient(ellipse, rgba(0,0,0,.84), rgba(0,0,0,.48) 48%, transparent 74%); filter: blur(21px); transition: opacity 180ms ease, transform 300ms ease; }
.book.cover-centered .book-floor-shadow { width: min(46%, 610px); }
.reader-stage.is-flipping .book-floor-shadow { opacity: .76; transform: translateX(-50%) scaleX(.95) translateY(3px); }
.reader-loading, .reader-error { position: absolute; z-index: 8; top: 40%; left: 50%; margin: 0; transform: translate(-50%,-50%); border: 1px solid var(--line); border-radius: 8px; background: var(--panel-raised); padding: 18px 22px; color: var(--muted); box-shadow: var(--shadow); }
.reader-error { border-color: rgba(240,120,120,.3); color: #e99b9b; }
.reader-footer { width: min(100%, 1100px); display: flex; align-items: center; justify-content: center; gap: 18px; padding-top: 8px; color: var(--muted-2); font: 600 10px/1.3 var(--mono); letter-spacing: .05em; }
.reader-footer-page-jump { display: inline-flex; align-items: center; gap: 5px; margin: 0; color: #89a5a3; }
.reader-footer-page-jump input {
  width: 50px;
  border: 0;
  border-bottom: 1px dashed rgba(137,165,163,.58);
  border-radius: 3px;
  background: transparent;
  padding: 1px 3px 2px;
  color: var(--cyan-soft);
  font: inherit;
  letter-spacing: inherit;
  text-align: center;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}
.reader-footer-page-jump input:hover { border-bottom-color: var(--cyan-soft); background: rgba(71,230,238,.05); }
.reader-footer-page-jump input:focus { outline: none; border-bottom-color: var(--cyan); background: rgba(71,230,238,.08); box-shadow: 0 2px 0 rgba(71,230,238,.18); }
.reader-footer-page-jump input::-webkit-inner-spin-button,
.reader-footer-page-jump input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.reader-page-status-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.reader-body:fullscreen .reader-toolbar { background: rgba(1,7,8,.86); }

@keyframes binding-page-turn {
  0%, 8% { opacity: 0; transform: rotateY(0deg) rotateZ(1.5deg); }
  15% { opacity: 1; }
  68% { opacity: 1; transform: rotateY(-178deg) rotateZ(-1.5deg); }
  82%, 100% { opacity: 0; transform: rotateY(-180deg) rotateZ(-1.5deg); }
}

@keyframes binding-stitch-pulse {
  0%, 100% { opacity: .45; }
  44% { opacity: .92; }
}

@media (max-width: 1120px) {
  .agent-commandbar { align-items: flex-start; }
  .agent-command-actions { flex-wrap: wrap; }
  .agent-overview { grid-template-columns: 1fr; }
  .queue-compact-head { grid-template-columns: 1fr; }
  .delivery-queue .queue-compact-head { grid-template-columns: 1fr; }
  .queue-compact-title { grid-template-columns: auto auto 1fr; }
  .task-list { max-height: none; }
  .report-table-head, .report-row { grid-template-columns: minmax(0,1fr) 126px minmax(244px,auto); }
  .reader-toolbar { grid-template-columns: auto minmax(160px,1fr); }
  .reader-controls { grid-column: 1 / -1; justify-content: center; overflow-x: auto; padding-bottom: 2px; }
  .reader-layout { height: calc(100vh - 116px); }
}

@media (max-width: 900px) and (min-width: 761px) {
  .report-table-head { display: none; }
  .report-list { border-radius: 8px; }
  .report-row { grid-template-columns: minmax(0,1fr) auto; }
  .report-student { grid-column: 1 / -1; }
  .report-row .actions { grid-column: 2; }
}

@media (max-width: 760px) {
  .agent-shell, .intake-topbar, .intake-shell { width: min(100% - 20px, 100%); margin-top: 10px; }
  .agent-commandbar { display: grid; padding: 18px; }
  .agent-mark { width: 52px; height: 52px; }
  .agent-brand h1 { font-size: 25px; }
  .agent-command-actions { justify-content: flex-start; }
  .agent-command-actions .agent-identity { order: -1; }
  .agent-panel { padding: 17px; }
  .report-charge-summary > span { display: grid; gap: 5px; }
  .agent-metrics { grid-template-columns: 1fr 1fr; }
  .delivery-tools { align-items: stretch; flex-direction: column-reverse; }
  .queue-compact-title { grid-template-columns: 1fr; gap: 7px; }
  .queue-compact .agent-metrics { grid-template-columns: 1fr 1fr; }
  .queue-compact .task-list:not(:empty) { grid-template-columns: 1fr; }
  .delivery-queue-metrics { grid-template-columns: 1fr; }
  .delivery-queue .delivery-task-list:not(:empty) { grid-template-columns: 1fr; }
  .delivery-queue-card { grid-template-columns: 1fr; gap: 11px; }
  .delivery-queue-details { grid-template-columns: 1fr; }
  .delivery-queue-details > div { border-left: 0; border-top: 1px solid rgba(71,230,238,.12); padding: 8px 0 0; }
  .task-primary { grid-template-columns: 1fr auto; }
  .task-stage { grid-column: 1 / -1; grid-row: 2; }
  .task-primary > .actions { grid-column: 1 / -1; justify-content: flex-start; }
  .delivery-head { align-items: stretch; flex-direction: column; }
  .report-search { width: 100%; }
  .report-table-head { display: none; }
  .report-list { border-radius: 8px; }
  .report-row { grid-template-columns: 1fr; gap: 7px; padding: 13px; }
  .report-student { grid-template-columns: minmax(100px,1fr) 76px minmax(100px,1fr); gap: 6px 8px; overflow: visible; }
  .report-time { display: block; }
  .report-row .actions { justify-content: flex-start; flex-wrap: wrap; }
  .report-profile-card dl { grid-template-columns: 1fr; }
  .report-profile-card .report-profile-wide { grid-column: 1; }
  .form-grid, .intake-preview, .creation-settings-grid { grid-template-columns: 1fr; }
  .intake-topbar { align-items: flex-start; flex-direction: column; }
  .topnav { width: 100%; justify-content: space-between; }
  .agent-footer { flex-direction: column; }
  .reader-toolbar { min-height: 58px; grid-template-columns: auto minmax(0,1fr); gap: 8px; padding: 8px 10px; backdrop-filter: none; }
  .reader-leading { gap: 5px; }
  #toc-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .reader-toolbar .back { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .reader-title-block { justify-content: flex-end; }
  .reader-artifact-tab { min-height: 32px; padding: 5px 9px; font-size: 11px; }
  .reader-controls { position: fixed; z-index: 24; right: 9px; bottom: max(9px, env(safe-area-inset-bottom)); left: 9px; grid-column: auto; justify-content: center; overflow-x: auto; border: 1px solid rgba(71,230,238,.2); border-radius: 10px; background: rgba(2,10,12,.9); padding: 7px; box-shadow: 0 16px 50px rgba(0,0,0,.52); backdrop-filter: blur(16px); }
  .reader-controls button, .reader-controls .button-link { min-height: 38px; padding: 6px 9px; }
  .reader-controls .button-link, #spread-toggle { display: none; }
  .reader-page-jump input { width: 48px; }
  .reader-layout { height: calc(100vh - 58px); grid-template-columns: 1fr; }
  .toc { position: fixed; z-index: 30; top: 0; bottom: 0; left: 0; width: min(88vw, 330px); display: block; transform: translateX(-105%); border-right-color: rgba(71,230,238,.32); padding-top: max(22px, env(safe-area-inset-top)); transition: transform 240ms cubic-bezier(.2,.8,.2,1); }
  .toc.open { transform: translateX(0); }
  .toc-heading button { display: block; }
  .book { padding: 10px 8px 78px; }
  .reader-stage { width: 100%; }
  .flipbook-host { width: min(calc(100% - 12px), var(--book-comfort-width, 100%)); }
  .reader-footer { display: none; }
  .book-floor-shadow { bottom: 5%; width: 88%; filter: blur(18px); }
  .reader-zoom-hud { top: 10px; right: 8px; width: auto; flex-direction: row; transform: none; padding: 5px; }
  .reader-zoom-heading, .reader-zoom-hud input[type="range"], .reader-zoom-hud small { display: none; }
  .reader-zoom-hud output { min-width: 42px; font-size: 12px; }
  .reader-zoom-hud button { width: 38px; min-height: 36px; display: inline-grid; grid-template-columns: 1fr; padding: 5px; font-size: 0; text-align: center; }
  .reader-zoom-hud button span:first-child { font-size: 17px; }
  .reader-page-controls { width: auto; display: flex; gap: 6px; border: 0; padding: 0; }
}

@media (max-width: 480px) {
  #sound-toggle { font-size: 0; }
  #sound-toggle::before { content: "♪"; font-size: 15px; }
  #sound-toggle[aria-pressed="false"]::before { content: "×♪"; }
  #sound-toggle[data-audio-state="locked"]::before { content: "♪?"; }
  #fullscreen-toggle { font-size: 0; }
  #fullscreen-toggle::before { content: "⛶"; font-size: 16px; }
  .reader-page-jump { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.data-pack-admin { display: grid; gap: 18px; }
.data-pack-upload-row { display: grid; grid-template-columns: minmax(260px,1fr) auto auto; align-items: end; gap: 12px; }
.data-pack-upload-row input[type="file"] { width: 100%; }
.data-pack-upload-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.data-pack-selection { margin: -6px 0 0; color: var(--muted); font-size: 12px; }
.data-pack-release-summary { display: grid; grid-template-columns: auto auto minmax(240px,1fr); gap: 12px; align-items: baseline; border: 1px solid var(--line); border-radius: 8px; padding: 14px; color: var(--muted); }
.data-pack-release-summary strong { color: var(--text); }
.data-pack-release-summary span:last-child { overflow-wrap: anywhere; font-size: 12px; }
.data-pack-upload-list { display: grid; gap: 8px; }
.data-pack-upload-item { display: grid; grid-template-columns: minmax(230px,1.4fr) auto minmax(160px,1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.data-pack-upload-item > div { display: grid; gap: 3px; }
.data-pack-upload-item span, .data-pack-upload-item small { color: var(--muted); }
.data-pack-upload-item code { color: #e99b9b; overflow-wrap: anywhere; }
.data-pack-rollback { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; color: var(--muted); font-size: 12px; }

@media (max-width: 760px) {
  .data-pack-upload-row, .data-pack-release-summary, .data-pack-upload-item { grid-template-columns: 1fr; align-items: stretch; }
  .data-pack-upload-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .data-pack-rollback { align-items: stretch; flex-direction: column; }
}

/* ============================================================
   UI 精修（2026-08-30 · 纯视觉，不改任何结构与功能）
   1. 取消品牌区 "DMB · ONLINE AGENT" 与装饰 slogan
   2. 英文区域标签降级为弱装饰，中文标题保持第一信息层级
   3. 顶栏从 126px 收紧为紧凑单行
   4. 背景三层动画静止（保留静态网格氛围），低性能设备更稳
   5. 小字号下限 10px → 11px
   本块置于文件末尾，同优先级时覆盖前文中同名规则。
   ============================================================ */

/* 1. 取消品牌英文标识与装饰 slogan（工作台顶栏 + 登记页顶栏） */
.agent-kicker,
.agent-brand.compact small,
.agent-brand p { display: none; }

/* 2. 英文区域标签弱化为纯装饰 */
.agent-section-label {
  font-size: 9px;
  opacity: .45;
  letter-spacing: .22em;
}

/* 3. 顶栏收紧为紧凑单行 */
.agent-commandbar {
  min-height: 0;
  padding: 15px 24px;
}
.agent-brand { gap: 13px; }
.agent-brand h1 { margin: 3px 0 0; font-size: 24px; letter-spacing: -.02em; }
.agent-mark { width: 46px; height: 46px; border-radius: 10px; }
.agent-mark svg { width: 26px; height: 26px; }

/* 4. 背景动画静止（prefers-reduced-motion 规则不受影响） */
.agent-body,
.agent-body::before,
.agent-body::after { animation: none; }
.agent-body::before { opacity: .28; }
.agent-body::after { opacity: .38; }

/* 5. 小字号下限 11px */
.agent-metrics span,
.report-table-head,
.task-student span,
.task-meta,
.status-chip { font-size: 11px; }

/* ============================================================
   阅读器 UI 精修（2026-08-30 · A–E）
   A 工具栏：下载 PDF 突出为主按钮；隐藏与 HUD 重复的「放大」；版本标签弱化
   B 目录：章节始终展开；当前章节高亮；字号提升
   C 工具栏下缘阅读进度条（JS 驱动宽度；加载中为不定态动画）
   D 缩放 HUD 空闲自动隐藏（JS 给 body 加 .reader-hud-idle）
   E 书页两缘悬浮翻页箭头；加载文案呼吸动画
   配合 readerPage 模板与 reader.js 末尾的「阅读器精修附加行为」使用。
   ============================================================ */

/* A1 下载 PDF → 主按钮（老师终局动作，视觉最高优先级） */
#reader-download.button-link {
  border-color: rgba(108, 155, 255, .75);
  background: linear-gradient(135deg, #658df3, #4772da);
  color: #020912;
  font-weight: 700;
  box-shadow: 0 9px 28px rgba(71, 114, 218, .23);
}

/* A2 工具栏「放大」与右侧 HUD 缩放功能重复，隐藏（缩放由 HUD 完整提供） */
#zoom-toggle { display: none; }

/* A4 非当前版本的标签弱化为小字徽章感 */
.reader-artifact-switcher .reader-artifact-tab:not(.active) {
  opacity: .55;
  border-color: transparent;
  background: none;
  box-shadow: none;
}

/* B5 当前章节保持高亮，所有章节内容始终展开 */
.toc-section.current .toc-chapter {
  border-color: rgba(71, 230, 238, .28);
  background: linear-gradient(90deg, rgba(38, 130, 135, .16), transparent 82%);
}

/* B6 目录字号与点击区提升 */
.toc nav button { padding: 9px 8px; }
.toc nav .toc-item strong { font-size: 13px; }
.toc nav .toc-item .toc-page-number { font-size: 10px; }
.toc-chapter-copy strong { font-size: 13px; }

/* C 阅读进度条（挂在工具栏下缘） */
.reader-progress {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: rgba(71, 230, 238, .08);
}
.reader-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #3f7fdb, var(--cyan));
  box-shadow: 0 0 8px rgba(71, 230, 238, .5);
  transition: width 300ms ease;
}
.reader-progress.is-indeterminate i {
  width: 32% !important;
  transition: none;
  animation: reader-progress-slide 1.4s ease-in-out infinite;
}
@keyframes reader-progress-slide {
  0% { margin-left: -32%; }
  100% { margin-left: 100%; }
}

/* D 缩放 HUD 空闲自动隐藏 */
.reader-zoom-hud { transition: opacity 400ms ease, transform 400ms ease; }
body.reader-hud-idle .reader-zoom-hud {
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
}

/* E1 书页两缘悬浮翻页箭头（常显低透明，悬停实体化） */
.reader-edge-nav {
  position: absolute;
  top: 50%;
  z-index: 15;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(71, 230, 238, .3);
  border-radius: 50%;
  background: rgba(3, 14, 16, .72);
  backdrop-filter: blur(8px);
  color: var(--cyan-soft);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  opacity: .32;
  transform: translateY(-50%);
  transition: opacity 180ms ease, border-color 180ms ease;
}
.reader-edge-nav:hover { opacity: 1; border-color: rgba(71, 230, 238, .65); }
.reader-edge-nav:disabled { opacity: .1; cursor: default; }
.reader-edge-prev { left: 14px; }
.reader-edge-next { right: 14px; }
@media (max-width: 760px) {
  .reader-edge-nav { display: none; }
}

/* E2 加载文案呼吸动画（277 页装订等待不再像卡死） */
.reader-loading { animation: reader-loading-pulse 1.6s ease-in-out infinite; }
@keyframes reader-loading-pulse {
  0%, 100% { opacity: .45; }
  50% { opacity: 1; }
}

/* 独立管理员控制台：沿用报告系统语言，以琥珀色区分系统级操作。 */
.admin-body {
  --admin-accent: #f1c56f;
  --admin-line: rgba(241, 197, 111, .28);
  background:
    radial-gradient(circle at 12% -6%, rgba(167, 112, 30, .16), transparent 30rem),
    radial-gradient(circle at 88% 16%, rgba(22, 88, 113, .13), transparent 30rem),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    var(--void);
  background-size: auto, auto, 44px 44px, 44px 44px, auto;
}
.admin-shell { width: min(1380px, calc(100% - 40px)); }
.admin-commandbar { border-color: var(--admin-line); }
.admin-commandbar::before { background: linear-gradient(90deg, transparent, rgba(241, 197, 111, .75), transparent); }
.admin-body .agent-kicker { display: block; color: var(--admin-accent); font-size: 9px; opacity: .7; }
.admin-body .agent-mark { border-color: rgba(241, 197, 111, .38); color: var(--admin-accent); box-shadow: inset 0 0 28px rgba(241, 197, 111, .05), 0 0 28px rgba(241, 197, 111, .05); }
.admin-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(420px, .75fr);
  gap: 34px;
  align-items: center;
  margin: 18px 0;
  padding: 24px 26px;
  border-color: var(--admin-line);
}
.admin-overview::before { background: linear-gradient(90deg, transparent, rgba(241, 197, 111, .55), transparent); }
.admin-overview-copy h2 { margin: 7px 0 5px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.025em; }
.admin-overview-copy p { max-width: 760px; margin: 0; color: var(--muted); }
.admin-overview .agent-section-label,
.admin-body .data-pack-admin .agent-section-label { color: var(--admin-accent); }
.admin-overview-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden; border: 1px solid rgba(241, 197, 111, .16); border-radius: 8px; background: rgba(241, 197, 111, .12); }
.admin-overview-meta div { min-width: 0; background: rgba(2, 10, 12, .92); padding: 12px 13px; }
.admin-overview-meta dt { color: var(--muted-2); font: 700 9px/1.25 var(--mono); letter-spacing: .08em; }
.admin-overview-meta dd { margin: 6px 0 0; color: var(--ink); font-size: 13px; font-weight: 750; }
.admin-production { display: grid; gap: 16px; margin-bottom: 18px; border-color: var(--admin-line); padding: 22px 24px; }
.admin-production::before { background: linear-gradient(90deg, transparent, rgba(241, 197, 111, .55), transparent); }
.admin-production .agent-section-label { color: var(--admin-accent); }
.admin-production-head { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: start; gap: 16px; }
.admin-production-head h2 { margin: 7px 0 4px; }
.admin-production-head p { margin: 0; color: var(--muted); }
.admin-service-grid, .admin-production-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.admin-service-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.admin-service-grid > div, .admin-production-metrics > div { min-width: 0; border: 1px solid rgba(241,197,111,.15); border-radius: 8px; background: rgba(2,10,12,.58); padding: 10px 12px; }
.admin-service-grid span, .admin-production-metrics span { display: block; color: var(--muted-2); font: 700 9px/1.3 var(--mono); letter-spacing: .08em; }
.admin-service-grid strong, .admin-production-metrics strong { display: block; margin-top: 5px; color: var(--ink); font-size: 16px; }
.admin-service-grid strong[data-state="ready"] { color: var(--green); }
.admin-service-grid strong[data-state="busy"] { color: var(--amber); }
.admin-service-grid strong[data-state="unavailable"] { color: #ffaaaa; }
.admin-service-grid strong[data-state="neutral"] { color: var(--muted); }
.admin-production-metrics > div:last-child { border-color: rgba(240,120,120,.2); }
.admin-production-metrics > div:last-child strong { color: #ffaaaa; }
.admin-production .message { min-height: 0; margin: 0; }
.admin-production-table-head, .admin-production-item { display: grid; grid-template-columns: minmax(280px,1.4fr) 130px minmax(180px,.8fr) minmax(150px,.7fr) 145px; align-items: center; gap: 14px; }
.admin-production-table-head { border-bottom: 1px solid rgba(241,197,111,.14); padding: 0 12px 8px; color: var(--muted-2); font: 700 9px/1.3 var(--mono); letter-spacing: .07em; }
.admin-production-list { display: grid; gap: 7px; }
.admin-production-item { position: relative; overflow: hidden; border: 1px solid rgba(241,197,111,.13); border-radius: 8px; background: rgba(2,10,12,.46); padding: 11px 12px; }
.admin-production-item::before { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; content: ""; background: var(--amber); }
.admin-production-item.is-running::before { background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.admin-production-item.is-failed::before { background: var(--red); }
.admin-production-student { display: grid; grid-template-columns: 34px minmax(0,1fr); align-items: center; gap: 10px; min-width: 0; }
.admin-production-student > b { color: var(--admin-accent); font: 800 13px/1 var(--mono); }
.admin-production-student > span { display: grid; min-width: 0; gap: 2px; }
.admin-production-student strong, .admin-production-student small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-production-student small { color: var(--muted); font: 10px/1.4 var(--mono); }
.admin-production-item > code { color: #8ca2a0; font: 10px/1.4 var(--mono); }
.admin-production-state { display: grid; justify-items: start; gap: 4px; min-width: 0; }
.admin-production-state small { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-production-progress { min-width: 0; }
.admin-production-progress > span { display: block; color: var(--cyan-soft); font: 700 10px/1 var(--mono); text-align: right; }
.admin-production-progress .progress { margin-top: 6px; }
.admin-production-item > time { color: var(--muted); font: 10px/1.5 var(--mono); }
.admin-production-list > .empty-state { min-height: 120px; }
.admin-report-history { display: grid; gap: 16px; margin-bottom: 18px; border-color: var(--admin-line); padding: 22px 24px; }
.admin-report-history::before { background: linear-gradient(90deg, transparent, rgba(241, 197, 111, .55), transparent); }
.admin-report-history .agent-section-label { color: var(--admin-accent); }
.admin-report-toolbar { display: grid; grid-template-columns: minmax(0,1fr) minmax(260px,.45fr); align-items: end; gap: 16px; }
.admin-report-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.admin-report-metrics > div { min-width: 0; border: 1px solid rgba(241,197,111,.15); border-radius: 8px; background: rgba(2,10,12,.58); padding: 10px 12px; }
.admin-report-metrics span { display: block; color: var(--muted-2); font: 700 9px/1.3 var(--mono); letter-spacing: .08em; }
.admin-report-metrics strong { display: block; margin-top: 5px; color: var(--ink); font-size: 16px; }
.admin-report-filter { display: grid; gap: 6px; color: var(--muted-2); font: 700 9px/1.3 var(--mono); letter-spacing: .08em; }
.admin-report-filter input { width: 100%; border: 1px solid rgba(241,197,111,.2); border-radius: 7px; background: rgba(2,10,12,.7); color: var(--ink); padding: 10px 11px; font: 12px/1.3 var(--sans); }
.admin-report-filter input:focus { outline: 2px solid rgba(241,197,111,.45); outline-offset: 1px; }
.admin-report-history .message { min-height: 0; margin: 0; }
.admin-report-table-head, .admin-report-item { display: grid; grid-template-columns: minmax(300px,1.6fr) 110px minmax(200px,.9fr) 120px 160px; align-items: center; gap: 14px; }
.admin-report-table-head { border-bottom: 1px solid rgba(241,197,111,.14); padding: 0 12px 8px; color: var(--muted-2); font: 700 9px/1.3 var(--mono); letter-spacing: .07em; }
.admin-report-list { display: grid; gap: 7px; }
.admin-report-item { position: relative; overflow: hidden; border: 1px solid rgba(241,197,111,.13); border-radius: 8px; background: rgba(2,10,12,.46); padding: 11px 12px; }
.admin-report-item::before { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; content: ""; background: var(--amber); }
.admin-report-item.is-published::before { background: var(--green); }
.admin-report-item.is-running::before { background: var(--blue); box-shadow: 0 0 10px var(--blue); }
.admin-report-item.is-failed::before, .admin-report-item.is-deleted::before { background: var(--red); }
.admin-report-primary, .admin-report-owner, .admin-report-state, .admin-report-attempt, .admin-report-time { min-width: 0; }
.admin-report-primary, .admin-report-owner, .admin-report-state, .admin-report-attempt, .admin-report-time { display: grid; gap: 3px; }
.admin-report-primary strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-report-primary small, .admin-report-owner small, .admin-report-state small, .admin-report-attempt small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.admin-report-primary small { font: 10px/1.4 var(--mono); }
.admin-report-primary code { overflow: hidden; color: #8ca2a0; font: 9px/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.admin-report-owner span, .admin-report-attempt span { color: var(--cyan-soft); font: 700 10px/1.3 var(--mono); }
.admin-report-state { justify-items: start; }
.admin-report-time { justify-items: start; }
.admin-report-time time { color: var(--muted); font: 10px/1.5 var(--mono); }
.admin-report-reader { color: var(--admin-accent); font-size: 10px; text-decoration: none; }
.admin-report-reader:hover { text-decoration: underline; }
.admin-report-list > .empty-state { min-height: 120px; }
.admin-body .data-pack-admin { border-color: var(--admin-line); }
.admin-body .data-pack-admin::before { background: linear-gradient(90deg, transparent, rgba(241, 197, 111, .55), transparent); }

@media (max-width: 940px) {
  .admin-overview { grid-template-columns: 1fr; gap: 20px; }
  .admin-production-head { grid-template-columns: minmax(0,1fr) auto; }
  .admin-production-head .agent-index { display: none; }
  .admin-service-grid, .admin-production-metrics { grid-template-columns: 1fr 1fr; }
  .admin-production-table-head { display: none; }
  .admin-production-item { grid-template-columns: minmax(0,1fr) auto; }
  .admin-production-state, .admin-production-progress, .admin-production-item > time { grid-column: 1 / -1; }
  .admin-report-toolbar { grid-template-columns: 1fr; }
  .admin-report-table-head { display: none; }
  .admin-report-item { grid-template-columns: minmax(0,1fr) auto; }
  .admin-report-state, .admin-report-attempt, .admin-report-time { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .admin-shell { width: min(100% - 20px, 1380px); margin-top: 10px; }
  .admin-overview { padding: 20px; }
  .admin-overview-meta { grid-template-columns: 1fr; }
  .admin-production { padding: 18px; }
  .admin-production-head { grid-template-columns: 1fr; }
  .admin-service-grid, .admin-production-metrics { grid-template-columns: 1fr; }
  .admin-production-item { grid-template-columns: 1fr; }
  .admin-production-state, .admin-production-progress, .admin-production-item > time { grid-column: auto; }
  .admin-report-history { padding: 18px; }
  .admin-report-metrics { grid-template-columns: 1fr 1fr; }
  .admin-report-item { grid-template-columns: 1fr; }
  .admin-report-state, .admin-report-attempt, .admin-report-time { grid-column: auto; }
}

/* ============================================================
   活体 Agent 驾驶舱（2026-09-01 · 纯视觉装饰层，功能零改动）
   仅作用于工作台页 body[data-page="workbench"]，阅读器/登记页/管理台不受影响。
   组成：点阵网格 + 极光呼吸 + 粒子星丛（#agent-stars，JS 注入）
   磨砂玻璃面板 / 渐变标题 + 声纹条 + AGENT ONLINE
   Agent 控制台（状态核心 + 活动流 + 心跳，JS 注入并由队列状态驱动）
   能量主按钮 / 状态动效 / 指标滚动 / 错峰入场 / 顶栏控件对齐
   回退方式：整体删除本块 + workbench.js 末尾同名附加行为块即可。
   ============================================================ */

/* 1. 粒子星丛画布（JS 注入；reduced-motion 时不注入，此处兜底隐藏） */
#agent-stars {
  position: fixed; inset: 0; z-index: -1;
  opacity: .5; pointer-events: none;
}
@media (prefers-reduced-motion: reduce) { #agent-stars { display: none; } }

/* 2. 活的背景：点阵网格 + 双层极光呼吸 */
body[data-page="workbench"] {
  /* Contain the shell's top margin so the body background begins at the viewport edge. */
  display: flow-root;
  background:
    radial-gradient(circle at 16% -8%, rgba(23, 131, 139, 0.2), transparent 32rem),
    radial-gradient(circle at 88% 14%, rgba(22, 88, 113, 0.15), transparent 30rem),
    radial-gradient(circle, rgba(71, 230, 238, .1) 1px, transparent 1.5px),
    var(--void);
  background-size: auto, auto, 26px 26px, auto;
}
body[data-page="workbench"]::before {
  position: fixed; z-index: -1; inset: -20%;
  content: ""; pointer-events: none; mask-image: none;
  background:
    radial-gradient(38% 32% at 22% 18%, rgba(46, 211, 219, .16), transparent 70%),
    radial-gradient(34% 30% at 82% 22%, rgba(107, 151, 255, .13), transparent 70%),
    radial-gradient(42% 36% at 55% 95%, rgba(139, 107, 255, .1), transparent 70%);
  filter: blur(30px);
  animation: cockpit-aurora-a 34s ease-in-out infinite alternate;
}
body[data-page="workbench"]::after {
  position: fixed; z-index: -1; inset: -18%;
  content: ""; pointer-events: none;
  background:
    radial-gradient(30% 26% at 70% 60%, rgba(37, 205, 185, .12), transparent 70%),
    radial-gradient(26% 24% at 15% 70%, rgba(72, 140, 220, .1), transparent 70%);
  filter: blur(36px);
  animation: cockpit-aurora-b 42s ease-in-out infinite alternate;
}
@keyframes cockpit-aurora-a {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); opacity: .8; }
  50% { transform: translate3d(2%, 1.5%, 0) scale(1.06); opacity: 1; }
  100% { transform: translate3d(3%, -1%, 0) scale(1.02); opacity: .85; }
}
@keyframes cockpit-aurora-b {
  0% { transform: translate3d(2%, 1%, 0) scale(1.03); opacity: .7; }
  100% { transform: translate3d(-2.5%, -1.5%, 0) scale(1); opacity: 1; }
}

/* 3. 磨砂玻璃面板 */
body[data-page="workbench"] .agent-commandbar,
body[data-page="workbench"] .agent-panel {
  border-color: rgba(120, 235, 240, .16);
  background: linear-gradient(160deg, rgba(15, 32, 36, .66), rgba(6, 14, 16, .58));
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
}
body[data-page="workbench"] .agent-panel { transition: border-color .25s ease, box-shadow .25s ease; }
body[data-page="workbench"] .agent-panel:hover {
  border-color: rgba(120, 235, 240, .3);
  box-shadow: var(--shadow), 0 0 46px rgba(46, 211, 219, .05);
}
body[data-page="workbench"] .composer { box-shadow: var(--shadow), 0 0 70px rgba(71, 230, 238, .07), inset 0 1px rgba(255, 255, 255, .045); }
body[data-page="workbench"] .task-card { background: rgba(8, 20, 23, .52); }
body[data-page="workbench"] .report-list { background: rgba(4, 12, 14, .35); }
body[data-page="workbench"] .report-table-head { background: rgba(33, 118, 124, .14); }
body[data-page="workbench"] .composer-step { background: rgba(2, 10, 12, .5); }
body[data-page="workbench"] input,
body[data-page="workbench"] select,
body[data-page="workbench"] textarea { background: rgba(1, 8, 10, .6); }

/* 4. 渐变标题 + 声纹条 + AGENT ONLINE pill（pill/声纹条由 JS 注入） */
body[data-page="workbench"] .agent-brand h1 {
  font-size: 28px;
  background: linear-gradient(100deg, #eafffe 15%, #8df2f5 48%, #7fa5ff 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(71, 230, 238, .2));
}
.agent-eq {
  display: inline-flex; align-items: flex-end; gap: 3px;
  height: 14px; margin-left: 12px; vertical-align: baseline;
}
.agent-eq i {
  width: 3px; border-radius: 2px; background: linear-gradient(180deg, #8df2f5, #47b8ee);
  animation: cockpit-eq 1.1s ease-in-out infinite;
}
.agent-eq i:nth-child(1) { height: 6px; animation-delay: 0s; }
.agent-eq i:nth-child(2) { height: 12px; animation-delay: .18s; }
.agent-eq i:nth-child(3) { height: 8px; animation-delay: .36s; }
.agent-eq i:nth-child(4) { height: 11px; animation-delay: .54s; }
@keyframes cockpit-eq { 0%, 100% { transform: scaleY(.4); } 50% { transform: scaleY(1); } }
.agent-live {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 40px;
  border: 1px solid rgba(92, 224, 174, .3); border-radius: 99px;
  background: rgba(46, 123, 94, .12);
  padding: 0 14px;
  color: var(--green); font: 800 10px/1 var(--mono); letter-spacing: .14em;
  white-space: nowrap;
}
.agent-live i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 12px rgba(92, 224, 174, .9);
  animation: cockpit-beacon 1.8s ease-in-out infinite;
}
@keyframes cockpit-beacon { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* 5. 顶栏操作区对齐：积分 = 与按钮同高 chip */
body[data-page="workbench"] .credit-balance {
  align-items: center; min-height: 40px; gap: 8px;
  border: 1px solid rgba(71, 230, 238, .16); border-radius: 7px;
  background: rgba(0, 0, 0, .22); padding: 0 14px;
}

/* 6. Agent 控制台：核心 + 状态文案 + 活动流（JS 注入，队列状态驱动） */
.agent-presence {
  --ap-arc1: 14s; --ap-arc2: 18s; --ap-orbit: 10s; --ap-pulse: 4s; --ap-glow: .5;
  display: grid; grid-template-columns: auto minmax(170px, .55fr) minmax(0, 1fr);
  align-items: center; gap: 20px;
  margin-top: 14px;
  border: 1px solid rgba(71, 230, 238, .18); border-radius: 12px;
  background: linear-gradient(120deg, rgba(71, 230, 238, .05), rgba(107, 151, 255, .04) 60%, transparent);
  padding: 14px 20px;
  transition: border-color .5s ease, background .5s ease, box-shadow .5s ease;
}
.agent-presence[data-state="working"] {
  --ap-arc1: 2.6s; --ap-arc2: 3.8s; --ap-orbit: 3s; --ap-pulse: 1.5s; --ap-glow: 1;
  border-color: rgba(107, 151, 255, .38);
  background: linear-gradient(120deg, rgba(71, 230, 238, .1), rgba(107, 151, 255, .09) 60%, transparent);
  box-shadow: 0 0 40px rgba(71, 190, 240, .08), inset 0 0 30px rgba(71, 230, 238, .04);
}
.agent-presence > svg { width: 78px; height: 78px; overflow: visible; display: block; }
.agent-presence .ap-ring, .agent-presence .ap-orbit, .agent-presence .ap-glow {
  transform-box: view-box; transform-origin: 50% 50%;
}
.ap-outer { animation: cockpit-spin 52s linear infinite; }
.ap-ticks { animation: cockpit-spin-rev 34s linear infinite; }
.ap-arc1 { animation: cockpit-spin var(--ap-arc1) linear infinite; transition: opacity .5s; }
.ap-arc2 { animation: cockpit-spin-rev var(--ap-arc2) linear infinite; transition: opacity .5s; }
.ap-orbit { animation: cockpit-spin var(--ap-orbit) linear infinite; }
.ap-glow { opacity: var(--ap-glow); animation: cockpit-core var(--ap-pulse) ease-in-out infinite; transition: opacity .5s; }
.agent-presence[data-state="idle"] .ap-arc1,
.agent-presence[data-state="idle"] .ap-arc2 { opacity: .35; }
@keyframes cockpit-spin { to { transform: rotate(360deg); } }
@keyframes cockpit-spin-rev { to { transform: rotate(-360deg); } }
@keyframes cockpit-core { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.13); } }
.agent-presence-copy { display: grid; gap: 3px; min-width: 0; }
.agent-presence-copy strong { font-size: 14px; color: var(--ink); }
.agent-presence[data-state="working"] .agent-presence-copy strong {
  background: linear-gradient(90deg, #8df2f5, #9bb7ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.agent-presence-copy span { color: var(--muted); font: 11px/1.5 var(--mono); }
.agent-presence-copy span b { color: var(--cyan-soft); }
.agent-presence-meta { color: #4d6363; font: 10px/1.4 var(--mono); letter-spacing: .04em; }
.agent-presence-meta i {
  display: inline-block; width: 6px; height: 6px; margin-right: 5px;
  border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px rgba(92, 224, 174, .8);
  animation: cockpit-beacon 2s ease-in-out infinite;
}
.agent-log {
  display: grid; gap: 4px; min-width: 0;
  border-left: 1px solid rgba(71, 230, 238, .14);
  padding-left: 20px;
  font: 11px/1.6 var(--mono); color: var(--muted-2);
}
.agent-log p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-log time { color: #41666a; margin-right: 8px; }
.agent-log .is-live { color: #c9ecec; }
.agent-log .is-live time { color: rgba(71, 230, 238, .65); }
.agent-log-caret { color: var(--cyan); margin-left: 5px; animation: cockpit-caret 1s steps(2) infinite; }
@keyframes cockpit-caret { 50% { opacity: 0; } }
@media (max-width: 980px) {
  .agent-presence { grid-template-columns: auto minmax(0, 1fr); }
  .agent-log { grid-column: 1 / -1; border-left: 0; border-top: 1px solid rgba(71,230,238,.14); padding: 10px 0 0; }
}

/* 7. 能量主按钮 */
body[data-page="workbench"] .agent-button-primary {
  position: relative; overflow: hidden;
  border-color: rgba(120, 235, 240, .5);
  background: linear-gradient(135deg, #4fd8e8, #4f8ef7);
  color: #02181d;
  box-shadow: 0 10px 34px rgba(71, 170, 240, .32), 0 0 26px rgba(89, 232, 242, .22);
}
body[data-page="workbench"] .agent-button-primary:hover { background: linear-gradient(135deg, #68e6f2, #639ff8); }
body[data-page="workbench"] .agent-button-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -85%; width: 55%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .42), transparent);
  transform: skewX(-18deg); pointer-events: none;
}
body[data-page="workbench"] .agent-button-primary:hover::after { animation: cockpit-shine .65s ease forwards; }
@keyframes cockpit-shine { to { left: 130%; } }

/* 8. 状态驱动动效 */
body[data-page="workbench"] .task-card.is-running { border-color: rgba(107, 151, 255, .4); }
body[data-page="workbench"] .task-card.is-running::before { animation: cockpit-edge 1.7s ease-in-out infinite; }
@keyframes cockpit-edge {
  0%, 100% { opacity: 1; box-shadow: 0 0 14px var(--blue); }
  50% { opacity: .5; box-shadow: 0 0 4px var(--blue); }
}
body[data-page="workbench"] .task-card.is-running progress.progress::-webkit-progress-value {
  background: linear-gradient(90deg, #3f7fdb, var(--cyan) 40%, #e8feff 50%, var(--cyan) 60%, #3f7fdb);
  background-size: 220% 100%; animation: cockpit-flow 1.3s linear infinite;
}
body[data-page="workbench"] .task-card.is-running progress.progress::-moz-progress-bar {
  background: linear-gradient(90deg, #3f7fdb, var(--cyan) 40%, #e8feff 50%, var(--cyan) 60%, #3f7fdb);
  background-size: 220% 100%; animation: cockpit-flow 1.3s linear infinite;
}
@keyframes cockpit-flow { to { background-position: -220% 0; } }
body[data-page="workbench"] .task-card.is-queued::before { animation: cockpit-edge-amber 2.8s ease-in-out infinite; }
@keyframes cockpit-edge-amber {
  0%, 100% { opacity: 1; box-shadow: 0 0 9px rgba(242, 199, 109, .55); }
  50% { opacity: .55; box-shadow: 0 0 2px rgba(242, 199, 109, .2); }
}
body[data-page="workbench"] .status-running { animation: cockpit-chip 1.7s ease-in-out infinite; }
@keyframes cockpit-chip {
  0%, 100% { box-shadow: 0 0 0 0 rgba(107, 151, 255, 0); }
  50% { box-shadow: 0 0 12px 0 rgba(107, 151, 255, .35); }
}

/* 9. 徽标开机描边（收敛版） */
body[data-page="workbench"] .agent-commandbar .agent-mark { animation: cockpit-mark 3.4s ease-in-out infinite; }
@keyframes cockpit-mark {
  0%, 100% { box-shadow: inset 0 0 28px rgba(46, 211, 219, .06), 0 0 22px rgba(46, 211, 219, .08); }
  50% { box-shadow: inset 0 0 28px rgba(46, 211, 219, .14), 0 0 32px rgba(46, 211, 219, .2); }
}
body[data-page="workbench"] .agent-commandbar .agent-mark svg rect,
body[data-page="workbench"] .agent-commandbar .agent-mark svg path,
body[data-page="workbench"] .agent-commandbar .agent-mark svg circle {
  stroke-dasharray: 220; stroke-dashoffset: 220;
  animation: cockpit-draw 1.2s ease-out .1s forwards;
}
@keyframes cockpit-draw { to { stroke-dashoffset: 0; } }
body[data-page="workbench"] .agent-commandbar .agent-mark svg circle {
  animation: cockpit-draw 1.2s ease-out .1s forwards, cockpit-beacon 2.1s ease-in-out 1.5s infinite;
}

/* 10. 读数辉光 / 行微交互 / 错峰入场 */
body[data-page="workbench"] .agent-metrics > div { background: rgba(2, 10, 12, .4); }
body[data-page="workbench"] .agent-metrics strong,
body[data-page="workbench"] .credit-balance strong { text-shadow: 0 0 14px rgba(145, 245, 247, .35); }
body[data-page="workbench"] .report-row { transition: background 140ms ease, box-shadow 140ms ease; }
body[data-page="workbench"] .report-row:hover,
body[data-page="workbench"] .report-row:focus-within {
  box-shadow: inset 2px 0 0 rgba(71, 230, 238, .7);
}
body[data-page="workbench"] .composer-step-current .composer-step-number { animation: cockpit-node 2.6s ease-out infinite; }
@keyframes cockpit-node {
  0% { box-shadow: 0 0 0 0 rgba(107, 151, 255, .4); }
  70% { box-shadow: 0 0 0 7px rgba(107, 151, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(107, 151, 255, 0); }
}
body[data-page="workbench"] .agent-commandbar { animation: agent-rise .5s cubic-bezier(.2, .8, .2, 1) both; }
body[data-page="workbench"] .agent-overview { animation: agent-rise .55s cubic-bezier(.2, .8, .2, 1) .09s both; }
body[data-page="workbench"] .queue-compact { animation: agent-rise .55s cubic-bezier(.2, .8, .2, 1) .18s both; }
body[data-page="workbench"] .agent-footer { animation: agent-rise .55s cubic-bezier(.2, .8, .2, 1) .26s both; }

/* ============================================================
   阅读页背景同步工作台驾驶舱（2026-09-02 · 纯视觉装饰层，功能零改动）
   用户拍板：不搞阅读页专属花样，背景 1:1 同步工作台（点阵 + 双层极光 + 粒子星丛）。
   覆盖 .reader-body 原有椭圆渐变背景；::after 原为竖线纹理，本块整体替换为极光 B。
   粒子星丛 #agent-stars 由 reader.js 末尾附加行为注入，样式复用上方全局 #agent-stars 规则。
   回退方式：整体删除本块 + reader.js 末尾同名附加行为块。
   ============================================================ */
.reader-body {
  background:
    radial-gradient(circle at 16% -8%, rgba(23, 131, 139, 0.2), transparent 32rem),
    radial-gradient(circle at 88% 14%, rgba(22, 88, 113, 0.15), transparent 30rem),
    radial-gradient(circle, rgba(71, 230, 238, .1) 1px, transparent 1.5px),
    var(--void);
  background-size: auto, auto, 26px 26px, auto;
}
.reader-body::before {
  position: fixed; z-index: -1; inset: -20%;
  content: ""; pointer-events: none;
  background:
    radial-gradient(38% 32% at 22% 18%, rgba(46, 211, 219, .16), transparent 70%),
    radial-gradient(34% 30% at 82% 22%, rgba(107, 151, 255, .13), transparent 70%),
    radial-gradient(42% 36% at 55% 95%, rgba(139, 107, 255, .1), transparent 70%);
  filter: blur(30px);
  animation: cockpit-aurora-a 34s ease-in-out infinite alternate;
}
.reader-body::after {
  position: fixed; z-index: -1; inset: -18%;
  content: ""; pointer-events: none; mask-image: none;
  background:
    radial-gradient(30% 26% at 70% 60%, rgba(37, 205, 185, .12), transparent 70%),
    radial-gradient(26% 24% at 15% 70%, rgba(72, 140, 220, .1), transparent 70%);
  filter: blur(36px);
  animation: cockpit-aurora-b 42s ease-in-out infinite alternate;
}

/* ============================================================
   双端工作台 · 手机端加固（P1 · 2026-09-06）
   同一套 Online Agent 的移动响应式补充，不新建移动页面：
   1. <=760px：header 两行布局、44px 触摸区、单列卡片、长文本可断行
   2. 弹窗 max-height + 内部滚动（100dvh 优先，100vh 回退），避开微信底栏
   3. safe-area 底部安全区 + 100dvh 阅读器高度回退
   4. <=480px：隐藏非核心说明文字，保留图标与可访问标签
   桌面（>=761px）完全不受影响：全部规则收在移动端媒体查询内。
   回退方式：整体删除本块。
   ============================================================ */
@media (max-width: 760px) {
  button, a { touch-action: manipulation; }

  /* 顶栏两行：品牌一行，积分/设置/返回首页一行 */
  .agent-commandbar { grid-template-rows: auto auto; row-gap: 14px; }
  .agent-command-actions {
    grid-row: 2;
    width: 100%;
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .agent-command-actions .agent-button,
  .agent-command-actions .credit-balance,
  .agent-live { min-height: 44px; }
  .agent-command-actions .agent-button { flex: 1 1 auto; }
  .agent-command-actions .credit-balance { flex: 1 1 auto; justify-content: center; }

  /* 创建卡片：首屏主按钮加高 */
  #parse-intake { min-height: 48px; font-size: 16px; }
  .composer-step-link { min-height: 56px; align-items: center; }
  .composer textarea { min-height: 170px; }

  /* 报告列表单列卡片：学生、状态、进度、时间、操作 */
  .report-row { min-width: 0; }
  .report-student-name,
  .report-major-summary { white-space: normal; overflow-wrap: anywhere; }
  .report-status-block small { white-space: normal; }
  .actions a, .actions button {
    min-height: 44px;
    padding: 9px 13px;
    font-size: 13px;
  }
  .report-search input { height: 44px; font-size: 16px; }

  /* 弹窗：内部滚动，避开微信底部工具栏 */
  .agent-dialog {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overscroll-behavior: contain;
    padding: 18px;
  }
  .dialog-actions { position: sticky; bottom: -18px; background: #071012; margin: 20px -18px -18px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .dialog-actions .agent-button { min-height: 46px; }
  .dialog-actions .agent-button-primary { min-width: 0; flex: 1.4; }
  .dialog-actions .agent-button-ghost { flex: 1; }

  /* 登记页（老师直接登记兼容页）同样保证触摸区 */
  .direct-intake .agent-button-wide { min-height: 48px; }
  .direct-intake select[multiple] { min-height: 180px; }

  /* 登记文本交接提示条（P2 由 workbench.js 注入） */
  .intake-handoff-notice {
    display: grid;
    gap: 10px;
    margin: 12px 0 2px;
    border: 1px solid rgba(71, 230, 238, .34);
    border-radius: 9px;
    background: rgba(23, 104, 109, .14);
    padding: 12px;
  }
  .intake-handoff-notice p { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.55; }
  .intake-handoff-notice .intake-handoff-actions { display: flex; gap: 8px; }
  .intake-handoff-notice .agent-button { flex: 1; min-height: 44px; }
}

@media (max-width: 480px) {
  /* 小屏隐藏非核心说明文字，保留图标与可访问标签 */
  .agent-panel-copy,
  .delivery-head p,
  .agent-brand p { display: none; }
  .agent-brand h1 { font-size: 21px; }
  .agent-command-actions .credit-balance small { display: none; }
  .intake-handoff-notice .agent-button { min-height: 46px; }
}

/* 登记文本交接提示条（桌面兜底样式：桌面新开窗口不共享 sessionStorage，通常不会出现） */
.intake-handoff-notice {
  display: grid;
  gap: 10px;
  margin: 12px 0 2px;
  border: 1px solid rgba(71, 230, 238, .34);
  border-radius: 9px;
  background: rgba(23, 104, 109, .14);
  padding: 12px;
}
.intake-handoff-notice p { margin: 0; color: var(--ink); font-size: 13px; line-height: 1.55; }
.intake-handoff-notice .intake-handoff-actions { display: flex; gap: 8px; }
.intake-handoff-notice .agent-button { min-height: 40px; }

/* 阅读器：页面加载失败后的“重试本页”按钮（P3） */
.flip-page-retry {
  min-height: 44px;
  border: 1px solid rgba(163, 92, 92, .45);
  border-radius: 7px;
  background: #fffdf8;
  padding: 8px 18px;
  color: #a35c5c;
  font-weight: 750;
  cursor: pointer;
}
.flip-page-retry:hover { border-color: rgba(163, 92, 92, .8); color: #7e3b3b; }

/* 阅读器移动高度回退：100dvh 优先，100vh 兜底 */
@supports (height: 100dvh) {
  @media (max-width: 760px) {
    .reader-body { height: 100dvh; }
    .reader-layout { height: calc(100dvh - 58px); }
  }
}

.credit-topup-dialog { width: min(1080px, calc(100vw - 24px)); max-width: none; height: min(900px, calc(100dvh - 24px)); max-height: none; padding: 16px; border: 1px solid #64748b; border-radius: 16px; background: #0f172a; color: #e2e8f0; }
.credit-topup-dialog::backdrop { background: rgb(2 6 23 / 75%); }
.credit-topup-dialog h2 { display: inline-block; margin: 0 16px 12px 0; font-size: 18px; }
.credit-topup-dialog iframe { display: block; width: 100%; height: calc(100% - 60px); margin-top: 12px; border: 0; border-radius: 8px; background: #020617; }

.workbench-icon { width: 19px; height: 19px; flex: 0 0 auto; vertical-align: middle; }
body[data-page="workbench"] .agent-button { gap: 8px; }
body[data-page="workbench"] .agent-panel-head h2,
body[data-page="workbench"] .delivery-title h2 { display: flex; align-items: center; gap: 12px; margin: 0; }
.workbench-heading-icon { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid rgba(71,230,238,.22); border-radius: 11px; background: rgba(71,230,238,.07); color: var(--cyan-soft); }
.workbench-heading-icon .workbench-icon { width: 21px; height: 21px; }
body[data-page="workbench"] .agent-panel-head { margin-bottom: 22px; }
body[data-page="workbench"] .delivery-head { min-height: 42px; align-items: center; margin-bottom: 22px; }
body[data-page="workbench"] .report-search { position: relative; display: block; }
body[data-page="workbench"] .report-search > .workbench-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
body[data-page="workbench"] .report-search input { padding-left: 40px; }
body[data-page="workbench"] .agent-footer { justify-content: flex-end; }
.credit-topup-dialog { border-color: var(--line-strong); background: var(--panel-raised); color: var(--ink); }
.credit-topup-dialog > .agent-button { float: right; }
#open-credit-topup:disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* Report status filters share a quiet baseline on desktop and touch screens. */
body.report-studio[data-page="workbench"] .report-filters{display:flex;gap:28px;margin:12px 0 0;align-items:center;border-bottom:1px solid #e7e0eb}
body.report-studio[data-page="workbench"] .report-filters button{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:0 0 auto;min-height:44px;height:44px;padding:0 0 2px;border:0;border-radius:0;background:transparent;color:#84768d;box-shadow:none;font:500 14px/1.5 "Microsoft YaHei",sans-serif;letter-spacing:0;cursor:pointer;transition:color .15s ease}
body.report-studio[data-page="workbench"] .report-filters button::after{content:"";position:absolute;bottom:-1px;left:0;right:0;height:2px;background:transparent}
body.report-studio[data-page="workbench"] .report-filters button:hover{background:transparent;color:#604277;box-shadow:none}
body.report-studio[data-page="workbench"] .report-filters button[aria-pressed="true"]{background:transparent;color:#604277;font-weight:600;box-shadow:none}
body.report-studio[data-page="workbench"] .report-filters button[aria-pressed="true"]::after{background:#76558c}
body.report-studio[data-page="workbench"] .report-filters button:focus-visible{outline:2px solid #9b77b4;outline-offset:4px;border-radius:2px}
body.report-studio[data-page="workbench"] .report-filter-count{color:#978b9d;font-size:11px;font-weight:400;font-variant-numeric:tabular-nums}
body.report-studio[data-page="workbench"] .report-list.archive-shelf{margin-top:0}
body.report-studio[data-page="workbench"] .report-list.archive-shelf>.archive{padding-top:24px}
@media(max-width:760px),(max-width:1024px) and (pointer:coarse){body.report-studio[data-page="workbench"] .report-filters{gap:24px;margin:8px 0 16px}body.report-studio[data-page="workbench"] .report-filters button{flex:0 0 auto;font-size:13px}body.report-studio[data-page="workbench"] .report-list.archive-shelf>.archive{padding-top:0}}

.family-gate{max-width:440px;margin:12vh auto;padding:28px;font-family:system-ui;line-height:1.7}.family-gate input,.family-share-dialog input{display:block;box-sizing:border-box;width:100%;padding:12px;margin:12px 0;border:1px solid #bbb;border-radius:8px}.family-gate button,.family-share-dialog button{padding:10px 16px;cursor:pointer}.family-share-dialog{width:min(560px,90vw);max-height:85vh;overflow:auto;padding:24px;border:1px solid #ddd;border-radius:14px}.family-share-dialog::backdrop{background:#0006}.family-share-actions{display:flex;flex-wrap:wrap;gap:10px}.family-watermark{position:fixed;bottom:65px;right:20px;z-index:10000;color:#52645b;opacity:.42;pointer-events:none;font:14px system-ui}[data-share-path] #reader-download{display:none!important}

.family-share-dialog summary{cursor:pointer;padding:12px 0;min-height:44px}.family-share-dialog button{min-height:44px}.family-share-dialog [data-recovery]{padding:12px;background:#fff4df;border-radius:8px}
.family-poster-dialog{background:#faf7f2;color:#461436;width:min(660px,92vw)}
.family-poster-preview{display:block;width:100%;height:auto;border-radius:6px}
.family-poster-dialog .family-share-actions{position:sticky;bottom:0;background:#faf7f2;padding:14px 0}
.family-poster-dialog [data-save]{background:#644176;color:white;border:0;border-radius:8px}
.family-share-simple h2{margin:0 0 12px;font-size:22px;color:#493655}
.family-share-simple [data-summary]{font-size:14px;color:#705e7c;margin:16px 0 22px;line-height:1.6}
.family-share-simple [data-summary]:has(.share-password-line){padding:12px 16px;background:#f7f3fa;border-radius:10px}
.family-share-simple .share-password-line{display:flex;align-items:center;gap:14px}
.family-share-simple .share-password-line strong{font-family:ui-monospace,Consolas,monospace;font-size:20px;font-weight:600;letter-spacing:2px;color:#684480}
.family-share-simple [data-summary] small{display:block;margin-top:4px;font-size:12px;color:#8c7b96}
.family-share-simple [data-feedback]:empty{display:none}
.family-share-simple [data-feedback]{font-size:14px;overflow-wrap:anywhere}
.family-share-simple .family-share-primary{width:100%;min-height:46px;border:0;border-radius:10px;background:#684480;color:#fff;font-weight:600}
.family-share-simple details{margin-top:16px;border-top:1px solid #e6dfea}
.family-share-simple details p{font-size:13px;color:#776d7e}
.family-share-simple details summary{color:#684480;font-size:14px}
.family-share-simple input{font-size:16px}
.family-reader-label{font:12px system-ui;color:#96859d;white-space:nowrap}
.family-poster-preview{-webkit-touch-callout:default;user-select:auto;-webkit-user-select:auto}
.family-poster-dialog [role="status"]:empty{display:none}
.family-share-simple [hidden]{display:none!important}

/* The workbench stays visible behind its compact WeChat login dialog. */
#report-auth-dialog.report-login-modal{box-sizing:border-box;width:min(420px,calc(100vw - 32px));max-height:calc(100dvh - 32px);padding:30px 22px 18px;margin:auto;border:1px solid #ddd2e4;border-radius:16px;background:#fffdf9;color:#554361;box-shadow:0 24px 90px #39224a33;overflow:auto;text-align:center}
#report-auth-dialog::backdrop{background:#33243e55;backdrop-filter:blur(5px)}
#report-auth-dialog h2{font:600 23px/1.5 "Microsoft YaHei",sans-serif;color:#554361;margin:6px 0 8px}
#report-auth-dialog p{font-size:12px;line-height:1.8;color:#9a8ba3;margin:0 0 6px}
#report-auth-dialog .report-login-close{position:absolute;right:12px;top:10px;border:0;background:transparent;color:#9e8daa;font:26px/1 sans-serif;width:36px;height:36px;padding:0;cursor:pointer}
#report-auth-dialog .report-login-frame{display:block;border:0;width:100%;height:min(470px,60dvh);background:#fffdf9}
#report-auth-dialog .report-login-retry{border:0;background:transparent;color:#8a7397;font-size:12px;padding:8px 14px;cursor:pointer}
#report-auth-dialog button:focus-visible{outline:2px solid #86689b;outline-offset:2px}
@media(max-width:480px){#report-auth-dialog.report-login-modal{padding:28px 12px 14px}#report-auth-dialog h2{font-size:21px}}

/* Phone authorization uses a compact sheet, not the desktop QR-sized frame. */
#report-auth-dialog.report-login-mobile{width:min(420px,calc(100vw - 24px));padding:28px 16px max(14px,env(safe-area-inset-bottom));max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px)}
#report-auth-dialog.report-login-mobile .report-login-frame{height:280px;height:min(310px,calc(100dvh - 190px));min-height:180px}
#report-auth-dialog.report-login-mobile .report-login-close{width:44px;height:44px;top:4px;right:5px}
#report-auth-dialog.report-login-mobile .report-login-retry{min-height:44px;font-size:13px}
@media(max-width:760px),(max-width:1024px) and (pointer:coarse){#report-auth-dialog.report-login-modal{width:calc(100vw - 24px);max-width:420px;margin:auto;padding:28px 14px 14px;border-radius:16px}#report-auth-dialog h2{font-size:21px}#report-auth-dialog>p{padding:0 12px}}
