/* ==========================================================================
   TableSide admin visual standard. THE single source of truth.

   Every admin page loads this sheet LAST in <head> (after app.css, luxe.css
   and any page sheet), so a page that loads it matches the CRM by default and
   a page never hardcodes its own font, size or colour again. If a page needs a
   value that is not here, add a token HERE, do not write a literal in the page.

   The look (measured majority of the CRM, audit 2026-10-18):
     headings  Playfair Display 600   page title 20px, section 15px, subhead 14px
     body      Libre Franklin 400     13px / 1.6, smallest text 11px
     buttons   Libre Franklin 600     12px
     spacing   4px grid
     green     #1F433D, one green everywhere

   api/lib/__tests__/adminVisualStandard.test.js fails the build if a page does
   not load this sheet, or if a stylesheet / page declares a family, a green or
   a sub-11px size of its own.
   ========================================================================== */

:root {
  /* ---- Colour: one green --------------------------------------------- */
  /* The one green. app.css (--forest, --ink) and tokens.css (--ts-*) carry the same value; the dark theme overrides those, which is why they are not redefined here. */
  --std-green:   #1F433D;

  /* ---- Families ------------------------------------------------------ */
  --font-sans:  'Libre Franklin', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --std-font-body:    var(--font-sans);
  --std-font-heading: var(--font-serif);
  --ts-font-sans:  var(--font-sans);
  --ts-font-serif: var(--font-serif);

  /* ---- Type scale ---------------------------------------------------- */
  --std-title:    20px;   /* page title: h1, .lux-title */
  --std-section:  15px;   /* section title: h2 */
  --std-subhead:  14px;   /* card / subhead title: h3 */
  --std-body:     13px;   /* body, tables, forms, lists */
  --std-table:    12px;   /* dense table cells (body stays 13px) */
  --std-small:    11px;   /* smallest text anywhere: labels, chips, table headers */
  --std-button:   12px;   /* every button, tab and chip */
  --std-heading-weight: 600;
  --std-body-weight:    400;
  --std-button-weight:  600;
  --std-line:     1.6;
  --std-line-heading: 1.2;
  --std-line-dense: 1.45;  /* tables, controls, chips, tiles */
  --std-metric:   18px;   /* big metric number */
  --std-metric-sm: 15px;

  /* Legacy scale names, pinned to the standard so old rules follow it. */
  --fs-xs:   var(--std-small);
  --fs-sm:   var(--std-small);
  --fs-base: var(--std-body);
  --fs-md:   var(--std-body);
  --fs-lg:   var(--std-section);
  --fs-xl:   var(--std-title);
  --fs-2xl:  24px;

  --lux-display:  var(--std-title);
  --lux-h2:       var(--std-section);
  --lux-kpi:      var(--std-metric);
  --lux-kpi-sm:   var(--std-metric-sm);
  --lux-body:     var(--std-body);
  --lux-eyebrow:  var(--std-small);

  /* ---- Spacing: 4px grid --------------------------------------------- */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --ts-sp-1: var(--space-1);
  --ts-sp-2: var(--space-2);
  --ts-sp-3: var(--space-3);
  --ts-sp-4: var(--space-4);
  --ts-sp-5: var(--space-5);
  --ts-sp-6: var(--space-6);
  --ts-sp-8: var(--space-8);

  /* ---- Controls ------------------------------------------------------ */
  --ts-bottom-nav-h: calc(66px + env(safe-area-inset-bottom)); /* 11px labels (was 10px) make the phone nav 4px taller */
  --std-control-h:        32px;   /* desktop minimum for a button / field */
  --std-control-h-touch:  44px;   /* coarse pointers (phones, tablets) */
}

/* ---- Base ------------------------------------------------------------ */
html, body {
  font-family: var(--std-font-body);
  font-size: var(--std-body);
  font-weight: var(--std-body-weight);
  line-height: var(--std-line);
}

h1, h2, h3, h4,
.lux-title, .serif {
  font-family: var(--std-font-heading);
  font-weight: var(--std-heading-weight);
  line-height: var(--std-line-heading);
  color: var(--forest-text, var(--std-green));
}
h1, .lux-title { font-size: var(--std-title); }
h2             { font-size: var(--std-section); }
h3, h4         { font-size: var(--std-subhead); }

/* Section and card titles that are classes, not headings. */
.lux-section-title, .lux-h2, .section-title, .card-title {
  font-family: var(--std-font-heading);
  font-size: var(--std-section);
  font-weight: var(--std-heading-weight);
}

/* Form controls and bare buttons inherit the page font, so none falls back to
   the browser default (Arial). */
