/* ═══════════════════════════════════════════════════════════════════════════
   CityFox design tokens — names match Figma 1:1
   Source: Figma file pKZ0z76SBZCCad8RV7rscq
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* ── Palette (primitive) ──────────────────────────────────────────────── */
  --neutral-white:      #ffffff;
  --neutral-50:         #f6f6f5;
  --neutral-100:        #eeeceb;
  --neutral-15:         #ebe7e4;
  --neutral-200:        #dedad6;
  --neutral-20:         #d6d1cf;
  --neutral-300:        #cbc7c3;
  --neutral-400:        #bab4af;
  --neutral-default:    #a9a19b;
  --neutral-600:        #87817c;
  --neutral-800:        #4a4039;
  --neutral-900:        #2a2422;

  --primary-100:        #ffe1d6;
  --primary-200:        #ffc5a8;
  --primary-400:        #ff8a4d;
  --primary-default:    #fe6930;
  --primary-600:        #cb5426;
  --primary-700:        #a23f1c;

  --secondary-50:       #f3eaff;
  --secondary-200:      #d4b8ff;
  --secondary-300:      #aa85e1;
  --secondary-400:      #a370e0;
  --secondary-default:  #7233cd;

  --error-50:           #fef2f2;
  --error-100:          #fee2e2;
  --error-200:          #fecaca;
  --error-default:      #ef4444;
  --error-600:          #dc2626;
  --error-700:          #b91c1c;

  --success-50:         #f0fdf4;
  --success-200:        #bbf7d0;
  --success-default:    #22c55e;

  --warning-50:         #fffbeb;
  --warning-200:        #fde68a;
  --warning-default:    #f59e0b;

  --alpha-black-8:      rgba(17, 16, 16, 0.08);
  --alpha-black-16:     rgba(17, 16, 16, 0.16);
  --alpha-black-40:     rgba(17, 16, 16, 0.4);
  --alpha-black-64:     rgba(17, 16, 16, 0.64);
  --alpha-black-80:     rgba(17, 16, 16, 0.8);

  /* ── Text/* ───────────────────────────────────────────────────────────── */
  --text-headings:        var(--neutral-900);
  --text-body:            var(--neutral-800);
  --text-body-light:      var(--neutral-800);
  --text-label:           var(--neutral-600);
  --text-label-light:     var(--neutral-400);
  --text-action:          var(--primary-default);
  --text-action-hover:    var(--primary-600);
  --text-action-pressed:  var(--primary-700);
  --text-disabled:        var(--neutral-300);
  --text-information:     var(--secondary-default);
  --text-warning:         var(--warning-default);
  --text-error:           var(--error-default);
  --text-error-hover:     var(--error-600);
  --text-error-pressed:   var(--error-700);
  --text-success:         var(--success-default);
  --text-on-color:        var(--neutral-white);

  /* ── Icon/* ───────────────────────────────────────────────────────────── */
  --icon-default:         var(--neutral-800);
  --icon-action:          var(--primary-default);
  --icon-action-hover:    var(--primary-600);
  --icon-action-pressed:  var(--primary-700);
  --icon-disabled:        var(--neutral-300);
  --icon-information:     var(--secondary-default);
  --icon-warning:         var(--warning-default);
  --icon-error:           var(--error-default);
  --icon-success:         var(--success-default);
  --icon-on-color:        var(--neutral-white);
  --icon-label:           var(--neutral-400);
  --icon-start-point:     var(--primary-400);
  --icon-destination:     var(--secondary-400);

  /* ── Surface/* ────────────────────────────────────────────────────────── */
  --surface-page:                var(--neutral-white);
  --surface-background:          var(--neutral-50);
  --surface-darker-background:   var(--neutral-100);
  --surface-action:              var(--primary-default);
  --surface-action-hover:        var(--primary-600);
  --surface-action-pressed:      var(--primary-700);
  --surface-action-disabled:     var(--primary-200);
  --surface-action-ghost-hover:  var(--primary-100);
  --surface-action-ghost-pressed:var(--primary-200);
  --surface-success:             var(--success-50);
  --surface-warning:             var(--warning-50);
  --surface-error:               var(--error-50);
  --surface-error-pressed:       var(--error-100);
  --surface-information:         var(--secondary-50);
  --surface-disabled:            var(--neutral-300);
  --surface-switch-bg:           var(--neutral-default);
  --surface-switch-bg-hover:     var(--neutral-400);
  --surface-switch-bg-pressed:   var(--neutral-default);
  --surface-modal:               var(--alpha-black-40);

  /* ── Border/* ─────────────────────────────────────────────────────────── */
  --border-default:        var(--neutral-300);
  --border-subtle:         var(--neutral-200);
  --border-success:        var(--success-200);
  --border-information:    var(--secondary-200);
  --border-warning:        var(--warning-200);
  --border-error:          var(--error-200);
  --border-action:         var(--primary-default);
  --border-action-hover:   var(--primary-600);
  --border-action-pressed: var(--primary-700);
  --border-focus:          var(--primary-default);
  --border-disabled:       var(--neutral-200);
  --border-input-hover:    var(--secondary-300);
  --border-input-active:   var(--secondary-default);
  --border-input-error:    var(--error-default);
  --border-icon:           var(--neutral-800);

  /* ── Scale ────────────────────────────────────────────────────────────── */
  --scale-0:    0px;
  --scale-25:   1px;
  --scale-50:   2px;
  --scale-100:  4px;
  --scale-200:  8px;
  --scale-300:  12px;
  --scale-350:  14px;
  --scale-400:  16px;
  --scale-500:  20px;
  --scale-600:  24px;
  --scale-700:  28px;
  --scale-800:  32px;
  --scale-900:  36px;
  --scale-1000: 40px;
  --scale-1100: 44px;
  --scale-1200: 48px;
  --scale-1400: 56px;
  --scale-1600: 64px;
  --scale-1800: 72px;
  --scale-2000: 80px;

  /* ── Border-width / Border-radius (semantic aliases) ──────────────────── */
  --border-w-none: var(--scale-0);
  --border-w-sm:   var(--scale-25);
  --border-w-md:   var(--scale-50);
  --border-w-lg:   var(--scale-100);

  --radius-none:   var(--scale-0);
  --radius-sm:     var(--scale-50);
  --radius-md:     var(--scale-100);
  --radius-lg:     var(--scale-200);
  --radius-xlg:    var(--scale-400);
  --radius-round:  var(--scale-1600);

  /* ── Typography primitives ────────────────────────────────────────────── */
  --font-family-headings: 'Lexend', sans-serif;
  --font-family-text:     'Work Sans', system-ui, sans-serif;
  --font-family-mono:     'JetBrains Mono', ui-monospace, monospace;

  --font-weight-regular:  400;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  /* Named text-style properties — every dimension resolves through Scale */
  /* Headings · Desktop */
  --text-h1-size:            var(--scale-1600);  /* 64 */
  --text-h1-line-height:     var(--scale-1800);  /* 72 */
  --text-h1-letter-spacing:  -0.03em;
  --text-h2-size:            var(--scale-1200);  /* 48 */
  --text-h2-line-height:     var(--scale-1400);  /* 56 */
  --text-h2-letter-spacing:  -0.02em;
  --text-h3-size:            var(--scale-900);   /* 36 */
  --text-h3-line-height:     var(--scale-1100);  /* 44 */
  --text-h3-letter-spacing:  -0.01em;
  --text-h4-size:            var(--scale-800);   /* 32 */
  --text-h4-line-height:     var(--scale-900);   /* 36 */
  --text-h4-letter-spacing:  -0.01em;
  --text-h5-size:            var(--scale-600);   /* 24 */
  --text-h5-line-height:     var(--scale-700);   /* 28 */
  --text-h5-letter-spacing:  0;
  --text-h6-size:            var(--scale-500);   /* 20 */
  --text-h6-line-height:     var(--scale-600);   /* 24 */
  --text-h6-letter-spacing:  0;
  --text-h7-size:            var(--scale-400);   /* 16 */
  --text-h7-line-height:     var(--scale-500);   /* 20 */
  --text-h7-letter-spacing:  0;

  /* Body */
  --text-body-lg-size:         var(--scale-500); /* 20 */
  --text-body-lg-line-height:  var(--scale-800); /* 32 */
  --text-body-md-size:         var(--scale-400); /* 16 */
  --text-body-md-line-height:  var(--scale-500); /* 20 */
  --text-body-sm-size:         var(--scale-350); /* 14 */
  --text-body-sm-line-height:  var(--scale-400); /* 16 */
  --text-body-xsm-size:        var(--scale-300); /* 12 */
  --text-body-xsm-line-height: var(--scale-400); /* 16 */
}

