:root {
  --bg: #eee8dd;
  --surface: #fffdf8;
  --surface-soft: #f6f1e7;
  --ink: #1e1e19;
  --muted: #68665e;
  --faint: #938f86;
  --line: #d9d1c3;
  --line-strong: #b9b0a2;
  --rail: #1e1e19;
  --rail-muted: #aaa59d;
  --accent: #e4a117;
  --accent-hover: #c9860f;
  --accent-soft: #fff2cf;
  --warning: #b95b33;
  --warning-soft: #fbefe9;
  --danger: #a63f3a;
  --danger-soft: #faecea;
  --success: #47785f;
  --success-soft: #eef5f0;
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", ui-sans-serif, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); }
.device-auth { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--rail); color: #f8f5ed; }
.device-auth-card { width: min(560px, 100%); padding: 36px; border: 1px solid rgb(255 255 255 / 18%); border-radius: 8px; background: #232522; }
.device-auth-mark { display: grid; width: 44px; height: 44px; place-items: center; margin-bottom: 24px; border: 1px solid rgb(255 255 255 / 24%); border-radius: 50%; font-size: 26px; }
.device-auth h1 { margin: 8px 0 12px; font-size: 32px; }
.device-auth p { margin: 0; color: #c9c5ba; line-height: 1.7; }
.device-auth .eyebrow { display: block; color: var(--accent); }
.device-code { display: block; margin: 26px 0 22px; padding: 14px 18px; border: 1px solid rgb(255 255 255 / 18%); background: rgb(255 255 255 / 5%); font: 600 20px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.device-auth .primary { width: 100%; }
.device-return { display: inline-block; margin-top: 20px; color: var(--accent); }
@media (max-width: 640px) { .device-auth { padding: 16px; } .device-auth-card { padding: 26px 22px; } .device-auth h1 { font-size: 27px; } }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login { min-height: 100vh; display: grid; grid-template-columns: minmax(280px, .8fr) minmax(420px, 1.2fr); }
.login-brand { position: relative; min-height: 100vh; padding: 42px 48px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; background: var(--rail); color: #f8fbf8; overflow: hidden; }
.login-brand-head { display: flex; align-items: baseline; gap: 9px; }
.login-promise { margin-top: auto; margin-bottom: 76px; max-width: 360px; }
.login-promise p { margin: 0 0 17px; color: white; font-size: 35px; line-height: 1.3; font-weight: 680; }
.login-promise span { color: rgb(255 255 255 / 66%); font-size: 13px; line-height: 1.75; }
.login-brand .brand-mark { color: var(--accent); }
.login-brand span:last-child { color: var(--rail-muted); }
.login-panel { align-self: center; width: min(560px, calc(100% - 64px)); margin: 0 auto; padding: 48px 0; }
.login-panel h1 { margin: 8px 0 16px; font-size: 38px; line-height: 1.22; font-weight: 650; }
.lede { margin: 0 0 26px; color: var(--muted); line-height: 1.75; }
.note { margin: 14px 0 0; color: var(--faint); font-size: 12px; }
.eyebrow { display: none; }
.brand-mark { font-size: 31px; line-height: 1; font-weight: 700; }

.primary, .secondary, .quiet { min-height: 44px; border-radius: 6px; padding: 0 16px; border: 1px solid transparent; }
.primary { width: 100%; background: var(--accent); color: var(--ink); font-weight: 680; }
.primary:hover { background: var(--accent-hover); }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.quiet { background: transparent; color: var(--muted); }
.topbar .quiet { color: #fffdf8; border-color: #5a574f; }
.topbar .quiet:hover { background: var(--surface-soft); }

.shell { min-height: 100vh; background: var(--bg); }
.topbar { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px; background: var(--rail); color: #fffdf8; border-bottom: 1px solid #33322c; }
.brand, .login-brand { display: flex; align-items: baseline; gap: 9px; }
.brand strong, .login-brand strong { font-size: 15px; }
.brand span:last-child, .login-brand span:last-child { font-size: 12px; color: var(--rail-muted); }
.topbar .brand strong { color: #fffdf8; }
.topbar .brand-mark { color: var(--accent); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.sync-state { color: #e6c46f; font-size: 12px; margin-right: 8px; }
.sync-state.error { color: var(--danger); }
.control-nav { position: sticky; top: 64px; z-index: 19; display: flex; gap: 24px; overflow-x: auto; padding: 0 28px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.control-nav button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); white-space: nowrap; }
.control-nav button:hover { background: var(--surface-soft); color: var(--ink); }
.control-nav button.active { background: transparent; color: var(--ink); border-bottom: 2px solid var(--accent); font-weight: 650; }
.control-view { display: none; }
.control-view.active { display: block; }

main { width: min(1260px, calc(100% - 56px)); margin: 22px auto 0; padding: 34px 38px 72px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.page-head h1 { margin: 6px 0 8px; font-size: 34px; line-height: 1.18; }
.page-head p:last-child { margin: 0; color: var(--muted); }
.revision { min-width: 110px; padding-left: 18px; border-left: 1px solid var(--line); display: grid; gap: 4px; }
.revision span { color: var(--muted); font-size: 12px; }
.revision strong { font-size: 22px; font-variant-numeric: tabular-nums; }

.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); background: transparent; gap: 0; margin-bottom: 26px; }
.metric { background: transparent; min-height: 92px; padding: 16px; display: grid; align-content: space-between; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 25px; font-variant-numeric: tabular-nums; }
.work-mix { margin: -12px 0 26px; padding: 12px 16px; border: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); background: var(--surface); font-size: 12px; }
.work-mix span { display: inline-flex; align-items: baseline; gap: 7px; }
.work-mix strong { color: var(--ink); font-size: 12px; }

.band { padding: 24px 0; border-top: 1px solid var(--line); min-width: 0; }
.section-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-head h2 { margin: 0 0 4px; font-size: 18px; }
.section-head p { margin: 0; color: var(--muted); font-size: 12px; }
.section-head > span { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; border: 0; border-top: 1px solid var(--line); background: transparent; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; background: var(--surface-soft); }
td { font-size: 12px; }
td:first-child { max-width: 300px; }
td strong { display: block; font-weight: 600; }
td small { display: block; margin-top: 3px; color: var(--faint); overflow-wrap: anywhere; }
td select { min-height: 44px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); padding: 0 8px; }
.table-action { min-height: 44px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 5px; background: var(--surface); color: var(--ink); }
.table-action:hover { background: var(--surface-soft); }
.table-action.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); }
tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; min-height: 26px; align-items: center; border-radius: 4px; padding: 2px 8px; font-size: 12px; background: var(--surface-soft); color: var(--muted); white-space: nowrap; }
.status.completed { background: var(--success-soft); color: var(--success); }
.status.failed, .status.rejected, .status.cancelled { background: var(--danger-soft); color: var(--danger); }
.status.running, .status.waiting_approval, .status.resumable { background: var(--warning-soft); color: var(--warning); }

.login-brand { background: var(--rail); }
.login-brand .brand-mark { color: var(--accent); }
.login-panel { padding-left: 2px; }
.login-panel h1 { max-width: 520px; font-size: 42px; line-height: 1.2; font-weight: 700; }
.login-panel .lede { max-width: 540px; font-size: 15px; }
.login-panel .primary { width: auto; min-width: 210px; padding: 0 22px; border-radius: 6px; }
.topbar { height: 66px; }
.control-nav { top: 66px; padding-top: 0; padding-bottom: 0; }
.control-nav button.active { background: transparent; border-bottom: 2px solid var(--accent); border-radius: 0; }
.page-head h1 { font-size: 34px; font-weight: 720; }
.metrics, .table-wrap, .gateway-summary { border-color: var(--line); }
.metric { min-height: 98px; }
.band { padding: 28px 0; }
.section-head h2 { font-size: 19px; }

.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 40px; }
.gateway-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-bottom: 26px; }
.gateway-summary > div { min-height: 104px; background: var(--surface); padding: 16px; display: grid; align-content: space-between; gap: 8px; }
.gateway-summary span { color: var(--muted); font-size: 12px; }
.gateway-summary strong { font-size: 15px; }
.gateway-summary small { color: var(--faint); font-size: 12px; }
.event-list, .entity-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.event-row, .entity-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.event-row strong, .entity-row strong { font-size: 12px; font-weight: 600; }
.event-row span, .entity-row span, .event-row time, .entity-row small { color: var(--muted); font-size: 12px; }
.event-main { display: grid; gap: 3px; min-width: 0; }
.event-main span { overflow-wrap: anywhere; }
.event-main code { color: var(--faint); font-size: 12px; }
.empty { padding: 24px 0; color: var(--faint); font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; background: var(--ink); color: white; padding: 10px 14px; border-radius: 6px; font-size: 12px; box-shadow: 0 10px 30px rgb(24 35 33 / 18%); }

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; gap: 0; }
  .gateway-summary { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { min-height: 110px; align-items: flex-start; padding: 24px; }
  .login-promise { display: none; }
  .login-panel { width: calc(100% - 48px); padding: 54px 0; }
  .login-panel h1 { font-size: 30px; }
  .topbar { height: 58px; padding: 0 14px; }
  .control-nav { top: 58px; padding: 7px 14px; }
  .control-nav { flex-wrap: wrap; overflow-x: visible; }
  .control-nav button { min-height: 44px; }
  .brand span:last-child, .sync-state { display: none; }
  .topbar-actions { gap: 2px; }
  .topbar-actions .secondary, .topbar-actions .quiet { padding: 0 10px; }
  main { width: calc(100% - 28px); padding-top: 22px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 26px; }
  .revision { min-width: 82px; padding-left: 12px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 82px; padding: 13px; }
  th, td { padding: 10px 12px; }
  .task-table { min-width: 0; }
  .task-table thead { display: none; }
  .task-table tbody { display: block; }
  .task-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 12px; padding: 12px; border-bottom: 1px solid var(--line); }
  .task-table tr:last-child { border-bottom: 0; }
  .task-table td { display: block; border: 0; padding: 0; font-size: 12px; }
  .task-table td:first-child { flex: 1 1 62%; min-width: 0; max-width: none; }
  .task-table td:nth-child(5) { flex: 0 0 auto; }
  .task-table td:nth-child(2), .task-table td:nth-child(3), .task-table td:nth-child(6) { flex: 1 1 auto; color: var(--muted); }
  .task-table td:nth-child(4), .task-table td:nth-child(7) { display: none; }
}

