@layer base, theme, refinement;

@layer base {
/* ========================================================================== 
   SUBTRACK — Liquid Glass · Editorial Serif
   A premium reskin. iOS-26 frosted-glass materials over a warm Claude cream
   canvas, typeset in Newsreader / Noto Serif SC. Palette unchanged.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

:root {
  color-scheme: light;

  /* Warm canvas */
  --bg: #faf9f5;
  --bg-2: #f5f1e9;

  /* Ink */
  --ink: #1d1b16;
  --ink-2: #4a443b;
  --ink-3: #6f685b;
  --muted: #8d8475;

  /* Terracotta accent (Claude) */
  --terra: #d97757;
  --terra-deep: #bd5f3f;
  --terra-press: #a4502f;
  --terra-tint: rgba(217,119,87,0.12);

  /* Sage + clay semantics (kept muted, warm) */
  --sage: #6B7B5E;
  --clay: #C47369;
  --ochre: #b08a4c;

  /* Hairlines */
  --line: rgba(40,32,22,0.08);
  --line-2: rgba(40,32,22,0.13);
  --line-3: rgba(40,32,22,0.20);

  /* Liquid glass */
  --glass-fill: linear-gradient(157deg, rgba(255,255,255,0.78) 0%, rgba(255,253,248,0.48) 46%, rgba(252,248,240,0.58) 100%);
  --glass-strong: linear-gradient(157deg, rgba(255,255,255,0.93) 0%, rgba(255,253,247,0.74) 50%, rgba(251,247,238,0.80) 100%);
  --glass-border: rgba(255,255,255,0.60);
  --glass-hi: inset 0 1.2px 0.5px rgba(255,255,255,0.95), inset 0 0 0 0.5px rgba(255,255,255,0.30);
  --glass-drop: 0 24px 60px -24px rgba(82,58,40,0.26), 0 7px 20px -12px rgba(82,58,40,0.13);
  --glass-blur: saturate(180%) blur(26px);

  /* Card glass (no backdrop blur — perf with many cards) */
  --card-fill: linear-gradient(158deg, rgba(255,254,251,0.96), rgba(250,247,240,0.86));
  --card-hi: inset 0 1px 0 rgba(255,255,255,0.9);
  --card-drop: 0 14px 34px -18px rgba(82,58,40,0.20), 0 2px 6px -3px rgba(82,58,40,0.07);

  /* Radii */
  --r-xl: 30px;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 13px;
  --r-pill: 999px;

  --serif: "Newsreader", "Noto Serif SC", "Songti SC", "STSong", serif;
  --shell: min(1320px, calc(100vw - 84px));
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  min-width: 320px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(217,119,87,0.22); color: var(--ink); }

.shell { width: var(--shell); margin-inline: auto; }
.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; }

/* Background aurora — soft warm blooms the frosted glass can refract */
.bg-aurora {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40rem 34rem at 84% -8%, rgba(217,119,87,0.12), transparent 68%),
    radial-gradient(34rem 30rem at 6% 2%, rgba(176,158,118,0.12), transparent 70%),
    radial-gradient(42rem 38rem at 52% 118%, rgba(150,138,116,0.10), transparent 68%),
    linear-gradient(180deg, #fbfaf6 0%, var(--bg) 42%, #f2eee4 100%);
}
.noise {
  position: fixed; inset: 0; z-index: 70; opacity: 0.04; pointer-events: none; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

/* ── Reusable eyebrow / kicker ─────────────────────────────────────────── */
.eyebrow, .section-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  color: var(--terra-deep);
  font-size: 0.7rem; font-weight: 500; font-style: italic;
  letter-spacing: 0.06em;
}
.eyebrow::before, .section-kicker::before {
  content: ""; width: 22px; height: 1.5px; border-radius: 2px;
  background: linear-gradient(90deg, var(--terra), transparent);
}