/* ═══════════════════════════════════════════════════════════════════════════
   Type — every text node uses a Desktop/* style
   ═══════════════════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--surface-background);
  color: var(--text-body);
  font-family: var(--font-family-text);
}

/* Desktop heading styles — every value bound to a token */
.h1 { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold); font-size: var(--text-h1-size); line-height: var(--text-h1-line-height); letter-spacing: var(--text-h1-letter-spacing); color: var(--text-headings); margin: 0 0 var(--scale-1600); }
.h2 { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold); font-size: var(--text-h2-size); line-height: var(--text-h2-line-height); letter-spacing: var(--text-h2-letter-spacing); color: var(--text-headings); margin: 0 0 var(--scale-1200); }
.h3 { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold); font-size: var(--text-h3-size); line-height: var(--text-h3-line-height); letter-spacing: var(--text-h3-letter-spacing); color: var(--text-headings); margin: 0 0 var(--scale-800); }
.h4 { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold); font-size: var(--text-h4-size); line-height: var(--text-h4-line-height); letter-spacing: var(--text-h4-letter-spacing); color: var(--text-headings); margin: 0 0 var(--scale-500); }
.h5 { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold); font-size: var(--text-h5-size); line-height: var(--text-h5-line-height); letter-spacing: var(--text-h5-letter-spacing); color: var(--text-headings); margin: 0 0 var(--scale-500); }
.h6 { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold); font-size: var(--text-h6-size); line-height: var(--text-h6-line-height); letter-spacing: var(--text-h6-letter-spacing); color: var(--text-headings); margin: 0 0 var(--scale-500); }
.h7 { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold); font-size: var(--text-h7-size); line-height: var(--text-h7-line-height); letter-spacing: var(--text-h7-letter-spacing); color: var(--text-headings); margin: 0 0 var(--scale-500); }

