/* ==========================================================================
   XOFLIX Admin — design system
   Self-contained: no build step, no external CDN, no icon font.
   Everything below is driven by the tokens in :root.
   ========================================================================== */

/* Inter, self-hosted. The product (web player + Android) is Inter; the admin
   rendered in whatever system-ui resolved to, which is a large part of why it
   read as generic. The CDN the web prototype uses is blocked here by the panel's
   CSP (default-src 'self'), so the file is served from our own origin —
   font-src 'self' already permits it, no CSP change. Upright only: an admin has
   no use for italic, and it would double the payload. */
@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/InterVariable.woff2') format('woff2-variations');
}
/* Metric-matched fallback: without this, `swap` reflows the whole page when Inter
   lands. These overrides make Arial occupy the same box as Inter, so the swap is
   invisible rather than a jolt. */
@font-face {
  font-family: 'Inter fallback';
  src: local('Arial');
  size-adjust: 107%;
  ascent-override: 90%;
  descent-override: 22%;
  line-gap-override: 0%;
}

:root {
  /* --- surfaces (light) ------------------------------------------------- */
  --bg: #f7f8fa;              /* page — soft off-white, never pure white */
  --surface: #ffffff;         /* cards, table wrap, sidebar, topbar */
  --surface-2: #f2f4f7;       /* subtle fill: hover, inset panels, inputs */
  --surface-3: #eaecf0;       /* pressed / heavier fill */
  --border: #e4e7ec;          /* default hairline */
  --border-strong: #d0d5dd;   /* input borders, dividers that must read */

  /* --- text ------------------------------------------------------------- */
  --text: #101828;            /* primary */
  --text-2: #475467;          /* secondary */
  --muted: #667085;           /* tertiary / labels / table headers */
  --on-brand: #ffffff;

  /* --- brand (accent only — never a big flood of red) ------------------- */
  --brand: #e50914;
  --brand-hover: #c40810;
  --brand-tint: rgba(229, 9, 20, .08);
  --brand-ring: rgba(229, 9, 20, .24);

  /* --- semantic pairs: fg / tint. AA on white. -------------------------- */
  --green: #067647;   --green-tint: #ecfdf3;   --green-line: #abefc6;
  --amber: #b54708;   --amber-tint: #fffaeb;   --amber-line: #fedf89;
  --red: #b42318;     --red-tint: #fef3f2;     --red-line: #fecdca;
  --blue: #175cd3;    --blue-tint: #eff8ff;    --blue-line: #b2ddff;
  --neutral: #475467; --neutral-tint: #f2f4f7; --neutral-line: #e4e7ec;

  /* --- spacing ---------------------------------------------------------- */
  --s-1: 4px;  --s-2: 8px;   --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px;  --s-8: 40px; --s-9: 48px; --s-10: 64px;

  /* --- type scale ------------------------------------------------------- */
  --fs-xs: 11px; --fs-sm: 12px; --fs-base: 14px; --fs-md: 15px;
  --fs-lg: 17px; --fs-xl: 20px; --fs-2xl: 24px; --fs-3xl: 30px; --fs-4xl: 40px;

  /* --- radii ------------------------------------------------------------ */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;

  /* --- elevation (light needs whisper-soft, not the old .35 black) ------ */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);

  /* --- motion ----------------------------------------------------------- */
  --t-fast: 120ms; --t: 160ms; --ease: cubic-bezier(.2, 0, .2, 1);

  /* --- layout ----------------------------------------------------------- */
  --sidebar-w: 248px;
  --z-drawer: 40; --z-scrim: 30; --z-topbar: 20;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ==========================================================================
   base
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Field groups toggle via [hidden]; make sure nothing here can out-specify it. */
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter var', 'Inter fallback', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 var(--s-2); color: var(--text); }
/* Optical sizing: the bigger the type, the tighter the tracking. Uniform
   weight/tracking at every size is what reads as unconsidered. */
h1 { font-size: var(--fs-3xl); font-weight: 660; letter-spacing: -.03em; line-height: 1.15; }
h2 { font-size: var(--fs-2xl); font-weight: 640; letter-spacing: -.022em; line-height: 1.2; }
h3 { font-size: var(--fs-lg);  font-weight: 620; letter-spacing: -.012em; line-height: 1.3; }
h4 { font-size: var(--fs-md);  font-weight: 600; letter-spacing: -.008em; }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }

small, .muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

