/* ==========================================================================
   Inkplainer UI Kit  ·  v1.0
   The visual language of Inkplainer, extracted so other apps can share it.

   - Tokens are namespaced  --ink-*   (no collisions with your own variables)
   - Components are         .ink-*    (nothing global is restyled)
   - Add class "ink-root" to the element that wraps your Ink-styled UI
     (usually <body>) to opt in to the base font, colors and box-sizing.
   - State classes: .is-active  .is-on  .is-open  .is-collapsed

   Fonts (add to <head>):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link href="https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Caveat:wght@700&display=swap" rel="stylesheet">
   ========================================================================== */


/* ── 1. DESIGN TOKENS ──────────────────────────────────────────────────── */
:root {
  /* Surfaces (lightest → darkest) */
  --ink-surface:    #ffffff;   /* sidebar, topbar, modal  (original: --sidebar)  */
  --ink-surface-1:  #fafafa;   /* cards, hover fill                              */
  --ink-panel:      #f5f5f5;   /* inset controls, option tiles                   */
  --ink-surface-2:  #e4e4e4;   /* tracks, hover fill, value chips                */
  --ink-bg:         #d8d8d8;   /* app background behind everything               */

  /* Lines */
  --ink-border:     rgba(0, 0, 0, 0.08);
  --ink-border-hi:  rgba(0, 0, 0, 0.14);

  /* Accent: Inkplainer is monochrome. The "accent" is near-black ink. */
  --ink-accent:     #1a1a1a;
  --ink-accent-lo:  rgba(26, 26, 26, 0.07);   /* selected / hover tint */
  --ink-accent-glo: rgba(26, 26, 26, 0.14);   /* focus + pulse glow    */

  /* Signal colors: used sparingly */
  --ink-danger:     #dc2626;   /* destructive / export hover (original: --accent2) */
  --ink-success:    #16a34a;   /* active / confirmed states                        */

  /* Text */
  --ink-text:       #111111;
  --ink-muted:      #909090;
  --ink-muted-hi:   #525252;

  /* Shape */
  --ink-radius-xs:  5px;
  --ink-radius-sm:  7px;
  --ink-radius:     8px;
  --ink-radius-md:  10px;
  --ink-radius-lg:  12px;
  --ink-radius-full: 20px;

  /* Elevation */
  --ink-shadow-btn:     0 1px 4px rgba(0, 0, 0, 0.18);
  --ink-shadow-btn-hi:  0 4px 14px rgba(0, 0, 0, 0.22);
  --ink-shadow-hover:   0 4px 12px rgba(0, 0, 0, 0.07);
  --ink-shadow-pop:     0 8px 32px rgba(0, 0, 0, 0.14);
  --ink-shadow-modal:   0 20px 60px rgba(0, 0, 0, 0.3);

  /* Layout */
  --ink-header-h:   52px;

  /* Type */
  --ink-font:       'Geist', 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ink-font-brand: 'Caveat', cursive;   /* wordmark only, never body text */
}


/* ── 2. BASE (opt-in via .ink-root) ────────────────────────────────────── */
.ink-root {
  font-family: var(--ink-font);
  background: var(--ink-bg);
  color: var(--ink-text);
  -webkit-font-smoothing: antialiased;
}
/* :where() keeps specificity at 0 so this never overrides your own rules */
.ink-root :where(*, *::before, *::after) { box-sizing: border-box; }
.ink-root :where(button, input, select, textarea) { font-family: inherit; }

/* App shell helper: full-height column (topbar on top, content below) */
.ink-app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ink-app__body { flex: 1; display: flex; min-height: 0; }

/* Scrollbars: thin, nearly invisible until hover */
.ink-scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(0,0,0,0.12) transparent; }
.ink-scroll::-webkit-scrollbar { width: 6px; }
.ink-scroll::-webkit-scrollbar-track { background: transparent; }
.ink-scroll::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.1); border-radius: 4px; }
.ink-scroll:hover::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.18); }


