/* =====================================================================
   Android Master Tool - "Carbon Forge" design tokens + shared elements.
   Single source of truth for web colors/spacing. Desktop mirrors this in
   desktop/AndroidMasterTool/Core/AppTheme.cs.
   ===================================================================== */

/* Self-hosted Roboto (variable) - no external font CDN, CSP stays 'self'. */
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/roboto-latin-ext-var.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Roboto";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/roboto-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

html[data-theme="dark"],
html:not([data-theme]) {
  --bg: #0B0F14;
  --bg-2: #0F141B;
  --surface: #12181F;
  --surface-2: #161E27;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #E6EDF3;
  --muted: #8B98A5;
  --accent: #3DF2B1;
  --accent-2: #4DA3FF;
  --accent-ink: #05281D;
  --danger: #FF6B6B;
  --warn: #FFB454;
  --glow: 0 0 0 4px rgba(61, 242, 177, 0.16);
  --shadow-card: 0 18px 50px rgba(0, 0, 0, 0.45);
  --grid-line: rgba(255, 255, 255, 0.028);
  --glow-a: rgba(61, 242, 177, 0.07);
  --glow-b: rgba(77, 163, 255, 0.06);
  --btn-bg: #18212B;
  --btn-bg-hover: #1E2936;
  --input-bg: #0E141B;
  --ok-bg: rgba(61, 242, 177, 0.09);
  --ok-fg: #7CF5C9;
  --err-bg: rgba(255, 107, 107, 0.10);
  --err-fg: #FFB0B0;
  --info-bg: rgba(77, 163, 255, 0.10);
  --info-fg: #A9D1FF;
}

html[data-theme="light"] {
  --bg: #F4F7F9;
  --bg-2: #EAF0F4;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --border: rgba(15, 35, 50, 0.10);
  --border-strong: rgba(15, 35, 50, 0.20);
  --text: #14202B;
  --muted: #5C6B7A;
  --accent: #0E9F6E;
  --accent-2: #1F6FEB;
  --accent-ink: #FFFFFF;
  --danger: #D64545;
  --warn: #B7791F;
  --glow: 0 0 0 4px rgba(14, 159, 110, 0.18);
  --shadow-card: 0 12px 34px rgba(18, 32, 43, 0.10);
  --grid-line: rgba(15, 35, 50, 0.04);
  --glow-a: rgba(14, 159, 110, 0.07);
  --glow-b: rgba(31, 111, 235, 0.06);
  --btn-bg: #EDF2F6;
  --btn-bg-hover: #E2EAF0;
  --input-bg: #FFFFFF;
  --ok-bg: rgba(14, 159, 110, 0.10);
  --ok-fg: #0B7A54;
  --err-bg: rgba(214, 69, 69, 0.10);
  --err-fg: #B03030;
  --info-bg: rgba(31, 111, 235, 0.10);
  --info-fg: #1F5FCC;
}

:root {
  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-sm: 14px;
  --font: "Roboto", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }

/* Data labels keep tabular digits for alignment, but use Roboto (no mono). */
.mono { font-family: var(--font); font-size: .9em; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.volt { color: var(--accent); }
.i { vertical-align: -3px; }
code { font-family: var(--font); font-size: .9em; font-variant-numeric: tabular-nums; background: var(--surface-2); padding: 1px 6px; border: 1px solid var(--border); }

/* ---- backdrop: grid + aurora ---------------------------------------- */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(600px 400px at 12% -5%, var(--glow-a), transparent 70%),
    radial-gradient(700px 500px at 95% 105%, var(--glow-b), transparent 70%),
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: auto, auto, 42px 42px, 42px 42px;
  pointer-events: none;
}

