:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef3f8;
  --text: #172332;
  --muted: #728095;
  --muted-strong: #506078;
  --line: #e2e8f0;
  --line-strong: #d5dfeb;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #edf4ff;
  --green: #0f9f72;
  --green-soft: #e8f8f1;
  --red: #d94a55;
  --amber: #c47b18;
  --shadow: 0 20px 50px rgba(34, 53, 79, 0.08);
  --shadow-small: 0 8px 24px rgba(34, 53, 79, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f141b;
  --surface: #151c25;
  --surface-soft: #111821;
  --surface-muted: #1b2633;
  --text: #edf3fb;
  --muted: #91a0b3;
  --muted-strong: #bcc8d6;
  --line: #273545;
  --line-strong: #34485e;
  --blue: #63a0ff;
  --blue-dark: #3d82ed;
  --blue-soft: #182c4c;
  --green: #3bd09c;
  --green-soft: #12392e;
  --red: #ff7b83;
  --amber: #e5a53e;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  --shadow-small: 0 8px 24px rgba(0, 0, 0, 0.16);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.62; }

.app-shell {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 56px;
}

.topbar {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: transparent;
  box-shadow: 0 10px 22px rgba(255, 111, 31, 0.18);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { font-size: 16px; letter-spacing: 0; }
.brand-copy small { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }

.topbar-actions, .intro-actions, .service-status, .queue-badge, .helper-row { display: flex; align-items: center; }
.topbar-actions { gap: 14px; }
.service-status { gap: 8px; color: var(--muted-strong); font-size: 13px; font-weight: 800; }
.status-dot, .pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status-dot { box-shadow: 0 0 0 4px var(--green-soft); }

.icon-button, .quiet-button, .small-button, .ghost-button, .primary-button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.icon-button:hover, .quiet-button:hover, .small-button:hover, .ghost-button:hover { border-color: var(--blue); color: var(--blue); }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; }
.theme-icon { width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; position: relative; }
.theme-icon::after { content: ""; position: absolute; top: -3px; right: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); }

.intro-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin: 48px 0 28px;
}

.eyebrow, .section-kicker {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.8px;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(36px, 5vw, 54px); line-height: 1.05; letter-spacing: -1.5px; }
h2 { font-size: 20px; line-height: 1.2; }
h3 { font-size: 19px; line-height: 1.2; }
.intro-copy { margin-top: 12px; color: var(--muted); font-size: 17px; }
.intro-actions { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.quiet-button { min-height: 40px; padding: 0 13px; color: var(--muted-strong); font-size: 13px; }
.quiet-button span { margin-right: 6px; color: var(--blue); font-size: 17px; vertical-align: -1px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr); gap: 22px; align-items: start; }
.workflow-card, .status-panel, .info-card, .session-guide { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.workflow-card { padding: 30px; }
.workflow-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.queue-badge { gap: 8px; min-height: 32px; border: 1px solid var(--line); border-radius: 999px; padding: 0 11px; color: var(--muted); font-size: 12px; font-weight: 800; white-space: nowrap; }
.queue-badge strong { color: var(--blue); font-size: 16px; }

.stepper { display: grid; grid-template-columns: auto minmax(30px, 1fr) auto minmax(30px, 1fr) auto; gap: 12px; align-items: center; margin: 28px 0 34px; }
.step { display: flex; align-items: center; gap: 9px; color: var(--muted); white-space: nowrap; }
.step > span { display: grid; width: 32px; height: 32px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--muted); font-size: 12px; font-weight: 900; }
.step div { display: grid; gap: 2px; }
.step small { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: 1px; }
.step strong { font-size: 13px; }
.step.active { color: var(--blue); }
.step.active > span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.step.active small { color: var(--blue); }
.step-line { height: 1px; background: var(--line); }

.form-page { display: none; }
.form-page.active { display: block; }
.field-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.field-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.field-number { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 10px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 900; }

.input-shell { display: flex; align-items: center; min-height: 68px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-soft); transition: border-color 160ms ease, box-shadow 160ms ease; }
.input-shell:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 15%, transparent); }
.input-prefix { padding: 0 17px; border-right: 1px solid var(--line); color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: 1px; }
input, textarea, select { width: 100%; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-soft); color: var(--text); outline: none; }
.input-shell input { min-height: 66px; border: 0; border-radius: 0 11px 11px 0; padding: 0 17px; background: transparent; }
textarea { min-height: 170px; resize: vertical; padding: 16px; line-height: 1.6; }
textarea:disabled { cursor: not-allowed; opacity: 0.72; }
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 15%, transparent); }

