/* ==========================================================================
   AyurSutra design system
   A warm, editorial take on a clinic product: cream paper, deep forest
   green, terracotta and saffron. Serif display (Fraunces), UI sans (Inter).
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
  /* palette */
  --paper:        #f6f1e5;
  --paper-deep:   #efe7d4;
  --surface:      #fffdf7;
  --surface-2:    #faf5e9;
  --ink:          #26301f;
  --text:         #2d3826;
  --text-soft:    #5a6551;
  --muted:        #828a74;
  --line:         #e3dac2;
  --line-strong:  #d3c8a9;

  --brand:        #2e5b44;
  --brand-deep:   #1f4033;
  --brand-soft:   #e4ede2;
  --brand-bright: #7fb694;

  --saffron:      #d19426;
  --saffron-deep: #b47a15;
  --saffron-soft: #f7ead0;

  --terra:        #b55238;
  --terra-soft:   #f3ded6;

  --ok:           #3f7d4e;
  --ok-soft:      #e2efdf;
  --warn:         #b97f16;
  --warn-soft:    #f9edd2;
  --danger:       #a83a2e;
  --danger-soft:  #f6ddd8;
  --info:         #56789b;
  --info-soft:    #e2eaf1;

  /* doshas */
  --vata:  #6f8fb8;
  --pitta: #c46a3a;
  --kapha: #5c8a5e;

  /* type */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  /* motion — strong custom curves (per design-engineering guidance) */
  --ease-out:    cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  /* geometry */
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(38, 48, 31, .06), 0 1px 6px rgba(38, 48, 31, .05);
  --shadow:    0 2px 6px rgba(38, 48, 31, .07), 0 12px 32px -12px rgba(38, 48, 31, .18);
  --shadow-lg: 0 4px 10px rgba(38, 48, 31, .08), 0 24px 60px -16px rgba(38, 48, 31, .25);

  --header-h: 64px;
}

[data-theme="dark"] {
  --paper:       #131a14;
  --paper-deep:  #0f150f;
  --surface:     #1b241c;
  --surface-2:   #212b22;
  --ink:         #ece7d7;
  --text:        #dcd7c6;
  --text-soft:   #a9ae9b;
  --muted:       #7e8570;
  --line:        #2d382d;
  --line-strong: #3c483b;

  --brand:        #8ec3a1;
  --brand-deep:   #163024;
  --brand-soft:   #223528;
  --brand-bright: #9fd4b0;

  --saffron:      #e0a83f;
  --saffron-soft: #3a301a;
  --terra:        #d3765a;
  --terra-soft:   #3c2a22;
  --ok-soft:      #243a28;
  --warn-soft:    #3a301a;
  --danger-soft:  #3c2420;
  --info-soft:    #243038;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 2px 8px rgba(0, 0, 0, .45), 0 16px 40px -16px rgba(0, 0, 0, .5);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, .5), 0 28px 70px -20px rgba(0, 0, 0, .6);
}

/* ---------- 2. Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.18;
  letter-spacing: -.01em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.15rem; }

:focus-visible {
  outline: 2px solid var(--saffron);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: var(--saffron-soft); color: var(--ink); }

/* ---------- 3. Layout primitives ---------- */
.container { width: min(1160px, 92vw); margin-inline: auto; }
.container--narrow { width: min(760px, 92vw); }
.section { padding-block: 4.5rem; }
.section--tint { background: var(--paper-deep); }

.page {
  max-width: 1180px;
  margin-inline: auto;
  padding: 2rem 3vw 4rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}
.page-head h1 { font-size: 1.75rem; }
.page-head .lede { color: var(--text-soft); max-width: 56ch; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--saffron-deep);
  margin-bottom: .75rem;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 2px;
  background: var(--saffron);
  border-radius: 2px;
}

