/* =========================================================
   IBUDO Design System — App layer
   Site chrome, navigation, tweak overrides, utilities
   Sits ON TOP of tokens.css
   ========================================================= */

/* ---- Tweakable theme overrides ----
   These three groups are toggled by the Tweaks panel via
   data-attributes on <html>. They only override semantic tokens,
   never the brand palette itself.
*/

/* Accent color: blue (default), green, purple, red */
html[data-accent="green"] {
  --accent:         var(--ibudo-green);
  --accent-hover:   #00C44E;
  --accent-pressed: #009E3D;
  --accent-fg:      var(--ink-900);
  --accent-soft:    #E0FBEC;
  --shadow-accent:  0 12px 28px rgba(1, 244, 98, 0.25);
}
html[data-accent="purple"] {
  --accent:         var(--ibudo-purple);
  --accent-hover:   #9648EB;
  --accent-pressed: #7E33D6;
  --accent-fg:      var(--white);
  --accent-soft:    #F4ECFF;
  --shadow-accent:  var(--shadow-purple);
}
html[data-accent="red"] {
  --accent:         var(--ibudo-red);
  --accent-hover:   #ED3A4F;
  --accent-pressed: #D52A3F;
  --accent-fg:      var(--white);
  --accent-soft:    #FFEBEE;
  --shadow-accent:  0 12px 28px rgba(255, 78, 99, 0.30);
}
html:not([data-accent]),
html[data-accent="blue"] {
  --shadow-accent: var(--shadow-blue);
}

/* Density: comfortable (default) | compact | airy */
html[data-density="compact"] {
  --pad-card: var(--space-4);
  --pad-section: var(--space-12);
  --gap-stack: var(--space-3);
  --control-h: 36px;
  --control-px: 14px;
}
html, html[data-density="comfortable"] {
  --pad-card: var(--space-6);
  --pad-section: var(--space-20);
  --gap-stack: var(--space-4);
  --control-h: 44px;
  --control-px: 18px;
}
html[data-density="airy"] {
  --pad-card: var(--space-10);
  --pad-section: var(--space-24);
  --gap-stack: var(--space-6);
  --control-h: 52px;
  --control-px: 22px;
}

/* Radius scale: doux (default) | net | arrondi */
html[data-radius="net"] {
  --r-xs: 0px;
  --r-sm: 2px;
  --r-md: 4px;
  --r-lg: 6px;
  --r-xl: 8px;
}
html, html[data-radius="doux"] {
  --r-xs: var(--radius-xs);
  --r-sm: var(--radius-sm);
  --r-md: var(--radius-md);
  --r-lg: var(--radius-lg);
  --r-xl: var(--radius-xl);
}
html[data-radius="arrondi"] {
  --r-xs: 8px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
}

/* Button shape: pill (default) | rond (slight) | carre */
html[data-btnshape="pill"] { --r-btn: 999px; }
html, html[data-btnshape="rond"] { --r-btn: var(--r-md); }
html[data-btnshape="carre"] { --r-btn: 2px; }

/* Dark mode — Midnight Blue surface */
html[data-mode="dark"] {
  --bg:           var(--ibudo-navy);
  --bg-elevated:  #221F7E;
  --bg-muted:     #1E1B73;
  --bg-inverse:   var(--white);

  --fg:           var(--white);
  --fg-muted:     rgba(255,255,255,0.72);
  --fg-subtle:    rgba(255,255,255,0.50);
  --fg-inverse:   var(--ink-900);

  --border:       rgba(255,255,255,0.14);
  --border-strong: rgba(255,255,255,0.28);

  --accent-soft:  rgba(255,255,255,0.10);
}
html[data-mode="dark"][data-accent="blue"] {
  --accent:       var(--ibudo-blue-200);
  --accent-hover: var(--ibudo-blue-300);
  --accent-pressed: var(--ibudo-blue);
  --accent-fg:    var(--white);
}
html[data-mode="dark"][data-accent="green"] {
  --accent:       var(--ibudo-green);
  --accent-hover: var(--ibudo-green-200);
  --accent-pressed: #00C44E;
  --accent-fg:    var(--ibudo-navy);
}

