/* HardenedOS admin — design tokens
   ----------------------------------------------------- */

:root {
  --bg-deep: #08080d;
  --bg: #0b0f14;
  --bg-soft: #111827;
  --bg-card: #161e2c;
  --bg-table-row: #131c2a;
  --line: #1f2a3d;
  --line-soft: #1a2332;
  --line-strong: #2a3a55;

  --fg: #e5e7eb;
  --fg-strong: #ffffff;
  --fg-mute: #94a3b8;
  --fg-dim: #6b7689;

  --accent: #7c5cff;
  --accent-2: #3b6dff;
  --accent-soft: rgba(124, 92, 255, 0.12);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --error: #ef4444;
  --error-soft: rgba(239, 68, 68, 0.12);

  /* Single neutral tier-badge color. Pre-v0.2 there were three —
     one per permission tier; v0.2 collapsed tiers into one
     capability set so every badge now uses --tier-standard. */
  --tier-standard: var(--accent);

  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.4);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--fg-strong); }

code { font-family: var(--mono); font-size: 0.92em; color: var(--fg); }

/* Sidebar layout
   ----------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-deep);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  /* Above .nav-backdrop (z-index: 6) so the backdrop's blur applies
     only to the main content, NOT to the sidebar slide-out itself. */
  z-index: 7;
}

.brand {
  display: flex;
  align-items: center;
  /* Tight gap matches the landing-page nav brand (web/landing/styles.css). */
  gap: 8px;
  color: var(--fg-strong);
  font-weight: 700;
  font-size: 30px;
  letter-spacing: -0.02em;
  padding: 6px 8px;
  margin-bottom: 26px;
}
.brand:hover { color: var(--fg-strong); }
.brand svg { width: 64px; height: 64px; }
/* "OS" suffix gets the same purple→blue gradient as the landing-page
   wordmark, so the admin brand matches /hardenedos.com. */
.brand .brand-name { font-weight: 700; }
.brand .brand-os {
  background: linear-gradient(110deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.sidebar nav a {
  color: var(--fg-mute);
  font-size: 14px;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 8px;
  transition: background 0.12s, color 0.12s;
}
.sidebar nav a:hover {
  color: var(--fg-strong);
  background: var(--bg-card);
}
.sidebar nav a.active {
  color: var(--fg-strong);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 92, 255, 0.3);
  padding: 8px 11px;
}

.sidebar-footer {
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reseller-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg-dim);
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-btn {
  background: none;
  border: none;
  color: var(--fg-mute);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 8px;
  text-align: left;
  border-radius: 6px;
  transition: color 0.12s, background 0.12s;
}
.link-btn:hover { color: var(--fg-strong); background: var(--bg-card); }

/* Language toggle button in the sidebar footer. Pill-shaped; shows
   the OTHER language code so the affordance is obvious. */
.lang-toggle-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg-mute);
  border-radius: 999px;
  padding: 4px 14px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.lang-toggle-btn:hover {
  color: var(--fg-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.content {
  margin-left: var(--sidebar-w);
  padding: 40px 48px 80px;
  max-width: 1200px;
}
body.no-nav .content {
  margin-left: 0;
  max-width: none;
  padding: 0;
}

/* Mobile: hamburger toggles a slide-out sidebar. The button + the
   backdrop both flip the `nav-open` class on <body>; CSS does the
   rest. ESC + backdrop click also close (admin.js wires those). */
.nav-hamburger {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 8;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-deep);
  color: var(--fg-strong);
  cursor: pointer;
  padding: 0;
}
.nav-hamburger span,
.nav-hamburger span::before,
.nav-hamburger span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.15s ease, top 0.2s ease;
}
.nav-hamburger span { position: relative; }
.nav-hamburger span::before { content: ""; position: absolute; top: -6px; left: 0; }
.nav-hamburger span::after  { content: ""; position: absolute; top:  6px; left: 0; }
body.nav-open .nav-hamburger span         { background: transparent; }
body.nav-open .nav-hamburger span::before { top: 0; transform: rotate(45deg);  }
body.nav-open .nav-hamburger span::after  { top: 0; transform: rotate(-45deg); }

.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 6;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
body.nav-open .nav-backdrop { display: block; }

@media (max-width: 880px) {
  .nav-hamburger { display: inline-flex; }

  /* Sidebar becomes a left-edge slide-out: hidden by default,
     translated in when body has .nav-open. */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: none;
    width: min(82vw, 280px);
    padding: 70px 16px 20px;   /* room for the hamburger up top */
  }
  body.nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 32px -10px rgba(0, 0, 0, 0.5);
  }

  .content { margin-left: 0; padding: 64px 20px 60px; }
}

/* Page chrome
   ----------------------------------------------------- */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.page-sub {
  color: var(--fg-mute);
  font-size: 14px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.panel-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-strong);
  letter-spacing: -0.01em;
}
.panel-body {
  padding: 22px;
  color: var(--fg-mute);
  font-size: 14px;
}
.panel-body p { margin-bottom: 10px; }
.panel-body p:last-child { margin-bottom: 0; }