/* ---------- 4. Public header / footer ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }

.site-nav { display: flex; align-items: center; gap: .25rem; margin-left: .5rem; }
.site-nav a {
  padding: .45rem .8rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-weight: 500;
  font-size: .95rem;
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--brand-deep); background: var(--brand-soft); }
[data-theme="dark"] .site-nav a[aria-current="page"] { color: var(--brand-bright); }

.site-header__actions { margin-left: auto; display: flex; align-items: center; gap: .6rem; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-soft);
  position: relative;
  transition: border-color 120ms ease, color 120ms ease, transform 160ms var(--ease-out);
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); text-decoration: none; }
.icon-btn:active { transform: scale(0.92); }
.icon-btn .badge-dot {
  position: absolute;
  top: -3px; right: -3px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--terra);
  color: #fff;
  font-size: .66rem;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.user-menu { position: relative; }
.user-menu__btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem .75rem .3rem .3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
}
.user-menu__btn:hover { border-color: var(--line-strong); }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--brand-deep);
  color: #f3ead3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  flex: none;
}
.avatar--lg { width: 56px; height: 56px; font-size: 1.05rem; border-radius: 16px; }

.user-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .5rem;
  /* origin-aware: scales in from its trigger at the top right */
  transform-origin: top right;
  opacity: 0;
  transform: scale(0.97) translateY(-4px);
  visibility: hidden;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s linear 180ms;
  z-index: 60;
}
.user-menu.open .user-menu__panel {
  opacity: 1;
  transform: none;
  visibility: visible;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.user-menu__panel .who { padding: .5rem .75rem .65rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }
.user-menu__panel .who strong { display: block; color: var(--ink); }
.user-menu__panel .who span { font-size: .8rem; color: var(--muted); }
.user-menu__panel a, .user-menu__panel button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: .93rem;
  text-align: left;
}
.user-menu__panel a:hover, .user-menu__panel button:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.user-menu__panel form { margin: 0; }
.menu-sep { height: 1px; background: var(--line); margin: .4rem 0; }

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper-deep);
  padding: 3.5rem 0 2.5rem;
  margin-top: 4rem;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 2rem;
}
.site-footer h4 { font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-family: var(--font-body); font-weight: 600; margin-bottom: .9rem; }
.site-footer ul { list-style: none; padding: 0; display: grid; gap: .45rem; }
.site-footer a { color: var(--text-soft); font-size: .93rem; }
.site-footer a:hover { color: var(--brand); }
.site-footer__note { color: var(--muted); font-size: .9rem; max-width: 34ch; }
.site-footer__bottom {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: .85rem;
  flex-wrap: wrap;
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.25;
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--brand-deep); color: #f3ead3; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--brand); color: #fff; }
[data-theme="dark"] .btn--primary { background: var(--brand-bright); color: #14261c; }
.btn--accent { background: var(--saffron); color: #2a2210; }
.btn--accent:hover { background: var(--saffron-deep); color: #fff; }
.btn--ghost { border-color: var(--line-strong); color: var(--text); background: transparent; }
.btn--ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #8f2f24; }
.btn--soft { background: var(--brand-soft); color: var(--brand-deep); }
[data-theme="dark"] .btn--soft { color: var(--brand-bright); }
.btn--soft:hover { filter: brightness(.97); }
.btn--sm { padding: .35rem .8rem; font-size: .85rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ---------- 6. Cards & panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card--pad { padding: 1.5rem; }
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}
.card__head h2, .card__head h3 { font-size: 1.05rem; }
.card__body { padding: 1.5rem; }
.card__body--flush { padding: 0; }
.card__foot { padding: 1rem 1.5rem; border-top: 1px solid var(--line); }

.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--sidebar { grid-template-columns: 260px 1fr; align-items: start; }

/* stat tiles */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--saffron));
  opacity: .7;
}
.stat__value { font-family: var(--font-display); font-size: 1.9rem; color: var(--ink); line-height: 1.1; }
.stat__label { color: var(--text-soft); font-size: .87rem; margin-top: .15rem; }

/* ---------- 7. Badges & pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .18rem .6rem;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .02em;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--green { background: var(--ok-soft); color: var(--ok); }
.badge--saffron { background: var(--saffron-soft); color: var(--saffron-deep); }
.badge--terra { background: var(--terra-soft); color: var(--terra); }
.badge--red { background: var(--danger-soft); color: var(--danger); }
.badge--gray { background: var(--paper-deep); color: var(--text-soft); border-color: var(--line); }
.badge--blue { background: var(--info-soft); color: var(--info); }

.badge--SCHEDULED { background: var(--info-soft); color: var(--info); }
.badge--COMPLETED { background: var(--ok-soft); color: var(--ok); }
.badge--MISSED { background: var(--terra-soft); color: var(--terra); }
.badge--CANCELLED { background: var(--paper-deep); color: var(--muted); }
.badge--ACTIVE { background: var(--ok-soft); color: var(--ok); }
.badge--PLANNED { background: var(--saffron-soft); color: var(--saffron-deep); }
.badge--cat-PRADHANA { background: var(--terra-soft); color: var(--terra); }
.badge--cat-PURVA { background: var(--saffron-soft); color: var(--saffron-deep); }
.badge--cat-PASCHAT { background: var(--brand-soft); color: var(--brand-deep); }
[data-theme="dark"] .badge--cat-PASCHAT { color: var(--brand-bright); }
.badge--cat-SUPPORT { background: var(--info-soft); color: var(--info); }

/* ---------- 8. Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
table.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left;
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  white-space: nowrap;
}
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; }

/* ---------- 9. Forms ---------- */
.form { display: grid; gap: 1.1rem; }
.form--cards { gap: 1.5rem; }