/* ── 3. TOP BAR ────────────────────────────────────────────────────────── */
.ink-topbar {
  height: var(--ink-header-h);
  min-height: var(--ink-header-h);
  background: var(--ink-surface);
  border-bottom: 1px solid var(--ink-border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  z-index: 100;
  flex-shrink: 0;
}
.ink-topbar__right { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.ink-divider { width: 1px; height: 22px; background: var(--ink-border-hi); margin: 0 4px; flex-shrink: 0; }

/* Logo lockup: rounded icon tile + handwritten wordmark */
.ink-logo { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.ink-logo__icon {
  width: 30px; height: 30px;
  background: var(--ink-surface-2);
  border: 1px solid var(--ink-border-hi);
  border-radius: var(--ink-radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-text);
}
.ink-logo__word {
  font-family: var(--ink-font-brand);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink-text);
}

/* Small inset chip (e.g. editable project name) */
.ink-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--ink-panel);
  border: 1px solid var(--ink-border);
  border-radius: var(--ink-radius);
  font-size: 12px; font-weight: 500; color: var(--ink-text);
  cursor: pointer;
  transition: all 0.15s;
}
.ink-chip:hover { border-color: var(--ink-border-hi); background: var(--ink-surface-1); }


/* ── 4. BUTTONS ────────────────────────────────────────────────────────── */
/* Base = quiet outline button (topbar style) */
.ink-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 6px 12px;
  background: transparent;
  color: var(--ink-muted-hi);
  border: 1px solid var(--ink-border-hi);
  border-radius: var(--ink-radius);
  font: 500 12px/1.2 var(--ink-font);
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
}
.ink-btn:hover { border-color: var(--ink-accent); color: var(--ink-text); background: var(--ink-surface-1); }
.ink-btn:active { transform: translateY(1px); }
.ink-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.ink-btn:disabled, .ink-btn.is-disabled { opacity: 0.45; pointer-events: none; }

/* Solid ink button */
.ink-btn--primary {
  background: var(--ink-accent); color: #fff;
  border-color: var(--ink-accent);
  padding: 8px 14px; font-size: 13px;
}
.ink-btn--primary:hover { background: #000; border-color: #000; color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }

/* Full-width tinted button (sidebar actions) */
.ink-btn--secondary {
  width: 100%;
  padding: 8px;
  background: var(--ink-surface-1); color: var(--ink-text);
  font-weight: 600;
}
.ink-btn--secondary:hover { background: var(--ink-surface-2); border-color: var(--ink-accent); }

/* Hero call-to-action with the slow shimmer ("Generate Animation") */
.ink-btn--cta {
  position: relative; overflow: hidden;
  width: 100%;
  padding: 10px;
  background: var(--ink-accent); color: #fff; border: none;
  border-radius: var(--ink-radius-md);
  font-size: 14px; font-weight: 600; letter-spacing: -0.1px;
  box-shadow: var(--ink-shadow-btn);
  transition: all 0.2s;
}
.ink-btn--cta::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.08) 60%, transparent 70%);
  background-size: 200% 100%;
  animation: ink-shimmer 2.8s ease-in-out infinite;
}
.ink-btn--cta:hover { background: #333; color: #fff; border: none; transform: translateY(-1px); box-shadow: var(--ink-shadow-btn-hi); }
.ink-btn--cta:active { transform: translateY(0); }
@keyframes ink-shimmer { 0%, 100% { background-position: 200% 0; } 50% { background-position: -200% 0; } }

/* Outline button that turns red on hover (export / destructive) */
.ink-btn--danger:hover {
  border-color: var(--ink-danger); color: var(--ink-danger); background: transparent;
  box-shadow: 0 0 0 1px var(--ink-danger), 0 2px 10px rgba(220, 38, 38, 0.1);
}

/* "Click me first" button: solid with a soft pulsing halo; .is-active turns green */
.ink-btn--pulse {
  width: 100%;
  padding: 10px 12px;
  background: var(--ink-accent); color: #fff; border: none;
  border-radius: 9px;
  font-size: 12.5px; font-weight: 600;
  animation: ink-pulse 2.2s ease-in-out infinite;
}
.ink-btn--pulse:hover { background: var(--ink-accent); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.18); }
.ink-btn--pulse.is-active { background: var(--ink-success); animation: none; }
@keyframes ink-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--ink-accent-lo); }
  50%      { box-shadow: 0 0 0 6px var(--ink-accent-lo); }
}

/* Square icon button (modal close, toolbars) */
.ink-icon-btn {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--ink-muted-hi);
  border: 1px solid var(--ink-border);
  border-radius: 6px;
  cursor: pointer; transition: all 0.15s;
}
.ink-icon-btn:hover { background: var(--ink-surface-2); border-color: var(--ink-border-hi); color: var(--ink-text); }
.ink-icon-btn svg { width: 14px; height: 14px; }


