/* ==========================================================================
   Ember UI — Production Bundle (all stylesheets concatenated, single request)
   Generated from css/*.css. For development you can instead import the
   modular files individually. Order matters: tokens → base → layout →
   components → frames.
   ========================================================================== */

/* ==========================================================================
   Ember — Design Tokens
   Warm-hued, minimalist design system. Light + dark via [data-theme].
   Function over form: a small, predictable set of variables drives everything.
   ========================================================================== */

:root {
  /* --- Warm neutral ramp (light) ---------------------------------------- */
  /* A subtly warm grey scale — never pure white, never pure black. */
  --warm-50:  #faf7f2;
  --warm-100: #f3ede4;
  --warm-150: #ece3d6;
  --warm-200: #e3d8c8;
  --warm-300: #d2c3ad;
  --warm-400: #b3a085;
  --warm-500: #8c7a60;
  --warm-600: #6b5b45;
  --warm-700: #4d4031;
  --warm-800: #322a20;
  --warm-900: #1f1a13;
  --warm-950: #14110c;

  /* --- Accent: ember / clay -------------------------------------------- */
  --ember-100: #fbe6d4;
  --ember-200: #f6c79e;
  --ember-300: #f0a567;
  --ember-400: #e8843a;
  --ember-500: #d96a1f;   /* primary accent */
  --ember-600: #b85316;
  --ember-700: #933f12;

  /* --- Secondary warm hues for status/charts --------------------------- */
  --clay:   #c2603f;
  --amber:  #d9a521;
  --olive:  #7d8a3f;
  --sage:   #6f9070;
  --teal:   #3f8a82;
  --plum:   #8a5a78;
  --rose:   #c25670;

  /* --- Semantic status -------------------------------------------------- */
  --ok:    #5c8a4a;
  --warn:  #cf9320;
  --error: #c5462f;
  --info:  #3f7d8a;

  /* --- Typography ------------------------------------------------------- */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2.25rem;
  --text-4xl:  3rem;

  --leading-tight: 1.2;
  --leading-snug:  1.4;
  --leading-base:  1.6;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semi:   600;
  --weight-bold:   700;

  /* --- Spacing scale (4px base, fluid where useful) -------------------- */
  --space-0:  0;
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.5rem;
  --space-6:  2rem;
  --space-7:  3rem;
  --space-8:  4rem;
  --space-9:  6rem;

  /* --- Radius ----------------------------------------------------------- */
  --radius-xs: 3px;
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 999px;

  /* --- Borders & rings -------------------------------------------------- */
  --border-w: 1px;

  /* --- Elevation (warm, low-contrast shadows) -------------------------- */
  --shadow-xs: 0 1px 2px rgba(50, 38, 25, 0.06);
  --shadow-sm: 0 1px 3px rgba(50, 38, 25, 0.10), 0 1px 2px rgba(50, 38, 25, 0.06);
  --shadow:    0 4px 12px rgba(50, 38, 25, 0.10), 0 2px 4px rgba(50, 38, 25, 0.06);
  --shadow-lg: 0 12px 32px rgba(50, 38, 25, 0.14), 0 4px 8px rgba(50, 38, 25, 0.06);
  --shadow-xl: 0 24px 56px rgba(50, 38, 25, 0.18);

  /* --- Motion ----------------------------------------------------------- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 360ms;

  /* --- Layout ----------------------------------------------------------- */
  --content-width: 72rem;
  --prose-width: 42rem;
  --z-sticky: 100;
  --z-dropdown: 1000;
  --z-overlay: 2000;
  --z-modal: 2100;
  --z-toast: 3000;
  --z-tooltip: 4000;

  /* ====================================================================
     Semantic surface tokens — LIGHT (default)
     Components reference ONLY these, never raw ramp values, so theming
     stays consistent and a single override flips the whole library.
     ==================================================================== */
  --bg:           var(--warm-50);
  --bg-subtle:    var(--warm-100);
  --bg-muted:     var(--warm-150);
  --surface:      #ffffff;
  --surface-2:    var(--warm-50);
  --surface-3:    var(--warm-100);
  --overlay-bg:   rgba(31, 26, 19, 0.45);

  --text:         var(--warm-900);
  --text-soft:    var(--warm-700);
  --text-muted:   var(--warm-500);
  --text-faint:   var(--warm-400);
  --text-on-accent: #fff8f0;

  --border:       var(--warm-200);
  --border-soft:  var(--warm-150);
  --border-strong:var(--warm-300);

  --accent:       var(--ember-500);
  --accent-hover: var(--ember-600);
  --accent-soft:  var(--ember-100);
  --accent-text:  var(--ember-700);

  --ring: color-mix(in srgb, var(--accent) 45%, transparent);

  color-scheme: light;
}

/* ====================================================================
   DARK — warm charcoal, never cold blue-black.
   ==================================================================== */
:root[data-theme="dark"] {
  --bg:           var(--warm-950);
  --bg-subtle:    var(--warm-900);
  --bg-muted:     var(--warm-800);
  --surface:      #211c15;
  --surface-2:    #2a241b;
  --surface-3:    #332b21;
  --overlay-bg:   rgba(10, 8, 5, 0.6);

  --text:         #f3ece0;
  --text-soft:    #cdbfa9;
  --text-muted:   #9c8d76;
  --text-faint:   #6f6450;
  --text-on-accent: #1a120a;

  --border:       #3a3025;
  --border-soft:  #2f271d;
  --border-strong:#4a3e2f;

  --accent:       var(--ember-400);
  --accent-hover: var(--ember-300);
  --accent-soft:  #3a2614;
  --accent-text:  var(--ember-300);

  --ring: color-mix(in srgb, var(--accent) 55%, transparent);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow:    0 4px 12px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55), 0 4px 8px rgba(0, 0, 0, 0.35);
  --shadow-xl: 0 24px 56px rgba(0, 0, 0, 0.65);

  color-scheme: dark;
}

/* Auto dark for users who never toggle, only when no explicit choice set. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: var(--warm-950); --bg-subtle: var(--warm-900); --bg-muted: var(--warm-800);
    --surface: #211c15; --surface-2: #2a241b; --surface-3: #332b21;
    --overlay-bg: rgba(10, 8, 5, 0.6);
    --text: #f3ece0; --text-soft: #cdbfa9; --text-muted: #9c8d76; --text-faint: #6f6450;
    --text-on-accent: #1a120a;
    --border: #3a3025; --border-soft: #2f271d; --border-strong: #4a3e2f;
    --accent: var(--ember-400); --accent-hover: var(--ember-300);
    --accent-soft: #3a2614; --accent-text: var(--ember-300);
    --ring: color-mix(in srgb, var(--accent) 55%, transparent);
    --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
    --shadow: 0 4px 12px rgba(0,0,0,.45), 0 2px 4px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.55), 0 4px 8px rgba(0,0,0,.35);
    --shadow-xl: 0 24px 56px rgba(0,0,0,.65);
    color-scheme: dark;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
/* ==========================================================================
   Ember — Reset + Classless Base
   Sensible defaults so semantic HTML looks good with zero classes
   (html.one inspired). Add components on top only where you need them.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
  font-size: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  font-weight: var(--weight-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

/* --- Typographic rhythm (classless) ----------------------------------- */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--leading-tight);
  font-weight: var(--weight-semi);
  letter-spacing: -0.012em;
  color: var(--text);
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); margin-block: 0 var(--space-4); }
h2 { font-size: var(--text-2xl); margin-block: var(--space-6) var(--space-3); }
h3 { font-size: var(--text-xl);  margin-block: var(--space-5) var(--space-2); }
h4 { font-size: var(--text-lg);  margin-block: var(--space-4) var(--space-2); }
h5 { font-size: var(--text-base); font-weight: var(--weight-bold); }
h6 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

p { margin-block: 0 var(--space-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent-text);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }

strong, b { font-weight: var(--weight-semi); color: var(--text); }
em, i { font-style: italic; }
small { font-size: var(--text-sm); color: var(--text-muted); }
mark { background: var(--accent-soft); color: var(--accent-text); padding: 0 0.2em; border-radius: var(--radius-xs); }
del { color: var(--text-muted); }

/* --- Lists ------------------------------------------------------------- */
ul, ol { margin-block: 0 var(--space-4); padding-inline-start: var(--space-5); }
li { margin-block: var(--space-1); }
li::marker { color: var(--text-muted); }
dl { margin-block: 0 var(--space-4); }
dt { font-weight: var(--weight-semi); }
dd { margin-inline-start: var(--space-4); color: var(--text-soft); }

