/* T0 portal theme: exact S4 section 3.1 tokens with shared component aliases. */
:root {
  color-scheme: dark;
  --bg: #1e1e1e; --bg2: #181818; --side: #1f1f1f; --panel: #252526; --act: #181818;
  --line: #2b2b2b; --line2: #3c3c3c; --fg: #cccccc; --fg2: #9d9d9d; --dim: #8b949e;
  --accent: #0078d4; --accent2: #2488db; --accent-hover: #106ebe; --green: #2ea043; --amber: #d29922; --red: #f85149; --red-text: #ff7b72;
  --user: #264f78; --code: #0d1117; --hover: #2a2d2e; --sel: #04395e;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --link: #4daafc; --white: #fff; --field: #313131; --field-line: #707070; --control: var(--field); --button: #2d2d2d; --button-hover: #383838;
  --danger-bg: #5a1d1d; --danger-line: #8b2c2c; --danger-fg: #ffd7d7;
  --success-bg: #1f4d2b; --success-fg: #d7ffe0; --warning-bg: #4d3800; --warning-fg: #ffd479;
  --backdrop: rgb(0 0 0 / 55%);
  --r-sm: 4px; --r: 8px; --r-lg: 10px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --nav-w: 224px; --top-h: 48px;
  --radius-sm: var(--r-sm); --radius: var(--r); --radius-pill: var(--r-lg);
  --font-size: 14px; --line-height: 1.5; --sidebar-width: var(--nav-w); --topbar-height: var(--top-h);
  --page-width: 980px; --public-width: 880px; --space: 8px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: var(--font-size)/var(--line-height) var(--sans); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; }
