/* FormForge admin. No inline styles anywhere: the app's CSP forbids them. Sections: fonts, tokens, base, shell, components, views. */

/* ---------- fonts (self-hosted, IBM Plex, SIL OFL) ---------- */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }

/* ---------- tokens ---------- */
:root {
  --font: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --bg: #f6f7f9;            /* page */
  --surface: #ffffff;       /* inputs, dialogs, table body */
  --surface-2: #eef1f5;     /* hover, subtle fills */
  --line: #e2e6eb;          /* hairlines */
  --line-strong: #c9d0d9;   /* input borders */
  --ink: #16212c;           /* primary text */
  --ink-2: #4b5967;         /* secondary text */
  --ink-3: #66727f;         /* tertiary text (still 4.5:1 on --bg) */

  --accent: #2a4fd6;        /* actions */
  --accent-hover: #2142b8;
  --accent-ink: #ffffff;
  --accent-soft: #e8edfc;

  --ok: #17703f;   --ok-soft: #e4f4ea;
  --warn: #8a5300; --warn-soft: #fdf1da;
  --bad: #b3261e;  --bad-soft: #fbe9e7;

  --rail: #16212c; --rail-ink: #cbd5df; --rail-ink-strong: #ffffff; --rail-line: #263646; --rail-hover: #1f2d3b; --rail-active: #26384b;
  --rail-accent: #7b9bff;

  --radius: 8px; --radius-sm: 6px;
  --shadow-pop: 0 10px 30px rgba(14, 24, 36, .16), 0 2px 6px rgba(14, 24, 36, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f161d; --surface: #16202a; --surface-2: #1e2a36; --line: #263340; --line-strong: #3a4a5a;
    --ink: #e9eef3; --ink-2: #aab6c2; --ink-3: #8e9ba8;
    --accent: #8aa6ff; --accent-hover: #a5bbff; --accent-ink: #0b1220; --accent-soft: #1c2745;
    --ok: #6fd39a; --ok-soft: #12301f; --warn: #f0b95a; --warn-soft: #382a0c; --bad: #ff8d84; --bad-soft: #3b1714;
    --rail: #0b1117; --rail-ink: #a9b6c3; --rail-line: #1b2733; --rail-hover: #131d27; --rail-active: #1c2a38;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f161d; --surface: #16202a; --surface-2: #1e2a36; --line: #263340; --line-strong: #3a4a5a;
  --ink: #e9eef3; --ink-2: #aab6c2; --ink-3: #8e9ba8;
  --accent: #8aa6ff; --accent-hover: #a5bbff; --accent-ink: #0b1220; --accent-soft: #1c2745;
  --ok: #6fd39a; --ok-soft: #12301f; --warn: #f0b95a; --warn-soft: #382a0c; --bad: #ff8d84; --bad-soft: #3b1714;
  --rail: #0b1117; --rail-ink: #a9b6c3; --rail-line: #1b2733; --rail-hover: #131d27; --rail-active: #1c2a38;
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { padding: 48px; color: var(--ink-3); }
svg.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 15px; height: 15px; }

/* ---------- shell ---------- */
.shell { --envh: 4px; display: grid; grid-template-columns: 232px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.shell.prod { --envh: 26px; }
.envbar { grid-column: 1 / -1; height: var(--envh); background: var(--warn); position: sticky; top: 0; z-index: 40; }
.envbar.prod { background: var(--bad); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12.5px; letter-spacing: .02em; }
.shell-body { display: contents; }
.rail { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; padding: 18px 12px 12px; position: sticky; top: var(--envh); height: calc(100vh - var(--envh)); }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: var(--rail-ink-strong); font-weight: 600; font-size: 16px; letter-spacing: .005em; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.env-chip { margin: 0 8px 16px; padding: 3px 9px; border: 1px solid var(--rail-line); border-radius: 99px; font-size: 12px; color: var(--rail-ink); width: fit-content; }
.env-chip.prod { border-color: var(--bad); color: #ffb4ad; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--rail-ink); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--rail-hover); color: var(--rail-ink-strong); }
.nav a[aria-current="page"] { background: var(--rail-active); color: var(--rail-ink-strong); box-shadow: inset 3px 0 0 var(--rail-accent); }
.rail-foot { margin-top: auto; position: relative; }
.user-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--rail-ink); }
.user-btn:hover { background: var(--rail-hover); }
.user-meta { min-width: 0; flex: 1; }
.user-name { color: var(--rail-ink-strong); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 12px; color: var(--rail-ink); }
.popover { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 10px; z-index: 30; }
.popover .label { font-size: 12px; color: var(--ink-3); margin: 2px 4px 6px; }
.seg button.icon-only { padding: 0 9px; }
.popover .seg { width: 100%; }
.popover .seg button { flex: 1; justify-content: center; }
.popover .seg button.icon-only { flex: 0 0 auto; padding: 0 12px; }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 10px -10px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--ink); }
.menu-item:hover { background: var(--surface-2); }

