/* ==========================================================================
   Pomio UI foundation (25-09-2026) -- tokens, primitives, app shell.
   Two palettes: Signal (light) and Voltage (dark). <html data-theme> always
   holds the RESOLVED palette (see src/ui/theme.js + theme-boot.js).
   Token map (short):
     surfaces  --bg --surface --surface-raised --surface-2 (subtle fill) --surface-3
     text      --text --muted --faint
     lines     --border --border-strong
     accent    --accent (#C8FF3D, both themes) --accent-hover --accent-soft
               --accent-ink (text ON lime) --accent-text (readable lime-family ink)
     trust     --trust (#0B3D91 navy: MFA/security/audit context only) --trust-soft
     status    --success/--warning/--danger (+ -text for AA text, -soft fills)
     tenant    --tenant-color (tenant brandColor; identity chip only, never CTAs)
   Compatibility aliases for older markup/JS: --text-muted --text-faint
   --accent-strong --accent-2.
   ========================================================================== */

@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/plus-jakarta-sans-latin-400-v5.3.0.woff2') format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/plus-jakarta-sans-latin-500-v5.3.0.woff2') format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/plus-jakarta-sans-latin-600-v5.3.0.woff2') format('woff2'); }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/plus-jakarta-sans-latin-700-v5.3.0.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/sora-latin-600-v5.3.0.woff2') format('woff2'); }
@font-face { font-family: 'Sora'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/sora-latin-700-v5.3.0.woff2') format('woff2'); }

:root {
  /* fixed brand values (same in both palettes) */
  --accent: #C8FF3D;
  --accent-hover: #D6FF6A;
  --accent-ink: #0F172A;
  --trust: #0B3D91;
  --success: #10B981;
  --warning: #F59E0B;

  --font-display: 'Sora', 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: ui-monospace, 'JetBrains Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --radius-control: 8px;
  --radius-button: 10px;
  --radius-card: 12px;
  --radius: 12px;
  --radius-pill: 999px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --header-h: 56px;
  --sidebar-w: 240px;
  --tap: 40px;
  --tap-primary: 44px;

  /* Signal (light) */
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-raised: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E2E8F0;
  --text: #0F172A;
  --muted: #64748B;
  --faint: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --accent-soft: rgba(200, 255, 61, 0.22);
  --accent-text: #3F6212;       /* lime-family ink that passes AA on white */
  --trust-soft: rgba(11, 61, 145, 0.08);
  --trust-text: #0B3D91;
  --success-text: #047857;
  --success-soft: rgba(16, 185, 129, 0.12);
  --warning-text: #B45309;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #DC2626;
  --danger-text: #B91C1C;
  --danger-soft: rgba(220, 38, 38, 0.09);
  --input-bg: #FFFFFF;
  --overlay: rgba(15, 23, 42, 0.45);
  --shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 18px 48px rgba(15, 23, 42, 0.16);
  /* a lime ring alone is invisible on white: it gets a thin ink edge */
  --focus-edge: #0F172A;
  --tenant-color: #64748B;

  /* compatibility aliases */
  --text-muted: var(--muted);
  --text-faint: var(--faint);
  --accent-strong: var(--accent-text);
  --accent-2: var(--accent-text);
  color-scheme: light;
}

:root[data-theme="dark"] {
  /* Voltage (dark) */
  --bg: #0A0A0F;
  --surface: #14141C;
  --surface-raised: #1A1A24;
  --surface-2: #1A1A24;
  --surface-3: #24242F;
  --text: #FFFFFF;
  --muted: #9CA3AF;
  --faint: #6B7280;
  --border: #2A2A34;
  --border-strong: #3A3A46;
  --accent-soft: rgba(200, 255, 61, 0.16);
  --accent-text: #C8FF3D;
  --trust-soft: rgba(96, 140, 230, 0.16);
  --trust-text: #9DB8F2;
  --success-text: #34D399;
  --success-soft: rgba(16, 185, 129, 0.16);
  --warning-text: #FBBF24;
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger: #F87171;
  --danger-text: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --input-bg: #14141C;
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-pop: 0 24px 60px rgba(0, 0, 0, 0.55);
  --focus-edge: transparent;
  color-scheme: dark;
}

/* no-JS fallback: follow the system until theme-boot.js has run */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0A0A0F; --surface: #14141C; --surface-raised: #1A1A24; --surface-2: #1A1A24; --surface-3: #24242F;
    --text: #FFFFFF; --muted: #9CA3AF; --faint: #6B7280; --border: #2A2A34; --border-strong: #3A3A46;
    --accent-soft: rgba(200, 255, 61, 0.16); --accent-text: #C8FF3D; --input-bg: #14141C;
    --danger: #F87171; --danger-text: #F87171; --focus-edge: transparent;
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: 2px; }
code, kbd, samp, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--focus-edge);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: 0 0 0 1px var(--focus-edge); }