/* Desktop body styles — every value bound to a token */
.body-lg            { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-lg-size);  line-height: var(--text-body-lg-line-height); }
.body-lg-link       { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-lg-size);  line-height: var(--text-body-lg-line-height);  text-decoration: underline; }
.body-lg-semibold   { font-family: var(--font-family-text); font-weight: var(--font-weight-semibold); font-size: var(--text-body-lg-size);  line-height: var(--text-body-lg-line-height); }
.body-md            { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-md-size);  line-height: var(--text-body-md-line-height); }
.body-md-link       { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-md-size);  line-height: var(--text-body-md-line-height);  text-decoration: underline; }
.body-md-semibold   { font-family: var(--font-family-text); font-weight: var(--font-weight-semibold); font-size: var(--text-body-md-size);  line-height: var(--text-body-md-line-height); }
.body-sm            { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-sm-size);  line-height: var(--text-body-sm-line-height); }
.body-sm-link       { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-sm-size);  line-height: var(--text-body-sm-line-height);  text-decoration: underline; }
.body-sm-semibold   { font-family: var(--font-family-text); font-weight: var(--font-weight-semibold); font-size: var(--text-body-sm-size);  line-height: var(--text-body-sm-line-height); }
.body-xsm           { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height); }
.body-xsm-link      { font-family: var(--font-family-text); font-weight: var(--font-weight-regular);  font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height); text-decoration: underline; }
.body-xsm-semibold  { font-family: var(--font-family-text); font-weight: var(--font-weight-semibold); font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height); }

p { margin: 0 0 var(--scale-500); }

code, .mono { font-family: var(--font-family-mono); font-size: var(--text-body-xsm-size); }

/* ═══════════════════════════════════════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════════════════════════════════════ */
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: var(--scale-800) var(--scale-600);
  background: var(--surface-page);
  border-right: var(--border-w-sm) solid var(--border-subtle);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--scale-300);
  margin-bottom: var(--scale-800);
}
.sidebar-mark {
  width: var(--scale-800);
  height: var(--scale-800);
  border-radius: var(--radius-md);
  background: var(--surface-action);
  display: grid;
  place-items: center;
  color: var(--text-on-color);
  font-family: var(--font-family-headings);
  font-weight: var(--font-weight-bold);
  font-size: var(--text-body-lg-size);  /* was 18px — off-scale; pulled up to 20 (Body lg) */
}

.nav-group { margin-bottom: var(--scale-600); }
.nav-group h6 {
  font-family: var(--font-family-text); font-weight: var(--font-weight-semibold);
  font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height);
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 var(--scale-200);
}
.nav-group a {
  display: flex; align-items: center; gap: var(--scale-200);
  padding: var(--scale-200) var(--scale-300);
  border-radius: var(--radius-md);
  color: var(--text-body);
  text-decoration: none;
  font-family: var(--font-family-text); font-weight: var(--font-weight-regular);
  font-size: var(--text-body-sm-size); line-height: var(--text-body-sm-line-height);
}
.nav-group a:hover { background: var(--surface-darker-background); }
.nav-group a .status {
  margin-left: auto;
  font-family: var(--font-family-mono);
  font-size: var(--text-body-xsm-size);  /* was 11px — off-scale; pulled to 12 (Body xsm) */
  color: var(--text-label-light);
}
.nav-group a.ready    .status { color: var(--text-success); }
.nav-group a.in-progress .status { color: var(--text-warning); }

.main {
  padding: var(--scale-2000) var(--scale-2000);
  max-width: 1200px; /* page-layout breakpoint, off-Scale by intent */
}

/* Page header */
.page-header {
  margin-bottom: var(--scale-2000);
}
.page-header .meta {
  display: inline-flex; gap: var(--scale-200);
  background: var(--surface-information);
  border: var(--border-w-sm) solid var(--border-information);
  color: var(--text-information);
  padding: var(--scale-100) var(--scale-300);
  border-radius: var(--radius-round);
  margin-bottom: var(--scale-600);
}

/* Section separators */
section.group { margin-bottom: var(--scale-2000); }
section.group > .section-intro { margin-bottom: var(--scale-1200); }

.kicker {
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--scale-200);
}

/* Component card */
.component {
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-subtle);
  border-radius: var(--radius-xlg);
  padding: var(--scale-800);
  margin-bottom: var(--scale-800);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--scale-800);
}
.component.gated { grid-template-columns: minmax(0, 1fr); }
.component .preview { width: 100%; box-sizing: border-box; }
.component-head {
  display: flex; align-items: baseline; gap: var(--scale-300);
  margin-bottom: var(--scale-300);
}
.badge {
  display: inline-flex; align-items: center; gap: var(--scale-100);
  padding: var(--scale-50) var(--scale-200);
  border-radius: var(--radius-round);
  font-family: var(--font-family-text); font-weight: var(--font-weight-semibold);
  font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height);
}
.badge.ready    { background: var(--surface-success);     color: var(--text-success); border: var(--border-w-sm) solid var(--border-success); }
.badge.progress { background: var(--surface-warning);     color: var(--text-warning); border: var(--border-w-sm) solid var(--border-warning); }
.figma-id {
  font-family: var(--font-family-mono);
  font-size: var(--text-body-xsm-size);
  color: var(--text-label);
}
.component-tagline { color: var(--text-body); margin-bottom: var(--scale-500); }

.component-body h7,
.component-body h6 { margin-top: var(--scale-600); }