.main { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 36px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.005em; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.head-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--accent); padding: 0 8px; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.danger { background: transparent; color: var(--bad); border-color: transparent; padding: 0 8px; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.input, .select { height: 34px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); min-width: 0; width: 100%; }
.input::placeholder { color: var(--ink-3); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.input:disabled { background: var(--surface-2); color: var(--ink-2); }
.select { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px; background-size: 5px 5px; background-repeat: no-repeat; }
.input.port { width: 96px; flex: none; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search .icon { position: absolute; left: 10px; top: 8px; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 34px; }
.field { display: grid; gap: 6px; }
.field > label, .field > .label { font-weight: 500; }
.field .hint { color: var(--ink-3); font-size: 13px; }
.field .error { color: var(--bad); font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.cb { appearance: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); display: inline-grid; place-content: center; cursor: pointer; flex: none; }
.cb:checked { background: var(--accent); border-color: var(--accent); }
.cb:checked::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: translateY(-1px) rotate(-45deg); }
.cb:disabled { opacity: .5; cursor: not-allowed; }
.cb:disabled:checked { background: var(--ink-3); border-color: var(--ink-3); }
.seg { display: inline-flex; padding: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 0 12px; height: 28px; border-radius: 4px; cursor: pointer; color: var(--ink-2); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(14, 24, 36, .14); }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--bg); white-space: nowrap; }
.table th.c, .table td.c { text-align: center; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table .primary { font-weight: 500; color: var(--ink); text-decoration: none; }
.table .primary:hover { text-decoration: underline; }
.table .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .num { font-variant-numeric: tabular-nums; }
.table-foot { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px; background: var(--bg); }

/* ---------- status, badges, avatars ---------- */
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.status.ok::before { background: var(--ok); } .status.warn::before { background: var(--warn); } .status.bad::before { background: var(--bad); }
.tag { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid var(--line); }
.tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.tag.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tags { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: 8px; vertical-align: middle; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-content: center; font-weight: 600; font-size: 12px; color: #fff; flex: none; }
.avatar.a0 { background: #3b6fd4; } .avatar.a1 { background: #1f7f6d; } .avatar.a2 { background: #8a4fc0; } .avatar.a3 { background: #b4501f; } .avatar.a4 { background: #5a6b7d; } .avatar.a5 { background: #a1357a; }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .who { min-width: 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- settings rows, key-values, sections ---------- */
.section { margin-bottom: 36px; }
.section > h2 { font-size: 16px; font-weight: 600; }
.section > .desc { color: var(--ink-2); margin: 4px 0 14px; max-width: 70ch; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.srow { display: grid; grid-template-columns: minmax(180px, 280px) minmax(0, 1fr); gap: 12px 32px; padding: 18px 20px; border-bottom: 1px solid var(--line); align-items: start; }
.srow:last-child { border-bottom: 0; }
.srow .name { font-weight: 500; }
.srow .help { color: var(--ink-3); font-size: 13px; margin-top: 2px; max-width: 34ch; }
.srow .controls { display: grid; gap: 10px; max-width: 520px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline .grow { flex: 1; min-width: 160px; }
.panel-foot { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); flex-wrap: wrap; }
.panel-foot .spacer { flex: 1; }
.secret { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.secret .dots { font-family: var(--mono); letter-spacing: 2px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--ink-2); }
.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); margin-bottom: 18px; align-items: flex-start; }
.notice.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.notice.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.notice .icon { margin-top: 2px; }
.notice code { font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.kv { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 0; }
.kv > div { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.kv > .k { color: var(--ink-3); }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }

/* ---------- verdict (URL tester) ---------- */
.verdict { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); align-items: flex-start; }
.verdict.yes { background: var(--ok-soft); color: var(--ok); }
.verdict.no { background: var(--bad-soft); color: var(--bad); }
.verdict strong { display: block; font-size: 15px; }
.verdict .detail { color: var(--ink-2); margin-top: 2px; }

/* ---------- empty, skeleton, toasts ---------- */
.empty { text-align: center; padding: 44px 24px; color: var(--ink-2); }
.empty .icon { width: 28px; height: 28px; color: var(--ink-3); margin-bottom: 10px; }
.empty h3 { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.empty p { max-width: 46ch; margin: 0 auto 14px; }
.skeleton { height: 14px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.w1 { width: 40%; } .skeleton.w2 { width: 65%; } .skeleton.w3 { width: 25%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 100; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop); animation: pop .18s ease-out; }
.toast.ok .icon { color: #6fd39a; } .toast.err .icon { color: #ff8d84; }
.toast .t-body { flex: 1; }
.toast button { background: transparent; border: 0; color: inherit; cursor: pointer; opacity: .7; padding: 0; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- dialogs & drawers ---------- */
dialog { border: 0; padding: 0; border-radius: 12px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(10, 18, 27, .55); }
.dlg { display: grid; gap: 16px; padding: 22px; }
.dlg h2 { font-size: 17px; font-weight: 600; }
.dlg .desc { color: var(--ink-2); margin-top: -8px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); border-radius: 0; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drawer-head h2 { font-size: 16px; font-weight: 600; }
.drawer-body { padding: 18px 22px 28px; display: grid; gap: 16px; }
pre.code { margin: 0; padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); font: 12.5px/1.55 var(--mono); overflow: auto; white-space: pre-wrap; word-break: break-word; max-height: 320px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: min(400px, 100%); display: grid; gap: 22px; }
.login-card .brand { color: var(--ink); padding: 0; font-size: 20px; }
.login-card h1 { font-size: 22px; font-weight: 600; }
.login-card .lead { color: var(--ink-2); margin-top: 6px; }
.login-card .panel { padding: 22px; display: grid; gap: 14px; }
.login-card .btn { height: 40px; }
.login-card details summary { cursor: pointer; color: var(--ink-2); font-weight: 500; padding: 4px 0; }
.login-card details[open] summary { margin-bottom: 12px; }
.login-card form { display: grid; gap: 12px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px 12px; padding: 10px 12px; }
  .brand { padding: 0 6px 0 0; } .env-chip { margin: 0; }
  .nav { display: flex; order: 3; width: 100%; overflow-x: auto; }
  .rail-foot { margin: 0 0 0 auto; }
  .user-meta { display: none; } .user-btn { width: auto; }
  .popover { left: auto; right: 0; width: 240px; top: calc(100% + 8px); bottom: auto; }
  .page { padding: 20px 16px 56px; }
  .srow { grid-template-columns: 1fr; padding: 16px; }
  .kv { grid-template-columns: 120px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.tagrow { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.secret > .inline { flex: 1; min-width: 240px; }
.srow .controls .help { max-width: none; margin-top: 0; }
.table .sub.indent { padding-left: 15px; }

.table time { white-space: nowrap; }
.table.dense th, .table.dense td { padding-left: 12px; padding-right: 12px; }
.table.dense th.c { white-space: normal; max-width: 88px; line-height: 1.25; }
.addrow { display: grid; gap: 10px; margin-top: 14px; align-items: center; }
.addrow.three { grid-template-columns: minmax(200px, 280px) minmax(0, 1fr) auto; }
.addrow.two { grid-template-columns: minmax(0, 1fr) auto; }
.addrow.grant { grid-template-columns: minmax(0, 1fr) 150px auto; }
.drawer-stack { display: grid; gap: 28px; }
.drawer-stack .section { margin-bottom: 0; padding-top: 20px; border-top: 1px solid var(--line); }
@media (max-width: 700px) { .addrow.three, .addrow.two, .addrow.grant { grid-template-columns: 1fr; } }

.section.spaced { margin-top: 32px; }
.section > h2 + .code, .section > h2 + .panel, .section > h2 + .table-wrap { margin-top: 10px; }

.progress-host:empty { display: none; }
.progress-host { margin-bottom: 18px; }
.progress { padding: 18px 20px; display: grid; gap: 14px; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.progress .elapsed { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.progress .notice { margin: 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 7px 2px; color: var(--ink-3); }
.steps li.done { color: var(--ink-2); }
.steps li.active { color: var(--ink); font-weight: 500; }
.steps li.failed { color: var(--bad); font-weight: 500; }
.steps .mark { width: 20px; height: 20px; display: grid; place-content: center; flex: none; }
.steps li.done .mark { color: var(--ok); }
.steps li.active .mark { color: var(--accent); }
.steps .dotmark { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.steps .spin { width: 16px; height: 16px; }
details.section > summary { cursor: pointer; font-weight: 500; margin-bottom: 10px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 32px; }
.option { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: grid; gap: 12px; align-content: start; }
.option h2 { font-size: 17px; font-weight: 600; }
.option .notice { margin: 0; }
.option .error { color: var(--bad); font-size: 13px; }
.idline { display: flex; align-items: center; gap: 4px; margin: 0 0 14px; }
.toolbar .spacer { flex: 1; }
.input.area { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.addrow.five { grid-template-columns: minmax(150px, 200px) minmax(0, 1fr) minmax(130px, 170px) minmax(110px, 180px) auto; }
.addrow.three2 { grid-template-columns: minmax(0, 1fr) minmax(150px, 200px) auto; }
.place { line-height: 1.45; }
.by { margin-left: 8px; }
@media (max-width: 860px) { .options { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .addrow.five, .addrow.three2 { grid-template-columns: 1fr; } }

dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog.drawer.wide { width: min(760px, 100vw); }
.statline { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; color: var(--ink-2); }
.statline .spin { color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--bg); color: var(--ink-3); font-size: 13px; }
.pager .btns { display: flex; gap: 8px; }
.table td.pick { width: 36px; padding-right: 0; }
.table .url { color: var(--ink-3); font-size: 12.5px; overflow-wrap: anywhere; }
.table td.pagecell { min-width: 340px; }
.stack { display: grid; gap: 14px; }
.table-wrap + .toolbar { margin-top: 14px; }
.toolbar .select { width: auto; min-width: 150px; }
.picker-foot { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 14px 22px; display: grid; gap: 10px; grid-template-columns: 170px minmax(0, 1fr) auto; align-items: center; margin: 0 -22px -28px; }
@media (max-width: 700px) { .picker-foot { grid-template-columns: 1fr; } }
.scroll-list { max-height: 52vh; overflow: auto; }

.snippets { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.snippet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 8px; align-content: start; }
.snippet-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.snippet p { margin: 0; }
.small { font-size: 12.5px; }
pre.code { margin: 0; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
.addperson { display: grid; gap: 10px; margin-top: 18px; max-width: 640px; }
.addperson h3 { font-size: 14px; font-weight: 600; margin: 0; }
.addperson-foot { display: flex; gap: 10px; align-items: center; }
.addperson-foot .select { width: 140px; }
.results { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-height: 240px; overflow: auto; }
.result { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer; color: inherit; font: inherit; }
.result:last-child { border-bottom: 0; }
.result:hover { background: var(--bg); }
.result[aria-selected="true"] { background: var(--accent-soft, #e8eefc); outline: 2px solid var(--accent); outline-offset: -2px; }
.result .who { display: grid; flex: 1; min-width: 0; }
.pad { padding: 12px 14px; margin: 0; }

.sub-h { font-size: 14px; font-weight: 600; margin: 22px 0 4px; }
.idline { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 0 14px; }
.idline .btn { margin-left: 10px; }
.gap-top { margin-top: 36px; }

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong, #8a8f98); background: var(--sw); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch:disabled { cursor: default; }
.rolerow { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rolename { font-weight: 600; }
.preset-line { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.checks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.checks li { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.checks .sample { display: grid; place-items: center; height: 30px; border-radius: 6px; background: var(--bg, #fff); color: var(--fg, #000); border: 1px solid var(--line); font-weight: 700; }
.checks li.ok .res { color: var(--ok); } .checks li.bad .res { color: var(--bad); font-weight: 600; }
.look-bar { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.preview-controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.inline-check { display: inline-flex; gap: 8px; align-items: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stagehost { display: grid; }
.ff-stage { position: relative; background: #dfe1e6; border-radius: 10px; padding: 24px; overflow: hidden; }
.ff-stage.desktop { width: 100%; max-width: 960px; }
.ff-stage.desktop.is-modal { height: 600px; padding: 0; }
.phone-frame { width: 407px; max-width: 100%; padding: 14px; border-radius: 40px; background: #1d1f24; margin: 0 auto 0 0; }
.ff-stage.phone { width: 375px; max-width: 100%; height: 680px; padding: 0; border-radius: 26px; overflow: auto; }
.ff-stage.phone:not(.is-modal) { padding: 16px; }
.ff-stage.phone.is-modal { overflow: hidden; }
.ff-stage .ff-root { min-height: 100%; }
.ff-stage.is-modal .ff-root { height: 100%; }
@media (max-width: 700px) { .rolerow { grid-template-columns: 1fr; } .checks li { grid-template-columns: 44px minmax(0, 1fr); } .checks .res { grid-column: 2; } }

.palrow { display: grid; grid-template-columns: 34px minmax(0, 1fr) 110px auto; gap: 12px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.swatch.static { cursor: default; }
.panel.pad .panel-foot { border-top: 0; }
.preset-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.preset-head { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.preset-head .input { max-width: 260px; }
.input.narrow { max-width: 120px; }
.save-bar { position: sticky; bottom: 0; background: var(--bg); padding: 14px 0; border-top: 1px solid var(--line); display: grid; gap: 10px; justify-items: start; margin-top: 24px; }
.errlist { margin: 6px 0 0; padding-left: 18px; }
