:root {
  color-scheme: light;
  --bg: #eeebe6;
  --bg-subtle: #e5dfd8;
  --surface: #fcf8f3;
  --surface-muted: #f6f0e9;
  --surface-raised: #fffaf5;
  --surface-input: rgba(255, 251, 246, 0.94);
  --frame-bg: rgba(252, 248, 243, 0.76);
  --frame-border: rgba(255, 255, 255, 0.52);
  --panel-bg: rgba(255, 251, 246, 0.92);
  --panel-muted-bg: rgba(246, 240, 233, 0.82);
  --line: #e4d9cc;
  --line-strong: #d4c4b3;
  --text: #5c4f45;
  --text-strong: #201a16;
  --muted: #8c7a6b;
  --brand-start: #ca7f68;
  --brand-mid: #a2859f;
  --brand-end: #7683a1;
  --brand-solid: #433731;
  --brand-on-solid: #fbf6f0;
  --brand-gradient: linear-gradient(90deg, var(--brand-start) 0%, var(--brand-mid) 52%, var(--brand-end) 100%);
  --brand-gradient-strong: linear-gradient(90deg, #bb7963 0%, #987d95 52%, #738098 100%);
  --brand-soft: rgba(202, 127, 104, 0.09);
  --brand-ring: rgba(147, 122, 104, 0.18);
  --accent: #8b7360;
  --accent-strong: #725c4d;
  --accent-soft: rgba(139, 115, 96, 0.1);
  --accent-ring: rgba(139, 115, 96, 0.14);
  --state-progress: #8b7360;
  --state-progress-soft: rgba(139, 115, 96, 0.16);
  --state-waiting: #a28a79;
  --state-waiting-soft: rgba(162, 138, 121, 0.14);
  --review: #8e7b63;
  --review-soft: rgba(142, 123, 99, 0.12);
  --success: #4d8f73;
  --success-soft: rgba(77, 143, 115, 0.12);
  --error: #d92d20;
  --error-soft: rgba(217, 45, 32, 0.08);
  --shadow-soft: 0 1px 2px rgba(54, 40, 29, 0.04), 0 20px 46px rgba(128, 98, 72, 0.12);
  --shadow-card: 0 1px 2px rgba(54, 40, 29, 0.04), 0 10px 26px rgba(128, 98, 72, 0.08);
  --glow-a: rgba(245, 164, 126, 0.34);
  --glow-b: rgba(212, 189, 165, 0.24);
  --glow-c: rgba(194, 156, 172, 0.12);
  --font-sans: "SF Pro Text", "SF Pro Display", "Segoe UI Variable", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-heading: "SF Pro Display", "Avenir Next", "PingFang SC", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Menlo", monospace;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151210;
  --bg-subtle: #1d1815;
  --surface: #211c19;
  --surface-muted: #29231f;
  --surface-raised: #312925;
  --surface-input: rgba(49, 41, 37, 0.94);
  --frame-bg: rgba(27, 22, 19, 0.78);
  --frame-border: rgba(255, 255, 255, 0.08);
  --panel-bg: rgba(34, 28, 24, 0.92);
  --panel-muted-bg: rgba(41, 35, 31, 0.84);
  --line: #3c322a;
  --line-strong: #50433a;
  --text: #d6ccbf;
  --text-strong: #f6f0e8;
  --muted: #a39282;
  --brand-start: #da9680;
  --brand-mid: #b190a9;
  --brand-end: #8a94af;
  --brand-solid: #d6c4b7;
  --brand-on-solid: #201913;
  --brand-gradient: linear-gradient(90deg, var(--brand-start) 0%, var(--brand-mid) 52%, var(--brand-end) 100%);
  --brand-gradient-strong: linear-gradient(90deg, #c88772 0%, #a98aa1 52%, #8990a8 100%);
  --brand-soft: rgba(218, 150, 128, 0.12);
  --brand-ring: rgba(214, 196, 183, 0.18);
  --accent: #b59780;
  --accent-strong: #d2b19a;
  --accent-soft: rgba(181, 151, 128, 0.14);
  --accent-ring: rgba(181, 151, 128, 0.2);
  --state-progress: #d2b19a;
  --state-progress-soft: rgba(210, 177, 154, 0.18);
  --state-waiting: #bfa48f;
  --state-waiting-soft: rgba(191, 164, 143, 0.16);
  --review: #d3b493;
  --review-soft: rgba(211, 180, 147, 0.18);
  --success: #6ea88d;
  --success-soft: rgba(110, 168, 141, 0.16);
  --error: #ff6b6b;
  --error-soft: rgba(255, 107, 107, 0.12);
  --shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.26), 0 22px 52px rgba(0, 0, 0, 0.34);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.24), 0 12px 28px rgba(0, 0, 0, 0.26);
  --glow-a: rgba(175, 103, 74, 0.22);
  --glow-b: rgba(115, 90, 71, 0.16);
  --glow-c: rgba(142, 110, 125, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1180px 520px at 88% 100%, var(--glow-a) 0%, transparent 58%),
    radial-gradient(960px 420px at 8% 102%, var(--glow-b) 0%, transparent 60%),
    radial-gradient(640px 260px at 76% 8%, var(--glow-c) 0%, transparent 62%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-subtle) 100%);
  font-family: var(--font-sans);
  transition: background 0.25s ease, color 0.2s ease;
}

