/* ==========================================================================
   Frontdesk — "Assembly"

   The product assembles a lead out of a conversation, so the interface is
   built from blocks: rounded, coloured, each with a dot at its end, snapping
   into slots on a periwinkle field. White surfaces float as objects rather
   than sitting as regions.

   Brand Studio writes --brand-primary / --brand-accent / --font-display onto
   :root, which is why rebranding retints everything — including the page
   that documents these tokens.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700&family=Figtree:wght@400;500;600;700&family=Azeret+Mono:wght@400;500&family=Instrument+Serif:ital@0;1&family=Outfit:wght@500;700&display=swap');

:root {
  /* -- Brand (overwritten at runtime by Brand Studio) -- */
  --brand-primary: #4A63C8;
  --brand-accent:  #F5B546;

  /* -- The field -- */
  --ink:        #1B2445;
  --ink-soft:   #5A6690;
  --ink-faint:  #8B95B8;
  --wash:       #D5E1F8;
  --wash-deep:  #C2D2F1;
  --paper:      #FFFFFF;
  --paper-2:    #F4F7FE;
  --line:       #E4EAF8;
  --line-strong:#C2CEEC;

  /* -- The blocks -- */
  --coral: #EF837B;
  --mint:  #63C6AE;
  --amber: #F5B546;
  --sky:   #7FA9EA;
  --plum:  #A98BD8;

  /* -- Typography -- */
  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --font-body:    'Figtree', 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'Azeret Mono', ui-monospace, Menlo, monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-lg:   1.0625rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.9rem;
  --text-3xl:  2.9rem;

  /* -- Space -- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;

  /* -- Form -- */
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 20px; --radius-xl: 28px;
  --radius-full: 999px;

  /* Shadows are blue-tinted, never gray — objects on a blue field. */
  --shadow-sm: 0 1px 2px rgba(27,36,69,.05), 0 2px 6px rgba(74,99,200,.06);
  --shadow-md: 0 4px 10px rgba(27,36,69,.06), 0 12px 28px rgba(74,99,200,.10);
  --shadow-lg: 0 10px 24px rgba(27,36,69,.10), 0 30px 64px rgba(74,99,200,.18);

  --sidebar-w: 250px;
  --ease: cubic-bezier(.2,.8,.3,1);
  --ease-snap: cubic-bezier(.34,1.56,.5,1);
}

/* Type pairings offered in Brand Studio. Each swaps the display face only —
   body and data faces stay put so the system holds together. */
[data-fonts="editorial"] {
  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
}
[data-fonts="editorial"] h1,
[data-fonts="editorial"] h2,
[data-fonts="editorial"] .stat__value,
[data-fonts="editorial"] .dial__num { letter-spacing: -0.01em; font-weight: 400; }

[data-fonts="humanist"] {
  --font-display: 'Outfit', 'Segoe UI', system-ui, sans-serif;
}
[data-fonts="humanist"] h1,
[data-fonts="humanist"] h2 { letter-spacing: -0.03em; }

* { box-sizing: border-box; }

/* Author `display` rules outrank the UA stylesheet's [hidden] rule. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Two soft lights on the field. The only ambient decoration — everything
   else earns its place. */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(48rem 32rem at 6% -8%,  rgba(127,169,234,.46), transparent 64%),
    radial-gradient(42rem 28rem at 104% 6%, rgba(245,181,70,.20),  transparent 62%),
    radial-gradient(34rem 24rem at 88% 104%, rgba(99,198,174,.16), transparent 60%);
}

h1,h2,h3,h4 {
  font-family: var(--font-display);
  font-weight: 700; line-height: 1.08; margin: 0;
  letter-spacing: -0.025em;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); letter-spacing: -0.015em; }
p  { margin: 0 0 var(--space-3); }
a  { color: inherit; text-decoration: none; }
small { font-size: var(--text-xs); }

::selection { background: var(--brand-accent); color: var(--ink); }

:focus-visible {
  outline: 2.5px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Layout ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: var(--space-5);
  padding: var(--space-5);
  min-height: 100vh;
  align-items: start;
}

.sidebar {
  background: var(--paper);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column; gap: var(--space-5);
  padding: var(--space-5) var(--space-4);
  position: sticky; top: var(--space-5);
  min-height: calc(100vh - var(--space-5) * 2);
}