.field { display: grid; gap: .35rem; }
.field label { font-weight: 600; font-size: .92rem; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--muted); }
.field .req { color: var(--terra); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], input[type="time"], input[type="search"],
input[type="url"], select, textarea {
  width: 100%;
  padding: .6rem .85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
textarea { resize: vertical; min-height: 90px; }

.field--check { display: flex; align-items: flex-start; gap: .6rem; }
.field--check input { width: 1.05rem; height: 1.05rem; margin-top: .28rem; accent-color: var(--brand); }
.field--check label { font-weight: 500; }

.field .error, .errorlist {
  color: var(--danger);
  font-size: .84rem;
  list-style: none;
  padding: 0;
  display: grid;
  gap: .15rem;
}
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }

/* radio pill groups (frequency, ratings) */
.pill-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.pill-group label {
  display: inline-flex;
  padding: .42rem .95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .9rem;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
  background: var(--surface);
}
.pill-group input { position: absolute; opacity: 0; pointer-events: none; }
.pill-group label:has(input:checked) {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #f3ead3;
  font-weight: 600;
}
[data-theme="dark"] .pill-group label:has(input:checked) {
  background: var(--brand-bright);
  border-color: var(--brand-bright);
  color: #14261c;
}
.pill-group label:hover { border-color: var(--brand); }

/* radio stack (prakriti answers) */
.choice-stack { display: grid; gap: .45rem; }
.choice-stack label {
  display: flex;
  gap: .65rem;
  align-items: baseline;
  padding: .6rem .85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--surface);
  transition: border-color .12s, background .12s;
  font-weight: 400;
}
.choice-stack label:hover { border-color: var(--brand); }
.choice-stack label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice-stack input { accent-color: var(--brand); }

/* Django RadioSelect rendered as pills */
.radio-pills > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-pills label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: .45rem .9rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.radio-pills label:has(input:checked) {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #f3ead3;
}
[data-theme="dark"] .radio-pills label:has(input:checked) {
  background: var(--brand-bright);
  border-color: var(--brand-bright);
  color: #14261c;
}
.radio-pills label:hover { border-color: var(--brand); }

.formset-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.formset-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* search bar */
.search-bar {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  align-items: center;
}
.search-bar input[type="search"] { max-width: 280px; }
.search-bar select { max-width: 180px; width: auto; }

/* ---------- 10. Messages / toasts ---------- */
.toasts {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  right: 16px;
  z-index: 100;
  display: grid;
  gap: .6rem;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .85rem 1rem;
  font-size: .93rem;
  transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out);
}
@starting-style {
  .toast {
    opacity: 0;
    transform: translateX(16px);
  }
}
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warn); }
.toast--info { border-left-color: var(--info); }
.toast--success { border-left-color: var(--ok); }

/* ---------- 11. Progress & meters ---------- */
.meter { display: grid; gap: .45rem; }
.meter__row { display: grid; grid-template-columns: 64px 1fr 44px; gap: .75rem; align-items: center; font-size: .88rem; }
.meter__track { height: 9px; background: var(--paper-deep); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.meter__fill { height: 100%; border-radius: 999px; }
.meter__fill--vata { background: var(--vata); }
.meter__fill--pitta { background: var(--pitta); }
.meter__fill--kapha { background: var(--kapha); }
.meter__fill--brand { background: linear-gradient(90deg, var(--brand), var(--brand-bright)); }
.meter__value { text-align: right; color: var(--text-soft); font-variant-numeric: tabular-nums; }

.progress-line { height: 7px; background: var(--paper-deep); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.progress-line__fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--saffron)); border-radius: 999px; }