/* ── 5. FORM CONTROLS ──────────────────────────────────────────────────── */
/* Tiny uppercase label used above controls */
.ink-label {
  display: block;
  font-size: 9px; font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 1.2px;
}
.ink-sublabel { font-size: 10px; color: var(--ink-muted); margin: 4px 0 3px; }

.ink-input, .ink-textarea, .ink-select {
  width: 100%;
  background: var(--ink-panel);
  border: 1px solid var(--ink-border-hi);
  color: var(--ink-text);
  font: 400 13px/1.4 var(--ink-font);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.ink-input    { padding: 8px 10px; border-radius: 9px; }
.ink-textarea { padding: 10px; border-radius: 9px; min-height: 72px; resize: vertical; }
.ink-select   { padding: 7px 9px; border-radius: var(--ink-radius-sm); font-size: 12px; cursor: pointer; }
.ink-input::placeholder, .ink-textarea::placeholder { color: var(--ink-muted); }
.ink-input:focus, .ink-textarea:focus { border-color: var(--ink-accent); box-shadow: 0 0 0 3px var(--ink-accent-lo); }
.ink-select:focus { border-color: var(--ink-accent); }

/* Toggle switch: <button class="ink-toggle is-on"></button> */
.ink-toggle {
  width: 40px; height: 22px; padding: 0;
  background: var(--ink-surface-2);
  border: 1px solid var(--ink-border-hi);
  border-radius: 11px;
  position: relative; flex-shrink: 0;
  cursor: pointer; outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}
.ink-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.ink-toggle.is-on, .ink-toggle[aria-pressed="true"] { background: var(--ink-accent); border-color: var(--ink-accent); }
.ink-toggle.is-on::after, .ink-toggle[aria-pressed="true"]::after { transform: translateX(18px); }
.ink-toggle:focus-visible { box-shadow: 0 0 0 3px var(--ink-accent-glo); }

.ink-toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ink-toggle-row__label { font-size: 12px; color: var(--ink-text); }

/* Range slider. --pct (0–100%) paints the filled part; inkplainer-ui.js keeps it in sync */
.ink-slider-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.ink-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; min-width: 0; height: 5px;
  border-radius: 3px; outline: none; cursor: pointer;
  --pct: 50%;
  background: linear-gradient(to right, var(--ink-accent) var(--pct), var(--ink-surface-2) var(--pct));
}
.ink-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  background: #fff;
  border: 2px solid var(--ink-accent); border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: grab;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ink-range::-webkit-slider-thumb:hover { transform: scale(1.2); box-shadow: 0 0 0 4px var(--ink-accent-lo), 0 2px 6px rgba(0,0,0,0.15); }
.ink-range::-webkit-slider-thumb:active { cursor: grabbing; }
.ink-range::-moz-range-track { background: transparent; height: 5px; }
.ink-range::-moz-range-thumb {
  width: 12px; height: 12px;
  background: #fff;
  border: 2px solid var(--ink-accent); border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: grab;
}
.ink-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--ink-accent-glo); }
.ink-slider-val {
  min-width: 28px; padding: 2px 5px;
  background: var(--ink-surface-2);
  border: 1px solid var(--ink-border);
  border-radius: var(--ink-radius-xs);
  font-size: 11px; font-weight: 600; color: var(--ink-text);
  text-align: right; font-variant-numeric: tabular-nums;
}


/* ── 6. SELECTABLE CHOICES ─────────────────────────────────────────────── */
/* The signature "selected" look everywhere: darker border, thicker LEFT bar, faint ink tint */

/* Option tile (icon + label), in a grid */
.ink-opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 4px; }
.ink-opt-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.ink-opt {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  background: var(--ink-panel);
  border: 1px solid var(--ink-border);
  border-radius: var(--ink-radius-sm);
  font-size: 10px; line-height: 1.2; color: var(--ink-muted-hi);
  white-space: nowrap; overflow: hidden;
  cursor: pointer; user-select: none;
  transition: all 0.15s;
}
.ink-opt:hover { border-color: var(--ink-border-hi); color: var(--ink-text); transform: translateY(-1px); }
.ink-opt.is-active { border-color: var(--ink-accent); border-left-width: 3px; background: var(--ink-accent-lo); color: var(--ink-text); }
.ink-opt__icon { font-size: 13px; line-height: 1; flex-shrink: 0; }
.ink-opt--tile { flex-direction: column; justify-content: center; min-height: 42px; text-align: center; white-space: normal; line-height: 1.25; }