/* ---- cards ----------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-card);
  position: relative;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 45%, var(--accent-2), transparent);
  opacity: 0.55;
}
.card-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  color: var(--muted);
  margin-bottom: .9rem;
}

/* ---- buttons --------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .58rem 1.05rem;
  border: 1px solid var(--border-strong);
  background: var(--btn-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-btn);
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
  text-decoration: none;
}
.btn:hover { background: var(--btn-bg-hover); transform: translateY(-1px); text-decoration: none; }
.btn:focus-visible { outline: none; box-shadow: var(--glow); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #21C79A);
  border-color: transparent;
  color: var(--accent-ink);
}
.btn-primary:hover { background: linear-gradient(135deg, #55F7BE, #29D6A6); box-shadow: 0 8px 26px rgba(61, 242, 177, 0.28); }
.btn-ghost { background: transparent; border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-strong); }
.btn-danger { background: var(--err-bg); border-color: rgba(255, 107, 107, 0.35); color: var(--err-fg); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.16); }
.btn-sm { padding: .34rem .7rem; font-size: .84rem; }
.btn-block { width: 100%; justify-content: center; }
.btn.is-disabled { opacity: .45; pointer-events: none; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* ---- forms ----------------------------------------------------------- */
.form { display: grid; gap: .9rem; }
.form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; align-items: start; }
.form-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: .9rem; align-items: start; }

/* Fields are top-aligned grids: a cell with a hint must never stretch its
   neighbours and push their inputs down (that produced the "jumping" rows). */
.field { display: grid; gap: .3rem; font-size: .88rem; align-content: start; align-self: start; }
.field > span:first-child { color: var(--muted); font-weight: 600; line-height: 1.3; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="tel"],
.field input[type="url"],
.field input[type="search"],
.field input[type="date"],
.field input[type="time"],
.field input[type="datetime-local"],
.field textarea,
.field select,
.filterbar input, .filterbar select {
  min-height: 2.6rem;
  background: var(--input-bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font: inherit;
  line-height: 1.3;
  padding: .58rem .75rem;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select { width: 100%; }
.field textarea { min-height: 6.5rem; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .75; }
.field input:focus, .field select:focus, .field textarea:focus, .filterbar input:focus, .filterbar select:focus {
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.field input:disabled { opacity: .55; }
.field-hint { color: var(--muted); font-size: .78rem; line-height: 1.35; margin: 0; }
/* Checkbox rows next to an input: reserve the input's height so the control
   lines up with the field beside it instead of drifting to the row bottom. */
.field-action { display: grid; gap: .3rem; align-content: start; align-self: start; }
.field-action > .checkline { min-height: 2.6rem; }
.field-inline { display: flex; align-items: center; gap: .4rem; }
.field-inline input { min-width: 240px; width: auto; }

.field-pw { position: relative; display: block; }
.field-pw input { width: 100%; padding-right: 2.6rem; }
.pw-eye {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: .3rem;
}
.pw-eye:hover { color: var(--accent); }

.form-links { display: flex; justify-content: space-between; font-size: .85rem; gap: 1rem; }

.switch { position: relative; display: flex; align-items: center; gap: .7rem; cursor: pointer; font-size: .9rem; }
.switch input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.switch-track {
  width: 42px; height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--input-bg);
  position: relative;
  flex: 0 0 auto;
  transition: background .2s ease, border-color .2s ease;
}
.switch-dot {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .2s ease, background .2s ease;
}
.switch input:checked + .switch-track { border-color: var(--accent); background: var(--ok-bg); }
.switch input:checked + .switch-track .switch-dot { transform: translateX(18px); background: var(--accent); }
.switch input:focus-visible + .switch-track { box-shadow: var(--glow); }

/* ---- alerts ----------------------------------------------------------- */
.alert {
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  margin-bottom: .9rem;
  font-size: .9rem;
}
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); border-color: rgba(61, 242, 177, 0.25); }
.alert-err { background: var(--err-bg); color: var(--err-fg); border-color: rgba(255, 107, 107, 0.25); }
.alert-info { background: var(--info-bg); color: var(--info-fg); border-color: rgba(77, 163, 255, 0.25); }

/* ---- badges / ticks / kv --------------------------------------------- */
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-strong);
  padding: .12rem .5rem;
  color: var(--muted);
}
.badge-ok { color: var(--ok-fg); border-color: rgba(61, 242, 177, 0.35); background: var(--ok-bg); }
.badge-err { color: var(--err-fg); border-color: rgba(255, 107, 107, 0.35); background: var(--err-bg); }
.badge-warn { color: var(--warn); border-color: rgba(255, 180, 84, 0.4); background: rgba(255, 180, 84, 0.10); }
.badge-info { color: var(--info-fg); border-color: rgba(77, 163, 255, 0.35); background: var(--info-bg); }