/* ---------------------------------------------------------------- buttons */
.btn, .btn-primary, .btn-ghost, .btn-danger-solid {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 8px 16px;
  border-radius: var(--radius-button); border: 1px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1.2; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-primary.btn-danger, .btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #FFFFFF; box-shadow: none; }
:root[data-theme="dark"] .btn-primary.btn-danger, :root[data-theme="dark"] .btn-danger-solid { color: #0F172A; }
.btn-primary:disabled, .btn-ghost:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: var(--radius-control); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.btn-link { background: none; border: none; padding: 0; color: var(--accent-text); text-decoration: underline; cursor: pointer; font: inherit; font-weight: 600; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap);
  border-radius: var(--radius-control); border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg, .nav-ico svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- inputs */
.input, .select, .field input, .field select, .field textarea, .search-input {
  width: 100%; min-height: var(--tap); padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-control);
  background: var(--input-bg); color: var(--text); font-size: 14px; outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field textarea { min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .field input:focus, .field select:focus, .field textarea:focus, .search-input:focus {
  border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft);
}
::placeholder { color: var(--faint); opacity: 1; }
.field { margin-bottom: 14px; }
.field label, .section-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.hint { font-size: 13px; color: var(--muted); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* ---------------------------------------------------------------- segmented + tabs */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-button); }
.segmented button, .views button {
  min-height: 34px; padding: 6px 12px; border: none; background: transparent; color: var(--muted);
  border-radius: var(--radius-control); font-weight: 600; font-size: 13px;
}
.segmented button[aria-pressed="true"], .segmented button.active, .views button.active {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 -2px 0 var(--accent);
}
.segmented button:hover:not([aria-pressed="true"]):not(.active), .views button:hover:not(.active) { color: var(--text); }
.views { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-button); }
.views button:disabled { opacity: .45; cursor: not-allowed; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab {
  flex: none; padding: 10px 14px; border: none; background: none; color: var(--muted); font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active, .tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

/* chips / pills */
.chip, .filter-tabs button, .filter-toggle, .tl-filter, .ua-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 600;
}
.chip:hover, .filter-tabs button:hover, .filter-toggle:hover, .tl-filter:hover, .ua-chip:hover { background: var(--surface-2); }
.chip.active, .chip[aria-pressed="true"], .filter-tabs button.active, .filter-toggle[aria-pressed="true"], .tl-filter.active, .ua-chip.active {
  background: var(--accent-soft); border-color: var(--accent-text); color: var(--text);
}
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- badges / status pills */
.badge, .ua-badge, .stage-pill, .badge-archived, .pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-accent, .stage-pill { background: var(--accent-soft); color: var(--text); border-color: transparent; }
.badge-success, .badge-done { background: var(--success-soft); color: var(--success-text); border-color: transparent; }
.badge-warning, .badge-archived { background: var(--warning-soft); color: var(--warning-text); border-color: transparent; }
.badge-danger { background: var(--danger-soft); color: var(--danger-text); border-color: transparent; }
.badge-trust { background: var(--trust-soft); color: var(--trust-text); border-color: transparent; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; flex: none; }
.status-dot.ok { background: var(--success); } .status-dot.warn { background: var(--warning); } .status-dot.bad { background: var(--danger); }

/* ---------------------------------------------------------------- cards / panels */
.card-panel, .settings-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow); padding: 20px;
}
.icon-tile { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--text); flex: none; }
.icon-tile svg { width: 20px; height: 20px; }
.icon-tile.trust { background: var(--trust-soft); color: var(--trust-text); }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; }
th, td { text-align: left; padding: 10px 14px; font-size: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface-2); }
tr:last-child td { border-bottom: none; }
tr.row-clickable { cursor: pointer; }
tr.row-clickable:hover td { background: var(--surface-2); }

