@font-face {
  font-family: 'Hanken Grotesk';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/hanken-grotesk-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Mulish';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/mulish-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Mulish';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/mulish-700.woff2') format('woff2');
}

:root {

  --font-head: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-text: 'Mulish', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 20px;  --s-6: 24px;  --s-8: 32px;  --s-10: 40px;
  --s-12: 48px; --s-16: 64px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  --control-h: 48px;
  --control-h-sm: 40px;
  --app-max: 760px;

  --dur: 180ms;
  --ease: cubic-bezier(.2, .7, .3, 1);

  --bg:           #FAF6EF;
  --surface:      #FFFFFF;
  --surface-2:    #F4EDE1;
  --surface-3:    #ECE3D4;
  --border:       #E9E0D1;
  --border-strong:#D6CAB6;

  --fg:        #322E29;
  --fg-muted:  #6E665B;
  --fg-subtle: #8A8072;
  --fg-inverse:#FFFFFF;

  --primary:        #2C7268;
  --primary-hover:  #235A52;
  --primary-press:  #1B453F;
  --primary-tint:   #E3EFEC;
  --primary-tint-2: #D2E6E1;

  --accent:    #D08160;
  --gold:      #6B4F14;
  --gold-tint: #F6EDD6;

  --success: #3C8A57;  --success-tint: #E4F1E8;
  --warning: #A9802B;  --warning-tint: #F7EFD9;
  --danger:  #C0584A;  --danger-tint:  #F8E6E2;  --danger-hover: #A6453A;

  --c-feed:   #B85F45;  --t-feed:   #F6E7DF;
  --c-weight: #466C9C;  --t-weight: #E4EAF3;
  --c-sleep:  #685D9B;  --t-sleep:  #EAE6F4;
  --c-diaper: #5C7B43;  --t-diaper: #E8EEDD;

  --scrim: rgba(40, 30, 18, 0.42);
  --shadow-sm: 0 1px 2px rgba(60, 45, 30, 0.07);
  --shadow-md: 0 4px 18px rgba(60, 45, 30, 0.10);
  --shadow-lg: 0 18px 50px rgba(35, 25, 14, 0.22);

  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--primary);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) { color-scheme: dark; }
  :root:not([data-theme='light']) {
    --bg:           #181511;
    --surface:      #211D17;
    --surface-2:    #2A251D;
    --surface-3:    #332D23;
    --border:       #383023;
    --border-strong:#4B4234;

    --fg:        #ECE3D5;
    --fg-muted:  #B2A795;
    --fg-subtle: #877C6B;
    --fg-inverse:#16201D;

    --primary:        #4FA294;
    --primary-hover:  #5FB3A4;
    --primary-press:  #6FC1B2;
    --primary-tint:   #233631;
    --primary-tint-2: #2C4640;

    --accent:    #E0926F;
    --gold:      #E4BD6A;
    --gold-tint: #322A18;

    --success: #5BA877;  --success-tint: #1F3326;
    --warning: #D6A94B;  --warning-tint: #332B18;
    --danger:  #D6796B;  --danger-tint:  #382220;  --danger-hover: #E08A7C;

    --c-feed:   #D98363;  --t-feed:   #382520;
    --c-weight: #7299CB;  --t-weight: #1F2A38;
    --c-sleep:  #9489C9;  --t-sleep:  #272138;
    --c-diaper: #88A86A;  --t-diaper: #232C1C;

    --scrim: rgba(0, 0, 0, 0.62);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.40);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.60);
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg:#181511; --surface:#211D17; --surface-2:#2A251D; --surface-3:#332D23;
  --border:#383023; --border-strong:#4B4234;
  --fg:#ECE3D5; --fg-muted:#B2A795; --fg-subtle:#877C6B; --fg-inverse:#16201D;
  --primary:#4FA294; --primary-hover:#5FB3A4; --primary-press:#6FC1B2;
  --primary-tint:#233631; --primary-tint-2:#2C4640;
  --accent:#E0926F; --gold:#E4BD6A; --gold-tint:#322A18;
  --success:#5BA877; --success-tint:#1F3326; --warning:#D6A94B; --warning-tint:#332B18;
  --danger:#D6796B; --danger-tint:#382220; --danger-hover:#E08A7C;
  --c-feed:#D98363; --t-feed:#382520; --c-weight:#7299CB; --t-weight:#1F2A38;
  --c-sleep:#9489C9; --t-sleep:#272138; --c-diaper:#88A86A; --t-diaper:#232C1C;
  --scrim:rgba(0,0,0,.62);
  --shadow-sm:0 1px 2px rgba(0,0,0,.30); --shadow-md:0 4px 18px rgba(0,0,0,.40);
  --shadow-lg:0 18px 50px rgba(0,0,0,.60);
}

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

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