.brandmark { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.brandmark__logo {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  font-size: 21px; border-radius: 14px;
  background: color-mix(in srgb, var(--brand-primary) 12%, var(--paper));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--brand-primary) 22%, transparent);
  transform: rotate(-4deg);
  transition: transform .3s var(--ease-snap);
}
.brandmark:hover .brandmark__logo { transform: rotate(4deg) scale(1.04); }
.brandmark__text { min-width: 0; }
.brandmark__text strong {
  display: block; font-family: var(--font-display);
  font-size: 0.9375rem; font-weight: 700; letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brandmark__text small { color: var(--ink-faint); font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__item {
  position: relative;
  display: flex; align-items: center; gap: var(--space-3);
  padding: 9px var(--space-3);
  border-radius: var(--radius-md);
  color: var(--ink-soft); font-size: var(--text-sm); font-weight: 550;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav__item:hover { background: var(--paper-2); color: var(--ink); transform: translateX(2px); }
.nav__item.is-active {
  background: color-mix(in srgb, var(--brand-primary) 11%, transparent);
  color: var(--brand-primary); font-weight: 650;
}
/* The active marker is a block, like everything else here. */
.nav__item.is-active::after {
  content: ''; position: absolute; right: 11px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--brand-primary);
}
.nav__ico {
  width: 11px; height: 11px; flex: none;
  border-radius: 3.5px; background: var(--ico, var(--line-strong));
  transition: transform .18s var(--ease-snap), box-shadow .18s var(--ease);
}
.nav__item:hover .nav__ico { transform: scale(1.18) rotate(-8deg); }
.nav__item.is-active .nav__ico {
  transform: scale(1.15);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--ico) 22%, transparent);
}

.sidebar__foot { margin-top: auto; padding-top: var(--space-4); border-top: 1.5px solid var(--line); }

.statusdot {
  font-size: 11.5px; color: var(--ink-soft); font-weight: 550;
  display: flex; align-items: center; gap: 7px;
}
.statusdot::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--mint);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--mint) 22%, transparent);
}
.statusdot.is-demo::before {
  background: var(--amber);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--amber) 24%, transparent);
}

.main { padding: var(--space-2) var(--space-2) var(--space-8); max-width: 1180px; }
.loading { color: var(--ink-faint); padding: var(--space-8); text-align: center; }

.page__head { margin-bottom: var(--space-6); }
.page__head h1 { font-size: var(--text-3xl); }
.page__head .lede {
  color: var(--ink-soft); max-width: 58ch; margin: var(--space-3) 0 0;
  font-size: var(--text-lg); line-height: 1.5;
}
.page__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }

/* An eyebrow is only used where the content really is a labelled category. */
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint);
  display: block; margin-bottom: var(--space-2);
}

/* ---------- Surfaces ---------- */

.card {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}
.card--flush { padding: 0; overflow: hidden; }

/* ---------- Blocks (the signature) ----------
   A rounded bar with a dot at its end, lifted from the reference
   illustration. Used for every badge, score and status in the app. */

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px 4px 11px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 650; letter-spacing: -0.005em;
  white-space: nowrap;
}
.badge::after {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; opacity: .5; flex: none;
}
.badge--plain::after { display: none; }