/* Compact pill, in a grid or row */
.ink-pill-row { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 6px; }
.ink-pill {
  padding: 6px 8px; text-align: center;
  background: var(--ink-panel);
  border: 1px solid var(--ink-border);
  border-radius: 6px;
  font-size: 10px; font-weight: 500; color: var(--ink-muted-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; user-select: none;
  transition: all 0.12s;
}
.ink-pill:hover { border-color: var(--ink-border-hi); color: var(--ink-text); }
.ink-pill.is-active { border-color: var(--ink-accent); border-left-width: 2px; background: var(--ink-accent-lo); color: var(--ink-text); font-weight: 600; }

/* Aspect-ratio picker: tile with a little proportional thumbnail */
.ink-ratio-row { display: flex; gap: 5px; }
.ink-ratio {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 7px 4px 6px;
  background: var(--ink-panel);
  border: 1px solid var(--ink-border);
  border-radius: var(--ink-radius);
  font-size: 10px; font-weight: 500; color: var(--ink-muted-hi);
  cursor: pointer; user-select: none;
  transition: all 0.15s;
}
.ink-ratio:hover { border-color: var(--ink-border-hi); color: var(--ink-text); transform: translateY(-1px); }
.ink-ratio.is-active { border-color: var(--ink-accent); border-left-width: 2px; background: var(--ink-accent-lo); color: var(--ink-text); }
.ink-ratio__thumb { background: var(--ink-muted); border-radius: 2px; opacity: 0.55; transition: background 0.15s, opacity 0.15s; }
.ink-ratio:hover .ink-ratio__thumb { opacity: 0.85; }
.ink-ratio.is-active .ink-ratio__thumb { background: var(--ink-accent); opacity: 1; }
.ink-ratio__thumb--16-9 { width: 32px; height: 18px; }
.ink-ratio__thumb--9-16 { width: 16px; height: 28px; }
.ink-ratio__thumb--1-1  { width: 24px; height: 24px; }

/* Segmented row of equal buttons (resolution, units…) */
.ink-seg { display: flex; gap: 5px; margin-top: 4px; }
.ink-seg__btn {
  flex: 1; padding: 5px 0; text-align: center;
  background: var(--ink-panel);
  border: 1px solid var(--ink-border);
  border-radius: var(--ink-radius-sm);
  font-size: 11px; font-weight: 500; color: var(--ink-muted-hi);
  cursor: pointer; user-select: none;
  transition: all 0.15s;
}
.ink-seg__btn:hover { border-color: var(--ink-border-hi); color: var(--ink-text); }
.ink-seg__btn.is-active { border-color: var(--ink-accent); background: var(--ink-accent-lo); color: var(--ink-text); font-weight: 600; }

/* Tab switcher: inset track, active tab is a solid ink pill */
.ink-tabs { display: flex; gap: 3px; padding: 3px; background: var(--ink-panel); border-radius: var(--ink-radius-md); }
.ink-tab {
  flex: 1; padding: 7px 0;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  background: transparent; border: none; border-radius: var(--ink-radius);
  font: 500 12px/1 var(--ink-font); letter-spacing: 0.01em; color: var(--ink-muted);
  cursor: pointer; transition: all 0.18s;
}
.ink-tab svg { flex-shrink: 0; opacity: 0.75; }
.ink-tab:hover { color: var(--ink-text); }
.ink-tab.is-active { background: var(--ink-accent); color: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18); }
.ink-tab.is-active svg { opacity: 1; }
.ink-pane { display: none; }
.ink-pane.is-active { display: block; }


