/* ===== Proxy Desk – design tokens ===== */
@font-face { font-family: "Geist"; src: url("/fonts/geist.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/fonts/geist-mono.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  /* one cool neutral family (hue 250) + one accent (teal, hue 195) */
  --bg:        oklch(0.975 0.004 250);
  --surface:   oklch(1 0 0);
  --surface-2: oklch(0.955 0.006 250);
  --line:      oklch(0.905 0.008 250);
  --line-soft: oklch(0.94 0.006 250);
  --text:      oklch(0.23 0.015 250);
  --text-2:    oklch(0.47 0.015 250);
  --text-3:    oklch(0.58 0.012 250);
  --accent:    oklch(0.5 0.095 195);
  --accent-hi: oklch(0.45 0.095 195);
  --accent-fg: oklch(0.99 0.005 195);
  --accent-bg: oklch(0.95 0.03 195);
  --ok:   oklch(0.48 0.12 150);  --ok-bg:   oklch(0.95 0.045 150);
  --warn: oklch(0.5 0.11 70);    --warn-bg: oklch(0.955 0.06 85);
  --bad:  oklch(0.52 0.17 25);   --bad-bg:  oklch(0.95 0.035 25);
  --focus: oklch(0.55 0.13 195);
  --shadow-1: 0 1px 2px oklch(0.3 0.02 250 / 0.06), 0 0 0 1px oklch(0.3 0.02 250 / 0.06);
  --shadow-2: 0 8px 28px oklch(0.25 0.02 250 / 0.14), 0 0 0 1px oklch(0.3 0.02 250 / 0.08);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* type scale */
  --t-xs: 0.75rem; --t-sm: 0.8125rem; --t-base: 0.875rem; --t-md: 1rem; --t-lg: 1.25rem; --t-xl: 1.75rem;
  /* radii: inner 6, controls 8, surfaces 12, dialogs 16 */
  --r-1: 6px; --r-2: 8px; --r-3: 12px; --r-4: 16px;
  /* z scale */
  --z-sticky: 10; --z-header: 20; --z-pop: 30; --z-toast: 40;
  --ease: cubic-bezier(0.2, 0, 0, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:        oklch(0.17 0.008 250);
    --surface:   oklch(0.205 0.009 250);
    --surface-2: oklch(0.245 0.01 250);
    --line:      oklch(0.31 0.012 250);
    --line-soft: oklch(0.265 0.01 250);
    --text:      oklch(0.94 0.006 250);
    --text-2:    oklch(0.74 0.012 250);
    --text-3:    oklch(0.64 0.012 250);
    --accent:    oklch(0.74 0.1 195);
    --accent-hi: oklch(0.8 0.1 195);
    --accent-fg: oklch(0.18 0.02 195);
    --accent-bg: oklch(0.3 0.05 195);
    --ok:   oklch(0.78 0.13 150);  --ok-bg:   oklch(0.3 0.06 150);
    --warn: oklch(0.82 0.12 85);   --warn-bg: oklch(0.32 0.06 80);
    --bad:  oklch(0.75 0.14 25);   --bad-bg:  oklch(0.32 0.07 25);
    --focus: oklch(0.78 0.11 195);
    --shadow-1: 0 0 0 1px oklch(1 0 0 / 0.07);
    --shadow-2: 0 10px 32px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.08);
  }
}
/* chosen in the header: Dark */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        oklch(0.17 0.008 250);
  --surface:   oklch(0.205 0.009 250);
  --surface-2: oklch(0.245 0.01 250);
  --line:      oklch(0.31 0.012 250);
  --line-soft: oklch(0.265 0.01 250);
  --text:      oklch(0.94 0.006 250);
  --text-2:    oklch(0.74 0.012 250);
  --text-3:    oklch(0.64 0.012 250);
  --accent:    oklch(0.74 0.1 195);
  --accent-hi: oklch(0.8 0.1 195);
  --accent-fg: oklch(0.18 0.02 195);
  --accent-bg: oklch(0.3 0.05 195);
  --ok:   oklch(0.78 0.13 150);  --ok-bg:   oklch(0.3 0.06 150);
  --warn: oklch(0.82 0.12 85);   --warn-bg: oklch(0.32 0.06 80);
  --bad:  oklch(0.75 0.14 25);   --bad-bg:  oklch(0.32 0.07 25);
  --focus: oklch(0.78 0.11 195);
  --shadow-1: 0 0 0 1px oklch(1 0 0 / 0.07);
  --shadow-2: 0 10px 32px oklch(0 0 0 / 0.5), 0 0 0 1px oklch(1 0 0 / 0.08);
}

/* ===== base ===== */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); font: 400 var(--t-base)/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; font-weight: 600; }
p { text-wrap: pretty; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); font-size: var(--t-sm); }
.num, .grid td, .kpi-value { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: var(--z-toast); background: var(--surface); padding: 8px 12px; border-radius: var(--r-2); box-shadow: var(--shadow-2); }
.skip:focus { top: 12px; }

/* ===== header ===== */
.top { position: sticky; top: 0; z-index: var(--z-header); background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--line-soft); }
.top-inner { max-width: 1440px; margin: 0 auto; display: flex; align-items: center; gap: 24px; padding: 10px 24px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: var(--t-md); letter-spacing: -0.01em; white-space: nowrap; }
.brand-mark { width: 22px; height: 22px; border-radius: var(--r-1); background: var(--accent); display: grid; place-items: center; }
.brand-mark::after { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--accent-fg); }
.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a { color: var(--text-2); text-decoration: none; padding: 7px 12px; border-radius: var(--r-2); white-space: nowrap; font-weight: 500;
  transition: background-color 150ms var(--ease), color 150ms var(--ease); }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a[aria-current="page"] { color: var(--text); background: var(--surface); box-shadow: var(--shadow-1); }