/* ── Topbar ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  width: 100%; height: 74px;
  padding-inline: max(42px, calc((100vw - min(1320px, calc(100vw - 84px))) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(180deg, rgba(250,249,245,0.86), rgba(250,249,245,0.66));
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset, 0 10px 30px -22px rgba(82,58,40,0.5);
}

.brand { display: inline-flex; align-items: center; gap: 13px; }
.brand-logo { width: 34px; height: 34px; flex: none; display: block; filter: drop-shadow(0 5px 12px rgba(174,86,59,0.26)); }
.brand-word { display: flex; flex-direction: column; line-height: 1; }
.brand-word b { font-weight: 600; font-size: 1.12rem; letter-spacing: -0.01em; color: var(--ink); }
.brand-word i { font-style: italic; font-size: 0.6rem; letter-spacing: 0.14em; color: var(--muted); margin-top: 3px; }

.topbar-meta { display: flex; align-items: center; gap: 11px; }
.local-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-pill);
  background: rgba(255,255,255,0.5); border: 1px solid var(--line);
  box-shadow: var(--glass-hi);
  color: var(--ink-3); font-size: 0.72rem; letter-spacing: 0.01em;
}
.local-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 4px rgba(127,140,99,0.16); }

.currency-setting select {
  height: 38px; padding: 0 30px 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  appearance: none; background-color: rgba(255,255,255,0.55);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%238d8475' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 9px;
  box-shadow: var(--glass-hi); color: var(--ink); font-size: 0.78rem; font-weight: 500; cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease;
}
.currency-setting select:hover { background-color: rgba(255,255,255,0.8); border-color: var(--line-2); }

.icon-button {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.5); border: 1px solid var(--line);
  box-shadow: var(--glass-hi); color: var(--ink-2);
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .12s ease;
}
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:hover { background: rgba(255,255,255,0.85); border-color: var(--line-2); color: var(--terra-deep); }
.icon-button:active { transform: scale(0.95); }

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  min-height: 600px; padding: 92px 0 76px;
  display: grid; grid-template-columns: 1.06fr 0.94fr; align-items: center; gap: 60px;
}
.hero h1 {
  margin: 22px 0 30px; max-width: none;
  font-weight: 600; line-height: 1.0; letter-spacing: -0.03em;
}
.hero h1 .hl-lead {
  display: block; font-size: clamp(1.7rem, 2.7vw, 2.5rem); font-weight: 500;
  color: var(--ink-2); letter-spacing: 0.12em; padding-left: 0.24em;
  margin-bottom: 0.18em;
}
.hero h1 .hl-hero {
  display: block; margin: 0 0 0.08em -0.06em;
  font-size: clamp(3.6rem, 8vw, 7rem); font-weight: 600;
  font-style: italic; color: var(--terra);
  line-height: 1.0; letter-spacing: -0.05em;
}
.hero h1 .hl-tail {
  display: block; margin-top: 0.08em; padding-left: 2.6em;
  font-size: clamp(2.3rem, 4.4vw, 4.2rem); line-height: 1.05; letter-spacing: -0.015em;
}
.hero h1 .hl-tail .dot { color: var(--terra); font-style: italic; }
.hero .eyebrow { margin-bottom: 12px; }
.hero-intro { max-width: 31rem; color: var(--ink-2); font-size: 1.14rem; line-height: 1.82; }
.hero-actions { display: flex; align-items: center; gap: 28px; margin-top: 44px; }

.primary-button {
  height: 50px; padding: 0 24px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 11px;
  background: linear-gradient(180deg, #e08a6b, var(--terra)); color: #fff;
  font-size: 0.92rem; font-weight: 500; letter-spacing: 0.005em;
  box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 12px 26px -12px rgba(174,86,59,0.6), 0 2px 5px rgba(120,60,40,0.18);
  transition: background .18s ease, box-shadow .2s ease, transform .12s ease;
}
.primary-button:hover { background: linear-gradient(180deg, #d97f5f, var(--terra-deep)); box-shadow: 0 1px 0 rgba(255,255,255,0.4) inset, 0 16px 32px -12px rgba(174,86,59,0.66), 0 3px 7px rgba(120,60,40,0.2); transform: translateY(-1px); }
.primary-button:active { transform: translateY(0) scale(0.985); }
.button-plus { position: relative; width: 13px; height: 13px; }
.button-plus::before, .button-plus::after { content: ""; position: absolute; inset: 50% 0 auto; height: 1.6px; border-radius: 2px; background: currentColor; transform: translateY(-50%); }
.button-plus::after { transform: translateY(-50%) rotate(90deg); }

.text-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.95rem; font-style: italic; border-bottom: 1px solid var(--line-2); padding-bottom: 3px; transition: color .18s ease, border-color .18s ease; }
.text-link span { color: var(--terra); transition: transform .2s ease; }
.text-link:hover { color: var(--ink); border-color: var(--terra); }
.text-link:hover span { transform: translateX(4px); }

/* Hero glass insight card */
.hero-visual { position: relative; display: grid; place-items: center end; min-height: 440px; perspective: 1500px; }
.hero-visual::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  top: 50%; right: 24px; width: min(384px, 30vw); height: 300px;
  transform: translateY(-60%) rotate(-3.4deg);
  border-radius: var(--r-xl);
  background: linear-gradient(157deg, rgba(255,255,255,0.44), rgba(244,239,230,0.22));
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: 0 28px 64px -36px rgba(82,58,40,0.36);
}
.hero-visual::after {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  right: 34px; bottom: 5%; width: min(348px, 28vw); height: 44px;
  background: radial-gradient(50% 100% at 50% 0%, rgba(82,58,40,0.22), transparent 70%);
  filter: blur(12px);
}
.insight-shell {
  position: relative; isolation: isolate;
  width: min(420px, 34vw); min-width: 320px; padding: 30px;
  border-radius: var(--r-xl); overflow: hidden;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), var(--glass-drop);
  transition: transform .54s cubic-bezier(.34,1.56,.64,1), box-shadow .3s ease;
  cursor: pointer; z-index: 1;
}
.insight-shell.is-pressed {
  transform: scale(.955);
  box-shadow: var(--glass-hi), 0 10px 26px -20px rgba(48,34,24,0.5);
  transition: transform .12s cubic-bezier(.4,0,.6,1), box-shadow .12s ease;
}
.insight-shell::before { content: ""; position: absolute; inset: -40% 30% auto -10%; height: 16rem; border-radius: 50%; background: radial-gradient(circle, rgba(217,119,87,0.16), transparent 65%); filter: blur(6px); z-index: -1; }
.insight-shell > * { position: relative; z-index: 1; }
.insight-shell::after { content: ""; position: absolute; z-index: 0; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(176deg, rgba(255,255,255,0.6) 0%, rgba(255,255,255,0) 24%); }
.insight-head { display: flex; align-items: center; justify-content: space-between; color: var(--ink-3); font-size: 0.72rem; font-style: italic; letter-spacing: 0.02em; }
.ov-live { display: inline-flex; align-items: center; gap: 7px; }
.ov-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--terra); animation: ov-pulse 2.6s ease-out infinite; }
@keyframes ov-pulse { 0% { box-shadow: 0 0 0 0 rgba(217,119,87,0.5); } 70%, 100% { box-shadow: 0 0 0 8px rgba(217,119,87,0); } }
.overview-upcoming { color: var(--ink-3); }
.overview-upcoming b { color: var(--terra-deep); font-weight: 600; font-style: normal; }
.insight-total { display: flex; align-items: flex-end; gap: 13px; margin: 34px 0 28px; }
.insight-total strong { font-weight: 600; font-size: clamp(3.6rem, 5vw, 5rem); line-height: 0.82; letter-spacing: -0.03em; font-variant-numeric: tabular-nums lining-nums; }
.insight-total span { padding-bottom: 6px; color: var(--muted); font-size: 0.82rem; font-style: italic; }
.insight-bars { height: 66px; display: flex; align-items: flex-end; gap: 7px; }
.insight-bars i { flex: 1; border-radius: 4px 4px 2px 2px; background: rgba(40,32,22,0.12); animation: bar-rise .7s both cubic-bezier(.2,.8,.2,1); }
.insight-bars i:nth-child(1){height:28%}.insight-bars i:nth-child(2){height:44%}.insight-bars i:nth-child(3){height:34%}
.insight-bars i:nth-child(4){height:66%;background:var(--terra)}.insight-bars i:nth-child(5){height:48%}.insight-bars i:nth-child(6){height:76%}
.insight-bars i:nth-child(7){height:56%}.insight-bars i:nth-child(8){height:90%;background:var(--ink)}.insight-bars i:nth-child(9){height:62%}
.insight-bars i:nth-child(10){height:78%}.insight-bars i:nth-child(11){height:50%}.insight-bars i:nth-child(12){height:100%;background:var(--terra)}
@keyframes bar-rise { from { height: 0; opacity: 0; } }
.insight-legend { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; color: var(--ink-3); font-size: 0.74rem; }
.insight-legend span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.insight-legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.insight-legend i { width: 8px; height: 8px; border-radius: 50%; }
.legend-active { background: #6B7B5E; } .legend-expired { background: #C47369; } .legend-cancelled { background: #9a9286; } .legend-lifetime { background: #D97757; }

.reveal { opacity: 0; transform: translateY(14px); animation: reveal .8s .1s forwards cubic-bezier(.2,.75,.2,1); }
.reveal-1 { animation-delay: .18s; } .reveal-2 { animation-delay: .3s; } .reveal-3 { animation-delay: .42s; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ── Delivery polish: a11y, focus, typography, reduced-motion ─────────── */
:where(a, button, select, input, [tabindex]):focus-visible { outline: 2.5px solid color-mix(in oklab, var(--terra) 62%, transparent); outline-offset: 2px; border-radius: 6px; }
.section-heading h2, .status-group-head h3, .detail-title-row h2, .empty-state h3 { text-wrap: balance; }
.hero-intro, .section-heading p, .status-group-head small, .empty-state p, .stat-card p { text-wrap: pretty; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal, .motion-item { opacity: 1 !important; transform: none !important; }
}

/* ── Stats ────────────────────────────────────────────────────────────── */
.stats { padding: 44px 0 88px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  position: relative; isolation: isolate; min-height: 196px; padding: 24px 24px 22px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--card-fill); box-shadow: var(--card-hi), var(--card-drop);
  transition: transform .26s cubic-bezier(.2,.8,.2,1), box-shadow .26s ease, border-color .26s ease;
}
.stat-card:hover { transform: translateY(-4px); border-color: var(--line-2); box-shadow: var(--card-hi), 0 24px 48px -22px rgba(82,58,40,0.28), 0 4px 10px -5px rgba(82,58,40,0.1); }
.stat-head { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.74rem; font-style: italic; }
.stat-head span {
  min-width: 26px; height: 22px; padding: 0 8px; border-radius: var(--r-pill);
  display: inline-grid; place-items: center; font-style: normal; font-weight: 600; font-size: 0.64rem;
  background: var(--terra-tint); color: var(--terra-deep); font-variant-numeric: tabular-nums;
}
.stat-head p { margin: 0; }
.stat-card > div strong { display: block; margin-bottom: 8px; font-weight: 600; font-size: clamp(1.9rem, 2.6vw, 2.5rem); line-height: 1; letter-spacing: -0.025em; font-variant-numeric: tabular-nums lining-nums; }
.stat-card > div > p:not(.stat-head p) { color: var(--ink-3); font-size: 0.82rem; font-style: italic; }
.stat-card strong.stat-empty { color: var(--muted); font-weight: 500; font-size: clamp(1.5rem, 2vw, 1.9rem); }
.stat-card-featured strong.stat-empty { color: rgba(255,247,242,0.75); }
.mini-bars { height: 26px; display: flex; align-items: flex-end; gap: 5px; }
.mini-bars i { flex: 1; max-width: 9px; border-radius: 2px; background: var(--terra); opacity: 0.8; }
.mini-bars i:nth-child(1){height:30%}.mini-bars i:nth-child(2){height:53%}.mini-bars i:nth-child(3){height:42%}.mini-bars i:nth-child(4){height:80%}.mini-bars i:nth-child(5){height:63%}.mini-bars i:nth-child(6){height:100%}.mini-bars i:nth-child(7){height:83%}
.stat-symbol {
  position: absolute; right: 22px; bottom: 22px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.1rem;
  border: 1px solid var(--line-2); background: rgba(255,255,255,0.6); color: var(--terra-deep);
}
.pulse-symbol { width: 12px; height: 12px; right: 30px; bottom: 30px; border: 0; background: var(--terra); box-shadow: 0 0 0 7px rgba(217,119,87,0.1); }
.category-symbol { width: 36px; height: 32px; padding: 7px; display: flex; align-items: flex-end; gap: 3px; border-radius: 9px; }
.category-symbol i { width: 5px; border-radius: 3px 3px 1px 1px; background: var(--sage); }
.category-symbol i:nth-child(1){height:36%;opacity:.5}.category-symbol i:nth-child(2){height:68%;opacity:.74}.category-symbol i:nth-child(3){height:100%}

/* Featured stat — terracotta glass */
.stat-card-featured {
  border-color: rgba(189,95,63,0.35);
  background: linear-gradient(158deg, #e69a7d 0%, var(--terra) 58%, var(--terra-deep) 100%);
  color: #fff7f2;
  box-shadow: 0 1px 0 rgba(255,255,255,0.32) inset, 0 18px 40px -18px rgba(174,86,59,0.6), 0 3px 8px -4px rgba(120,60,40,0.2);
}
.stat-card-featured::after { content:""; position:absolute; inset:0; z-index:-1; background: radial-gradient(20rem 14rem at 110% -10%, rgba(255,255,255,0.4), transparent 60%); }
.stat-card-featured .stat-head { color: rgba(255,247,242,0.82); }
.stat-card-featured .stat-head span { background: rgba(255,255,255,0.22); color: #fff; }
.stat-card-featured > div > p:not(.stat-head p) { color: rgba(255,247,242,0.85); }
.stat-card-featured .mini-bars i { background: #fff; opacity: 0.78; }

/* ── Renewals panel (glass) ───────────────────────────────────────────── */
.renewals {
  position: relative; isolation: isolate; margin: 8px auto 24px; padding: 46px 48px;
  border-radius: var(--r-xl); overflow: hidden;
  background: linear-gradient(158deg, rgba(255,254,250,0.7), rgba(244,240,231,0.82));
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), 0 24px 56px -26px rgba(82,58,40,0.22);
}
.renewals::before { content: ""; position: absolute; z-index: -1; inset: -10rem -6rem auto auto; width: 26rem; height: 22rem; right: -6rem; top: -10rem; background: radial-gradient(circle, rgba(217,119,87,0.14), transparent 64%); }
.renewals .section-kicker { color: var(--terra-deep); }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 30px; }
.section-heading h2 { margin: 10px 0 0; font-weight: 600; font-size: clamp(2.1rem, 3.4vw, 3rem); line-height: 1.05; letter-spacing: -0.02em; }
.section-heading h2 sup { margin-left: 9px; color: var(--terra-deep); font-size: 0.9rem; font-style: italic; vertical-align: super; font-variant-numeric: tabular-nums; }

.segmented {
  display: inline-flex; padding: 4px; gap: 2px; border-radius: var(--r-pill);
  background: rgba(40,32,22,0.05); border: 1px solid var(--line);
  box-shadow: inset 0 1px 2px rgba(82,58,40,0.06);
}
.segmented button { min-width: 60px; height: 34px; padding: 0 14px; border-radius: var(--r-pill); color: var(--ink-3); font-size: 0.82rem; font-weight: 500; transition: color .18s ease, background .18s ease, box-shadow .18s ease; }
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: linear-gradient(180deg, #fff, #fbf8f1); color: var(--terra-deep); box-shadow: 0 2px 6px rgba(82,58,40,0.12), 0 0 0 1px rgba(255,255,255,0.6) inset; }

.renewal-track { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.renewal-item {
  --accent: var(--terra);
  position: relative; isolation: isolate; min-height: 116px; padding: 18px 18px 18px 22px; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: rgba(255,254,250,0.7); box-shadow: var(--card-hi), 0 8px 20px -14px rgba(82,58,40,0.18);
  transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.renewal-item::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.renewal-item:hover { transform: translateY(-2px); border-color: var(--line-2); background: rgba(255,255,253,0.9); box-shadow: var(--card-hi), 0 16px 30px -16px rgba(82,58,40,0.24); }
.renewal-date { width: 54px; height: 64px; border-radius: var(--r-sm); display: grid; place-content: center; text-align: center; background: linear-gradient(160deg, #f6e7de, #f1ddd1); color: var(--terra-press); box-shadow: inset 0 0 0 1px rgba(174,86,59,0.1); }
.renewal-date strong { font-weight: 500; font-size: 1.42rem; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums lining-nums; }
.renewal-date span { margin-top: 4px; font-size: 0.6rem; font-style: italic; letter-spacing: 0.04em; text-transform: uppercase; }
.renewal-copy { min-width: 0; }
.renewal-copy strong, .renewal-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.renewal-copy strong { margin-bottom: 5px; font-weight: 500; font-size: 1rem; }
.renewal-copy span { color: var(--ink-3); font-size: 0.78rem; font-style: italic; }
.renewal-price { text-align: right; }
.renewal-price strong { display: block; font-weight: 500; font-size: 1rem; font-variant-numeric: tabular-nums lining-nums; }
.renewal-price span { display: block; margin-top: 4px; color: var(--terra-deep); font-size: 0.64rem; font-style: italic; }
.renewal-item.urgency-high { --accent: var(--clay); border-color: rgba(176,106,82,0.3); background: linear-gradient(135deg, rgba(247,230,222,0.92), rgba(255,254,250,0.7)); }
.renewal-item.urgency-high .renewal-date { background: linear-gradient(160deg, #e69a7d, var(--terra)); color: #fff; box-shadow: none; }
.renewal-item.urgency-high .renewal-price span { color: var(--clay); }
.renewal-item.urgency-soon { --accent: var(--ochre); border-color: rgba(176,138,76,0.28); }
.renewal-empty { grid-column: 1 / -1; min-height: 116px; border: 1px dashed var(--line-3); border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; gap: 11px; color: var(--ink-3); font-size: 0.86rem; font-style: italic; background: rgba(255,255,255,0.3); }
.renewal-empty i { width: 8px; height: 8px; border-radius: 50%; background: var(--terra); }

/* ── Library ──────────────────────────────────────────────────────────── */
.library { padding: 60px 0 100px; }
.library-heading { margin-bottom: 26px; }
.secondary-button {
  height: 46px; padding: 0 20px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(255,255,255,0.6); border: 1px solid var(--line-2); color: var(--ink);
  font-size: 0.9rem; font-weight: 500; box-shadow: var(--glass-hi);
  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.secondary-button:hover { background: rgba(255,255,255,0.92); border-color: var(--line-3); transform: translateY(-1px); }
.secondary-button:active { transform: scale(0.98); }

.controls {
  position: sticky; top: 88px; z-index: 20;
  margin-bottom: 30px; padding: 9px; border-radius: var(--r-md);
  display: grid; grid-template-columns: minmax(220px,1fr) repeat(3, auto) auto; align-items: center; gap: 5px;
  background: linear-gradient(180deg, rgba(250,249,245,0.9), rgba(250,249,245,0.74));
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), 0 16px 40px -22px rgba(82,58,40,0.28);
}
.search-control { height: 50px; padding: 0 16px; display: flex; align-items: center; gap: 11px; border-right: 1px solid var(--line); }
.search-control svg { width: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.7; stroke-linecap: round; }
.search-control input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 0.95rem; }
.search-control input::placeholder { color: var(--muted); font-style: italic; }
.select-control { position: relative; min-width: 138px; height: 50px; padding: 0 12px; display: flex; align-items: center; gap: 9px; }
.select-control > span { color: var(--muted); font-size: 0.66rem; font-style: italic; letter-spacing: 0.04em; }
.select-control select {
  min-width: 80px; border: 0; outline: 0; appearance: none; padding-right: 22px;
  background: transparent; color: var(--ink); cursor: pointer; font-size: 0.84rem; font-weight: 500;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%238d8475' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 2px center; background-size: 9px;
}
.select-control option { background: #fff; color: var(--ink); }
.reset-button { height: 50px; padding: 0 16px; border-left: 1px solid var(--line); color: var(--muted); font-size: 0.82rem; font-style: italic; transition: color .16s ease, background-color .16s ease; }
.reset-button:hover { color: var(--terra-deep); background-color: rgba(255,255,255,0.65); }

/* status groups */
.subscription-grid { display: block; }
.status-group { padding-top: 14px; scroll-margin-top: 160px; }
.status-group + .status-group { margin-top: 56px; }
.status-group-head { min-height: 54px; margin-bottom: 20px; padding: 0 4px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.status-group-head > div { display: flex; align-items: baseline; gap: 13px; flex-wrap: wrap; }
.status-group-head span { color: var(--sage); font-size: 0.66rem; font-style: italic; letter-spacing: 0.05em; font-variant-numeric: tabular-nums; }
.status-group-head h3 { margin: 0; font-weight: 600; font-size: 1.75rem; letter-spacing: -0.02em; }
.status-group-head small { color: var(--muted); font-size: 0.8rem; font-style: italic; }
.status-group-head p { margin: 0; color: var(--muted); font-size: 0.72rem; font-style: italic; font-variant-numeric: tabular-nums; }
.status-group-expired .status-group-head span { color: #C47369; }
.status-group-cancelled .status-group-head span { color: var(--muted); }
.status-group-lifetime .status-group-head span { color: #D97757; }
.status-items { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }

/* ── Subscription card ────────────────────────────────────────────────── */
.subscription-card {
  --card-color: #b0a89c;
  position: relative; isolation: isolate; min-height: 206px; padding: 19px; overflow: hidden;
  display: flex; flex-direction: column; cursor: pointer;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--card-fill); box-shadow: var(--card-hi), var(--card-drop);
  transition: transform .24s cubic-bezier(.2,.8,.2,1), box-shadow .24s ease, border-color .24s ease, opacity .5s ease;
}
/* faint category-tinted corner bloom for material depth */
.subscription-card::before {
  content: ""; position: absolute; z-index: -1; width: 230px; height: 230px; top: -104px; right: -80px; border-radius: 50%;
  background: radial-gradient(circle, var(--card-color), transparent 66%); opacity: 0.2;
  transition: opacity .4s ease, transform .5s cubic-bezier(.2,.8,.2,1);
}
.subscription-card:hover::before { opacity: 0.44; transform: scale(1.22); }
/* pointer-follow specular sheen (Liquid Glass light bending) */
.subscription-card::after {
  content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(180px circle at var(--pointer-x,50%) var(--pointer-y,0%), rgba(255,255,255,0.82), color-mix(in oklab, var(--card-color) 30%, transparent) 42%, transparent 62%);
  opacity: 0; transition: opacity .2s ease;
}
.subscription-card.pointer-lit::after { opacity: 0.6; }
.subscription-card > * { position: relative; z-index: 1; }
.subscription-card:hover { transform: translateY(-5px); border-color: color-mix(in oklab, var(--card-color) 58%, var(--line-2)); box-shadow: var(--card-hi), 0 26px 52px -20px rgba(82,58,40,0.32), 0 4px 10px -5px rgba(82,58,40,0.1), 0 0 60px -8px color-mix(in oklab, var(--card-color) 66%, transparent), 0 0 26px -10px color-mix(in oklab, var(--card-color) 80%, transparent); }
.subscription-card:focus-visible { outline: 3px solid color-mix(in oklab, var(--card-color) 40%, transparent); outline-offset: 3px; }

.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-category { min-width: 0; display: inline-flex; align-items: center; gap: 8px; overflow: hidden; color: var(--ink-3); font-size: 0.74rem; font-style: italic; text-overflow: ellipsis; white-space: nowrap; }
.card-category i { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--card-color); box-shadow: 0 0 0 3px color-mix(in oklab, var(--card-color) 16%, transparent); }
.renewal-countdown {
  --u-ink: var(--sage); --u-bg: rgba(127,140,99,0.12);
  min-height: 27px; padding: 0 11px; flex: none; display: inline-flex; align-items: center; border-radius: var(--r-pill);
  background: var(--u-bg); color: var(--u-ink); border: 1px solid color-mix(in oklab, var(--u-ink) 22%, transparent);
  font-size: 0.72rem; font-weight: 500; letter-spacing: -0.005em; font-variant-numeric: tabular-nums;
}
.subscription-card.urgency-urgent .renewal-countdown { --u-ink: var(--clay); --u-bg: rgba(176,106,82,0.13); }
.subscription-card.urgency-soon .renewal-countdown { --u-ink: var(--ochre); --u-bg: rgba(176,138,76,0.14); }
.subscription-card.urgency-relaxed .renewal-countdown { --u-ink: var(--sage); --u-bg: rgba(127,140,99,0.12); }
.subscription-card.urgency-quiet .renewal-countdown, .subscription-card.urgency-cancelled .renewal-countdown { --u-ink: var(--muted); --u-bg: rgba(141,132,117,0.14); }
.subscription-card.urgency-expired .renewal-countdown { --u-ink: var(--clay); --u-bg: rgba(176,106,82,0.12); }
.subscription-card.urgency-lifetime .renewal-countdown { --u-ink: var(--sage); --u-bg: rgba(127,140,99,0.13); }

.card-primary { margin: 16px 0 18px; }
.card-primary h3 { min-height: 1.3em; margin: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--ink); font-weight: 600; font-size: 1.22rem; line-height: 1.28; letter-spacing: -0.015em; }
.card-amount { min-height: 26px; margin-top: 9px; display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums lining-nums; }
.card-amount strong { color: var(--ink); font-weight: 600; font-size: 1.34rem; letter-spacing: -0.02em; }
.card-amount small { color: var(--ink-3); font-size: 0.74rem; font-style: italic; }
.card-pending { min-height: 25px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 8px; background: rgba(40,32,22,0.06); color: var(--muted); font-size: 0.74rem; font-style: italic; }

.card-timeline { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.cycle-progress { height: 5px; overflow: hidden; border-radius: var(--r-pill); background: rgba(40,32,22,0.08); }
.cycle-progress.is-hidden { visibility: hidden; }
.cycle-progress i { display: block; width: var(--progress); height: 100%; border-radius: inherit; background: var(--card-color); transform-origin: left; animation: progress-reveal .65s cubic-bezier(.2,.8,.2,1) both; }
@keyframes progress-reveal { from { scale: 0 1; } }
.card-schedule { min-height: 22px; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.card-open { flex: none; color: var(--terra-deep); font-style: italic; opacity: 0; transform: translateX(-4px); transition: opacity .18s ease, transform .18s ease; }
.subscription-card:hover .card-open, .subscription-card:focus-visible .card-open { opacity: 1; transform: none; }

.subscription-card.status-expired, .subscription-card.status-cancelled { background: linear-gradient(158deg, rgba(250,247,242,0.96), rgba(244,240,233,0.82)); }
.subscription-card.status-expired .card-primary, .subscription-card.status-expired .card-timeline,
.subscription-card.status-cancelled .card-primary, .subscription-card.status-cancelled .card-timeline { opacity: 0.74; }
.subscription-card.is-incomplete { background: linear-gradient(158deg, rgba(253,251,247,0.96), rgba(248,244,237,0.84)); }

/* ── Empty state ──────────────────────────────────────────────────────── */
.empty-state { min-height: 400px; padding: 64px 24px; border: 1px dashed var(--line-3); border-radius: var(--r-lg); text-align: center; background: rgba(255,255,255,0.4); }
.empty-state[hidden] { display: none; }
.empty-mark { width: 92px; height: 76px; margin: 0 auto 28px; position: relative; }
.empty-mark span { position: absolute; width: 64px; height: 46px; left: 14px; border: 1px solid var(--line-3); border-radius: 13px; background: var(--card-fill); box-shadow: var(--card-drop); }
.empty-mark span:nth-child(1) { top: 0; transform: rotate(-7deg); }
.empty-mark span:nth-child(2) { top: 12px; transform: rotate(5deg); }
.empty-mark span:nth-child(3) { top: 25px; border-color: rgba(217,119,87,0.45); }
.empty-state h3 { margin: 13px 0 10px; font-weight: 600; font-size: 1.7rem; }
.empty-state > p:not(.section-kicker) { margin: 0 auto 22px; max-width: 30ch; color: var(--ink-3); font-size: 0.95rem; font-style: italic; }
.empty-state .primary-button { margin: 0 auto; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.footer { min-height: 96px; margin-top: 8px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--muted); font-size: 0.84rem; font-style: italic; }
.footer span { color: var(--terra); font-style: normal; padding: 0 4px; }
.footer button { color: var(--ink-2); border-bottom: 1px solid var(--line-2); font: inherit; transition: color .16s ease, border-color .16s ease; }
.footer button:hover { color: var(--terra-deep); border-color: var(--terra); }

/* ── Dialogs (glass) ──────────────────────────────────────────────────── */
dialog { color: var(--ink); }
dialog::backdrop { background: rgba(40,32,22,0.28); backdrop-filter: blur(10px) saturate(120%); -webkit-backdrop-filter: blur(10px) saturate(120%); }

.subscription-dialog {
  width: min(620px, calc(100vw - 32px)); max-height: min(880px, calc(100vh - 32px)); padding: 0; overflow: auto;
  border: 1px solid var(--glass-border); border-radius: var(--r-xl);
  background: var(--glass-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), 0 50px 120px -30px rgba(48,34,24,0.5);
}
.subscription-dialog[open] { animation: dialog-in .3s cubic-bezier(.2,.8,.2,1); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
.subscription-dialog form { padding: 34px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.dialog-head h2, .confirm-dialog h2 { margin: 8px 0 0; font-weight: 600; font-size: 2rem; letter-spacing: -0.02em; }
.dialog-close { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,255,255,0.5); border: 1px solid var(--line); color: var(--ink-2); font-size: 1.4rem; font-weight: 300; line-height: 1; transition: background .16s ease, color .16s ease; }
.dialog-close:hover { background: rgba(255,255,255,0.9); color: var(--terra-deep); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 16px; }
.field { position: relative; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.field-span-2 { grid-column: span 2; }
.field > span:first-child, .field legend { color: var(--ink-2); font-size: 0.78rem; font-style: italic; }
.field b { color: var(--terra-deep); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid transparent; border-radius: 12px; outline: 0;
  background: rgba(255,255,255,0.55); box-shadow: inset 0 0 0 1px var(--line-2), inset 0 1px 2px rgba(82,58,40,0.04);
  color: var(--ink); transition: background .16s ease, box-shadow .16s ease;
}
.field input, .field select { height: 49px; padding: 0 15px; }
.field textarea { min-height: 88px; padding: 13px 15px; resize: vertical; line-height: 1.6; }
.field input:hover, .field select:hover, .field textarea:hover { background: rgba(255,255,255,0.78); box-shadow: inset 0 0 0 1px var(--line-3), inset 0 1px 2px rgba(82,58,40,0.05); }
.field input:focus, .field select:focus, .field textarea:focus { background: #fff; box-shadow: 0 0 0 3px var(--terra-tint), inset 0 0 0 1px var(--terra); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); font-style: italic; }
.field select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%238d8475' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 9px; }
.field-error { display: none; color: var(--clay); font-size: 0.72rem; font-style: italic; }
.field.invalid .field-error { display: block; }
.field.invalid input { box-shadow: 0 0 0 3px rgba(176,106,82,0.12), inset 0 0 0 1px var(--clay); }
.field-hint { color: var(--muted); font-size: 0.72rem; font-style: italic; line-height: 1.5; }

.price-input-wrap { position: relative; display: block; }
.price-input-wrap > b { position: absolute; z-index: 1; left: 15px; top: 50%; translate: 0 -50%; color: var(--muted); font-size: 0.9rem; }
.price-input-wrap input { padding-left: 36px; }

.cycle-field { display: block; border: 0; padding: 0; margin: 0; }
.cycle-field legend { margin-bottom: 9px; }
.cycle-options { min-width: 0; height: 48px; padding: 4px; display: flex; gap: 3px; overflow-x: auto; border-radius: 13px; background: rgba(40,32,22,0.05); box-shadow: inset 0 0 0 1px var(--line-2); scrollbar-width: none; scroll-snap-type: x proximity; }
.cycle-options::-webkit-scrollbar { display: none; }
.cycle-options label { position: relative; min-width: 62px; height: 40px; flex: 1 0 62px; scroll-snap-align: center; }
.cycle-options input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.cycle-options label span { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 10px; color: var(--ink-3); font-size: 0.82rem; white-space: nowrap; pointer-events: none; transition: color .16s ease, background .16s ease, box-shadow .18s ease; }
.cycle-options label:hover span { color: var(--ink); }
.cycle-options input:checked + span { background: #fff; color: var(--terra-deep); box-shadow: 0 2px 7px rgba(82,58,40,0.12), inset 0 0 0 1px rgba(217,119,87,0.3); }
.cycle-options input:focus-visible + span { outline: 2px solid var(--terra-tint); outline-offset: -2px; }

.custom-cycle { margin-top: 11px; display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-radius: 13px; background: rgba(40,32,22,0.04); box-shadow: inset 0 0 0 1px var(--line-2); animation: dialog-in .22s both ease; }
.custom-cycle[hidden] { display: none; }
.custom-cycle .custom-cycle-label, .custom-cycle .custom-cycle-hint { color: var(--ink-3); font-size: 0.82rem; font-style: italic; white-space: nowrap; }
.custom-cycle .custom-cycle-hint { color: var(--muted); }
.custom-cycle input[type="number"] { width: 64px; flex: none; height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); font-weight: 500; font-size: 0.92rem; text-align: center; font-variant-numeric: tabular-nums; }
.custom-cycle select { width: auto; flex: none; height: 40px; padding: 0 30px 0 12px; border: 0; border-radius: 10px; appearance: none; background-color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%238d8475' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; background-size: 9px; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink); font-size: 0.86rem; cursor: pointer; }
.custom-cycle input:focus, .custom-cycle select:focus { outline: 0; box-shadow: 0 0 0 3px var(--terra-tint), inset 0 0 0 1px var(--terra); }

.advanced-settings { margin-top: 24px; border-top: 1px solid var(--line); }
.advanced-settings summary { min-height: 58px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; list-style: none; cursor: pointer; color: var(--ink); font-size: 0.95rem; }
.advanced-settings summary::-webkit-details-marker { display: none; }
.advanced-settings summary small { color: var(--muted); font-size: 0.8rem; font-style: italic; }
.advanced-settings summary i { width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .22s ease; }
.advanced-settings[open] summary i { transform: rotate(225deg); }
.advanced-grid { padding-top: 10px; animation: settings-in .26s both ease; }
@keyframes settings-in { from { opacity: 0; transform: translateY(-7px); } }

.color-field .color-input-wrap { height: 49px; padding: 0 13px; display: flex; align-items: center; gap: 12px; border-radius: 12px; background: rgba(255,255,255,0.55); box-shadow: inset 0 0 0 1px var(--line-2); }
.color-input-wrap input { width: 27px; height: 27px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; background: none; cursor: pointer; box-shadow: 0 0 0 1px var(--line-2); }
.color-input-wrap input::-webkit-color-swatch-wrapper { padding: 0; }
.color-input-wrap input::-webkit-color-swatch { border: 0; border-radius: 50%; }
.color-input-wrap output { color: var(--ink-3); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.color-swatches { display: flex; gap: 8px; }
.color-swatches button { width: 23px; height: 23px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--line-3); transition: transform .16s ease; }
.color-swatches button:hover { transform: scale(1.14); }

.dialog-actions { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; align-items: stretch; gap: 10px; }
.text-button { height: 46px; padding: 0 20px; border-radius: 13px; color: var(--ink-2); font-size: 0.9rem; transition: background .16s ease, color .16s ease; }
.text-button:hover { background: rgba(40,32,22,0.05); color: var(--ink); }
.save-button { min-width: 150px; }

/* Detail dialog */
.detail-dialog {
  width: min(720px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 32px)); padding: 0; overflow: auto;
  border: 1px solid var(--glass-border); border-radius: var(--r-xl);
  background: var(--glass-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-hi), 0 54px 130px -34px rgba(48,34,24,0.52);
}
.detail-dialog { --detail-color: var(--terra); }
.detail-dialog[open] { display: block; animation: dialog-in .34s cubic-bezier(.2,.8,.2,1); }
.detail-dialog::backdrop { background: rgba(40,32,22,0.3); backdrop-filter: blur(12px) saturate(110%); -webkit-backdrop-filter: blur(12px) saturate(110%); }
.detail-close { position: absolute; z-index: 4; top: 26px; right: 26px; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: rgba(255,255,255,0.66); border: 1px solid var(--line); color: var(--ink-2); font-size: 1.3rem; line-height: 1; backdrop-filter: blur(8px); }
.detail-close:hover { background: rgba(255,255,255,0.95); color: var(--terra-deep); }
.detail-cover {
  position: relative; isolation: isolate; min-height: 138px; margin: 14px 14px 0; padding: 22px 24px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  border-radius: var(--r-md); border: 1px solid color-mix(in oklab, var(--detail-color) 24%, var(--line-2));
  background:
    radial-gradient(16rem 12rem at 88% 12%, color-mix(in oklab, var(--detail-color) 26%, transparent), transparent 62%),
    linear-gradient(150deg, color-mix(in oklab, var(--detail-color) 16%, #faf9f5), #f4f0e8);
  color: var(--ink);
}
.detail-cover::after { content: ""; position: absolute; z-index: -1; width: 150px; height: 150px; right: -54px; bottom: -92px; border: 24px solid color-mix(in oklab, var(--detail-color) 16%, transparent); border-radius: 50%; }
.detail-cover > span { width: fit-content; min-height: 24px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: var(--r-pill); border: 1px solid color-mix(in oklab, var(--detail-color) 28%, transparent); background: rgba(255,255,255,0.5); color: var(--ink-2); font-size: 0.68rem; font-style: italic; backdrop-filter: blur(4px); }
.detail-cover > strong { font-weight: 600; font-size: 2.9rem; line-height: 0.85; letter-spacing: -0.04em; color: color-mix(in oklab, var(--detail-color) 62%, var(--ink)); }
.detail-cover > i { position: absolute; right: 24px; bottom: 22px; width: 34px; height: 3px; border-radius: 3px; background: var(--detail-color); opacity: 0.6; }
.detail-content { padding: 28px 34px 30px; display: flex; flex-direction: column; min-width: 0; }
.detail-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-right: 44px; }
.detail-title-row > div { min-width: 0; }
.detail-title-row h2 { max-width: 430px; margin: 10px 0 0; font-weight: 600; font-size: 2.1rem; line-height: 1.16; letter-spacing: -0.02em; }
.status-pill { display: inline-flex; align-items: center; min-height: 25px; padding: 0 11px; border-radius: var(--r-pill); background: rgba(127,140,99,0.13); color: var(--sage); font-size: 0.7rem; font-weight: 500; font-style: italic; }
.status-pill.status-expired { background: rgba(176,106,82,0.12); color: var(--clay); }
.status-pill.status-cancelled { background: rgba(141,132,117,0.14); color: var(--muted); }
.status-pill.status-lifetime { background: var(--ink); color: #f7f4ec; }
.detail-price { padding-bottom: 3px; white-space: nowrap; color: var(--ink-2); font-size: 0.95rem; font-weight: 500; font-variant-numeric: tabular-nums lining-nums; }
.detail-note { margin: 17px 0 22px; padding-bottom: 20px; border-bottom: 1px solid var(--line); color: var(--ink-3); font-size: 0.92rem; font-style: italic; line-height: 1.7; }
.detail-facts { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; }
.detail-facts div { min-height: 74px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.5); }
.detail-facts dt { margin-bottom: 8px; color: var(--muted); font-size: 0.68rem; font-style: italic; }
.detail-facts dd { margin: 0; color: var(--ink); font-size: 0.86rem; font-weight: 500; }
.detail-history { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.detail-history header { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 11px; font-size: 0.82rem; }
.detail-history header span { color: var(--muted); font-style: italic; }
.detail-history header strong { font-weight: 500; font-variant-numeric: tabular-nums; }
.detail-history > div { max-height: 76px; overflow: auto; color: var(--ink-3); font-size: 0.8rem; }
.detail-history > div span { padding: 5px 0; display: flex; justify-content: space-between; gap: 12px; }
.detail-history > div strong { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.detail-actions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.detail-delete { padding: 9px 14px; color: var(--muted); font-size: 0.86rem; font-style: italic; transition: color .16s ease; }
.detail-delete:hover { color: var(--clay); }
.detail-record { min-height: 44px; padding: 0 16px; border-radius: 13px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.6); color: var(--ink); font-size: 0.86rem; font-weight: 500; transition: background .16s ease, border-color .16s ease; }
.detail-record:hover { background: rgba(255,255,255,0.92); border-color: var(--line-3); }
.detail-record:disabled { opacity: 0.42; cursor: not-allowed; }
.detail-actions .primary-button { height: 46px; }

/* Confirm dialog */
.confirm-dialog { width: min(430px, calc(100vw - 32px)); padding: 34px; border: 1px solid var(--glass-border); border-radius: var(--r-lg); background: var(--glass-strong); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--glass-hi), 0 50px 120px -34px rgba(48,34,24,0.5); text-align: center; }
.confirm-dialog[open] { animation: dialog-in .26s ease-out; }
.confirm-icon { width: 46px; height: 46px; margin: 0 auto 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(176,106,82,0.12); color: var(--clay); font-size: 1.2rem; }
.confirm-dialog > p:not(.section-kicker) { color: var(--ink-3); font-size: 0.92rem; font-style: italic; line-height: 1.66; }
.confirm-dialog .section-kicker { justify-content: center; }
.confirm-dialog > p strong { color: var(--ink); font-style: normal; }
.confirm-actions { margin-top: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm-actions .text-button { height: 48px; border: 1px solid var(--line-2); border-radius: 13px; justify-content: center; display: inline-flex; align-items: center; }
.danger-button { height: 48px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(180deg, #c47558, var(--clay)); color: #fff; font-size: 0.9rem; font-weight: 500; box-shadow: 0 10px 22px -12px rgba(140,70,50,0.6); transition: background .16s ease, transform .12s ease; }
.danger-button:hover { background: linear-gradient(180deg, #b06a52, #9a5742); }
.danger-button:active { transform: scale(0.98); }

/* Toast */
.toast { position: fixed; right: 28px; bottom: 28px; z-index: 80; min-width: 220px; padding: 14px 17px; display: flex; align-items: center; gap: 11px; border-radius: var(--r-md); background: var(--glass-strong); border: 1px solid var(--glass-border); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--glass-hi), 0 24px 50px -22px rgba(48,34,24,0.4); color: var(--ink); opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .24s ease, transform .24s ease; }
.toast.show { opacity: 1; transform: none; }
.toast span { width: 23px; height: 23px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--sage); color: #fff; font-size: 0.72rem; }
.toast p { margin: 0; font-size: 0.86rem; }

/* ── Motion ───────────────────────────────────────────────────────────── */
.motion-item { opacity: 0; transform: translateY(30px) scale(.985); transition: opacity .72s cubic-bezier(.16,1,.3,1) calc(var(--motion-index,0) * 55ms), transform .72s cubic-bezier(.16,1,.3,1) calc(var(--motion-index,0) * 55ms); }
.motion-item.in-view { opacity: 1; transform: none; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1120px) {
  :root { --shell: calc(100% - 48px); }
  .hero { grid-template-columns: 1fr 0.78fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .status-items { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .renewal-track { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .controls { grid-template-columns: 1fr repeat(3, auto); }
  .topbar { padding-inline: 24px; }
}
@media (max-width: 820px) {
  :root { --shell: calc(100% - 36px); }
  .hero { min-height: auto; padding: 56px 0 44px; grid-template-columns: 1fr; gap: 28px; }
  .hero-visual { justify-items: start; min-height: 0; }
  .insight-shell { width: 100%; max-width: 420px; transform: none; }
  .renewals { padding: 34px 28px; }
  .status-items { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 600px) {
  :root { --shell: calc(100% - 28px); }
  .topbar { height: 64px; padding-inline: 16px; }
  .local-pill { display: none; }
  .hero h1 .hl-hero { font-size: clamp(3.4rem, 16vw, 5.2rem); }
  .hero h1 .hl-tail { padding-left: 0.7em; }
  .hero-intro { font-size: 1rem; }
  .hero-actions { flex-direction: column; align-items: flex-start; gap: 18px; }
  .stats { gap: 12px; }
  .stat-card { min-height: 176px; padding: 19px; }
  .controls { top: 78px; grid-template-columns: 1fr 1fr; gap: 4px; }
  .search-control { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--line); }
  .select-control:nth-of-type(4) { display: none; }
  .renewal-track { grid-template-columns: 1fr; }
  .status-items { grid-template-columns: 1fr; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 18px; }
  .subscription-dialog { width: calc(100vw - 20px); border-radius: var(--r-lg); }
  .subscription-dialog form { padding: 26px 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: span 1; }
  .detail-dialog { width: calc(100vw - 16px); }
  .detail-facts { grid-template-columns: 1fr 1fr; }
  .detail-actions { flex-wrap: wrap; }
  .toast { right: 14px; left: 14px; bottom: 14px; }
  .footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}

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