body {
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;

  padding-bottom: env(safe-area-inset-bottom);
}

img, svg { display: block; max-width: 100%; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:where(h1, h2, h3, h4) {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-wrap: balance;
}
h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p { text-wrap: pretty; }
small, .meta { font-size: 0.8125rem; color: var(--fg-muted); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

::selection { background: var(--primary-tint-2); color: var(--fg); }

.app {
  width: 100%;
  max-width: var(--app-max);
  margin-inline: auto;
  padding: var(--s-6) var(--s-4) calc(var(--s-16) + env(safe-area-inset-bottom));
}
.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
  flex-wrap: wrap;
}
.page-head p { color: var(--fg-muted); }

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  padding-top: calc(var(--s-3) + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--fg);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 50% 50% 50% 4px;
  background: var(--accent);
  box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--accent) 55%, var(--surface));
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  list-style: none;
  padding: 0;
  margin-inline-start: var(--s-2);
}
.nav-links a {
  display: inline-flex;
  align-items: center;
  height: var(--control-h-sm);
  padding-inline: var(--s-3);
  border-radius: var(--r-pill);
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 0.9375rem;
}
.nav-links a:hover { color: var(--fg); background: var(--surface-2); text-decoration: none; }
.nav-links a.is-active { color: var(--primary); background: var(--primary-tint); }

.nav-end { display: flex; align-items: center; gap: var(--s-3); margin-inline-start: auto; }

.plan-badge {
  font-family: var(--font-text);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px var(--s-2);
  border-radius: var(--r-pill);
  color: var(--fg-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.plan-badge.is-pro {
  color: var(--gold);
  background: var(--gold-tint);
  border-color: color-mix(in srgb, var(--gold) 35%, transparent);
}

@media (max-width: 560px) {
  .nav-links { display: none; }
}

.tabs {
  display: flex;
  gap: var(--s-1);
  padding: var(--s-1);
  margin-bottom: var(--s-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding-inline: var(--s-4);
  border-radius: var(--r-pill);
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--fg-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.tab::before {
  content: '';
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--cat, var(--fg-subtle));
  transition: transform var(--dur) var(--ease);
}
.tab:hover { color: var(--fg); text-decoration: none; }
.tab:hover:not(.is-active) { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.tab.is-active {
  color: #fff;
  background: var(--cat, var(--primary));
  box-shadow: var(--shadow-sm);
}
.tab.is-active::before { background: rgba(255, 255, 255, 0.9); transform: scale(0.85); }

.cat-feed   { --cat: var(--c-feed);   --cat-tint: var(--t-feed); }
.cat-weight { --cat: var(--c-weight); --cat-tint: var(--t-weight); }
.cat-sleep  { --cat: var(--c-sleep);  --cat-tint: var(--t-sleep); }
.cat-diaper { --cat: var(--c-diaper); --cat-tint: var(--t-diaper); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: clip;
}
.card-pad { padding: var(--s-6); }

table.entries {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
table.entries th {
  text-align: left;
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  background: var(--surface-2);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
}
table.entries td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.entries tbody tr:last-child td { border-bottom: none; }
table.entries tbody tr { transition: background var(--dur) var(--ease); }
table.entries tbody tr:hover { background: var(--surface-2); }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }

.row-actions {
  display: inline-flex;
  gap: var(--s-1);
  opacity: 0.55;
  transition: opacity var(--dur) var(--ease);
}
tr:hover .row-actions,
tr:focus-within .row-actions { opacity: 1; }
@media (hover: none) { .row-actions { opacity: 1; } }

tr.is-editing {
  background: var(--primary-tint);
  box-shadow: inset 3px 0 0 var(--primary);
}
tr.is-editing td { padding-block: var(--s-2); }
tr.is-editing :where(input, select) {
  height: var(--control-h-sm);
  font-size: 0.9375rem;
}

.empty {
  text-align: center;
  padding: var(--s-12) var(--s-6);
  color: var(--fg-muted);
}

@media (max-width: 560px) {
  table.entries, table.entries tbody, table.entries tr, table.entries td { display: block; width: 100%; }
  table.entries thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.entries tr {
    padding: var(--s-3) var(--s-4);
    border-bottom: 1px solid var(--border);
  }
  table.entries td { border: none; padding: var(--s-1) 0; display: flex; gap: var(--s-3); }
  table.entries td::before {
    content: attr(data-label);
    flex: 0 0 84px;
    font-size: 0.75rem; font-weight: 700; letter-spacing: 0.03em;
    text-transform: uppercase; color: var(--fg-subtle);
    align-self: center;
  }
  .col-actions { justify-content: flex-end; padding-top: var(--s-2) !important; }
  .col-actions::before { display: none; }
  .row-actions { margin-inline-start: auto; }
}

.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--fg);
  --btn-bd: var(--border-strong);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--control-h);
  padding: 0 var(--s-6);
  font-family: var(--font-text);
  font-weight: 700;
  font-size: 0.9375rem;
  letter-spacing: 0.005em;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-md);
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }

.btn-primary { --btn-bg: var(--primary); --btn-fg: var(--fg-inverse); --btn-bd: transparent; }
.btn-primary:hover { --btn-bg: var(--primary-hover); }
.btn-primary:active { --btn-bg: var(--primary-press); }

.btn-secondary { --btn-bg: var(--surface); --btn-fg: var(--fg); --btn-bd: var(--border-strong); }
.btn-secondary:hover { --btn-bg: var(--surface-2); }

.btn-ghost { --btn-bg: transparent; --btn-fg: var(--fg-muted); --btn-bd: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-fg: var(--fg); }

.btn-danger { --btn-bg: transparent; --btn-fg: var(--danger); --btn-bd: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { --btn-bg: var(--danger-tint); --btn-fg: var(--danger-hover); }

.btn-upgrade {
  --btn-bg: var(--gold-tint);
  --btn-fg: var(--gold);
  --btn-bd: color-mix(in srgb, var(--gold) 38%, transparent);
  min-height: var(--control-h-sm);
  padding-inline: var(--s-4);
}
.btn-upgrade:hover { --btn-bg: color-mix(in srgb, var(--gold) 18%, var(--surface)); }

.btn-block { width: 100%; }
.btn-sm { min-height: var(--control-h-sm); padding-inline: var(--s-4); font-size: 0.875rem; }
.btn-icon {
  min-height: var(--control-h-sm);
  width: var(--control-h-sm);
  padding: 0;
  border-radius: var(--r-sm);
  --btn-bg: transparent; --btn-fg: var(--fg-muted); --btn-bd: transparent;
}
.btn-icon:hover { --btn-bg: var(--surface-3); --btn-fg: var(--fg); }

.fab {
  position: fixed;
  right: max(var(--s-5), env(safe-area-inset-right));
  bottom: max(calc(var(--s-6)), calc(env(safe-area-inset-bottom) + var(--s-4)));
  z-index: 30;
  width: min(60px, 12vw); height: min(60px, 12vw);
  display: grid; place-items: center;
  font-size: min(1.9rem, 5vw); line-height: 1;
  color: var(--fg-inverse);
  background: var(--primary);
  border: none; border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (min-width: 761px) {
  .fab {
    position: static;
    display: inline-flex; align-items: center; justify-content: center;
    gap: var(--s-2);
    width: auto; height: auto;
    min-height: var(--control-h-sm);
    padding: 0 var(--s-4);
    font-family: var(--font-text);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.005em;
    line-height: normal;
    color: var(--fg-inverse);
    background: var(--primary);
    border: 1px solid transparent;
    border-radius: var(--r-md);
    box-shadow: none;
    z-index: auto;
    right: auto; bottom: auto;
    transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
  }
  .fab:hover { background: var(--primary-hover); }
  .fab:active { transform: translateY(1px); }
  .fab::after { content: 'Add'; }
}
.fab:hover { background: var(--primary-hover); }
.fab:active { transform: scale(0.94); }

.btn[aria-busy='true'] { color: transparent; }
.btn[aria-busy='true']::after {
  content: '';
  position: absolute; left: 0; bottom: 0; height: 3px; width: 40%;
  background: color-mix(in srgb, currentColor 60%, transparent);
  animation: btn-load 1s var(--ease) infinite;
}
@keyframes btn-load { 0% { left: -40%; } 100% { left: 100%; } }

.form { display: flex; flex-direction: column; gap: var(--s-5); }
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.field > label {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--fg);
}

input, select, textarea {
  font-family: var(--font-text);
  font-size: 1rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  width: 100%;
}
:where(input:not([type='checkbox']):not([type='radio']), select) {
  height: var(--control-h);
  padding: 0 var(--s-4);
}
textarea { min-height: 96px; padding: var(--s-3) var(--s-4); line-height: 1.5; resize: vertical; }
::placeholder { color: var(--fg-subtle); }

input:hover, select:hover, textarea:hover { border-color: var(--fg-subtle); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.field.is-invalid :where(input, select, textarea),
[aria-invalid='true'] {
  border-color: var(--danger);
}
.field.is-invalid :where(input, select, textarea):focus,
[aria-invalid='true']:focus { box-shadow: 0 0 0 3px var(--danger-tint); }

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236E665B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--s-4) center;
  padding-right: var(--s-10);
}