body.gate-locked {
  overflow: hidden;
}

body.gate-locked #appShell {
  filter: blur(18px);
  pointer-events: none;
  user-select: none;
}

main,
section,
header,
div {
  min-width: 0;
}

.entry-gate {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(960px 460px at 86% 100%, rgba(202, 127, 104, 0.18) 0%, transparent 60%),
    radial-gradient(760px 320px at 12% 0%, rgba(162, 133, 159, 0.14) 0%, transparent 62%),
    rgba(238, 235, 230, 0.38);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

body[data-theme="dark"] .entry-gate {
  background:
    radial-gradient(960px 460px at 86% 100%, rgba(218, 150, 128, 0.18) 0%, transparent 60%),
    radial-gradient(760px 320px at 12% 0%, rgba(177, 144, 169, 0.16) 0%, transparent 62%),
    rgba(21, 18, 16, 0.46);
}

.entry-gate-panel {
  width: min(100%, 420px);
  padding: 30px 28px 26px;
  border: 1px solid var(--frame-border);
  border-radius: 28px;
  background: rgba(252, 248, 243, 0.8);
  box-shadow: 0 24px 60px rgba(84, 64, 48, 0.16);
}

body[data-theme="dark"] .entry-gate-panel {
  background: rgba(27, 22, 19, 0.84);
}

.entry-gate-copy {
  display: grid;
  justify-items: center;
  gap: 6px;
  margin-bottom: 20px;
  text-align: center;
}

.entry-gate-copy h2 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-heading);
  font-size: clamp(1.9rem, 4.4vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.entry-code-form {
  display: grid;
}

.entry-code-field {
  display: grid;
  gap: 10px;
}

.entry-code-field span {
  color: var(--text-strong);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
}

.entry-code-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  background: var(--surface-input);
  color: var(--text-strong);
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: 0.32em;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.entry-code-input::placeholder {
  color: var(--muted);
  letter-spacing: 0.06em;
  font-size: 1rem;
}

.entry-code-input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.entry-code-error {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--error);
  font-size: 0.9rem;
  text-align: center;
}

.shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 20px 18px 40px;
  transition: filter 0.24s ease;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0 16px;
  border-bottom: 1px solid var(--line);
}

