/*
 * Inventory Ops design tokens.
 * Every value is taken from design/Inventory Ops.dc.html. Light theme only.
 * Name by role; components should reference these, never raw values.
 */
:root {
  /* Ink: primary text, sidebar, primary buttons, toast */
  --color-ink: #0B1220;
  --color-ink-rgb: 11, 18, 32;

  /* Sidebar (dark navigation rail) */
  --color-sidebar-bg: #0B1220;
  --color-sidebar-item-hover: #1A2436;      /* hover + active nav item */
  --color-sidebar-card-bg: #111C2E;         /* "next event" card */
  --color-sidebar-card-border: #1E2A3D;
  --color-sidebar-avatar-bg: #2C3A50;
  --color-sidebar-text: #9AA4B5;            /* nav labels, secondary lines */
  --color-sidebar-text-muted: #7C8698;      /* captions, eyebrow labels */
  --color-sidebar-warning: var(--color-warning-accent); /* warning text on the sidebar card: 7.28:1 (Jude card 4.77:1); --color-warning is 3.15:1 here */
  --color-sidebar-text-active: #FFFFFF;

  /* Brand blue */
  --color-brand: #1D4ED8;                   /* links, focus, primary hover, today */
  --color-brand-hover: #1E3A8A;             /* link hover */
  --color-on-brand: #FFFFFF;

  /* Blue tint set (info / "Out" / selected) */
  --color-blue-tint-bg: #EEF4FF;
  --color-blue-tint-bg-hover: #DCE7FE;
  --color-blue-tint-border: #C7D7FE;
  --color-blue-tint-text: #1D4ED8;

  /* Surfaces & backgrounds */
  --color-page-bg: #F4F5F7;
  --color-surface: #FFFFFF;                 /* cards, header, modals, drawer */
  --color-bg-subtle: #F8F9FB;               /* inputs, stat tiles, drop zone */
  --color-bg-row-hover: #FAFBFC;            /* list/table row hover */
  --color-bg-muted: #FAFAFB;                /* out-of-month calendar days */
  --color-bg-placeholder: #EEF1F5;          /* photo / thumbnail placeholder */
  --color-bg-neutral: #F2F4F7;              /* neutral status badge */
  --color-bg-control: #F4F5F7;              /* mini & chip buttons, secondary hover */
  --color-bg-control-hover: #EAECF0;        /* mini & chip hover, progress track */
  --color-bg-pressed: var(--color-bg-control-hover); /* a tap target while it's held down */
  /* Tertiary buttons (the drawer's secondary row): grey fill, no border, secondary text; hover one shade
     darker. Text on fill 7.05:1, on hover 6.50:1 (Jude: 8.79:1 / 7.72:1, following its own grey tokens). */
  --color-btn-tertiary-bg: var(--color-bg-control);
  --color-btn-tertiary-bg-hover: var(--color-bg-control-hover);
  --color-btn-tertiary-text: var(--color-text-secondary);
  /* Disabled buttons that still explain themselves (aria-disabled: the drawer's fixed rows): a quiet
     fill and muted text, legible (muted on subtle 4.6:1), no hover, any button variant. */
  --color-btn-disabled-bg: var(--color-bg-subtle);
  --color-btn-disabled-border: var(--color-border-header);
  --color-btn-disabled-text: var(--color-text-muted);

  /* Borders */
  --color-border: #E4E7EC;                  /* default: cards, inputs, buttons */
  --color-border-header: #EEF0F3;           /* card header divider */
  --color-border-row: #F2F4F7;              /* list row divider */
  --color-border-strong: #D0D5DD;           /* checkbox, dashed drop zone */
  --color-scrollbar-thumb: #D6DAE1;
  --color-dot-idle: #CDD3DC;                /* timeline dot */

  /* Text scale (darkest to faintest) */
  --color-text: #0B1220;
  --color-text-strong: #344054;             /* button labels, emphasized body */
  --color-text-secondary: #475467;          /* table cells, neutral badge text */
  --color-text-muted: #667085;              /* meta text, icon buttons */
  --color-text-subtle: #98A2B3;             /* empty states, hints, done items */
  --color-text-faint: #C6CBD4;              /* indices, out-of-month days */
  --color-text-inverse: #FFFFFF;

  /* Danger */
  --color-danger: #B42318;                  /* text, badge dot, low-stock bar */
  --color-danger-bg: #FEF3F2;
  --color-danger-border: #FDA29B;

  /* Warning */
  --color-warning: #B54708;                 /* text */
  --color-warning-bg: #FFFAEB;
  --color-warning-accent: #F79009;          /* mid-stock bar */

  /* Success */
  --color-success: #067647;                 /* text */
  --color-success-bg: #ECFDF3;
  --color-success-accent: #12B76A;          /* checked box, full bar */

  /* Underlines (links and hover underlines; base.css). The offset clears Plus Jakarta Sans
     descenders at 12–19px; skip-ink breaks the line wherever a glyph would still cross it. */
  --underline-thickness: 1px;
  --underline-offset: 0.3em;

  /* View as banner (an admin viewing the app as someone): deep amber, dark ink, 5.72:1 */
  --color-masquerade-bg: #D97706;
  --color-masquerade-ink: #1F1300;
  --masquerade-bar-h: 44px;

  /* Gold (Pro+ "anointed" crown badge) */
  --color-gold: #8A5A00;                    /* crown + badge text (contrast on gold bg) */
  --color-gold-bg: #FFF6DB;
  --color-gold-border: #F2C94C;
  --color-gold-accent: #D4A017;             /* crown fill */

  /* Jude theme decorations (only used under [data-theme="jude"]) */
  --jude-petal-pattern: none;
  --jude-flower-a: transparent;
  --jude-flower-b: transparent;
  --jude-flower-center: transparent;

  /* Overlays & backdrops */
  --overlay-modal: rgba(11, 18, 32, 0.4);
  --overlay-drawer: rgba(11, 18, 32, 0.35);
  --overlay-photo-control: rgba(11, 18, 32, 0.72);
  --overlay-signin: #0B1220;                /* full-screen sign-in gate */

  /* Shadows */
  --shadow-modal: 0 30px 70px rgba(11, 18, 32, 0.3);
  --shadow-drawer: -18px 0 50px rgba(11, 18, 32, 0.18);
  --shadow-dropdown: 0 16px 40px rgba(11, 18, 32, 0.16);
  --shadow-toast: 0 14px 36px rgba(11, 18, 32, 0.28);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: ui-monospace, monospace;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;

  /* Headings and labels. Components reference these, so sizes change in one place. */
  --font-size-page-title: 21px;                   /* H1 page titles (was 19px) */
  --font-size-section-title: 19px;                /* card / section titles (was 17px; 15px before that) */
  --font-weight-section-title: var(--font-weight-bold);
  --font-size-label: 12.5px;                      /* small uppercase labels + table headers (was 10.5–11.5px) */
  --font-size-field-label: 12px;                  /* form field labels (.field-label): sentence case, semibold */
  --font-size-input: 12.5px;                      /* the text inside inputs and pickers */
  --font-size-meta: 12.5px;                       /* muted meta lines (with --color-text-muted) */
  --font-size-floor: 0px;                         /* smallest text: max(size, floor) in app.css; 12px under coarse pointers */
  --letter-spacing-label: 0.6px;
  --inv-card-line: 18px;                          /* phone inventory card: the name's lines and the quantity share it, so their tops align */
  --color-label: var(--color-text-secondary);     /* was text-subtle / text-muted: darker for scanning */

  /* Radii */
  /*
   * Spacing. Every container's padding, and the gaps between cards and sections,
   * come from these. Card content (headers, bodies, rows, empty states, stat
   * rows, footers) shares one horizontal inset so text lines up down a card.
   */
  --space-page-x: 28px;          /* content area left/right, every screen */
  --content-max-narrow: 760px;   /* single-column screens (Settings): every card shares this width */
  --space-page-y: 24px;          /* content area top */
  --space-page-end: 60px;        /* content area bottom (room under the last card) */
  --space-topbar-y: 16px;
  /*
   * Control sizing. Every button, chip, badge, input, and select takes its height
   * and horizontal padding from these (vertical padding 0; flex centers the text).
   * scripts/lint_spacing.mjs enforces it.
   */
  --control-h-md: 38px;          /* standard buttons, inputs, selects, header controls */
  --control-pad-x-md: 14px;
  --control-h: var(--control-h-md); /* alias (header controls) */
  --control-h-sm: 28px;          /* compact buttons: every card-header action, row actions */
  --control-pad-x-sm: 10px;
  --chip-h: 32px;                /* filter chips, amenity chips, person chips, Show more */
  --chip-pad-x: 10px;
  --badge-h: 18px;               /* status, tier, count, Shared / Today badges and tags */
  --badge-pad-x: 7px;
  /* The date / time field's calendar glyph (appearance: none removes WebKit's own). */
  --icon-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2'/%3E%3Cpath d='M3.5 9.5h17M8 3v4M16 3v4'/%3E%3C/svg%3E");
  --icon-btn-sm: 28px;           /* square icon buttons: ×, remove, calendar chevrons */
  --icon-btn-md: 32px;           /* square icon buttons: drawer / modal close, copy link */
  --icon-btn-compact: 32px;      /* a small icon button that stays 32px on touch too (a ::before reaches --hit-min) */
  --hit-min: 44px;               /* the hit area those small buttons reach, every pointer */
  --control-gap: 6px;            /* icon or dot ↔ label inside one control ("Wifi" ↔ "✓ Included") */
  --control-group-gap: 8px;      /* between adjacent controls (Share ↔ Edit event) */
  --space-sidebar-x: 16px;
  --space-sidebar-y: 22px;
  --space-section-gap: 20px;     /* between major page sections */
  --space-stat-gap: 40px;        /* between the Shows card's stats (Packed · Lead · Ship by) */
  --space-card-gap: 16px;        /* between cards in a column or grid */
  --space-card-x: 18px;          /* horizontal inset for ALL card content */
  --space-card-y: 18px;          /* card header / body / footer / empty state vertical padding */
  --space-row-y: 12px;           /* list and table rows (horizontal: --space-card-x) */
  --space-row-y-tight: 9px;      /* dense key/value and activity rows */
  --space-inset-x: 12px;         /* small boxes inside cards: banners, notices, options, popover rows */
  --space-inset-y: 10px;
  --space-stack-sm: 4px;         /* label → value */
  --space-stack-md: 8px;         /* title → subtitle, popover padding */
  --space-stack-lg: 12px;        /* value → bar, block → actions */
  /* Scale for the small gaps and margins inside components (icon → label, line → line). */
  --space-1: 1px;
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-14: 14px;
  --space-16: 16px;
  --space-18: 18px;
  --space-20: 20px;
  --space-24: 24px;
  --space-28: 28px;

  --radius-bar: 4px;                        /* progress bars */
  --radius-badge: 6px;                      /* status badges */
  --radius-xs: 7px;                         /* small icon / filter buttons */
  --radius-sm: 8px;                         /* mini buttons, icon buttons, thumbs */
  --radius-control: 9px;                    /* buttons, inputs, nav items */
  --radius-tile: 10px;                      /* logo mark, large thumbnails */
  --thumb-card: 48px;                       /* phone inventory card thumbnail */
  --radius-thumb-card: calc(var(--radius-tile) * 48 / 56); /* --radius-tile scaled to the 48px card thumb (it was drawn at 56px) */
  --radius-menu: 11px;                      /* dropdown, toast, stat tiles, large input */
  --radius-sidebar-card: 12px;
  --radius-dropzone: 13px;
  --radius-card: 14px;
  --radius-modal: 16px;                     /* modals, sign-in card */
  --radius-pill: 20px;                      /* chips, count badges */
  --radius-round: 50%;                      /* avatars, dots */

  /* Sponsorship tiers: text + dot color on the white card (≥ 4.5:1) */
  --tier-bronze: #8C5523;                          /* 6.11:1 on #FFFFFF */
  --tier-silver: #5F6B7A;                          /* 5.43:1 */
  --tier-gold: #8A6A00;                            /* 5.07:1 */
  --tier-title: var(--color-text);                 /* Title: the primary text color */
  --tier-custom: var(--color-text);                /* Custom (its own name): the primary text color */
  --tier-custom-dot: var(--color-text-subtle);     /* ... with a neutral dot */
  /*
   * Event cover images (the Shows card's top section): ink over the photo, darker toward the
   * bottom, so white text and the light tier colors stay legible even over a pure-white photo.
   * Worst case (white photo): the name at the top 5.65:1, the meta line (from 45% down) 7.85:1
   * white; bronze 5.05, silver 6.36, gold 5.82:1 (scripts/check_cover_contrast.mjs).
   * These are the ink opacities at the default shadow strength (60); each event sets its own
   * (cover_overlay 0–100 → coverOverlay() in cover-frame.js, inline on the section).
   */
  --cover-shade-top: 0.64;
  --cover-shade-bottom: 0.84;
  --cover-text: #FFFFFF;
  --cover-sep: rgba(255, 255, 255, 0.7);            /* the meta line's "·" (decorative) */
  --tier-bronze-on-dark: #F5C79B;
  --tier-silver-on-dark: #E2E8EF;
  --tier-gold-on-dark: #F8DC85;
  --tier-title-on-dark: var(--cover-text);
  --tier-custom-on-dark: var(--cover-text);
  --tier-custom-dot-on-dark: var(--cover-sep);       /* neutral, like the meta line's "·" */
  --cover-banner-h: 200px;                         /* the event page's cover banner (phones: --cover-banner-h-phone) */
  --cover-banner-h-phone: 160px;
  --cover-aspect: 564 / 77;                        /* the Shows card's top section at 1440px (measured: 564 × 77, one-line title); the editor preview */
  /*
   * Event schedule colors. Every block, bar, swatch, and kind dot is labelled in
   * white (--color-sched-label), so every fill below meets 4.5:1 against #FFFFFF
   * (ratios in the comments; scripts/check_schedule.mjs fails if one drops below).
   * Kind defaults (Event details), used when an entry has no color of its own:
   */
  --color-sched-label: #FFFFFF;
  --color-sched-booth: #1F7F79;                    /* booth + teardown: teal, 4.81:1 */
  --color-sched-travel: #2E7D4F;                   /* travel: green, 5.05:1 */
  --color-sched-setup: #3B5BDB;                    /* setup: blue, 5.67:1 */
  --color-sched-ship: #5B6B82;                     /* ship: slate, 5.43:1 */
  --color-sched-neutral: #6E6259;                  /* other: warm grey, 5.91:1 */
  --color-sched-head: var(--color-blue-tint-bg);   /* day column header bar */
  /* Schedule entry colors (the Edit schedule picker; keys in SCHEDULE_COLORS, app/lists.php), vs white: */
  --sched-tomato: #C62828;        /* 5.62:1 */
  --sched-cherry: #A3123F;        /* 7.73:1 */
  --sched-flamingo: #C2185B;      /* 5.87:1 */
  --sched-rose: #B0306A;          /* 6.04:1 */
  --sched-tangerine: #C2410C;     /* 5.18:1 */
  --sched-pumpkin: #A84B00;       /* 5.72:1 */
  --sched-mango: #9A5B00;         /* 5.43:1 */
  --sched-mustard: #7F6A00;       /* 5.30:1 */
  --sched-pistachio: #4D7C0F;     /* 4.99:1 */
  --sched-sage: #3B7A57;          /* 5.11:1 */
  --sched-basil: #0B6B3A;         /* 6.61:1 */
  --sched-eucalyptus: #00796B;    /* 5.32:1 */
  --sched-peacock: #00718A;       /* 5.63:1 */
  --sched-ocean: #0B5E99;         /* 6.83:1 */
  --sched-cobalt: #1D4ED8;        /* 6.70:1 */
  --sched-blueberry: #3949AB;     /* 7.73:1 */
  --sched-lavender: #7B58BE;      /* 5.27:1 */
  --sched-wisteria: #9C3D9A;      /* 5.92:1 */
  --sched-grape: #8E24AA;         /* 7.04:1 */
  --sched-amethyst: #4A2C9A;      /* 9.91:1 */
  --sched-cocoa: #6D4C41;         /* 7.61:1 */
  --sched-bronze: #8C5523;        /* 6.11:1 */
  --sched-slate: #4F6672;         /* 6.04:1 */
  --sched-graphite: #575757;      /* 7.23:1 */
  --swatch-size: 24px;           /* color picker swatches */
  --team-mark-size: 32px;        /* the team badge: icon on its color (Teams list, team header, Edit team preview) */
  --team-mark-size-sm: 24px;     /* the same badge in compact places: Team picker options, team chips */
  --team-pick-row-h: 48px;       /* one Add members person row: 32px avatar + two text lines, padded */
  --team-pick-rows: 3;           /* rows the Add members list shows before it scrolls */
  --team-pick-fade: 24px;        /* the fade at its bottom edge while more rows are below */

  /*
   * Layout shell. Breakpoints (CSS can't read custom properties in @media, so
   * these are written out in app.css "Responsive shell" and in shell.js):
   *   phone    < 700px        bottom tab bar, no sidebar      (max-width: 699.98px)
   *   tablet   700px–1099px   72px icon rail, expands to 236  (min-width: 700px) and (max-width: 1099.98px)
   *   desktop  ≥ 1100px       full sidebar (unchanged)
   */
  --sidebar-w: 236px;            /* desktop sidebar, and the tablet rail when expanded */
  --rail-w: 72px;                /* tablet icon rail */
  --brand-mark-h: 25px;          /* sidebar brand mark = visible ink from the cap top of "Inventory Ops" to the tagline baseline (pixel-scanned at 1440, DPR 1/2/3) */
  --brand-mark-ink-offset: 4px;  /* cap top sits this far below the title block's line-box top (18px line box, 14.5px bold) */
  --brand-mark-rail-h: 28px;     /* the tablet rail's compact mark */
  --tabbar-h: 56px;              /* phone bottom tab bar, above --safe-bottom */
  --icon-btn-lg: 44px;           /* touch-size square buttons: phone topbar, rail, tab targets */
  --space-page-x-phone: 16px;    /* --space-page-x on phones */
  --sheet-max-h: 85vh;           /* bottom sheets scroll inside past this */
  --sheet-row-h: 48px;           /* rows in the More / Add sheets */
  /*
   * Safe-area insets: 0 in a browser tab, env() only when installed to the home screen. The viewport
   * meta has no viewport-fit=cover, so env() is 0 in a tab anyway; the gate also rules out a blank
   * notch band above the topbar (or a gap under the tab bar) if a browser reports insets regardless.
   * Use these, never env(safe-area-inset-*) directly.
   */
  --safe-top: 0px;
  --safe-right: 0px;
  --safe-bottom: 0px;
  --safe-left: 0px;
}
@media (display-mode: standalone) {
  :root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
  }
}