/* =========================================================
   RESET-ish
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; }

/* =========================================================
   APP SHELL
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  padding: var(--space-6) var(--space-5);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2);
}
.sidebar-brand img { height: 28px; }
.sidebar-brand-meta {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.sidebar-brand-meta .label {
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  font-size: var(--fs-14);
  color: var(--fg);
}
.sidebar-brand-meta .meta {
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--fg-subtle);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  margin-top: 4px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-group-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: var(--w-semi);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-subtle);
  padding: 0 var(--space-3);
  margin: var(--space-3) 0 var(--space-2);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  font-weight: var(--w-medium);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.nav-link:hover { background: var(--accent-soft); color: var(--accent); border-bottom: none; }
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: var(--w-semi);
}
.nav-link .num {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  color: var(--fg-subtle);
  margin-left: auto;
  font-weight: var(--w-regular);
}
.nav-link.active .num { color: var(--accent); }

.sidebar-footer {
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  font-size: var(--fs-12);
  color: var(--fg-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Main */
.main {
  min-width: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) var(--space-10);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.topbar-crumbs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-14);
  color: var(--fg-subtle);
  font-family: var(--font-body);
}
.topbar-crumbs strong { color: var(--fg); font-weight: var(--w-semi); }
.topbar-spacer { flex: 1; }
.topbar-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--bg-muted);
  border-radius: var(--r-md);
  padding: 8px var(--space-3);
  width: 280px;
  color: var(--fg-subtle);
  font-size: var(--fs-14);
}
.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--fg-muted);
}

.page {
  padding: var(--space-12) var(--space-10) var(--space-24);
  max-width: 1180px;
  width: 100%;
}
.page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-12);
}
.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--fs-12);
  font-weight: var(--w-semi);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--accent);
}
.page-eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background: var(--accent);
}
.page-title {
  font-family: var(--font-display);
  font-weight: var(--w-light);
  font-size: var(--fs-64);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}
.page-lead {
  font-family: var(--font-body);
  font-size: var(--fs-20);
  line-height: var(--lh-norm);
  color: var(--fg-muted);
  max-width: 64ch;
  margin: 0;
}

.section {
  margin-top: var(--space-16);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--fs-30);
  font-weight: var(--w-regular);
  margin: 0;
  letter-spacing: var(--tracking-snug);
}
.section-meta {
  font-size: var(--fs-14);
  color: var(--fg-subtle);
  font-family: var(--font-body);
}
.section-desc {
  font-family: var(--font-body);
  color: var(--fg-muted);
  max-width: 70ch;
  margin: 0 0 var(--space-8);
  line-height: var(--lh-norm);
}

/* Spec block: chrome around demo + label */
.spec {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg);
  overflow: hidden;
  margin-bottom: var(--space-6);
}
.spec-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: var(--fs-12);
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.spec-bar .right { display: flex; gap: var(--space-3); align-items: center; text-transform: none; letter-spacing: 0; font-weight: var(--w-regular); color: var(--fg-subtle); }
.spec-body {
  padding: var(--space-10) var(--space-8);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  flex-wrap: wrap;
  min-height: 160px;
}
.spec-body.left { justify-content: flex-start; align-items: flex-start; }
.spec-body.stack { flex-direction: column; align-items: stretch; }
.spec-body.dark { background: var(--ibudo-navy); color: var(--white); }
.spec-body.muted { background: var(--bg-elevated); }
.spec-body.tight { padding: var(--space-6); min-height: 0; }
.spec-body.flush { padding: 0; min-height: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }

/* =========================================================
   ATOMIC COMPONENTS
   ========================================================= */