.link {
  font-size: 13px;
  color: var(--fg-mute);
  font-weight: 500;
}
.link:hover { color: var(--accent); }

/* KPI grid
   ----------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.kpi {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  margin-bottom: 4px;
}
.kpi-sub {
  font-size: 13px;
  color: var(--fg-mute);
}

/* Tables
   ----------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}
.data-table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--fg);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-table-row); }

.tier-badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.14);
  border: 1px solid rgba(124, 92, 255, 0.4);
  color: var(--tier-standard);
}
/* Legacy tier-personal / tier-corporate / tier-government modifier
   classes existed pre-v0.2 to color-code the three permission tiers.
   v0.2 collapsed them into one capability set; the modifier classes
   inherit the base .tier-badge style and look identical. */
.tier-badge + .tier-badge { margin-left: 4px; }

/* Users page */
.user-anon { color: var(--fg-mute); font-style: italic; }
.user-meta { color: var(--fg-mute); font-size: 12px; }
.kpi-value-muted { color: var(--fg-mute); }

/* Table filter input — pairs with /static/table-filter.js */
.table-filter {
  width: 100%;
  max-width: 360px;
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font);
}
.table-filter:focus { outline: none; border-color: var(--accent); }
.table-filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}
.table-filter-row .table-filter-count {
  color: var(--fg-mute);
  font-size: 13px;
}

/* Branding preview — pared-down phone-shaped mockup that updates as
   the operator changes form fields. Companion to /static/branding-preview.js.
*/
.brand-preview-wrap {
  position: sticky;
  top: 24px;
  display: flex;
  justify-content: center;
  padding: 8px 0;
}
.brand-preview-phone {
  width: 240px;
  aspect-ratio: 9 / 19.5;
  background: linear-gradient(155deg, #25293a 0%, #0c0f17 100%);
  border-radius: 32px;
  padding: 7px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 24px 60px -16px rgba(0, 0, 0, 0.7);
}
.brand-preview-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-image: linear-gradient(180deg, #0a0d14 0%, #161e2c 100%);
  border-radius: 26px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: #fff;
}
.brand-preview-camera {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  background: #000;
  border-radius: 50%;
  z-index: 3;
}
.brand-preview-status {
  display: flex;
  justify-content: space-between;
  padding: 13px 18px 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}
.brand-preview-lock {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 22px 16px 18px;
  text-align: center;
}
.brand-preview-time {
  font-size: 52px;
  font-weight: 200;
  letter-spacing: -0.04em;
  margin-top: 22px;
  font-feature-settings: "tnum";
}
.brand-preview-date {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
}
.brand-preview-brand {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.brand-preview-logo {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-preview-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.brand-preview-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  background: rgba(124, 92, 255, 0.16);
  border: 1px solid rgba(124, 92, 255, 0.4);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 500;
  margin-top: 8px;
}
.brand-preview-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* Branding-page split: form on the left, mockup on the right */
.branding-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}
@media (max-width: 980px) {
  .branding-grid { grid-template-columns: 1fr; }
  .brand-preview-wrap { position: static; }
}

/* Sidebar sub-nav (e.g. Provision under Users) */
.sidebar nav a.sub-nav-item {
  padding-left: 22px;
  font-size: 13px;
  opacity: 0.78;
}
.sidebar nav a.sub-nav-item.active { opacity: 1; }

/* Wider textarea for the provisioning form */
form textarea {
  width: 100%;
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
}
form textarea:focus { outline: none; border-color: var(--accent); }

/* Empty states
   ----------------------------------------------------- */
.empty-state {
  background: var(--bg-card);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  color: var(--fg-mute);
}
.empty-state h2 {
  font-size: 18px;
  color: var(--fg-strong);
  margin-bottom: 8px;
  font-weight: 600;
}
.empty-hint {
  margin-top: 8px;
  font-size: 14px;
}

/* Forms
   ----------------------------------------------------- */
.form-grid {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-strong);
}
.form-row input[type="number"],
.form-row input[type="password"],
.form-row input[type="text"],
.form-row select {
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--fg-strong);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  transition: border-color 0.15s;
}
.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-row select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16'><path fill='%2394a3b8' d='M3.5 5.5 8 10l4.5-4.5z'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-help {
  font-size: 12px;
  color: var(--fg-mute);
  margin-top: 2px;
}
.form-actions {
  margin-top: 4px;
  display: flex;
  gap: 10px;
}

.btn-primary {
  background: linear-gradient(110deg, var(--accent), var(--accent-2));
  color: var(--fg-strong);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); opacity: 0.95; }
.btn-primary:active { transform: translateY(0); }

/* Alerts
   ----------------------------------------------------- */
.alert {
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  margin-bottom: 24px;
  border: 1px solid;
}
.alert-error {
  background: var(--error-soft);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--error);
}
.alert-success {
  background: var(--success-soft);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}
.alert strong { color: inherit; font-weight: 700; }

/* Impersonation banner (View-as-reseller)
   -----------------------------------------------------
   Rendered by layout.html when the session has Impersonator
   set. Fixed at the top so it's visible on every page; the
   `body.body-impersonating` class adds a corresponding padding-top
   so the page content doesn't slide under it. */
