/* ============================================================================
   OPSMERA app — variant overrides toggled by the in-app Appearance switcher.
   Always loaded; rules only bite when the body carries the class.
     body.theme-light  -> see light.css (white canvas, navy chrome)
     body.font-sans     -> headlines render in Manrope instead of Playfair
   ============================================================================ */

/* ---- Sans-serif headlines -------------------------------------------------
   Remap the display face to Manrope and re-tune: every heading references
   var(--font-display), so the swap cascades. We only adjust weight/tracking
   and re-express the italic emphasis as a weight jump (Manrope has no italic). */
body.font-sans { --font-display: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

body.font-sans .h-serif,
body.font-sans .dash-hero h1,
body.font-sans .card-h h3,
body.font-sans .det-head h2,
body.font-sans .drawer-h h2,
body.font-sans .field-copy h1,
body.font-sans .fa-body h2,
body.font-sans .motion h3,
body.font-sans .asst-hero h1,
body.font-sans .sugg h3,
body.font-sans .view-head h1 { font-weight: 600; letter-spacing: -.025em; }

body.font-sans .h-serif em,
body.font-sans .dash-hero h1 em,
body.font-sans .field-copy h1 em,
body.font-sans .fa-body h2 em,
body.font-sans .asst-hero h1 em { font-style: normal; font-weight: 800; letter-spacing: -.03em; }

/* ---- Canvas colour options (dark variants; mint accent stays consistent) --
   Only the navy surface tokens change, so the whole app recolours cohesively. */
body.canvas-graphite {
  --navy-900: #0E1116; --navy-800: #161B22; --navy-700: #1E242E;
  --navy-600: #2B333F; --navy-500: #38414F;
}
body.canvas-indigo {
  --navy-900: #0A0E2A; --navy-800: #141A40; --navy-700: #1D2454;
  --navy-600: #2B3576; --navy-500: #3A4691;
}

/* ---- Density: Compact (a layout lever) -----------------------------------
   Tightens the major paddings + gaps so more fits on screen. */
body.density-compact .wrap { padding: 18px 22px 30px; }
body.density-compact .dash-hero { padding: 20px 24px 16px; }
body.density-compact .dash-grid { padding: 16px 22px 30px; gap: 14px; }
body.density-compact .stack { gap: 14px; }
body.density-compact .card-h { padding: 12px 16px; }
body.density-compact .deadline { padding: 10px 16px; }
body.density-compact .mini-row { padding: 9px 16px; }
body.density-compact .in-row { padding: 11px 18px; }
body.density-compact .tbl tbody td { padding: 10px 16px; }
body.density-compact .tbl thead th { padding: 9px 16px; }
body.density-compact .sugg { padding: 13px 15px; }
body.density-compact .sugg-list { gap: 9px; padding: 14px 24px 34px; }
body.density-compact .motion { padding: 14px 18px; margin-bottom: 9px; }
body.density-compact .hero-pulse .cell { padding: 11px 16px; }
body.density-compact .det-body, body.density-compact .inv-body { gap: 16px; padding: 16px 22px; }

/* ---- Appearance switcher popover (rendered into <body> via portal) -------- */
.appearance-scrim { position: fixed; inset: 0; z-index: 60; }
.appearance-pop { position: fixed; top: 56px; right: 18px; z-index: 61; width: 336px;
  max-height: calc(100vh - 76px); overflow-y: auto;
  background: var(--navy-800); border: 1px solid var(--line-1); border-radius: 14px;
  padding: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 8px;
  transform-origin: top right; animation: apIn .2s var(--ease-out); }
body.theme-light .appearance-pop { box-shadow: 0 24px 60px rgba(11,37,69,.2); }
@keyframes apIn { from { opacity: 0; transform: scale(.94) translateY(-6px); } to { opacity: 1; transform: none; } }

.ap-top { display: flex; align-items: center; justify-content: space-between; }
.ap-h { font-family: var(--font-sans); font-weight: 600; font-size: 14px; color: var(--fg-1); display: flex; align-items: center; gap: 8px; }
.ap-h [data-lucide] { color: var(--mint-500); width: 15px; height: 15px; }
.ap-x { width: 26px; height: 26px; border: 0; background: transparent; color: var(--fg-3); border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ap-x:hover { color: var(--fg-1); background: rgba(255,255,255,.05); }
body.theme-light .ap-x:hover { background: rgba(11,37,69,.05); }
.ap-sub { font-size: 12px; color: var(--fg-3); margin-bottom: 8px; line-height: 1.4; }

.ap-group { display: flex; flex-direction: column; gap: 9px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.ap-glab { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-3); }
.ap-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.ap-card { position: relative; text-align: left; cursor: pointer; padding: 8px; border-radius: 10px;
  background: var(--navy-900); border: 1px solid var(--line-1); display: flex; flex-direction: column; gap: 9px;
  transition: transform var(--dur) var(--ease-out), border-color var(--dur), box-shadow var(--dur); }
.ap-card:hover { transform: translateY(-2px); border-color: var(--line-3); }
.ap-card.on { border-color: transparent; box-shadow: 0 0 0 2px var(--mint-500), 0 8px 22px rgba(51,212,153,.14); }
.ap-meta { padding: 0 2px 2px; }
.ap-name { font-size: 12.5px; color: var(--fg-1); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.ap-pill { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--mint-500); border: 1px solid rgba(51,212,153,.4); border-radius: 999px; padding: 1px 5px; }
.ap-desc { font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.ap-check { position: absolute; top: 7px; right: 7px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--mint-500); color: #06251a; display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.5); transition: all var(--dur) var(--ease-out); }
.ap-check [data-lucide] { width: 12px; height: 12px; stroke-width: 3; }
.ap-card.on .ap-check { opacity: 1; transform: none; }

/* mini app-chrome preview */
.mini { height: 56px; border-radius: 7px; overflow: hidden; display: flex; border: 1px solid var(--line-2); background: #0B2545; }
.mini-side { width: 16px; background: #081B33; display: flex; flex-direction: column; gap: 3px; padding: 6px 0; align-items: center; }
.mini-dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,.25); }
.mini-dot.mint { background: var(--mint-500); box-shadow: 0 0 5px rgba(51,212,153,.9); }
.mini-body { flex: 1; padding: 8px 9px; }
.mini-aa { font-family: var(--font-display); font-size: 15px; font-weight: 500; color: #F4F7FB; line-height: 1; }
.mini-bar { height: 3px; border-radius: 2px; background: rgba(255,255,255,.18); margin-top: 5px; }
.mini-bar.w1 { width: 80%; } .mini-bar.w2 { width: 55%; }
.mini-light { background: #FFFFFF; }
.mini-light .mini-side { background: #0B2545; }
.mini-light .mini-aa { color: #0B2545; }
.mini-light .mini-bar { background: rgba(11,37,69,.16); }

/* mini type preview */
.mini-type { align-items: center; justify-content: center; background: #0B2545; }
.mini-type span { font-size: 26px; color: #F4F7FB; line-height: 1; }
.mini-type.serif span { font-family: var(--font-display); font-weight: 500; font-style: italic; }
.mini-type.sans span { font-family: var(--font-sans); font-weight: 700; letter-spacing: -.02em; }
body.theme-light .mini-type { background: var(--navy-700); }
body.theme-light .mini-type span { color: #0B2545; }

.ap-trigger.on { color: var(--fg-1); border-color: var(--line-3); background: rgba(255,255,255,.05); }
body.theme-light .ap-trigger.on { background: rgba(255,255,255,.08); }

/* canvas colour swatch preview */
.mini-swatch { height: 50px; border-radius: 7px; overflow: hidden; display: flex; border: 1px solid var(--line-2); }
.mini-swatch .sw-side { width: 14px; }
.mini-swatch .sw-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 9px; }
.mini-swatch .sw-bar { height: 3px; border-radius: 2px; }
.mini-swatch .sw-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint-500); box-shadow: 0 0 6px rgba(51,212,153,.8); margin-bottom: 2px; }

/* density preview */
.mini-density { height: 50px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--navy-900);
  display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 8px 10px; }
.mini-density .dl { height: 4px; border-radius: 2px; background: rgba(140,152,173,.4); }
.mini-density.tight { gap: 2.5px; padding: 6px 10px; }
.mini-density.tight .dl { height: 3px; }

/* shortlist */
.ap-shortlist { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.ap-saverow { display: flex; gap: 8px; align-items: center; }
.ap-save { flex: 1; justify-content: center; }
.ap-saved { display: flex; flex-wrap: wrap; gap: 6px; }
.ap-look { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11px;
  color: var(--fg-1); background: var(--navy-900); border: 1px solid var(--line-1); border-radius: 999px;
  padding: 4px 5px 4px 11px; cursor: pointer; transition: all var(--dur); }
.ap-look:hover { border-color: var(--line-3); }
.ap-look.active { border-color: var(--mint-500); box-shadow: 0 0 0 1px var(--mint-500); }
.ap-look .rm { width: 15px; height: 15px; display: flex; align-items: center; justify-content: center; color: var(--fg-3); border-radius: 50%; }
.ap-look .rm:hover { color: #f0938a; background: rgba(226,87,74,.12); }
.ap-look .rm [data-lucide] { width: 11px; height: 11px; }
.ap-empty { font-size: 11px; color: var(--fg-3); line-height: 1.4; }