/* Administration follows the NoonWake desk-and-paper language. */
:root {
  --bg: #eee8dd;
  --surface: #fffdf8;
  --surface-soft: #f6f1e7;
  --ink: #1e1e19;
  --muted: #68665e;
  --faint: #938f86;
  --line: #d9d1c3;
  --line-strong: #b9b0a2;
  --rail: #1e1e19;
  --rail-muted: #aaa59d;
  --accent: #e4a117;
  --accent-hover: #c9860f;
  --accent-soft: #fff2cf;
  --warning: #b95b33;
  --warning-soft: #fbefe9;
  --danger: #a63f3a;
  --danger-soft: #faecea;
  --success: #47785f;
  --success-soft: #eef5f0;
}
body { background: var(--bg); color: var(--ink); }
.login { grid-template-columns: minmax(360px, .82fr) minmax(440px, 1.18fr); }
.login-brand { background: var(--rail); padding: 42px 48px; }
.login-brand .brand-mark { color: var(--accent); }
.login-brand span:last-child { color: var(--rail-muted); }
.login-promise { max-width: 430px; margin-bottom: 82px; }
.login-promise p { font-size: 42px; line-height: 1.16; font-weight: 680; }
.login-promise span { color: #cfcac3; font-size: 14px; }
.login-panel { width: min(590px, calc(100% - 80px)); }
.login-panel h1 { max-width: 580px; font-size: clamp(40px, 4.2vw, 56px); line-height: 1.12; font-weight: 700; }
.login-panel .lede { max-width: 530px; color: var(--muted); font-size: 15px; }
.login-panel .primary { min-width: 220px; border-radius: 6px; background: var(--accent); color: var(--ink); }
.login-panel .primary:hover, .primary:hover { background: var(--accent-hover); }
.primary { background: var(--accent); border-radius: 6px; color: var(--ink); }
.secondary, .quiet, .table-action { border-radius: 6px; }
.topbar { height: 64px; background: var(--rail); border-bottom: 1px solid #33322c; color: #fffdf8; }
.brand strong { font-size: 15px; }
.topbar .brand-mark { color: var(--accent); }
.control-nav { top: 64px; gap: 24px; padding: 0 28px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.control-nav button { min-height: 52px; padding: 0; border-radius: 0; border-bottom: 2px solid transparent; color: var(--muted); }
.control-nav button:hover { background: transparent; color: var(--ink); }
.control-nav button.active { background: transparent; border-bottom-color: var(--accent); color: var(--ink); font-weight: 650; }
main { width: min(1260px, calc(100% - 56px)); margin: 22px auto 0; padding: 34px 38px 72px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.page-head { align-items: flex-end; border-bottom: 1px solid var(--ink); padding-bottom: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 34px; line-height: 1.18; }
.page-head p:last-child { color: var(--muted); font-size: 14px; }
.revision { border-left-color: var(--line-strong); }
.metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; border: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); background: transparent; margin-bottom: 24px; }
.attention-strip { margin: 0 0 20px; padding: 14px 16px; border: 1px solid #dfc2b2; border-left: 3px solid var(--warning); border-radius: 6px; background: var(--warning-soft); display: flex; align-items: flex-start; gap: 28px; }
.attention-strip[hidden] { display: none; }
.attention-copy { min-width: 190px; display: grid; gap: 2px; }
.attention-copy span { color: var(--warning); font-size: 12px; font-weight: 650; }
.attention-copy strong { font-size: 14px; }
.attention-list { min-width: 0; flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; }
.attention-list > span { min-width: 0; display: grid; gap: 2px; }
.attention-list strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-list small { color: var(--muted); font-size: 12px; }
.metric { min-height: 86px; padding: 14px 16px; border-right: 1px solid var(--line); background: transparent; }
.metric:last-child { border-right: 0; }
.metric strong { font-size: 28px; }
.work-mix { margin: -8px 0 24px; padding: 0 0 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; }
.band { padding: 24px 0; border-top: 1px solid var(--line); }
.section-head { margin-bottom: 12px; }
.section-head h2 { font-size: 22px; }
.table-wrap { border: 0; border-top: 1px solid var(--line); background: transparent; }
table { border-collapse: collapse; }
th { background: transparent; color: var(--faint); }
th, td { border-bottom-color: var(--line); }
.split { gap: 48px; }
.gateway-summary { gap: 0; border: 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); background: transparent; }
.gateway-summary > div { border-right: 1px solid var(--line); background: transparent; }
.gateway-summary > div:last-child { border-right: 0; }
.event-list, .entity-list { border-top-color: var(--ink); }
.event-row, .entity-row { border-bottom-color: var(--line); }
.status { border-radius: 4px; }
.status.completed { background: var(--success-soft); color: var(--success); }
.status.running, .status.waiting_approval, .status.resumable { background: var(--warning-soft); color: var(--warning); }

@media (max-width: 980px) {
  .control-nav { gap: 18px; }
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric:nth-child(3n) { border-right: 0; }
  .metric:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { min-height: 110px; padding: 22px; }
  .login-panel { width: calc(100% - 32px); padding: 42px 0 78px; }
  .login-panel h1 { font-size: 36px; }
  .topbar { height: 58px; padding: 0 14px; }
  .control-nav { top: 58px; flex-wrap: nowrap; overflow-x: auto; padding: 0 14px; scrollbar-width: none; }
  .control-nav::-webkit-scrollbar { display: none; }
  .control-nav button { flex: 0 0 auto; min-height: 48px; }
  main { width: calc(100% - 28px); margin-top: 14px; padding: 24px 14px 64px; border-radius: 6px; }
  .page-head h1 { font-size: 30px; }
  .metrics { display: flex; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
  .attention-strip { flex-direction: column; gap: 10px; }
  .attention-list { width: 100%; grid-template-columns: 1fr; }
  .metrics::-webkit-scrollbar { display: none; }
  .metric { flex: 0 0 132px; min-height: 82px; padding: 13px 14px; border-bottom: 0 !important; }
  .metric:nth-child(3n) { border-right: 1px solid var(--line); }
  .split { gap: 0; }
  .task-table tr { padding: 14px 2px; }
  .status { border-radius: 4px; }
}