.impersonation-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;            /* above sidebar (10) and nav-backdrop (6) */
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
  color: #1a1505;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.25);
}
.impersonation-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 24px;
  max-width: 1400px;
  margin: 0 auto;
}
.impersonation-banner-icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.impersonation-banner-text {
  flex: 1;
  line-height: 1.35;
}
.impersonation-banner-text strong {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  background: rgba(26, 21, 5, 0.15);
  padding: 1px 7px;
  border-radius: 4px;
}
.impersonation-banner-form { margin: 0; flex-shrink: 0; }
.impersonation-banner-btn {
  background: rgba(26, 21, 5, 0.85);
  color: #fff5d6;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.impersonation-banner-btn:hover { background: #1a1505; color: #fff; }

/* Push every other piece of chrome below the banner. The banner is
   ~44px tall on desktop, more on mobile when the text wraps — we
   reserve a fixed 48px and let the inner content wrap naturally if
   needed (it stays one line at common widths). */
/* Sidebar already uses `top:0; bottom:0` so pushing only `top` is
   enough — `bottom:0` keeps it pinned to the viewport floor. */
body.body-impersonating { padding-top: 48px; }
body.body-impersonating .sidebar { top: 48px; }
body.body-impersonating .nav-hamburger { top: calc(14px + 48px); }

@media (max-width: 880px) {
  .impersonation-banner-inner {
    padding: 8px 14px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .impersonation-banner-text {
    font-size: 13px;
    min-width: 0;
    flex-basis: 100%;
    order: 2;
  }
  .impersonation-banner-icon { order: 1; }
  .impersonation-banner-form { order: 1; margin-left: auto; }
  body.body-impersonating { padding-top: 76px; }
  body.body-impersonating .sidebar { top: 76px; }
  body.body-impersonating .nav-hamburger { top: calc(14px + 76px); }
}

/* Status badges (internal admin)
   ----------------------------------------------------- */
.status-badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
}
.status-badge.status-active {
  background: var(--success-soft);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--success);
}
.status-badge.status-suspended {
  background: var(--error-soft);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--error);
}

/* Key box (one-time display of API keys etc.)
   ----------------------------------------------------- */
.key-box {
  background: var(--bg-deep);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-strong);
  white-space: pre;
  overflow-x: auto;
  user-select: all;
}

/* Internal-admin sidebar — same look as the reseller side. We used to
   tint this orange + show a ⚡ in the brand to differentiate, but the
   brand should match the landing-page wordmark consistently. The
   "internal" status is conveyed via the sidebar-footer label
   ("internal admin") instead. */

/* Login page
   ----------------------------------------------------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(circle at 30% 20%, rgba(124, 92, 255, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(59, 109, 255, 0.10) 0%, transparent 40%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg-strong);
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 28px;
}
.login-brand:hover { color: var(--fg-strong); }
.login-brand svg { width: 26px; height: 26px; }

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.login-lede {
  color: var(--fg-mute);
  font-size: 14px;
  margin-bottom: 24px;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
}
.login-card label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-strong);
}
.login-card input {
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--fg-strong);
  font-family: var(--mono);
  font-size: 13px;
  padding: 12px 14px;
  transition: border-color 0.15s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-card .btn-primary {
  margin-top: 6px;
  width: 100%;
  padding: 12px;
}
.login-help {
  font-size: 13px;
  color: var(--fg-mute);
  border-top: 1px solid var(--line-soft);
  padding-top: 18px;
}

/* Floating lang toggle for the login pages, where there's no sidebar
   to host the regular toggle. Top-right corner of the viewport. */
.login-lang-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
}

/* ───── Policy editor ─────────────────────────────────────────── */
.policy-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.policy-editor details.policy-cat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.policy-editor details.policy-cat[open] {
  border-color: var(--line-soft);
  background: var(--bg-soft);
}
.policy-editor details.policy-cat > summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  list-style: none;
  user-select: none;
}
.policy-editor details.policy-cat > summary::-webkit-details-marker { display: none; }
.policy-editor details.policy-cat > summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  margin-right: 6px;
  color: var(--fg-mute);
  transition: transform 0.15s;
}
.policy-editor details.policy-cat[open] > summary::before {
  transform: rotate(90deg);
}
.policy-editor .policy-cat-body {
  padding: 4px 14px 14px 14px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.policy-editor .policy-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.policy-editor .policy-row label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}
.policy-editor .policy-row input,
.policy-editor .policy-row select,
.policy-editor .policy-row textarea {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font-size: 13px;
  padding: 8px 10px;
  font-family: inherit;
}
.policy-editor .policy-row input:focus,
.policy-editor .policy-row select:focus,
.policy-editor .policy-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.policy-editor .policy-row .form-help {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: var(--fg-mute);
}
.policy-editor .policy-geofence {
  display: flex;
  gap: 6px;
}
#policy-raw-cat {
  margin-top: 6px;
  border-style: dashed;
}