.primary-button { display: inline-flex; min-height: 58px; align-items: center; justify-content: center; gap: 20px; width: 100%; margin-top: 18px; border-color: transparent; background: var(--blue); color: #fff; box-shadow: 0 10px 20px rgba(37, 99, 235, 0.17); }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.primary-button b { font-size: 20px; font-weight: 500; }
.ghost-button { min-height: 58px; min-width: 100px; padding: 0 18px; color: var(--muted-strong); }
.button-row { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.button-row .primary-button { margin-top: 0; }

.helper-row { gap: 7px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.helper-icon { display: grid; width: 16px; height: 16px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 10px; font-weight: 900; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.summary-grid label { display: grid; gap: 8px; }
.summary-grid label > span { color: var(--muted-strong); font-size: 12px; font-weight: 850; }
select { min-height: 56px; padding: 0 14px; }
select:disabled { opacity: 0.75; }
.review-box { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.review-box div, .task-card div { min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; background: var(--surface-soft); }
.review-box span, .task-card span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.review-box strong, .task-card strong { display: block; overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.side-column { display: grid; gap: 14px; }
.info-card { display: flex; align-items: flex-start; gap: 12px; padding: 17px; box-shadow: var(--shadow-small); }
.card-icon { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 9px; font-weight: 900; }
.blue-icon { background: var(--blue-soft); color: var(--blue); }
.green-icon { background: var(--green-soft); color: var(--green); }
.info-card strong { font-size: 14px; }
.info-card p { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.session-guide { padding: 18px; box-shadow: var(--shadow-small); }
.session-guide-head p { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.guide-actions { display: grid; gap: 10px; margin-top: 16px; }
.guide-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 72px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); padding: 12px 13px; color: inherit; text-decoration: none; transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.guide-card:hover { border-color: var(--blue); background: var(--blue-soft); transform: translateY(-1px); }
.guide-step { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 900; }
.guide-copy { display: grid; min-width: 0; gap: 3px; }
.guide-copy strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.guide-copy small { color: var(--muted); font-size: 12px; }
.guide-arrow { color: var(--muted-strong); font-size: 18px; }

.status-panel { overflow: hidden; }
.panel-head { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 0 20px; }
.panel-head h2 { margin-top: 1px; }
.panel-head .section-kicker { margin-bottom: 4px; }
.small-button { min-height: 34px; padding: 0 11px; color: var(--muted-strong); font-size: 12px; }
.empty-state, .empty-log { display: grid; min-height: 170px; align-content: center; justify-items: center; gap: 7px; padding: 24px; text-align: center; color: var(--muted); }
.empty-state strong, .empty-log strong { color: var(--muted-strong); font-size: 13px; }
.empty-state small, .empty-log small { font-size: 12px; }
.empty-icon { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--blue); font-size: 20px; }
.task-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 16px; }
.log-panel { margin-top: 22px; }
.log-list { display: flex; max-height: 300px; min-height: 150px; flex-direction: column; gap: 8px; overflow: auto; padding: 14px 16px; }
.log-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 10px; border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 8px; padding: 10px 12px; background: var(--surface-soft); font-size: 13px; }
.log-row time { color: var(--muted); font-size: 11px; }
.log-row.success { border-left-color: var(--green); }
.log-row.error { border-left-color: var(--red); }
.log-row.warn { border-left-color: var(--amber); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .app-shell { width: min(100% - 28px, 680px); padding-top: 14px; }
  .intro-row { align-items: flex-start; flex-direction: column; margin-top: 38px; }
  .intro-actions { justify-content: flex-start; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-column .status-panel, .side-column .session-guide { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .app-shell { width: min(100% - 20px, 520px); padding-bottom: 28px; }
  .brand-copy small { display: none; }
  .service-status { display: none; }
  .intro-row { margin-top: 30px; }
  h1 { font-size: 38px; letter-spacing: -1px; }
  .intro-copy { font-size: 15px; }
  .workflow-card { padding: 22px 18px; }
  .workflow-head { flex-direction: column; }
  .stepper { gap: 7px; margin: 22px 0 28px; }
  .step { gap: 6px; }
  .step > span { width: 28px; height: 28px; }
  .step small { display: none; }
  .step strong { font-size: 12px; }
  .step-line { min-width: 12px; }
  .side-column { grid-template-columns: 1fr; }
  .side-column .status-panel { grid-column: auto; }
  .summary-grid, .review-box, .task-card { grid-template-columns: 1fr; }
  .button-row { flex-direction: column; }
  .button-row button { width: 100%; }
  .quiet-button { flex: 1; }
}