.me { display: flex; align-items: center; gap: 10px; color: var(--text-2); white-space: nowrap; font-size: var(--t-sm); }
.role { padding: 1px 7px; border-radius: var(--r-1); background: var(--surface-2); color: var(--text); font-size: var(--t-xs); font-weight: 500; }

.banner { max-width: 1440px; margin: 12px auto 0; padding: 0 24px; }
.banner > div { background: var(--warn-bg); color: var(--text); border-radius: var(--r-2); padding: 9px 14px; font-size: var(--t-sm); }
.banner a { color: inherit; font-weight: 600; }

main { max-width: 1440px; margin: 0 auto; padding: 20px 24px 48px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: var(--t-xl); letter-spacing: -0.02em; line-height: 1.15; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
h2.section { font-size: var(--t-md); margin: 28px 0 10px; }

/* ===== buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 12px;
  border: 0; border-radius: var(--r-2); background: var(--surface); box-shadow: var(--shadow-1); color: var(--text); font-weight: 500; cursor: pointer;
  transition: background-color 150ms var(--ease), scale 150ms var(--ease), box-shadow 150ms var(--ease); white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); }
.btn:active:not(:disabled) { scale: 0.96; }
.btn.primary { background: var(--accent); color: var(--accent-fg); box-shadow: none; }
.btn.primary:hover { background: var(--accent-hi); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: none; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.sm { min-height: 28px; padding: 0 9px; font-size: var(--t-sm); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ===== KPI tiles ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--r-3); box-shadow: var(--shadow-1); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
a.kpi { color: inherit; text-decoration: none; transition: box-shadow 150ms var(--ease); }
a.kpi:hover { box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.kpi-label { color: var(--text-2); font-size: var(--t-sm); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi-value { font-size: var(--t-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-sub { color: var(--text-2); font-size: var(--t-sm); }
.kpi-sub b { color: var(--text); font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; display: flex; margin-top: 4px; }
.meter > span { display: block; height: 100%; }
.meter .m-fill { background: var(--accent); }
.meter .m-low { background: var(--bad); }
.meter .m-yes { background: var(--ok); } .meter .m-no { background: var(--text-3); } .meter .m-open { background: var(--warn); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--t-sm); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.syncline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--text-2); font-size: var(--t-sm); }
.syncline .err { color: var(--bad); }

/* attention list */
.panel { background: var(--surface); border-radius: var(--r-3); box-shadow: var(--shadow-1); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-head h2 { font-size: var(--t-md); }
.empty { padding: 28px 16px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ===== filters & bulk bar ===== */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.search { flex: 1 1 260px; min-width: 200px; position: relative; }
.search input { width: 100%; padding-left: 32px; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; color: var(--text-3); pointer-events: none; }
input[type=search], input[type=text], input[type=number], select, textarea {
  min-height: 34px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-2); padding: 6px 10px; }
select { padding-right: 28px; }
input:hover, select:hover, textarea:hover { border-color: color-mix(in oklch, var(--line) 50%, var(--text-3)); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 6px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.bulk { position: sticky; top: 58px; z-index: var(--z-sticky); display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); box-shadow: var(--shadow-2); border-radius: var(--r-3); padding: 8px 10px 8px 14px; margin-bottom: 10px; }
.bulk strong { margin-right: 4px; font-weight: 600; }
.bulk .sep { width: 1px; height: 20px; background: var(--line); margin: 0 2px; }
.meta { color: var(--text-2); font-size: var(--t-sm); margin: 4px 0 8px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ===== tables ===== */
.tablewrap { background: var(--surface); border-radius: var(--r-3); box-shadow: var(--shadow-1); overflow: auto; max-height: calc(100dvh - 250px); }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: var(--t-sm); }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: start; font-weight: 500; color: var(--text-2);
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; white-space: nowrap; }
.grid tbody tr { transition: background-color 120ms var(--ease); }
.grid tbody tr:hover { background: var(--surface-2); }
.grid tbody tr.sel { background: var(--accent-bg); }
.grid .c { width: 40px; padding-inline: 12px 0; }
.grid .c input { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: middle; }
.cell-2 { display: flex; flex-direction: column; gap: 1px; line-height: 1.35; }
.cell-2 .sub { color: var(--text-3); font-size: var(--t-xs); }
.notes { max-width: 260px; white-space: normal; }
.notes .cm { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); }
.pw { font-family: var(--mono); font-size: var(--t-sm); }
.linkbtn { background: none; border: 0; padding: 4px 2px; color: var(--accent); font-weight: 500; cursor: pointer; border-radius: var(--r-1); }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: var(--r-1); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.mut { background: var(--surface-2); color: var(--text-2); }
.tag { display: inline-block; padding: 1px 7px; border-radius: var(--r-1); font-size: var(--t-xs); font-weight: 500; margin: 1px 3px 1px 0;
  background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--tag, var(--accent)); padding-left: 9px; }

/* renew decision segmented control */
.seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface-2); border-radius: var(--r-2); }
.seg button { border: 0; background: none; min-height: 26px; min-width: 40px; padding: 0 9px; border-radius: var(--r-1); font-size: var(--t-xs); font-weight: 600; color: var(--text-2); cursor: pointer;
  transition: background-color 120ms var(--ease), color 120ms var(--ease), scale 120ms var(--ease); }