.spec-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--scale-300) 0 var(--scale-500);
}
.spec-table th,
.spec-table td {
  text-align: left;
  padding: var(--scale-200) var(--scale-300);
  border-bottom: var(--border-w-sm) solid var(--border-subtle);
  font-family: var(--font-family-text); font-weight: var(--font-weight-regular);
  font-size: var(--text-body-sm-size); line-height: var(--text-body-sm-line-height);
  color: var(--text-body);
  vertical-align: top;
}
.spec-table th {
  font-weight: var(--font-weight-semibold);
  color: var(--text-label);
  background: var(--surface-background);
}
.spec-table code { background: var(--surface-darker-background); padding: 1px 6px; border-radius: var(--radius-sm); }

ul.spec-list { margin: 0; padding-left: var(--scale-500); }
ul.spec-list li { margin-bottom: var(--scale-200); }

/* Preview pane */
.preview {
  background: var(--surface-background);
  border: var(--border-w-sm) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--scale-600);
  display: flex; flex-direction: column; gap: var(--scale-400);
  align-self: start;
}
.preview-row { display: flex; flex-wrap: wrap; gap: var(--scale-300); align-items: center; }
.preview-stack { display: flex; flex-direction: column; gap: var(--scale-300); }
.preview-label { color: var(--text-label); }

/* Variant matrix — column = state, row = type */
.variant-grid {
  display: grid;
  gap: var(--scale-300) var(--scale-400);
  align-items: center;
  margin-bottom: var(--scale-400);
}
.variant-grid .vh,
.variant-grid .vrl {
  font-family: var(--font-family-text); font-weight: var(--font-weight-semibold);
  font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height);
  color: var(--text-label);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.variant-grid .vrl { text-align: right; }
.variant-grid .vh  { text-align: center; }
.variant-grid .cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--scale-1100);
}
.variant-section-title {
  font-family: var(--font-family-mono); font-size: var(--text-body-xsm-size);
  color: var(--text-body);
  margin: var(--scale-400) 0 var(--scale-200);
  padding-bottom: var(--scale-100);
  border-bottom: var(--border-w-sm) dashed var(--border-subtle);
}
.variant-section-title:first-of-type { margin-top: 0; }

/* ═══════════════════════════════════════════════════════════════════════════
   Component renders — Button
   ═══════════════════════════════════════════════════════════════════════════ */
.cf-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--scale-300);
  border-radius: var(--radius-lg);
  font-family: var(--font-family-text); font-weight: var(--font-weight-semibold);
  font-size: var(--text-body-md-size); line-height: var(--text-body-md-line-height);
  border: var(--border-w-none) solid transparent;
  cursor: pointer;
  padding: 0 var(--scale-400);
  height: var(--scale-1000);
  transition: background-color 80ms ease, color 80ms ease, border-color 80ms ease;
}
.cf-btn.lg { height: var(--scale-1100); }
.cf-btn.sm { height: var(--scale-700); padding: 0 var(--scale-300); gap: var(--scale-200);
             font-size: var(--text-body-sm-size); line-height: var(--text-body-sm-line-height); }

.cf-btn.primary    { background: var(--surface-action); color: var(--text-on-color); }
.cf-btn.primary:hover   { background: var(--text-action-hover); }
.cf-btn.primary:active  { background: var(--surface-action-pressed); }

.cf-btn.outlined   { background: transparent; color: var(--text-body); border: var(--border-w-sm) solid var(--border-default); }
.cf-btn.outlined:hover  { background: var(--neutral-15); }
.cf-btn.outlined:active { background: var(--neutral-20); }

.cf-btn.ghost      { background: transparent; color: var(--text-action); }
.cf-btn.ghost:hover     { background: var(--surface-action-ghost-hover); }
.cf-btn.ghost:active    { background: var(--surface-action-ghost-pressed); }

.cf-btn.danger     { background: transparent; color: var(--text-error); border: var(--border-w-sm) solid var(--border-default); }
.cf-btn.danger:hover    { background: var(--surface-error); }
.cf-btn.danger:active   { background: var(--surface-error-pressed); }

.cf-btn[disabled] { cursor: not-allowed; }
.cf-btn.primary[disabled]  { background: var(--surface-action-disabled); color: var(--text-on-color); }
.cf-btn.outlined[disabled],
.cf-btn.ghost[disabled],
.cf-btn.danger[disabled]   { color: var(--text-disabled); background: transparent; }

/* Forced states for variant matrix (real :hover/:active still work) */
.cf-btn.primary.is-hover    { background: var(--text-action-hover); }
.cf-btn.primary.is-pressed  { background: var(--surface-action-pressed); }
.cf-btn.outlined.is-hover   { background: var(--neutral-15); }
.cf-btn.outlined.is-pressed { background: var(--neutral-20); }
.cf-btn.ghost.is-hover      { background: var(--surface-action-ghost-hover); }
.cf-btn.ghost.is-pressed    { background: var(--surface-action-ghost-pressed); }
.cf-btn.danger.is-hover     { background: var(--surface-error); }
.cf-btn.danger.is-pressed   { background: var(--surface-error-pressed); }

/* Phosphor icon sizing per context. Icons inherit font-size and use currentColor. */
/* Button — spec: 32 / 24 / 16 for lg / md / sm */
.cf-btn .ph             { font-size: var(--scale-600); flex-shrink: 0; line-height: 1; }
.cf-btn.lg .ph          { font-size: var(--scale-800); }
.cf-btn.sm .ph          { font-size: var(--scale-400); }
/* Field/Dropdown caret */
.cf-field .ph           { font-size: var(--scale-500); }
/* Dropdown menu — selected check */
.cf-menu-item .ph       { font-size: var(--scale-600); }
/* Checkbox glyph — 16 on md, 20 on lg */
.cf-checkbox .ph        { font-size: var(--scale-400); line-height: 1; color: var(--icon-on-color); }
.cf-checkbox.lg .ph     { font-size: var(--scale-500); }
/* Modal — md close button uses a 24px icon (matches Button md icon size). Head icon stays 24 inside the 32×32 slot. */
.cf-modal-close .ph     { font-size: var(--scale-600); }
.cf-modal-head .icon .ph{ font-size: var(--scale-600); }