/* --- Quotes ------------------------------------------------------------ */
blockquote {
  margin: var(--space-4) 0;
  padding: var(--space-2) var(--space-4);
  border-inline-start: 3px solid var(--accent);
  color: var(--text-soft);
  font-style: italic;
}
blockquote cite { display: block; margin-top: var(--space-2); font-style: normal; font-size: var(--text-sm); color: var(--text-muted); }

/* --- Code -------------------------------------------------------------- */
code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
code {
  background: var(--bg-muted);
  padding: 0.12em 0.4em;
  border-radius: var(--radius-xs);
  color: var(--accent-text);
}
pre {
  background: var(--surface-3);
  color: var(--text);
  padding: var(--space-4);
  border-radius: var(--radius);
  overflow-x: auto;
  border: var(--border-w) solid var(--border-soft);
  margin-block: 0 var(--space-4);
  line-height: var(--leading-snug);
}
pre code { background: none; padding: 0; color: inherit; }
kbd {
  background: var(--surface);
  border: var(--border-w) solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-xs);
  padding: 0.1em 0.45em;
  font-size: 0.82em;
  color: var(--text-soft);
}

/* --- Media ------------------------------------------------------------- */
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
img { border-radius: var(--radius-sm); }

/* --- Rules & separators ----------------------------------------------- */
hr {
  border: 0;
  border-top: var(--border-w) solid var(--border);
  margin-block: var(--space-6);
}

/* --- Tables (classless) ------------------------------------------------ */
table { border-collapse: collapse; width: 100%; margin-block: 0 var(--space-4); font-size: var(--text-sm); }
th, td { text-align: start; padding: var(--space-2) var(--space-3); border-bottom: var(--border-w) solid var(--border-soft); }
th { font-weight: var(--weight-semi); color: var(--text-soft); }
tbody tr { transition: background var(--dur-fast) var(--ease); }
tbody tr:hover { background: var(--bg-subtle); }

/* --- Forms (classless baseline) --------------------------------------- */
input, textarea, select, button { font: inherit; color: inherit; }
label { display: inline-block; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-soft); }
fieldset { border: var(--border-w) solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin: 0 0 var(--space-4); }
legend { padding: 0 var(--space-2); font-weight: var(--weight-semi); }

/* --- Accessibility ----------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent-soft); color: var(--accent-text); }

.visually-hidden, .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;
}

[hidden] { display: none !important; }

/* --- Scrollbars (warm, subtle) ---------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }
/* ==========================================================================
   Ember — Layout utilities + self-layouting primitives
   "Self-layouting spans": elements that arrange their own children with
   no media queries, using intrinsic CSS (flex-wrap, auto-fit grids, clamp).
   ========================================================================== */

/* --- Page container --------------------------------------------------- */
.container { width: 100%; max-width: var(--content-width); margin-inline: auto; padding-inline: var(--space-4); }
.container-sm { max-width: 48rem; }
.container-prose { max-width: var(--prose-width); }
.container-wide { max-width: 90rem; }
.full-bleed { width: 100vw; margin-inline: calc(50% - 50vw); }

/* --- Stack: vertical flow with consistent gap ------------------------- */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-1 { gap: var(--space-1); } .stack-2 { gap: var(--space-2); }
.stack-3 { gap: var(--space-3); } .stack-5 { gap: var(--space-5); }
.stack-6 { gap: var(--space-6); } .stack-7 { gap: var(--space-7); }
.stack > * { margin: 0; }

/* --- Cluster: horizontal wrap (self-layouting tags/buttons) ----------- */
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.cluster-tight { gap: var(--space-2); }
.cluster-end { justify-content: flex-end; }
.cluster-between { justify-content: space-between; }
.cluster-center { justify-content: center; }

/* --- Auto-grid: responsive without a single media query --------------- */
.auto-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(var(--col, 16rem), 100%), 1fr));
}
.auto-grid-sm { --col: 11rem; }
.auto-grid-lg { --col: 22rem; }
.auto-fit { grid-template-columns: repeat(auto-fit, minmax(min(var(--col, 16rem), 100%), 1fr)); }

/* --- Switcher: row that flips to column under a threshold -------------- */
.switcher { display: flex; flex-wrap: wrap; gap: var(--space-4); }
.switcher > * { flex: 1 1 calc((var(--threshold, 30rem) - 100%) * 999); min-width: 0; }

/* --- Sidebar: content + fixed-ish aside, wraps when cramped ------------ */
.with-sidebar { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.with-sidebar > .sidebar { flex: 1 1 var(--sidebar-width, 16rem); }
.with-sidebar > .not-sidebar { flex: 999 1 calc(var(--sidebar-content-min, 50%) - var(--space-5)); min-width: 0; }
.with-sidebar.sidebar-right { flex-direction: row-reverse; }

/* --- Reel: horizontal scroll strip ------------------------------------ */
.reel { display: flex; gap: var(--space-4); overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x proximity; padding-bottom: var(--space-2); }
.reel > * { flex: 0 0 auto; scroll-snap-align: start; }

/* --- Center: intrinsic centering -------------------------------------- */
.center { display: grid; place-items: center; }
.center-box { display: flex; flex-direction: column; align-items: center; text-align: center; }

/* --- Cover: header / centered content / footer ------------------------ */
.cover { display: flex; flex-direction: column; min-height: var(--cover-min, 100vh); gap: var(--space-4); padding: var(--space-5); }
.cover > * { margin-block: var(--space-2); }
.cover > .cover-center { margin-block: auto; }

/* --- Frame: aspect-ratio media box ------------------------------------ */
.frame-ratio { aspect-ratio: var(--ratio, 16 / 9); overflow: hidden; }
.frame-ratio > * { width: 100%; height: 100%; object-fit: cover; }
.ratio-square { --ratio: 1; } .ratio-video { --ratio: 16/9; }
.ratio-portrait { --ratio: 3/4; } .ratio-wide { --ratio: 21/9; }

/* --- Grid spans (explicit 12-col when you want control) --------------- */
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--space-4); }
.span-1{grid-column:span 1}.span-2{grid-column:span 2}.span-3{grid-column:span 3}
.span-4{grid-column:span 4}.span-5{grid-column:span 5}.span-6{grid-column:span 6}
.span-7{grid-column:span 7}.span-8{grid-column:span 8}.span-9{grid-column:span 9}
.span-10{grid-column:span 10}.span-11{grid-column:span 11}.span-12{grid-column:span 12}
@media (max-width: 48rem) {
  .grid-12 > [class*="span-"] { grid-column: span 12; }
}

/* --- Spacing utilities ------------------------------------------------- */
.m-0{margin:0}.mt-0{margin-top:0}.mb-0{margin-bottom:0}
.mt-2{margin-top:var(--space-2)}.mt-4{margin-top:var(--space-4)}.mt-6{margin-top:var(--space-6)}
.mb-2{margin-bottom:var(--space-2)}.mb-4{margin-bottom:var(--space-4)}.mb-6{margin-bottom:var(--space-6)}
.p-0{padding:0}.p-2{padding:var(--space-2)}.p-3{padding:var(--space-3)}
.p-4{padding:var(--space-4)}.p-5{padding:var(--space-5)}.p-6{padding:var(--space-6)}
.gap-2{gap:var(--space-2)}.gap-4{gap:var(--space-4)}.gap-6{gap:var(--space-6)}

/* --- Flex / display helpers ------------------------------------------- */
.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}
.block{display:block}.inline-block{display:inline-block}.hidden{display:none}
.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.flex-1{flex:1 1 0}
.items-center{align-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}
.items-stretch{align-items:stretch}.items-baseline{align-items:baseline}
.justify-center{justify-content:center}.justify-between{justify-content:space-between}
.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}
.grow{flex-grow:1}.shrink-0{flex-shrink:0}.self-center{align-self:center}.ml-auto{margin-inline-start:auto}.mr-auto{margin-inline-end:auto}

/* --- Text helpers ------------------------------------------------------ */
.text-center{text-align:center}.text-end{text-align:end}.text-start{text-align:start}
.text-xs{font-size:var(--text-xs)}.text-sm{font-size:var(--text-sm)}.text-lg{font-size:var(--text-lg)}
.text-xl{font-size:var(--text-xl)}.text-2xl{font-size:var(--text-2xl)}.text-3xl{font-size:var(--text-3xl)}.text-4xl{font-size:var(--text-4xl)}
.font-medium{font-weight:var(--weight-medium)}.font-semi{font-weight:var(--weight-semi)}.font-bold{font-weight:var(--weight-bold)}
.muted{color:var(--text-muted)}.soft{color:var(--text-soft)}.faint{color:var(--text-faint)}
.accent{color:var(--accent-text)}.mono{font-family:var(--font-mono)}.serif{font-family:var(--font-serif)}
.uppercase{text-transform:uppercase;letter-spacing:.06em}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.line-clamp{display:-webkit-box;-webkit-line-clamp:var(--lines,3);line-clamp:var(--lines,3);-webkit-box-orient:vertical;overflow:hidden}
.balance{text-wrap:balance}.nowrap{white-space:nowrap}

