/* Antik UI. One small design system, no libraries: tokens → controls → tables → dialogs → pieces. */

/* Country flags on Windows (no native flag emoji). Only the regional-indicator range; served locally. */
@font-face {
  font-family: 'Twemoji Country Flags';
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  src: url('/fonts/TwemojiCountryFlags.woff2') format('woff2');
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --bg: #09090b; --card: #0d0d10; --pop: #131316; --inset: #111114;
  --muted-bg: #18181b; --hover: #1b1b1f; --active: #232328;
  --line: #232327; --line2: #34343a;
  --fg: #ececef; --fg2: #a1a1aa; --fg3: #6f6f79;
  --accent: #7aa7ff; --ring: rgba(122, 167, 255, .35);
  --ok: #3ecf8e; --ok-bg: rgba(62, 207, 142, .1); --ok-line: rgba(62, 207, 142, .3);
  --bad: #f2766d; --bad-bg: rgba(242, 118, 109, .1); --bad-line: rgba(242, 118, 109, .32);
  --warn: #e3b341; --warn-bg: rgba(227, 179, 65, .09); --warn-line: rgba(227, 179, 65, .3);
  --star: #f0b429;
  --r: 6px; --r-lg: 10px;
  --h: 32px; --h-sm: 26px;
  --top: 52px;
  --shadow: 0 16px 48px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { overflow-y: scroll; background: var(--bg); scrollbar-color: #2e2e34 transparent; }
body { margin: 0; font: 13px/1.45 'Twemoji Country Flags', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--fg); background: var(--bg); -webkit-font-smoothing: antialiased; }
.mono, code { font-family: ui-monospace, 'Cascadia Mono', Consolas, 'DejaVu Sans Mono', monospace; font-size: 12px; }
code { background: var(--muted-bg); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--fg3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }
::selection { background: rgba(122, 167, 255, .3); }

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 20px; height: var(--top); padding: 0 24px; border-bottom: 1px solid var(--line); background: rgba(9, 9, 11, .85); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.1px; white-space: nowrap; }
.brand::before { content: ''; width: 16px; height: 16px; border-radius: 5px; background: linear-gradient(135deg, #fafafa, #8b8b94); box-shadow: inset 0 0 0 4px var(--bg), 0 0 0 1px var(--line2); }
.tabs { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: var(--r); background: none; color: var(--fg2); font-size: 13px; font-weight: 500; }
.tab:hover { color: var(--fg); background: var(--hover); }
.tab.active { color: var(--fg); background: var(--active); }
/* the counter keeps its place while empty: a number that arrives later must not push the other tabs */
.count { display: inline-block; min-width: 28px; padding: 0 5px; border-radius: 9px; background: var(--muted-bg); color: var(--fg3); font-size: 11px; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; }
.count:empty { visibility: hidden; }
.tab.active .count { background: #303037; color: var(--fg2); }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border: 1px solid var(--line); border-radius: 12px; color: var(--fg2); font-size: 12px; white-space: nowrap; }
.chip:empty { display: none; }
.chip.run { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.chip.run::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.chip.off { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }

/* ---------- page ---------- */
main { padding: 20px 24px 56px; }   /* full width of the window: tables are data, not text columns */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.3px; line-height: 1.2; }
.page-desc { margin: 4px 0 0; color: var(--fg2); max-width: 860px; }
.page-head .actions { margin: 0; flex: none; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { width: 260px; }
.toolbar select { max-width: 260px; }
.spacer { flex: 1; }
.block-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; font-weight: 600; color: var(--fg); margin: 28px 0 10px; }
.block-title .muted { font-weight: 400; font-size: 13px; }
.block-title select { height: var(--h-sm); font-size: 12px; font-weight: 400; }
.sub { color: var(--fg3); font-size: 12px; }
.reg-head { color: var(--fg2); }
.reg-head b { color: var(--fg); font-weight: 600; }

/* ---------- controls ---------- */
input, select, textarea, button { font: inherit; color: var(--fg); }
input, select, textarea { background: var(--inset); border: 1px solid var(--line2); border-radius: var(--r); transition: border-color .12s, box-shadow .12s; }
input, select { height: var(--h); padding: 0 10px; }
select { padding-right: 26px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23a1a1aa' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; text-overflow: ellipsis; }
textarea { padding: 8px 10px; width: 100%; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #55555e; }
input:hover, select:hover, textarea:hover { border-color: #45454d; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input:disabled, select:disabled { opacity: .45; }
input[type=checkbox] { height: 15px; width: 15px; margin: 0; padding: 0; accent-color: #e4e4e7; flex: none; }
input[type=file] { height: auto; padding: 4px; font-size: 12px; }
input[type=search]::-webkit-search-cancel-button { filter: invert(.6); }

button { height: var(--h); padding: 0 12px; border: 1px solid var(--line2); border-radius: var(--r); background: var(--card); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
button:hover { background: var(--hover); border-color: #45454d; }
button:active { background: var(--active); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
button:disabled { opacity: .4; cursor: default; pointer-events: none; }
button.primary { background: #f4f4f5; border-color: #f4f4f5; color: #121214; }
button.primary:hover { background: #d9d9de; border-color: #d9d9de; }
button.sm { height: var(--h-sm); padding: 0 9px; font-size: 12px; }
button.with-ic { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
button.with-ic svg { width: 13px; height: 13px; flex: none; }
button.danger, button.bad { color: var(--bad); }
button.danger:hover, button.bad:hover { background: var(--bad-bg); border-color: var(--bad-line); }
button.danger.solid { background: #c9483f; border-color: #c9483f; color: #fff; }
button.danger.solid:hover { background: #b03d35; }
button.go { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
button.go:hover { background: rgba(62, 207, 142, .18); border-color: var(--ok); }
button.ghost { border-color: transparent; background: none; color: var(--fg2); }
button.ghost:hover { background: var(--hover); color: var(--fg); }
button.icon { width: var(--h-sm); height: var(--h-sm); padding: 0; display: inline-flex; align-items: center; justify-content: center; }
button.icon svg { width: 15px; height: 15px; }
.linkbtn { background: none; border: 0; color: var(--accent); padding: 0; height: auto; font-size: 12px; font-weight: 400; }
.linkbtn:hover { background: none; text-decoration: underline; }
.lnk { color: var(--accent); text-decoration: none; }
.lnk:hover { text-decoration: underline; }

/* segmented control */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 8px; background: var(--muted-bg); border: 1px solid var(--line); height: var(--h); flex: none; }
.seg button { border: 0; height: 100%; padding: 0 12px; border-radius: 5px; background: none; color: var(--fg2); font-size: 12px; }
.seg button:hover { color: var(--fg); background: none; }
.seg button.on { background: #2e2e35; color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.seg .n { color: var(--fg3); margin-left: 4px; font-variant-numeric: tabular-nums; display: inline-block; min-width: 3ch; text-align: left; }

/* ---------- tables ---------- */
/* A table never pushes the page sideways: it scrolls inside its own frame and keeps its actions column in view. */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
.table-wrap + .table-wrap { margin-top: 12px; }
.grid { width: 100%; border-collapse: collapse; table-layout: auto; }
.grid th { text-align: left; font-weight: 500; color: var(--fg3); font-size: 12px; height: 36px; padding: 0 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: break-word; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--hover); }
.grid th .sortable, .grid th.sortable { cursor: pointer; user-select: none; }
.grid th .sortable:hover, .grid th.sortable:hover { color: var(--fg); }
.grid th .sorted, .grid th.sorted { color: var(--fg); }
.grid th .sorted::after { content: ' ↓'; color: var(--fg2); }
.grid th .sorted.asc::after { content: ' ↑'; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid th.num { text-align: right; }
.grid th.num, .grid td.num { width: 1%; padding-left: 16px; }
/* The three reputation tables share one column grid, so their numbers line up under each other. */
.rep-table { table-layout: fixed; }
.rep-table th:nth-child(2), .rep-table td:nth-child(2) { width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-table th.num, .rep-table td.num { width: 100px; }
.rep-table th.c-status, .rep-table td.c-status { width: 34px; }
.rep-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid td.c-actions, .grid th.c-actions { position: sticky; right: 0; background: var(--card); }
.grid tbody tr:hover td.c-actions { background: var(--hover); }
.table-wrap.scrolled-x .grid td.c-actions, .table-wrap.scrolled-x .grid th.c-actions { box-shadow: -12px 0 12px -12px rgba(0, 0, 0, .8); }
.c-status { width: 34px; padding-right: 0 !important; }
.c-actions { text-align: right; white-space: nowrap; width: 1%; }
.c-actions > * + * { margin-left: 4px; }
.name { font-weight: 500; }
.grid td .tag { max-width: 150px; }
#profiles-table .name { display: block; max-width: 230px; }
.grid .name { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-type { min-width: 200px; max-width: 300px; }
.c-wrap2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.c-fp { min-width: 120px; max-width: 240px; }
.c-proxy { min-width: 170px; max-width: 225px; }
.c-proxy .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-traffic { white-space: nowrap; }
.c-lines { min-width: 170px; max-width: 260px; }
.c-lines, .c-lines .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-hosts { min-width: 220px; max-width: 420px; }
.c-hosts .host-list { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.host-list { color: var(--fg2); font-size: 12px; max-width: 420px; }
.err { color: var(--bad); font-size: 12px; }
.clamp { max-width: 460px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clickable { cursor: pointer; }
.clickable:hover { text-decoration: underline; text-decoration-color: var(--fg3); text-underline-offset: 3px; }
.empty { padding: 48px 24px; text-align: center; color: var(--fg3); border: 1px dashed var(--line2); border-radius: var(--r-lg); margin-top: 12px; }
.list-foot { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; color: var(--fg3); font-size: 12px; }

/* profile purpose tags */
.c-purpose { max-width: 190px; }
.c-purpose .tags { display: flex; flex-wrap: wrap; gap: 4px; }
.c-purpose .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
tr.is-test .name { color: var(--fg2); font-weight: 400; }
.tag.use { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.tag.acc { color: #a9c7ff; border-color: rgba(122, 167, 255, .3); background: rgba(122, 167, 255, .08); }
.kind svg { width: 12px; height: 12px; margin-right: 5px; flex: none; }

/* expandable rows */
.caret { display: inline-block; width: 10px; color: var(--fg3); transition: transform .12s; }
tr.open .caret { transform: rotate(90deg); }
#patches-table tbody tr.prow, tr.sess.has-hosts { cursor: pointer; }
tr.detail > td, tr.hrow > td { background: var(--inset); }
tr.detail:hover > td, tr.hrow:hover > td { background: var(--inset) !important; }
tr.detail > td { padding: 14px 16px 18px 46px; }
tr.hrow > td { padding: 12px 12px 16px 46px; }
/* What an opened row shows must not resize the table: the box reports no width of its own to the column layout
   and then simply takes the width the table already has. */
.dwrap { contain: inline-size; }
.dwrap .table-wrap { background: var(--card); }
.dwrap .grid tbody tr:hover > td { background: var(--hover) !important; }
tr.frow { cursor: pointer; }
tr.frow.open > td { background: var(--hover); border-bottom-color: transparent; }
.run-head { margin: 0 0 10px; }
.run-list { margin-bottom: 10px; }
.detail-what { color: var(--fg); max-width: 900px; margin-bottom: 4px; }
.detail-meta { color: var(--fg3); font-size: 12px; margin-bottom: 12px; }
.lists { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lists h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; }
.lists ul, tr.hrow ul { margin: 0; padding: 0; list-style: none; }
.lists li { position: relative; padding: 0 0 6px 16px; line-height: 1.45; color: var(--fg2); }
.lists li::before { content: ''; position: absolute; left: 2px; top: 7px; width: 6px; height: 6px; border-radius: 50%; }
.l-ok h4 { color: var(--ok); } .l-ok li::before { background: var(--ok); }
.l-nv h4 { color: var(--warn); } .l-nv li::before { background: var(--warn); }
.l-lim h4 { color: var(--bad); } .l-lim li::before { background: var(--bad); }
.lists .none { color: var(--fg3); padding-left: 0; }
.lists .none::before { display: none; }
tr.hrow ul.mono li { padding: 1px 0; color: var(--fg2); overflow-wrap: anywhere; }
tr.hrow .block-title { margin: 0 0 8px; font-size: 12px; color: var(--fg2); }
.cnt { display: inline-block; min-width: 20px; text-align: center; border-radius: 9px; font-size: 11px; line-height: 18px; margin-left: 4px; font-variant-numeric: tabular-nums; }
.cnt.ok { color: var(--ok); background: var(--ok-bg); } .cnt.nv { color: var(--warn); background: var(--warn-bg); } .cnt.lim { color: var(--bad); background: var(--bad-bg); }
.status-ready { color: var(--ok); }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.two-col .grid td:first-child { white-space: nowrap; font-weight: 500; width: 1%; vertical-align: top; }
.two-col .grid td:last-child { color: var(--fg2); }
.hosts-tbl { width: auto; min-width: 560px; border-collapse: collapse; font-size: 12px; }
.hosts-tbl td, .hosts-tbl th { padding: 3px 12px 3px 0; border: 0 !important; background: none !important; text-align: left; font-weight: normal; height: auto; }
.hosts-tbl th { color: var(--fg3); }
.hosts-tbl .num { text-align: right; width: auto; }
.bar { display: inline-block; height: 5px; background: var(--fg2); border-radius: 3px; vertical-align: middle; opacity: .55; }

/* ---------- status pieces ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3a3a42; vertical-align: middle; }
.dot.running { background: var(--ok); box-shadow: 0 0 0 3px rgba(62, 207, 142, .18); }
.dot.starting { background: var(--warn); animation: pulse 1s infinite; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
@keyframes pulse { 50% { opacity: .3; } }
.tag, .kind, .badge, .pill { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 500; background: var(--muted-bg); color: var(--fg2); border: 1px solid var(--line); white-space: nowrap; vertical-align: middle; max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.tag.warn, .tag.unwired, .badge.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.tag.ok-tag, .badge.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.badge.bad { color: var(--bad); border-color: var(--bad-line); background: var(--bad-bg); }
.badge.muted { color: var(--fg3); }
.tag.src { color: var(--fg3); border: 0; background: none; padding: 0 2px; height: auto; }
.tag.test { color: var(--fg3); background: none; border-style: dashed; border-color: var(--line2); }
.kind.mobile { color: #a9c7ff; border-color: rgba(122, 167, 255, .3); background: rgba(122, 167, 255, .08); }
.pill { border-radius: 10px; }
.flag { font-size: 15px; margin-right: 4px; vertical-align: -1px; }
.ok-txt, .running-txt { color: var(--ok); } .bad-txt, .bad { color: var(--bad); }
.warn-ic, .ipwarn { color: var(--warn); }
.ipwarn { font-size: 12px; }
.kind-system td { color: var(--fg3); }
.warn, .risk { color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); padding: 8px 10px; border-radius: var(--r); font-size: 12px; }
.risk { margin-bottom: 4px; }
.reg-error { padding: 12px 14px; border: 1px solid var(--bad-line); background: var(--bad-bg); color: var(--bad); border-radius: var(--r); margin-bottom: 12px; }
.traffic { white-space: nowrap; font-variant-numeric: tabular-nums; }
.traffic .live { color: var(--ok); }
.traffic .big { color: var(--fg); }
.est { color: var(--fg3); font-size: 11px; }

/* ---------- dialogs: header, scrolling body, footer that stays in view ---------- */
dialog { padding: 0; border: 1px solid var(--line2); border-radius: 12px; background: var(--pop); color: var(--fg); width: min(600px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); box-shadow: var(--shadow); overflow: hidden; }
dialog[open] { display: flex; animation: dlg-in .14s ease-out; }
dialog::backdrop { background: rgba(0, 0, 0, .62); backdrop-filter: blur(2px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
dialog.wide { width: min(1100px, calc(100vw - 32px)); }
dialog.mid { width: min(760px, calc(100vw - 32px)); }
dialog.narrow { width: min(420px, calc(100vw - 32px)); }
dialog > form { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.dlg-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); flex: none; }
.dlg-head h2 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.4; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-head p { margin: 2px 0 0; color: var(--fg2); font-size: 12px; }
.dlg-head > div { flex: 1; min-width: 0; }
.dlg-body { padding: 18px 20px 20px; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.dlg-body > p:first-child { margin-top: 0; }
.dlg-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--inset); flex: none; }
.dlg-foot .form-error { flex: 1; min-width: 0; margin: 0; min-height: 0; }
.form-error { color: var(--bad); font-size: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
/* settings-style dialog: sections on the left, one fixed size so switching a section moves nothing */
dialog.settings { width: min(860px, calc(100vw - 32px)); height: min(660px, calc(100dvh - 48px)); }
.dlg-split { display: flex; flex: 1; min-height: 0; }
.dlg-nav { width: 180px; flex: none; padding: 12px 8px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; background: var(--inset); overflow-y: auto; }
.dlg-nav button { justify-content: flex-start; text-align: left; border: 0; background: none; color: var(--fg2); height: 32px; padding: 0 10px; font-weight: 500; }
.dlg-nav button:hover { background: var(--hover); color: var(--fg); }
.dlg-nav button.on { background: var(--active); color: var(--fg); }
.dlg-sec > h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.dlg-sec > .sec-desc { margin: 0 0 16px; color: var(--fg2); font-size: 12px; }

/* forms */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
.form-grid + .form-grid, .form-sec + .form-grid { margin-top: 14px; }
.form-grid label, dialog label, .field { display: block; color: var(--fg2); font-size: 12px; font-weight: 500; min-width: 0; }
/* label text (and a short note beside it) on the first line, the control under it: fields in one row start level */
label:not(.inline) > input, label:not(.inline) > select, label:not(.inline) > textarea, label:not(.inline) > .row, .field > .row, .field > .seg, label > .hint { display: block; margin-top: 6px; }
label:not(.inline) > .row, .field > .row { display: flex; }
.field > .seg { display: flex; width: fit-content; }
dialog label .muted, .field .muted { font-weight: 400; }
label.inline { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 400; color: var(--fg); }
.span2 { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dlg-body > .row { margin-top: 12px; }
.row > input:not([type=checkbox]):not([type=file]), .row > .grow { flex: 1; min-width: 0; }
.form-grid input:not([type=checkbox]), .form-grid select, .form-grid textarea, .dlg-body > label input { width: 100%; min-width: 0; }
.form-grid .row > select { width: auto; flex: none; max-width: 55%; }
.form-grid .row > button { flex: none; }
.form-sec { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 18px 0 0; color: var(--fg); font-size: 12px; font-weight: 600; }
.form-sec::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-grid > .form-sec { margin-top: 6px; }
.form-grid > .form-sec:first-child, .fp-grid > .fp-sub:first-child { margin-top: 0; }
.hint { font-size: 12px; color: var(--fg3); font-weight: 400; overflow-wrap: anywhere; }
.hint-warn { color: var(--warn); }
.preview { font-size: 12px; color: var(--fg2); padding: 8px 10px; border: 1px dashed var(--line2); border-radius: var(--r); }
.preset-info { font-size: 12px; color: var(--fg2); min-height: 18px; }
.preset-info .cov { color: var(--warn); margin-top: 4px; }
.device-box { display: flex; gap: 10px; align-items: flex-end; }
.device-box .grow { flex: 1; min-width: 0; }
fieldset.fp { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; margin: 0; min-width: 0; }
fieldset.fp legend { color: var(--fg2); font-size: 12px; font-weight: 500; padding: 0 6px; }
.fp-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
.fp-sub { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--fg); font-size: 12px; font-weight: 600; }
.fp-sub::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.file-row { margin: 4px 0; }
.hist-scroll { max-height: 56vh; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
.hist-scroll .grid th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.hist-summary { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12px; color: var(--fg2); }
.hist-summary > span { padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.hist-summary b { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 4px; }
#history-table td { white-space: nowrap; }
.tpl-hosts { max-height: 36vh; margin-top: 12px; }
.confirm-text { color: var(--fg2); white-space: pre-line; line-height: 1.55; }

/* ---------- popover menu ---------- */
.menu { position: fixed; z-index: 60; min-width: 190px; padding: 4px; border: 1px solid var(--line2); border-radius: 8px; background: var(--pop); box-shadow: var(--shadow); animation: dlg-in .1s ease-out; }
.menu button { display: flex; width: 100%; align-items: center; gap: 8px; justify-content: flex-start; border: 0; background: none; height: 30px; padding: 0 10px; font-weight: 400; border-radius: 5px; }
.menu button:hover { background: var(--active); }
.menu button.danger:hover { background: var(--bad-bg); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px -4px; }
.menu .menu-label { padding: 6px 10px 2px; font-size: 11px; color: var(--fg3); }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 70; pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--pop); border: 1px solid var(--line2); padding: 10px 14px; border-radius: 8px; max-width: 460px; font-size: 13px; box-shadow: var(--shadow); animation: dlg-in .14s ease-out; pointer-events: auto; }
.toast::before { content: ''; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--fg3); flex: none; }
.toast.bad::before { background: var(--bad); }
.toast.ok::before { background: var(--ok); }

/* ---------- accounts ---------- */
.favi-wrap { display: inline-flex; width: 16px; height: 16px; vertical-align: middle; flex: 0 0 16px; }
.favi { width: 16px; height: 16px; border-radius: 3px; object-fit: contain; }
.favi-mono { width: 16px; height: 16px; border-radius: 4px; background: var(--muted-bg); border: 1px solid var(--line2); color: var(--fg2); font-size: 10px; font-weight: 600; align-items: center; justify-content: center; display: inline-flex; }
.favi-wrap.broken .favi { display: none; }
.favi-wrap:not(.broken) .favi + .favi-mono { display: none; }
.acc-id { display: flex; align-items: center; gap: 8px; }
/* every pool is its own table: fixed columns keep them in one line down the page */
.acc-table { table-layout: fixed; min-width: 1240px; }
.acc-table col.a-st { width: 34px; } .acc-table col.a-email { width: 350px; } .acc-table col.a-svc { width: 160px; } .acc-table col.a-status { width: 105px; }
.acc-table col.a-files { width: 125px; } .acc-table col.a-added { width: 80px; } .acc-table col.a-act { width: 172px; }
/* Profile, Location and Proxy share what is left */
.acc-table .c-actions { width: auto; }
.acc-table td .pill { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.pool-head .favi-wrap { width: 18px; height: 18px; flex-basis: 18px; }
.pool-head .favi, .pool-head .favi-mono { width: 18px; height: 18px; }

/* ---------- sign-in page ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.login h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.2px; }
.login p { margin: -8px 0 4px; color: var(--fg2); }
.login label { display: flex; flex-direction: column; gap: 6px; color: var(--fg2); font-size: 12px; font-weight: 500; }
.login input, .login button { height: 36px; }

@media (max-width: 1150px) {
  .lists, .two-col { grid-template-columns: minmax(0, 1fr); }
  .toolbar input[type=search] { width: 180px; }
  .hide-md { display: none; }
  .clamp { max-width: 260px; }
  .grid td, .grid th { padding-left: 8px; padding-right: 8px; }
  .ellipsis { max-width: 120px; }
  main, .top { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 720px) {
  .form-grid, .fp-grid { grid-template-columns: minmax(0, 1fr); }
  dialog.settings .dlg-split { flex-direction: column; }
  .dlg-nav { width: auto; flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; overflow-x: auto; }
  .page-head { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
/* platform marks (Cores, Identity) */
.plat { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.plat-ico { display: inline-flex; width: 16px; height: 16px; flex: none; }
.plat-ico svg { width: 16px; height: 16px; display: block; }
.dev-line { display: flex; align-items: center; gap: 6px; white-space: nowrap; margin-bottom: 2px; }
.dev-line .mono { font-size: 12px; }
.dev-sep { color: var(--fg3); }
.c-chrome .mono { font-size: 12px; }
.dev-name { font-weight: 500; margin-bottom: 4px; }
.dev-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 4px; }
.dev-sum { white-space: normal; line-height: 1.45; }
.c-proxy .nowrap { white-space: normal; }
.c-accounts { min-width: 250px; }
.acc-line { display: flex; align-items: flex-start; gap: 7px; cursor: pointer; padding: 1px 0; }
.acc-line .favi-wrap { margin-top: 2px; }
.acc-text { display: flex; flex-direction: column; min-width: 0; }
.acc-line + .acc-line { margin-top: 3px; }
.acc-line:hover .acc-login { color: var(--fg); text-decoration: underline; }
.acc-login { color: var(--fg); font-size: 12px; white-space: nowrap; }
/* icons in tabs and row buttons */
.tab-ico { width: 15px; height: 15px; flex: none; opacity: .75; }
.tab.active .tab-ico { opacity: 1; }
button.sm:not(.icon) > svg { width: 12px; height: 12px; margin-right: 5px; flex: none; vertical-align: -1px; }
button.sm:not(.icon) { display: inline-flex; align-items: center; }
/* until a tab's data is in, its tables keep their place but show nothing (no jumping columns) */
.panel.loading .grid tbody, .panel.loading .empty, .panel.loading .list-foot { visibility: hidden; }
/* profiles: fixed column widths, so data arriving later (accounts, versions) never moves the columns */
#profiles-table { table-layout: fixed; }
#profiles-table td { overflow: hidden; }
#profiles-table .acc-login { display: block; overflow: hidden; text-overflow: ellipsis; }
#profiles-table .acc-text { overflow: hidden; }
/* filters with options filled from data keep one width (no jump when the options arrive) */
#group-filter, #sess-profile, #sess-proxy, #apool { width: 240px; text-overflow: ellipsis; }
.vendor-ico { width: 14px; height: 14px; flex-basis: 14px; margin-right: 6px; vertical-align: -2px; }
.vendor-ico .favi, .vendor-ico .favi-mono { width: 14px; height: 14px; }
.dev-sum .vendor-ico { width: 12px; height: 12px; flex-basis: 12px; margin-right: 4px; }
.dev-sum .vendor-ico .favi, .dev-sum .vendor-ico .favi-mono { width: 12px; height: 12px; }
/* maker icons on a light chip: dark logos (AMD) stay visible on the dark page */
.favi-wrap.vendor-light { background: #f4f4f5; border-radius: 3px; align-items: center; justify-content: center; }
.favi-wrap.vendor-light .favi { width: 10px; height: 10px; border-radius: 0; }
.dev-sum .favi-wrap.vendor-light .favi { width: 8px; height: 8px; }
.vendor-own { display: inline-flex; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.vendor-own svg { width: 100%; height: 100%; display: block; }
.dev-sum .vendor-own { width: 12px; height: 12px; margin-right: 4px; }
/* until a tab's data is in, its tables are not shown at all (they appear once, laid out with the real rows) */
.panel.loading > :not(.page-head) { visibility: hidden; }
/* maker marks a little bigger: wordmarks (intel, arm) need the pixels */
.vendor-own, .vendor-ico { width: 16px !important; height: 16px !important; flex-basis: 16px !important; vertical-align: -3px !important; }
.vendor-ico .favi, .vendor-ico .favi-mono { width: 16px !important; height: 16px !important; }
.dev-sum .vendor-own, .dev-sum .vendor-ico { width: 14px !important; height: 14px !important; flex-basis: 14px !important; vertical-align: -3px !important; }
.dev-sum .vendor-ico .favi, .dev-sum .vendor-ico .favi-mono { width: 14px !important; height: 14px !important; }

/* Releases: the description wraps, the other columns stay on one line */
#releases-table td.rel-desc { white-space: pre-line; min-width: 280px; max-width: 520px; line-height: 1.4; }