.seg button:hover { color: var(--text); }
.seg button:active { scale: 0.96; }
.seg button[aria-pressed="true"][data-v="yes"] { background: var(--ok-bg); color: var(--ok); box-shadow: var(--shadow-1); }
.seg button[aria-pressed="true"][data-v="no"] { background: var(--bad-bg); color: var(--bad); box-shadow: var(--shadow-1); }

/* skeleton */
.sk { display: block; height: 12px; border-radius: 4px; background: var(--surface-2); }
@media (prefers-reduced-motion: no-preference) {
  .sk { animation: pulse 1.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.45; } }
}

/* ===== dialogs ===== */
dialog { border: 0; border-radius: var(--r-4); background: var(--surface); color: var(--text); padding: 0; width: min(540px, calc(100vw - 32px)); box-shadow: var(--shadow-2); overscroll-behavior: contain; }
dialog::backdrop { background: oklch(0.2 0.02 250 / 0.45); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
dialog h3 { font-size: var(--t-md); }
dialog .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
dialog textarea { width: 100%; min-height: 220px; font-family: var(--mono); font-size: var(--t-sm); }
dialog .hint { color: var(--text-2); font-size: var(--t-sm); margin: 0; }
dialog .taglist { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; }
dialog .taglist .row { justify-content: space-between; }
dialog .field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
dialog .price { background: var(--surface-2); border-radius: var(--r-2); padding: 10px 12px; font-size: var(--t-sm); }
dialog .price b { font-size: var(--t-md); }
.radios { display: flex; gap: 8px; }
.radios label { flex: 1; display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-radius: var(--r-2); box-shadow: var(--shadow-1); cursor: pointer; }
.radios label:has(input:checked) { box-shadow: 0 0 0 2px var(--accent); }
.radios input { accent-color: var(--accent); }

/* ===== settings ===== */
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 12px; }
.sform { display: flex; flex-direction: column; gap: 12px; }
.sform label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sform input[type=number] { width: 100px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== toast ===== */
.toast { position: fixed; bottom: max(20px, env(safe-area-inset-bottom)); left: 50%; translate: -50% 0; z-index: var(--z-toast);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--r-2); font-size: var(--t-sm); width: max-content; max-width: min(560px, 90vw); box-shadow: var(--shadow-2); }
.toast.err { background: var(--bad); color: oklch(0.99 0 0); }
.toast:empty { display: none; }

/* ===== login ===== */
body.login { display: grid; place-items: center; padding: 16px; }
.loginbox { background: var(--surface); box-shadow: var(--shadow-2); border-radius: var(--r-4); padding: 32px 28px 26px; width: min(380px, 100%);
  display: flex; flex-direction: column; gap: 14px; align-items: center; text-align: center; }
.loginbox .brand { font-size: var(--t-lg); }
.loginbox .hint { color: var(--text-2); margin: 0; }
.loginbox .small { font-size: var(--t-xs); }
.loginerr { margin: 0; padding: 8px 12px; border-radius: var(--r-2); background: var(--bad-bg); color: var(--bad); font-size: var(--t-sm); }

@media (max-width: 760px) {
  .top-inner { flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px; }
  .tabs { order: 3; flex-basis: 100%; }
  main { padding: 16px 16px 40px; }
  .banner { padding: 0 16px; }
  .bulk { top: 100px; }
  input, select, textarea { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; }
}

/* utility */
.pad { padding: 16px; }
.sk.w40 { width: 40%; } .sk.w60 { width: 60%; } .sk.tall { height: 24px; }
.panel-foot { padding: 8px 12px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; }
.panel .grid th { position: static; }
/* hidden must always win over component display rules (bulk bar, admin-only buttons) */
[hidden] { display: none !important; }
.search input[type=search] { padding-left: 34px; }
.sform label.field { flex-direction: column; align-items: stretch; justify-content: flex-start; }

.tablewrap.flat { box-shadow: none; border-radius: 0; max-height: 520px; }
.price.warn { background: var(--warn-bg); }
.price.bad { background: var(--bad-bg); color: var(--text); }
.price dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.price dt { color: var(--text-2); }
.price dd { margin: 0; font-variant-numeric: tabular-nums; }
.sform .radios label, .sform label.check { justify-content: flex-start; }
.price { background: var(--surface-2); border-radius: var(--r-2); padding: 10px 12px; font-size: var(--t-sm); }
.price b { font-size: var(--t-md); }
.price .hint { color: var(--text-2); font-size: var(--t-sm); margin: 6px 0 0; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
@media (max-width: 1000px) { .me > span:first-child { display: none; } .top-inner { gap: 16px; } }

.grid tr.inactive td { color: var(--text-3); }
.grid tr.inactive .cell-2 > span:first-child { text-decoration: line-through; text-decoration-color: var(--text-3); }
.invite { width: 100%; min-height: 150px; font-family: var(--font); font-size: var(--t-sm); }

.grid .row-btns { flex-wrap: nowrap; gap: 6px; }
.cell-2.gap { gap: 4px; }

.approvals { margin-bottom: 14px; box-shadow: 0 0 0 1px var(--bad), var(--shadow-1); }
.approval-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.approval-row:first-of-type { border-top: 0; }

/* login box: always centred (main's page margins must not apply here) */
main.loginbox { margin: auto; max-width: none; }

/* theme switch */
.theme-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; }
.theme-btn svg { width: 18px; height: 18px; }
/* paste IPs */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 99px; background: var(--accent-bg); color: var(--text); font-size: var(--t-sm); }
.chip button { min-height: 24px; }
dialog textarea.paste { min-height: 200px; }
.result-ok { color: var(--ok); font-weight: 600; }
.result-miss { color: var(--warn); font-weight: 600; }