/* --- Surfaces & misc helpers ------------------------------------------ */
.surface{background:var(--surface);border:var(--border-w) solid var(--border);border-radius:var(--radius)}
.rounded{border-radius:var(--radius)}.rounded-lg{border-radius:var(--radius-lg)}.rounded-full{border-radius:var(--radius-full)}
.border{border:var(--border-w) solid var(--border)}.border-t{border-top:var(--border-w) solid var(--border)}.border-b{border-bottom:var(--border-w) solid var(--border)}
.shadow{box-shadow:var(--shadow)}.shadow-sm{box-shadow:var(--shadow-sm)}.shadow-lg{box-shadow:var(--shadow-lg)}.shadow-none{box-shadow:none}
.w-full{width:100%}.h-full{height:100%}.min-w-0{min-width:0}
.relative{position:relative}.absolute{position:absolute}.sticky{position:sticky;top:0}.fixed{position:fixed}
.overflow-hidden{overflow:hidden}.overflow-auto{overflow:auto}
.pointer{cursor:pointer}.select-none{user-select:none}.opacity-0{opacity:0}

/* --- Print ------------------------------------------------------------- */
@media print {
  .no-print, nav, .toast-region, .navbar { display: none !important; }
  body { background: #fff; color: #000; }
}
/* ==========================================================================
   Ember — Components
   All interactive + structural components. Touch-first: interactive targets
   are >=44px, focus-visible everywhere, no hover-only affordances.
   ========================================================================== */

/* ======================================================================
   BUTTONS
   ====================================================================== */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4);
  font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: 1;
  background: var(--btn-bg); color: var(--btn-fg);
  border: var(--border-w) solid var(--btn-bd); border-radius: var(--radius-sm);
  cursor: pointer; user-select: none; white-space: nowrap; text-decoration: none;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: var(--bg-subtle); border-color: var(--text-faint); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--text-on-accent); --btn-bd: var(--accent); }
.btn-primary:hover { --btn-bg: var(--accent-hover); --btn-bd: var(--accent-hover); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { background: var(--bg-muted); border-color: transparent; }
.btn-soft { --btn-bg: var(--accent-soft); --btn-fg: var(--accent-text); --btn-bd: transparent; }
.btn-soft:hover { background: color-mix(in srgb, var(--accent-soft) 70%, var(--accent) 12%); }
.btn-outline { --btn-bg: transparent; --btn-fg: var(--accent-text); --btn-bd: var(--accent); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-danger { --btn-bg: var(--error); --btn-fg: #fff; --btn-bd: var(--error); }
.btn-danger:hover { --btn-bg: color-mix(in srgb, var(--error) 85%, #000); }
.btn-link { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--accent-text); min-height: auto; padding: 0; text-decoration: underline; text-underline-offset: 0.2em; }

.btn-sm { min-height: 34px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn-lg { min-height: 52px; padding: 0 var(--space-5); font-size: var(--text-base); }
.btn-icon { padding: 0; width: 44px; }
.btn-icon.btn-sm { width: 34px; } .btn-icon.btn-lg { width: 52px; }
.btn-block { display: flex; width: 100%; }
.btn-pill { border-radius: var(--radius-full); }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-inline-start: calc(var(--border-w) * -1); }
.btn-group .btn:first-child { border-start-start-radius: var(--radius-sm); border-end-start-radius: var(--radius-sm); margin-inline-start: 0; }
.btn-group .btn:last-child { border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); }
.btn-group .btn:focus-visible, .btn-group .btn:hover { position: relative; z-index: 1; }

/* ======================================================================
   BADGES, CHIPS, TAGS, AVATARS, KBD
   ====================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 0.15em 0.6em; font-size: var(--text-xs); font-weight: var(--weight-medium);
  background: var(--bg-muted); color: var(--text-soft);
  border-radius: var(--radius-full); line-height: 1.5; white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }
.badge-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.badge-warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.badge-error { background: color-mix(in srgb, var(--error) 16%, transparent); color: var(--error); }
.badge-info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); }
.badge-outline { background: transparent; border: var(--border-w) solid var(--border-strong); }
.badge-dot::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: currentColor; }

/* Chip / tag — removable interactive element */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-sm);
  background: var(--surface-3); color: var(--text); border: var(--border-w) solid var(--border);
  border-radius: var(--radius-full); cursor: default; transition: background var(--dur-fast) var(--ease);
}
.chip.is-selected { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); }
.chip[data-removable] { padding-inline-end: var(--space-1); }
.chip-remove {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  border-radius: 50%; font-size: 1.1em; line-height: 1; transition: background var(--dur-fast) var(--ease);
}
.chip-remove:hover { background: var(--bg-muted); color: var(--text); }

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: var(--size, 40px); height: var(--size, 40px); border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-weight: var(--weight-semi); font-size: calc(var(--size, 40px) * 0.4);
  overflow: hidden; object-fit: cover; border: var(--border-w) solid var(--border-soft);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.avatar-sm { --size: 28px; } .avatar-lg { --size: 56px; } .avatar-xl { --size: 80px; }
.avatar-stack { display: inline-flex; }
.avatar-stack > .avatar { margin-inline-start: -10px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack > .avatar:first-child { margin-inline-start: 0; }

/* ======================================================================
   CARD
   ====================================================================== */
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: var(--border-w) solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card-pad { padding: var(--space-5); }
.card > .card-body { padding: var(--space-5); }
.card > .card-header { padding: var(--space-4) var(--space-5); border-bottom: var(--border-w) solid var(--border-soft); font-weight: var(--weight-semi); }
.card > .card-footer { padding: var(--space-4) var(--space-5); border-top: var(--border-w) solid var(--border-soft); background: var(--surface-2); }
.card-hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-interactive { cursor: pointer; }
.card-interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.card-media { aspect-ratio: 16/9; overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

/* ======================================================================
   FORM CONTROLS
   ====================================================================== */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-soft); display: flex; gap: var(--space-1); align-items: center; }
.field-label .req { color: var(--error); }
.field-hint { font-size: var(--text-xs); color: var(--text-muted); }
.field-error { font-size: var(--text-xs); color: var(--error); display: flex; align-items: center; gap: var(--space-1); }
.field.has-error .input, .field.has-error .textarea, .field.has-error .select { border-color: var(--error); }
.field.has-error .input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--error) 30%, transparent); }

.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 0 var(--space-3);
  background: var(--surface); color: var(--text);
  border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: var(--text-base); line-height: 1.4;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .textarea:hover, .select:hover { border-color: var(--text-faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
.input:disabled, .textarea:disabled, .select:disabled { background: var(--bg-muted); color: var(--text-muted); cursor: not-allowed; }
.input[readonly] { background: var(--bg-subtle); }
.textarea { padding: var(--space-3); min-height: 96px; resize: vertical; line-height: var(--leading-snug); }
.input-sm { min-height: 34px; font-size: var(--text-sm); }
.input-lg { min-height: 52px; font-size: var(--text-lg); }

/* Select with caret */
.select {
  padding-inline-end: var(--space-6);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238c7a60' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--space-3) center; background-size: 16px;
  cursor: pointer;
}
[dir="rtl"] .select { background-position: left var(--space-3) center; }

/* Input group (prefix/suffix/addon) */
.input-group { display: flex; align-items: stretch; position: relative; }
.input-group .input { border-radius: 0; }
.input-group > :first-child { border-start-start-radius: var(--radius-sm); border-end-start-radius: var(--radius-sm); }
.input-group > :last-child { border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); }
.input-group .input + .input, .input-group .input + .input-addon, .input-group .input-addon + .input { margin-inline-start: -1px; }
.input-addon {
  display: inline-flex; align-items: center; padding: 0 var(--space-3);
  background: var(--surface-3); color: var(--text-muted); border: var(--border-w) solid var(--border-strong);
  font-size: var(--text-sm); white-space: nowrap;
}
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > svg, .input-icon > .icon { position: absolute; inset-inline-start: var(--space-3); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.input-icon .input { padding-inline-start: calc(var(--space-3) * 2 + 18px); }
.input-icon.icon-end > svg, .input-icon.icon-end > .icon { inset-inline-start: auto; inset-inline-end: var(--space-3); }
.input-icon.icon-end .input { padding-inline-start: var(--space-3); padding-inline-end: calc(var(--space-3) * 2 + 18px); }

/* Checkbox & radio (custom, touch-friendly) */
.check, .radio { display: inline-flex; align-items: flex-start; gap: var(--space-2); cursor: pointer; min-height: 44px; align-items: center; line-height: 1.4; }
.check input, .radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box, .radio .box {
  flex-shrink: 0; width: 22px; height: 22px; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--border-strong);
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.check .box { border-radius: var(--radius-xs); }
.radio .box { border-radius: 50%; }
.check .box::after { content: ""; width: 12px; height: 12px; background: var(--text-on-accent); clip-path: polygon(14% 50%, 0 65%, 40% 100%, 100% 22%, 84% 8%, 38% 70%); transform: scale(0); transition: transform var(--dur-fast) var(--ease); }
.radio .box::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--text-on-accent); transform: scale(0); transition: transform var(--dur-fast) var(--ease); }
.check input:checked + .box, .radio input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box::after, .radio input:checked + .box::after { transform: scale(1); }
.check input:focus-visible + .box, .radio input:focus-visible + .box { box-shadow: 0 0 0 3px var(--ring); }
.check input:indeterminate + .box { background: var(--accent); border-color: var(--accent); }
.check input:indeterminate + .box::after { transform: scale(1); clip-path: none; width: 12px; height: 3px; border-radius: 2px; }
.check input:disabled + .box, .radio input:disabled + .box { opacity: 0.5; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  position: relative; width: 46px; height: 26px; flex-shrink: 0;
  background: var(--border-strong); border-radius: var(--radius-full);
  transition: background var(--dur) var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-20px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--ring); }