/* ---------- 12. Calendar ---------- */
.calendar { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.calendar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.calendar__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar__dow {
  padding: .5rem .5rem;
  text-align: center;
  font-size: .72rem;
  font-weight: 650;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.calendar__cell {
  min-height: 108px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: .4rem;
  font-size: .8rem;
}
.calendar__cell:nth-child(7n) { border-right: 0; }
.calendar__cell--out { background: var(--paper-deep); opacity: .6; }
.calendar__cell--today .calendar__date {
  background: var(--brand-deep);
  color: #f3ead3;
}
.calendar__date {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: .3rem;
}
.calendar__event {
  display: block;
  max-width: 100%;
  padding: .22rem .45rem;
  margin-bottom: .25rem;
  border-radius: 7px;
  font-size: .74rem;
  line-height: 1.35;
  background: var(--brand-soft);
  color: var(--brand-deep);
  border-left: 3px solid var(--brand);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-theme="dark"] .calendar__event { color: var(--brand-bright); }
.calendar__event--done { background: var(--ok-soft); border-left-color: var(--ok); color: var(--ok); }
.calendar__event--missed { background: var(--terra-soft); border-left-color: var(--terra); color: var(--terra); }
.calendar__event--cancelled { background: var(--paper-deep); border-left-color: var(--muted); color: var(--muted); text-decoration: line-through; }
.calendar__more { font-size: .72rem; color: var(--muted); padding-left: .45rem; }

/* ---------- 13. Charts (SVG, server-rendered) ---------- */
.chart { width: 100%; height: auto; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .bar-brand { fill: var(--brand); }
.chart .bar-saffron { fill: var(--saffron); }
.chart .bar-terra { fill: var(--terra); }
.chart .line-series { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .dot { fill: var(--saffron); }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .value-text { fill: var(--text-soft); font-weight: 600; }

/* ---------- 14. Hero (landing) ---------- */
.hero {
  position: relative;
  padding: 5.5rem 0 4.5rem;
  overflow: hidden;
}
.hero__rings {
  position: absolute;
  top: -140px;
  right: -140px;
  width: 560px;
  height: 560px;
  opacity: .5;
  pointer-events: none;
}
[data-theme="dark"] .hero__rings { opacity: .25; }
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 3.5rem; align-items: center; }
.hero h1 { margin: .5rem 0 1.1rem; }
.hero h1 em { font-style: italic; color: var(--brand); }
.hero__sub { font-size: 1.08rem; color: var(--text-soft); max-width: 52ch; margin-bottom: 1.8rem; }
.hero__actions { display: flex; gap: .8rem; flex-wrap: wrap; }
.hero__stats { display: flex; gap: 2.2rem; margin-top: 2.6rem; flex-wrap: wrap; }
.hero__stat strong { font-family: var(--font-display); font-size: 1.55rem; color: var(--ink); display: block; line-height: 1.1; }
.hero__stat span { color: var(--muted); font-size: .85rem; }

/* floating schedule card in hero */
.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem;
  max-width: 380px;
  transform: rotate(1.2deg);
  position: relative;
}
.hero-card::before {
  content: "";
  position: absolute;
  inset: -10px -10px auto auto;
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--saffron-soft);
  z-index: -1;
}
.hero-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px dashed var(--line);
}
.hero-card__row:last-child { border-bottom: 0; }
.hero-card__row .t { font-weight: 600; color: var(--ink); font-size: .93rem; }
.hero-card__row .s { color: var(--muted); font-size: .8rem; }
.hero-card__title {
  font-size: .78rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--saffron-deep);
  margin-bottom: .5rem;
}

/* therapy cards */
.therapy-card {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  color: inherit;
  height: 100%;
}
.therapy-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
  text-decoration: none;
}
.therapy-card h3 { font-size: 1.18rem; }
.therapy-card .sanskrit { font-style: italic; color: var(--saffron-deep); font-size: .9rem; }
.therapy-card p { color: var(--text-soft); font-size: .92rem; flex: 1; }
.therapy-card__meta { display: flex; gap: .5rem; flex-wrap: wrap; }
.therapy-card .badge:first-child { align-self: flex-start; }

/* steps */
.steps { counter-reset: step; }
.steps-grid { counter-reset: step; }
.step { position: relative; padding-left: 3.4rem; padding-bottom: 1.6rem; }
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0; top: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--saffron-deep);
  border: 1px solid var(--saffron);
  background: var(--saffron-soft);
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step::after {
  content: "";
  position: absolute;
  left: 1.24rem;
  top: 2.7rem;
  bottom: .1rem;
  width: 1px;
  background: var(--line-strong);
}
.step:last-child::after { display: none; }
.steps-grid .step::after { display: none; }
.step h3 { margin-bottom: .25rem; }
.step p { color: var(--text-soft); font-size: .95rem; max-width: 52ch; }