/* specialists only see their own items: the owner column is always them */
body.role-operator .col-owner { display: none; }
/* executives working for several specialists: show whose it is (desktop; phones use the Owner filter) */
@media (min-width: 761px) { body.role-operator.show-owner .col-owner { display: table-cell; } }
dialog .works-for { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
dialog .works-for legend { font-weight: 500; margin-bottom: 6px; padding: 0; }
dialog .works-for .wf-list { display: flex; flex-wrap: wrap; gap: 2px 14px; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; }
dialog .works-for .wf-list label[hidden] { display: none; }
.warn-text { color: var(--warn); }

.toolbar .f-search { width: 170px; }
.act-search { flex: 0 1 360px; }
@media (max-width: 760px) { .toolbar .f-search { width: calc(50% - 4px); } .act-search { flex-basis: 100%; } }

.pill.fresh { background: var(--bad); color: oklch(0.99 0 0); margin-left: 6px; vertical-align: 1px; font-variant-numeric: tabular-nums; }
.pill.st { margin-left: 6px; vertical-align: 1px; white-space: nowrap; }
.pill.reused { background: var(--warn-bg); color: var(--warn); margin-left: 6px; vertical-align: 1px; white-space: nowrap; }

/* tag manager */
.tag-new { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line-soft); }
.tag-new input[type=text] { flex: 1 1 220px; }
input[type=color] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface); cursor: pointer; }
#tag-table input[type=text] { width: 100%; max-width: 280px; }
/* inline note editing */
.note-edit { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-left: 4px; padding: 0; border: 0; background: none;
  color: var(--text-3); border-radius: var(--r-1); cursor: pointer; vertical-align: middle; }
.note-edit:hover { color: var(--text); background: var(--surface-2); }
.note-edit svg { width: 14px; height: 14px; }
.note-input { width: 100%; min-width: 200px; }

.fb { max-width: 230px; overflow: hidden; text-overflow: ellipsis; }
.fb .email { font-size: var(--t-sm); }
.fb-input { width: 100%; min-width: 210px; }

/* ===== spinners (B) ===== */
@keyframes spin { to { rotate: 360deg; } }
.btn.busy, .linkbtn.busy, .seg button.busy { pointer-events: none; }
.btn.busy::before, .linkbtn.busy::before, .seg button.busy::before, .spinner {
  content: ""; display: inline-block; width: 12px; height: 12px; flex: none; border-radius: 50%;
  border: 2px solid color-mix(in oklch, currentColor 25%, transparent); border-top-color: currentColor;
  animation: spin 0.7s linear infinite; vertical-align: -2px; margin-right: 6px; }
.seg button.busy::before { margin-right: 4px; }
.delivery { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r-2); background: var(--surface-2); font-size: var(--t-sm); }
.delivery.ok { background: var(--ok-bg); }
.delivery.warn { background: var(--warn-bg); }
.more-row td { text-align: center; padding: 10px; }
.btn.copied { color: var(--ok); }

/* ===== motion (C). Short, subtle, transform/opacity only. Off for "reduce motion". ===== */
@keyframes fade-in { from { opacity: 0; } }
@keyframes dlg-in { from { opacity: 0; scale: 0.97; translate: 0 6px; } }
@keyframes dlg-out { to { opacity: 0; scale: 0.98; translate: 0 4px; } }
@keyframes bar-in { from { opacity: 0; translate: 0 -6px; } }
@keyframes pop-in { from { opacity: 0; scale: 0.96; translate: 0 -4px; } }
@keyframes row-flash { from { background: color-mix(in oklch, var(--accent) 22%, transparent); } }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: dlg-in 170ms var(--ease); }
  dialog[open]::backdrop { animation: fade-in 170ms var(--ease); }
  dialog.closing { animation: dlg-out 140ms var(--ease) forwards; }
  dialog.closing::backdrop { opacity: 0; transition: opacity 140ms var(--ease); }
  .bulk:not([hidden]) { animation: bar-in 180ms var(--ease); }
  .tab:not([hidden]) { animation: fade-in 160ms var(--ease); }
  .menu:not([hidden]) { animation: pop-in 140ms var(--ease); }
  .more-filters:not([hidden]) { animation: bar-in 160ms var(--ease); }
  .grid tbody tr.flash { animation: row-flash 1.2s ease-out; }
  .delivery { animation: fade-in 200ms var(--ease); }
}
/* toast: slide up + fade */
.toast, .toast:empty { display: block; opacity: 0; translate: -50% 10px; pointer-events: none;
  transition: opacity 180ms var(--ease), translate 180ms var(--ease); }
.toast.show { opacity: 1; translate: -50% 0; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .toast, .toast:empty { transition: none; } }

/* sortable headers (D14) */
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; border-radius: var(--r-1); padding: 2px 4px; margin: -2px -4px; }
.th-sort:hover { color: var(--text); }
.th-sort:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
th[aria-sort] .th-sort { color: var(--text); }
th[aria-sort="ascending"] .th-sort::after { content: "↑"; font-size: 11px; }
th[aria-sort="descending"] .th-sort::after { content: "↓"; font-size: 11px; }