.topbar-copy {
  display: grid;
  gap: 6px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy-compact {
  display: grid;
  gap: 4px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: lowercase;
  font-size: 0.76rem;
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-heading);
  font-size: clamp(1.6rem, 3.1vw, 2.1rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.brand-gradient {
  display: inline-block;
  margin-right: 0.12em;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.28);
  color: var(--text-strong);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

body[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.08);
}

.theme-toggle-icon {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.theme-toggle-icon.active {
  border-color: var(--line-strong);
  background: rgba(255, 250, 244, 0.92);
}

body[data-theme="dark"] .theme-toggle-icon.active {
  background: rgba(255, 248, 240, 0.1);
}

.theme-toggle-glyph {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
}

.theme-toggle-glyph svg {
  width: 18px;
  height: 18px;
}

.workspace-frame {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--frame-border);
  border-radius: 28px;
  background: var(--frame-bg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.workspace-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.main-tabs,
.subtabs,
.source-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.subtabs {
  margin-bottom: 16px;
}

.tab-button,
.subtab-button,
.source-switch-item span {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.tab-button:hover,
.subtab-button:hover,
.source-switch-item span:hover {
  color: var(--text-strong);
}

.tab-button.active,
.subtab-button.active,
.source-switch-item input:checked + span {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 250, 244, 0.88);
  color: var(--text-strong);
  box-shadow: 0 8px 20px rgba(84, 64, 48, 0.08);
}

body[data-theme="dark"] .main-tabs,
body[data-theme="dark"] .subtabs,
body[data-theme="dark"] .source-switch {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: none;
}

body[data-theme="dark"] .tab-button.active,
body[data-theme="dark"] .subtab-button.active,
body[data-theme="dark"] .source-switch-item input:checked + span {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 248, 240, 0.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.workspace.hidden {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 16px;
}

.single-panel {
  display: grid;
  grid-template-columns: 1fr;
}

.single-panel .panel:not(.panel-combined) {
  max-width: none;
}

.summary-grid {
  align-items: start;
}

.summary-workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 16px;
  align-items: start;
}

.panel {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel-bg);
  box-shadow: var(--shadow-card);
}

.panel-form {
  overflow: visible;
}

.panel-head {
  padding: 20px 20px 0;
}

.panel-head h2,
.preview-head h3,
.soft-block-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-heading);
  font-size: 1.24rem;
  letter-spacing: -0.02em;
}

