:root {
  --ink: #102a36;
  --ink-soft: #294550;
  --muted: #60747b;
  --surface: #ffffff;
  --surface-soft: #f3f7f6;
  --canvas: #eaf0ef;
  --line: #ccd8d7;
  --line-strong: #98aeac;
  --teal: #176b72;
  --teal-dark: #0d535a;
  --teal-pale: #e1f1f0;
  --green: #17613d;
  --green-pale: #e5f3e9;
  --amber: #815515;
  --amber-pale: #fff1d9;
  --red: #92382f;
  --red-pale: #fae8e5;
  --blue: #155b86;
  --focus: #0877b5;
  --radius: 13px;
  --shadow: 0 10px 28px rgb(16 42 54 / 8%);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--canvas); color: var(--ink); }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(2.15rem, 4.6vw, 4.6rem); letter-spacing: -0.055em; line-height: 0.98; }
h2 { margin-bottom: 8px; font-size: clamp(1.25rem, 2.4vw, 1.75rem); letter-spacing: -0.025em; }
h3 { margin-bottom: 8px; font-size: 1.22rem; }

.shell { width: min(100% - 32px, 1480px); margin-inline: auto; }
.topbar { position: sticky; z-index: 20; top: 0; border-bottom: 1px solid #b8c8c7; background: rgb(239 245 244 / 96%); backdrop-filter: blur(14px); }
.topbar-inner { display: flex; width: min(100% - 32px, 1480px); min-height: 70px; margin-inline: auto; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand > div:last-child { display: grid; }
.brand small { color: var(--muted); font-size: 11px; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 8px; background: var(--ink); color: white; font-family: "Cascadia Mono", Consolas, monospace; font-weight: 800; }
nav { display: flex; align-items: center; gap: 4px; overflow-x: auto; }
nav a { min-height: 44px; padding: 13px 12px; border-radius: 8px; color: var(--ink-soft); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
nav a:hover, nav a.active { background: var(--surface); color: var(--teal-dark); }

.page-heading { display: flex; min-height: 240px; padding-block: clamp(42px, 7vw, 86px); align-items: end; justify-content: space-between; gap: 30px; }
.page-heading > div:first-child { max-width: 860px; }
.eyebrow { margin-bottom: 12px; color: var(--teal-dark); font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.lede { max-width: 760px; margin-bottom: 0; color: var(--muted); font-size: clamp(1rem, 1.7vw, 1.18rem); line-height: 1.6; }
.heading-actions { flex: 0 0 auto; }

.sync-bar { display: flex; min-height: 44px; margin-bottom: 14px; padding: 10px 14px; align-items: center; gap: 9px; border: 1px solid #8fb8b4; border-radius: 10px; background: #e6f4f2; color: var(--teal-dark); font-size: 12px; }
.sync-light { width: 9px; height: 9px; border-radius: 999px; background: #1f8c62; box-shadow: 0 0 0 4px rgb(31 140 98 / 12%); }
.sync-time { margin-left: auto; color: var(--muted); font-family: "Cascadia Mono", Consolas, monospace; }
.feedback { min-height: 0; }
.feedback p { margin-bottom: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.feedback.success p { border-color: #a4c9b2; background: var(--green-pale); color: var(--green); }
.feedback.error p { border-color: #ddb1ad; background: var(--red-pale); color: var(--red); }

.metrics { display: grid; margin-bottom: 14px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metrics.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.metric.warn { border-color: #d6b77d; background: var(--amber-pale); }
.metric-label, .metric-detail { margin-bottom: 0; color: var(--muted); font-size: 11px; }
.metric-label { font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.metric-value { margin: 7px 0 2px; font-size: clamp(1.5rem, 2.7vw, 2.25rem); font-weight: 800; letter-spacing: -.04em; }

.manager-grid, .operator-layout { display: grid; padding-bottom: 46px; align-items: start; grid-template-columns: minmax(0, 1fr) minmax(300px, 410px); gap: 14px; }
.panel, .task-card, .request-card, .operator-task { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel { padding: clamp(16px, 2.2vw, 26px); }
.section-title { display: flex; margin-bottom: 16px; align-items: end; justify-content: space-between; gap: 18px; }
.section-title p { max-width: 560px; margin-bottom: 0; color: var(--muted); font-size: 13px; }
.side-stack { display: grid; gap: 14px; }
.task-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.task-card, .request-card { min-width: 0; padding: 16px; box-shadow: none; }
.task-card.status-active { border-left: 5px solid #2a8a5b; }
.task-card.status-paused { border-left: 5px solid var(--red); }
.task-card.status-planned { border-left: 5px solid var(--teal); }
.task-card.status-done { opacity: .72; }
.card-top, .badge-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.badge-row { justify-content: start; flex-wrap: wrap; }
.task-card h3, .request-card h3 { margin-top: 20px; }
.task-target, .request-meta, .owner-line { color: var(--muted); font-size: 13px; }
.task-details { margin: 14px 0; }
.task-details > div { display: grid; padding: 9px 0; border-top: 1px solid #e4eae9; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; }
.task-details dt { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.task-details dd { margin: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }

.ui-button { display: inline-flex; min-height: 46px; padding: 11px 16px; align-items: center; justify-content: center; border: 1px solid var(--ink); border-radius: 8px; background: var(--ink); color: white; cursor: pointer; font-size: 13px; font-weight: 760; line-height: 1.2; text-align: center; text-decoration: none; }
.ui-button:hover { border-color: var(--teal-dark); background: var(--teal-dark); }
.ui-button-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.ui-button-secondary:hover { background: var(--teal-pale); color: var(--ink); }
.compact-actions { display: flex; margin-top: 12px; gap: 7px; }
.compact-actions .ui-button { min-height: 42px; padding: 9px 11px; flex: 1; }
.ui-badge { display: inline-flex; min-height: 26px; padding: 4px 8px; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); font-size: 10px; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.ui-badge-success { border-color: #a7c8b2; background: var(--green-pale); color: var(--green); }
.ui-badge-warning { border-color: #e1bf84; background: var(--amber-pale); color: var(--amber); }
.ui-badge-danger { border-color: #ddb1ad; background: var(--red-pale); color: var(--red); }

.task-form { display: grid; gap: 13px; }
.task-form label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.ui-input, .ui-select, .ui-textarea, .task-form input, .task-form select, .task-form textarea, .message-form input, .update-form input { width: 100%; min-width: 0; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); }
.task-form textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { border-color: var(--focus); outline: 3px solid rgb(8 119 181 / 18%); outline-offset: 1px; }

.operator-main { display: grid; gap: 14px; }
.operator-task { overflow: hidden; padding: clamp(22px, 4vw, 46px); background: var(--ink); color: white; }
.operator-task .ui-badge-neutral { border-color: #65808a; background: #193845; color: #d8e7e9; }
.operator-model { margin: 58px 0 4px; font-size: clamp(4rem, 10vw, 8rem); font-weight: 800; letter-spacing: -.07em; line-height: .88; }
.operator-target { margin-bottom: 32px; color: #bdd0d4; font-family: "Cascadia Mono", Consolas, monospace; font-size: 1.05rem; }
.operator-instruction { max-width: 660px; margin-bottom: 34px; padding: 16px; border-left: 4px solid #63b2b7; background: rgb(255 255 255 / 6%); color: #e6eff1; font-size: 1.05rem; line-height: 1.55; }
.operator-task > .ui-button { min-width: 230px; min-height: 58px; border-color: white; background: white; color: var(--ink); font-size: 16px; }
.paused-note { padding: 14px; border: 1px solid #cb7d76; border-radius: 8px; background: rgb(146 56 47 / 28%); }
.help-panel > p { color: var(--muted); }
.operator-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.operator-actions .ui-button { min-height: 58px; }

.request-stack, .request-board { display: grid; gap: 9px; }
.request-board { padding-bottom: 46px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.request-card.severity-critical { border-left: 5px solid var(--red); }
.request-card.severity-high { border-left: 5px solid #c18222; }
.request-card.severity-normal { border-left: 5px solid var(--teal); }
.update-list { display: grid; margin: 12px 0; padding: 0; gap: 7px; list-style: none; }
.update-list li { display: grid; padding: 8px 10px; border-radius: 7px; background: var(--surface-soft); font-size: 12px; }
.update-list time { color: var(--muted); font-size: 10px; }
.request-controls { display: grid; margin-top: 13px; gap: 9px; }
.update-form, .message-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.empty, .empty-state { color: var(--muted); }
.empty-state { padding: 50px 20px; text-align: center; }
.message-list { display: grid; max-height: 360px; margin-bottom: 12px; gap: 8px; overflow-y: auto; }
.message { padding: 10px 12px; border-radius: 9px; background: var(--surface-soft); }
.message > div { display: flex; justify-content: space-between; gap: 12px; }
.message time { color: var(--muted); font-size: 11px; }
.message p { margin: 5px 0 0; font-size: 13px; line-height: 1.45; }
.history-list { display: grid; max-height: 430px; overflow-y: auto; }
.history-row { padding: 10px 0; border-bottom: 1px solid #e2e9e8; }
.history-row:last-child { border-bottom: 0; }
.history-row > div { display: flex; justify-content: space-between; gap: 10px; }
.history-row time, .history-row small { color: var(--muted); font-size: 10px; }
.history-row p { margin: 4px 0; font-size: 12px; line-height: 1.42; }
.site-footer { padding-block: 30px 44px; color: var(--muted); font-size: 11px; text-align: center; }
.site-footer p { margin: 0; }

@media (max-width: 1100px) {
  .topbar-inner { align-items: start; flex-direction: column; padding-block: 10px; }
  nav { width: 100%; }
  .manager-grid, .operator-layout { grid-template-columns: 1fr; }
  .side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .request-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .shell, .topbar-inner { width: min(100% - 20px, 1480px); }
  .brand small { display: none; }
  .page-heading { min-height: auto; padding-block: 38px; align-items: stretch; flex-direction: column; }
  .heading-actions, .heading-actions .ui-button { width: 100%; }
  .metrics, .metrics.two, .task-grid, .side-stack, .request-board, .operator-actions { grid-template-columns: 1fr; }
  .section-title { align-items: start; flex-direction: column; }
  .operator-model { margin-top: 42px; }
  .operator-task > .ui-button { width: 100%; min-width: 0; }
  .update-form, .message-form { grid-template-columns: 1fr; }
  .compact-actions { flex-direction: column; }
}

@media (max-width: 420px) {
  .shell, .topbar-inner { width: min(100% - 12px, 1480px); }
  nav a { padding-inline: 10px; }
  .panel, .task-card, .request-card, .operator-task { border-radius: 9px; }
  .panel, .task-card, .request-card { padding: 13px; }
  .sync-bar { align-items: start; flex-wrap: wrap; }
  .sync-time { width: 100%; margin-left: 18px; }
}

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