/* filter bar (D15) */
.more-filters { margin-top: -2px; padding: 8px; background: var(--surface); border-radius: var(--r-2); box-shadow: var(--shadow-1); }
#f-more.active { box-shadow: 0 0 0 1.5px var(--accent); }

/* More ▾ menu (D16) */
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: var(--z-header); min-width: 170px; padding: 4px;
  background: var(--surface); border-radius: var(--r-3); box-shadow: var(--shadow-2); display: flex; flex-direction: column; }
.menu [role=menuitem] { all: unset; padding: 8px 10px; border-radius: var(--r-2); cursor: pointer; font-size: var(--t-sm); }
.menu [role=menuitem]:hover, .menu [role=menuitem]:focus-visible { background: var(--surface-2); }
.menu [role=menuitem]:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* confirm window (D17) */
dialog.confirm { width: min(420px, calc(100vw - 32px)); }
.btn.danger-solid { background: var(--bad); color: oklch(0.99 0 0); box-shadow: none; }
.btn.danger-solid:hover { filter: brightness(1.08); }

/* ===================== phones (≤ 640px) ===================== */
.mobile-only { display: none !important; }
@media (max-width: 640px) {
  .mobile-only { display: inline-flex !important; }
  body { font-size: 15px; }
  main { padding: 12px 12px 96px; }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 1.45rem; }

  /* header: brand + account on one line, tabs scroll sideways with a fade hinting there is more */
  .top-inner { padding: 8px 12px 0; gap: 6px 10px; }
  .me { gap: 6px; }
  .tabs { margin: 0 -12px; padding: 0 12px 8px; scroll-snap-type: x proximity;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent); }
  .tabs a { scroll-snap-align: center; padding: 8px 12px; }

  /* overview tiles: two per row */
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 12px; gap: 4px; }
  .kpi-value { font-size: 1.3rem; }
  .kpi-label, .kpi-sub, .legend { font-size: 12px; }
  .syncline { width: 100%; }

  /* filters fold away behind "Filters" */
  .toolbar .search { flex-basis: calc(100% - 96px); }
  #tab-proxies:not(.show-filters) .toolbar > :not(.search):not(#f-toggle),
  #tab-proxies:not(.show-filters) .more-filters { display: none !important; }
  #f-toggle.active { box-shadow: 0 0 0 1.5px var(--accent); }
  .toolbar select, .toolbar .f-search { flex: 1 1 calc(50% - 4px); width: auto; min-width: 0; }
  .meta { justify-content: space-between; }
  .m-tools { gap: 8px; align-items: center; }
  .m-tools select { min-height: 32px; padding: 4px 26px 4px 8px; font-size: 14px; }

  /* tables scroll with the page (no box-in-a-box scrolling) */
  .tablewrap { max-height: none; overflow: visible; background: none; box-shadow: none; }

  /* proxy table → cards */
  #p-table thead { display: none; }
  #p-table, #p-table tbody { display: block; }
  #p-table tbody tr[data-k] { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto;
    grid-template-areas: "chk proxy exp" "chk login pass" "chk fb fb" "chk keep copy" "chk owner arenew" "chk notes notes";
    gap: 8px 10px; padding: 12px; margin-bottom: 8px; background: var(--surface); border-radius: var(--r-3); box-shadow: var(--shadow-1); }
  #p-table tbody tr[data-k].sel { background: var(--accent-bg); }
  #p-table td { padding: 0; border: 0; white-space: normal; min-width: 0; }
  #p-table td:nth-child(1) { grid-area: chk; padding-top: 2px; }
  #p-table td:nth-child(2) { grid-area: proxy; }
  #p-table td:nth-child(3) { grid-area: login; }
  #p-table td:nth-child(4) { grid-area: pass; text-align: right; }
  #p-table td:nth-child(5) { grid-area: fb; }
  #p-table td:nth-child(6) { grid-area: exp; text-align: right; }
  #p-table td:nth-child(6) .cell-2 { align-items: flex-end; }
  #p-table td:nth-child(7) { grid-area: keep; }
  #p-table td:nth-child(8) { grid-area: owner; }
  #p-table td:nth-child(9) { grid-area: arenew; text-align: right; }
  #p-table td:nth-child(10) { grid-area: notes; }
  #p-table td:nth-child(11) { grid-area: copy; text-align: right; }
  #p-table td:is(:nth-child(3), :nth-child(4), :nth-child(5), :nth-child(8), :nth-child(9))::before {
    content: attr(data-label); display: block; font-size: 11px; color: var(--text-3); margin-bottom: 1px; }
  #p-table td.notes:not(:has(.cm, .tag)) .note-edit::after { content: " Add note"; font-size: 12px; }
  #p-table td.notes .note-edit { width: auto; padding: 0 6px; }
  #p-table .seg button { min-height: 34px; min-width: 56px; font-size: 13px; }
  #p-table .act-copy { min-height: 34px; padding: 0 14px; }
  #p-table .rowchk { width: 20px; height: 20px; }
  #p-table .fb { max-width: none; }
  #p-table tr.more-row, #p-table tr:not([data-k]) { display: block; }
  #p-table tr.more-row td, #p-table tr:not([data-k]) td { display: block; }
  body.role-operator #p-table tbody tr[data-k] { grid-template-areas: "chk proxy exp" "chk login pass" "chk fb fb" "chk keep copy" "chk arenew arenew" "chk notes notes"; }

  /* other tables → stacked cards with labels */
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: block; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); border-radius: var(--r-3); box-shadow: var(--shadow-1); }
  .panel table.stack tr { box-shadow: none; margin: 0; border-radius: 0; border-bottom: 1px solid var(--line-soft); }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; white-space: normal; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; text-align: left; flex: none; }
  table.stack td:not([data-label])::before, table.stack td[data-label=""]::before { content: none; }
  table.stack td[colspan] { display: block; text-align: center; }
  table.stack td .cell-2 { align-items: flex-end; }
  table.stack td.notes { max-width: none; }
  table.stack .row-btns { justify-content: flex-end; flex-wrap: wrap; }
  .grid tbody tr:hover { background: inherit; }

  /* selection bar → fixed bottom bar within thumb reach */
  .bulk { position: fixed; top: auto; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); z-index: var(--z-header);
    flex-wrap: nowrap; overflow-x: auto; padding: 8px; gap: 6px; margin: 0; scrollbar-width: none; }
  .bulk strong { white-space: nowrap; }
  .bulk .btn { min-height: 38px; }
  .bulk .sep, .bulk > .muted { display: none; }
  .menu { top: auto; bottom: calc(100% + 8px); position: fixed; left: auto; right: 16px; bottom: 76px; }
  body.has-bulk .toast { bottom: 84px; }
  @media (prefers-reduced-motion: no-preference) { .bulk:not([hidden]) { animation: sheet-in 200ms var(--ease); } }

  /* dialogs → bottom sheets */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 92dvh; overflow-y: auto; }
  dialog form { padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
  dialog .actions { flex-wrap: wrap; }
  dialog .actions .btn { flex: 1 1 auto; min-height: 42px; }
  @media (prefers-reduced-motion: no-preference) {
    dialog[open] { animation: sheet-in 200ms var(--ease); }
    dialog.closing { animation: sheet-out 160ms var(--ease) forwards; }
  }

  /* forms: bigger targets */
  .radios { flex-direction: column; }
  .btn { min-height: 38px; }
  .two { grid-template-columns: 1fr; }
  .sform label:not(.field):not(.check) { flex-direction: column; align-items: stretch; }
  .sform input[type=number] { width: 100%; }
  .approval-row .row-btns .btn { flex: 1; }
}
@keyframes sheet-in { from { translate: 0 24px; opacity: 0; } }
@keyframes sheet-out { to { translate: 0 24px; opacity: 0; } }