/* Button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: var(--control-h);
  padding: 0 var(--control-px);
  border-radius: var(--r-btn);
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  font-size: var(--fs-14);
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 5px var(--accent);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-fg);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-pressed); transform: translateY(1px); }
.btn-primary.lift { box-shadow: var(--shadow-accent); }

.btn-secondary {
  background: var(--bg);
  color: var(--fg);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn-secondary:active { background: var(--accent-soft); border-color: var(--accent-pressed); }

.btn-ghost {
  background: transparent;
  color: var(--fg);
}
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }

.btn-icon {
  width: var(--control-h);
  padding: 0;
  background: transparent;
  color: var(--fg);
  border-radius: var(--r-btn);
}
.btn-icon:hover { background: var(--accent-soft); color: var(--accent); }

.btn-grad {
  background: var(--grad-arc);
  color: var(--white);
  border: none;
  position: relative;
}
.btn-grad:hover { filter: brightness(1.05); }

.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-12); }
.btn-lg { height: 56px; padding: 0 28px; font-size: var(--fs-16); }
.btn-block { width: 100%; }

.btn[disabled], .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Input */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-family: var(--font-body);
  font-size: var(--fs-14);
  font-weight: var(--w-medium);
  color: var(--fg);
}
.field-hint { font-size: var(--fs-12); color: var(--fg-subtle); }
.field-error { font-size: var(--fs-12); color: var(--ibudo-red); }
.input, .select, .textarea {
  width: 100%;
  height: var(--control-h);
  padding: 0 var(--control-px);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  color: var(--fg);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.textarea { height: auto; padding: 12px var(--control-px); min-height: 96px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--fg-subtle); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.error, .select.error, .textarea.error {
  border-color: var(--ibudo-red);
  box-shadow: 0 0 0 3px rgba(255,78,99,0.12);
}
.input-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: var(--control-h);
  padding: 0 var(--control-px);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--bg);
}
.input-group input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-family: var(--font-body);
  font-size: var(--fs-14);
  color: var(--fg);
  padding: 0;
  height: 100%;
}
.input-group .icon { color: var(--fg-subtle); }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%),
                    linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

/* Checkbox / radio */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  cursor: pointer;
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-out);
  background: var(--bg);
  color: transparent;
}
.check input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.check.radio .box { border-radius: 50%; }
.check.radio input:checked + .box {
  background: var(--bg);
  border-color: var(--accent);
  border-width: 5px;
}
.check input:focus-visible + .box {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 40px; height: 22px;
  background: var(--ink-300);
  border-radius: 999px;
  position: relative;
  transition: background var(--dur-norm) var(--ease-out);
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: var(--white);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-norm) var(--ease-out);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 10px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: var(--w-semi);
  letter-spacing: 0.02em;
  background: var(--bg-muted);
  color: var(--fg-muted);
  white-space: nowrap;
}
.badge.solid { background: var(--accent); color: var(--accent-fg); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--fg); }
.badge.success { background: rgba(1, 244, 98, 0.12); color: #008A38; }
.badge.warning { background: rgba(248, 243, 38, 0.20); color: #6B6500; }
.badge.danger  { background: rgba(255, 78, 99, 0.12); color: #C81F36; }
.badge.info    { background: rgba(24, 99, 220, 0.10); color: var(--ibudo-blue); }
.badge.magic   { background: rgba(173, 97, 255, 0.12); color: var(--ibudo-purple); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Avatar */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  font-size: var(--fs-14);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar.sm { width: 28px; height: 28px; font-size: var(--fs-12); }
.avatar.lg { width: 56px; height: 56px; font-size: var(--fs-18); }
.avatar.xl { width: 72px; height: 72px; font-size: var(--fs-20); }
.avatar.brand { background: var(--ibudo-blue); color: var(--white); }
.avatar.green { background: rgba(1, 244, 98, 0.18); color: #008A38; }
.avatar.purple { background: rgba(173, 97, 255, 0.15); color: var(--ibudo-purple); }
.avatar.red { background: rgba(255, 78, 99, 0.13); color: var(--ibudo-red); }
.avatar.yellow { background: rgba(248, 243, 38, 0.30); color: #6B6500; }
.avatar.grad { background: var(--grad-arc); color: var(--white); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-status {
  position: absolute;
  bottom: 0; right: 0;
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--ibudo-green);
}
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar:not(:first-child) { margin-left: -10px; box-shadow: 0 0 0 2px var(--bg); }

/* Card */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--pad-card);
  transition: box-shadow var(--dur-norm) var(--ease-out), transform var(--dur-norm) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.card.elev { box-shadow: var(--shadow-sm); }
.card.hover:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.card-title {
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  font-size: var(--fs-18);
  margin: 0 0 6px;
}
.card-text { color: var(--fg-muted); font-size: var(--fs-14); margin: 0; line-height: var(--lh-norm); }

/* Alert */
.alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--bg);
  align-items: flex-start;
}
.alert .alert-icon { flex-shrink: 0; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.alert .alert-title { font-family: var(--font-display); font-weight: var(--w-semi); font-size: var(--fs-14); margin: 0 0 4px; }
.alert .alert-body { font-size: var(--fs-14); color: var(--fg-muted); margin: 0; }
.alert.info { background: var(--accent-soft); border-color: transparent; }
.alert.info .alert-icon { color: var(--accent); }
.alert.success { background: rgba(1, 244, 98, 0.10); border-color: transparent; }
.alert.success .alert-icon { color: #008A38; }
.alert.warning { background: rgba(248, 243, 38, 0.20); border-color: transparent; }
.alert.warning .alert-icon { color: #8A7E00; }
.alert.danger { background: rgba(255, 78, 99, 0.10); border-color: transparent; }
.alert.danger .alert-icon { color: var(--ibudo-red); }

/* Tooltip */
.tt { position: relative; display: inline-block; }
.tt[data-tt]:hover::after {
  content: attr(data-tt);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-900);
  color: var(--white);
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-12);
  white-space: nowrap;
  z-index: 100;
  font-family: var(--font-body);
}

/* Chip / tag */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--bg-muted);
  font-family: var(--font-body);
  font-size: var(--fs-12);
  font-weight: var(--w-medium);
  color: var(--fg);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.chip:hover { background: var(--accent-soft); color: var(--accent); }
.chip.active { background: var(--accent); color: var(--accent-fg); }

/* Divider */
.divider { height: 1px; background: var(--border); margin: var(--space-6) 0; }

/* Logo dot — tiny "O ouvert" inline mark */
.brand-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ibudo-blue);
  display: inline-block;
}

/* Code preview */
.code-block {
  background: var(--ink-900);
  color: #C4CADD;
  border-radius: var(--r-sm);
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--fs-12);
  line-height: 1.6;
  overflow-x: auto;
}
.code-block .tk-prop { color: #91B6F3; }
.code-block .tk-val { color: #5DFE9D; }
.code-block .tk-com { color: #6E7896; font-style: italic; }

/* Tabs */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--border); }
.tabs .tab {
  padding: 10px var(--space-4);
  font-family: var(--font-display);
  font-weight: var(--w-medium);
  font-size: var(--fs-14);
  color: var(--fg-muted);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--dur-fast) var(--ease-out);
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--fg); }
.tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Breadcrumbs */
.crumbs { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-body); font-size: var(--fs-14); color: var(--fg-subtle); }
.crumbs a { color: var(--fg-muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); border-bottom: none; }
.crumbs .sep { color: var(--ink-300); }
.crumbs .current { color: var(--fg); font-weight: var(--w-medium); }