::selection { background: var(--brand-ring); }

/* One consistent focus ring everywhere (the old CSS killed outlines entirely). */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute; left: -9999px; top: var(--s-2);
  background: var(--surface); color: var(--text);
  padding: var(--s-2) var(--s-4); border-radius: var(--r-md);
  box-shadow: var(--shadow-md); z-index: 100;
}
.skip-link:focus { left: var(--s-2); }

/* ==========================================================================
   icons
   ========================================================================== */

.icon {
  width: 18px; height: 18px; flex: none;
  stroke: currentColor; fill: none;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 15px; height: 15px; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ==========================================================================
   layout
   ========================================================================== */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--s-5) var(--s-3);
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--s-1);
}

.brand {
  display: flex; align-items: center; gap: var(--s-2);
  font-weight: 700; font-size: var(--fs-lg); letter-spacing: -.02em;
  padding: var(--s-2) var(--s-3) var(--s-5);
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand .dot {
  width: 9px; height: 9px; border-radius: var(--r-full);
  background: var(--brand); flex: none;
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-6);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .8);
  backdrop-filter: saturate(1.6) blur(8px);
  position: sticky; top: 0; z-index: var(--z-topbar);
  min-height: 60px;
}
.crumb { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.crumb-sep { color: var(--border-strong); }
.crumb-title { font-weight: 600; font-size: var(--fs-md); }

/* Full-bleed. A max-width cap here left 337px dead at 1920 and 968px dead on the
   single-column form screens — half the monitor unused. Breadth comes from the
   page filling the display; readability comes from the column widths inside it,
   not from starving the whole canvas. */
.content { padding: var(--s-7) var(--s-8); width: 100%; }
@media (max-width: 1280px) { .content { padding: var(--s-6); } }

.who { display: flex; flex-direction: column; line-height: 1.25; text-align: right; }
.who .who-name { font-weight: 600; font-size: var(--fs-sm); }
.who .who-role { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .06em; }

/* --- navigation ---------------------------------------------------------- */

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  color: var(--text-2); font-weight: 500;
  position: relative;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav a .icon { color: var(--muted); transition: color var(--t-fast) var(--ease); }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a:hover .icon { color: var(--text-2); }

/* Active = tint + brand text + left rule. Not a solid red slab. */
.nav a[aria-current="page"] {
  background: var(--brand-tint); color: var(--brand); font-weight: 600;
}
.nav a[aria-current="page"] .icon { color: var(--brand); }
.nav a[aria-current="page"]::before {
  content: ""; position: absolute;
  left: calc(var(--s-3) * -1);          /* reach out to the sidebar's edge */
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px;
  border-radius: 0 var(--r-full) var(--r-full) 0;
  background: var(--brand);
}

.nav .group {
  color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  margin: var(--s-5) var(--s-3) var(--s-2);
}
.nav .group:first-child { margin-top: 0; }

/* --- mobile drawer (CSS only — no JS) ------------------------------------ */

.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.hamburger { display: none; }
.scrim { display: none; }

@media (max-width: 900px) {
  .hamburger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex: none;
    border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--surface); color: var(--text-2); cursor: pointer;
    transition: background var(--t-fast) var(--ease);
  }
  .hamburger:hover { background: var(--surface-2); }

  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh;
    z-index: var(--z-drawer);
    transform: translateX(-100%);
    transition: transform var(--t) var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .nav-toggle:checked ~ .layout .sidebar { transform: translateX(0); }

  .scrim {
    display: block; position: fixed; inset: 0;
    background: rgba(16, 24, 40, .4);
    opacity: 0; pointer-events: none;
    transition: opacity var(--t) var(--ease);
    z-index: var(--z-scrim);
  }
  .nav-toggle:checked ~ .layout .scrim { opacity: 1; pointer-events: auto; }

  .content { padding: var(--s-4); }
  .topbar { padding: var(--s-3) var(--s-4); }
}

/* ==========================================================================
   grid & cards
   ========================================================================== */

.grid { display: grid; gap: var(--s-4); }
/* Grid items default to min-width:auto and so refuse to shrink below their
   min-content, which pushed wide cards past the viewport on phones. */
.grid > * { min-width: 0; }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
/* Auto-fit: no more orphaned 5th card in a 4-col grid. */
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
/* Panel grid: cards flow to fill whatever width the display gives us, instead
   of a lone 680px column stranded in the middle of a 1920 monitor. */