.switch input:disabled + .track { opacity: 0.5; }

/* Range slider */
.range { width: 100%; height: 44px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: var(--radius-full); background: var(--border-strong); }
.range::-moz-range-track { height: 6px; border-radius: var(--radius-full); background: var(--border-strong); }
.range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; margin-top: -9px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur-fast) var(--ease); }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: var(--shadow-sm); }
.range:active::-webkit-slider-thumb { transform: scale(1.12); }
.range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--ring); }

/* Number stepper */
.stepper { display: inline-flex; align-items: stretch; border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.stepper button { width: 44px; min-height: 44px; border: 0; background: var(--surface-3); color: var(--text); cursor: pointer; font-size: 1.2em; display: grid; place-items: center; transition: background var(--dur-fast) var(--ease); }
.stepper button:hover { background: var(--bg-muted); }
.stepper button:active { background: var(--accent-soft); }
.stepper input { width: 4ch; text-align: center; border: 0; border-inline: var(--border-w) solid var(--border-soft); background: var(--surface); min-height: 44px; -moz-appearance: textfield; appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Segmented control */
.segmented { display: inline-flex; padding: 3px; background: var(--bg-muted); border-radius: var(--radius-sm); gap: 2px; }
.segmented button { min-height: 38px; padding: 0 var(--space-3); border: 0; background: transparent; color: var(--text-soft); cursor: pointer; border-radius: calc(var(--radius-sm) - 2px); font-size: var(--text-sm); font-weight: var(--weight-medium); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); white-space: nowrap; }
.segmented button[aria-pressed="true"], .segmented button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* OTP / PIN */
.otp { display: inline-flex; gap: var(--space-2); }
.otp input { width: 48px; height: 56px; text-align: center; font-size: var(--text-xl); font-weight: var(--weight-semi); border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
.otp input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }

/* Rating (stars) */
.rating { display: inline-flex; gap: 2px; direction: ltr; }
.rating button { border: 0; background: none; cursor: pointer; padding: var(--space-1); color: var(--border-strong); transition: color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); font-size: 1.5rem; line-height: 1; }
.rating button:hover { transform: scale(1.15); }
.rating button.is-on, .rating[data-hover] button.is-hover { color: var(--amber); }

/* File dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-6); text-align: center; min-height: 140px;
  background: var(--surface-2); border: 2px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dropzone:hover, .dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.dropzone input[type="file"] { display: none; }

/* Tags input */
.tags-input { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; padding: var(--space-2); min-height: 44px; background: var(--surface); border: var(--border-w) solid var(--border-strong); border-radius: var(--radius-sm); cursor: text; }
.tags-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.tags-input input { flex: 1; min-width: 8ch; border: 0; outline: none; background: transparent; min-height: 28px; }

/* Password strength meter */
.strength { display: flex; gap: 4px; margin-top: var(--space-1); }
.strength span { flex: 1; height: 4px; border-radius: var(--radius-full); background: var(--border); transition: background var(--dur) var(--ease); }
.strength[data-level="1"] span:nth-child(-n+1) { background: var(--error); }
.strength[data-level="2"] span:nth-child(-n+2) { background: var(--warn); }
.strength[data-level="3"] span:nth-child(-n+3) { background: var(--amber); }
.strength[data-level="4"] span { background: var(--ok); }

/* ======================================================================
   ALERTS, BANNERS, CALLOUTS
   ====================================================================== */
.alert {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-4); border-radius: var(--radius);
  background: var(--surface-2); border: var(--border-w) solid var(--border);
  border-inline-start: 3px solid var(--text-muted);
}
.alert .alert-icon { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; }
.alert .alert-body { flex: 1; min-width: 0; }
.alert .alert-title { font-weight: var(--weight-semi); margin-bottom: var(--space-1); }
.alert-info { border-inline-start-color: var(--info); background: color-mix(in srgb, var(--info) 8%, var(--surface)); }
.alert-ok { border-inline-start-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--surface)); }
.alert-warn { border-inline-start-color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, var(--surface)); }
.alert-error { border-inline-start-color: var(--error); background: color-mix(in srgb, var(--error) 8%, var(--surface)); }

.banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--accent-soft); color: var(--accent-text); font-size: var(--text-sm); }
.banner .btn-close { margin-inline-start: auto; }

/* ======================================================================
   PROGRESS, SPINNER, SKELETON
   ====================================================================== */
.progress { width: 100%; height: 8px; background: var(--bg-muted); border-radius: var(--radius-full); overflow: hidden; }
.progress > .bar { height: 100%; width: var(--value, 0%); background: var(--accent); border-radius: inherit; transition: width var(--dur-slow) var(--ease); }
.progress.is-indeterminate > .bar { width: 40%; animation: ember-indeterminate 1.2s var(--ease) infinite; }
@keyframes ember-indeterminate { 0% { margin-inline-start: -40%; } 100% { margin-inline-start: 100%; } }
.progress-ring { transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 8; }
.progress-ring .track { stroke: var(--bg-muted); }
.progress-ring .value { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset var(--dur-slow) var(--ease); }

.spinner { width: var(--size, 24px); height: var(--size, 24px); border: 3px solid var(--bg-muted); border-top-color: var(--accent); border-radius: 50%; animation: ember-spin 0.7s linear infinite; }
@keyframes ember-spin { to { transform: rotate(360deg); } }
.dots-loader { display: inline-flex; gap: 4px; }
.dots-loader span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: ember-bounce 1.2s var(--ease) infinite; }
.dots-loader span:nth-child(2) { animation-delay: 0.15s; }
.dots-loader span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ember-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }

.skeleton { background: linear-gradient(90deg, var(--bg-muted) 25%, var(--surface-3) 50%, var(--bg-muted) 75%); background-size: 200% 100%; animation: ember-shimmer 1.4s ease infinite; border-radius: var(--radius-sm); }
.skeleton-text { height: 0.85em; margin-block: 0.3em; }
.skeleton-text.short { width: 60%; }
.skeleton-circle { border-radius: 50%; }
@keyframes ember-shimmer { to { background-position: -200% 0; } }

/* ======================================================================
   TABS
   ====================================================================== */