.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.ticks li { position: relative; padding-left: 1.4rem; color: var(--muted); }
.ticks li::before {
  content: "";
  position: absolute; left: 0; top: .52em;
  width: 7px; height: 7px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.kv { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .45rem; }
.kv li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed var(--border); padding-bottom: .45rem; }
.kv span { color: var(--muted); font-size: .86rem; }

.stack { display: grid; gap: .6rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 1.1rem; margin-bottom: 1.1rem; }

/* ---- tabs -------------------------------------------------------------- */
.tabs { display: flex; gap: .35rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--border); }
.tab {
  padding: .55rem 1rem;
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
  border-bottom: 2px solid transparent;
  text-decoration: none;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---- tables ------------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left;
  font-family: var(--font);
  font-weight: 500;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
  padding: .5rem .6rem;
}
.table td { padding: .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }

/* ---- empty state -------------------------------------------------------- */
.empty {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 2.2rem 1rem;
  color: var(--muted);
  border: 1px dashed var(--border-strong);
}
.empty .i { color: var(--accent); opacity: .7; }
.empty p { margin: .6rem 0 0; }

/* ---- details fold -------------------------------------------------------- */
.fold { margin-bottom: 1.1rem; }
.fold > summary { cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] > summary { color: var(--accent); }

/* ---- filter bar ----------------------------------------------------------- */
.filterbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.1rem; }
.filterbar select { padding: .5rem .6rem; font: inherit; }