.grid.panels { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); align-items: start; }

/* Detail view: work on the left, reference on the right. The 62/38 asymmetry is
   the point — an even split would say we hadn't decided which side mattered. */
.detail {
  display: grid; gap: var(--s-5);
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
  align-items: start;
}
.detail-main, .detail-side { gap: var(--s-5); min-width: 0; }
@media (max-width: 1200px) { .detail { grid-template-columns: 1fr; } }

/* Deleting is the one thing here you cannot undo; the card should say so before
   you read the copy. */
.danger-zone { border-color: var(--red-line); }
.danger-zone .card-head { border-bottom-color: var(--red-line); background: var(--red-tint); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

@media (max-width: 1100px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px)  { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 640px)  { .grid.cols-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-xs);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) var(--s-5);
  padding: var(--s-4) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.card-head h3, .card-head h2 { margin: 0; }
.card-sub { background: var(--surface-2); box-shadow: none; }
.card-flush { padding: 0; overflow: hidden; }
/* The theme profile that is serving devices right now. */
.card.is-live { border-color: var(--green-line); box-shadow: 0 0 0 3px var(--green-tint); }

/* Stat cards carry the dashboard, so give the number real presence and the
   label a quiet, uppercase counterweight. Tabular figures stop the digits
   jittering as counts change. */
/* Stat cards are links to the filtered list they describe. */
a.stat { text-decoration: none; transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease); }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.stat { display: flex; flex-direction: column-reverse; gap: var(--s-2); }
.stat .n {
  /* Explicit: the tile is an <a>, so without this the number inherits the link
     colour (brand red) and every unmodified stat reads as an alert. */
  color: var(--text);
  font-size: var(--fs-4xl); font-weight: 680; letter-spacing: -.035em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat .l {
  color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
}
.stat.is-green .n { color: var(--green); }
.stat.is-amber .n { color: var(--amber); }
.stat.is-red   .n { color: var(--red); }
.stat.is-blue  .n { color: var(--blue); }

/* Page header strip — a real masthead with a rule under it, so each screen
   opens with a clear title band instead of cards starting at the top edge. */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-5);
  border-bottom: 1px solid var(--border);
}
.page-head .page-sub { color: var(--muted); margin: var(--s-2) 0 0; font-size: var(--fs-md); }

/* ==========================================================================
   toolbar (a real component — was a .card pretending to be one)
   ========================================================================== */

.toolbar {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
  box-shadow: var(--shadow-xs);
}
.toolbar .grow { flex: 1; min-width: 160px; }
.toolbar-label { font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); padding-left: var(--s-1); }

/* ==========================================================================
   tables
   ========================================================================== */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-xs);
}
table { width: 100%; border-collapse: collapse; }
/* Roomier rows: cramped rows are the clearest "cheap admin" tell, and long
   device lists are what this panel is actually for. */
/* Row rhythm: 44px. 32 reads cramped, 64 reads empty; everything divides by 4.
   Tabular figures everywhere digits appear — proportional numerals in a table
   make the columns jitter as counts change, and that is the single loudest
   "cheap" tell in a data-dense admin. */
