/* Layout: one restrained system for the site and the app, after TryClean. Warm charcoal
   neutrals, white primary buttons, filled charcoal secondary buttons, neutral selected states.
   Libertinus Serif only for landing and sign-in display headings; Inter for everything else.
   Colour comes from cover art, service marks and muted amber/red states, never from accents. */
:root {
  --paper: #151412;
  --paper-rgb: 21 20 18;
  --surface: #1D1B19;
  --surface-2: #292622;
  --surface-3: #34302B;
  --ink: #F4F2EC;
  --ink-2: #B8B2AA;
  --ink-3: #9A948C;
  --line: rgba(244, 242, 236, .08);
  --line-2: rgba(244, 242, 236, .14);
  --on-ink: #151412;
  /* Selected and data states are neutral. The old accent names map onto them. */
  --blue: #E9E5DD;
  --blue-ink: #F4F2EC;
  --blue-soft: rgba(244, 242, 236, .08);
  --pink: #E9E5DD;
  --pink-soft: rgba(244, 242, 236, .08);
  --yellow: #D4A85A;
  --mint: rgba(244, 242, 236, .08);
  --ok: #E9E5DD;
  --ok-soft: rgba(244, 242, 236, .08);
  --warn: #D9B06A;
  --warn-mark: #C9A15E;
  --warn-soft: rgba(212, 168, 90, .12);
  --bad: #E08A7F;
  --bad-soft: rgba(217, 121, 110, .13);
  --card-border: rgba(244, 242, 236, .08);
  --card-shadow: rgba(0, 0, 0, .4);
  --scrim: rgba(10, 9, 8, .72);
  --chart-grid: rgba(244, 242, 236, .07);
  --glass: rgba(21, 20, 18, .86);
  --block-ink: #100F0E;
  --block-paper: #F4F2EC;
  --label: #8C867E;
  --f-display: "Libertinus Serif", "Iowan Old Style", Georgia, serif;
  --f-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-doc: var(--f-sans);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --t-fast: 150ms;
  --t-med: 200ms;
  --t-slow: 250ms;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --paper: #F6F4EF; --paper-rgb: 246 244 239; --surface: #FFFFFF; --surface-2: #EFECE6; --surface-3: #E4E0D8;
    --ink: #1A1816; --ink-2: #57524B; --ink-3: #6A645C; --line: rgba(26, 24, 22, .09); --line-2: rgba(26, 24, 22, .16); --on-ink: #FFFFFF;
    --blue: #2A2724; --blue-ink: #1A1816; --blue-soft: rgba(26, 24, 22, .06); --pink: #2A2724; --pink-soft: rgba(26, 24, 22, .06);
    --yellow: #8F6A1E; --mint: rgba(26, 24, 22, .06); --ok: #2A2724; --ok-soft: rgba(26, 24, 22, .06);
    --warn: #8A5F12; --warn-mark: #B8862C; --warn-soft: #F6EBD3; --bad: #A8412F; --bad-soft: #F7E3DE;
    --card-border: rgba(26, 24, 22, .09); --card-shadow: rgba(26, 24, 22, .1); --scrim: rgba(26, 24, 22, .45); --chart-grid: rgba(26, 24, 22, .07);
    --glass: rgba(246, 244, 239, .88); --label: #8C867E;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --paper: #F6F4EF; --paper-rgb: 246 244 239; --surface: #FFFFFF; --surface-2: #EFECE6; --surface-3: #E4E0D8;
  --ink: #1A1816; --ink-2: #57524B; --ink-3: #6A645C; --line: rgba(26, 24, 22, .09); --line-2: rgba(26, 24, 22, .16); --on-ink: #FFFFFF;
  --blue: #2A2724; --blue-ink: #1A1816; --blue-soft: rgba(26, 24, 22, .06); --pink: #2A2724; --pink-soft: rgba(26, 24, 22, .06);
  --yellow: #8F6A1E; --mint: rgba(26, 24, 22, .06); --ok: #2A2724; --ok-soft: rgba(26, 24, 22, .06);
  --warn: #8A5F12; --warn-mark: #B8862C; --warn-soft: #F6EBD3; --bad: #A8412F; --bad-soft: #F7E3DE;
  --card-border: rgba(26, 24, 22, .09); --card-shadow: rgba(26, 24, 22, .1); --scrim: rgba(26, 24, 22, .45); --chart-grid: rgba(26, 24, 22, .07);
  --glass: rgba(246, 244, 239, .88); --label: #8C867E;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--f-sans); margin: 0; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; font-weight: 600; }
p, ul, ol, dl, dd, blockquote, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
p { text-wrap: pretty; }
a { color: inherit; }
img, svg { max-width: 100%; }
.i { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); }
.small { font-size: 13px; }
.num, .code { font-variant-numeric: tabular-nums; }
.code { letter-spacing: .01em; font-weight: 500; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

/* Buttons: white primary, filled charcoal secondary, quiet ghost */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; background: var(--surface-2); color: var(--ink);
  font-weight: 500; font-size: 14px; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.btn:active { transform: scale(.97); }
.btn .i { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); color: var(--on-ink); }
.btn.accent { background: var(--ink); color: var(--on-ink); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .65; cursor: default; transform: none; }
@media (hover: hover) {
  .btn:hover { background: var(--surface-3); }
  .btn.primary:hover, .btn.accent:hover { background: #FFFFFF; }
  :root[data-theme="light"] .btn.primary:hover { background: #000000; }
  .btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
  .btn .arrow-i { transition: transform var(--t-med) var(--ease-out); }
  .btn:hover .arrow-i { transform: translateX(2px); }
}
@media (prefers-color-scheme: light) { @media (hover: hover) { :root:not([data-theme="dark"]) .btn.primary:hover { background: #000000; } } }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); transition: text-decoration-color var(--t-fast) var(--ease-out); }
@media (hover: hover) { .linkbtn:hover { text-decoration-color: currentColor; } }

/* Status: success is a check plus a label; warnings amber, errors red, all muted */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill .i { width: 13px; height: 13px; }
.pill.ok { background: var(--surface-2); color: var(--ink); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.blue { background: var(--surface-2); color: var(--ink); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-2); font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tag .i { width: 13px; height: 13px; }

/* Forms */
.input {
  width: 100%; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.input::placeholder { color: var(--ink-3); }
@media (hover: hover) { .input:hover { border-color: var(--ink-3); } }
.input:focus { outline: none; border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(244, 242, 236, .24); }
:root[data-theme="light"] .input:focus { box-shadow: 0 0 0 3px rgba(26, 24, 22, .2); }
textarea.input { min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 32px; }
.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 500; color: var(--ink-2); }

/* Brand: vinyl mark, neutral */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-sans); font-weight: 600; font-size: 18px; letter-spacing: -.02em; color: var(--ink); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.logo { width: 26px; height: 26px; flex: none; display: block; }
.logo .disc { fill: var(--ink); }
.logo .groove { fill: none; stroke: var(--paper); stroke-opacity: .32; stroke-width: 1; }
.logo .lbl { fill: var(--label); }
.logo .hole { fill: var(--paper); }

/* Official service marks */
.bm { display: inline-block; flex: none; object-fit: contain; vertical-align: middle; }
.bm-light { display: none; }
:root[data-theme="light"] .bm-dark { display: none; }
:root[data-theme="light"] .bm-light { display: inline-block; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .bm-dark { display: none; } :root:not([data-theme="dark"]) .bm-light { display: inline-block; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 80;
  display: flex; align-items: center; gap: 10px;
  max-width: min(520px, calc(100% - 32px)); padding: 12px 18px; border-radius: 12px;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-2); font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 32px var(--card-shadow);
  opacity: 0; visibility: hidden; transform: translate(-50%, 8px);
  transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out), visibility var(--t-med);
}
.toast .i { color: var(--ink-2); width: 16px; height: 16px; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* Modal */
.modal-back {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center;
  background: var(--scrim);
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  animation: fade var(--t-med) var(--ease-out);
}
.modal {
  width: 100%; max-width: 520px; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow: auto;
  background: var(--surface); border-radius: var(--r-lg); padding: 28px;
  display: grid; gap: 16px; animation: rise var(--t-slow) var(--ease-out);
  border: 1px solid var(--line-2);
}
.modal h2 { font-size: 22px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .btn:active { transform: none; }
}

/* Liquid glass: a translucent tint over a blurred, saturated backdrop, a bright rim that fades
   around the edge, an inner specular sheen, and soft depth. Falls back to a solid surface. */
.glass {
  --glass-tint: rgba(44, 41, 37, .42);
  --glass-sheen: rgba(255, 255, 255, .10);
  --glass-rim: rgba(255, 255, 255, .5);
  --glass-rim-soft: rgba(255, 255, 255, .07);
  --glass-shadow: 0 12px 36px rgba(0, 0, 0, .34), 0 2px 6px rgba(0, 0, 0, .22);
  position: relative; isolation: isolate;
  background: linear-gradient(180deg, var(--glass-sheen), rgba(255, 255, 255, .015) 58%, rgba(255, 255, 255, .04)), var(--glass-tint);
  -webkit-backdrop-filter: blur(22px) saturate(175%);
  backdrop-filter: blur(22px) saturate(175%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), inset 0 -1px 1px rgba(0, 0, 0, .22), var(--glass-shadow);
}
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 1;
  background: linear-gradient(140deg, var(--glass-rim), var(--glass-rim-soft) 28%, rgba(255, 255, 255, .02) 55%, var(--glass-rim-soft) 82%, rgba(255, 255, 255, .22));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(120% 90% at 18% -30%, rgba(255, 255, 255, .13), transparent 55%);
}
:root[data-theme="light"] .glass { --glass-tint: rgba(255, 255, 255, .58); --glass-sheen: rgba(255, 255, 255, .5); --glass-rim: rgba(255, 255, 255, .95); --glass-rim-soft: rgba(26, 24, 22, .06); --glass-shadow: 0 12px 32px rgba(26, 24, 22, .12), 0 1px 3px rgba(26, 24, 22, .1); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .glass { --glass-tint: rgba(255, 255, 255, .58); --glass-sheen: rgba(255, 255, 255, .5); --glass-rim: rgba(255, 255, 255, .95); --glass-rim-soft: rgba(26, 24, 22, .06); --glass-shadow: 0 12px 32px rgba(26, 24, 22, .12), 0 1px 3px rgba(26, 24, 22, .1); } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--surface); } }
@media (prefers-reduced-transparency: reduce) { .glass { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; } }