.tabs { display: flex; flex-direction: column; }
.tab-list { display: flex; gap: var(--space-1); border-bottom: var(--border-w) solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab-list::-webkit-scrollbar { display: none; }
.tab {
  min-height: 44px; padding: 0 var(--space-4); border: 0; background: none; cursor: pointer;
  color: var(--text-muted); font-size: var(--text-sm); font-weight: var(--weight-medium); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab-panel { padding-top: var(--space-4); }
.tab-panel[hidden] { display: none; }
.tabs-pill .tab-list { border: 0; gap: var(--space-2); }
.tabs-pill .tab { border: var(--border-w) solid var(--border); border-radius: var(--radius-full); margin: 0; }
.tabs-pill .tab[aria-selected="true"] { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }

/* ======================================================================
   ACCORDION / COLLAPSE
   ====================================================================== */
.accordion { border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.accordion-item + .accordion-item { border-top: var(--border-w) solid var(--border-soft); }
.accordion-trigger {
  width: 100%; min-height: 52px; padding: var(--space-3) var(--space-4); display: flex; align-items: center; gap: var(--space-3);
  border: 0; background: var(--surface); color: var(--text); cursor: pointer; text-align: start; font-weight: var(--weight-medium);
  transition: background var(--dur-fast) var(--ease);
}
.accordion-trigger:hover { background: var(--bg-subtle); }
.accordion-trigger .chevron { margin-inline-start: auto; transition: transform var(--dur) var(--ease); color: var(--text-muted); }
.accordion-trigger[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.accordion-content { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--dur) var(--ease); }
.accordion-content > div { overflow: hidden; }
.accordion-content.is-open { grid-template-rows: 1fr; }
.accordion-content .inner { padding: 0 var(--space-4) var(--space-4); color: var(--text-soft); }

/* native details styled */
details.collapse { border: var(--border-w) solid var(--border); border-radius: var(--radius); padding: var(--space-3) var(--space-4); }
details.collapse summary { cursor: pointer; font-weight: var(--weight-medium); list-style: none; display: flex; align-items: center; gap: var(--space-2); min-height: 28px; }
details.collapse summary::-webkit-details-marker { display: none; }
details.collapse summary::before { content: "›"; transition: transform var(--dur) var(--ease); color: var(--text-muted); font-size: 1.3em; }
details.collapse[open] summary::before { transform: rotate(90deg); }
details.collapse > :not(summary) { margin-top: var(--space-3); color: var(--text-soft); }

/* ======================================================================
   MODAL / DIALOG / DRAWER
   ====================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: var(--overlay-bg); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: var(--space-4);
  opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility var(--dur);
}
.modal-backdrop.is-open { opacity: 1; visibility: visible; }
.modal {
  width: 100%; max-width: var(--modal-w, 32rem); max-height: 90vh; overflow: auto;
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); z-index: var(--z-modal);
  transform: translateY(12px) scale(0.98); opacity: 0; transition: transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease);
}
.modal-backdrop.is-open .modal { transform: none; opacity: 1; }
.modal-header { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: var(--border-w) solid var(--border-soft); }
.modal-header h2, .modal-header h3 { margin: 0; font-size: var(--text-lg); }
.modal-body { padding: var(--space-5); }
.modal-footer { display: flex; gap: var(--space-3); justify-content: flex-end; padding: var(--space-4) var(--space-5); border-top: var(--border-w) solid var(--border-soft); background: var(--surface-2); flex-wrap: wrap; }
.modal-lg { --modal-w: 48rem; } .modal-sm { --modal-w: 24rem; } .modal-full { --modal-w: 90rem; }
.btn-close { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1.3em; margin-inline-start: auto; transition: background var(--dur-fast) var(--ease); }
.btn-close:hover { background: var(--bg-muted); color: var(--text); }

.drawer-backdrop { position: fixed; inset: 0; z-index: var(--z-overlay); background: var(--overlay-bg); opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility var(--dur); }
.drawer-backdrop.is-open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: var(--z-modal);
  width: min(var(--drawer-w, 22rem), 92vw); background: var(--surface);
  border-inline-start: var(--border-w) solid var(--border); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform var(--dur-slow) var(--ease-out);
}
[dir="rtl"] .drawer { transform: translateX(-100%); }
.drawer.is-open { transform: none; }
.drawer.drawer-left { inset-inline-end: auto; inset-inline-start: 0; border-inline: 0; border-inline-end: var(--border-w) solid var(--border); transform: translateX(-100%); }
.drawer.drawer-left.is-open { transform: none; }
.drawer.drawer-bottom { inset: auto 0 0 0; width: auto; height: min(var(--drawer-h, 60vh), 90vh); border: 0; border-top: var(--border-w) solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; transform: translateY(100%); }
.drawer.drawer-bottom.is-open { transform: none; }
.drawer-header { padding: var(--space-4) var(--space-5); border-bottom: var(--border-w) solid var(--border-soft); display: flex; align-items: center; }
.drawer-body { flex: 1; overflow: auto; padding: var(--space-5); }
.drawer-footer { padding: var(--space-4) var(--space-5); border-top: var(--border-w) solid var(--border-soft); }

/* ======================================================================
   TOOLTIP & POPOVER
   ====================================================================== */
.tooltip { position: relative; display: inline-flex; }
.tooltip-bubble {
  position: absolute; z-index: var(--z-tooltip); bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) translateY(4px);
  padding: var(--space-1) var(--space-2); background: var(--warm-900); color: var(--warm-50);
  font-size: var(--text-xs); border-radius: var(--radius-xs); white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); box-shadow: var(--shadow);
}
:root[data-theme="dark"] .tooltip-bubble { background: var(--warm-200); color: var(--warm-950); }
.tooltip:hover .tooltip-bubble, .tooltip:focus-within .tooltip-bubble { opacity: 1; transform: translateX(-50%); }

.popover {
  position: absolute; z-index: var(--z-dropdown); min-width: 12rem;
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: var(--space-3);
  opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
}
.popover.is-open { opacity: 1; visibility: visible; transform: none; }

/* ======================================================================
   DROPDOWN / MENU / CONTEXT MENU
   ====================================================================== */
.menu {
  position: absolute; z-index: var(--z-dropdown); min-width: 11rem;
  background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: var(--space-1); list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(4px) scale(0.98); transform-origin: top;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
}
.menu.is-open { opacity: 1; visibility: visible; transform: none; }
.menu li { margin: 0; }
.menu-item {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 40px; padding: 0 var(--space-3);
  border: 0; background: none; color: var(--text); cursor: pointer; border-radius: var(--radius-sm); font-size: var(--text-sm); text-align: start; text-decoration: none;
  transition: background var(--dur-fast) var(--ease);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--bg-subtle); }
.menu-item.is-danger { color: var(--error); }
.menu-item.is-danger:hover { background: color-mix(in srgb, var(--error) 12%, transparent); }
.menu-item[aria-disabled="true"] { opacity: 0.5; pointer-events: none; }
.menu-item .shortcut { margin-inline-start: auto; color: var(--text-faint); font-size: var(--text-xs); }
.menu-sep { height: 1px; background: var(--border-soft); margin: var(--space-1) 0; }
.menu-label { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

/* ======================================================================
   TOASTS
   ====================================================================== */
.toast-region { position: fixed; z-index: var(--z-toast); bottom: var(--space-4); inset-inline-end: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); max-width: min(24rem, calc(100vw - var(--space-6))); pointer-events: none; }
.toast-region.top { bottom: auto; top: var(--space-4); }
.toast-region.center { inset-inline: 0; align-items: center; }
.toast {
  pointer-events: auto; display: flex; gap: var(--space-3); align-items: flex-start; width: 100%;
  padding: var(--space-3) var(--space-4); background: var(--surface); color: var(--text);
  border: var(--border-w) solid var(--border); border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: ember-toast-in var(--dur-slow) var(--ease-out);
}
.toast.is-leaving { animation: ember-toast-out var(--dur) var(--ease) forwards; }
.toast.toast-ok { border-inline-start-color: var(--ok); }
.toast.toast-error { border-inline-start-color: var(--error); }
.toast.toast-warn { border-inline-start-color: var(--warn); }
.toast .toast-body { flex: 1; min-width: 0; font-size: var(--text-sm); }
.toast .toast-title { font-weight: var(--weight-semi); }
@keyframes ember-toast-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } }
@keyframes ember-toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ======================================================================
   PAGINATION & BREADCRUMBS & STEPS
   ====================================================================== */
.pagination { display: flex; gap: var(--space-1); align-items: center; flex-wrap: wrap; }
.pagination .page { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; padding: 0 var(--space-2); border: var(--border-w) solid var(--border); background: var(--surface); color: var(--text); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); text-decoration: none; transition: background var(--dur-fast) var(--ease); }
.pagination .page:hover { background: var(--bg-subtle); }
.pagination .page[aria-current="page"] { background: var(--accent); color: var(--text-on-accent); border-color: var(--accent); }
.pagination .page[aria-disabled="true"] { opacity: 0.4; pointer-events: none; }
.pagination .ellipsis { padding: 0 var(--space-1); color: var(--text-muted); }

.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); font-size: var(--text-sm); list-style: none; padding: 0; margin: 0; }
.breadcrumbs li { display: flex; align-items: center; gap: var(--space-2); margin: 0; }
.breadcrumbs li:not(:last-child)::after { content: "/"; color: var(--text-faint); }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent-text); }
.breadcrumbs [aria-current="page"] { color: var(--text); font-weight: var(--weight-medium); }