/* split feature rows */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.split__list { list-style: none; padding: 0; display: grid; gap: .8rem; margin-top: 1.4rem; }
.split__list li { display: flex; gap: .7rem; align-items: baseline; color: var(--text-soft); }
.split__list li::before {
  content: "✓";
  color: var(--ok);
  font-weight: 700;
  flex: none;
}

/* quote */
.quote {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  font-style: italic;
  color: var(--ink);
  max-width: 30ch;
  line-height: 1.4;
}
.quote-block { border-left: 3px solid var(--saffron); padding-left: 1.5rem; }
.quote-block cite { display: block; margin-top: 1rem; font-style: normal; font-family: var(--font-body); font-size: .9rem; color: var(--muted); }

/* CTA band */
.cta-band {
  background: linear-gradient(135deg, var(--brand-deep), #274a3a 55%, #6d5426);
  color: #f3ead3;
  border-radius: var(--radius-lg);
  padding: 3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { color: #f9f4e6; }
.cta-band p { color: #d8d2ba; max-width: 48ch; margin-top: .4rem; }

/* ---------- 15. Auth pages ---------- */
.auth-wrap {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  place-items: center;
  padding: 3rem 4vw;
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--saffron-soft), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--brand-soft), transparent 55%);
}
.auth-card { width: min(480px, 100%); }
.auth-card .card--pad { padding: 2.25rem; }
.auth-side { text-align: center; margin-top: 1.5rem; color: var(--text-soft); font-size: .93rem; }
.auth-side a { font-weight: 600; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 1.25rem; }
.auth-logo img { width: 52px; height: 52px; border-radius: 14px; }

/* ---------- 16. App shell (sidebar) ---------- */
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - var(--header-h)); }
.app-side {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 1.5rem 1rem;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
.app-side__group { margin-bottom: 1.5rem; }
.app-side__label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 .7rem .5rem;
}
.app-side a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-weight: 500;
  font-size: .94rem;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}
.app-side a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.app-side a.active {
  background: var(--brand-soft);
  color: var(--brand-deep);
  border-left-color: var(--saffron);
  font-weight: 600;
}
[data-theme="dark"] .app-side a.active { color: var(--brand-bright); }
.app-side a svg { width: 17px; height: 17px; flex: none; opacity: .8; }

.app-main { padding: 2rem 3vw 4rem; min-width: 0; }

/* ---------- 17. Misc widgets ---------- */
.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}
.empty svg { width: 54px; height: 54px; margin: 0 auto 1rem; opacity: .45; }
.empty h3 { color: var(--text-soft); margin-bottom: .3rem; }

.pagination { display: flex; gap: .35rem; justify-content: center; margin-top: 1.75rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: .38rem .8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .9rem;
  color: var(--text-soft);
  background: var(--surface);
}
.pagination .current { background: var(--brand-deep); color: #f3ead3; border-color: var(--brand-deep); font-weight: 600; }
.pagination a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

.session-chip {
  display: flex;
  gap: .9rem;
  align-items: center;
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .12s;
}
.session-chip:hover { border-color: var(--line-strong); }
.session-chip__time {
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  color: var(--ink);
  font-size: .95rem;
  width: 88px;
  flex: none;
}
.session-chip__body { flex: 1; min-width: 0; }
.session-chip__body .t { font-weight: 600; color: var(--ink); }
.session-chip__body .s { color: var(--muted); font-size: .82rem; }

.stars { color: var(--saffron); letter-spacing: .1em; font-size: .95rem; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1.2rem; font-size: .93rem; }
.kv dt { color: var(--muted); }
.kv dd { color: var(--text); font-weight: 500; margin: 0; }

.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; }