.badge--hot   { background: color-mix(in srgb, var(--coral) 18%, var(--paper)); color: #C4544B; }
.badge--warm  { background: color-mix(in srgb, var(--amber) 24%, var(--paper)); color: #A9741A; }
.badge--cold  { background: var(--wash); color: var(--ink-soft); }
.badge--ok    { background: color-mix(in srgb, var(--mint) 22%, var(--paper)); color: #2F8570; }
.badge--brand { background: color-mix(in srgb, var(--brand-primary) 13%, var(--paper)); color: var(--brand-primary); }

/* ---------- Controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-size: var(--text-sm); font-weight: 600;
  padding: 9px 16px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line-strong); background: var(--paper); color: var(--ink);
  cursor: pointer; transition: all .18s var(--ease);
}
.btn:hover { background: var(--paper-2); transform: translateY(-1.5px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn--primary {
  background: var(--brand-primary); border-color: var(--brand-primary); color: #fff;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--brand-primary) 62%, #000);
}
.btn--primary:hover {
  background: color-mix(in srgb, var(--brand-primary) 92%, #000);
  box-shadow: 0 4px 0 color-mix(in srgb, var(--brand-primary) 62%, #000), var(--shadow-md);
}
.btn--primary:active { box-shadow: 0 1px 0 color-mix(in srgb, var(--brand-primary) 62%, #000); }
.btn--accent {
  background: var(--brand-accent); border-color: var(--brand-accent); color: #4A3208;
  box-shadow: 0 2px 0 color-mix(in srgb, var(--brand-accent) 65%, #000);
}
.btn--accent:hover { box-shadow: 0 4px 0 color-mix(in srgb, var(--brand-accent) 65%, #000), var(--shadow-md); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-soft); box-shadow: none; }
.btn--ghost:hover { background: var(--wash); color: var(--ink); }
.btn--sm { padding: 6px 11px; font-size: var(--text-xs); }

.input, .select, .textarea {
  width: 100%; font: inherit; font-size: var(--text-sm);
  padding: 10px 12px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line); background: var(--paper-2); color: var(--ink);
  transition: border-color .18s var(--ease), background .18s var(--ease), box-shadow .18s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; background: var(--paper);
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--brand-primary) 16%, transparent);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.55; }
.field { margin-bottom: var(--space-4); }
.field > label {
  display: block; font-size: 11px; font-weight: 600;
  color: var(--ink-faint); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .09em; font-family: var(--font-mono);
}
.field .hint { font-size: var(--text-xs); color: var(--ink-faint); margin-top: 5px; }

.grid { display: grid; gap: var(--space-4); }
.grid--2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

/* ---------- Stat tiles ---------- */

.stat {
  position: relative; overflow: hidden;
  background: var(--paper); border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
/* Each tile is tagged with a coloured block on its edge. */
.stat::before {
  content: ''; position: absolute; left: 0; top: 18%; bottom: 18%;
  width: 5px; border-radius: 0 var(--radius-full) var(--radius-full) 0;
  background: var(--tile, var(--sky));
}
.stat__label {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--ink-faint); text-transform: uppercase; letter-spacing: .11em;
}
.stat__value {
  font-family: var(--font-display); font-size: var(--text-2xl);
  font-weight: 700; line-height: 1.05; margin-top: 7px; letter-spacing: -0.035em;
}
.stat__value small { font-size: var(--text-base); font-weight: 600; color: var(--ink-faint); }
.stat__note { font-size: var(--text-xs); color: var(--ink-faint); margin-top: 3px; }

/* ---------- Table ---------- */

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead th {
  text-align: left; padding: 11px var(--space-4);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  color: var(--ink-faint); text-transform: uppercase; letter-spacing: .11em;
  background: var(--paper-2); border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 13px var(--space-4); border-bottom: 1.5px solid var(--line);
  vertical-align: middle; white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
/* Below wide desktop, drop the two lowest-value columns rather than let
   every cell wrap to two lines. */
@media (max-width: 1320px) {
  thead th:nth-child(5), thead th:nth-child(6),
  tbody td:nth-child(5), tbody td:nth-child(6) { display: none; }
}
tbody tr { cursor: pointer; transition: background .15s var(--ease); }
tbody tr:hover { background: var(--paper-2); }
tbody tr:hover .cell-name { color: var(--brand-primary); }
.cell-name { font-weight: 650; transition: color .15s var(--ease); }
.cell-sub { color: var(--ink-faint); font-size: var(--text-xs); }
.cell-num { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--ink-soft); }

/* The score is a block filling a slot. */
.scorebar { display: flex; align-items: center; gap: 9px; }
.scorebar__track {
  width: 48px; height: 7px; border-radius: var(--radius-full);
  background: var(--wash); overflow: hidden; flex: none;
}
.scorebar__fill { height: 100%; border-radius: inherit; transition: width .6s var(--ease); }

/* ---------- Drawer ---------- */

.drawer {
  position: fixed; top: var(--space-4); right: var(--space-4); bottom: var(--space-4);
  width: min(540px, calc(100% - var(--space-5)));
  background: var(--paper); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); z-index: 60;
  display: flex; flex-direction: column; overflow: hidden;
  animation: slidein .34s var(--ease);
}
@keyframes slidein { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer__head {
  padding: var(--space-5); border-bottom: 1.5px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3);
  background: var(--paper-2);
}
.drawer__body { padding: var(--space-5); overflow-y: auto; flex: 1; }
.drawer__section { margin-bottom: var(--space-6); }
.drawer__section:last-child { margin-bottom: 0; }
.drawer__section > h4 {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .11em;
  color: var(--ink-faint); margin-bottom: var(--space-3);
}
.scrim {
  position: fixed; inset: 0; background: rgba(27,36,69,.34);
  backdrop-filter: blur(3px); z-index: 55; animation: fade .24s var(--ease);
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.kv { display: grid; grid-template-columns: 108px 1fr; gap: 9px var(--space-3); font-size: var(--text-sm); }
.kv dt { color: var(--ink-faint); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- Chat ---------- */

.chat { display: flex; flex-direction: column; gap: var(--space-3); }
.bubble {
  max-width: 84%; padding: 10px 14px;
  font-size: var(--text-sm); line-height: 1.5;
  animation: pop .26s var(--ease-snap);
}
@keyframes pop { from { transform: translateY(8px) scale(.97); opacity: 0 } to { transform: none; opacity: 1 } }
.bubble--agent {
  background: var(--wash); color: var(--ink); align-self: flex-start;
  border-radius: var(--radius-lg) var(--radius-lg) var(--radius-lg) 6px;
}
.bubble--visitor {
  background: var(--brand-primary); color: #fff; align-self: flex-end;
  border-radius: var(--radius-lg) var(--radius-lg) 6px var(--radius-lg);
}
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .18s } .typing i:nth-child(3) { animation-delay: .36s }
@keyframes blink { 0%,60%,100% { opacity: .22 } 30% { opacity: 1 } }

/* Mock client website behind the widget */
.sitepreview {
  border-radius: var(--radius-xl); overflow: hidden;
  background: var(--paper); position: relative;
  min-height: 580px; display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
}
.sitepreview__chrome {
  display: flex; align-items: center; gap: 7px;
  padding: 11px var(--space-4); background: var(--paper-2);
  border-bottom: 1.5px solid var(--line);
}
.sitepreview__chrome i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.sitepreview__chrome i:nth-child(1) { background: color-mix(in srgb, var(--coral) 65%, var(--paper)); }
.sitepreview__chrome i:nth-child(2) { background: color-mix(in srgb, var(--amber) 70%, var(--paper)); }
.sitepreview__chrome i:nth-child(3) { background: color-mix(in srgb, var(--mint) 65%, var(--paper)); }
.sitepreview__url {
  margin-left: var(--space-3); font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-faint);
}
.sitenav {
  display: flex; gap: var(--space-5); padding: var(--space-4) var(--space-6);
  border-bottom: 1.5px solid var(--line); font-size: var(--text-sm);
  color: var(--ink-soft); font-weight: 500;
}
.sitehero {
  padding: var(--space-7) var(--space-6); flex: 1;
  background:
    radial-gradient(30rem 20rem at 4% 0%, color-mix(in srgb, var(--brand-primary) 11%, transparent), transparent 65%),
    var(--paper);
}
.sitehero h1 { font-size: 2.4rem; max-width: 11ch; }
.sitehero p { color: var(--ink-soft); max-width: 30ch; margin-top: var(--space-3); font-size: var(--text-sm); }
.sitehero__cta { margin-top: var(--space-5); }

.widget {
  position: absolute; bottom: var(--space-4); width: 304px;
  background: var(--paper); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: 410px; overflow: hidden;
}
.widget[data-pos="bottom-right"] { right: var(--space-4); }
.widget[data-pos="bottom-left"]  { left: var(--space-4); }
.widget__head {
  background: var(--brand-primary); color: #fff;
  padding: var(--space-3) var(--space-4); display: flex; align-items: center; gap: var(--space-3);
}
.widget__head strong { font-family: var(--font-display); font-size: var(--text-sm); font-weight: 700; }
.widget__head small { opacity: .82; display: block; font-size: 11px; }
.widget__body { padding: var(--space-4); overflow-y: auto; flex: 1; min-height: 190px; }
.widget__foot { border-top: 1.5px solid var(--line); padding: var(--space-3); display: flex; gap: var(--space-2); }

/* ---------- Live extraction: the block-snap ----------
   Each field is an empty slot until the agent learns it, then a coloured
   block drops into place. This is the one orchestrated moment in the app. */

.extract { display: flex; flex-direction: column; gap: 7px; }
.slot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 9px 12px; border-radius: var(--radius-md);
  background: var(--paper-2);
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: var(--text-sm); min-height: 40px;
  transition: background .3s var(--ease), box-shadow .3s var(--ease);
}
.slot__key { color: var(--ink-faint); font-size: var(--text-xs); font-weight: 550; }
.slot__val { font-weight: 650; text-align: right; color: var(--ink-faint); font-style: italic; opacity: .7; }

.slot.is-filled {
  background: color-mix(in srgb, var(--slot-tint, var(--sky)) 15%, var(--paper));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--slot-tint, var(--sky)) 38%, transparent);
}
.slot.is-filled .slot__val { color: var(--ink); font-style: normal; opacity: 1; }
.slot.just-snapped { animation: snap .5s var(--ease-snap); }
@keyframes snap {
  0%   { transform: translateX(14px) scale(.96); opacity: .3; }
  60%  { transform: translateX(-2px) scale(1.02); opacity: 1; }
  100% { transform: none; }
}