/* ---- pager ----------------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 1rem;
  padding-top: .9rem;
  border-top: 1px dashed var(--border);
}
.pager-info { margin-right: auto; color: var(--muted); font-size: .78rem; }
.pager-num,
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 .55rem;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--btn-bg);
  color: var(--text);
  font-size: .84rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.pager-num:hover,
.pager-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pager-num.is-current {
  background: linear-gradient(135deg, var(--accent), #21C79A);
  border-color: transparent;
  color: var(--accent-ink);
}
.pager-btn.is-disabled { opacity: .35; pointer-events: none; }
.pager-gap { color: var(--muted); padding: 0 .15rem; }
.flip { display: inline-flex; transform: rotate(180deg); }
.heart-ico { color: var(--danger); display: inline-flex; vertical-align: -2px; }

/* ---- right-aligned actions row ---------------------------------------------- */
.actions-right { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

/* ---- inline form ------------------------------------------------------------ */
.inline { display: inline; }
.token-line {
  display: flex; align-items: center; justify-content: space-between; gap: .8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .55rem .7rem;
  margin-bottom: .5rem;
  word-break: break-all;
}
.card-token::before { background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: 1; }

/* ---- toast ------------------------------------------------------------------- */
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 60; }
.toast {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  padding: .55rem .85rem;
  font-size: .88rem;
  box-shadow: var(--shadow-card);
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .form-2col, .form-3col { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* =====================================================================
   Public chrome - shared by landing AND auth pages (theme.css is loaded
   everywhere; the rest of the landing styling stays in landing.css).
   ===================================================================== */

/* ---- base ------------------------------------------------------------ */
.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub .grid-bg { opacity: .55; }
.pub-main { flex: 1; }

/* Soften the public surface: calm, rounded cards (matches panels). */
.pub .card {
  border-radius: var(--radius-card);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-card);
}
.pub .card::before { display: none; }
.pub .btn,
.pub .btn-primary,
.pub .btn-ghost {
  border-radius: var(--radius-btn);
  padding-inline: 1.05rem;
}

/* ---- header / nav ---------------------------------------------------- */
.pub-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: .85rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.pub-top .brand { font-size: 1.05rem; }
.pub-nav { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.nav-link {
  color: var(--muted);
  padding: .4rem .7rem;
  border-radius: 8px;
  font-size: .92rem;
}
.nav-link:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav-link.active { color: var(--text); background: var(--surface-2); }
.pub-actions { display: flex; align-items: center; gap: .55rem; }
.pub-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.pub-theme:hover { color: var(--text); border-color: var(--border-strong); }

/* ---- footer ---------------------------------------------------------- */
.pub-foot {
  border-top: 1px solid var(--border);
  background: var(--surface);
  margin-top: 2rem;
}
.pub-foot-inner {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 2.4rem 1.5rem 1.6rem;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 2rem;
}
.foot-brand p { margin: .7rem 0 0; max-width: 34ch; font-size: .93rem; }
.foot-col { display: grid; gap: .45rem; align-content: start; }
.foot-col strong {
  font-size: .74rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .2rem;
}
.foot-col a { color: var(--text); font-size: .93rem; }
.foot-col a:hover { color: var(--accent); }
.pub-foot-base {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: .9rem 1.5rem 1.4rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .88rem;
  color: var(--muted);
}
.pub-foot-base a { color: var(--muted); }
.pub-foot-base a:hover { color: var(--accent); }

@media (max-width: 960px) {
  .pub-foot-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .pub-top { flex-wrap: wrap; }
  .pub-nav { order: 3; width: 100%; justify-content: flex-start; }
  .pub-foot-inner { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
}

/* ---- announcement bar + footer socials (site content settings) -------- */
.announce {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .5rem 1rem;
  background: var(--ok-bg);
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
  text-align: center;
}
.announce .i { color: var(--accent); flex: none; }
.foot-social { display: flex; gap: .5rem; margin-top: .8rem; }
.foot-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--muted);
}
.foot-social a:hover { color: var(--accent); border-color: var(--border-strong); }

/* =====================================================================
   Shared panel components - page headers, data tables, dialogs, charts.
   Used by the admin console (dashboard, users, catalog, logs, settings).
   ===================================================================== */

/* ---- page header ------------------------------------------------------ */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.page-head h2 { margin: 0; font-size: 1.28rem; letter-spacing: -.01em; }
.page-head p { margin: .22rem 0 0; color: var(--muted); font-size: .88rem; max-width: 72ch; }
.page-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

/* ---- table helpers ---------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table td.tight { padding-top: .45rem; padding-bottom: .45rem; }
.cell-main { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.cell-main .cell-txt { display: grid; gap: .05rem; min-width: 0; }
.cell-main .cell-txt strong,
.cell-main .cell-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-family: var(--font);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.avatar.is-admin { background: linear-gradient(135deg, var(--danger), var(--warn)); }
.avatar.is-reseller { background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.rowact { align-items: center; }
.iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.iconbtn:hover { color: var(--accent); border-color: var(--accent); background: var(--ok-bg); }
.iconbtn.is-danger:hover { color: var(--err-fg); border-color: var(--danger); background: var(--err-bg); }
.iconbtn[disabled] { opacity: .4; cursor: not-allowed; }

/* ---- definition facts ------------------------------------------------- */
.facts { display: grid; grid-template-columns: minmax(120px, 170px) 1fr; gap: .5rem .9rem; margin: 0; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.facts .span2 { grid-column: 1 / -1; }

/* ---- dialog ----------------------------------------------------------- */
.amt-modal {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-card);
  background: var(--surface);
  color: var(--text);
  width: min(760px, calc(100vw - 1.6rem));
  max-height: min(88vh, 920px);
  padding: 0;
  box-shadow: var(--shadow-card);
}
.amt-modal::backdrop { background: rgba(2, 6, 10, .66); backdrop-filter: blur(3px); }
.amt-modal-head {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
}
.amt-modal-head strong { font-size: .98rem; }
.amt-modal-x {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  padding: .1rem .35rem;
  cursor: pointer;
}
.amt-modal-x:hover { color: var(--danger); }
.amt-modal-body { padding: 1rem 1.1rem 1.2rem; overflow: auto; max-height: calc(88vh - 58px); display: grid; gap: .9rem; }
.logbox {
  margin: 0;
  background: #06090D;
  color: #D7E3EF;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .8rem .9rem;
  font-family: var(--font);
  font-size: .84rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow: auto;
}

/* ---- dashboard extras -------------------------------------------------- */
.stat-sub { color: var(--muted); font-size: .76rem; }
.stat-link { font-size: .76rem; font-weight: 700; color: var(--accent); align-self: start; }
.stat { transition: border-color .15s ease, transform .15s ease; }
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
a.stat { text-decoration: none; color: inherit; }
a.stat:hover { text-decoration: none; }
.spark { display: flex; align-items: flex-end; gap: .45rem; height: 110px; }
.spark-col { flex: 1; display: grid; justify-items: center; align-content: end; gap: .3rem; min-width: 0; }
.spark-bar {
  width: 100%;
  max-width: 46px;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent), rgba(61, 242, 177, .12));
  box-shadow: 0 0 16px rgba(61, 242, 177, .16);
}
.spark-bar.is-quiet { background: linear-gradient(180deg, var(--border-strong), rgba(139, 152, 165, .08)); box-shadow: none; }
.spark-lbl { font-family: var(--font); font-size: .64rem; color: var(--muted); }
.spark-val { font-family: var(--font); font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: .7rem; align-items: baseline; }
.timeline time { font-family: var(--font); font-size: .72rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.timeline-body { min-width: 0; display: grid; gap: .1rem; }
.timeline-body strong { font-size: .86rem; overflow: hidden; text-overflow: ellipsis; }
.timeline-body small { color: var(--muted); font-size: .76rem; }

/* ---- health chips ------------------------------------------------------ */
.health { display: flex; flex-wrap: wrap; gap: .45rem; }
.health-item {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .8rem;
  color: var(--muted);
}
.health-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 8px currentColor; }
.health-item.is-ok { color: var(--ok-fg); border-color: rgba(61, 242, 177, .3); }
.health-item.is-ok .dot { background: var(--accent); }
.health-item.is-warn { color: var(--warn); border-color: rgba(255, 180, 84, .32); }
.health-item.is-warn .dot { background: var(--warn); }
.health-item.is-off { color: var(--muted); }

