/**
 * Phase 23.5 R0 — design tokens (Amida values, app name semantics).
 *
 * Canonical visual source: docs/design/system/ (Amida).
 * App token NAMES keep APP semantics. DS contributes values, not renames.
 * DS names (--paper, --line, --ink*, --accent-ink, …) are additional aliases
 * so export markup resolves without redefining app tokens.
 *
 * Palette (amended 2026-09-07; replaces Phase 23 sand / petrol-blue / amber):
 *   accent → violet (#6244f2)
 *   review / flagged → orange (--review*; --warning* aliases)
 *   category / industrial → magenta (--category*; --industrial* aliases)
 *
 * Spacing: app --space-1..6 keep names AND values (step scale).
 * DS pixel steps that collide (--space-2 / --space-4 at 2px / 4px) are NOT
 * declared. Non-colliding DS steps (--space-8…) and --am-space-2/4 are added.
 * Never reference a bare --space-N expecting DS pixel values.
 *
 * Dark theme [data-theme="dark"]: deferred — not ported.
 */

@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@600;800&display=swap");

:root {
  color-scheme: light;

  /* ---------- Neutrals (DS values; app names for page/card/border colour) ---------- */
  /* --surface = PAGE (takes DS --paper). --surface-raised = CARD (takes DS --surface). */
  --surface: #f7f7fa;
  --surface-raised: #ffffff;
  --band: #eeeef3;
  --line: #e4e4eb;
  --line-strong: #c7c6d2;
  /* --border stays a COLOUR (never a shorthand). */
  --border: var(--line);

  /* DS / export aliases → app page/card */
  --paper: var(--surface);
  --surface-page: var(--surface);
  --surface-card: var(--surface-raised);
  --surface-sunken: var(--band);
  --border-color: var(--line);

  /* Ink ramp (DS) */
  --ink: #100f18;
  --ink-2: #55545f;
  --ink-3: #6a6975;
  --ink-4: #9b9aa5;
  --ink-inverse: #ffffff;

  /* App text names → ink */
  --text-primary: var(--ink);
  --text-secondary: var(--ink-2);
  --text-muted: var(--ink-3);
  --text-placeholder: var(--ink-4);

  /* ---------- Accent — violet ---------- */
  --accent: #6244f2;
  --accent-hover: #5335e3;
  --accent-active: #4527c9;
  /* App --accent-text = button ink on accent fill (DS --accent-ink). */
  --accent-text: #ffffff;
  --accent-ink: var(--accent-text);
  /* DS link/text accent (export markup). Not the button ink. */
  --accent-link: #4e31db;
  --accent-wash: #f8f7fe;
  --accent-soft: #f0edfe;
  --accent-line: #c9bffb;

  /* ---------- Category — industrial / especialista (magenta) ---------- */
  --category: #ea45bd;
  --category-text: #a2187c;
  --category-ink: #100f18;
  --category-wash: #fdf6fb;
  --category-soft: #fcebf7;
  --category-line: #f3b8e0;
  /* App aliases (teal names → magenta values) */
  --industrial: var(--category);
  --industrial-soft: var(--category-soft);
  --industrial-text: var(--category-text);

  /* ---------- Review — flagged / needs-review (orange) ---------- */
  --review: #ff6a1a;
  --review-text: #c43c00;
  --review-ink: #100f18;
  --review-wash: #fff8f3;
  --review-soft: #ffeee4;
  --review-line: #ffc5a3;
  /* App aliases (amber names → orange values) */
  --warning: var(--review);
  --warning-soft: var(--review-soft);
  --warning-text: var(--review-text);

  /* ---------- Saved / success ---------- */
  --saved: #00be85;
  --saved-text: #00795c;
  --saved-ink: #100f18;
  --saved-wash: #f3fbf8;
  --saved-soft: #e2f8f0;
  --saved-line: #93e2cc;
  --success: var(--saved-text);
  --success-soft: var(--saved-soft);

  /* ---------- Error / danger ---------- */
  --error: #f5254f;
  --error-text: #c50e36;
  --error-ink: #100f18;
  --error-wash: #fff6f7;
  --error-soft: #feeaee;
  --error-line: #f9bbc7;
  --danger: var(--error-text);
  --danger-soft: var(--error-soft);
  --danger-border: var(--error-line);

  /* ---------- Info (kept — banner-info consumers) ---------- */
  --info: var(--accent-link);
  --info-soft: var(--accent-wash);

  /* ---------- Disabled ---------- */
  --disabled-ink: #a6a5b0;
  --disabled-surface: #f1f1f5;
  --disabled-line: #dededf;

  /* ---------- Overlay ---------- */
  --overlay: rgba(16, 15, 24, 0.42);

  /* ---------- Spacing — APP step scale (names + values unchanged) ---------- */
  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px — NOT DS 2px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px — NOT DS 4px */
  --space-5: 1.5rem; /* 24px */
  --space-6: 2rem; /* 32px */

  /* DS colliding 2px / 4px under non-colliding prefix */
  --am-space-2: 2px;
  --am-space-4: 4px;

  /* Non-colliding DS pixel-named steps (safe to add) */
  --space-8: 8px;
  --space-12: 12px;
  --space-20: 20px;
  --space-32: 32px;
  --space-40: 40px;
  --space-64: 64px;

  --row-height: 40px;
  --row-height-compact: 36px;
  --touch-primary: 48px;
  --touch-secondary: 44px;

  /* ---------- Type — app names + DS scale aliases ---------- */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Manrope", var(--font-ui);
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    monospace;
  --font-body: var(--font-ui);
  --font-money: var(--font-ui);

  --text-label: 11px;
  --text-meta: 12px;
  --text-body: 14px;
  --text-heading: 18px;
  --text-title: 24px;
  --text-money: 16px;
  --text-money-lg: 18px;
  --text-money-xl: 24px;

  /* App size names → DS prose scale */
  --font-size-page-title: var(--text-title);
  --font-size-section-heading: var(--text-heading);
  --font-size-body: var(--text-body);
  --font-size-small: var(--text-meta);
  --font-size-micro: var(--text-label);

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 800;
  --font-weight-regular: var(--weight-regular);
  --font-weight-semibold: var(--weight-semibold);
  --font-weight-bold: 700; /* app screens; wordmark uses --weight-bold 800 */

  --leading-tight: 1.2;
  --leading-row: 1.3;
  --leading-body: 1.45;
  --tracking-title: -0.02em;
  --tracking-label: 0.06em;

  /* ---------- Radius — DS values (2 / 4 / 12) ---------- */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --radius-round: 50%;

  /* ---------- Border shorthands (DS; --border itself stays colour) ---------- */
  --border-width: 1px;
  --am-border: var(--border-width) solid var(--line);
  --border-strong: var(--border-width) solid var(--line-strong);
  --border-accent: var(--border-width) solid var(--accent);
  --border-review: var(--border-width) solid var(--review-line);
  --border-error: var(--border-width) solid var(--error-line);

  --focus-width: 2px;
  --focus-color: var(--accent);
  --focus-offset: 1px;
  --focus-ring: var(--focus-width) solid var(--focus-color);

  /* ---------- Elevation — flat; shadows on overlays only ---------- */
  --shadow-raised: none; /* flat system; name kept for .card-raised consumers */
  --shadow-overlay: 0 10px 30px rgba(15, 15, 13, 0.16);
  --shadow-sheet: 0 -10px 30px rgba(15, 15, 13, 0.16);

  --duration-fast: 120ms;
  --duration-base: 180ms;
  --ease: cubic-bezier(0.2, 0, 0.2, 1);

  /* ---------- Layout ---------- */
  --sidebar-width: 240px;
  --sidebar-width-expanded: var(--sidebar-width); /* app alias */
  --sidebar-width-collapsed: 60px;
  --content-max: 1100px;
  --content-narrow: 640px;
  --content-form: 420px;
  --content-max-width: var(--content-narrow); /* app alias — composer/settings */
  --content-max-width-wide: var(--content-max); /* app alias — history/review */

  --bp-narrow: 640px;
  --bp-drawer: 768px;
  --shell-drawer-breakpoint: var(--bp-drawer);

  /* Existing z-index values as tokens (no new stacking fixes) */
  --z-sticky: 100;
  --z-sidebar: 200;
  --z-drawer-backdrop: 190;
  --z-popover: 400;
  --z-modal: 1000;
}

@media (max-width: 640px) {
  :root {
    --text-title: 20px;
  }
}