.steps { display: flex; gap: 0; list-style: none; padding: 0; margin: 0; }
.steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); position: relative; text-align: center; font-size: var(--text-sm); color: var(--text-muted); }
.steps li:not(:last-child)::after { content: ""; position: absolute; top: 16px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.steps .step-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border-strong); color: var(--text-muted); font-weight: var(--weight-semi); position: relative; z-index: 1; }
.steps li.is-active .step-dot { border-color: var(--accent); color: var(--accent-text); }
.steps li.is-done .step-dot { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.steps li.is-done:not(:last-child)::after { background: var(--accent); }
.steps li.is-active, .steps li.is-done { color: var(--text); }

/* ======================================================================
   NAVBAR & SIDEBAR NAV
   ====================================================================== */
.navbar { display: flex; align-items: center; gap: var(--space-4); min-height: 60px; padding: 0 var(--space-4); background: color-mix(in srgb, var(--surface) 85%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: var(--border-w) solid var(--border); }
.navbar.is-sticky { position: sticky; top: 0; z-index: var(--z-sticky); }
.navbar .brand { font-weight: var(--weight-bold); font-size: var(--text-lg); display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--text); }
.navbar .nav-links { display: flex; gap: var(--space-1); align-items: center; margin-inline-start: auto; }
.nav-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-sm); color: var(--text-soft); text-decoration: none; font-size: var(--text-sm); font-weight: var(--weight-medium); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.nav-link:hover { background: var(--bg-subtle); color: var(--text); }
.nav-link.is-active { color: var(--accent-text); background: var(--accent-soft); }

.sidenav { display: flex; flex-direction: column; gap: 2px; padding: var(--space-2); }
.sidenav .nav-link { justify-content: flex-start; gap: var(--space-2); }
.sidenav-group-label { padding: var(--space-3) var(--space-3) var(--space-1); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

/* ======================================================================
   TABLE (enhanced data table styling)
   ====================================================================== */
.table-wrap { overflow-x: auto; border: var(--border-w) solid var(--border); border-radius: var(--radius); }
.table { margin: 0; width: 100%; }
.table thead th { background: var(--surface-2); position: sticky; top: 0; z-index: 1; cursor: default; }
.table.sortable thead th[data-sort] { cursor: pointer; user-select: none; }
.table.sortable thead th[data-sort]::after { content: "⇅"; opacity: 0.3; margin-inline-start: 0.4em; font-size: 0.85em; }
.table.sortable thead th[aria-sort="ascending"]::after { content: "↑"; opacity: 1; }
.table.sortable thead th[aria-sort="descending"]::after { content: "↓"; opacity: 1; }
.table.striped tbody tr:nth-child(even) { background: var(--surface-2); }
.table.compact th, .table.compact td { padding: var(--space-1) var(--space-2); }
.table td.num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }

/* ======================================================================
   TREE, TIMELINE, COMMAND PALETTE, SPLIT, KANBAN, CHAT
   ====================================================================== */
.tree { list-style: none; padding: 0; margin: 0; font-size: var(--text-sm); }
.tree ul { list-style: none; padding-inline-start: var(--space-4); margin: 0; }
.tree-item { display: flex; align-items: center; gap: var(--space-1); min-height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-sm); cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.tree-item:hover { background: var(--bg-subtle); }
.tree-toggle { width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--text-muted); transition: transform var(--dur-fast) var(--ease); }
.tree-node.is-open > .tree-item .tree-toggle { transform: rotate(90deg); }
.tree-node:not(.is-open) > ul { display: none; }

.timeline { list-style: none; padding: 0; margin: 0; position: relative; padding-inline-start: var(--space-5); }
.timeline::before { content: ""; position: absolute; inset-inline-start: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline li { position: relative; padding-bottom: var(--space-5); }
.timeline li::before { content: ""; position: absolute; inset-inline-start: calc(var(--space-5) * -1 + 2px); top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--border); }
.timeline .time { font-size: var(--text-xs); color: var(--text-muted); }

.cmdk-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay-bg); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility var(--dur); }
.cmdk-backdrop.is-open { opacity: 1; visibility: visible; }
.cmdk { width: min(36rem, 92vw); background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); overflow: hidden; transform: translateY(-12px); transition: transform var(--dur) var(--ease-out); }
.cmdk-backdrop.is-open .cmdk { transform: none; }
.cmdk-input { width: 100%; border: 0; border-bottom: var(--border-w) solid var(--border-soft); padding: var(--space-4); font-size: var(--text-lg); background: transparent; outline: none; }
.cmdk-list { max-height: 50vh; overflow: auto; padding: var(--space-2); list-style: none; margin: 0; }
.cmdk-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); cursor: pointer; }
.cmdk-item.is-active, .cmdk-item:hover { background: var(--accent-soft); color: var(--accent-text); }
.cmdk-item .shortcut { margin-inline-start: auto; }
.cmdk-empty { padding: var(--space-5); text-align: center; color: var(--text-muted); }

.split { display: flex; width: 100%; height: 100%; }
.split.vertical { flex-direction: column; }
.split-pane { overflow: auto; min-width: 0; min-height: 0; }
.split-gutter { flex: 0 0 8px; background: var(--border-soft); cursor: col-resize; transition: background var(--dur-fast) var(--ease); position: relative; }
.split.vertical > .split-gutter { cursor: row-resize; flex-basis: 8px; }
.split-gutter:hover, .split-gutter.is-dragging { background: var(--accent); }
.split-gutter::after { content: ""; position: absolute; inset: 0; margin: auto; }

.kanban { display: flex; gap: var(--space-4); overflow-x: auto; padding-bottom: var(--space-2); align-items: flex-start; }
.kanban-col { flex: 0 0 17rem; background: var(--surface-2); border: var(--border-w) solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 100%; }
.kanban-col-head { padding: var(--space-3) var(--space-4); font-weight: var(--weight-semi); display: flex; align-items: center; gap: var(--space-2); border-bottom: var(--border-w) solid var(--border-soft); }
.kanban-cards { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); overflow-y: auto; min-height: 40px; }
.kanban-card { background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-sm); padding: var(--space-3); cursor: grab; box-shadow: var(--shadow-xs); }
.kanban-card.is-dragging { opacity: 0.5; }
.kanban-cards.is-droptarget { background: var(--accent-soft); border-radius: var(--radius-sm); }

.chat { display: flex; flex-direction: column; gap: var(--space-3); }
.bubble { max-width: 80%; padding: var(--space-2) var(--space-3); border-radius: var(--radius-lg); background: var(--surface-3); color: var(--text); align-self: flex-start; border-bottom-left-radius: var(--radius-xs); }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--text-on-accent); border-bottom-left-radius: var(--radius-lg); border-bottom-right-radius: var(--radius-xs); }
.bubble .meta { font-size: var(--text-xs); opacity: 0.7; margin-top: var(--space-1); }

/* ======================================================================
   CAROUSEL
   ====================================================================== */
.carousel { position: relative; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 0; scroll-behavior: smooth; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-slide { flex: 0 0 100%; scroll-snap-align: center; }
.carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border: var(--border-w) solid var(--border); box-shadow: var(--shadow); cursor: pointer; display: grid; place-items: center; z-index: 1; }
.carousel-nav.prev { inset-inline-start: var(--space-3); } .carousel-nav.next { inset-inline-end: var(--space-3); }
.carousel-dots { display: flex; gap: var(--space-2); justify-content: center; margin-top: var(--space-3); }
.carousel-dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; background: var(--border-strong); cursor: pointer; transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.carousel-dots button.is-active { background: var(--accent); transform: scale(1.3); }

/* ======================================================================
   STAT / METRIC, EMPTY STATE, CODE BLOCK W/ COPY, DIVIDER
   ====================================================================== */
.stat { display: flex; flex-direction: column; gap: var(--space-1); }
.stat .stat-label { font-size: var(--text-sm); color: var(--text-muted); }
.stat .stat-value { font-size: var(--text-3xl); font-weight: var(--weight-bold); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat .stat-delta { font-size: var(--text-sm); display: inline-flex; align-items: center; gap: var(--space-1); }
.stat .stat-delta.up { color: var(--ok); } .stat .stat-delta.down { color: var(--error); }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-7) var(--space-4); color: var(--text-muted); }
.empty-state .empty-icon { width: 56px; height: 56px; opacity: 0.5; }

.code-block { position: relative; }
.code-block .copy-btn { position: absolute; top: var(--space-2); inset-inline-end: var(--space-2); }

.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--text-muted); font-size: var(--text-sm); margin-block: var(--space-4); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ======================================================================
   CANVAS workspace
   ====================================================================== */
.canvas-stage { position: relative; background: var(--surface-2); border: var(--border-w) solid var(--border); border-radius: var(--radius); overflow: hidden; }
.canvas-stage canvas { display: block; width: 100%; touch-action: none; }
.canvas-toolbar { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2); border-bottom: var(--border-w) solid var(--border-soft); background: var(--surface); align-items: center; }
.canvas-html-layer { position: absolute; inset: 0; pointer-events: none; }

/* ======================================================================
   MASONRY (CSS columns based, progressive)
   ====================================================================== */
