/* dOps Console: one stylesheet, tokens first, light and dark from the system setting. */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --line: #e2e5ea; --text: #16181d; --muted: #5d6573;
  --accent: #3b5bdb; --accent-2: #7048e8; --accent-text: #ffffff; --focus: #4c6ef5;
  --good: #2b8a3e; --good-bg: #e6f4ea; --bad: #c92a2a; --bad-bg: #fdecec; --warn: #a15c00; --warn-bg: #fff4e0;
  --radius: 10px; --side: 232px; --rail: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1e222b; --line: #2a2f3a; --text: #e8eaef; --muted: #9aa3b2;
    --accent: #748ffc; --accent-2: #9775fa; --accent-text: #0f1115; --focus: #91a7ff;
    --good: #69db7c; --good-bg: #13291a; --bad: #ff8787; --bad-bg: #331616; --warn: #ffc078; --warn-bg: #33240f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 1.45rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h2 small, h3 small { color: var(--muted); font-weight: 500; margin-left: .35rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
code, .mono { font-family: var(--mono); font-size: .85em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ---- shell: sidebar = scroll region + pinned account foot ---- */
.shell { display: flex; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow: hidden; width: var(--side); flex: 0 0 var(--side); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.side-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 10px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: var(--accent-text); background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: 0 0 auto; }
.brand-text, .bare-brand span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.brand small, .who small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.on { background: var(--surface-2); color: var(--text); }
.nav-link.on .ic { color: var(--accent); }
.badge { margin-left: auto; min-width: 22px; padding: 0 7px; border-radius: 11px; background: var(--accent); color: var(--accent-text); font-size: .75rem; font-weight: 700; text-align: center; line-height: 20px; }
.side-foot { flex: 0 0 auto; border-top: 1px solid var(--line); padding: 8px; display: flex; align-items: center; gap: 4px; position: relative; }
.account { flex: 1 1 auto; min-width: 0; }
.account summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.account summary::-webkit-details-marker { display: none; }
.account summary:hover, .account[open] summary { background: var(--surface-2); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: 0 0 auto; }
.who { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.caret { margin-left: auto; color: var(--muted); font-size: .8rem; }
.menu { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgb(0 0 0 / .18); padding: 6px; z-index: 20; animation: rise .14s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .menu { animation: none; } }
.menu-title { margin: 4px 8px 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--surface-2); text-decoration: none; }
.menu-out { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 6px; }
.danger-text { color: var(--bad) !important; }
.rail-form { margin: 0; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* collapsed rail */
body.rail .side { width: var(--rail); flex-basis: var(--rail); }
body.rail .nav-label, body.rail .badge, body.rail .caret { display: none; }
body.rail .nav-link, body.rail .brand { justify-content: center; padding-left: 0; padding-right: 0; }
body.rail .side-foot { flex-direction: column-reverse; }
body.rail .account summary { justify-content: center; padding: 6px 0; }
body.rail .menu { left: 8px; right: auto; }

/* ---- main ---- */
.main { flex: 1 1 auto; min-width: 0; padding: 22px 28px 48px; max-width: 1180px; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sub { margin: 4px 0 0; color: var(--muted); }
.panel, .lane { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 14px; }
.lane-alert { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); box-shadow: inset 3px 0 0 var(--bad); }
.lane-alert h2 { color: var(--bad); }
.narrow { max-width: 560px; }
.lede { font-size: 1.05rem; margin: 0 0 .3rem; font-weight: 600; }
.empty { color: var(--muted); margin: .2rem 0; }
.hint { color: var(--muted); font-size: .88rem; margin: .5rem 0 0; }
.why { color: var(--bad); font-size: .86rem; display: block; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.flash.ok { background: var(--good-bg); color: var(--good); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.flash.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.card:hover { text-decoration: none; border-color: var(--accent); }
.card-n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.card-l { font-weight: 600; }
.card small { color: var(--muted); }
.card-act { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: inset 3px 0 0 var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .88rem; }
.chip.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.chip:hover { text-decoration: none; color: var(--text); }
.chip small { margin-left: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 6px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td.code, .code { font-family: var(--mono); font-size: .85rem; white-space: nowrap; }
td.what a { color: var(--text); font-weight: 500; }
td.act { white-space: nowrap; text-align: right; }
tr.urgent td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.more { margin: .6rem 0 0; display: flex; gap: 14px; }
.tag { display: inline-block; margin-left: 6px; padding: 0 7px; border-radius: 6px; font-size: .74rem; font-weight: 600; background: var(--surface-2); color: var(--muted); vertical-align: 1px; }
.tag-good { background: var(--good-bg); color: var(--good); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
.status { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .8rem; font-weight: 600; background: var(--surface-2); }
.s-done, .a-approved { background: var(--good-bg); color: var(--good); }
.s-answered { background: var(--good-bg); color: var(--good); }
.s-done-unverified, .a-refused, .a-expired { background: var(--bad-bg); color: var(--bad); }
.a-pending, .s-waiting, .s-parked { background: var(--warn-bg); color: var(--warn); }
.show-s { display: none; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.plain li:last-child { border-bottom: 0; }
.history { margin: 0; padding-left: 1.2rem; }
.history li { padding: 3px 0; }
.brief-list { list-style: none; margin: 0; padding: 0; }
.brief-list li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.brief-list li:last-child { border-bottom: 0; }
.brief-list a { color: var(--text); }
.brief-list .code { color: var(--muted); margin-right: 6px; }

/* ---- forms and buttons ---- */
.actions { display: flex; flex-direction: column; gap: 12px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.inline-form label { font-size: .88rem; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack label { font-size: .88rem; color: var(--muted); margin-top: 6px; }
input { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; min-height: 38px; min-width: 0; }
input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.pw { display: flex; align-items: center; gap: 4px; }
.pw input { flex: 1 1 auto; }
.btn { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-quiet { background: transparent; }
.btn-danger { color: var(--bad); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: .86rem; }
.btn-wide { width: 100%; justify-content: center; margin-top: 12px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: .6rem 0 0; }
pre.copyable { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.handover { border-color: var(--accent); }

/* ---- sign-in ---- */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.bare-main { width: 100%; max-width: 400px; }
.bare-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.bare-card h1 { margin: 10px 0 12px; }
.bare-brand { margin: 0; padding: 0; }

/* ---- the proof as a document ---- */
body.doc { background: #fff; color: #111; }
.doc-main { max-width: 960px; margin: 0 auto; }

/* ---- short laptop (1280 x 720) ---- */
@media (max-height: 760px) and (min-width: 721px) {
  .main { padding-top: 16px; }
  .card { padding: 10px 14px; }
  .card-n { font-size: 1.45rem; }
}
@media (max-width: 1100px) and (min-width: 721px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- phone: the sidebar becomes a tab bar at the bottom ---- */
@media (max-width: 720px) {
  .shell { display: block; }
  .main { padding: 14px 14px 92px; }
  .side { position: fixed; z-index: 30; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: auto; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .side-scroll { padding: 4px 2px; overflow: visible; flex: 1 1 auto; }
  .brand { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav-link { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .72rem; position: relative; flex: 1 1 0; align-items: center; }
  .badge { position: absolute; top: 0; right: 14%; margin: 0; min-width: 18px; line-height: 17px; font-size: .68rem; padding: 0 5px; }
  .side-foot { border-top: 0; border-left: 1px solid var(--line); padding: 4px 6px; }
  .who, .caret, .rail-form { display: none; }
  .account summary { padding: 6px; }
  .menu { left: auto; right: 0; bottom: calc(100% + 8px); width: min(280px, 92vw); }
  body.rail .nav-label { display: inline; }
  body.rail .side { width: auto; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { padding: 10px 12px; }
  .card-n { font-size: 1.35rem; }
  .hide-s { display: none; }
  .show-s { display: block; font-size: .8rem; }
  .facts { grid-template-columns: 1fr; }
  td { padding: 9px 6px; }
  h1 { font-size: 1.2rem; }
  .inline-form input { flex: 1 1 100%; }
  td.act .btn { padding: 0 9px; }
  td.act .btn-label { display: none; }
}

@media print {
  .side, .toolbar, .flash { display: none !important; }
  .main { padding: 0; max-width: none; }
  .panel, .lane { border: 0; padding: 0; }
  a { color: inherit; }
}