.dial { display: grid; place-items: center; gap: 3px; padding: var(--space-3) 0 var(--space-5); }
.dial__num {
  font-family: var(--font-display); font-size: 3.4rem;
  font-weight: 700; line-height: 1; letter-spacing: -0.05em;
  transition: color .5s var(--ease);
}
.dial__cap {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .13em;
}

/* ---------- Brand studio ---------- */

.swatchrow { display: flex; gap: var(--space-3); align-items: center; }
.colorpick {
  width: 48px; height: 40px; padding: 3px; border-radius: var(--radius-md);
  border: 1.5px solid var(--line-strong); background: var(--paper); cursor: pointer;
}
.preset {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--line); border-radius: var(--radius-md);
  cursor: pointer; transition: all .2s var(--ease);
  background: var(--paper); width: 100%;
  font: inherit; font-size: var(--text-sm); font-weight: 550;
  text-align: left; color: var(--ink);
}
.preset:hover {
  border-color: var(--brand-primary); transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.preset__dots { display: flex; gap: 5px; margin-left: auto; }
.preset__dots i {
  width: 17px; height: 17px; border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgba(27,36,69,.09);
}

/* ---------- Design system page ---------- */

.tokengrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px,1fr)); gap: var(--space-3); }
.token { border-radius: var(--radius-md); overflow: hidden; box-shadow: inset 0 0 0 1.5px var(--line); }
/* Near-white tokens would otherwise disappear against the card. */
.token__chip { height: 56px; box-shadow: inset 0 0 0 1px rgba(27,36,69,.10); }
.token__meta { padding: 9px 11px; background: var(--paper); }
.token__meta code { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft); }
.typespec {
  display: flex; align-items: baseline; gap: var(--space-4);
  padding: var(--space-3) 0; border-bottom: 1.5px solid var(--line);
}
.typespec:last-child { border-bottom: 0; }
.typespec code {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint);
  width: 96px; flex: none;
}
.subhead {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .11em; color: var(--ink-faint);
  margin-bottom: var(--space-3);
}