/* ─ Field/Dropdown ──────────────────────────────────────────────────────── */
.cf-label {
  display: inline-flex; align-items: center; gap: var(--scale-100);
  color: var(--text-label);
  font-family: var(--font-family-text); font-weight: var(--font-weight-regular);
  font-size: var(--text-body-sm-size); line-height: var(--text-body-sm-line-height);
}
.cf-label.required::before { content: '*'; color: var(--text-error); margin-right: var(--scale-50); }
.cf-label.xs { font-size: var(--text-body-xsm-size); }
/* Icon slot — 20px on md, 16px on xs, in Icon/Label color */
.cf-label .ph     { font-size: var(--scale-500); color: var(--icon-label); line-height: 1; }
.cf-label.xs .ph  { font-size: var(--scale-400); }

/* Default label-to-field gap is Scale/200 (md / sm). lg bumps to Scale/300. */
.cf-field-wrap { display: flex; flex-direction: column; gap: var(--scale-200); }
.cf-field-wrap:has(.cf-field.lg),
.cf-field-wrap:has(.cf-textarea.lg) { gap: var(--scale-300); }
.cf-field {
  display: flex; align-items: center; gap: var(--scale-200);
  height: var(--scale-1100);
  padding: 0 var(--scale-300);
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-body);
  font-family: var(--font-family-text); font-weight: var(--font-weight-regular);
  font-size: var(--text-body-sm-size); line-height: var(--text-body-sm-line-height);
  min-width: var(--scale-2000);  /* 80 — preview-only sizing floor */
}
.cf-field.lg     { height: var(--scale-1400);
                   font-size: var(--text-body-md-size); line-height: var(--text-body-md-line-height); }
.cf-field.sm     { height: var(--scale-700); }
/* Hover · border swaps to Border/Input-hover (Secondary/300). Width stays at sm. */
.cf-field.is-hover { border-color: var(--border-input-hover); }
/* Active · border swaps to Border/Input-active. Width stays at sm (1px) — confirmed by user. */
.cf-field.active,
.cf-field.is-active { border-color: var(--border-input-active); }

/* Interactive demo · use real :hover and :focus-visible. Apply via .interactive + tabindex="0". */
.cf-field.interactive { cursor: pointer; outline: none; }
.cf-field.interactive:hover:not(.is-disabled):not(.is-error)         { border-color: var(--border-input-hover); }
.cf-field.interactive:focus-visible:not(.is-disabled):not(.is-error) { border-color: var(--border-input-active); }
.cf-field .caret { transition: transform 120ms ease; }

/* Combobox — Field/Dropdown trigger paired with a Dropdown menu popup */
.cf-combobox { position: relative; }
.cf-combobox-menu {
  position: absolute;
  top: calc(100% + var(--scale-100));
  left: 0;
  width: 100%;
  z-index: 10;
}
.cf-combobox.is-open .cf-field .caret { transform: rotate(180deg); }
.cf-combobox.is-open .cf-field { border-color: var(--border-input-active); }

/* Show the trailing check only on selected menu items (markup includes it on every row) */
.cf-menu-item .check { display: none; margin-left: auto; }
.cf-menu-item.selected .check { display: inline-flex; }
.cf-field.is-filled { border-color: var(--border-default); }
.cf-field.error,
.cf-field.is-error  { border-color: var(--border-input-error); }
.cf-field.disabled,
.cf-field.is-disabled { background: var(--surface-background); color: var(--text-disabled); border-color: var(--border-default); }
.cf-field .placeholder { color: var(--text-label-light); }
.cf-field .caret { margin-left: auto; color: var(--icon-default); }
.cf-hint  { color: var(--text-label); font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height); }
.cf-error-msg { color: var(--text-error); font-size: var(--text-body-xsm-size); line-height: var(--text-body-xsm-line-height); }

/* ─ Dropdown menu ───────────────────────────────────────────────────────── */
.cf-menu {
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 247px; /* Figma published spec width — off-Scale by intent */
}
.cf-menu-item {
  display: flex; align-items: center; gap: var(--scale-200);
  padding: var(--scale-300);
  height: var(--scale-1400);
  color: var(--text-body);
  border-bottom: var(--border-w-sm) solid var(--border-subtle);
  cursor: pointer;
}
.cf-menu-item:last-child { border-bottom: none; }
.cf-menu-item:hover,
.cf-menu-item.is-hover               { background: var(--surface-background); }
.cf-menu-item.selected               { background: var(--surface-action); color: var(--text-on-color); }
.cf-menu-item.selected:hover,
.cf-menu-item.selected.is-hover      { background: var(--surface-action-hover); }
.cf-menu-item.is-disabled,
.cf-menu-item.disabled               { color: var(--text-disabled); cursor: not-allowed; background: var(--surface-page); }
.cf-menu-item.selected.is-disabled,
.cf-menu-item.selected.disabled      { background: var(--surface-disabled); color: var(--text-on-color); }
.cf-menu-item .check { margin-left: auto; }