button, input, select, textarea, optgroup {
  font-family: var(--std-font-body);
}
button { font-size: var(--std-button); font-weight: var(--std-button-weight); }
input, select, textarea { font-size: var(--std-body); }

.btn, a.btn, button.btn, .btn.sm, .tab, .chip,
button.tab, button.chip, .sortby-dir {
  font-family: var(--std-font-body);
  font-size: var(--std-button);
  font-weight: var(--std-button-weight);
}

/* Table headers and small labels: 11px floor. */
th, label, small, .eyebrow, .lux-eyebrow, .muted-label {
  font-size: max(var(--std-small), 11px);
}

/* Nothing on screen is smaller than the floor. */
.tiny, .xs, .fine, .hint-sm { font-size: var(--std-small); }

/* ---- Phone / touch: one rule, not one per page ------------------------ */
@media (pointer: coarse) {
  .btn, button.btn, a.btn, .tab, button.tab {
    min-height: var(--std-control-h-touch);
  }
  input:not([type=checkbox]):not([type=radio]), select, textarea {
    font-size: 16px;            /* stops iOS zooming on focus */
    min-height: var(--std-control-h-touch);
    box-sizing: border-box;
  }
}

/* ---- Media never outgrows its column ---------------- */
img, svg, video, canvas { max-width: 100%; }

/* ---- Bookkeeping second-level sub-strip (moved from the retired redesign.css) ---- */
.bk-subnav.bk-subnav-2 {
  margin-top: -10px;
  margin-bottom: 16px;
  padding-top: 2px;
  padding-bottom: 10px;
  border-bottom: 0.5px solid var(--ts-cream-deep);
  gap: 12px;
}
.bk-subnav.bk-subnav-2 a { font-size: var(--std-button); opacity: 0.92; }
.bk-subnav.bk-subnav-2 a.active { opacity: 1; }