@media (max-width: 640px) {
  #p-table td.notes { text-align: left; }
  #attn table.stack td:first-child { justify-content: flex-start; text-align: left; }
  #attn table.stack td:first-child::before { content: none; }
}
@media (max-width: 640px) { #attn table.stack td:first-child .cell-2 { align-items: flex-start; } }

/* phones: radio cards stay in a row, and every tap target is thumb-sized */
@media (max-width: 640px) {
  .sform .radios label:not(.field):not(.check) { flex-direction: row; align-items: center; min-height: 44px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; flex: none; }
  label.check { min-height: 36px; align-items: center; }
  .linkbtn { min-height: 36px; padding: 6px 8px; }
  .note-edit { width: 36px; height: 36px; }
  #p-table td.notes .note-edit, .note-edit { min-height: 36px; min-width: 36px; }
  .seg button { min-height: 34px; min-width: 52px; font-size: 13px; }
  .m-tools label { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
}

#s-bot .pill { white-space: normal; }
@media (max-width: 640px) { #p-table td.notes .note-edit { display: inline-flex; align-items: center; gap: 4px; } }

/* Buy: order form on the left, the wider history table on the right */
@media (min-width: 900px) { #tab-buy .two { grid-template-columns: minmax(360px, 5fr) minmax(0, 7fr); align-items: start; } }

/* Needs attention header with the Renew-Keep shortcut */
.section-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 10px; }
.section-row h2.section { margin: 0; }

/* quick filters: one-click presets above the proxy list */
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; }
.qchip { display: inline-flex; align-items: center; gap: 7px; min-height: 30px; padding: 0 6px 0 12px; border: 0; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-1); color: var(--text-2); font: inherit; font-size: var(--t-sm); font-weight: 500; cursor: pointer;
  transition-property: background-color, color, box-shadow; transition-duration: 150ms; }
.qchip:hover:not(:disabled) { color: var(--text); }
.qchip:active:not(:disabled) { scale: 0.96; }
.qchip:disabled { opacity: 0.45; cursor: default; }
.qchip .qn { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: var(--t-xs); font-weight: 600;
  font-variant-numeric: tabular-nums; text-align: center; }
.qchip[aria-pressed="true"] { background: var(--accent-bg); color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent); }
.qchip[aria-pressed="true"] .qn { background: var(--accent); color: var(--surface); }
.qchip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 640px) {
  .quick { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 10px; padding: 2px 12px 4px; scrollbar-width: none;
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 28px), transparent); }
  .quick::-webkit-scrollbar { display: none; }
  .qchip { flex: none; min-height: 36px; }
  .section-row { margin-top: 22px; }
}

/* 10. KPI cards fill one row on desktop; Auto-renew lives in the Balance card */
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }
.kpi-link { align-self: flex-start; margin-top: 2px; padding: 2px 0; border: 0; background: none; font: inherit; font-size: var(--t-sm);
  color: var(--text-2); cursor: pointer; text-align: left; }