.masonry { column-count: var(--cols, 3); column-gap: var(--space-4); }
.masonry > * { break-inside: avoid; margin-bottom: var(--space-4); display: inline-block; width: 100%; }
@media (max-width: 56rem) { .masonry { column-count: 2; } }
@media (max-width: 34rem) { .masonry { column-count: 1; } }

/* ======================================================================
   Touch & small-screen refinements
   ====================================================================== */
@media (hover: none) {
  /* Touch devices: ensure tap targets and remove hover-dependent reveals */
  .tooltip-bubble { display: none; }
}
@media (max-width: 40rem) {
  h1 { font-size: var(--text-2xl); } h2 { font-size: var(--text-xl); }
  .modal-footer { justify-content: stretch; }
  .modal-footer .btn { flex: 1; }
  .navbar { gap: var(--space-2); }
}
/* ==========================================================================
   Ember — Frame Templates (32)
   Page-level layout scaffolds. Each `.frame-*` is a self-contained, responsive
   skeleton you drop content into. All collapse gracefully on small/touch
   screens with no JS required.
   ========================================================================== */

[class^="frame-"], [class*=" frame-"] { box-sizing: border-box; }

/* 01 — Centered single column ----------------------------------------- */
.frame-centered { max-width: var(--prose-width); margin-inline: auto; padding: var(--space-6) var(--space-4); }

/* 02 — Sidebar left + content ----------------------------------------- */
.frame-sidebar-left { display: grid; grid-template-columns: var(--aside, 16rem) 1fr; min-height: 100vh; }
.frame-sidebar-left > aside { border-inline-end: var(--border-w) solid var(--border); background: var(--surface-2); padding: var(--space-4); overflow: auto; }
.frame-sidebar-left > main { padding: var(--space-6); overflow: auto; min-width: 0; }

/* 03 — Sidebar right + content ---------------------------------------- */
.frame-sidebar-right { display: grid; grid-template-columns: 1fr var(--aside, 16rem); min-height: 100vh; }
.frame-sidebar-right > aside { border-inline-start: var(--border-w) solid var(--border); background: var(--surface-2); padding: var(--space-4); overflow: auto; }
.frame-sidebar-right > main { padding: var(--space-6); min-width: 0; }

/* 04 — Dual sidebar ---------------------------------------------------- */
.frame-dual-sidebar { display: grid; grid-template-columns: var(--left, 14rem) 1fr var(--right, 16rem); min-height: 100vh; }
.frame-dual-sidebar > .left { border-inline-end: var(--border-w) solid var(--border); background: var(--surface-2); padding: var(--space-4); }
.frame-dual-sidebar > .right { border-inline-start: var(--border-w) solid var(--border); background: var(--surface-2); padding: var(--space-4); }
.frame-dual-sidebar > main { padding: var(--space-6); min-width: 0; }

/* 05 — Holy grail (header / 3-col / footer) --------------------------- */
.frame-holy-grail { display: grid; min-height: 100vh; grid-template: "head head head" auto "nav main aside" 1fr "foot foot foot" auto / var(--nav, 13rem) 1fr var(--aside, 15rem); }
.frame-holy-grail > header { grid-area: head; border-bottom: var(--border-w) solid var(--border); padding: var(--space-4); }
.frame-holy-grail > nav { grid-area: nav; border-inline-end: var(--border-w) solid var(--border); background: var(--surface-2); padding: var(--space-4); }
.frame-holy-grail > main { grid-area: main; padding: var(--space-6); min-width: 0; }
.frame-holy-grail > .aside { grid-area: aside; border-inline-start: var(--border-w) solid var(--border); background: var(--surface-2); padding: var(--space-4); }
.frame-holy-grail > footer { grid-area: foot; border-top: var(--border-w) solid var(--border); padding: var(--space-4); }

/* 06 — Dashboard (sticky topbar + sidebar + fluid grid main) ---------- */
.frame-dashboard { display: grid; grid-template-columns: var(--aside, 15rem) 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.frame-dashboard > .topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--space-3); min-height: 60px; padding: 0 var(--space-4); border-bottom: var(--border-w) solid var(--border); background: var(--surface); }
.frame-dashboard > aside { border-inline-end: var(--border-w) solid var(--border); background: var(--surface-2); padding: var(--space-3); overflow: auto; }
.frame-dashboard > main { padding: var(--space-5); overflow: auto; min-width: 0; background: var(--bg); }

/* 07 — Hero landing (full viewport centered) -------------------------- */
.frame-hero { min-height: 90vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-5); padding: var(--space-8) var(--space-4); background: radial-gradient(120% 80% at 50% 0%, var(--accent-soft) 0%, transparent 55%); }
.frame-hero h1 { font-size: var(--text-4xl); max-width: 20ch; }
.frame-hero p { font-size: var(--text-lg); color: var(--text-soft); max-width: 52ch; }

/* 08 — Split hero (50/50) --------------------------------------------- */
.frame-split-hero { display: grid; grid-template-columns: 1fr 1fr; min-height: 80vh; align-items: center; gap: var(--space-7); padding: var(--space-7) var(--space-5); max-width: var(--content-width); margin-inline: auto; }
.frame-split-hero .media { aspect-ratio: 4/3; background: var(--surface-3); border-radius: var(--radius-lg); overflow: hidden; }

/* 09 — Card gallery grid ---------------------------------------------- */
.frame-gallery { padding: var(--space-6) var(--space-4); max-width: var(--content-width); margin-inline: auto; display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fill, minmax(min(18rem, 100%), 1fr)); }

/* 10 — Masonry gallery ------------------------------------------------ */
.frame-masonry { padding: var(--space-6) var(--space-4); max-width: var(--content-width); margin-inline: auto; column-count: 3; column-gap: var(--space-4); }
.frame-masonry > * { break-inside: avoid; margin-bottom: var(--space-4); }
@media (max-width: 56rem) { .frame-masonry { column-count: 2; } }
@media (max-width: 34rem) { .frame-masonry { column-count: 1; } }

/* 11 — Blog article (prose) ------------------------------------------- */
.frame-article { max-width: var(--prose-width); margin-inline: auto; padding: var(--space-7) var(--space-4); }
.frame-article > header { margin-bottom: var(--space-6); }
.frame-article > header h1 { font-size: var(--text-4xl); }
.frame-article .lead { font-size: var(--text-lg); color: var(--text-soft); }
.frame-article figure { margin-block: var(--space-5); }
.frame-article figcaption { font-size: var(--text-sm); color: var(--text-muted); text-align: center; margin-top: var(--space-2); }

/* 12 — Documentation (nav + content + TOC) ---------------------------- */
.frame-docs { display: grid; grid-template-columns: var(--nav, 15rem) minmax(0, 1fr) var(--toc, 13rem); min-height: 100vh; max-width: 88rem; margin-inline: auto; }
.frame-docs > nav { border-inline-end: var(--border-w) solid var(--border); padding: var(--space-5) var(--space-4); position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; }
.frame-docs > main { padding: var(--space-6) var(--space-6); min-width: 0; max-width: var(--prose-width); }
.frame-docs > .toc { padding: var(--space-6) var(--space-4); position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; font-size: var(--text-sm); border-inline-start: var(--border-w) solid var(--border); }

/* 13 — Pricing table -------------------------------------------------- */
.frame-pricing { padding: var(--space-7) var(--space-4); max-width: var(--content-width); margin-inline: auto; }
.frame-pricing .tiers { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); align-items: start; margin-top: var(--space-6); }
.frame-pricing .tier { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.frame-pricing .tier.featured { border-color: var(--accent); box-shadow: var(--shadow); position: relative; }
.frame-pricing .tier .price { font-size: var(--text-3xl); font-weight: var(--weight-bold); }
.frame-pricing .tier ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.frame-pricing .tier li::before { content: "✓"; color: var(--ok); margin-inline-end: var(--space-2); font-weight: var(--weight-bold); }

/* 14 — Feature showcase (alternating rows) ---------------------------- */
.frame-features { padding: var(--space-7) var(--space-4); max-width: var(--content-width); margin-inline: auto; display: flex; flex-direction: column; gap: var(--space-8); }
.frame-features .feature { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); align-items: center; }
.frame-features .feature:nth-child(even) .media { order: -1; }
.frame-features .feature .media { aspect-ratio: 16/10; background: var(--surface-3); border-radius: var(--radius-lg); }

/* 15 — Profile / about ------------------------------------------------ */
.frame-profile { max-width: 60rem; margin-inline: auto; padding: var(--space-6) var(--space-4); }
.frame-profile .profile-head { display: flex; gap: var(--space-5); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-6); }

/* 16 — Contact (form + info split) ------------------------------------ */
.frame-contact { display: grid; grid-template-columns: 1fr 1.2fr; gap: var(--space-7); max-width: var(--content-width); margin-inline: auto; padding: var(--space-7) var(--space-4); align-items: start; }