/* ---- Utilities extracted from the inline styles in campaigns.html (one class per repeated declaration set). !important keeps the inline-style precedence they had. ---- */
.cu-1 { font-size:12px !important; }
.cu-2 { font-size:11px !important; }
.cu-3 { margin-bottom:10px !important; }
.cu-4 { display:flex !important;align-items:center !important;gap:6px !important;text-transform:none !important;font-weight:normal !important;color:var(--ink-2) !important;font-family:var(--font-sans) !important;font-size:13px !important;letter-spacing:0 !important; }
.cu-5 { font-size:11px !important;margin-top:2px !important; }
.cu-6 { color:#b34450 !important; }
.cu-7 { margin:0 !important; }
.cu-8 { font-size:12px !important;margin-bottom:10px !important; }
.cu-9 { text-align:right !important; }
.cu-10 { font-size:11px !important;margin-top:3px !important; }
.cu-11 { margin:0 0 4px 0 !important;font-family:var(--font-serif) !important;font-size:14px !important;color:var(--forest) !important; }
.cu-12 { margin-top:14px !important; }
.cu-13 { font-size:11px !important;text-transform:uppercase !important;letter-spacing:0.06em !important;display:block !important; }
.cu-14 { font-weight:600 !important; }
.cu-15 { margin-top:0 !important; }
.cu-16 { font-weight:500 !important;font-size:11px !important; }
.cu-17 { margin-bottom:6px !important; }
.cu-18 { margin-top:10px !important; }
.cu-19 { grid-column:1 / -1 !important; }
.cu-20 { margin-bottom:4px !important; }
.cu-21 { font-size:13px !important; }
.cu-22 { font-size:12px !important;margin-bottom:8px !important; }
.cu-23 { text-align:center !important; }
.cu-24 { display:flex !important;flex-direction:column !important;gap:12px !important;padding:16px !important; }
.cu-25 { height:16px !important;width:80% !important; }
.cu-26 { height:16px !important;width:70% !important; }
.cu-27 { font-size:11px !important;margin-bottom:6px !important; }
.cu-28 { margin-bottom:18px !important; }
.cu-29 { display:flex !important;flex-wrap:wrap !important;gap:8px !important;margin-bottom:10px !important;align-items:center !important; }
.cu-30 { margin-top:6px !important; }
.cu-31 { text-align:left !important;padding:6px 8px !important; }
.cu-32 { font-size:22px !important;font-weight:600 !important; }
.cu-33 { display:none !important; }
.cu-34 { font-size:11px !important;margin-top:8px !important; }
.cu-35 { font-size:11px !important;margin-top:4px !important; }
.cu-36 { margin-bottom:8px !important; }
.cu-37 { padding:6px 8px !important; }
.cu-38 { margin-bottom:14px !important; }
.cu-39 { margin:0 0 10px 0 !important;font-family:var(--font-serif) !important;color:var(--forest) !important;font-size:15px !important; }
.cu-40 { white-space:nowrap !important; }
.cu-41 { font-size:12px !important;word-break:break-word !important; }
.cu-42 { margin-top:8px !important; }
.cu-43 { font-weight:600 !important;font-size:13px !important;margin-bottom:4px !important; }
.cu-44 { display:flex !important;gap:8px !important;margin-top:10px !important;flex-wrap:wrap !important; }
.cu-45 { height:20px !important;width:60% !important; }
.cu-46 { height:16px !important;width:45% !important; }
.cu-47 { height:24px !important;width:40% !important; }
.cu-48 { height:16px !important;width:60% !important; }
.cu-49 { display:flex !important;flex-wrap:wrap !important;gap:18px !important; }
.cu-50 { margin-top:18px !important;padding:14px !important;background:rgba(198,136,69,0.07) !important;border-left:3px solid #c68845 !important;border-radius:6px !important; }
.cu-51 { grid-template-columns:1fr 1fr !important;gap:10px !important; }
.cu-52 { display:flex !important;align-items:center !important;gap:8px !important;text-transform:none !important;font-weight:normal !important;color:var(--ink-2) !important;font-family:var(--font-sans) !important;font-size:13px !important;letter-spacing:0 !important;margin-top:14px !important; }
.cu-53 { display:flex !important;align-items:center !important;gap:8px !important;text-transform:none !important;font-weight:600 !important;color:var(--ink) !important;font-family:var(--font-sans) !important;font-size:13px !important;letter-spacing:0 !important; }
.cu-54 { display:none !important;flex-direction:column !important;gap:6px !important;margin-left:24px !important; }
.cu-55 { display:none !important;margin-left:24px !important;font-size:12px !important;color:var(--forest) !important; }
.cu-56 { font-family:var(--font-serif) !important;font-size:19px !important;font-weight:700 !important;color:#1F433D !important; }
.cu-57 { font-family:var(--font-serif) !important;font-style:italic !important;font-size:13px !important;color:#5C5C5C !important;margin-top:4px !important; }
.cu-58 { background:#E1F5EE !important;border:1px solid rgba(45,122,79,0.2) !important;border-radius:8px !important;padding:10px 12px !important;margin-top:10px !important; }
.cu-59 { font-size:var(--std-small) !important;font-weight:700 !important;letter-spacing:0.1em !important;text-transform:uppercase !important;color:#2d7a4f !important; }
.cu-60 { font-size:13px !important;font-weight:600 !important;color:#1F433D !important;margin-top:3px !important; }
.cu-61 { background:rgba(31,67,61,0.05) !important;padding:8px 10px !important;border-radius:8px !important; }
.cu-62 { font-size:var(--std-small) !important;font-weight:700 !important;letter-spacing:0.1em !important;text-transform:uppercase !important;color:rgba(31,67,61,0.55) !important; }
.cu-63 { margin-top:12px !important; }
.cu-64 { font-family:var(--font-serif) !important;font-size:12px !important;color:#1F433D !important;font-weight:600 !important;margin-bottom:6px !important; }
.cu-65 { display:flex !important;gap:8px !important;align-items:center !important;font-size:11px !important;margin-bottom:4px !important; }
.cu-66 { width:20px !important;height:20px !important;border-radius:50% !important;background:#2d7a4f !important;color:#fff !important;display:flex !important;align-items:center !important;justify-content:center !important;font-weight:700 !important;font-size:var(--std-small) !important;flex-shrink:0 !important; }
.cu-67 { display:grid !important;grid-template-columns:1fr 1fr !important;gap:8px !important;font-size:13px !important; }
.cu-68 { margin:16px !important; }
.cu-69 { width:100% !important; }
.cu-70 { color:var(--good) !important; }
.cu-71 { padding:0 !important; }
.cu-72 { font-size:11px !important;font-weight:400 !important; }
.cu-73 { display:flex !important;gap:10px !important;align-items:flex-start !important;padding:8px 4px !important;border-bottom:1px solid var(--line) !important;font-size:12px !important;cursor:pointer !important; }
.cu-74 { flex:1 !important;min-width:0 !important; }
.cu-75 { margin-left:6px !important; }
.cu-76 { display:flex !important;justify-content:space-between !important;align-items:center !important;padding:6px 4px !important;border-bottom:1px solid var(--line) !important;font-size:12px !important; }
.cu-77 { padding:24px 16px !important; }
.cu-78 { font-family:ui-monospace,Menlo,Consolas,monospace !important;font-size:11px !important;word-break:break-all !important; }
.cu-79 { margin-top:10px !important;background:rgba(26,47,26,0.04) !important;border:1px solid var(--line) !important;border-radius:8px !important;padding:12px !important; }
.cu-80 { padding:20px !important; }
.cu-81 { font-size:var(--std-small) !important;padding:1px 6px !important;margin-left:6px !important; }
.cu-82 { margin-right:8px !important; }
.cu-83 { padding:10px 12px !important;border:1px dashed var(--line) !important;border-radius:8px !important; }
.cu-84 { font-size:11px !important;margin:10px 0 4px !important; }
.cu-85 { display:flex !important;flex-wrap:wrap !important;gap:6px !important; }
.cu-86 { font-size:12px !important;margin-top:10px !important; }

/* ---- Headings inside the page body follow the same scale as the page titles.
   The #main prefix is what lets this win over a page's own class rule; a
   heading that must differ (a dialog, a hero number) uses a class, not an h-tag. ---- */
#main h1 { font-family: var(--std-font-heading); font-size: var(--std-title); font-weight: var(--std-heading-weight); }
#main h2 { font-family: var(--std-font-heading); font-size: var(--std-section); font-weight: var(--std-heading-weight); }
#main h3 { font-family: var(--std-font-heading); font-size: var(--std-subhead); font-weight: var(--std-heading-weight); }

/* ---- Dense UI keeps a tighter line box than running text. Body copy is 1.6;
   tables, controls, chips and tiles are not paragraphs, and at 1.6 a screen of
   rows loses a fifth of its height. ---- */
table, th, td, .btn, button, input, select, textarea, label, .tab, .chip, .pill, .badge, .kpi, .lux-kpi, .lux-header, .lux-sub {
  line-height: var(--std-line-dense);
}

/* Header band: a touch tighter than luxe.css so the larger standard title costs no vertical space. */
.lux-header { padding: 10px 0 8px; margin-bottom: 8px; }

/* Phones: the header band gives back a few pixels so the first row stays above the fold. */
@media (max-width: 768px) {
  .lux-header { padding: 8px 0 6px; margin-bottom: 8px; }
  .lux-eyebrow { margin-bottom: 2px; }
  .lux-sub { margin-top: 2px; }
}

/* Secondary and helper lines sit between running text and dense UI. */
.muted, .hint, .sub, .meta, small, dd, dt, li { line-height: 1.5; }

/* Chrome keeps the geometry its offsets were written against (the staged dock sits above a 62px nav). */
.mobile-bottom-nav, .mobile-bottom-nav a, .sidebar, .topbar, .app-bar { line-height: var(--std-line-dense); }

/* Dense table cells are 12px; everything else in the body is 13px. */
table td { font-size: var(--std-table); }

/* Settings > Performance (admin/settings/performance.html) */
.perf-page { padding: 22px 28px 80px; max-width: 860px; }
.perf-card { background: var(--ts-white, #fff); border: 1px solid var(--ts-cream-deep); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; }
.perf-card h2 { margin: 0 0 6px; font-size: 16px; }
.perf-desc { margin: 0 0 10px; font-size: 13px; }
.perf-row { display: flex; gap: 8px; align-items: center; }
.perf-row input { width: 110px; min-height: 40px; box-sizing: border-box; font: inherit; padding: 8px 10px; border: 1px solid var(--ts-cream-deep); border-radius: 8px; }
.perf-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; font-size: 12.5px; }
.perf-msg.err { color: var(--bad); }
.city-row { flex-wrap: wrap; margin-bottom: 8px; }
.perf-page .ts-btn { min-height: 40px; padding: 8px 14px; }
.city-row input { width: 230px; max-width: 100%; }
.toast-stack { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 300; }
.toast { background: var(--ts-ink); color: white; padding: 10px 16px; border-radius: 8px; font-size: 13px; }
.toast.error { background: var(--ts-coral); }
@media (max-width: 720px) {
  .perf-page { padding: 16px 14px 60px; }
  .toast-stack { left: 14px; right: 14px; bottom: 16px; }
}

/* Display density (Settings, Display and theme). Comfortable is the default
   token scale above. Compact tightens the shared spacing scale by about a
   quarter so more fits on screen, without any page needing its own rule. The
   choice is stored on the profile and follows the owner across devices. */
:root[data-density="compact"] {
  --space-1: 3px;
  --space-2: 6px;
  --space-3: 9px;
  --space-4: 12px;
  --space-5: 15px;
  --space-6: 18px;
  --space-7: 21px;
  --space-8: 24px;
}

/* The shell's phone search button is injected before ui-1103.css has loaded; until that sheet lands it must not sit on the page as a bare 16px icon. */
.u-phone-search { display: none; }