/* ─ Checkbox ────────────────────────────────────────────────────────────── */
.cf-checkbox {
  width: var(--scale-600); height: var(--scale-600);
  border: var(--border-w-sm) solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-page);
  display: inline-grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.cf-checkbox.lg { width: var(--scale-800); height: var(--scale-800); }
/* Selected/Unselected base */
.cf-checkbox.selected { background: var(--surface-action); border-color: var(--border-action); }
/* Forced states — Unselected · hover/pressed = action-tinted (Figma 233:9700) */
.cf-checkbox.is-hover,
.cf-checkbox.interactive:hover:not(.is-disabled):not(.is-error):not(.selected)        { background: var(--surface-action-ghost-hover);   border-color: var(--border-action); }
.cf-checkbox.is-pressed,
.cf-checkbox.interactive:active:not(.is-disabled):not(.is-error):not(.selected)       { background: var(--surface-action-ghost-pressed); border-color: var(--border-action-pressed); }
.cf-checkbox.is-error,
.cf-checkbox.error                            { background: var(--surface-error); border-color: var(--border-input-error); }
.cf-checkbox.is-disabled,
.cf-checkbox.disabled                         { background: var(--surface-disabled); border-color: var(--border-disabled); cursor: not-allowed; }
/* Forced states — Selected */
.cf-checkbox.selected.is-hover,
.cf-checkbox.selected.interactive:hover:not(.is-disabled):not(.is-error)              { background: var(--surface-action-hover);   border-color: var(--border-action-hover); }
.cf-checkbox.selected.is-pressed,
.cf-checkbox.selected.interactive:active:not(.is-disabled):not(.is-error)             { background: var(--surface-action-pressed); border-color: var(--border-action-pressed); }
.cf-checkbox.selected.is-error                { background: var(--surface-action); border-color: var(--border-input-error); }
.cf-checkbox.selected.is-disabled,
.cf-checkbox.selected.disabled                { background: var(--surface-disabled); border-color: var(--border-disabled); }
.cf-checkbox svg { color: var(--icon-on-color); }
/* Interactive demo · hide check on unselected, show on selected */
.cf-checkbox.interactive { outline: none; }
.cf-checkbox.interactive:focus-visible:not(.is-disabled) { box-shadow: 0 0 0 var(--border-w-md) var(--border-focus); }
.cf-checkbox.interactive:not(.selected) .ph-check { display: none; }
.cf-row { display: inline-flex; align-items: center; gap: var(--scale-200); }
.cf-row .body { color: var(--text-body); font-family: var(--font-family-text);
                font-size: var(--text-body-sm-size); line-height: var(--text-body-sm-line-height); }