.panel-head p,
.preview-head p,
.soft-block-head p,
.step-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.form,
.job-state,
.empty-state {
  padding: 20px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.job-state {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel-combined {
  max-width: none !important;
}

.panel-combined .form {
  padding-top: 16px;
}

.summary-builder-form {
  gap: 18px;
}

.summary-source-panel {
  display: grid;
  gap: 14px;
  padding-bottom: 2px;
}

.summary-step-grid {
  display: grid;
  gap: 18px;
}

.summary-step-section {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.summary-step-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.summary-result-panel .job-state {
  gap: 16px;
}

.summary-preview-stack {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-muted-bg);
  overflow: hidden;
}

.summary-preview-block {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.summary-preview-block:first-child {
  border-top: 0;
}

.summary-preview-block .preview-head {
  padding: 14px 16px 0;
}

.summary-preview-block .line-preview,
.summary-preview-block .keyword-preview-grid {
  max-height: 260px;
  background: transparent;
}

.summary-preview-block .keyword-preview-grid {
  min-height: 56px;
}

.panel-divider {
  height: 1px;
  margin: 0 20px;
  background: var(--line);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.field-head-range {
  min-height: 28px;
}

.field-label-with-help {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 700;
  cursor: help;
  user-select: none;
  line-height: 1;
  flex-shrink: 0;
  transform: translateY(-1px);
}

.help-badge::before,
.help-badge::after {
  position: absolute;
  left: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 20;
}

.help-badge::before {
  content: "";
  bottom: calc(100% + 6px);
  transform: translateX(-50%) translateY(4px);
  border-width: 6px 6px 0 6px;
  border-style: solid;
  border-color: rgba(53, 44, 38, 0.92) transparent transparent transparent;
}

.help-badge::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 12px);
  width: min(280px, 46vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(53, 44, 38, 0.92);
  color: #fff7f2;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.55;
  text-align: left;
  white-space: normal;
  box-shadow: 0 14px 30px rgba(53, 44, 38, 0.18);
  transform: translateX(-50%) translateY(4px);
}

.help-badge:hover,
.help-badge:focus-visible {
  border-color: var(--accent-strong);
  color: var(--accent-strong);
  outline: none;
}

.help-badge:hover::before,
.help-badge:hover::after,
.help-badge:focus-visible::before,
.help-badge:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body[data-theme="dark"] .help-badge::before {
  border-color: rgba(255, 248, 242, 0.96) transparent transparent transparent;
}

body[data-theme="dark"] .help-badge::after {
  background: rgba(255, 248, 242, 0.96);
  color: #3d3129;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.field span {
  color: var(--text-strong);
  font-size: 0.92rem;
  font-weight: 600;
}

.range-value {
  color: var(--accent);
  font-size: 0.92rem;
  display: inline-flex;
  align-items: center;
}

.field-range {
  justify-content: center;
}

.field-range input[type="range"] {
  margin: 0;
}

input,
select,
textarea,
.button {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-input);
  color: var(--text-strong);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3.25 5.25 7 8.75l3.75-3.5' stroke='%235c4f45' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
}

select:hover {
  border-color: var(--line-strong);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  color: var(--muted);
  background: var(--surface-muted);
  border-style: dashed;
  box-shadow: none;
}

body[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3.25 5.25 7 8.75l3.75-3.5' stroke='%23f6f0e8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

input[readonly] {
  color: var(--text);
  background: var(--surface-muted);
  border-style: dashed;
  cursor: default;
}

.readonly-display {
  border-style: solid;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 100%),
    var(--surface-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  caret-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  color: var(--muted);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-strong);
  cursor: pointer;
}

textarea {
  min-height: 128px;
  resize: vertical;
}

input[type="range"] {
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  accent-color: var(--accent);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.note {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.note:not(:empty) {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-muted-bg);
}

.credential-note {
  padding: 0 2px;
  font-size: 0.86rem;
}

.credential-note:not(:empty) {
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.micro-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.inline-summary {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
}

.inline-summary-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.inline-summary-value {
  margin: 0;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.55;
}

.quick-card,
.soft-block,
.tech-block,
.preview,
.step-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-muted-bg);
}

.quick-card,
.soft-block {
  padding: 16px;
}

.quick-label,
.soft-block-eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-value {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 0.96rem;
  line-height: 1.65;
}

.soft-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-card {
  padding: 16px;
}

.admin-card h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-heading);
  font-size: 1.02rem;
}

.admin-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-card-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.admin-stack {
  display: grid;
  gap: 16px;
}

.admin-subtabs {
  margin-bottom: 4px;
}

.admin-panel-body {
  display: grid;
  gap: 16px;
}

.admin-panel-body > .admin-overview-grid,
.admin-panel-body > .admin-grid,
.admin-panel-body > .admin-table-toolbar,
.admin-panel-body > .table-wrap,
.admin-panel-body > .metric-empty,
.admin-panel-body > .admin-date-chips {
  width: 100%;
}

.admin-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0 2px;
}

.admin-date-field {
  min-width: 220px;
}

.admin-toolbar-meta {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.admin-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.admin-stat-card {
  display: grid;
  gap: 8px;
}

.admin-stat-value {
  color: var(--text-strong);
  font-family: var(--font-heading);
  font-size: 2rem;
  letter-spacing: -0.03em;
}

.admin-stat-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.admin-grid-metrics {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-card-wide {
  grid-column: 1 / -1;
}

.admin-table-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-date-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-date-chip {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  color: var(--muted);
}

.admin-date-chip.active {
  border-color: var(--accent-strong);
  background: rgba(255, 250, 244, 0.94);
  color: var(--text-strong);
}

body[data-theme="dark"] .admin-date-chip {
  background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .admin-date-chip.active {
  background: rgba(255, 248, 240, 0.1);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.18);
}

body[data-theme="dark"] .table-wrap {
  background: rgba(255, 255, 255, 0.03);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-raised);
  color: var(--text-strong);
  font-size: 0.88rem;
}

.admin-table td {
  color: var(--text);
  font-size: 0.92rem;
}

.admin-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.14);
}

.admin-table tbody tr:hover td {
  background: rgba(255, 250, 244, 0.68);
}