th, td {
  text-align: left; padding: var(--s-3) var(--s-5); vertical-align: middle;
  height: 44px;
  font-variant-numeric: tabular-nums;
}
thead th {
  color: var(--muted); font-size: var(--fs-xs); font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { border-bottom: 1px solid var(--border); }

/* Banned is exception styling, not a column. It applies to 0 of 53 devices
   today, and a column that is constant for every row carries no information —
   but when it does apply it is the single most important fact about the row. */
tbody tr.is-banned td { background: var(--red-tint); }
tbody tr.is-banned td:first-child { box-shadow: inset 3px 0 0 var(--red); }
tbody tr.is-banned:hover td { background: var(--red-tint); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover td { background: var(--surface-2); }

/* Column priority: shed low-value columns before the table starts scrolling. */
@media (max-width: 1100px) { .col-lo { display: none; } }
@media (max-width: 860px)  { .col-mid { display: none; } }

/* key/value list — replaces <table>-as-definition-list */
.kv { display: grid; grid-template-columns: minmax(96px, auto) 1fr; gap: var(--s-2) var(--s-4); }
.kv dt { color: var(--muted); font-size: var(--fs-sm); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  padding: var(--s-8) var(--s-5); text-align: center; color: var(--muted);
}
.empty .icon { width: 24px; height: 24px; color: var(--border-strong); }

/* ==========================================================================
   badges & dots
   ========================================================================== */

.badge {
  display: inline-flex; align-items: center; gap: var(--s-1);
  padding: 2px var(--s-2);
  border-radius: var(--r-full);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1.6;
  /* Real default — a bare .badge used to be invisible. */
  background: var(--neutral-tint); color: var(--neutral);
  border: 1px solid var(--neutral-line);
  white-space: nowrap;
}
.badge.active,  .badge.on,      .badge.ok      { background: var(--green-tint); color: var(--green); border-color: var(--green-line); }
.badge.expired, .badge.warn,    .badge.pending { background: var(--amber-tint); color: var(--amber); border-color: var(--amber-line); }
.badge.banned,  .badge.suspended,.badge.danger { background: var(--red-tint);   color: var(--red);   border-color: var(--red-line); }
.badge.info,    .badge.trial                   { background: var(--blue-tint);  color: var(--blue);  border-color: var(--blue-line); }
.badge.muted { opacity: .75; }

.dot-online, .dot-offline {
  display: inline-block; width: 8px; height: 8px;
  border-radius: var(--r-full); flex: none;
}
.dot-online  { background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.dot-offline { background: var(--border-strong); box-shadow: 0 0 0 3px var(--surface-2); }

/* The colour itself is data, so it arrives as an inline --swatch custom property. */
.swatch {
  width: 24px; height: 24px; flex: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
  background: var(--swatch, var(--surface-2));
}
.swatch-row { display: flex; gap: var(--s-1); flex-wrap: wrap; }

/* ==========================================================================
   forms
   ========================================================================== */

label { display: block; margin: 0 0 var(--s-1); color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.field { margin-bottom: var(--s-4); }
.field:last-child { margin-bottom: 0; }
.field-hint { color: var(--muted); font-size: var(--fs-sm); margin: var(--s-1) 0 0; }
/* Result feedback (e.g. the M3U extractor), set by admin.js via class — not
   inline style, so it stays token-driven. */
.field-hint.is-ok  { color: var(--green); font-weight: 500; }
.field-hint.is-err { color: var(--red);   font-weight: 500; }

input, select, textarea {
  width: 100%;
  padding: 9px var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
input[readonly], input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2); color: var(--text-2); cursor: not-allowed;
}
textarea { resize: vertical; min-height: 76px; }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-3) center;
  padding-right: var(--s-8);
}

input[type="color"] {
  width: 40px; height: 38px; padding: 3px; cursor: pointer;
  background: var(--surface);
}
input[type="file"] { padding: 7px var(--s-3); background: var(--surface-2); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--brand); cursor: pointer; }

.row { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.row.tight > * { min-width: 120px; }

.checkbox {
  display: flex; align-items: center; gap: var(--s-2);
  margin: 0 0 var(--s-2);
  color: var(--text); font-size: var(--fs-base); font-weight: 400;
  cursor: pointer;
}
.checkbox input { width: auto; flex: none; }

/* grouped checkbox block — auth-mode had 11 undifferentiated ones */
.check-group {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--s-3); background: var(--surface-2);
}
.check-group > .check-group-title {
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: var(--s-2);
}

/* colour field: picker + hex text side by side */
.color-field { display: flex; gap: var(--s-2); align-items: center; }
.color-field input[type="text"] { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-sm); }

/* ==========================================================================
   buttons
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  padding: 9px var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: none; }

.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn.danger { background: var(--surface); border-color: var(--red-line); color: var(--red); }
.btn.danger:hover { background: var(--red-tint); border-color: var(--red); }

.btn.solid-danger { background: var(--red); border-color: var(--red); color: var(--on-brand); }
.btn.solid-danger:hover { background: #912018; border-color: #912018; }

.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }

.btn.sm { padding: 5px var(--s-3); font-size: var(--fs-sm); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-row { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }

/* ==========================================================================
   tabs — sub-navigation inside a destination (links, not radios)
   ========================================================================== */

/* These are real links to real URLs. The previous radio implementation could not
   survive a round trip: after POSTing the Login form the page reloaded with
   #tab-profile still `checked`, so you saved Login and landed on Profile with a
   success alert above none of your changes. Links are also deep-linkable,
   bookmarkable and work with the back button. */
