:root {
  color-scheme: light;
  --canvas: #f8f7f3;
  --paper: #fffefa;
  --rail: #eeeee7;
  --ink: #202725;
  --muted: #54605a;
  --line: #d6dbd2;
  --teal: #245e47;
  --green-surface: #e7f0e8;
  --amber: #805322;
  --amber-surface: #fbefdc;
  --blue-surface: #e8f0f9;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  font-size: 15px;
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--teal); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #458fef; outline-offset: 3px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { font-family: "Aptos Display", "Segoe UI", sans-serif; font-size: clamp(1.85rem, 3vw, 2.5rem); line-height: 1.15; letter-spacing: -.045em; overflow-wrap: anywhere; }
h2 { font-size: 1.04rem; letter-spacing: -.02em; }
h3 { font-size: .96rem; }
code, .date, .metrics dd { font-variant-numeric: tabular-nums; }
code { font-family: "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 202px minmax(0, 1fr); }
.sidebar { display: flex; flex-direction: column; gap: 29px; padding: 34px 19px 23px; border-inline-end: 1px solid var(--line); background: var(--rail); }
.brand { display: inline-block; margin-inline: 9px; color: var(--ink); font-size: 1.3rem; font-weight: 750; line-height: 1.17; letter-spacing: -.045em; text-decoration: none; }
.navigation { display: grid; gap: 2px; }
.navigation a { border-inline-start: 2px solid transparent; padding: 8px 10px; color: var(--muted); text-decoration: none; }
.navigation a:hover, .navigation a[aria-current] { color: var(--teal); background: #e1e8df; }
.navigation a[aria-current] { border-inline-start-color: var(--teal); font-weight: 650; }
.sidebar-footer { display: grid; gap: 10px; margin: auto 9px 0; }
.sign-out button { border: 0; padding: 4px 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.sign-out button:hover { color: var(--teal); }

.main { width: 100%; min-width: 0; padding: clamp(22px, 4vw, 55px) clamp(18px, 4vw, 58px) 50px; }
.mode { display: inline-flex; align-items: center; gap: 7px; color: var(--amber); font-size: .82rem; font-weight: 600; white-space: nowrap; }
.mode span, .worker-label span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.page-heading { margin-block: 0 24px; }
.page-heading p { margin-top: 8px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 23px; border-block: 1px solid var(--line); }
.metrics div { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 10px 15px; }
.metrics div + div { border-inline-start: 1px solid var(--line); }
.metrics dt { color: var(--muted); font-size: .83rem; }
.metrics dd { margin: 0; font-size: 1.22rem; font-weight: 700; }
.panel { border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.dashboard-grid { display: grid; align-items: start; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(235px, .36fr); }
.panel { min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.panel-copy, .worker-body, .empty { padding: 17px; }
.empty p { margin: 5px 0 10px; color: var(--muted); }
.muted { color: var(--muted); font-size: .84rem; }
.worker-label { display: inline-flex; align-items: center; gap: 8px; color: var(--amber); font-weight: 650; }
.worker-label.online { color: var(--teal); }
.facts, .references { display: grid; gap: 10px; margin: 14px 0; font-size: .85rem; }
.facts div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.facts dt, .references dt { color: var(--muted); }
.facts dd, .references dd { margin: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
td, th { padding: 11px 13px; text-align: start; }
th { background: #f4f5ef; color: var(--muted); font-weight: 650; white-space: nowrap; }
tbody tr+tr { border-top: 1px solid var(--line); }
td small { display: block; margin-top: 2px; color: var(--muted); font-size: .78rem; }
.date { white-space: nowrap; color: var(--muted); }
.order-link { color: var(--ink); font-weight: 650; text-underline-offset: 3px; text-decoration-color: #8b9dae; }
.order-link:hover { color: var(--teal); }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 3px; padding: 3px 7px; color: #315877; background: var(--blue-surface); font-size: .77rem; font-weight: 650; }
.status::before { content: ""; border-radius: 50%; width: 6px; height: 6px; background: currentColor; flex: 0 0 6px; }
.status.preview_completed { background: var(--green-surface); color: var(--teal); }
.status.needs_review, .status.partially_cancelled { background: var(--amber-surface); color: var(--amber); }
.back { display: inline-block; font-size: .86rem; text-decoration: none; }
.order-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; }
.stack { display: grid; gap: 16px; min-width: 0; }
.part { padding: 11px 17px; }
.part + .part { border-top: 1px solid var(--line); }
.part ul { margin-block: 4px; padding-inline-start: 18px; }
.timeline { list-style: none; margin: 17px; padding: 0; font-size: .86rem; }
.timeline li { position: relative; margin-left: 4px; padding: 0 0 14px 17px; border-inline-start: 1px solid #bdd9cc; }
.timeline li:last-child { padding-bottom: 0; border-color: transparent; }
.timeline li::before { content: ""; position: absolute; top: 5px; left: -5px; width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--paper); background: var(--teal); }
.timeline time { display: block; color: var(--muted); }
.references { margin: 0; padding: 14px 17px; border-top: 1px solid var(--line); }
.references dd { margin-top: 2px; }

.guide { margin: 0; padding: 0; }
.notice { padding: 13px 16px; margin-bottom: 15px; border: 1px solid #b4d6c7; border-radius: 7px; background: var(--green-surface); }
.notice p { margin-block: 3px 6px; }
.notice.error { border-color: #e5c8af; background: var(--amber-surface); }
.control-form { display: grid; align-items: start; gap: 12px; }
.control-form label, .settings-form label, .log-filters label { display: grid; gap: 4px; font-size: .88rem; font-weight: 650; }
.control-form input, .settings-form input, .log-filters input[type='search'], .log-filters select { width: 100%; min-width: 0; min-height: 40px; padding: 7px 10px; border: 1px solid #a9b7c4; border-radius: 6px; background: var(--paper); color: var(--ink); }
.heading-actions, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.heading-actions { justify-content: space-between; }
.settings-form, .connection-receipt { max-width: 710px; }
.settings-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.settings-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; margin: 0; padding: 12px 16px 16px; border: 1px solid var(--line); border-radius: 4px; background: var(--paper); }
.settings-group legend { padding-inline: 5px; margin-inline-start: -5px; font-weight: 700; }
.settings-group .muted { margin-top: -5px; }
.settings-pair { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-reference { margin: 0; font-size: .86rem; }
.settings-reference dt { color: var(--muted); }
.settings-reference dd { margin: 2px 0 0; }
.connection-receipt code { display: block; margin: 7px 0 13px; }
.connection-receipt + .form-actions, section.panel + .form-actions { margin-top: 14px; }
.log-filters { display: grid; gap: 10px 12px; grid-template-columns: minmax(200px, 2fr) repeat(3, minmax(100px, 1fr)); align-items: end; margin-bottom: 16px; }
.log-filters .check-label { grid-column: 1; display: flex; align-items: center; line-height: 40px; }
.log-filters .form-actions { grid-column: 2 / -1; }
.log-level.warning { color: var(--amber); }
.log-level.error { color: #97242a; font-weight: 650; }
.log-level.info { color: var(--muted); }
.log-table td { vertical-align: top; }
.log-table details { margin-top: 4px; max-width: 33rem; font-size: .8rem; }
.log-table summary { cursor: pointer; color: var(--teal); }
.log-table details code { overflow-wrap: anywhere; }
.button { display: inline-flex; justify-content: center; align-items: center; width: fit-content; min-height: 39px; padding: 7px 13px; border: 1px solid var(--teal); border-radius: 6px; background: var(--teal); color: #fff; text-decoration: none; font-size: .88rem; font-weight: 650; }
.button:hover { background: #0b523d; }
.button.secondary { color: var(--teal); background: var(--paper); }
.button.secondary:hover { background: var(--green-surface); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; }
.guide { padding-inline-start: 21px; }
.guide li + li { margin-top: 7px; }
.docs-content { max-width: 810px; }
.docs-content p { margin-top: 12px; }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 22px; }
.login-panel { width: min(100%, 420px); padding: clamp(21px, 6vw, 38px); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.login-panel h1 { margin-bottom: 21px; font-size: clamp(1.65rem, 6vw, 2.15rem); }
.login-panel .button { min-width: 104px; }

@media (max-width: 1040px) { .dashboard-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 850px) {
  .log-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log-query { grid-column: 1 / -1; }
  .log-filters .check-label { grid-column: auto; }
  .log-filters .form-actions { grid-column: 1 / -1; }
}
@media (max-width: 740px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 8px 13px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .sidebar .brand { margin-inline: 0; }
  .navigation { order: 3; display: flex; flex-wrap: wrap; width: 100%; }
  .navigation a { padding: 7px 9px; font-size: .82rem; }
  .sidebar-footer { display: flex; gap: 12px; align-items: center; margin: 0 0 0 auto; }
  .main { padding-top: 22px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics div { padding-inline: 8px; }
  .metrics div:nth-child(3) { border-inline-start: 0; }
  .metrics div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .order-heading { align-items: start; flex-direction: column; }
}
@media (max-width: 480px) {
  td, th { padding: 8px; }
  th, .date { white-space: normal; }
  td { overflow-wrap: anywhere; }
  .settings-pair { grid-template-columns: minmax(0, 1fr); }
}
