/* Administration console: sidebar layout, dense tables, forms. Builds on site.css tokens. */
:root {
  --info-bg: #e8f0fb; --info: #134b99; --head-bg: #f3f6fa; --focus: #2b6fd6;
  --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 1px 1px rgba(16, 32, 56, .04);
  --shadow-lg: 0 18px 50px rgba(5, 25, 50, .22);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --info-bg: #142b4a; --info: #9cc0f0; --head-bg: #1c2733; --focus: #8bb6f2; --shadow: none; --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55); }
}
header.top .in { max-width: 1280px; }
main.console { max-width: 1280px; padding: 20px 16px 48px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.env-tag { background: var(--gold); color: #1d2733; font-weight: 700; font-size: 12px; padding: 2px 10px; border-radius: 99px; letter-spacing: .2px; }
.env-tag:empty { display: none; }
.env-tag.prod { background: #fff; color: var(--brand-deep); }

/* Focus and keyboard access: one visible ring everywhere */
:where(button, a, input, select, textarea, summary, tr[tabindex], [tabindex="-1"]):focus { outline: none; }
:where(button, a, input, select, textarea, summary, tr[tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--focus); }
header.top :focus-visible { outline-color: #fff; }

/* Buttons: primary (default), secondary, danger, link */
button, .btn { font-weight: 500; line-height: 1.25; transition: background-color .12s, border-color .12s, color .12s; }
button:hover:not(:disabled), .btn:hover { filter: brightness(1.08); }
button.secondary:hover:not(:disabled), .btn.secondary:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); filter: none; }
button.small, .btn.small { padding: 6px 12px; font-size: 13px; border-radius: 7px; }
button.secondary.small, .btn.secondary.small { padding: 5px 11px; }
button.danger { background: var(--bad); color: var(--surface); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.busy { cursor: progress; }
button.link { background: none; border: 0; color: var(--brand); padding: 0; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; font-weight: 400; }
button.link.small { font-size: 13px; }

/* Sign-in, code and password screens */
.auth .card.narrow { max-width: 420px; margin: 40px auto; padding: 28px 28px 20px; border-top: 4px solid var(--brand); box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--muted); }
.auth-brand img { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); }
.auth-brand b { display: block; color: var(--ink); font-size: 15px; } .auth-brand small { display: block; font-size: 12px; }
.auth h1 { margin: 0; font-size: 22px; }
.auth .stack { gap: 14px; }
.auth .stack > button[type=submit] { padding: 11px 16px; margin-top: 2px; }
.auth button.link { align-self: center; font-size: 14px; color: var(--muted); }
input.otp { font: 600 24px/1 var(--mono); letter-spacing: 10px; text-align: center; padding: 12px; }
.err { color: var(--bad); min-height: 1.2em; margin: 10px 0 0; font-size: 14px; }
.err.ok { color: var(--ok); }
.err:empty { margin: 0; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, .form label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }
.field .lbl { color: var(--ink); font-weight: 500; font-size: 13.5px; }
.field .help { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.req { color: var(--bad); font-weight: 700; }
input, select, textarea { font: inherit; font-size: 15px; padding: 9px 11px; border: 1px solid color-mix(in srgb, var(--muted) 35%, var(--line)); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 0; }
input:disabled, select:disabled, textarea:disabled { background: color-mix(in srgb, var(--line) 45%, var(--surface)); color: var(--muted); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; }
input[type=file] { font-size: 13px; border: 0; padding: 0; }
textarea { font-family: var(--mono); font-size: 13px; resize: vertical; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); padding: 9px 0; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 16px; align-items: start; }
.form .wide, .form > h3, .form > .help { grid-column: 1 / -1; }
.form > h3 { margin: 6px 0 -4px; }
.form > p { margin: 0; }
.formfoot { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 2px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.nowrap { flex-wrap: nowrap; }

/* Layout: sidebar and pane */
.layout { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 28px; align-items: start; }
.side { position: sticky; top: 16px; min-width: 0; }
.scope { display: flex; gap: 10px; align-items: center; padding: 12px; margin-bottom: 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.scope-mark { flex: none; min-width: 38px; height: 38px; padding: 0 6px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font: 700 13px/1 var(--mono); letter-spacing: .5px; }
.scope.sec .scope-mark { background: var(--brand); color: var(--brand-ink); }
.scope.ms .scope-mark { background: var(--gold); color: #1d2733; font-size: 15px; }
.scope-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.scope-text b { font-size: 14px; } .scope-text span { font-size: 12px; color: var(--muted); }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav button { display: flex; align-items: center; gap: 8px; text-align: left; background: transparent; color: var(--ink); border-radius: 8px; padding: 8px 12px; font-size: 14.5px; font-weight: 400; position: relative; }
.side nav button[aria-current="page"] { background: color-mix(in srgb, var(--brand) 11%, transparent); color: var(--brand); font-weight: 600; }
.side nav button[aria-current="page"]::before { content: ""; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 3px; background: var(--brand); }
.side nav button:hover:not([aria-current="page"]) { background: color-mix(in srgb, var(--brand) 6%, transparent); filter: none; }
.side nav .grp { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); margin: 16px 12px 4px; }
.side nav .grp:first-child { margin-top: 6px; }
.nb { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: var(--line); color: var(--muted); }
.nb.bad { background: var(--bad); color: var(--surface); } .nb.warn { background: var(--warn-bg); color: var(--warn); }
.pane { min-width: 0; }

/* Page and section headings */
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pane h1 { margin: 0; font-size: 26px; letter-spacing: -.2px; }
.head.sub { margin: 28px 0 10px; }
.head.sub h2 { margin: 0; font-size: 17px; }
.pane h3 { font-size: 15px; margin: 18px 0 8px; }
.lead { color: var(--muted); margin: 6px 0 16px; max-width: 80ch; font-size: 15px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.toolbar input[type=search] { flex: 1 1 240px; max-width: 360px; padding-left: 34px; background: var(--surface) no-repeat 11px 50% / 15px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235b6878' stroke-width='1.8'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='M11 11l3.5 3.5'/%3E%3C/svg%3E"); }
.toolbar select, .toolbar input { font-size: 14px; padding: 7px 10px; }
.toolbar .count { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.toolbar .tb-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-left: 4px; }
.seg-switch { display: inline-flex; border: 1px solid color-mix(in srgb, var(--muted) 35%, var(--line)); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg-switch button { background: transparent; color: var(--ink); border-radius: 0; padding: 7px 12px; font-size: 14px; }
.seg-switch button + button { border-left: 1px solid var(--line); }
.seg-switch button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

/* KPI tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin: 4px 0 8px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-align: left; color: var(--ink); font-weight: 400; display: block; }
.tile .n { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.tile .l { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.35; }
.tile .n.split { display: flex; gap: 18px; font-size: 22px; }
.tile .n.split span { display: flex; flex-direction: column; }
.tile .n.split small { font-size: 11.5px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.tile.ok { border-top-color: var(--ok); } .tile.warn { border-top-color: var(--warn); } .tile.bad { border-top-color: var(--bad); }
.tiles .tile.warn .n { color: var(--warn); } .tiles .tile.bad .n { color: var(--bad); }
button.tile { cursor: pointer; padding: 14px 16px; display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; font-size: inherit; }
button.tile:hover { filter: none; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
button.tile .l::after { content: " \203A"; color: var(--brand); }

/* Tables */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th, table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.grid thead th { background: var(--head-bg); color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tbody tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent); }
table.grid.clickable tbody tr { cursor: pointer; }
table.grid.clickable tbody tr:focus-visible { outline-offset: -2px; }
table.grid.clickable tbody tr:focus-visible td, table.grid tr.sel td { background: color-mix(in srgb, var(--brand) 10%, transparent); }
table.grid tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.rowtitle { font-weight: 500; }
.cc { display: inline-block; font: 600 12px/1.5 var(--mono); padding: 0 5px; border-radius: 5px; background: color-mix(in srgb, var(--brand) 9%, transparent); color: var(--brand); letter-spacing: .4px; }
.ccname { white-space: nowrap; }
.person { display: inline-flex; gap: 10px; align-items: center; }
.tag { font: 12.5px/1.4 var(--mono); padding: 1px 6px; border-radius: 5px; background: var(--head-bg); border: 1px solid var(--line); white-space: nowrap; }
.kvline { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; overflow-wrap: anywhere; }

/* Badges: first letter capitalised, one colour scheme for every status */
.badge { display: inline-block; font-size: 12px; line-height: 1.6; padding: 0 9px; border-radius: 99px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.badge::first-letter { text-transform: uppercase; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.badge.off { background: color-mix(in srgb, var(--line) 70%, transparent); color: var(--muted); }

/* Notices, alerts, empty, loading and error states */
.alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.alerts li { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; padding: 10px 14px; border-left: 4px solid var(--warn); background: var(--warn-bg); color: var(--ink); border-radius: 8px; font-size: 14px; }
.alerts li > span { flex: 1 1 320px; }
.alerts li .link { margin-left: auto; white-space: nowrap; font-weight: 500; }
.alerts li.bad { border-color: var(--bad); background: var(--bad-bg); }
.alerts li.ok { border-color: var(--ok); background: var(--ok-bg); }
.notice { padding: 10px 14px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--info) 22%, transparent); background: var(--info-bg); color: var(--ink); font-size: 14px; margin: 8px 0 12px; }
.notice.ok { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.notice.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.notice.bad { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice button { margin-left: 8px; }
.empty { border: 1px dashed color-mix(in srgb, var(--muted) 40%, var(--line)); border-radius: var(--radius); padding: 22px 16px; text-align: center; color: var(--muted); background: color-mix(in srgb, var(--surface) 60%, transparent); font-size: 14px; }
.empty p { margin: 0; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 32px 0; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--ok-bg); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); position: sticky; top: 8px; z-index: 30; box-shadow: var(--shadow); }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }

/* Panels (add forms), cards and the danger zone */
.card { box-shadow: var(--shadow); }
.card > h2:first-child { margin-top: 0; font-size: 17px; }
details.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; box-shadow: var(--shadow); }
details.panel > summary { cursor: pointer; font-weight: 600; padding: 11px 16px; list-style: none; display: flex; align-items: center; gap: 8px; color: var(--brand); }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before { content: "+"; display: inline-flex; width: 20px; height: 20px; border-radius: 6px; align-items: center; justify-content: center; background: color-mix(in srgb, var(--brand) 10%, transparent); font-weight: 700; }
details.panel[open] > summary::before { content: "\2212"; }
details.panel[open] > summary { border-bottom: 1px solid var(--line); }
.panel-body { padding: 4px 16px 16px; }
.panel-body > h3:first-child { margin-top: 12px; }
.recipients { display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; }
.recipient { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: var(--radius); box-shadow: var(--shadow); }
.dangerzone { display: flex; gap: 14px; align-items: center; justify-content: space-between; border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line)); border-radius: var(--radius); padding: 12px 14px; margin: 18px 0 4px; }
.dangerzone p { margin: 2px 0 0; }
fieldset.group { border: 1px solid var(--line); margin: 0 0 14px; padding: 0 18px 18px; min-width: 0; }
fieldset.group legend { float: left; width: 100%; font-weight: 700; font-size: 16px; padding: 14px 0 10px; margin: 0 0 6px; border-bottom: 1px solid var(--line); }
fieldset.group legend + * { clear: both; }
.savebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.secret { font: 14px/1.4 var(--mono); background: #0f1b2b; color: #dbe7f5; padding: 12px; border-radius: 8px; word-break: break-all; user-select: all; }
dialog { border: 0; border-radius: 12px; padding: 22px; max-width: 560px; width: calc(100% - 32px); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
dialog h2 { margin: 0; }
dialog::backdrop { background: rgba(5, 25, 50, .45); }

/* Gender in trade: ownership categories and simple bar charts */
.c-WO { background: #0b6e4f; color: #fff; } .c-WL { background: #6cbf94; color: #10261b; }
.c-OT { background: #2c5aa0; color: #fff; } .c-ND { background: #b9c1cc; color: #1d2733; }
i.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); margin: 0 0 12px; }
.stack-bars, .mbars { display: flex; flex-direction: column; gap: 7px; }
.sb-row { display: grid; grid-template-columns: 92px 1fr 72px; gap: 10px; align-items: center; font-size: 13px; }
.sb-q { color: var(--muted); font-variant-numeric: tabular-nums; }
.sb-n { text-align: right; font-variant-numeric: tabular-nums; }
.sb-bar { display: flex; height: 22px; border-radius: 5px; overflow: hidden; background: color-mix(in srgb, var(--line) 50%, transparent); align-items: center; }
.sb-bar .seg { height: 100%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; min-width: 2px; }
.mbars .sb-row { grid-template-columns: 110px 1fr 56px; }
.mbars h3 { font-size: 14px; margin: 0 0 6px !important; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
table.entry input { width: 100%; min-width: 72px; padding: 6px 8px; text-align: right; font-size: 14px; }
table.entry td:first-child { white-space: nowrap; font-size: 14px; }

/* Integration: journey, guide cards, code examples, sandbox steps */
ol.journey { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
ol.journey li { padding: 12px 14px; border-right: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
ol.journey li:last-child { border-right: 0; }
ol.journey b { grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: 14px; }
ol.journey li:nth-child(4) b { background: var(--accent); } ol.journey li:nth-child(5) b { background: var(--gold); color: #1d2733; }
ol.journey span { font-weight: 600; font-size: 14.5px; } ol.journey small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.gcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.gcard { display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.gcard:hover { border-color: var(--brand); }
.gcard .kind { font-size: 11.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .7px; }
.gcard b { font-size: 15.5px; } .gcard span:last-child { color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.codetabs .seg-switch { margin-bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 0; }
.codetabs pre.code { margin: 0; border-top-left-radius: 0; }
.notice pre.code { margin: 6px 0 0; font-size: 12px; max-height: 240px; overflow: auto; }
.notice details summary { cursor: pointer; margin-top: 6px; }
.card.step { margin: 0 0 14px; }
.card.step > h2 { display: flex; align-items: center; gap: 10px; }
.stepn { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center; font-size: 14px; }
.card.step .tablewrap { box-shadow: none; margin: 8px 0; }
.card.step form.row input { flex: 1 1 280px; }
.progress { flex: 1 1 200px; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; } .progress i { display: block; height: 100%; background: var(--accent); }
ul.checklist { margin: 4px 0 8px; padding-left: 20px; font-size: 14px; } ul.checklist li { margin: 3px 0; }

.mailtext { white-space: pre-wrap; font: 14px/1.5 var(--mono); background: var(--bg, #f6f8fb); padding: 12px; border-radius: 8px; margin: 10px 0 0; }
/* Profile menu (top right) */
.profile { position: relative; }
#profile-btn { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 99px; padding: 3px 10px 3px 3px; font-size: 14px; }
#profile-btn:hover, #profile-btn[aria-expanded="true"] { background: rgba(255,255,255,.22); filter: none; }
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--gold); color: #1d2733; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand); }
.caret { font-size: 11px; opacity: .85; }
.pmenu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 270px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.pmenu .phead { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pmenu .phead span { font-size: 13px; color: var(--muted); }
.pmenu button { display: block; width: 100%; text-align: left; background: transparent; color: var(--ink); border: 0; border-radius: 6px; padding: 9px 10px; font-size: 14px; font-weight: 400; }
.pmenu button:hover, .pmenu button:focus-visible { background: color-mix(in srgb, var(--brand) 10%, transparent); filter: none; outline-offset: -2px; }
.pmenu #logout { color: var(--bad); }

/* Details drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--surface); color: var(--ink); box-shadow: -18px 0 50px rgba(0,0,0,.22); z-index: 40; display: flex; flex-direction: column; border-left: 1px solid var(--line); animation: slidein .18s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } }
@media (prefers-reduced-motion: reduce) { .drawer, .spinner { animation: none; } }
.drawer-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 20px 14px; border-bottom: 1px solid var(--line); background: var(--head-bg); }
.drawer-titles { flex: 1; min-width: 0; }
.drawer-head h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.drawer-sub { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.drawer-body { padding: 4px 20px 28px; overflow-y: auto; flex: 1; }
.drawer-body h3 { margin: 20px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.drawer-body .form > h3 { margin: 10px 0 -6px; }
.drawer-body .tablewrap { box-shadow: none; }
.drawer-body details.panel { margin-top: 14px; box-shadow: none; }
table.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
table.kv th { text-align: left; color: var(--muted); font-weight: 500; width: 36%; padding: 8px 12px 8px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
table.kv td { padding: 8px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }

@media (max-width: 760px) {
  main.console { padding: 12px 16px 40px; }
  header.top .brand small { display: none; }
  .pname { display: none; }
  .two { grid-template-columns: 1fr; }
  .sb-row { grid-template-columns: 70px 1fr 56px; }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .side { position: static; }
  .scope { padding: 8px 10px; margin-bottom: 8px; box-shadow: none; }
  .scope-mark { min-width: 32px; height: 32px; }
  .side nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; position: relative; scrollbar-width: thin; }
  .side nav .grp { display: none; }
  .side nav button { flex: none; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; font-size: 14px; }
  .side nav button[aria-current="page"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
  .side nav button[aria-current="page"]::before { display: none; }
  .pane h1 { font-size: 22px; }
  .head .actions { margin-left: 0; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  ol.journey { grid-template-columns: 1fr; } ol.journey li { border-right: 0; border-bottom: 1px solid var(--line); } ol.journey li:last-child { border-bottom: 0; }
  .tile { padding: 12px; } .tile .n { font-size: 22px; } .tile .n.split { font-size: 17px; gap: 12px; }
  .toolbar input[type=search] { max-width: none; flex-basis: 100%; }
  .toolbar select { flex: 1 1 140px; }
  .toolbar .count { margin-left: 0; flex-basis: 100%; }
  .drawer { width: 100%; }
  .drawer-head { padding: 12px 16px; flex-wrap: wrap; }
  .drawer-body { padding: 4px 16px 24px; }
  .dangerzone { flex-direction: column; align-items: flex-start; }
  table.kv th { width: 42%; }
  table.grid th, table.grid td { white-space: nowrap; padding: 8px 10px; }
  table.entry td:first-child { white-space: normal; min-width: 150px; }
  .auth .card.narrow { margin: 16px auto; padding: 22px 18px 16px; }
}