.breadcrumb { display: flex; gap: .45rem; align-items: center; font-size: .85rem; color: var(--muted); margin-bottom: .9rem; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { opacity: .5; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip-filter {
  padding: .35rem .85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}
.chip-filter:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.chip-filter.active { background: var(--brand-deep); border-color: var(--brand-deep); color: #f3ead3; }
[data-theme="dark"] .chip-filter.active { background: var(--brand-bright); color: #14261c; }

/* checklist */
.checklist { list-style: none; padding: 0; display: grid; gap: .5rem; }
.checklist li { display: flex; gap: .6rem; align-items: baseline; }
.checklist .done { color: var(--ok); font-weight: 700; }
.checklist .todo { color: var(--muted); }

.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 1.2rem 2rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: 0; top: 5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--brand);
}
.timeline li.bad::before { border-color: var(--terra); }
.timeline .when { font-size: .78rem; color: var(--muted); }
.timeline .what { color: var(--text); }

/* ---------- 18. Responsive ---------- */
@media (max-width: 1020px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero-card { transform: none; margin-top: .5rem; }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; gap: 2rem; }
  .app-shell { grid-template-columns: 1fr; }
  .app-side {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: .25rem;
    overflow-x: auto;
    padding: .75rem 3vw;
  }
  .app-side__group { display: flex; gap: .25rem; margin: 0; }
  .app-side__label { display: none; }
  .app-side a { white-space: nowrap; border-left: 0; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .grid--2, .grid--3 { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .section { padding-block: 3rem; }
  .formset-grid-2, .formset-grid-3 { grid-template-columns: 1fr; }
  .calendar__cell { min-height: 74px; }
  .calendar__event span.ev-who { display: none; }
  .page { padding: 1.25rem 4vw 3rem; }
  .session-chip { flex-wrap: wrap; }
  .session-chip__time { width: auto; }
  .site-footer__grid { grid-template-columns: 1fr; }
}

/* ---------- 19. Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* gentle load stagger for stat tiles (decorative, short, reduced-motion safe) */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.page .stat { animation: rise 380ms var(--ease-out) backwards; }
.page .stat:nth-child(2) { animation-delay: 50ms; }
.page .stat:nth-child(3) { animation-delay: 100ms; }
.page .stat:nth-child(4) { animation-delay: 150ms; }

/* hover lifts only where a real pointer exists */
@media (hover: hover) and (pointer: fine) {
  .therapy-card:hover { transform: translateY(-3px); }
  .btn:hover { transform: translateY(-1px); }
}

/* ---------- 20. AyurBot chat ---------- */
.chat { display: flex; flex-direction: column; height: min(62vh, 560px); overflow: hidden; }
.chat__log {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.chat__msg {
  max-width: 78%;
  padding: .6rem .9rem;
  border-radius: 14px;
  font-size: .94rem;
  line-height: 1.5;
}
.chat__msg--bot {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat__msg--user {
  align-self: flex-end;
  background: var(--brand-deep);
  color: #f3ead3;
  border-bottom-right-radius: 4px;
}
[data-theme="dark"] .chat__msg--user { background: var(--brand-bright); color: #14261c; }
.chat__chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chat__form {
  display: flex;
  gap: .6rem;
  padding: .85rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.chat__form input { flex: 1; }

/* ---------- 21. Print (prescription sheet) ---------- */
@media print {
  .site-header, .site-footer, .toasts, .btn-row, .no-print { display: none !important; }
  body { background: #fff; color: #111; font-size: 12px; }
  main { padding: 0; }
  .page { max-width: none; padding: 0; }
}
.print-sheet { max-width: 800px; margin-inline: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 2.25rem; box-shadow: var(--shadow-sm); }
@media print { .print-sheet { border: 0; box-shadow: none; padding: 0; max-width: none; } }
.print-sheet__head { display: flex; gap: 1.25rem; align-items: flex-start; border-bottom: 2px solid var(--brand-deep); padding-bottom: 1rem; margin-bottom: 1.25rem; }
.print-sheet__head img { border-radius: 10px; }
.print-sheet__head h1 { font-size: 1.35rem; }
.print-sheet__head p { font-size: .78rem; color: var(--text-soft); margin-top: .2rem; }
.print-sheet__meta { margin-left: auto; font-size: .8rem; text-align: right; }
.print-sheet__meta dt { display: inline; color: var(--muted); }
.print-sheet__meta dt::after { content: " "; }
.print-sheet__meta dd { display: inline; margin: 0 .9rem 0 .25rem; font-weight: 600; }
.print-sheet__section { margin-bottom: 1.4rem; }
.print-sheet__section h2 { font-size: .95rem; margin-bottom: .6rem; }
.print-sheet__section--cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.print-sheet__section ul { padding-left: 1.1rem; margin: 0; display: grid; gap: .25rem; }
.print-sheet__notes { margin-top: .6rem; font-size: .88rem; color: var(--text-soft); }
.print-sheet__foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 2rem; border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1.5rem; font-size: .8rem; color: var(--muted); }
.print-sheet__sign { text-align: center; min-width: 200px; }
.print-sheet__sign span { display: block; border-top: 1px solid var(--text); margin-bottom: .3rem; padding-top: .3rem; color: var(--text-soft); }
.print-sheet__sign p { margin: 0; font-weight: 600; color: var(--text); }
@media print {
  .table th { background: #f3f0e8 !important; color: #333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