/* Pagination */
.pagination { display: inline-flex; align-items: center; gap: 4px; }
.pagination .pg {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: var(--w-medium); font-size: var(--fs-14);
  color: var(--fg-muted);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: all var(--dur-fast) var(--ease-out);
}
.pagination .pg:hover { background: var(--accent-soft); color: var(--accent); }
.pagination .pg.active { background: var(--accent); color: var(--accent-fg); }

/* Table */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--font-body);
  font-size: var(--fs-14);
}
.table th {
  text-align: left;
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  font-size: var(--fs-12);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-subtle);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.table td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  color: var(--fg);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: none; }

/* Toast */
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  background: var(--ink-900);
  color: var(--white);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
}
.toast.success { background: var(--ink-900); border-left: 3px solid var(--ibudo-green); }
.toast.danger { background: var(--ink-900); border-left: 3px solid var(--ibudo-red); }
.toast .toast-title { font-family: var(--font-display); font-weight: var(--w-semi); font-size: var(--fs-14); margin: 0; }
.toast .toast-body { font-size: var(--fs-12); color: rgba(255,255,255,0.7); margin: 4px 0 0; }
.toast .close { margin-left: auto; background: none; border: none; color: rgba(255,255,255,0.6); cursor: pointer; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 15, 31, 0.5);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: var(--space-6);
}
.modal {
  background: var(--bg);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  max-width: 480px;
  width: 100%;
  padding: var(--space-8);
}
.modal-title { font-family: var(--font-display); font-weight: var(--w-semi); font-size: var(--fs-24); margin: 0 0 var(--space-2); }
.modal-body { color: var(--fg-muted); margin: 0 0 var(--space-6); line-height: var(--lh-norm); }
.modal-actions { display: flex; gap: var(--space-3); justify-content: flex-end; }