/*
 * Touch (coarse pointers: phones and iPads). Every control grows to a 44px target, text inside
 * inputs is 16px (iOS zooms on focus below that), and no text is smaller than 12px.
 * A mouse or trackpad keeps the values above. app.css "Touch" covers what tokens can't.
 */
@media (pointer: coarse) {
  :root {
    --tap-min: 44px;             /* smallest tap target; transparent ::before hit areas reach this */
    --font-size-input: 16px;
    --font-size-floor: 12px;
    --control-h-md: 44px;
    --control-h-sm: 44px;
    --chip-h: 44px;
    --icon-btn-sm: 44px;
    --icon-btn-md: 44px;
  }
}

/* Phones: narrower page gutters (everything that uses --space-page-x follows). */
@media (max-width: 699.98px) {
  :root { --space-page-x: var(--space-page-x-phone); }
}

/*
 * Jude theme: users.theme = 'jude' and the Stripe workspace (shell.js sets
 * data-theme="jude" on <html>; nobody else ever sees it). A pink palette for
 * ink, sidebar, brand, tints, and borders; body text keeps ≥ 4.5:1 contrast.
 * Flowers are inline SVG in the shell (filled from these tokens); the petal
 * pattern is an original inline SVG used as the page background.
 */
[data-theme="jude"] {
  --color-ink: #4A1033;
  --color-ink-rgb: 74, 16, 51;

  --color-sidebar-bg: #5B1440;
  --color-sidebar-item-hover: #7A1E57;
  --color-sidebar-card-bg: #6B1A4C;
  --color-sidebar-card-border: #8A2A64;
  --color-sidebar-avatar-bg: #A23B78;
  --color-sidebar-text: #F8D3E7;
  --color-sidebar-text-muted: #EDB4D3;
  --color-sidebar-text-active: #FFFFFF;

  --color-brand: #B0186E;
  --color-brand-hover: #7E0F4E;
  --color-on-brand: #FFFFFF;

  --color-blue-tint-bg: #FDEAF4;
  --color-blue-tint-bg-hover: #FAD5E9;
  --color-blue-tint-border: #F5B8D8;
  --color-blue-tint-text: #A0145F;

  --color-page-bg: #FFF1F7;
  --color-surface: #FFFFFF;
  --color-bg-subtle: #FFF7FB;
  --color-bg-row-hover: #FFF4F9;
  --color-bg-muted: #FFF7FB;
  --color-bg-placeholder: #FCE3F0;
  --color-bg-neutral: #FBE6F1;
  --color-bg-control: #FCE8F2;
  --color-bg-control-hover: #F8D6E8;

  --color-border: #F3C6DD;
  --color-border-header: #F8DCEA;
  --color-border-row: #FBE7F1;
  --color-border-strong: #E9A6C9;
  --color-scrollbar-thumb: #EDB4D3;
  --color-dot-idle: #EDB4D3;

  --color-text: #3D0B2A;
  --color-text-strong: #5E1942;
  --color-text-secondary: #6E2550;
  --color-text-muted: #8A3A68;
  --color-text-subtle: #9C5A82;

  --overlay-modal: rgba(74, 16, 51, 0.4);
  --overlay-drawer: rgba(74, 16, 51, 0.35);
  --overlay-signin: #4A1033;
  --shadow-modal: 0 30px 70px rgba(176, 24, 110, 0.25);
  --shadow-drawer: -18px 0 50px rgba(176, 24, 110, 0.18);
  --shadow-dropdown: 0 16px 40px rgba(176, 24, 110, 0.16);
  --shadow-toast: 0 14px 36px rgba(176, 24, 110, 0.28);

  --radius-card: 22px;
  --radius-control: 12px;
  --radius-modal: 24px;

  --jude-flower-a: #F7A8CF;
  --jude-flower-b: #FFD1E6;
  --jude-flower-center: #FFE08A;
  --jude-petal-pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%23F9C6DF' fill-opacity='0.45'%3E%3Cellipse cx='22' cy='26' rx='7' ry='3.5' transform='rotate(35 22 26)'/%3E%3Cellipse cx='86' cy='18' rx='6' ry='3' transform='rotate(-20 86 18)'/%3E%3Cellipse cx='64' cy='74' rx='8' ry='3.5' transform='rotate(60 64 74)'/%3E%3Cellipse cx='14' cy='96' rx='5.5' ry='2.8' transform='rotate(-45 14 96)'/%3E%3Cellipse cx='104' cy='92' rx='6.5' ry='3' transform='rotate(15 104 92)'/%3E%3C/g%3E%3Cg fill='%23FBD9EA' fill-opacity='0.6'%3E%3Ccircle cx='48' cy='44' r='2'/%3E%3Ccircle cx='98' cy='56' r='1.6'/%3E%3Ccircle cx='36' cy='108' r='1.8'/%3E%3C/g%3E%3C/svg%3E");
}