.admin-table th:nth-child(n + 5):nth-child(-n + 19),
.admin-table td:nth-child(n + 5):nth-child(-n + 19) {
  text-align: right;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

body[data-theme="dark"] .admin-toolbar-meta {
  background: rgba(255, 255, 255, 0.04);
}

body[data-theme="dark"] .admin-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}

body[data-theme="dark"] .admin-table tbody tr:hover td {
  background: rgba(255, 248, 240, 0.08);
}

.metric-list {
  display: grid;
  gap: 12px;
}

.metric-item {
  display: grid;
  gap: 8px;
}

.metric-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metric-item-head-stacked {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.metric-item-label {
  color: var(--text-strong);
  font-weight: 600;
}

.metric-item-value {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.metric-bar-track {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--state-progress-soft);
}

.metric-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--state-progress);
}

.metric-item-foot {
  color: var(--muted);
  font-size: 0.84rem;
}

body[data-theme="dark"] .metric-bar-track {
  background: rgba(255, 255, 255, 0.08);
}

.metric-empty {
  color: var(--muted);
  line-height: 1.7;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: var(--accent-strong);
}

.completion-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
}

.completion-donut {
  --success-ratio: 0%;
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--success) 0 var(--success-ratio), var(--error) var(--success-ratio) 100%);
}

.completion-donut::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: var(--panel-bg);
}

.completion-donut-center {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  text-align: center;
}

.completion-donut-center strong {
  color: var(--text-strong);
  font-family: var(--font-heading);
  font-size: 1.6rem;
}

.completion-donut-center span {
  color: var(--muted);
  font-size: 0.88rem;
}

.completion-legend {
  display: grid;
  gap: 10px;
}

.completion-legend-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.completion-legend-item strong {
  color: var(--text-strong);
}

.completion-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.completion-legend-dot.success {
  background: var(--success);
}

.completion-legend-dot.failed {
  background: var(--error);
}

.token-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.token-chip {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.26);
}

.token-chip span {
  color: var(--muted);
  font-size: 0.88rem;
}

.token-chip strong {
  color: var(--text-strong);
  font-size: 1.1rem;
  font-family: var(--font-heading);
}

body[data-theme="dark"] .token-chip {
  background: rgba(255, 255, 255, 0.04);
}

.source-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-muted-bg);
}

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

.source-toolbar-stacked {
  align-items: flex-start;
}

.source-title {
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 650;
}

.source-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.field-compact {
  gap: 6px;
}

.source-switch-item {
  position: relative;
}

.source-switch-item input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.source-switch-item span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

body[data-theme="dark"] .button-secondary {
  background: rgba(255, 255, 255, 0.06);
}

.source-card .field > span {
  font-size: 0.88rem;
}

.source-select-field {
  gap: 8px;
}

.upload-dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  background: rgba(255, 252, 248, 0.78);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.upload-dropzone:hover,
.upload-dropzone.dragging {
  border-color: var(--accent-strong);
  background: rgba(255, 248, 241, 0.92);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(84, 64, 48, 0.08);
}

.upload-dropzone.has-file {
  border-style: solid;
}

.upload-dropzone-compact {
  padding-block: 22px;
}

.upload-dropzone-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--brand-ring);
  border-radius: 18px;
  background: rgba(255, 245, 238, 0.9);
  color: var(--accent-strong);
  font-size: 1.35rem;
  font-weight: 700;
}

.upload-dropzone-copy {
  display: grid;
  gap: 6px;
}

.upload-dropzone-copy h3 {
  margin: 0;
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 650;
}

.upload-dropzone-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}

.visually-hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

body[data-theme="dark"] .upload-dropzone {
  background: rgba(255, 249, 243, 0.04);
}

body[data-theme="dark"] .upload-dropzone:hover,
body[data-theme="dark"] .upload-dropzone.dragging {
  background: rgba(255, 249, 243, 0.08);
  box-shadow: none;
}

.step-flow {
  display: grid;
  gap: 14px;
}

.step-card {
  padding: 16px;
}