/* ─ Radio ───────────────────────────────────────────────────────────────── */
.cf-radio {
  width: var(--scale-600); height: var(--scale-600);
  border: var(--border-w-sm) solid var(--border-default);
  border-radius: var(--radius-round);
  background: var(--surface-page);
  display: inline-grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.cf-radio.lg { width: var(--scale-800); height: var(--scale-800); }
.cf-radio.selected { background: var(--surface-action); border-color: var(--border-action); }
.cf-radio.selected::after {
  content: ''; width: var(--scale-300); height: var(--scale-300);
  border-radius: var(--radius-round);
  background: var(--surface-page);
}
/* Forced states — Unselected · hover/pressed = action-tinted (Figma 233:9908) */
.cf-radio.is-hover,
.cf-radio.interactive:hover:not(.is-disabled):not(.is-error):not(.selected)          { background: var(--surface-action-ghost-hover);   border-color: var(--border-action); }
.cf-radio.is-pressed,
.cf-radio.interactive:active:not(.is-disabled):not(.is-error):not(.selected)         { background: var(--surface-action-ghost-pressed); border-color: var(--border-action-pressed); }
.cf-radio.is-error                  { background: var(--surface-error); border-color: var(--border-input-error); }
.cf-radio.is-disabled,
.cf-radio.disabled                  { background: var(--surface-disabled); border-color: var(--border-disabled); }
/* Forced states — Selected */
.cf-radio.selected.is-hover,
.cf-radio.selected.interactive:hover:not(.is-disabled):not(.is-error)                { background: var(--surface-action-hover);   border-color: var(--border-action-hover); }
.cf-radio.selected.is-pressed,
.cf-radio.selected.interactive:active:not(.is-disabled):not(.is-error)               { background: var(--surface-action-pressed); border-color: var(--border-action-pressed); }
.cf-radio.selected.is-error         { background: var(--surface-action); border-color: var(--border-input-error); }
.cf-radio.selected.is-disabled,
.cf-radio.selected.disabled         { background: var(--surface-disabled); border-color: var(--border-disabled); }
/* Interactive demo */
.cf-radio.interactive { outline: none; }
.cf-radio.interactive:focus-visible:not(.is-disabled) { box-shadow: 0 0 0 var(--border-w-md) var(--border-focus); }

/* ─ Switch ──────────────────────────────────────────────────────────────── */
.cf-switch {
  position: relative;
  width: var(--scale-1100); height: var(--scale-600); /* 44 × 24 */
  padding: var(--scale-100);
  border-radius: var(--radius-round);
  background: var(--surface-switch-bg);
  /* Transparent base border keeps geometry constant when On/Disabled show a visible stroke */
  border: var(--border-w-sm) solid transparent;
  display: inline-flex; align-items: center;
  cursor: pointer;
  transition: background-color 80ms ease, border-color 80ms ease;
  flex-shrink: 0;
}
/* Hover halo overlay — Off only. Surface/Action-ghost-hover at 50% opacity behind the knob. */
.cf-switch::before { content: none; }
.cf-switch.is-hover:not(.on)::before,
.cf-switch.interactive:hover:not(.is-disabled):not(.on)::before {
  content: '';
  position: absolute;
  inset: calc(-1 * var(--scale-25));   /* -1px overflow halo around the track */
  border-radius: var(--radius-round);
  background: var(--surface-action-ghost-hover);
  opacity: 0.5;
  pointer-events: none;
}
.cf-switch .knob { position: relative; z-index: 1; } /* keep knob above halo */
.cf-switch.sm { width: var(--scale-900); height: var(--scale-500); /* 36 × 20 */ }
.cf-switch .knob {
  width: var(--scale-400); height: var(--scale-400); /* 16 */
  border-radius: var(--radius-round);
  background: var(--neutral-white);
  transition: transform 100ms ease;
}
.cf-switch.sm .knob { width: var(--scale-300); height: var(--scale-300); /* 12 */ }
/* On state — Border/Action stroke (per spec; visually merges with the orange surface) */
.cf-switch.on { background: var(--surface-action); justify-content: flex-end;
                border-color: var(--border-action); }
.cf-switch.on .knob { background: var(--neutral-white); }
.cf-switch.disabled,
.cf-switch.is-disabled { background: var(--surface-disabled); cursor: not-allowed; border: var(--border-w-sm) solid var(--border-disabled); }
/* Forced states — Off · gray track + orange border + halo overlay (Figma 234:10059) */
.cf-switch.is-hover,
.cf-switch.interactive:hover:not(.is-disabled):not(.on)         { background: var(--surface-switch-bg-hover);
                                                                  border-color: var(--border-action-hover); }
.cf-switch.is-pressed,
.cf-switch.interactive:active:not(.is-disabled):not(.on)        { background: var(--surface-switch-bg-pressed);
                                                                  border-color: var(--border-action-pressed); }
/* Forced states — On (track + border swap) */
.cf-switch.on.is-hover,
.cf-switch.on.interactive:hover:not(.is-disabled)               { background: var(--surface-action-hover);
                                                                  border-color: var(--border-action-hover); }
.cf-switch.on.is-pressed,
.cf-switch.on.interactive:active:not(.is-disabled)              { background: var(--surface-action-pressed);
                                                                  border-color: var(--border-action-pressed); }
/* Interactive demo */
.cf-switch.interactive { outline: none; }
.cf-switch.interactive:focus-visible:not(.is-disabled) { box-shadow: 0 0 0 var(--border-w-md) var(--border-focus); }

/* ─ Text area ───────────────────────────────────────────────────────────── */
/* Wrapper that holds iconLeft + editable area + iconRight (matches Figma 334:1696) */
.cf-textarea {
  display: flex;
  align-items: flex-start;
  gap: var(--scale-200);                                      /* gap-Spacing/spacing 03 */
  height: 120px; width: 100%;                                 /* heights 80/120/160 are off-Scale by spec */
  padding: var(--scale-300);                                  /* px/py-Scale/300 */
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-default);
  border-radius: var(--radius-lg);
  color: var(--text-body);
  font-family: var(--font-family-text); font-weight: var(--font-weight-regular);
  /* Default (md) and sm use Body sm. lg uses Body md (override below). */
  font-size: var(--text-body-sm-size); line-height: var(--text-body-sm-line-height);
  cursor: text;
}
.cf-textarea > .ph {
  flex-shrink: 0;
  color: var(--icon-default);
  align-self: flex-start;
}
.cf-textarea > .ph-caret-down  { font-size: var(--scale-500); /* 20 — iconRight */ }
.cf-textarea > .ph:not(.ph-caret-down) { font-size: var(--scale-600); /* 24 — iconLeft */ }
.cf-textarea-input {
  flex: 1 0 0; min-width: 0;
  align-self: stretch;
  border: 0; background: transparent; outline: none; resize: none;
  font: inherit; color: inherit;
  padding: var(--scale-100) 0;                                /* py-Scale/100 — Container offset */
  width: 100%;
}
.cf-textarea-input::placeholder { color: var(--text-label-light); }

/* States */
.cf-textarea:focus-within,
.cf-textarea.is-active { border-color: var(--border-input-active); outline: none; }
.cf-textarea.lg { height: 160px;
                  font-size: var(--text-body-md-size); line-height: var(--text-body-md-line-height); }
.cf-textarea.sm { height: var(--scale-2000); /* 80 */ }
/* Hover · Border/Input-hover (matches Field/Dropdown — Figma fix shipped 334:1722) */
.cf-textarea.is-hover,
.cf-textarea:hover:not(:focus-within):not(.is-disabled):not(.is-error) { border-color: var(--border-input-hover); }
.cf-textarea.is-filled   { border-color: var(--border-default); }
.cf-textarea.is-error    { border-color: var(--border-input-error); }
.cf-textarea.is-disabled { background: var(--surface-background); color: var(--text-disabled); border-color: var(--border-default); cursor: not-allowed; }
.cf-textarea.is-disabled .cf-textarea-input { color: var(--text-disabled); cursor: not-allowed; }
.cf-textarea.is-disabled > .ph { color: var(--icon-disabled); }