/* ── 7. SIDEBAR + CARDS ────────────────────────────────────────────────── */
.ink-sidebar {
  width: 300px; flex-shrink: 0;
  background: var(--ink-surface);
  border-right: 1px solid var(--ink-border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
}
.ink-sidebar__sticky-top { position: sticky; top: 0; z-index: 30; background: var(--ink-surface); border-bottom: 1px solid var(--ink-border); padding: 10px 10px 8px; }
.ink-sidebar__sticky-bottom { position: sticky; bottom: 0; z-index: 20; margin-top: auto; background: var(--ink-surface); border-top: 1px solid var(--ink-border); padding: 10px 8px 14px; }

.ink-section-label {
  padding: 10px 14px 4px;
  font-size: 9px; font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 1.6px;
}

/* Collapsible card. Header label gets a thin ink bar on its left. */
.ink-card {
  margin: 6px 8px 0;
  background: var(--ink-surface-1);
  border: 1px solid var(--ink-border);
  border-radius: var(--ink-radius-md);
  overflow: hidden; flex-shrink: 0;
  transition: border-color 0.15s;
  animation: ink-fade-up 0.3s ease both;
}
.ink-card:last-child { margin-bottom: 6px; }
.ink-card:hover { border-color: var(--ink-border-hi); }
.ink-card__header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.025);
  border-bottom: 1px solid var(--ink-border);
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.ink-card__header:hover { background: rgba(0, 0, 0, 0.04); }
.ink-card__label {
  flex: 1; padding-left: 7px;
  border-left: 2px solid var(--ink-accent);
  font-size: 9px; font-weight: 600; color: var(--ink-muted-hi);
  text-transform: uppercase; letter-spacing: 1.4px;
}
.ink-card__chevron { font-size: 9px; color: var(--ink-muted); flex-shrink: 0; transition: transform 0.2s ease; }
.ink-card__body {
  padding: 0 10px 10px;
  max-height: 2000px; opacity: 1;
  transition: max-height 0.22s ease, opacity 0.18s ease;
}
.ink-card.is-collapsed .ink-card__header { border-bottom: none; }
.ink-card.is-collapsed .ink-card__chevron { transform: rotate(-90deg); }
.ink-card.is-collapsed .ink-card__body { max-height: 0; opacity: 0; padding-bottom: 0; overflow: hidden; }
@keyframes ink-fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* List item (layers, projects): selected = left bar + tint */
.ink-item {
  background: var(--ink-surface-1);
  border: 1.5px solid var(--ink-border);
  border-radius: var(--ink-radius-md);
  overflow: hidden; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s, box-shadow 0.15s;
}
.ink-item:hover { border-color: var(--ink-border-hi); transform: translateY(-1px); box-shadow: var(--ink-shadow-hover); }
.ink-item.is-active { border-color: var(--ink-accent); border-left-width: 3px; background: var(--ink-accent-lo); box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.1); }
.ink-item__row { display: flex; align-items: center; gap: 7px; padding: 7px 9px; }
.ink-item__thumb {
  width: 34px; height: 34px; flex-shrink: 0;
  border: 1px solid var(--ink-border-hi); border-radius: 6px;
  background: repeating-conic-gradient(#ccc 0% 25%, #e8e8e8 0% 50%) 0 0 / 10px 10px; /* transparency checkerboard */
  object-fit: contain;
}
.ink-item__main { flex: 1; min-width: 0; }
.ink-item__title { font-size: 11px; font-weight: 500; color: var(--ink-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ink-item__meta { font-size: 10px; color: var(--ink-muted); }


/* ── 8. OVERLAYS ───────────────────────────────────────────────────────── */
/* Modal: <div class="ink-modal" id="x"><div class="ink-modal__window">…</div></div> */
.ink-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.ink-modal.is-open { display: flex; animation: ink-fade-in 0.15s ease; }
.ink-modal__window {
  width: 560px; max-width: 90vw; max-height: 70vh;
  display: flex; flex-direction: column;
  background: var(--ink-surface);
  border-radius: var(--ink-radius-lg);
  box-shadow: var(--ink-shadow-modal);
  animation: ink-slide-up 0.2s ease;
}
.ink-modal__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--ink-border); }
.ink-modal__title { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink-text); }
.ink-modal__subtitle { margin-top: 2px; font-size: 11.5px; color: var(--ink-muted); }
.ink-modal__body { flex: 1; padding: 16px 24px; overflow-y: auto; }
.ink-modal__footer { display: flex; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--ink-border); }
@keyframes ink-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes ink-slide-up { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Dropdown menu (logo menu) */
.ink-menu {
  width: 230px; overflow: hidden;
  background: var(--ink-surface);
  border: 1px solid var(--ink-border-hi);
  border-radius: var(--ink-radius-lg);
  box-shadow: var(--ink-shadow-pop);
  animation: ink-menu-in 0.15s ease;
}
.ink-menu__header { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 12px; }
.ink-menu__title { font-family: var(--ink-font-brand); font-size: 18px; font-weight: 700; letter-spacing: -0.3px; color: var(--ink-text); }
.ink-menu__tagline { font-size: 11.5px; line-height: 1.4; color: var(--ink-muted); }
.ink-menu__divider { height: 1px; margin: 0 10px; background: var(--ink-border); }
.ink-menu__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  font-size: 13px; font-weight: 500; color: var(--ink-muted-hi); text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.ink-menu__item:hover { background: var(--ink-panel); color: var(--ink-text); }
.ink-menu__item:last-child { margin-bottom: 4px; }
@keyframes ink-menu-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* Toast: dark pill, top-center. Create with InkUI.toast("Saved") */
.ink-toast {
  position: fixed; top: 72px; left: 50%; z-index: 99999;
  transform: translateX(-50%);
  padding: 6px 13px;
  background: rgba(26, 26, 26, 0.88); color: #fff;
  border-radius: var(--ink-radius-full);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
  font-size: 12px; font-weight: 500; white-space: nowrap;
  pointer-events: none;
  opacity: 1; transition: opacity 0.25s;
}
.ink-toast.is-leaving { opacity: 0; }

/* Coach-mark / tooltip: solid ink bubble */
.ink-tip {
  width: 220px; padding: 12px 14px 10px;
  background: var(--ink-accent); color: #fff;
  border-radius: var(--ink-radius-md);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  font-size: 12px; line-height: 1.5;
}
.ink-tip__title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }

/* "Still working" indicator: three dots that bounce on the compositor thread,
   so they keep moving even while the main thread is busy. Toggle .is-visible */
.ink-busy {
  display: none; align-items: center; gap: 7px;
  padding: 5px 11px;
  background: var(--ink-accent-lo);
  border: 1px solid var(--ink-accent-glo);
  border-radius: var(--ink-radius-full);
  flex-shrink: 0;
}
.ink-busy.is-visible { display: inline-flex; }
.ink-busy__dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-accent);
  opacity: 0.35; transform: scale(0.8);
  animation: ink-bounce 1.1s ease-in-out infinite;
  will-change: transform, opacity;
}
.ink-busy__dot:nth-child(2) { animation-delay: 0.15s; }
.ink-busy__dot:nth-child(3) { animation-delay: 0.3s; }
.ink-busy__label { font-size: 10.5px; font-weight: 500; color: var(--ink-muted-hi); white-space: nowrap; }
@keyframes ink-bounce { 0%, 80%, 100% { transform: scale(0.8); opacity: 0.35; } 40% { transform: scale(1.15); opacity: 1; } }

/* Empty state */
.ink-empty { padding: 60px 24px; text-align: center; color: var(--ink-muted); }
.ink-empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.ink-empty p { margin: 0 0 4px; font-size: 13px; }
.ink-empty small { font-size: 11px; color: var(--ink-muted); }

/* Callout box (hint with a tinted background) */
.ink-hint {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 11px;
  background: var(--ink-accent-lo);
  border: 1px solid var(--ink-accent-glo);
  border-radius: 9px;
  font-size: 11px; line-height: 1.4; color: var(--ink-muted-hi);
}

/* Small badge (version, count) */
.ink-badge {
  display: inline-block; padding: 2px 8px;
  background: var(--ink-panel);
  border: 1px solid var(--ink-border);
  border-radius: var(--ink-radius-full);
  font-size: 9px; font-weight: 600; letter-spacing: 0.3px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}


/* ── 9. UTILITIES ──────────────────────────────────────────────────────── */
.ink-row   { display: flex; align-items: center; gap: 8px; }
.ink-stack { display: flex; flex-direction: column; gap: 8px; }
.ink-mt    { margin-top: 8px; }
.ink-muted { color: var(--ink-muted); }

/* Reduced motion: calm everything except the busy dots, whose whole job is to
   show the app is alive (a gentle opacity pulse, not a vestibular trigger). */
@media (prefers-reduced-motion: reduce) {
  .ink-root *:not(.ink-busy__dot), .ink-root *::before, .ink-root *::after,
  .ink-modal, .ink-modal *, .ink-toast { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
