/* Light theme tokens (from the brief), type scale, glass material, shared controls. */
:root {
  --card: #ffffff; --ring: #8a79ab; --input: #eae7f0; --muted: #dcd9e3; --accent: #e6a5b8;
  --border: #cec9d9; --radius: 0.5rem; --primary: #8a79ab; --sidebar: #f1eff5;
  --secondary: #dfd9ec; --background: #f8f7fa; --foreground: #3d3c4f; --destructive: #d95c5c;
  --muted-foreground: #6b6880; --accent-foreground: #4b2e36; --primary-foreground: #f8f7fa;
  --secondary-foreground: #3d3c4f; --sidebar-border: #d7d2e0; --chart-3: #77b8a1; --chart-4: #f0c88d; --chart-5: #a0bbe3; --chart-2: #e6a5b8;
  /* #8a79ab with light text is 3.7:1; filled buttons use this deeper step (4.9:1). */
  --primary-strong: #6f5d9a; --primary-stronger: #5f4f88;
  --danger-text: #b23f3f;

  --font-sans: Geist, ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Lora", Georgia, serif;
  --font-mono: "Fira Code", ui-monospace, monospace;

  /* Type scale (px): 12 · 13 · 15 · 17 · 22 · 30 · 44 */
  --t-xs: 0.75rem; --t-sm: 0.8125rem; --t-base: 0.9375rem; --t-md: 1.0625rem;
  --t-lg: 1.375rem; --t-xl: 1.875rem; --t-display: clamp(2.125rem, 1.4rem + 3.2vw, 2.75rem);

  /* One quiet radius family: 6 for small marks, 10 for controls and images, 14 for panels. */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 16px; --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgb(61 60 79 / 0.06), 0 1px 1px rgb(61 60 79 / 0.04);
  --shadow-md: 1px 2px 5px 1px rgb(0 0 0 / 0.06);
  --shadow-lift: 0 10px 30px -12px rgb(61 60 79 / 0.28);
  /* Layered soft depth for raised surfaces (cards, panels) */
  --shadow-card: 0 1px 1px rgb(61 60 79 / 0.03), 0 2px 4px rgb(61 60 79 / 0.04), 0 12px 32px -16px rgb(61 60 79 / 0.16);

  /* Liquid glass: frosted fill, bright rim, inner highlight, soft drop. */
  --glass-fill: linear-gradient(180deg, rgb(255 255 255 / 0.82), rgb(255 255 255 / 0.68));
  --glass-rim: rgb(206 201 217 / 0.7);
  --glass-shadow: inset 0 1px 0 rgb(255 255 255 / 0.95), inset 0 -1px 0 rgb(var(--tint, 138 121 171) / 0.14),
    0 12px 40px -8px rgb(61 60 79 / 0.22), 0 2px 6px rgb(61 60 79 / 0.06);
  --glass-blur: blur(22px) saturate(1.7);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
body { margin: 0; font: 400 var(--t-base)/1.55 var(--font-sans); color: var(--foreground); background: var(--background); font-feature-settings: "ss01", "cv11"; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted-foreground); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.glass { background: var(--glass-fill); border: 1px solid var(--glass-rim); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
/* Denser glass for surfaces people read from (menus, sheets, dock, toasts). */
.glass-strong { --glass-fill: linear-gradient(180deg, rgb(255 255 255 / 0.93), rgb(255 255 255 / 0.86)); --glass-blur: blur(30px) saturate(1.8); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgb(255 255 255 / 0.96); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* Buttons */
.btn { font: 600 var(--t-sm)/1 var(--font-sans); letter-spacing: 0.005em; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-md); border: 1px solid var(--border); background: var(--card); color: var(--foreground);
  cursor: var(--cursor-hand, pointer); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; white-space: nowrap; transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease); }
.btn:hover { background: var(--sidebar); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary-strong); border-color: var(--primary-strong); color: #fff; }
.btn-primary:hover { background: var(--primary-stronger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgb(var(--tint, 138 121 171) / 0.1); }
.btn-danger { color: var(--danger-text); }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: var(--t-base); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: 0.5; transform: none; box-shadow: none; }

/* Fields */
.field label { display: block; font-size: var(--t-sm); font-weight: 600; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted-foreground); }
input, textarea, select { width: 100%; font: 400 var(--t-base)/1.4 var(--font-sans); color: var(--foreground);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 12px; min-height: 44px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
input::placeholder, textarea::placeholder { color: #9d99ab; }
select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236b6880' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 4.5 3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
textarea { min-height: 96px; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: #b9b2c9; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(var(--tint, 138 121 171) / 0.22); }
/* Ticks and radios get no glow box (it shows as a stray rectangle beside them); keyboard focus
   still gets a ring that follows their rounded corners. */
/* Ticks and radios are only as tall as they look (inputs get a 44px minimum elsewhere). */
input[type="checkbox"], input[type="radio"] { min-height: 0; }
input[type="checkbox"]:focus, input[type="radio"]:focus { box-shadow: none; outline: none; }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: none; border-radius: 4px; box-shadow: 0 0 0 3px rgb(var(--tint, 138 121 171) / 0.35); }
[aria-invalid="true"] { border-color: var(--destructive); }
.error { color: var(--danger-text); font-size: var(--t-sm); margin-top: 6px; }
.error:empty { display: none; }

/* Status badges */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 600; line-height: 1;
  padding: 5px 8px; border-radius: var(--r-sm); background: var(--input); color: var(--muted-foreground); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-live { background: #e2f1eb; color: #2f6b56; }
.badge-draft { background: #fbf0dd; color: #85560f; }
.badge-closed { background: var(--muted); color: var(--muted-foreground); }
.badge-warn { background: #f8e1e1; color: #9a3535; }
.badge-run { background: var(--secondary); color: #574878; }

/* Option chips */
.chip { font: 500 var(--t-sm)/1 var(--font-sans); min-height: 44px; min-width: 52px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--card); color: var(--foreground); cursor: var(--cursor-hand, pointer);
  transition: border-color .12s var(--ease), background .12s var(--ease); }
.chip:hover:not(:disabled) { border-color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--foreground); border-color: var(--foreground); color: #fff; }
.chip:disabled { cursor: not-allowed; color: #aaa6b6; background: transparent; border-style: dashed; text-decoration: line-through; text-decoration-color: #c4bfd0; }
.chip[hidden] { display: none; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 12px 16px; border-radius: var(--r-md); font-size: var(--t-sm); font-weight: 600; background: var(--foreground); color: #fff;
  transition: opacity .2s var(--ease), transform .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* A disabled primary button says what's missing, so it stays solid and readable. */
.btn-primary:disabled, .btn-primary[aria-disabled="true"] { opacity: 1; background: rgb(var(--tint, 138 121 171) / 0.2); border-color: transparent; color: var(--primary-stronger); }

/* Styled dropdown (dropdown.js) */
.dd { position: relative; display: inline-block; }
.dd-block { display: block; }
.dd-btn { all: unset; box-sizing: border-box; cursor: var(--cursor-hand, pointer); display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card); font: 600 var(--t-sm)/1 var(--font-sans); color: var(--foreground);
  box-shadow: 0 1px 2px rgb(61 60 79 / 0.05); transition: border-color .15s, box-shadow .15s; white-space: nowrap; }
.dd-block .dd-btn { width: 100%; }
.dd-btn:hover { border-color: #b9b2c9; }
.dd-btn:focus-visible, .dd.open .dd-btn { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(var(--tint, 138 121 171) / 0.22); }
.dd-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.dd-chev { color: var(--muted-foreground); transition: transform .15s; }
.dd.open .dd-chev { transform: rotate(180deg); }
.dd-sm .dd-btn { min-height: 34px; padding: 0 10px; font-size: var(--t-sm); }
.dd-list { position: fixed; z-index: 60; max-width: calc(100vw - 24px); margin: 0; padding: 6px; list-style: none;
  background: #fff; border: 1px solid #e3dfea; border-radius: var(--r-md); box-shadow: 0 18px 40px -14px rgb(61 60 79 / 0.32), 0 2px 6px rgb(61 60 79 / 0.06);
  animation: dd-in .14s var(--ease); }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }
.dd-list li { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: var(--r-sm); font-size: var(--t-sm); font-weight: 500; cursor: var(--cursor-hand, pointer); white-space: nowrap; outline: none; }
.dd-list li:hover, .dd-list li:focus { background: rgb(var(--tint, 138 121 171) / 0.12); }
.dd-list li[aria-selected="true"] { font-weight: 600; }
.dd-check { margin-left: auto; color: var(--primary-strong); }
.dd-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tone-draft, .tone-ordered { background: #d9a441; } .tone-live, .tone-delivered { background: #3f9a74; }
.tone-closed { background: #9a96a8; } .tone-new { background: #8a79ab; } .tone-shipped { background: #5b86c4; }
.dd-list { overflow-y: auto; overscroll-behavior: contain; }
.dd-list li.dd-off { color: #aaa6b6; cursor: not-allowed; }
/* Only the option's name is struck through, not its note ("Sold out") */
.dd-list li.dd-off .dd-label { text-decoration: line-through; }
.dd-list li.dd-off:hover { background: transparent; }
.dd-note { margin-left: auto; font-size: var(--t-xs); color: var(--muted-foreground); text-decoration: none; }

/* Accent set: your five theme hues. Deep steps for marks/text, pastels (above) for fills. */
:root {
  /* Brand plum: filled buttons, active tabs, data bars (white text on it is 11:1). */
  --plum: #3d2f66; --plum-deep: #2f2452;
  --a-lilac: #6f5ba8; --a-rose: #b5476f; --a-mint: #2f9a7a; --a-amber: #c98a1f; --a-blue: #4a7fd0;
  --float: 0 1px 1px rgb(61 60 79 / 0.04), 0 8px 16px -8px rgb(61 60 79 / 0.10), 0 28px 56px -28px rgb(111 91 168 / 0.34);
  --float-hover: 0 2px 4px rgb(61 60 79 / 0.05), 0 14px 28px -12px rgb(61 60 79 / 0.14), 0 40px 70px -30px rgb(111 91 168 / 0.42);
}
.btn-primary { background: var(--plum); border-color: var(--plum); color: #fff;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.14), 0 8px 20px -10px rgb(61 47 102 / 0.7); }
.btn-primary:hover { background: var(--plum-deep); border-color: var(--plum-deep); }

/* iPhone zooms the page into any text field under 16px and stays zoomed; touch screens get 16px. */
@media (pointer: coarse), (max-width: 899px) {
  input, textarea, select { font-size: 16px; }
}
.dd-swatch { width: 12px; height: 12px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12); }