button { cursor: pointer; } button:disabled { opacity: .5; cursor: default; }
button, a, input, textarea, select, summary, [tabindex] { outline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent2); }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex-shrink: 0; vertical-align: middle; }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: 18px; line-height: 1.25; font-weight: 600; color: var(--white); }
h2 { font-size: 18px; line-height: 1.4; font-weight: 600; color: var(--fg); }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--fg2); } .dim { color: var(--dim); } .text-danger { color: var(--red-text); }
.mono { font-family: var(--mono); } .small { font-size: 12px; }
.row, .actions { display: flex; align-items: center; gap: var(--space); } .actions { flex-wrap: wrap; }
.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: calc(var(--space) * 2); }
.grid, .tool-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: calc(var(--space) * 2); }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--space) * 3); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--fg); font-size: 20px; font-weight: 600; }
.brand:hover { text-decoration: none; color: var(--white); }
.public-header { max-width: calc(var(--public-width) + 64px); margin: auto; padding: 28px 32px; display: flex; align-items: center; justify-content: space-between; }
.public-main { width: min(var(--public-width), calc(100% - 40px)); margin: 7vh auto 40px; min-height: 55vh; }
.public-footer { color: var(--fg2); text-align: center; padding: 24px 20px calc(24px + var(--safe-b)); font-size: 12px; }
.shell { display: flex; min-height: 100dvh; }
.sidebar { width: var(--sidebar-width); background: var(--side); border-right: 1px solid var(--line); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; padding: 12px 8px; }
.sidebar .brand { padding: 0 8px; min-height: 24px; margin-bottom: 24px; }
.sidebar-label { color: var(--fg2); padding: 0 12px; font-size: 12px; margin-bottom: 12px; }
.sidebar nav { overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 6px 14px; margin-bottom: 4px; border-radius: var(--radius-sm); color: var(--fg); min-height: 34px; }
.nav-item:hover { text-decoration: none; background: var(--hover); color: var(--fg); }
.nav-item.active { background: var(--sel); color: var(--white); }
.nav-item > span:first-of-type { flex: 1; }
.workspace { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); min-width: 0; }
.topbar { min-height: var(--topbar-height); border-bottom: 1px solid var(--line); padding: 4px 16px; display: flex; align-items: center; gap: 12px; background: var(--bg2); }
.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }
.dashboard-main { max-width: var(--page-width); margin: auto; padding: 16px; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu-panel { position: absolute; right: 0; top: 100%; width: 180px; padding: 8px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--panel); z-index: 30; }
.user-menu-panel a, .user-menu-panel button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px; color: var(--fg); border: 0; border-radius: var(--radius-sm); background: transparent; text-align: left; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--hover); text-decoration: none; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.page-header p { margin-bottom: 0; } .page-header h1 { margin-bottom: 8px; }
.card { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card > :last-child { margin-bottom: 0; }
.field { margin-bottom: 20px; }
.field label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--fg2); font-weight: 400; }
.field-help { font-size: 12px; margin: 6px 0 0; color: var(--fg2); }
.field-help.text-danger { color: var(--red-text); }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), textarea, select { width: 100%; min-width: 0; min-height: 42px; padding: 9px 11px; background: var(--control); border: 1px solid var(--field-line); border-radius: var(--radius-sm); }
textarea { min-height: 112px; resize: vertical; } input::placeholder, textarea::placeholder { color: var(--fg2); }
input:focus, textarea:focus, select:focus { border-color: var(--accent2); }
input[aria-invalid=true], textarea[aria-invalid=true] { border-color: var(--red); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border: 1px solid var(--line2); border-radius: var(--radius-sm); background: var(--button); color: var(--fg); font-weight: 600; line-height: 1.4; }
.btn:hover { text-decoration: none; background: var(--button-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--white); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-fg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.block { width: 100%; } .btn svg { width: 16px; height: 16px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius-sm); background: transparent; }
.iconbtn:hover { background: var(--hover); }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 12px; background: var(--button); color: var(--fg2); white-space: nowrap; }
.badge.success { color: var(--success-fg); background: var(--success-bg); }
.badge.warning { color: var(--warning-fg); background: var(--warning-bg); }
.badge.danger { color: var(--danger-fg); background: var(--danger-bg); }
.flash-stack:empty { display: none; } .flash-stack { margin-bottom: 24px; display: grid; gap: 8px; }
.toast { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--panel); }
.toast.error, .toast.danger { border-color: var(--danger-line); color: var(--danger-fg); }
.toast.success { color: var(--success-fg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; text-align: left; }
caption { text-align: left; padding: 14px 16px; font-weight: 600; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--panel); color: var(--fg2); font-size: 12px; font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
.empty-state { padding: 48px 24px; text-align: center; border: 1px dashed var(--line2); border-radius: var(--radius); }
.empty-state > svg { color: var(--fg2); margin-bottom: 16px; width: 28px; height: 28px; }
.tool-tile { display: flex; flex-direction: column; align-items: flex-start; }
.tool-tile p { flex: 1; margin-bottom: 20px; }
.error-card { max-width: 560px; margin: 0 auto; }
.error-code { display: block; color: var(--fg2); font: 13px var(--mono); margin-bottom: 20px; }
.error-card p { margin-bottom: 24px; }
.modal-backdrop { position: fixed; inset: 0; padding: 24px; display: flex; align-items: center; justify-content: center; background: var(--backdrop); z-index: 100; }
.modal { width: min(100%, 520px); max-height: calc(100dvh - 48px); overflow-y: auto; border-color: var(--line2); border-radius: var(--r-lg); }
.modal .row { margin-bottom: 12px; } .modal h2 { margin: 0; } .modal-open, .drawer-open { overflow: hidden; }
.menu-toggle { display: none; }
.drawer-backdrop { position: fixed; inset: 0; border: 0; background: var(--backdrop); z-index: 35; }
.skip-link { position: fixed; top: -100px; left: 16px; padding: 10px 16px; background: var(--panel); z-index: 200; }
.skip-link:focus { top: 12px; }
@media (max-width: 859px) {
  .sidebar { transform: translateX(-100%); visibility: hidden; width: min(280px, 82vw); }
  .drawer-open .sidebar { transform: none; visibility: visible; }
  .workspace { width: 100%; margin-left: 0; }
  .topbar { padding: 2px 12px; }
  .nav-item { min-height: 44px; }
  input, textarea, select { font-size: 16px; }
  .menu-toggle { display: inline-flex; }
  .dashboard-main { padding: 24px 20px; }
  .public-header { padding: 24px 20px; }
  .public-main { margin-top: 24px; }
  .two-column { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; flex-direction: column; margin-bottom: 24px; }
  .card { padding: 20px; }
  h1 { font-size: 18px; }
  .user-menu summary span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

/* S4 compact components and content frames for sections. */
.account-frame { max-width: 380px; margin: auto; }
.goodbye-frame { max-width: 560px; margin: auto; }
.tiny { font-size: 12px; } .input { accent-color: var(--accent); }
.btn.sm { min-height: 30px; padding: 5px 11px; font-size: 12px; }
.btn.big { padding: 10px 16px; font-size: 15px; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item .badge { background: var(--accent); color: var(--white); }
.nav-divider { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.tool-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 10px; }
.tool-tile { padding: 14px; color: var(--fg); }
a.tool-tile:hover { background: var(--hover); border-color: var(--line2); text-decoration: none; }
.tool-tile h2 { font-size: 14px; margin: 0 0 4px; }
.tool-tile p { font-size: 13px; margin-bottom: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty-state { padding: 40px 16px; background: var(--panel); border: 1px solid var(--line); }
.card .empty-state { background: none; border: 0; padding: 8px; }
.empty-state > svg { margin-bottom: 8px; }
.empty-state h2 { margin-bottom: 4px; }
.empty-state p { margin-bottom: 0; }
.empty-state h2 { font-size: 14px; } .empty-state p { font-size: 13px; }
.table-wrap { background: var(--panel); }
th { background: transparent; border-bottom-color: var(--line2); }
tbody tr:hover { background: var(--hover); }
.numeric, time { font-variant-numeric: tabular-nums; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.layout-dashboard .shell { height: 100dvh; }
.layout-dashboard .workspace { display: flex; flex-direction: column; height: 100dvh; }
.layout-dashboard .topbar { flex-shrink: 0; }
.layout-dashboard .dashboard-main { overflow-y: auto; flex: 1; width: 100%; }
@media (max-width: 859px) {
  .btn.sm { min-height: 36px; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: auto; }
  .table-wrap thead { display: none; }
  .table-wrap tr { margin: 8px 0; padding: 4px 0; border: 1px solid var(--line2); border-radius: var(--r); background: var(--side); }
  .table-wrap td { border: 0; padding: 4px 12px; }
  .table-wrap td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--fg2); margin-bottom: 1px; }
}

/* F3: design and copy fixes from R2. */
.brand-mark { width: 24px; height: 24px; flex: none; }
body.layout-public { display: flex; flex-direction: column; min-height: 100dvh; }
.layout-public .public-header { width: 100%; margin-inline: auto; }
.layout-public .public-main { flex: 1 0 auto; min-height: 0; }
.layout-public .public-footer { flex: none; }
body:has(.account-frame) .public-header { max-width: none; width: min(380px, calc(100% - 40px)); padding: 28px 0 0; }
body:has(.goodbye-frame) .public-header { max-width: none; width: min(560px, calc(100% - 40px)); padding: 28px 0 0; }
.card > h1:first-child, .card > h2:first-child { color: var(--white); margin-bottom: 4px; }
.card > h1:first-child { margin-bottom: 8px; }
.goodbye-body .card > h1.goodbye-title { margin-bottom: 12px; }
.card > h1 + p.muted, .card > h2 + p.muted { margin-bottom: 20px; }
:where(.layout-dashboard section) > h2, .layout-dashboard .card:not(.tool-tile) > h2, .account-frame .card h2 { font-size: 15px; }
.stat { font-size: 20px; font-weight: 600; color: var(--white); margin: 0; }
@media (min-width: 860px) { .topbar-title { visibility: hidden; } }
.grid > .field, .stack > .field { margin-bottom: 0; }
.filters .grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 12px; }
.filters > summary { cursor: pointer; font-weight: 600; color: var(--white); }
.filters[open] > summary { margin-bottom: 14px; }
@media (min-width: 860px) { .filters > summary { display: none; } .filters[open] > summary { margin: 0; } }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--fg); }
.field .check { display: flex; font-size: 14px; color: var(--fg); margin: 0; }
.grid + .actions, .field + .actions, .grid + .field { margin-top: 12px; }
.stack > h2 { margin-bottom: 0; }
.check input { margin: 3px 0 0; flex: none; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; }
input[readonly] { background: transparent; border-color: var(--line2); color: var(--fg2); }
@media (max-width: 859px) {
  .table-wrap { border: 0; background: none; overflow: visible; }
  .table-wrap caption { display: block; padding: 0 0 8px; }
  .table-wrap td:empty { display: none; }
  td[data-label="IP"], td[data-label="Device"] { display: none; }
  .tool-grid { gap: 8px; }
  .tool-tile { padding: 12px 14px; }
  .tool-tile p { -webkit-line-clamp: 1; }
}

/* Public footer: legal links (lead, 22 Oct 2026) */
.public-footer nav { display: flex; justify-content: center; align-items: center; gap: 20px; }
.public-footer .footer-gap { display: none; }
.public-footer a { color: var(--fg2); text-decoration: none; font-size: 12.5px; }
.public-footer a:hover, .public-footer a:focus-visible { color: var(--fg); text-decoration: underline; }
.agree-line { margin: 12px 0 0; text-align: center; }
.agree-line a, .contact-fine a { color: var(--link); }