.kpi-link b { color: var(--accent); font-weight: 600; }
.kpi-link:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* 12. Residential row buttons line up on the right */
#r-table td:last-child .row-btns { justify-content: flex-end; }

/* 13. Settings panels size to their content instead of stretching */
#tab-settings .two { align-items: start; }

/* 14. Activity filters */
#a-filters { margin-bottom: 4px; }
#a-filters select { width: auto; min-width: 150px; }
.a-date { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--text-2); }
.a-date input { width: auto; }
#a-csv { margin-left: auto; }

/* 15. operators with no notes or tags: no empty Notes column */
body.no-notes .col-notes { display: none !important; }

@media (max-width: 640px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  #a-filters select, .a-date { flex: 1 1 calc(50% - 4px); min-width: 0; }
  .a-date input { flex: 1; min-width: 0; }
  #a-csv { margin-left: 0; flex: 1 1 calc(50% - 4px); }
  #a-reset { flex: 1 1 calc(50% - 4px); }
}

/* Team: alerts state as a small secondary line under the status pill */
.alert-line { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--text-2); }
.alert-line .dot { width: 6px; height: 6px; }
.alert-line.warn { color: var(--warn); }

/* Residential list filters */
#r-filters .search { flex: 1 1 280px; }
#r-filters select { width: auto; min-width: 140px; }
@media (max-width: 640px) {
  #r-filters .search { flex-basis: 100%; }
  #r-filters select { flex: 1 1 calc(50% - 4px); min-width: 0; }
}

/* Residential: selected rows + checkbox placement on phone cards */
#r-table tbody tr.sel { background: var(--accent-bg); }
@media (max-width: 640px) {
  #r-table tbody tr:has(> td.c) { position: relative; padding-left: 48px; }
  #r-table td.c { position: absolute; left: 14px; top: 14px; padding: 0; width: auto; display: block; }
  #r-table td.c input { width: 20px; height: 20px; }
  #tab-resident .meta { justify-content: space-between; }
}

/* role-hidden items must stay hidden even when they are mobile-only */
.mobile-only[hidden] { display: none !important; }

