/* ============================================================
   SmartOS Design System — theme.css
   Single source of truth for all tokens, fonts, shell layout,
   and shared component classes.

   Colour palette from Smart Outdoor Brand Guidelines 2025:
     Shadow   #1a083c  — darkest dark
     Fuschia  #7225b1  — primary brand accent
     Illicit  #c175f9  — accent bright / gradient end
     Pouty    #e6d5f1  — soft accent tint

   Typefaces:
     Display / UI headings : Space Grotesk (Google Fonts)
     Body / secondary      : Poppins (Google Fonts)
     System fallback       : Aptos, sans-serif
     Monospace             : system ui-monospace stack
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Poppins:wght@300;400;500;600&display=swap');

/* ── Tokens ───────────────────────────────────────────────── */
:root {
  /* Fonts */
  --font-display: 'Space Grotesk', Aptos, sans-serif;
  --font-body:    'Poppins', Aptos, sans-serif;
  --font-mono:    ui-monospace, 'Cascadia Code', 'Fira Mono', 'Courier New', monospace;

  /* Dark chrome — sidebar, topbar */
  --ink-900: #1a083c;   /* Shadow — primary dark bg */
  --ink-800: #25104f;   /* raised dark (inputs on dark bg) */
  --ink-700: #2e1460;   /* hover states on dark */
  --ink-600: #3d1d7a;
  --ink-400: #8a7aaa;   /* muted text on dark */
  --ink-300: #c4b8e0;   /* body text on dark */
  --ink-100: rgba(255,255,255,0.08); /* subtle divider on dark */

  /* Light canvas — main content area */
  --canvas:          #F6F5F0;   /* warm off-white page bg */
  --canvas-raised:   #FFFFFF;   /* cards, tables, modals */
  --canvas-sunken:   #EEEDE6;   /* table headers, hover rows, wells */
  --hairline:        #E4E2D8;   /* default borders */
  --hairline-strong: #D4D2C6;   /* button borders, emphasised dividers */

  /* Text on light canvas */
  --text-primary:   #18211D;
  --text-secondary: #5A645F;
  --text-tertiary:  #8A9089;
  --text-dim:       #8A9089;   /* alias for --text-tertiary (legacy template strings) */

  /* Brand accent — Smart Outdoor Fuschia */
  --accent:       #7225b1;   /* primary accent */
  --accent-hover: #5a1a90;   /* pressed / hover */
  --accent-ink:   #FFFFFF;   /* text on accent */
  --accent-soft:  #e6d5f1;   /* Pouty — tinted backgrounds */
  --accent-light: #c175f9;   /* Illicit — gradient end, highlights */

  /* Neo Purple Gradient (sidebar flourish, icon bg) */
  --gradient-brand: linear-gradient(160deg, #1a083c 0%, #7225b1 60%, #c175f9 100%);

  /* Status colours (WCAG AA on light canvas) */
  --status-live:        #2E8B5C;
  --status-booked:      #B8860B;
  --status-available:   #4A6FA5;
  --status-maintenance: #A04545;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  56px;
  --logo-h-sidebar: 20px;
  --logo-h-light:   26px;

  /* Breakpoints (reference only — CSS doesn't evaluate custom props in @media).
     Convention across the app:
       <  640px  → mobile: card-list transforms, bottom tab bar, bottom sheets.
       640–1024  → tablet: keep desktop density (sidebar + tables).
       ≥ 1024px  → desktop.
     Use these exact values in media queries so the breakpoints stay consistent. */
  --bp-mobile: 640px;
  --bp-tablet: 1024px;

  /* Mobile shell dimensions */
  --mobile-topbar-h: 50px;
  --mobile-tabbar-h: 56px;
}

/* ── Reset basics ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Focus rings ──────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Shell layout ─────────────────────────────────────────── */
.so-shell {
  display: flex;
  min-height: 100dvh;
  font-family: var(--font-body);
  background: var(--canvas);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
}

/* Sidebar */
.so-sidebar {
  width: var(--sidebar-w);
  min-height: 100dvh;
  background: var(--ink-900);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease;
}

/* Desktop sidebar collapse */
.so-sidebar.collapsed {
  width: 60px !important;
}
.so-sidebar.collapsed .so-brand-logo { display: none; }
.so-sidebar.collapsed .so-brand-icon { display: block; }
.so-sidebar.collapsed .so-brand-text  { display: none; }
/* Hide every label, section heading, footer email, and the "Sign out" text. */
.so-sidebar.collapsed .so-nav-item .nav-label,
.so-sidebar.collapsed .so-nav-item > span:not(.nav-icon),
.so-sidebar.collapsed .so-nav-section,
.so-sidebar.collapsed .so-user-email,
.so-sidebar.collapsed .so-signout span,
.so-sidebar.collapsed .so-signout-label { display: none !important; }
.so-sidebar.collapsed .so-nav-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}
.so-sidebar.collapsed .so-nav-item .nav-icon {
  width: 24px;
  height: 24px;
  margin: 0;
}
.so-sidebar.collapsed .so-nav-item .nav-icon svg {
  width: 22px;
  height: 22px;
}
.so-sidebar.collapsed .so-sidebar-footer { padding: 10px 0; display: flex; justify-content: center; }
.so-sidebar.collapsed .so-brand { justify-content: center; padding: 14px 8px; }
/* Pad the bottom of the sidebar so nav items don't sit underneath the
   floating toggle button. */