/* ---------------------------------------------------------------- dialog / drawer / overlay */
.overlay, .ua-backdrop { position: fixed; inset: 0; background: var(--overlay); display: none; z-index: 90; }
.overlay.show, .ua-backdrop.show { display: block; }
.ua-backdrop { z-index: 115; }
.modal, .ua-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px; width: 460px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px);
  overflow-y: auto; box-shadow: var(--shadow-pop); z-index: 110; display: none;
}
.ua-modal { z-index: 120; width: 500px; }
.modal.show, .ua-modal.show { display: block; }
.modal h2, .ua-modal h2 { font-size: 18px; margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: 460px; max-width: 94vw;
  background: var(--surface-raised); color: var(--text); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop); transform: translateX(100%); transition: transform .2s ease; z-index: 100; overflow-y: auto;
}
.drawer.show { transform: translateX(0); }
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; background: var(--surface-raised); border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 17px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.drawer-body { padding: 18px 20px 28px; }

/* ---------------------------------------------------------------- empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state .icon-circle { width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; font-size: 24px; }
.empty-state h3 { margin: 0 0 6px; font-size: 16px; }
.empty-state p { margin: 0; font-size: 14px; }

/* ---------------------------------------------------------------- toast */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast {
  background: var(--surface-raised); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; box-shadow: var(--shadow-pop); padding: 12px 14px; font-size: 14px; color: var(--text); animation: toast-in .18s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   App shell
   ========================================================================== */
.pomio-lockup { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); }
.pomio-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.04em; line-height: 1; }
.pomio-wordmark .dot { color: var(--accent-text); }
.product-chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px;
  background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; letter-spacing: .04em;
}

#app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 16px; padding: 16px 12px; position: sticky; top: 0; height: 100vh;
}
.sb-brand { padding: 4px 8px 0; }
.tenant-context {
  display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border);
  border-radius: var(--radius-card); background: var(--surface-2); min-width: 0;
}
.tenant-avatar {
  width: 32px; height: 32px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); overflow: hidden; font-weight: 700; font-size: 13px; color: var(--text);
  box-shadow: inset 0 -3px 0 var(--tenant-color);
}
.tenant-avatar img { width: 100%; height: 100%; object-fit: contain; background: #FFFFFF; }
.tenant-meta { min-width: 0; }
.tenant-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-sub { font-size: 12px; color: var(--muted); }

.navlist { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-tab {
  display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 8px 10px; border-radius: var(--radius-control);
  color: var(--muted); background: none; border: none; text-align: left; width: 100%; font-weight: 600; font-size: 14px;
  transition: background .12s ease, color .12s ease;
}
.nav-tab:hover { background: var(--surface-2); color: var(--text); }
.nav-tab.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav-ico { display: inline-flex; flex: none; }
.nav-count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--muted); border-radius: var(--radius-pill); padding: 1px 7px; line-height: 1.5; }
.nav-count + .nav-count { margin-left: 4px; }
.nav-count.alert { background: var(--danger-soft); color: var(--danger-text); }