/* Banner */
.banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--ink-900);
  color: var(--white);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  border-radius: var(--r-md);
}
.banner.brand {
  background: var(--grad-brand);
  color: var(--white);
}
.banner .close {
  margin-left: auto;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
}

/* Accordion */
.accordion { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; background: var(--bg); }
.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: none; }
.accordion-header {
  padding: var(--space-4) var(--space-5);
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  font-size: var(--fs-16);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  background: var(--bg);
  transition: background var(--dur-fast) var(--ease-out);
}
.accordion-header:hover { background: var(--bg-elevated); }
.accordion-header .chev { transition: transform var(--dur-norm) var(--ease-out); color: var(--fg-subtle); }
.accordion-item.open .accordion-header .chev { transform: rotate(90deg); color: var(--accent); }
.accordion-body {
  padding: 0 var(--space-5) var(--space-5);
  color: var(--fg-muted);
  font-size: var(--fs-14);
  line-height: var(--lh-norm);
  display: none;
}
.accordion-item.open .accordion-body { display: block; }

/* Empty state */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-12) var(--space-6);
  gap: var(--space-3);
}
.empty .sticker { width: 120px; height: 120px; }
.empty h4 { font-family: var(--font-display); font-weight: var(--w-semi); font-size: var(--fs-20); margin: 0; }
.empty p { color: var(--fg-muted); margin: 0 0 var(--space-3); max-width: 38ch; }

/* Inline icons (lucide-style stroke, currentColor) */
.i { display: inline-block; width: 1em; height: 1em; vertical-align: -0.15em; flex-shrink: 0; }
.i-sm { width: 14px; height: 14px; }
.i-md { width: 18px; height: 18px; }
.i-lg { width: 22px; height: 22px; }

/* Token swatch */
.swatch {
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
}
.swatch-color { aspect-ratio: 16/10; }
.swatch-meta { padding: var(--space-3); }
.swatch-name { font-family: var(--font-display); font-weight: var(--w-semi); font-size: var(--fs-14); margin: 0; }
.swatch-hex { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--fg-subtle); margin-top: 2px; }

/* =========================================================
   TWEAKS PANEL
   ========================================================= */
.tweaks-toggle {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 200;
  background: var(--ink-900);
  color: var(--white);
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-family: var(--font-display);
  font-size: var(--fs-14);
  font-weight: var(--w-semi);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur-fast) var(--ease-out);
}
.tweaks-toggle:hover { transform: translateY(-2px); }

.tweaks-panel {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 320px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xl);
  z-index: 200;
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
.tweaks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.tweaks-head h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-16);
  font-weight: var(--w-semi);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.tweaks-close { background: none; border: none; cursor: pointer; color: var(--fg-muted); padding: 4px; line-height: 1; }
.tweaks-body { padding: var(--space-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-5); }
.tweak-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.tweak-section-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: var(--w-semi);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-subtle);
}
.tweak-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 6px;
}
.tweak-opt {
  padding: 10px 8px;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: var(--fs-12);
  font-weight: var(--w-medium);
  cursor: pointer;
  text-align: center;
  transition: all var(--dur-fast) var(--ease-out);
  color: var(--fg);
}
.tweak-opt:hover { border-color: var(--border-strong); }
.tweak-opt.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.tweak-swatch {
  position: relative;
  height: 44px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.tweak-swatch.on { border-color: var(--ink-900); transform: scale(1.05); box-shadow: var(--shadow-sm); }

/* Page-specific */
.token-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: var(--fs-14);
}
.token-row:hover { background: var(--bg-elevated); }
.token-row .name { font-family: var(--font-mono); color: var(--fg); font-size: var(--fs-12); }
.token-row .visual { display: flex; align-items: center; gap: var(--space-3); color: var(--fg-muted); font-size: var(--fs-12); }
.token-row .value { font-family: var(--font-mono); color: var(--fg-subtle); font-size: var(--fs-12); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .page { padding: var(--space-8) var(--space-6) var(--space-16); }
  .topbar { padding: var(--space-3) var(--space-6); }
  .topbar-search { display: none; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