.so-sidebar { padding-bottom: 64px; }

/* Collapse toggle button — appended to <body> with position:fixed so it
   can't be hidden behind the sidebar's "Sign out" link or clipped by
   overflow:hidden. Sits at the bottom-left corner of the sidebar.
   Uses explicit colours (no CSS var fallbacks) so it renders identically
   on every browser/OS, including Windows Edge/Chrome where var() with
   long fallback chains has been observed to render the button invisible. */
.sidebar-collapse-btn {
  position: fixed !important;
  bottom: 16px;
  left: 224px; /* var(--sidebar-w) is 240; place 16px in from the right edge */
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #2B1066; /* SmartOutdoor primary so it always pops against any bg */
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #2B1066;
  z-index: 99999;
  transition: left 0.2s ease, background 0.15s, color 0.15s;
  line-height: 1;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  /* Belt-and-braces against parent transforms / opacity */
  opacity: 1 !important;
  visibility: visible !important;
}
.sidebar-collapse-btn:hover {
  color: #ffffff;
  background: #2B1066;
}
/* When collapsed, the sidebar is 60px wide. Position the button just inside
   its right edge. */
.so-sidebar.collapsed ~ #sidebar-collapse-btn,
body:has(.so-sidebar.collapsed) #sidebar-collapse-btn {
  left: 44px;
}
/* Mobile-tablet: hide because mobile uses the bottom drawer instead. */
@media (max-width: 767px) {
  .sidebar-collapse-btn { display: none !important; }
}

.so-brand {
  padding: 18px 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--ink-100);
  flex-shrink: 0;
}
.so-brand-icon, .so-brand-glyph {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: block; /* always visible — pairs with .so-brand-text */
}
.so-brand-logo {
  height: var(--logo-h-sidebar);
  width: auto;
  object-fit: contain;
}

/* Two-tone text branding: "Smart" (white) + "Estate Planning" (accent light) */
.so-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 0;
}
.so-brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  letter-spacing: -0.01em;
}
.so-brand-sub {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: #c175f9;
  letter-spacing: 0.03em;
}

.so-nav {
  list-style: none;
  margin: 12px 0 0;
  padding: 0 8px;
  flex: 1;
}
.so-nav li { margin: 2px 0; }
.so-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-300);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.so-nav-item .nav-icon {
  font-size: 15px;
  width: 20px;
  height: 20px;
  text-align: center;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.so-nav-item .nav-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}
.so-nav-item:hover {
  background: var(--ink-700);
  color: #fff;
}
.so-nav-item.active {
  background: var(--ink-700);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--accent);
}