.account { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.account-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 12px;
}
.account-meta { min-width: 0; }
.account-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-role { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .btn-ghost { width: 100%; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 60; height: var(--header-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.topbar-title h1 { font-size: 18px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.03em; }
.topbar-mobile-brand { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.lang-select {
  min-height: 36px; padding: 6px 30px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-control);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px;
}
.theme-seg button { min-height: 32px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px; }
.theme-seg svg { width: 15px; height: 15px; }

.bottom-nav { display: none; }
.sheet-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 140; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; background: var(--surface-raised); color: var(--text);
  border-top: 1px solid var(--border); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-pop);
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); max-height: 86vh; overflow-y: auto;
}
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 0 auto 12px; }
.sheet h2 { font-size: 15px; margin: 8px 0; }
.sheet .nav-tab { font-size: 15px; }
.sheet-group { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.sheet-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-row label { font-weight: 600; font-size: 14px; }

@media (max-width: 820px) {
  body { font-size: 15px; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; }
  .topbar-mobile-brand { display: flex; }
  .topbar-title h1 { font-size: 16px; }
  .topbar-actions .desktop-only { display: none; }
  input, select, textarea { font-size: 16px; }
  .modal, .ua-modal { width: auto; left: 12px; right: 12px; max-width: none; transform: translateY(-50%); padding: 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions > * { width: 100%; min-height: var(--tap-primary); }
  .drawer { width: 100%; max-width: none; border-left: none; }
  #toast-container { left: 12px; right: 12px; bottom: 84px; max-width: none; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 80; background: var(--surface);
    border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px -12px rgba(15, 23, 42, 0.25);
  }
  .bottom-nav .bn-item {
    flex: 1 1 0; min-width: 0; min-height: 52px; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: none; border: none; box-shadow: none; color: var(--muted); font-size: 11px; font-weight: 600; padding: 4px 2px; border-radius: var(--radius-control);
  }
  .bottom-nav .bn-item span:not(.nav-count):not(.nav-ico) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav .bn-item.active { color: var(--text); background: var(--accent-soft); }
  .bn-item .nav-count { position: absolute; top: 2px; left: 55%; font-size: 9px; line-height: 1.4; padding: 0 5px; margin: 0; }
  .nav-count-extra { display: none !important; }
}
@media (min-width: 821px) {
  .mobile-only { display: none !important; }
}

/* ==========================================================================
   Auth pages (login, forgot/change password, invite, admin sign-in)
   ========================================================================== */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 18px; }
.auth-top { width: 100%; max-width: 420px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); padding: 28px 28px 24px;
}
.auth-card h1 { font-size: 22px; letter-spacing: -0.03em; margin: 0 0 6px; }
.auth-card .auth-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin: 14px 0 6px; }
.auth-card input:not([type=checkbox]) {
  width: 100%; min-height: var(--tap-primary); padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-control); background: var(--input-bg); color: var(--text); font-size: 16px;
}
.auth-card input:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.auth-card .btn-primary { width: 100%; min-height: var(--tap-primary); margin-top: 20px; font-size: 15px; }
.auth-error:not(:empty), .auth-notice:not(:empty) { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-control); font-size: 14px; }
.auth-error:not(:empty) { background: var(--danger-soft); color: var(--danger-text); }
.auth-notice:not(:empty) { background: var(--trust-soft); color: var(--text); border-left: 3px solid var(--trust); }
.auth-links { margin-top: 16px; font-size: 14px; text-align: center; }
.auth-lang { min-height: 36px; padding: 6px 28px 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; }
@media (max-width: 480px) { .auth-card { padding: 22px 18px 20px; border-radius: 14px; } }

/* checkboxes/radios inside form fields keep their native size */
.field input[type=checkbox], .field input[type=radio], .settings-section input[type=checkbox], .settings-section input[type=radio] {
  width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0 6px 0 0; accent-color: var(--accent-text); vertical-align: middle; box-shadow: none;
}

/* S9-polish (01-10-2026): "© <jaar> Pomio CRM · Made in Europe" */
.pomio-footer { font-size: 12px; line-height: 1.5; color: var(--muted); color: color-mix(in srgb, var(--text) 72%, var(--bg)); text-align: center; overflow-wrap: anywhere; } /* ≥ 4.5:1 for small text in both themes (plain --muted is 4.39:1 on the light --bg) */
.pomio-footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.pomio-footer a:hover { color: var(--text); }
.auth-body > .pomio-footer { width: 100%; max-width: 420px; margin-top: 4px; }
.pomio-footer-app { font-size: 11px; text-align: left; padding: 2px 0 0; }
.sheet > .pomio-footer-app { text-align: center; padding: 8px 0 2px; }