.step-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.step-head h3 {
  margin: 0;
  color: var(--text-strong);
  font-family: var(--font-heading);
  font-size: 1.04rem;
}

.step-badge {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--brand-ring);
  border-radius: 999px;
  background: var(--brand-solid);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
}

.choice-grid,
.choice-list,
.tag-grid {
  display: grid;
  gap: 10px;
}

.choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.tag-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.choice-option,
.choice-row,
.tag-chip {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 252, 248, 0.88);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.choice-option:hover,
.choice-row:hover,
.tag-chip:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
}

.choice-option {
  min-height: 88px;
  padding: 14px;
}

.choice-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
}

.tag-chip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  padding: 14px;
}

.keyword-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.keyword-selector .tag-chip {
  width: auto;
  min-height: 0;
  padding: 8px 12px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
}

.choice-option.active,
.choice-row.active,
.tag-chip.active {
  border-color: var(--brand-ring);
  background:
    linear-gradient(0deg, var(--brand-soft), var(--brand-soft)),
    rgba(255, 252, 248, 0.92);
}

.choice-title,
.tag-chip-label {
  display: block;
  color: var(--text-strong);
  font-weight: 650;
}

.choice-meta,
.choice-desc,
.tag-chip-reason {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.58;
  font-size: 0.9rem;
}

.keyword-status {
  display: grid;
  gap: 10px;
}

.progress-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.progress-meta-compact {
  align-items: center;
}

.label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.message {
  margin: 0;
  color: var(--text-strong);
  font-size: 1rem;
  font-weight: 650;
}

.percent {
  color: var(--accent);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.percent-compact {
  font-size: 1.1rem;
}

.progress-bar {
  width: 100%;
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  background: var(--state-progress-soft);
  overflow: hidden;
}

.progress-bar-compact {
  margin-top: 0;
}

.progress-fill {
  width: 0;
  height: 100%;
  background: var(--state-progress);
  transition: width 0.3s ease;
}

.empty-state,
.empty-inline {
  color: var(--muted);
  line-height: 1.7;
}

.empty-state-centered {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding-block: 34px;
  text-align: center;
}

.empty-guide-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--brand-ring);
  border-radius: 16px;
  background: rgba(255, 245, 238, 0.88);
  color: var(--accent-strong);
  font-size: 1.2rem;
  font-weight: 700;
}

.empty-guide-title {
  margin: 0;
  color: var(--text-strong);
  font-size: 1.02rem;
  font-weight: 650;
}

.empty-guide-text {
  max-width: 280px;
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

body[data-theme="dark"] .empty-guide-icon {
  background: rgba(255, 249, 243, 0.08);
}

.empty-inline {
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.job-state > .actions {
  margin-top: -2px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  box-shadow: none;
  transform: none;
}

.button-primary:disabled {
  border-color: rgba(0, 0, 0, 0.04);
  background: rgba(146, 136, 126, 0.34);
  color: rgba(58, 48, 41, 0.72);
}

body[data-theme="dark"] .button-primary:disabled {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 250, 244, 0.56);
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled:hover {
  transform: none;
}

.button-primary {
  border: 1px solid rgba(0, 0, 0, 0.04);
  background: var(--brand-solid);
  color: var(--brand-on-solid);
  box-shadow: 0 12px 28px rgba(74, 56, 42, 0.16);
}

body[data-theme="dark"] .button-primary {
  color: var(--brand-on-solid);
}

.button-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.24);
  color: var(--text-strong);
}

.button-inline {
  min-height: 38px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.error-box {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(217, 45, 32, 0.18);
  border-radius: 14px;
  background: var(--error-soft);
  color: var(--error);
  line-height: 1.65;
}

.info-list {
  margin-top: 18px;
  display: grid;
  gap: 0;
}

.info-list div {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.info-list div:last-child {
  border-bottom: 0;
}

.info-list span {
  color: var(--muted);
}

.info-list strong {
  color: var(--text);
  word-break: break-all;
}

.preview {
  margin-top: 18px;
  overflow: hidden;
}

.preview-head {
  padding: 14px 16px 0;
}

.preview-head h3 {
  font-size: 1.06rem;
}

.keyword-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  min-height: 70px;
  background: rgba(255, 252, 248, 0.84);
}

.keyword-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 247, 240, 0.8);
  color: var(--text-strong);
  font-size: 0.9rem;
  font-weight: 600;
}