.tabs-nav {
  display: flex; gap: var(--s-1); flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 0 0 var(--s-6);
}
.tabs-nav > .tab {
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-base); font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;              /* sit the underline on the container rule */
  text-decoration: none;
  transition: color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.tabs-nav > .tab:hover { color: var(--text); text-decoration: none; }
.tabs-nav > .tab[aria-current="page"] { color: var(--brand); border-bottom-color: var(--brand); }
.tabs-nav > .tab:focus-visible {
  outline: 2px solid var(--brand); outline-offset: -2px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}

/* ==========================================================================
   alerts
   ========================================================================== */

.alert {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  margin-bottom: var(--s-4);
  border: 1px solid;
  font-size: var(--fs-base);
}
.alert.success { background: var(--green-tint); border-color: var(--green-line); color: var(--green); }
.alert.error   { background: var(--red-tint);   border-color: var(--red-line);   color: var(--red); }
.alert.warn    { background: var(--amber-tint); border-color: var(--amber-line); color: var(--amber); }
.alert.info    { background: var(--blue-tint);  border-color: var(--blue-line);  color: var(--blue); }
.alert .icon { margin-top: 2px; }

/* ==========================================================================
   pagination — Laravel's default emits Tailwind markup that never loaded,
   so these four screens were rendering raw. This styles our own view.
   ========================================================================== */

.pagination {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); flex-wrap: wrap;
  margin-top: var(--s-4);
}
.pagination-info { color: var(--muted); font-size: var(--fs-sm); }
.pagination-links { display: flex; align-items: center; gap: var(--s-1); flex-wrap: wrap; }
.pagination-links a, .pagination-links span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 var(--s-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); color: var(--text-2);
  font-size: var(--fs-sm); font-weight: 600;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pagination-links a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.pagination-links .is-current {
  background: var(--brand-tint); border-color: var(--brand); color: var(--brand);
}
.pagination-links .is-disabled { opacity: .45; cursor: not-allowed; }
.pagination-links .is-dots { border-color: transparent; background: transparent; }

/* ==========================================================================
   disclosure (row expander) — was <summary class="btn"> faking a button
   ========================================================================== */

details.expander > summary {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 5px var(--s-3);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; list-style: none; user-select: none;
  box-shadow: var(--shadow-xs);
  transition: background var(--t-fast) var(--ease);
}
details.expander > summary::-webkit-details-marker { display: none; }
details.expander > summary:hover { background: var(--surface-2); }
details.expander > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: 2px;
  border-right: 1.75px solid currentColor; border-bottom: 1.75px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t-fast) var(--ease);
}
details.expander[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
details.expander > .expander-body {
  margin-top: var(--s-3); padding: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md);
}

/* ==========================================================================
   misc utilities
   ========================================================================== */

.flex { display: flex; align-items: center; gap: var(--s-2); }
.flex-col { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.shrink { flex: none !important; min-width: 0 !important; }
.w-num { width: 5rem; }

/* Selection-aware bulk bar. Authored VISIBLE and only collapsed by :has(), so a
   browser without :has() support degrades to the old always-on bar rather than
   hiding the bulk actions entirely. Fail open, never closed. */
form:has(.devchk) .bulkbar { display: none; }
form:has(.devchk:checked) .bulkbar { display: flex; }

.mt { margin-top: var(--s-4); }
.mb { margin-bottom: var(--s-4); }
.mb-1 { margin-bottom: var(--s-1); }
.mt-lg { margin-top: var(--s-6); }
.mb-lg { margin-bottom: var(--s-6); }
.m-0 { margin: 0; }

.w-sm { max-width: 480px; }
.w-md { max-width: 680px; }
.w-lg { max-width: 860px; }

.code {
  font-family: ui-monospace, Consolas, "SF Mono", Monaco, monospace;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
pre.code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--s-3);
  white-space: pre-wrap; overflow-x: auto; margin: var(--s-2) 0 0;
}
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* locked state for the DNS-bound server box (was a JS style.opacity mutation) */
/* Read-only because a value is bound from elsewhere (e.g. the DNS pool). */
.is-locked {
  background: var(--surface-2);
  color: var(--text-2);
  cursor: not-allowed;
}

/* ==========================================================================
   login
   ========================================================================== */

.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: var(--s-5);
  background:
    radial-gradient(1000px 500px at 50% -10%, var(--brand-tint), transparent 70%),
    var(--bg);
}
.login-card { width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); padding: var(--s-7); }
.login-card .brand { justify-content: center; padding-top: 0; }