/* ---- radio choice cards (settings) ------------------------------------ */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .6rem; }
.choice {
  position: relative;
  display: grid;
  gap: .2rem;
  padding: .75rem .85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.choice input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice strong { font-size: .88rem; display: flex; align-items: center; gap: .4rem; }
.choice small { color: var(--muted); font-size: .76rem; }
.choice:hover { border-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--ok-bg); box-shadow: var(--glow); }
.choice:has(input:focus-visible) { box-shadow: var(--glow); }
.range-row { display: flex; align-items: center; gap: .8rem; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-val { font-family: var(--font); font-size: .85rem; min-width: 3ch; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- split layout (list + side form) ----------------------------------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .62fr); gap: 1.1rem; align-items: start; }
.split-form { position: sticky; top: 84px; }
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; }
  .split-form { position: static; }
}

/* ---- rich text editor --------------------------------------------------- */
.rte {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  background: var(--input-bg);
  overflow: hidden;
}
.rte:focus-within { border-color: var(--accent); box-shadow: var(--glow); }
.rte-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .15rem;
  padding: .38rem .45rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 6px;
}
.rte-glyph { font-size: 13px; font-weight: 600; line-height: 1; color: inherit; }
.rte-glyph.is-bold { font-weight: 800; }
.rte-glyph.is-italic { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.rte-glyph.is-underline { text-decoration: underline; text-underline-offset: 2px; }
.rte-glyph.is-strike { text-decoration: line-through; }
.rte-glyph.is-word { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.rte-btn:hover { color: var(--text); background: var(--surface); border-color: var(--border); }
.rte-btn.is-on { color: var(--accent); background: var(--ok-bg); border-color: rgba(61, 242, 177, .3); }
.rte-btn:focus-visible { outline: none; box-shadow: var(--glow); }
.rte-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 .3rem; }
.rte-block {
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: .78rem;
  padding: 0 .4rem;
}
.rte-area {
  min-height: 190px;
  max-height: 460px;
  overflow: auto;
  padding: .8rem .9rem;
  outline: none;
  font-size: .92rem;
  line-height: 1.65;
}
.rte-area:empty::before {
  content: attr(data-placeholder);
  color: var(--muted);
  pointer-events: none;
}

/* Shared typography for editor output and public/admin render. */
.rte-area p, .release-notes p { margin: .4rem 0; }
.rte-area h3, .release-notes h3 { margin: .9rem 0 .35rem; font-size: 1.02rem; }
.rte-area h4, .release-notes h4 { margin: .8rem 0 .3rem; font-size: .95rem; }
.rte-area ul, .release-notes ul,
.rte-area ol, .release-notes ol { margin: .4rem 0; padding-left: 1.35rem; }
.rte-area li, .release-notes li { margin: .18rem 0; }
.rte-area blockquote, .release-notes blockquote {
  margin: .55rem 0;
  padding: .35rem .8rem;
  border-left: 3px solid var(--accent);
  background: var(--ok-bg);
  color: var(--muted);
}
.rte-area pre, .release-notes pre {
  margin: .55rem 0;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, .22);
  white-space: pre-wrap;
  overflow: auto;
}
.rte-area code, .release-notes code { font-family: var(--font); background: var(--surface-2); padding: 1px 5px; border: 1px solid var(--border); }
.rte-area a, .release-notes a { color: var(--accent-2); }
.release-notes { font-size: .9rem; line-height: 1.65; }
.release-notes hr { border: 0; border-top: 1px dashed var(--border-strong); margin: .8rem 0; }