/* 17 — Auth card (centered) ------------------------------------------- */
.frame-auth { min-height: 100vh; display: grid; place-items: center; padding: var(--space-4); background: radial-gradient(100% 100% at 50% 0%, var(--accent-soft) 0%, transparent 60%); }
.frame-auth .auth-card { width: 100%; max-width: 24rem; background: var(--surface); border: var(--border-w) solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: var(--space-6); }

/* 18 — Split auth (brand panel + form) -------------------------------- */
.frame-auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.frame-auth-split .brand-panel { background: var(--accent); color: var(--text-on-accent); padding: var(--space-7); display: flex; flex-direction: column; justify-content: space-between; }
.frame-auth-split .form-panel { display: grid; place-items: center; padding: var(--space-6); }
.frame-auth-split .form-panel > * { width: 100%; max-width: 22rem; }

/* 19 — Settings (tabbed/sectioned) ------------------------------------ */
.frame-settings { display: grid; grid-template-columns: var(--nav, 14rem) 1fr; gap: var(--space-6); max-width: 64rem; margin-inline: auto; padding: var(--space-6) var(--space-4); align-items: start; }
.frame-settings .settings-section { padding-bottom: var(--space-6); margin-bottom: var(--space-6); border-bottom: var(--border-w) solid var(--border-soft); }

/* 20 — Empty state (full) --------------------------------------------- */
.frame-empty { min-height: 70vh; display: grid; place-items: center; padding: var(--space-6); text-align: center; }

/* 21 — Error page ----------------------------------------------------- */
.frame-error { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-4); padding: var(--space-6); }
.frame-error .code { font-size: clamp(4rem, 18vw, 9rem); font-weight: var(--weight-bold); line-height: 1; color: var(--accent); letter-spacing: -0.04em; }

/* 22 — Coming soon / countdown ---------------------------------------- */
.frame-coming-soon { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--space-5); padding: var(--space-6); background: radial-gradient(120% 90% at 50% 100%, var(--accent-soft) 0%, transparent 55%); }
.frame-coming-soon .countdown { display: flex; gap: var(--space-4); font-variant-numeric: tabular-nums; }
.frame-coming-soon .countdown .unit { display: flex; flex-direction: column; gap: var(--space-1); }
.frame-coming-soon .countdown .num { font-size: var(--text-4xl); font-weight: var(--weight-bold); }
.frame-coming-soon .countdown .lbl { font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }

/* 23 — Portfolio grid (masonry-ish hover) ----------------------------- */
.frame-portfolio { padding: var(--space-6) var(--space-4); max-width: var(--content-width); margin-inline: auto; display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); grid-auto-rows: 12rem; }
.frame-portfolio .tile { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--surface-3); }
.frame-portfolio .tile.wide { grid-column: span 2; } .frame-portfolio .tile.tall { grid-row: span 2; }

/* 24 — Resume / CV ---------------------------------------------------- */
.frame-resume { max-width: 50rem; margin-inline: auto; padding: var(--space-7) var(--space-5); display: grid; grid-template-columns: 1fr 2fr; gap: var(--space-6); }
.frame-resume > header { grid-column: 1 / -1; border-bottom: 2px solid var(--accent); padding-bottom: var(--space-4); }

/* 25 — FAQ ------------------------------------------------------------ */
.frame-faq { max-width: 48rem; margin-inline: auto; padding: var(--space-7) var(--space-4); }

/* 26 — Gallery + lightbox grid ---------------------------------------- */
.frame-lightbox-grid { padding: var(--space-5) var(--space-4); display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(min(10rem, 100%), 1fr)); }
.frame-lightbox-grid img { aspect-ratio: 1; object-fit: cover; cursor: zoom-in; border-radius: var(--radius-xs); transition: transform var(--dur) var(--ease); }
.frame-lightbox-grid img:hover { transform: scale(1.03); }

/* 27 — Kanban board (full height) ------------------------------------- */
.frame-kanban { display: flex; flex-direction: column; height: 100vh; }
.frame-kanban > header { padding: var(--space-3) var(--space-4); border-bottom: var(--border-w) solid var(--border); }
.frame-kanban > .board { flex: 1; overflow: auto; padding: var(--space-4); }

/* 28 — Chat / messaging ----------------------------------------------- */
.frame-chat { display: grid; grid-template-columns: var(--list, 18rem) 1fr; height: 100vh; }
.frame-chat > .conversations { border-inline-end: var(--border-w) solid var(--border); overflow: auto; background: var(--surface-2); }
.frame-chat > .thread { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; }
.frame-chat > .thread > .messages { overflow: auto; padding: var(--space-4); }
.frame-chat > .thread > .composer { border-top: var(--border-w) solid var(--border); padding: var(--space-3); display: flex; gap: var(--space-2); }

/* 29 — Feed / timeline (centered single column) ----------------------- */
.frame-feed { max-width: 38rem; margin-inline: auto; padding: var(--space-5) var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); }

/* 30 — Stats / metrics overview --------------------------------------- */
.frame-stats { padding: var(--space-6) var(--space-4); max-width: var(--content-width); margin-inline: auto; }
.frame-stats .metric-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); }

/* 31 — Full-bleed tool workspace (toolbar + canvas + panels) ---------- */
.frame-workspace { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto 1fr auto; height: 100vh; }
.frame-workspace > .toolbar-top { grid-column: 1 / -1; border-bottom: var(--border-w) solid var(--border); padding: var(--space-2) var(--space-3); display: flex; align-items: center; gap: var(--space-2); background: var(--surface); }
.frame-workspace > .panel-left { border-inline-end: var(--border-w) solid var(--border); width: var(--panel-l, 14rem); overflow: auto; background: var(--surface-2); }
.frame-workspace > .stage { overflow: auto; min-width: 0; background: var(--bg-muted); display: grid; place-items: center; }
.frame-workspace > .panel-right { border-inline-start: var(--border-w) solid var(--border); width: var(--panel-r, 16rem); overflow: auto; background: var(--surface-2); }
.frame-workspace > .statusbar { grid-column: 1 / -1; border-top: var(--border-w) solid var(--border); padding: var(--space-1) var(--space-3); font-size: var(--text-xs); color: var(--text-muted); display: flex; gap: var(--space-3); background: var(--surface); }

/* 32 — Footer-rich landing (stacked sections) ------------------------- */
.frame-landing { display: flex; flex-direction: column; }
.frame-landing > section { padding: var(--space-8) var(--space-4); }
.frame-landing > section > .inner { max-width: var(--content-width); margin-inline: auto; }
.frame-landing > section:nth-child(even) { background: var(--surface-2); }
.frame-landing > footer { background: var(--warm-900); color: var(--warm-100); padding: var(--space-7) var(--space-4); }
:root[data-theme="dark"] .frame-landing > footer { background: #100d09; }
.frame-landing > footer a { color: var(--warm-200); }
.frame-landing > footer .footer-grid { max-width: var(--content-width); margin-inline: auto; display: grid; gap: var(--space-6); grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); }

/* ======================================================================
   Responsive collapse — all multi-column frames stack on small screens.
   ====================================================================== */
@media (max-width: 60rem) {
  .frame-docs { grid-template-columns: var(--nav, 14rem) 1fr; }
  .frame-docs > .toc { display: none; }
  .frame-dual-sidebar { grid-template-columns: var(--left, 13rem) 1fr; }
  .frame-dual-sidebar > .right { display: none; }
  .frame-holy-grail { grid-template: "head" auto "nav" auto "main" 1fr "aside" auto "foot" auto / 1fr; }
  .frame-holy-grail > nav, .frame-holy-grail > .aside { border: 0; border-bottom: var(--border-w) solid var(--border); }
}
@media (max-width: 48rem) {
  .frame-sidebar-left, .frame-sidebar-right, .frame-dashboard,
  .frame-docs, .frame-settings, .frame-chat, .frame-auth-split,
  .frame-split-hero, .frame-features .feature, .frame-contact, .frame-resume {
    grid-template-columns: 1fr;
  }
  .frame-sidebar-left > aside, .frame-sidebar-right > aside,
  .frame-dashboard > aside, .frame-docs > nav, .frame-settings .settings-nav {
    border: 0; border-bottom: var(--border-w) solid var(--border);
  }
  .frame-features .feature:nth-child(even) .media { order: 0; }
  .frame-auth-split .brand-panel { display: none; }
  .frame-chat > .conversations { display: none; }
  .frame-masonry, .frame-portfolio { column-count: 1; }
  .frame-workspace { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto auto; }
  .frame-workspace > .panel-left, .frame-workspace > .panel-right { width: auto; border: 0; border-bottom: var(--border-w) solid var(--border); max-height: 30vh; }
}