/* Spending page */
.sp-periods button { min-height: 32px; padding: 0 12px; font-size: var(--t-sm); }
.sp-periods button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.sp-custom { display: inline-flex; gap: 8px; flex-wrap: wrap; }
#sp-csv { margin-left: auto; }
.sp-share { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.sp-share .meter { flex: 1; margin: 0; min-width: 60px; }
.sp-total { margin: 0 0 8px; color: var(--text-2); }
.sp-total b { color: var(--text); font-size: 1.25rem; }
.sp-detail { max-height: 55vh; overflow: auto; }
.sp-owns { align-items: flex-end; }
#tab-spending .kpis { margin-bottom: 4px; }
@media (max-width: 640px) {
  .sp-periods { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .sp-periods button { flex: 1 0 auto; min-height: 36px; }
  .sp-custom { width: 100%; }
  .sp-custom .a-date { flex: 1 1 calc(50% - 4px); }
  #sp-csv { margin-left: 0; width: 100%; }
  .sp-share { justify-content: flex-end; }
  .sp-share .meter { max-width: 120px; }
  .sp-detail { max-height: none; }
}
/* the spending detail needs room for five columns on desktop */
@media (min-width: 641px) { dialog:has(#sp-items) { width: min(820px, calc(100% - 32px)); max-width: none; } .sp-detail { overflow-x: visible; } }
@media (max-width: 640px) { .sp-periods { mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent); } }

/* Expired tab */
.p-exp-link { font-size: var(--t-sm); color: var(--accent); text-decoration: none; }
.p-exp-link:hover { text-decoration: underline; text-underline-offset: 3px; }
#e-table tbody tr.sel { background: var(--accent-bg); }
#e-table .fb { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#e-filters select { width: auto; min-width: 130px; }
#e-filters .search { flex: 1 1 280px; }
@media (max-width: 640px) {
  #e-filters .search { flex-basis: 100%; }
  #e-filters select { flex: 1 1 calc(50% - 4px); min-width: 0; }
  #e-table tbody tr:has(> td.c) { position: relative; padding-left: 48px; }
  #e-table td.c { position: absolute; left: 14px; top: 14px; padding: 0; width: auto; display: block; }
  #e-table td.c input { width: 20px; height: 20px; }
  #e-table .fb { max-width: none; }
  #tab-expired .meta { justify-content: space-between; }
}
#e-table td .cell-2 .pill { align-self: flex-start; }
@media (max-width: 640px) { #e-table td .cell-2 .pill { align-self: flex-end; } }

/* "+ Buy proxies" in the header (admins) */
.buy-btn { white-space: nowrap; margin-right: 4px; }
.buy-btn .buy-short { display: none; }

/* Buy pop-up */
.buy-dlg { width: min(560px, calc(100vw - 32px)); max-height: 92dvh; overflow-y: auto; }
.buy-dlg .buy-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.buy-dlg .buy-head h3 { margin: 0; flex: 1 1 auto; }
.buy-dlg .buy-head .syncline { order: 3; flex-basis: 100%; font-size: var(--t-sm); }
.buy-dlg .buy-x { min-width: 36px; }
.buy-dlg form { padding-top: 14px; }
.buy-dlg .row-btns { justify-content: flex-end; }

/* toast with an action button (e.g. "Show them") */
.toast.has-action { display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.toast.has-action .btn.ghost { color: inherit; }
.toast.has-action .btn { flex: none; white-space: nowrap; }
.paste-lines { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.paste-lines:empty { display: none; }
.paste-exp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }

@media (max-width: 640px) {
  .buy-btn .buy-long { display: none; }
  .buy-btn .buy-short { display: inline; }
  .buy-btn { min-height: 34px; padding: 0 12px; }
  #me .me-name { display: none; }
  .buy-dlg { width: 100%; }
  .buy-dlg .buy-head { padding: 16px 16px 0; }
  .buy-dlg .row-btns .btn { flex: 1; min-height: 44px; }
}
.buy-dlg:focus { outline: none; }
@media (max-width: 640px) {
  /* admins: the Buy button already shows the role, so keep the phone header on one line */
  #me:has(.buy-btn) .role { display: none; }
}

/* New / edit residential list */
dialog .two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
dialog .two-col select:disabled { opacity: 0.55; }
dialog .tagpick { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
dialog .tagpick legend { font-weight: 500; margin-bottom: 6px; padding: 0; }
dialog .hint.err { color: var(--bad); }
.relogin { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 12px; border-radius: var(--r-2); background: var(--warn-bg); color: var(--text); font-size: var(--t-sm); }
.relogin span { flex: 1; }
dialog .edit-actions { align-items: center; }
dialog .edit-actions .spacer { flex: 1; }
#r-new { white-space: nowrap; }
@media (max-width: 640px) {
  dialog .two-col { grid-template-columns: 1fr; }
  dialog .edit-actions .spacer { display: none; }
  dialog .edit-actions #el-del { order: 3; flex-basis: 100%; }
}

/* Team search */
#t-filters .search { flex: 1 1 280px; }
#t-filters select { width: auto; min-width: 130px; }
@media (max-width: 640px) {
  #t-filters .search { flex-basis: 100%; }
  #t-filters select { flex: 1 1 calc(50% - 4px); min-width: 0; }
}

/* ===== searchable picker (enhancePick) ===== */
.pick { position: relative; display: block; min-width: 0; font-weight: 400; }
.pick > input { width: 100%; }
.pick:not(.pick-list) > input:not([type=search]) { padding-right: 30px; text-overflow: ellipsis; cursor: pointer; }
.pick:not(.pick-list) > input:focus { cursor: text; }
.pick-src { display: none !important; }
.pick-chev { position: absolute; right: 9px; top: 10px; color: var(--text-3); pointer-events: auto; cursor: pointer; transform-box: fill-box; transform-origin: center; transition: rotate 150ms var(--ease); }
.pick.open .pick-chev { rotate: 180deg; }
.pick > input:disabled { opacity: 0.55; cursor: not-allowed; }
.pick > input:disabled ~ .pick-chev { opacity: 0.55; }
.pick-pop { position: absolute; left: 0; top: calc(100% + 4px); z-index: var(--z-pop); min-width: 100%; width: max-content; max-width: min(360px, calc(100vw - 32px));
  max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding: 4px; background: var(--surface); border-radius: var(--r-3); box-shadow: var(--shadow-2); }
.pick-pop.pick-right { left: auto; right: 0; }
.pick-opt { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 6px 10px 6px 8px; border-radius: var(--r-2); cursor: pointer; }
.pick-opt.active { background: var(--surface-2); }
.pick-opt.sel { color: var(--accent); font-weight: 500; }
.pick-check { flex: none; visibility: hidden; }
.pick-opt.sel .pick-check { visibility: visible; }
.pick-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-label mark { background: none; color: inherit; font-weight: 650; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.uname, .pick-sub { color: var(--text-3); font-size: var(--t-xs); font-weight: 400; }
.pick-opt.sel .pick-sub { color: inherit; opacity: 0.75; }
.pick-meta { flex: none; color: var(--text-3); font-size: var(--t-xs); font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pick-tag { flex: none; font-size: var(--t-xs); font-weight: 500; color: var(--accent); background: var(--accent-bg); border-radius: 99px; padding: 1px 8px; }
.pick-group { padding: 10px 10px 4px; font-size: var(--t-xs); font-weight: 500; color: var(--text-3); }
.pick-group:first-child { padding-top: 4px; }
.pick-empty, .pick-more { padding: 10px; color: var(--text-2); font-size: var(--t-sm); }
.pick-more { border-top: 1px solid var(--line-soft); margin-top: 4px; }
/* inside windows the list opens in place and pushes the rest down (windows scroll, they don't overflow) */
dialog .pick-pop { position: relative; top: auto; left: auto; width: auto; max-width: none; margin-top: 4px; max-height: 240px;
  box-shadow: none; border: 1px solid var(--line); }
/* always-open list (owner window) */
.pick-list > input { padding-left: 34px; }
.pick-glass { position: absolute; left: 11px; top: 9px; color: var(--text-3); pointer-events: none; }
.pick-list .pick-pop { position: relative; top: auto; width: auto; max-width: none; margin-top: 8px; max-height: min(340px, 46dvh);
  box-shadow: none; border: 1px solid var(--line); }
/* filter bars */
.toolbar .pick { width: 140px; flex: none; }
.toolbar .pick.pick-free { width: 170px; }
.toolbar .pick > input { width: 100%; }
@media (max-width: 760px) {
  .toolbar .pick { flex: 1 1 calc(50% - 4px); width: auto; }
  .pick-opt { min-height: 42px; }
  .pick-chev { top: 11px; }
  dialog .pick-pop { max-height: 38dvh; }
}