/* ---------- Modal / toast / notice ---------- */

.modal {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(27,36,69,.42); backdrop-filter: blur(4px); padding: var(--space-4);
}
.modal__card {
  background: var(--paper); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-6); max-width: 545px; width: 100%;
  animation: pop .32s var(--ease-snap);
}
.modal__card h2 { font-size: var(--text-2xl); }
.modal__card .lede { color: var(--ink-soft); margin-top: var(--space-2); }
.modal__actions { margin-top: var(--space-5); display: flex; justify-content: flex-end; }

/* A real 3-step sequence, so numbering carries information. */
.steps { list-style: none; margin: var(--space-5) 0 0; padding: 0; counter-reset: step; }
/* The marker is positioned rather than laid out as a sibling: a grid or flex
   parent would promote each bare text node in the item to its own track. */
.steps li {
  counter-increment: step;
  position: relative; padding-left: 42px;
  margin-bottom: var(--space-4); line-height: 1.5;
  font-size: var(--text-sm); color: var(--ink-soft);
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--brand-primary) 12%, var(--paper));
  color: var(--brand-primary);
}
.steps strong { color: var(--ink); font-weight: 650; }

.toast {
  position: fixed; bottom: var(--space-5); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 20px;
  border-radius: var(--radius-full); font-size: var(--text-sm); font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 95; animation: pop .28s var(--ease-snap);
}

.notice {
  display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg); font-size: var(--text-sm);
  background: color-mix(in srgb, var(--amber) 15%, var(--paper));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--amber) 34%, transparent);
  margin-bottom: var(--space-5); color: var(--ink);
}
.notice code {
  font-family: var(--font-mono); font-size: 11.5px;
  background: var(--paper); padding: 2px 6px; border-radius: 6px;
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid--3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; gap: var(--space-4); padding: var(--space-3); }
  .sidebar {
    position: static; min-height: 0; flex-direction: row; align-items: center;
    gap: var(--space-4); overflow-x: auto; padding: var(--space-3);
    border-radius: var(--radius-lg);
  }
  .nav { flex-direction: row; }
  .nav__item span:not(.nav__ico) { display: none; }
  .nav__item.is-active::after { display: none; }
  .sidebar__foot { margin-top: 0; padding-top: 0; border-top: 0; margin-left: auto; }
  .main { padding: 0 0 var(--space-7); }
  .page__head h1 { font-size: 2.1rem; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .drawer { inset: auto 0 0 0; top: 8vh; width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
  .widget { position: static; width: auto; margin: var(--space-4); max-height: none; }
  .sitepreview { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