.keyword-preview-empty {
  color: var(--muted);
  font-size: 0.92rem;
}

body[data-theme="dark"] .keyword-preview-grid,
body[data-theme="dark"] .line-preview {
  background: rgba(255, 249, 242, 0.04);
}

body[data-theme="dark"] .keyword-pill {
  background: rgba(255, 249, 242, 0.06);
}

body[data-theme="dark"] .line-no {
  background: rgba(255, 249, 242, 0.05);
}

.preview pre {
  margin: 0;
  padding: 16px;
  max-height: 280px;
  overflow: auto;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.line-preview-card {
  overflow: hidden;
}

.line-preview {
  max-height: 420px;
  overflow: auto;
  background: rgba(255, 252, 248, 0.84);
  font-family: var(--font-mono);
  font-size: 0.88rem;
}

.panel-combined .line-preview {
  max-height: 560px;
}

.line-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  border-top: 1px solid var(--line);
}

.line-row:first-child {
  border-top: 0;
}

.line-no,
.line-text {
  display: block;
  padding: 10px 12px;
  line-height: 1.68;
  white-space: pre-wrap;
  word-break: break-word;
}

.line-no {
  text-align: right;
  color: var(--muted);
  background: rgba(246, 239, 231, 0.92);
  border-right: 1px solid var(--line);
  user-select: none;
}

.line-text {
  color: var(--text);
}

.line-empty .line-text {
  color: var(--muted);
}

.tech-block {
  margin-top: 18px;
  overflow: hidden;
}

.tech-block summary {
  cursor: pointer;
  padding: 14px 16px;
  color: var(--text-strong);
  font-weight: 650;
  list-style: none;
}

.tech-block summary::-webkit-details-marker {
  display: none;
}

.tech-block summary::after {
  content: "展开";
  float: right;
  color: var(--muted);
  font-weight: 500;
}

.tech-block[open] summary::after {
  content: "收起";
}

.tech-stack {
  padding: 0 16px 16px;
}

.compact-info {
  margin-top: 0;
}

.compact-info div {
  grid-template-columns: 84px 1fr;
}

.tech-log {
  margin-top: 16px;
}

.log-preview pre {
  max-height: 240px;
}

.hidden {
  display: none !important;
}

:is(
  input[type="number"],
  .range-value,
  .percent,
  .admin-stat-value,
  .completion-donut-center strong,
  .token-chip strong,
  .metric-item-value,
  .line-no,
  .admin-table th,
  .admin-table td,
  .info-list strong
) {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

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

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

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

  .admin-overview-grid,
  .token-summary-grid {
    grid-template-columns: 1fr;
  }

  .admin-table-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .completion-card {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .topbar,
  .workspace-nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  .entry-gate {
    padding: 16px;
  }

  .entry-gate-panel {
    padding: 24px 20px 22px;
    border-radius: 24px;
  }

  .entry-code-input {
    font-size: 1.36rem;
  }

  .shell {
    padding: 16px 12px 30px;
  }

  .workspace-frame {
    padding: 14px;
    border-radius: 22px;
  }

  .panel {
    border-radius: 18px;
  }

  .field-grid,
  .info-list div,
  .compact-info div {
    grid-template-columns: 1fr;
  }

  .main-tabs,
  .subtabs {
    width: 100%;
  }

  .tab-button,
  .subtab-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .topbar-actions {
    align-items: stretch;
  }

  .theme-toggle {
    width: 100%;
  }

  .choice-grid,
  .tag-grid {
    grid-template-columns: 1fr;
  }

  .source-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .keyword-selector {
    gap: 8px;
  }

  .line-row {
    grid-template-columns: 54px 1fr;
  }
}
