/* /admin: the owner's one place. A sidebar beside the engine's own screens (app.css), a gate until the
   owner key is accepted, and a side panel for records so nothing leads out of the admin. */
body[data-surface="admin"] { min-height: 100vh; }
/* the layout rules below set display; a hidden gate, app or side panel must stay hidden */
.adm-gate[hidden], .adm[hidden], .adm-drawer[hidden], .adm [hidden] { display: none !important; }

.adm-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.adm-gate-card { width: min(440px, 100%); background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 32px; }
.adm-gate-card .mark { width: 34px; height: 34px; }
.adm-gate-card h1 { font-size: 22px; margin: 14px 0 8px; }
.adm-gate-card p { color: var(--text-2); font-size: 14px; line-height: 1.55; }
.adm-gate-msg { color: var(--rose) !important; min-height: 1em; }
.adm-gate-card form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.adm-remember { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.adm-gate-card input, .adm-inline input, .adm-inline select, .adm-tile select, .adm-cp-control input { flex: 1; min-width: 0; border: 1px solid var(--line-2); background: var(--deep); color: var(--text); border-radius: 9px; padding: 9px 11px; font: 13px var(--mono); }

.adm { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.adm-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: rgb(var(--bg-rgb) / .9); padding: 18px 12px; display: flex; flex-direction: column; gap: 6px; }
.adm-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 4px 10px 14px; }
.adm-brand .mark { width: 24px; height: 24px; }
.adm-menu { display: none; }
.adm-nav { display: flex; flex-direction: column; gap: 1px; }
.adm-nav .tab { width: 100%; justify-content: flex-start; padding: 8px 10px; border-radius: 9px; font-size: 13.5px; }
.adm-nav .tab[aria-selected="true"] { background: rgb(var(--tint-rgb) / .07); }
.adm-nav .tab[aria-selected="true"]::after { display: none; }
.adm-nav .tab .badge { margin-left: auto; }
.adm-nav .adm-sub { padding-left: 30px; font-size: 13px; }
.adm-nav .adm-sub:disabled { display: none; }
.adm-group { font: 500 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 16px 10px 4px; }
.adm-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.adm-foot .systems { justify-content: flex-start; }

.adm-main { min-width: 0; }
.adm-main main { max-width: 1180px; padding: 32px 32px 80px; }
.adm-main > .view { max-width: 1180px; margin: 0 auto; padding: 32px 32px 80px; }
.adm-main .ws-home-link { display: none; }