/* ─ Modal ───────────────────────────────────────────────────────────────── */
.cf-modal-frame {
  position: relative;
  background: var(--surface-modal);
  border-radius: var(--radius-lg);
  padding: var(--scale-1200) var(--scale-600);
  display: grid; place-items: center;
  min-height: 280px; /* preview frame height — off-Scale, not part of the spec */
}
.cf-modal {
  width: 386px; max-width: 100%; /* Figma published spec — off-Scale by intent */
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-default);
  border-radius: var(--radius-xlg);
  overflow: hidden;
}
.cf-modal-head {
  position: relative;
  display: flex; gap: var(--scale-300);
  align-items: flex-start;                     /* Figma: items-start */
  padding: var(--scale-500) var(--scale-100) var(--scale-300) var(--scale-600);
}
.cf-modal-head .icon {                         /* Generic 32×32 slot — no chip styling */
  width: var(--scale-800); height: var(--scale-800);
  color: var(--icon-default);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.cf-modal-titles {                             /* Title block: column, gap 8, pt 4 */
  display: flex; flex-direction: column;
  gap: var(--scale-200);
  padding-top: var(--scale-100);
  flex: 1 0 0;
  min-width: 0;
}
.cf-modal-title { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold);
                  font-size: var(--text-h6-size); line-height: var(--text-h6-line-height);
                  color: var(--text-headings); margin: 0; }
.cf-modal-subline { color: var(--text-body); margin: 0; }
.cf-modal-close {
  /* Button md sizing — height 40, icon 24, px 16. Top adjusted so center == H6 center (y=36) */
  position: absolute;
  top: var(--scale-400); right: var(--scale-25);   /* 16 / 1 — keeps center on H6 */
  height: var(--scale-1000);                       /* 40 tall (md), content-driven width */
  padding: 0 var(--scale-400);                     /* px-16 */
  border-radius: var(--radius-lg);
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--scale-300);                           /* gap-12 */
  cursor: pointer; color: var(--icon-default);
  background: transparent; border: 0;
}
.cf-modal-close:hover { background: var(--surface-darker-background); }
.cf-modal-content { padding: var(--scale-100) var(--scale-600) var(--scale-800); color: var(--text-body); }
.cf-modal-actions { display: flex; gap: var(--scale-300); padding: 0 var(--scale-600) var(--scale-600); }
.cf-modal-actions .cf-btn { flex: 1; }
.cf-modal-actions.vertical { flex-direction: column; }
.cf-modal-actions.vertical .cf-btn { width: 100%; flex: none; }

/* ─ Gated state ─────────────────────────────────────────────────────────── */
.gated-block {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--scale-400);
}
.gated-tile {
  border: var(--border-w-sm) dashed var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--scale-500);
  background: var(--surface-page);
  display: flex; flex-direction: column; gap: var(--scale-200);
}
.gated-tile .name { font-family: var(--font-family-headings); font-weight: var(--font-weight-bold);
                    font-size: var(--text-h7-size); line-height: var(--text-h7-line-height);
                    color: var(--text-headings); }
.gated-tile .id   { font-family: var(--font-family-mono); font-size: var(--text-body-xsm-size);
                    color: var(--text-label); }

/* ─ Token tables ────────────────────────────────────────────────────────── */
.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--scale-300);
}
.token-chip {
  display: flex; align-items: center; gap: var(--scale-300);
  padding: var(--scale-300);
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-subtle);
  border-radius: var(--radius-md);
}
.token-swatch {
  width: var(--scale-1000); height: var(--scale-1000);
  border-radius: var(--radius-md);
  border: var(--border-w-sm) solid var(--border-subtle);
  flex-shrink: 0;
}
.token-info { display: flex; flex-direction: column; min-width: 0; }
.token-name { font-family: var(--font-family-mono); font-size: var(--text-body-xsm-size);
              color: var(--text-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.token-resolves { font-family: var(--font-family-mono); font-size: var(--text-body-xsm-size);  /* was 11 — pulled to 12 (Body xsm) */
                  color: var(--text-label); }

.scale-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--scale-300); }
.scale-tile {
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--scale-300);
  display: flex; flex-direction: column; gap: var(--scale-200);
}
.scale-tile .bar {
  height: var(--scale-200);
  background: var(--surface-action);
  border-radius: var(--radius-sm);
}

.type-row {
  background: var(--surface-page);
  border: var(--border-w-sm) solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--scale-400) var(--scale-500);
  margin-bottom: var(--scale-200);
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--scale-500);
  align-items: center;
}
.type-row .meta-name { font-family: var(--font-family-mono); font-size: var(--text-body-xsm-size); color: var(--text-label); }
.type-row .meta-spec { font-family: var(--font-family-mono); font-size: var(--text-body-xsm-size);  /* was 11 — pulled to 12 (Body xsm) */
                       color: var(--text-label-light); margin-top: var(--scale-100); }

/* ─ Anti-pattern callouts ────────────────────────────────────────────────── */
.callout {
  border-left: var(--border-w-lg) solid var(--border-error);
  background: var(--surface-error);
  padding: var(--scale-300) var(--scale-400);
  border-radius: var(--radius-md);
  margin: var(--scale-400) 0;
}
.callout.info { border-left-color: var(--border-information); background: var(--surface-information); color: var(--text-information); }

@media (max-width: 1024px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: var(--border-w-sm) solid var(--border-subtle); }
  .main { padding: var(--scale-1200); }
  .component { grid-template-columns: 1fr; }
}