.form-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; }
.form-actions .btn { flex: 1 1 auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.form-row > * { min-width: 0; }
@media (max-width: 440px) { .form-row { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .form-row-stack { grid-template-columns: 1fr; } }

dialog.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  border: none;
  padding: 0;
  background: transparent;
  color: var(--fg);
  max-width: 480px;
  width: 100%;
  margin: auto;
}
dialog.sheet::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.sheet-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 1.25rem; }
.sheet-head .btn-icon { font-size: 1.5rem; line-height: 1; }
.sheet-actions { display: flex; gap: var(--s-3); }
.sheet-actions .btn { flex: 1; }

@media (max-width: 540px) {
  dialog.sheet { max-width: 100%; margin: 0; position: fixed; inset: auto 0 0 0; }
  .sheet-inner {
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    padding-bottom: calc(var(--s-6) + env(safe-area-inset-bottom));
  }
}

dialog.sheet[open] { animation: sheet-in var(--dur) var(--ease); }
dialog.sheet[open]::backdrop { animation: fade-in var(--dur) var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes fade-in { from { opacity: 0; } }
@media (max-width: 540px) {
  @keyframes sheet-in { from { opacity: 0; transform: translateY(100%); } }
}

.baby-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: var(--s-3); }
.baby-card {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.avatar {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 700; font-size: 1.1rem;
  color: var(--primary);
  background: var(--primary-tint);
  border-radius: 50% 50% 50% 8px;
}
.baby-meta { flex: 1 1 auto; min-width: 0; }
.baby-name { font-family: var(--font-head); font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: var(--s-2); }

.tag {
  font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; padding: 2px var(--s-2);
  border-radius: var(--r-pill);
  color: var(--fg-muted); background: var(--surface-2);
}
.tag-preemie { color: var(--c-sleep); background: var(--t-sleep); }

.result-panel {
  max-width: 440px; margin: var(--s-12) auto;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: var(--s-4);
  padding: var(--s-10) var(--s-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.result-panel p { color: var(--fg-muted); }
.result-icon {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  font-size: 1.8rem; font-weight: 700;
  border-radius: 50%;
  color: var(--success); background: var(--success-tint);
}

.htmx-indicator { opacity: 0; transition: opacity var(--dur) var(--ease); }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

.htmx-added { animation: fade-in var(--dur) var(--ease); }

.htmx-swapping { opacity: 0.5; transition: opacity var(--dur) var(--ease); }

.stack > * + * { margin-top: var(--s-5); }
.center { text-align: center; }

.btn-row { display: flex; gap: var(--s-2); }
.card-mb { margin-bottom: var(--s-6); }
.section-title { margin-bottom: var(--s-5); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-bottom: var(--s-4); }
.stat-card { text-align: center; }
.stat-label { font-size: 0.8125rem; color: var(--fg-muted); margin-bottom: var(--s-1); }
.stat-value { font-size: 2rem; font-weight: 700; line-height: 1; }
.stat-value-sm { font-size: 1rem; font-weight: 600; line-height: 1.3; }
.tabs-flush { margin-bottom: 0; }
td.empty { padding: var(--s-8) var(--s-6); }
.result-icon-cancel { color: var(--fg-muted); background: var(--surface-2); }

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

.chart-container { position: relative; height: 250px; margin-bottom: var(--s-4); }

.switcher-list { display: flex; flex-direction: column; gap: var(--s-2); }
.switcher-item {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-3) var(--s-4); border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface);
  cursor: pointer; font: inherit; color: inherit; text-align: left; width: 100%;
}
.switcher-item:hover { background: var(--surface-2); }
.switcher-item.is-current { border-color: var(--primary); background: var(--surface-2); font-weight: 600; }

.quick-picks { display: flex; gap: var(--s-2); margin-bottom: var(--s-2); }
.quick-picks .btn { background: var(--surface-2); border: 1px solid var(--border); min-width: 3rem; }

.pro-charts { margin-top: var(--s-4); }

.chart-carousel {
  position: relative;
  overflow: hidden;
  padding: var(--s-2) 0;
}
.carousel-track { position: relative; }
.carousel-slide { display: none; }
.carousel-slide.active { display: block; }
.carousel-slide-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-align: center;
  margin-bottom: var(--s-2);
}
.carousel-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-3);
}
.carousel-prev, .carousel-next {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.carousel-prev:hover, .carousel-next:hover {
  background: var(--surface-3);
  color: var(--fg);
}
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: var(--s-2);
}
.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--border-strong);
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background var(--dur) var(--ease);
}
.carousel-dot.active { background: var(--primary); }