.adm-head { margin-bottom: 20px; }
.adm-head h2 { font-size: 26px; margin: 0; }
.adm-lede { color: var(--text-2); margin: 8px 0 0; max-width: 70ch; }
.adm-sec { margin-top: 16px; }
.adm-note { color: var(--text-3); font-size: 12.5px; margin: 10px 0 0; }
.adm-empty { color: var(--text-3); font-size: 14px; margin: 4px 0; }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.adm-tile { text-align: left; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; color: var(--text); cursor: pointer; display: flex; flex-direction: column; gap: 6px; font: inherit; }
.adm-tile b { font-size: 26px; font-weight: 600; }
.adm-tile b.ok { color: var(--green); font-size: 20px; }
.adm-tile b.bad { color: var(--rose); font-size: 20px; }
.adm-tile span { color: var(--text-2); font-size: 13px; }
.adm-tile.hot { border-color: var(--green-line); }
label.adm-tile { cursor: default; }
.adm-cp-control { cursor: default; }
.adm-cp-control label:not(.sr-only) { color: var(--text-2); font-size: 13px; }
.adm-cp-control .btn { align-self: flex-start; margin-top: 4px; }
.adm-needs { list-style: none; margin: 0; padding: 0; }
.adm-needs li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.adm-needs li:first-child { border-top: 0; }
.adm-scroll { overflow-x: auto; }
.adm-table td { vertical-align: top; }
.adm-clip { display: block; max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); }
.adm-link { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; text-align: left; }
.adm-kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
.adm-kv dt { color: var(--text-3); }
.adm-kv dd { margin: 0; overflow-wrap: anywhere; }
.adm-inline { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
.adm-inline input { max-width: 240px; }
.adm-inline select { flex: 0 0 auto; }
.adm-seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.adm-seg button { border: 0; background: none; color: var(--text-2); padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; }
.adm-seg button[aria-selected="true"] { background: rgb(var(--tint-rgb) / .09); color: var(--text); }

.adm-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 40; background: var(--card); border-left: 1px solid var(--line-2); display: flex; flex-direction: column; box-shadow: -30px 0 60px -30px rgb(var(--shade-rgb) / .6); }
.adm-drawer-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.adm-drawer-head h3 { margin: 0; font-size: 16px; }
.adm-drawer-body { padding: 18px 20px 40px; overflow-y: auto; flex: 1; }
.adm-frame { width: 100%; height: calc(100vh - 110px); border: 0; border-radius: 10px; background: var(--bg); }
.adm-quote { white-space: pre-wrap; background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; }
.adm-steps { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.adm-steps li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 2px 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.adm-step-when { color: var(--text-3); font-family: var(--mono); grid-row: span 2; }
.adm-step-sum { color: var(--text-2); overflow-wrap: anywhere; }
.adm-steps li.s-succeeded .adm-step-what b, .adm-steps li.s-completed .adm-step-what b { color: var(--green); }
.adm-steps li.s-denied .adm-step-what b, .adm-steps li.s-failed .adm-step-what b { color: var(--rose); }
.adm-chat { display: flex; flex-direction: column; gap: 10px; }
.adm-bubble { max-width: 86%; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; font-size: 14px; }
.adm-bubble span { display: block; margin-top: 6px; font-size: 11.5px; color: var(--text-3); }
.adm-bubble.in { align-self: flex-start; background: var(--deep); border: 1px solid var(--line); }
.adm-bubble.out { align-self: flex-end; background: var(--green-soft); border: 1px solid var(--green-line); }

@media (max-width: 860px) {
  .adm { grid-template-columns: minmax(0, 1fr); }
  .adm-side { position: sticky; height: auto; z-index: 35; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .adm-brand { padding: 0; }
  .adm-menu { display: inline-flex; margin-left: auto; border: 1px solid var(--line-2); background: none; color: var(--text); border-radius: 9px; padding: 7px 12px; font: inherit; cursor: pointer; }
  .adm-nav, .adm-foot { display: none; width: 100%; }
  body.adm-nav-open .adm-nav, body.adm-nav-open .adm-foot { display: flex; }
  .adm-main main, .adm-main > .view { padding: 20px 16px 64px; }
  .adm-kv { grid-template-columns: minmax(0, 1fr); }
  .adm-kv dt { margin-top: 6px; }
}
@media (max-width: 600px) {
  .adm-cp-grid { grid-template-columns: minmax(0, 1fr); }
  #admZoho { flex-direction: column; align-items: stretch; }
  #admZoho input { width: 100%; max-width: none; flex: auto; }
  #admZoho .btn { width: 100%; }
}

/* ---------------------------------------------------------------- stage 2 (2026-11-05): the admin on paper.
   Same tokens as the public pages and the console (home.css body.front + console.css); square corners,
   hairlines, the accent marks the current section; every control at least 44 px. */
body.front[data-surface="admin"] .adm-side { background: var(--paper); border-right: 1px solid var(--rule); }
body.front[data-surface="admin"] .adm-brand { font-family: var(--display); font-weight: 650; letter-spacing: -.02em; color: var(--ink); min-height: 44px; }
body.front[data-surface="admin"] .adm-group { color: var(--ink-2); font-size: 11.5px; letter-spacing: .08em; margin: 18px 10px 4px; }
body.front[data-surface="admin"] .adm-group b { color: var(--acc-ink); font-weight: 500; }
body.front[data-surface="admin"] .adm-nav .tab { min-height: 44px; border-radius: 0; color: var(--ink-2); padding: 0 10px; border-left: 2px solid transparent; }
body.front[data-surface="admin"] .adm-nav .tab:hover:not(:disabled) { color: var(--ink); background: rgb(22 21 19 / .04); }
body.front[data-surface="admin"] .adm-nav .tab[aria-selected="true"] { background: var(--card-bg); color: var(--ink); border-left-color: var(--acc); }
body.front[data-surface="admin"] .adm-nav .tab[aria-selected="true"] .ic { color: var(--acc); }
body.front[data-surface="admin"] .adm-nav .tab .badge { border-radius: 2px; background: var(--acc-ink); color: #fff; }
body.front[data-surface="admin"] .adm-nav .adm-sub { padding-left: 28px; }
body.front[data-surface="admin"] .adm-menu { min-height: 44px; border-radius: 3px; border-color: var(--rule-2); color: var(--ink); }
body.front[data-surface="admin"] .adm-head h2 { font: 650 clamp(26px, 2.4vw, 34px)/1.08 var(--display); letter-spacing: -.03em; color: var(--ink); }
body.front[data-surface="admin"] .adm-lede { color: var(--ink-2); }
body.front[data-surface="admin"] .adm-note, body.front[data-surface="admin"] .adm-empty, body.front[data-surface="admin"] .adm-kv dt,
body.front[data-surface="admin"] .adm-step-when, body.front[data-surface="admin"] .adm-bubble span { color: var(--ink-3); }
body.front[data-surface="admin"] .adm-tile { background: var(--card-bg); border: 1px solid var(--rule); border-radius: 4px; min-height: 44px; }
body.front[data-surface="admin"] .adm-tile b { font-family: var(--display); font-weight: 650; letter-spacing: -.02em; }
body.front[data-surface="admin"] .adm-tile b.ok { color: #145a36; }
body.front[data-surface="admin"] .adm-tile b.bad { color: #7d1b21; }
body.front[data-surface="admin"] .adm-tile.hot { border-color: var(--acc); box-shadow: inset 3px 0 0 var(--acc); }
body.front[data-surface="admin"] .adm-gate-card { background: var(--card-bg); border: 1px solid var(--rule); border-radius: 4px; }
body.front[data-surface="admin"] .adm-gate-card h1 { font: 650 28px/1.1 var(--display); letter-spacing: -.03em; }
body.front[data-surface="admin"] .adm-gate-card input, body.front[data-surface="admin"] .adm-inline input, body.front[data-surface="admin"] .adm-inline select,
body.front[data-surface="admin"] .adm-tile select, body.front[data-surface="admin"] .adm-cp-control input { background: #fff; border-color: var(--rule-2); color: var(--ink); border-radius: 3px; min-height: 44px; }
body.front[data-surface="admin"] .adm-remember { min-height: 44px; }
body.front[data-surface="admin"] .adm-seg { border-radius: 3px; border-color: var(--rule-2); }
body.front[data-surface="admin"] .adm-seg button { min-height: 44px; border-radius: 2px; color: var(--ink-2); }
body.front[data-surface="admin"] .adm-seg button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
body.front[data-surface="admin"] .adm-link { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink); }
body.front[data-surface="admin"] .adm-drawer { background: var(--card-bg); border-left: 1px solid var(--rule-2); box-shadow: -24px 0 48px -32px rgb(22 21 19 / .35); }
body.front[data-surface="admin"] .adm-quote, body.front[data-surface="admin"] .adm-bubble.in { background: #fff; border-color: var(--rule); border-radius: 3px; }
body.front[data-surface="admin"] .adm-bubble.out { background: rgb(29 122 74 / .07); border-color: rgb(29 122 74 / .35); border-radius: 3px; }
body.front[data-surface="admin"] .adm-steps li.s-succeeded .adm-step-what b, body.front[data-surface="admin"] .adm-steps li.s-completed .adm-step-what b { color: #145a36; }
body.front[data-surface="admin"] .adm-steps li.s-denied .adm-step-what b, body.front[data-surface="admin"] .adm-steps li.s-failed .adm-step-what b { color: #7d1b21; }
body.front[data-surface="admin"] .adm-main main, body.front[data-surface="admin"] .adm-main > .view { max-width: 1240px; }
.adm-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 12px 0 6px; }
.adm-form label { font-size: 13px; color: var(--ink-2); }
.adm-form input { min-height: 44px; width: auto; min-width: 8em; max-width: 100%; }
.adm-form .btn { min-height: 44px; }
.adm-list { margin: 8px 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; color: var(--ink-2); }
.adm-list b { color: var(--ink); }