.so-nav-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-400);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: color .15s ease;
}
.so-nav-section:hover { color: var(--ink-300, #b9a8d6); }
.so-nav-section .nav-sec-chevron {
  display: inline-flex;
  opacity: .55;
  transition: transform .18s ease;
}
.so-nav-section .nav-sec-chevron svg { width: 13px; height: 13px; }
.so-nav-section.collapsed .nav-sec-chevron { transform: rotate(-90deg); }
/* mobile drawer section header: not clickable, no chevron affordance needed */
.mdrawer-section { cursor: default; justify-content: flex-start; }
.mdrawer-section .nav-sec-chevron { display: none; }

.so-sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--ink-100);
  flex-shrink: 0;
}
.so-user-email {
  display: block;
  font-size: 11.5px;
  color: var(--ink-400);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.so-signout {
  font-size: 12px;
  color: var(--ink-400);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 500;
}
.so-signout:hover { color: var(--ink-300); }

/* Canvas — right of sidebar */
.so-canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar */
.so-topbar {
  height: var(--topbar-h);
  background: var(--ink-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.so-breadcrumb {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.so-breadcrumb .bc-parent {
  color: var(--ink-400);
  font-weight: 400;
}
.so-breadcrumb .bc-sep {
  color: var(--ink-600);
  margin: 0 6px;
}
.so-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Main content */
.so-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* Light shell — client-facing pages (no sidebar) */
.so-light-shell {
  min-height: 100dvh;
  background: var(--canvas);
  font-family: var(--font-body);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.so-light-header {
  height: 60px;
  background: var(--canvas-raised);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  padding: 0 32px;
}
.so-light-header img { height: var(--logo-h-light); width: auto; }
.so-light-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

/* Responsive — slightly tighter sidebar on narrow laptops */
@media (max-width: 1280px) {
  :root { --sidebar-w: 200px; }
  .so-main { padding: 20px; }
  .so-topbar { padding: 0 18px; }
}

/* Below 768px (tablets / phones) collapse sidebar to icon strip with
   the billboard mark only. Desktop & laptop always show full sidebar. */
@media (max-width: 767px) {
  .so-sidebar { width: 60px; }
  .so-brand-logo,
  .so-brand-text,
  .so-nav-item > span,
  .so-nav-item .nav-label,
  .so-nav-section,
  .so-user-email,
  .so-signout { display: none; }
  .so-brand-icon { display: block; } /* show icon glyph only when sidebar is narrow */
  .so-brand { justify-content: center; padding: 14px 8px; }
  .so-nav-item { justify-content: center; padding: 10px; }
  .so-nav-item .nav-icon { width: auto; }
  .so-main { padding: 16px; }
}

/* ── Cards ────────────────────────────────────────────────── */
.so-card {
  background: var(--canvas-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: 20px;
}
.so-card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin: 0 0 6px;
}
.so-card-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}
.so-card-value.hero { color: var(--accent); }

/* ── Buttons ──────────────────────────────────────────────── */
.so-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13.5px;
  padding: 7px 15px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  text-decoration: none;
  transition: background 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.so-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Primary — dark, not purple */
.so-btn-primary { background: var(--ink-900); color: #fff; }
.so-btn-primary:hover:not(:disabled) { background: var(--ink-700); }

/* Accent — use sparingly (brand moments only) */
.so-btn-accent  { background: var(--accent); color: var(--accent-ink); }
.so-btn-accent:hover:not(:disabled) { background: var(--accent-hover); }

/* Ghost */
.so-btn-ghost {
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--text-primary);
}
.so-btn-ghost:hover:not(:disabled) { background: var(--canvas-sunken); }
/* Ghost buttons sitting on the dark topbar need light text/border to be legible
   (the default dark text disappears against --ink-900). */
.so-topbar .so-btn-ghost { color: rgba(255,255,255,0.85); border-color: rgba(255,255,255,0.22); }
.so-topbar .so-btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.45); color: #fff; }

/* Danger */
.so-btn-danger { background: #dc2626; color: #fff; }
.so-btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* Size variants */
.so-btn-sm { font-size: 12px;   padding: 5px 11px; }
.so-btn-md { font-size: 13.5px; padding: 7px 15px; } /* default */
.so-btn-lg { font-size: 15px;   padding: 10px 20px; }

/* Pill modifier — fully-rounded action buttons (used for inline row/panel actions) */
.so-btn-pill { border-radius: 100px; }
/* A row of pill actions: wrap cleanly with a small gap, no text separators */
.so-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ── Tables ───────────────────────────────────────────────── */
.so-table-wrap {
  background: var(--canvas-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.so-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.so-table thead tr {
  background: var(--canvas-sunken);
  border-bottom: 1px solid var(--hairline);
}
.so-table th {
  padding: 9px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  text-align: left;
  white-space: nowrap;
}
.so-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-primary);
  vertical-align: middle;
}
.so-table tbody tr:last-child td { border-bottom: none; }
.so-table tbody tr:hover td { background: var(--canvas-sunken); }
.so-table .mono { font-family: var(--font-mono); font-size: 12.5px; }
.so-table .muted { color: var(--text-secondary); }

/* Row actions — hidden at rest, shown on row hover */
.so-table .row-actions { visibility: hidden; }
.so-table tbody tr:hover .row-actions { visibility: visible; }

/* ── Status tags ──────────────────────────────────────────── */
.so-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.so-tag::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.so-tag-live        { color: var(--status-live);         background: #E4F3EB; }
.so-tag-booked      { color: var(--status-booked);       background: #FDF3D8; }
.so-tag-available   { color: var(--status-available);    background: #E8EEF7; }
.so-tag-maintenance { color: var(--status-maintenance);  background: #F5E8E8; }
.so-tag-draft       { color: var(--text-tertiary);       background: var(--canvas-sunken); }

/* ── Forms / inputs ───────────────────────────────────────── */
.so-input,
.so-select,
.so-textarea {
  font-family: var(--font-body);
  font-size: 13.5px;
  background: var(--canvas-raised);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-primary);
  outline: none;
  width: 100%;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.so-input:focus,
.so-select:focus,
.so-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.so-input::placeholder,
.so-textarea::placeholder { color: var(--text-tertiary); }

/* Date/time inputs — strip Safari/WebKit's native control chrome so they match a plain
   .so-input box in height and don't spread the dd/mm/yyyy segments across the field or sit
   taller than the neighbouring selects (SmartFeedback #8). Blink honours the same rules, so
   Chrome and Safari render identically. Height/padding/width stay with the base + any modifier. */
.so-input[type="date"],
.so-input[type="datetime-local"],
.so-input[type="time"],
.so-input[type="month"] {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  min-height: 0;                 /* kill Safari's intrinsic min-height */
  line-height: 1.25;
}
.so-input[type="date"]::-webkit-date-and-time-value,
.so-input[type="datetime-local"]::-webkit-date-and-time-value,
.so-input[type="time"]::-webkit-date-and-time-value,
.so-input[type="month"]::-webkit-date-and-time-value { text-align: left; margin: 0; padding: 0; }
.so-input[type="date"]::-webkit-datetime-edit,
.so-input[type="datetime-local"]::-webkit-datetime-edit,
.so-input[type="time"]::-webkit-datetime-edit,
.so-input[type="month"]::-webkit-datetime-edit { padding: 0; line-height: 1.25; }
.so-input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.so-input::-webkit-inner-spin-button,
.so-input::-webkit-clear-button { display: none; -webkit-appearance: none; }
.so-input::-webkit-calendar-picker-indicator { margin: 0 0 0 6px; padding: 0; opacity: .5; cursor: pointer; }
.so-input::-webkit-calendar-picker-indicator:hover { opacity: .8; }

.so-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ── Page section headers ─────────────────────────────────── */
.so-page-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.so-page-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

/* Toolbar row (search + filters + actions) */
.so-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.so-toolbar .so-input { max-width: 280px; }

/* Stat card grid */
.so-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* Two-column layout utility that collapses to a single column on mobile
   (the <640 override lives in mobile.css). Use in place of hand-rolled
   `grid-template-columns:1fr …` blocks so every page stacks consistently. */
.so-cols { display: grid; gap: 16px; align-items: start; }
.so-cols-1-1 { grid-template-columns: 1fr 1fr; }
.so-cols-1-330 { grid-template-columns: 1fr 330px; }
.so-cols-1-360 { grid-template-columns: 1fr 360px; }

/* ── Divider ──────────────────────────────────────────────── */
.so-divider {
  border: none;
  border-top: 1px solid var(--hairline);
  margin: 20px 0;
}

/* ── Toast / notification strip ──────────────────────────── */
.so-toast-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

/* Individual toast (used by utils.js via #so-toast-host) */
.so-toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 9999;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: #fff;
  background: var(--ink-900);
  border: 1px solid var(--ink-700);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  box-shadow: 0 6px 24px rgba(26, 8, 60, 0.45);
  pointer-events: auto;
  max-width: min(420px, 90vw);
  transition: opacity .2s ease;
}
.so-toast-success { border-left: 3px solid var(--status-live); }
.so-toast-error   { border-left: 3px solid #dc2626; }
.so-toast-info    { border-left: 3px solid var(--accent-light); }

/* ── Empty states ─────────────────────────────────────────── */
.so-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  background: var(--canvas-raised);
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-md);
}
.so-empty-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.4;
}
.so-empty-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 4px;
}
.so-empty-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin: 0 0 16px;
}

/* ── Stale data / info banner ─────────────────────────────── */
.so-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #FDF3D8;
  color: #6b4a00;
  font-size: 13px;
  border-bottom: 1px solid #F0D98A;
}
.so-banner .so-banner-close {
  margin-left: auto;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: inherit;
  opacity: 0.6;
}
.so-banner .so-banner-close:hover { opacity: 1; }

/* ── Generic modal (.modal-bg + .modal) ─────────────────────
   Used by admin.html, poi-search.html and any page that wants a
   centred dialog. CSS lives globally so any page that includes
   theme.css renders it correctly. */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center; justify-content: center;
  padding: 24px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 9000;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--canvas-raised, #fff);
  border: 1px solid var(--hairline-strong, rgba(0,0,0,0.12));
  border-radius: var(--radius-lg, 10px);
  padding: 24px;
  max-width: 500px; width: 100%;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  position: relative;
}
.modal h3 {
  font-family: var(--font-display, system-ui, sans-serif);
  font-weight: 700;
  color: var(--text-primary, #18211d);
  margin: 0 0 12px;
  font-size: 16px;
}
.modal .close-btn {
  background: none; border: none;
  color: var(--text-tertiary, #888);
  cursor: pointer;
  font-size: 22px; line-height: 1;
  position: absolute; top: 12px; right: 14px;
}
.modal .close-btn:hover { color: var(--text-primary, #000); }

/* ── Branded modal header (Quick-Plan style) ────────────────
   Add <div class="so-modal-head"><h3>Title</h3><div class="sub">…</div></div>
   as the first child of .modal for a full-bleed gradient header. */
.so-modal-head {
  margin: -24px -24px 18px;
  padding: 18px 24px;
  background: linear-gradient(160deg, #1a083c 0%, #7225b1 60%, #c175f9 100%);
  border-radius: var(--radius-lg, 14px) var(--radius-lg, 14px) 0 0;
  color: #fff;
}
.so-modal-head h3 { margin: 0; color: #fff; font-size: 18px; font-family: var(--font-display); font-weight: 700; }
.so-modal-head .sub { margin-top: 3px; font-family: var(--font-body); font-weight: 400; font-size: 12.5px; color: rgba(255,255,255,0.82); }
.modal:has(.so-modal-head) .close-btn { color: rgba(255,255,255,0.85); }
.modal:has(.so-modal-head) .close-btn:hover { color: #fff; }

/* Consistent field spacing + labels in any form/modal */
.field { margin-bottom: 12px; }
.field > .so-label { display: block; margin-bottom: 5px; }

/* Right-aligned modal footer with a divider */
.modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--hairline, #e4e2d8);
}
@media (max-width: 639px) {
  .so-modal-head { margin: -20px -20px 16px; padding: 16px 20px; }
}

/* ════════════════════════════════════════════════════════════
   P12.F — Premium polish (additive; same SmartOS brand)
   Layered depth, smoother motion, calmer tables, nicer empties.
   ════════════════════════════════════════════════════════════ */
:root {
  --shadow-xs: 0 1px 2px rgba(26, 8, 60, 0.04);
  --shadow-sm: 0 1px 3px rgba(26, 8, 60, 0.06), 0 1px 2px rgba(26, 8, 60, 0.04);
  --shadow-md: 0 4px 16px rgba(26, 8, 60, 0.08), 0 1px 3px rgba(26, 8, 60, 0.05);
  --shadow-lg: 0 12px 32px rgba(26, 8, 60, 0.14);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Cards: soft elevation + hairline; clickable cards lift on hover. */
.so-card { box-shadow: var(--shadow-sm); transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease); }
.so-card:hover { box-shadow: var(--shadow-md); }
.so-card[href], a.so-card, .so-card.clickable { cursor: pointer; }
.so-card[href]:hover, a.so-card:hover, .so-card.clickable:hover { transform: translateY(-2px); border-color: var(--accent-soft); }
.kpi-card { box-shadow: var(--shadow-xs); transition: box-shadow .18s var(--ease), transform .18s var(--ease); }
.kpi-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }

/* Buttons: spring on press, accent gets a subtle branded shadow. */
.so-btn { transition: background .14s var(--ease), box-shadow .14s var(--ease), transform .08s var(--ease), opacity .14s var(--ease); }
.so-btn:active:not(:disabled) { transform: translateY(1px); }
.so-btn-accent { box-shadow: 0 2px 8px rgba(114, 37, 177, 0.24); }
.so-btn-accent:hover:not(:disabled) { box-shadow: 0 4px 14px rgba(114, 37, 177, 0.30); }
.so-btn-pill:hover:not(:disabled) { box-shadow: var(--shadow-sm); }

/* Tables: quieter header, gentle row hover, comfortable rhythm. */
.so-table thead th { background: var(--canvas-sunken); color: var(--text-tertiary); font: 600 11px var(--font-mono, monospace); letter-spacing: .04em; text-transform: uppercase; }
.so-table tbody tr { transition: background .12s var(--ease); }
.so-table tbody tr:hover { background: var(--canvas-sunken); }
.crm-table.dense tbody tr:hover { background: var(--accent-soft); }

/* Inputs: a touch more presence on focus (token already sets ring). */
.so-input, .so-select, .so-textarea { transition: border-color .14s var(--ease), box-shadow .14s var(--ease), background .14s var(--ease); }

/* Empty states: centred, calm, a little bigger. */
.so-empty { text-align: center; padding: 34px 20px; color: var(--text-tertiary); }
.so-empty-title { font: 600 14px var(--font-display, sans-serif); color: var(--text-secondary); }
.so-empty-sub { font-size: 12.5px; margin-top: 4px; }

/* Chips/pills: hairline for definition on light surfaces. */
.crm-chip { box-shadow: inset 0 0 0 1px rgba(26, 8, 60, 0.05); }

/* Page headers: tighten the type rhythm. */
.so-page-title { letter-spacing: -0.01em; }
.so-page-sub { color: var(--text-tertiary); }

@media (prefers-reduced-motion: reduce) {
  .so-card, .so-btn, .kpi-card, .so-table tbody tr, .so-input, .so-select, .so-textarea { transition: none; }
  .so-card[href]:hover, a.so-card:hover, .so-card.clickable:hover, .kpi-card:hover, .so-btn:active:not(:disabled) { transform: none; }
}