.pro-gate { position: relative; }
.pro-blur {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}
.pro-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  text-align: center;
}
.pro-lock { font-size: 2rem; }
.pro-overlay p {
  font-weight: 600;
  color: var(--fg);
  margin: 0;
}

.list-controls {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.list-filter,
.list-per-page {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.list-controls label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--fg-muted);
}
.list-controls select {
  font-size: var(--fs-sm);
  padding: var(--s-1) var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  color: var(--fg);
  min-height: 36px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
}
.pagination-info {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  font-weight: 500;
}
.btn-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.hero {
  text-align: center;
  padding: var(--s-12) 0 var(--s-8);
}
.hero h1 {
  font-size: 2rem;
  margin-bottom: var(--s-4);
}
.hero-sub {
  color: var(--fg-muted);
  max-width: 520px;
  margin-inline: auto;
  margin-bottom: var(--s-6);
  font-size: 1.05rem;
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-3);
}
.btn-lg {
  min-height: 56px;
  padding: 0 var(--s-8);
  font-size: 1.05rem;
  border-radius: var(--r-lg);
}

.feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-4);
  margin-bottom: var(--s-8);
}
.feature-card {
  text-align: center;
  border-left: 3px solid var(--cat, var(--primary));
}
.feature-card h3 { margin-bottom: var(--s-2); }
.feature-card p { color: var(--fg-muted); font-size: 0.9375rem; }
.feature-icon { margin-bottom: var(--s-3); }
.feature-icon svg { width: 32px; height: 32px; margin-inline: auto; }

@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.65rem; }
}

.hero-free {
  margin-top: var(--s-4);
  font-size: 1.05rem;
  opacity: .7;
}

.free-banner {
  text-align: center;
  padding: var(--s-8) var(--s-6);
}
.free-banner h2 {
  font-size: 1.6rem;
  margin-bottom: var(--s-2);
}
.free-banner p {
  font-size: 1.1rem;
  opacity: .7;
}

.pro-panel {
  text-align: center;
  padding: var(--s-8) var(--s-6);
  margin-bottom: var(--s-8);
  color: var(--fg);
  background: var(--gold-tint);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
  border-radius: var(--r-lg);
}
.pro-panel-badge {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 15%, transparent);
  padding: var(--s-1) var(--s-3);
  border-radius: var(--r-pill);
  margin-bottom: var(--s-3);
}
.pro-panel h2 { margin-bottom: var(--s-4); }
.pro-feats {
  list-style: none;
  padding: 0;
  margin-bottom: var(--s-4);
}
.pro-feats li {
  padding: var(--s-2) 0;
  color: var(--fg);
  font-weight: 600;
}
.pro-feats li::before {
  content: '\2713\00a0';
  color: var(--gold);
  font-weight: 700;
}
.price-tag {
  font-family: var(--font-head);
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: var(--s-2);
}
.pro-panel .hero-cta { margin-top: var(--s-5); }

.landing-footer {
  text-align: center;
  padding: var(--s-8) 0 var(--s-4);
  color: var(--fg-muted);
  font-size: 0.875rem;
}
.landing-footer p + p { margin-top: var(--s-2); }