/* ---- misc --------------------------------------------------------------- */
.mono-num { font-family: var(--font); font-variant-numeric: tabular-nums; }
.text-truncate { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.span2 { grid-column: 1 / -1; }

/* ---- brand logos -------------------------------------------------------- */
.avatar-logo { padding: 0; overflow: hidden; background: var(--surface-2); }
.avatar-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-title { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.brand-title-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 3px;
}
.logo-field { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview {
  width: 74px;
  height: 74px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-2);
  object-fit: contain;
  padding: 6px;
}
.logo-preview.is-empty { display: grid; place-items: center; color: var(--muted); }
.logo-field-body { flex: 1 1 240px; min-width: 0; display: grid; gap: .35rem; }
.checkline { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; display: block; }

/* ---- string source pair editor ----------------------------------------- */
.pairs { display: grid; gap: .7rem; }
.pairs-list { display: grid; gap: .8rem; }
.pair-row {
  display: grid;
  gap: .55rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.pair-head { display: flex; align-items: flex-end; gap: .6rem; }
.pair-head .field { flex: 1; min-width: 0; }
.pair-head .iconbtn { margin-bottom: .15rem; }
.linenum-wrap {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--input-bg);
  overflow: hidden;
}
.linenum {
  flex: 0 0 auto;
  min-width: 2.2rem;
  padding: 8px 6px;
  text-align: right;
  color: var(--muted);
  background: var(--surface);
  border-right: 1px solid var(--border);
  font-size: 12px;
  line-height: 18px;
  overflow: hidden;
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.linenum span { display: block; height: 18px; }
.linenum-wrap textarea {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent;
  font-size: 12px;
  line-height: 18px;
  padding: 8px 10px;
  resize: vertical;
  min-height: 96px;
  box-shadow: none !important;
}
.pairs-foot { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.pair-preview { display: flex; flex-direction: column; gap: .2rem; max-width: 380px; }
.pair-chip { display: flex; gap: .4rem; align-items: baseline; font-size: .8rem; overflow: hidden; }
.pair-chip code { color: var(--accent-2); white-space: nowrap; }
.pair-chip span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pair-detail { display: grid; gap: .7rem; margin-top: .8rem; }
.pair-detail-row code { display: block; margin-bottom: .25rem; color: var(--accent-2); }
.pair-detail-row .logbox { margin: 0; max-height: 220px; overflow: auto; white-space: pre-wrap; }

/* ---- Settings sub-blocks (numbered sections inside one card) ----------- */
.set-block { display: grid; gap: .7rem; }
.set-block + .set-block { border-top: 1px dashed var(--border); padding-top: .95rem; }
.set-sub { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.set-sub > strong { font-size: .9rem; letter-spacing: .01em; }
.set-sub > small { color: var(--muted); font-size: .78rem; }

/* ---- SMTP settings block ----------------------------------------------- */
.smtp-box {
  display: grid;
  gap: .8rem;
  padding: .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.smtp-box[hidden] { display: none; }
.smtp-box.is-idle { opacity: .6; }
.smtp-box.is-idle:focus-within { opacity: 1; }
.smtp-head { display: flex; align-items: baseline; gap: .6rem; flex-wrap: wrap; }
.smtp-head > strong { font-size: .86rem; }
.smtp-head > small { font-size: .78rem; }

/* ---- Feature model picker ---------------------------------------------- */
.model-pick {
  display: grid;
  gap: .35rem;
  max-height: 280px;
  overflow: auto;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

/* ---- Reseller directory (/resellers) + country picker ------------------ */
.country-flag { font-size: 1rem; line-height: 1; }
/* Bundled SVG flags (Windows has no flag emoji glyphs). */
.cf {
  width: 20px;
  height: 15px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .14);
  background: var(--surface-2);
  vertical-align: -2px;
}

/* ---- Reseller avatar ---------------------------------------------------- */
.avatar { overflow: hidden; }
.avatar > img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.avatar-row { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.avatar-fields { display: grid; gap: .45rem; flex: 1 1 280px; }
.avatar-lg { width: 76px; height: 76px; border-radius: 20px; padding: 0; }
.field input[type="file"] {
  width: 100%;
  padding: .5rem .6rem;
  background: var(--input-bg);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-btn);
  color: var(--muted);
  font: inherit;
  font-size: .8rem;
}
.field input[type="file"]::file-selector-button {
  margin-right: .6rem;
  padding: .35rem .7rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
}
.dir-avatar {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border-radius: 16px;
  object-fit: cover;
  display: block;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.dir-avatar-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .95rem;
  color: var(--accent);
  background: var(--ok-bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.dir-id { display: grid; gap: .2rem; min-width: 0; }
.cp-option .cf { width: 20px; height: 15px; }
.cp-chip .cf { width: 18px; height: 13px; }
.dir-chip .cf { width: 18px; height: 13px; vertical-align: -3px; }
.cp-code {
  font: 600 .72rem/1 var(--font);
  letter-spacing: .04em;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--surface);
  color: var(--muted);
}

/* ---- Country picker (searchable multi-select with flags) ---------------- */
.cp { display: grid; gap: .45rem; }
.cp-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
  min-height: 2.6rem;
  padding: .4rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-btn);
  background: var(--input-bg);
  cursor: text;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.cp-control.is-open { border-color: var(--accent); box-shadow: var(--glow); }
.cp.is-limit .cp-control { border-color: var(--warn); }
.cp-chips { display: inline-flex; flex-wrap: wrap; gap: .3rem; }
.cp-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 2px 4px 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: .78rem;
}
.cp-chip-x {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1;
  padding: 0 3px;
  cursor: pointer;
}
.cp-chip-x:hover { color: var(--danger); }
.cp-input {
  flex: 1 1 130px;
  min-width: 110px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .88rem;
  padding: .2rem .3rem;
  outline: none;
}
.cp-noscript { width: 100%; min-height: 8rem; padding: .4rem; border: 1px solid var(--border-strong); border-radius: var(--radius-btn); background: var(--input-bg); }
.cp-list {
  display: grid;
  gap: .1rem;
  max-height: 250px;
  overflow: auto;
  padding: .35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.cp-list[hidden] { display: none; }
.cp-option {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .42rem .5rem;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  text-align: left;
  cursor: pointer;
}
.cp-option[hidden] { display: none; }
.cp-option:hover, .cp-option.is-focus { background: var(--surface); }
.cp-option[aria-selected="true"] { background: var(--ok-bg); color: var(--accent); }
.cp-tick { margin-left: auto; opacity: 0; display: inline-flex; }
.cp-option[aria-selected="true"] .cp-tick { opacity: 1; }
.cp-empty { margin: 0; padding: .5rem .6rem; font-size: .8rem; color: var(--muted); }
.cp-empty[hidden] { display: none; }

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: .3rem .8rem;
  max-height: 240px;
  overflow: auto;
  padding: .7rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.dir-title { display: flex; align-items: baseline; gap: .5rem; margin: 1.4rem 0 .8rem; font-size: 1rem; letter-spacing: .02em; }
.dir-group { margin-bottom: 1.2rem; }
.dir-group-head {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin: .2rem 0 .6rem;
  font-weight: 600;
  font-size: .92rem;
}
.dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .8rem;
}
.dir-card {
  display: grid;
  gap: .55rem;
  padding: .85rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.dir-card.is-distributor {
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.dir-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.dir-flags { display: inline-flex; gap: .15rem; }
.dir-name { font-weight: 700; font-size: .95rem; }
.dir-badge {
  margin-left: auto;
  padding: 1px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.dir-badge.is-distributor { color: var(--accent); border-color: var(--accent); background: var(--ok-bg); }
.dir-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; }
.dir-chip {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .72rem;
  color: var(--muted);
}
.dir-links { display: flex; flex-wrap: wrap; gap: .4rem; }
.dir-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .74rem;
  color: var(--text);
  text-decoration: none;
}
.dir-link:hover { border-color: var(--accent); color: var(--accent); background: var(--ok-bg); }
