/* ==========================================================================
   Astrology app design system
   Tokens -> base -> layout -> components -> charts -> print.
   Dark mode is chosen by <html data-theme="dark"> (see js/theme.js), which follows
   the OS unless the user picked Dark or Light; only the tokens change.
   ========================================================================== */

:root {
  color-scheme: light;

  /* surfaces and text */
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #1e293b;
  --text-strong: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  /* brand and semantic colours; *-soft are tinted backgrounds, *-ink their text */
  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-soft: #fef3c7;
  --primary-ink: #92400e;
  --info: #0284c7;
  --info-hover: #0369a1;
  --info-soft: #e0f2fe;
  --info-ink: #075985;
  --success: #16a34a;
  --success-hover: #15803d;
  --success-soft: #dcfce7;
  --success-ink: #166534;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fee2e2;
  --danger-ink: #991b1b;
  --whatsapp: #25d366;
  --whatsapp-hover: #1ea952;
  --on-color: #ffffff;
  --highlight: #ffe37f;
  --highlight-ink: #422006;

  /* shape and depth */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 28px rgba(15, 23, 42, 0.18);
  --focus-ring: 0 0 0 3px rgba(217, 119, 6, 0.35);
  --overlay: rgba(15, 23, 42, 0.55);

  /* type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* charts */
  --chart-bg: #fffdfa;
  --chart-frame: #b45309;
  --chart-line: #d97706;
  --chart-text: #78350f;
  --chart-sign: #92400e;
  --chart-planet: #dc2626;
  --chart-lagna: #d97706;
  --chart-center-bg: #fef3c7;
  --chart-hover: rgba(217, 119, 6, 0.08);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #1e293b;
  --surface-2: #162032;
  --surface-3: #334155;
  --border: #334155;
  --border-strong: #475569;
  --text: #e2e8f0;
  --text-strong: #f8fafc;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-soft: #451a03;
  --primary-ink: #fcd34d;
  --info: #0ea5e9;
  --info-hover: #0284c7;
  --info-soft: #082f49;
  --info-ink: #7dd3fc;
  --success: #22c55e;
  --success-hover: #16a34a;
  --success-soft: #052e16;
  --success-ink: #86efac;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-soft: #450a0a;
  --danger-ink: #fca5a5;
  --highlight: #78350f;
  --highlight-ink: #fef3c7;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.6);
  --focus-ring: 0 0 0 3px rgba(245, 158, 11, 0.45);

  --chart-bg: #162032;
  --chart-frame: #d97706;
  --chart-line: #b45309;
  --chart-text: #fbbf24;
  --chart-sign: #f59e0b;
  --chart-planet: #f87171;
  --chart-lagna: #fbbf24;
  --chart-center-bg: #451a03;
  --chart-hover: rgba(245, 158, 11, 0.12);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0 auto;
  max-width: 1100px;
  padding: 20px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3, h4 { color: var(--text-strong); line-height: 1.25; margin: 0 0 12px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; margin-top: 18px; }
p { margin: 0 0 12px; }
a { color: var(--info); }
code { font-family: var(--font-mono); font-size: 0.92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- layout ---------- */
.container {
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.container + .container { margin-top: 16px; }
.container-flush { padding: 0; box-shadow: none; background: transparent; }

.page-narrow { max-width: 480px; margin: 40px auto; }
.page-medium { max-width: 540px; margin: 30px auto; }
.page-wide { max-width: 960px; margin: 30px auto; }

.stack > * + * { margin-top: 12px; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.cluster-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.mono { font-family: var(--font-mono); }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }

/* ---------- forms ---------- */
.form-group { margin-bottom: 14px; }
.form-subtitle { color: var(--text-muted); font-size: 13px; margin: -6px 0 18px; }
.form-hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

label { display: block; font-weight: 600; font-size: 13px; color: var(--text-strong); margin-bottom: 5px; }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus-ring); }
textarea { resize: vertical; }
select option { background: var(--surface); color: var(--text); }
input[type="checkbox"], input[type="radio"] { width: auto; }

/* responsive field grid: fields wrap instead of squeezing on narrow screens */
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 16px; }
.row .col-2 { grid-column: span 2; }
@media (max-width: 520px) { .row .col-2 { grid-column: auto; } }

.autocomplete { position: relative; }
.autocomplete-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 1000;
  max-height: 220px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.autocomplete-results:empty { display: none; }
.autocomplete-item { padding: 9px 11px; cursor: pointer; border-bottom: 1px solid var(--border); }
.autocomplete-item:last-child { border-bottom: 0; }
.autocomplete-item:hover { background: var(--surface-3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; min-height: 40px;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; white-space: nowrap;
  color: var(--on-color); background: var(--text-muted);
  border: 1px solid transparent; border-radius: var(--radius);
  cursor: pointer; user-select: none;
  transition: background-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.btn:hover { filter: brightness(0.93); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.btn-primary { background: var(--primary); }
.btn-info { background: var(--info); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-whatsapp { background: var(--whatsapp); }
.btn-dark { background: var(--text-strong); color: var(--bg); }
.btn-secondary { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); filter: none; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-3); filter: none; }

.btn-sm { padding: 5px 12px; min-height: 30px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-lg { padding: 12px 22px; min-height: 46px; font-size: 16px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 6px 10px; min-width: 34px; font-size: 20px; line-height: 1; background: transparent; color: var(--text-muted); }

.btn-google { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-google:hover { background: var(--surface-3); filter: none; }

/* ---------- navigation ---------- */
.navbar-container { padding: 12px 16px; margin-bottom: 16px; }
.navbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.navbar .spacer { margin-left: auto; }
@media (max-width: 640px) { .navbar .spacer { margin-left: 0; } }

/* sub-navigation: chips for choosing which divisional chart to load */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--text); background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px;
  cursor: pointer; transition: background-color 0.15s, border-color 0.15s;
}
.chip:hover { border-color: var(--primary); }
.chip:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.chip.htmx-request, .chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-color); }
.chip-accent { background: var(--primary-soft); color: var(--primary-ink); border-color: var(--primary); }

/* ---------- cards, badges, alerts ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.card-lg { box-shadow: var(--shadow); }
.card-dashed { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 18px; }

.badge-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; background: var(--surface-3); color: var(--text-muted); }
.badge-pill.is-primary { background: var(--primary-soft); color: var(--primary-ink); }
.badge-pill.is-success { background: var(--success-soft); color: var(--success-ink); }
.badge-pill.is-warn { background: var(--primary-soft); color: var(--primary-ink); }
.badge-pill.is-danger { background: var(--danger-soft); color: var(--danger-ink); }

.alert { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; }
.alert-info { background: var(--info-soft); color: var(--info-ink); border-color: var(--info); }
.alert-success { background: var(--success-soft); color: var(--success-ink); border-color: var(--success); }
.alert-danger { background: var(--danger-soft); color: var(--danger-ink); border-color: var(--danger); }

.poll-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }
.dot-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .dot-pulse { animation: none; } }

/* htmx request feedback */
.htmx-request.btn, .htmx-request .btn[type="submit"] { opacity: 0.7; pointer-events: none; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--overlay); }
.modal[hidden] { display: none !important; }
.modal-panel { width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 24px; background: var(--surface); color: var(--text); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); }
.table-wrap table { margin-top: 0; border: 0; }
table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; color: var(--text); }
th, td { padding: 7px 9px; text-align: left; border: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-3); color: var(--text-strong); font-weight: 600; white-space: nowrap; }
tbody tr:nth-child(even) { background: var(--surface-2); }
tbody tr:hover { background: var(--chart-hover); }
.table-wrap th, .table-wrap td { border-top: 0; }
.table-wrap th:first-child, .table-wrap td:first-child { border-left: 0; }
.table-wrap th:last-child, .table-wrap td:last-child { border-right: 0; }
.table-center th, .table-center td { text-align: center; }

.retro { color: var(--danger); font-weight: 700; }
.highlight-sub { color: var(--primary-hover); }
.highlight-day { color: var(--primary); }
:root[data-theme="dark"] .highlight-sub { color: #fbbf24; }

/* key/value summary used above charts */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; margin: 0 0 16px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kv > div { display: flex; gap: 10px; padding: 8px 12px; background: var(--surface); }
.kv dt { flex: 0 0 8.5em; margin: 0; font-weight: 600; color: var(--text-muted); font-size: 13px; }
.kv dd { margin: 0; font-size: 13.5px; color: var(--text-strong); overflow-wrap: anywhere; }

/* ---------- results ---------- */
.results-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.results-head h3 { margin: 0; }

.letterhead { margin-bottom: 16px; padding: 14px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text); }
.letterhead-grid { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
.letterhead-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--primary-ink); font-weight: 700; margin-bottom: 2px; }
.letterhead-name { font-size: 16px; font-weight: 800; color: var(--text-strong); }
.letterhead-address { font-size: 12px; color: var(--text-muted); margin-top: 4px; white-space: pre-line; max-width: 480px; }
.letterhead-contact { font-size: 12px; min-width: 200px; text-align: right; }
.letterhead-contact > div + div { margin-top: 3px; }
@media (max-width: 520px) { .letterhead-contact { text-align: left; min-width: 0; } }

.chart-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; margin-top: 18px; }
.chart-layout > .data-box { flex: 1 1 340px; min-width: 0; }
.multi-chart-wrapper { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-around; width: 100%; margin-top: 16px; }
.chart-column { flex: 1 1 320px; max-width: 460px; min-width: 0; }
.chart-box { flex: 1 1 320px; min-width: 0; max-width: 460px; }
.chart-box > h4, .chart-column h4 { margin: 0 0 8px; font-size: 14px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; }

/* ---------- charts ---------- */
/* North Indian (diamond) */
svg.north-chart { display: block; width: 100%; height: auto; background: var(--chart-bg); border: 2px solid var(--chart-frame); border-radius: var(--radius); }
.chart-line { stroke: var(--chart-line); stroke-width: 1.5; fill: none; }
.chart-text { font-size: 13px; font-weight: 700; fill: var(--chart-text); text-anchor: middle; dominant-baseline: middle; }
.sign-num { font-size: 12px; font-weight: 700; fill: var(--chart-sign); }
.planet-text { font-size: 11px; font-weight: 700; fill: var(--chart-planet); }
svg.north-chart text { paint-order: stroke; }

/* South Indian (grid) */
.south-chart {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr);
  width: 100%; aspect-ratio: 1 / 1;
  background: var(--chart-bg); border: 2px solid var(--chart-frame); border-radius: var(--radius); overflow: hidden;
}
.south-box { position: relative; min-width: 0; padding: 4px 5px; font-size: clamp(9px, 1.6vw, 12px); color: var(--text); border: 1px solid var(--chart-line); overflow: hidden; transition: background-color 0.15s; }
.south-box:hover { background: var(--chart-hover); }
.south-center { grid-column: 2 / 4; grid-row: 2 / 4; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-weight: 700; color: var(--chart-text); background: var(--chart-center-bg); border: 1px solid var(--chart-line); }
.sign-title { display: block; font-size: clamp(8px, 1.3vw, 10px); font-weight: 700; color: var(--chart-sign); }
.house-tag { margin-top: 2px; font-weight: 700; color: var(--chart-lagna); }
.planet-tag { color: var(--chart-planet); font-weight: 700; }
.lagna-tag { color: var(--chart-lagna); font-weight: 700; }
.lagna-tag.small, .planet-tag.small { font-size: 10px; }
.planet-tag.inline { display: inline-block; margin-right: 3px; }

/* ---------- pricing, checkout, auth gates ---------- */
.gate-icon { font-size: 40px; margin-bottom: 8px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 22px 0; color: var(--text-faint); font-size: 12px; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 20px; }
.plan { display: flex; flex-direction: column; justify-content: space-between; transition: transform 0.15s, box-shadow 0.15s; }
.plan:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.plan-price { font-size: 28px; font-weight: 800; color: var(--text-strong); }
.plan-price.is-free { color: var(--success); }
.feature-list { list-style: none; padding: 0; margin: 0 0 20px; font-size: 13px; }
.feature-list li { display: flex; gap: 8px; margin-bottom: 6px; }
.feature-list li::before { content: "✓"; color: var(--success); font-weight: 700; }

.summary-box { padding: 12px 16px; margin-bottom: 20px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; }
.summary-row + .summary-row { margin-top: 6px; }
.summary-row > :first-child { color: var(--text-muted); }
.qr-box { display: inline-block; padding: 12px; background: #ffffff; border: 2px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.qr-box img { display: block; width: 240px; height: 240px; max-width: 100%; }

/* ---------- print ----------
   The page is not meant to be printed from the browser: documents are generated
   on the server and sent by email or WhatsApp. Printing shows only a notice. */
@media print {
  html { background: #fff !important; }
  body { display: none !important; }
  html::before {
    content: "Printing is disabled. Use Send Document to get a copy.";
    display: block; padding: 25mm 15mm; font: 14pt/1.5 var(--font); color: #000;
  }
  html[data-print-message]::before { content: attr(data-print-message); }
}

/* result containers loaded by htmx below their forms */
#results-container, #horary-results-container, #nakshatra-times-results-container { margin-top: 24px; }
.section { margin-top: 24px; }

/* ---------- Sudarshan Chakra ---------- */
:root {
  --pl-sun: #dc2626; --pl-moon: #0f172a; --pl-mars: #b91c1c; --pl-mercury: #15803d; --pl-jupiter: #c2410c;
  --pl-venus: #a21caf; --pl-saturn: #1d4ed8; --pl-rahu: #475569; --pl-ketu: #78350f; --pl-lagna: #b45309; --pl-other: #475569;
  --ring-outer: #c2410c; --ring-middle: #b91c1c; --ring-inner: #1d4ed8;
  --sc-fill: #fefce8; --sc-hub: #fffef5; --sc-line: #1e293b; --sc-tile: #ffffff;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --pl-sun: #f87171; --pl-moon: #e2e8f0; --pl-mars: #fb7185; --pl-mercury: #4ade80; --pl-jupiter: #fb923c;
  --pl-venus: #e879f9; --pl-saturn: #60a5fa; --pl-rahu: #cbd5e1; --pl-ketu: #e0b88c; --pl-lagna: #fbbf24; --pl-other: #cbd5e1;
  --ring-outer: #fb923c; --ring-middle: #f87171; --ring-inner: #60a5fa;
  --sc-fill: #1b2740; --sc-hub: #243350; --sc-line: #64748b; --sc-tile: #1e293b;
}
.pl-sun { fill: var(--pl-sun); color: var(--pl-sun); }
.pl-moon { fill: var(--pl-moon); color: var(--pl-moon); }
.pl-mars { fill: var(--pl-mars); color: var(--pl-mars); }
.pl-mercury { fill: var(--pl-mercury); color: var(--pl-mercury); }
.pl-jupiter { fill: var(--pl-jupiter); color: var(--pl-jupiter); }
.pl-venus { fill: var(--pl-venus); color: var(--pl-venus); }
.pl-saturn { fill: var(--pl-saturn); color: var(--pl-saturn); }
.pl-rahu { fill: var(--pl-rahu); color: var(--pl-rahu); }
.pl-ketu { fill: var(--pl-ketu); color: var(--pl-ketu); }
.pl-lagna { fill: var(--pl-lagna); color: var(--pl-lagna); }
.pl-other { fill: var(--pl-other); color: var(--pl-other); }

.sudarshan-svg { display: block; width: 100%; max-width: 650px; height: auto; margin: 0 auto; user-select: none; font-family: var(--font); }
.sc-disc { fill: var(--sc-fill); stroke: var(--sc-line); stroke-width: 1.8; }
.sc-disc-outer { stroke-width: 2.5; }
.sc-hub { fill: var(--sc-hub); stroke-width: 2.5; }
.sc-spoke { stroke: var(--sc-line); stroke-width: 1.5; }
.sc-om { text-anchor: middle; dominant-baseline: central; font-weight: 900; fill: var(--chart-planet); font-family: "Noto Sans Devanagari", "Devanagari MT", "Mangal", serif; }
.sc-num { text-anchor: middle; dominant-baseline: central; font-size: 13px; font-weight: 700; fill: var(--text-strong); }
/* a halo in the ring colour keeps letters readable where they cross a divider */
.sc-pl { text-anchor: middle; dominant-baseline: central; font-weight: 800; stroke: var(--sc-fill); stroke-width: 3px; paint-order: stroke; stroke-linejoin: round; }
.sc-frame { fill: var(--chart-bg); stroke: var(--chart-frame); stroke-width: 3; }
.sc-sq-line { stroke: var(--chart-line); stroke-width: 2; }
.sc-tile { fill: var(--sc-tile); fill-opacity: 0.92; stroke: var(--border-strong); stroke-width: 1; }
.sc-tier { text-anchor: middle; font-size: 10.5px; font-weight: 700; }
.sc-deg { text-anchor: middle; dominant-baseline: central; font-size: 9.5px; font-weight: 600; fill: var(--text-muted); stroke: var(--sc-fill); stroke-width: 2.5px; paint-order: stroke; stroke-linejoin: round; }
.sc-tier-outer { fill: var(--ring-outer); }
.sc-tier-middle { fill: var(--ring-middle); }
.sc-tier-inner { fill: var(--ring-inner); }

.sudarshan .sc-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 16px; padding-bottom: 16px; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.sudarshan .sc-title { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.sudarshan .sc-title h3 { margin: 0; font-size: 20px; }
.sc-rings { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.sc-rings b { font-weight: 700; }
.ring-outer { color: var(--ring-outer); } .ring-middle { color: var(--ring-middle); } .ring-inner { color: var(--ring-inner); }
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--radius); }
.segmented .seg { padding: 6px 12px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-muted); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.segmented .seg:hover { color: var(--text-strong); }
.segmented .seg[aria-pressed="true"] { background: var(--info); color: var(--on-color); box-shadow: var(--shadow-sm); }
.segmented.is-lang .seg[aria-pressed="true"] { background: var(--success); }
.sc-charts { display: flex; flex-wrap: wrap; gap: 24px; justify-content: center; align-items: flex-start; }
.sc-box { flex: 1 1 340px; max-width: 620px; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.sc-box[hidden] { display: none !important; }
.sc-box-title { margin-bottom: 10px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.sc-lang { width: 100%; }
.sc-legend { margin-top: 24px; padding: 14px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.sc-legend-items { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.sc-legend-abbr { font-weight: 800; margin-right: 4px; }
.sc-legend-abbr.pl-moon, .sc-legend-abbr.pl-rahu { text-shadow: none; }

/* ---------- dropdown menu ---------- */
.menu { position: relative; display: inline-block; }
.menu-name { display: inline-block; max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 1500; min-width: 230px; padding: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.menu-panel[hidden] { display: none !important; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 10px;
  font: inherit; font-size: 14px; text-align: left; text-decoration: none; color: var(--text);
  background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item[aria-checked="true"]::after { content: "✓"; font-weight: 700; color: var(--primary); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.menu-label { padding: 4px 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); }

/* a submenu opens beside its parent item; the menu sits at the right edge, so it opens to the left */
.menu-sub { position: relative; }
.menu-sub > .menu-item { justify-content: flex-start; }
.menu-grow { flex: 1; }
.menu-subpanel { top: -7px; right: calc(100% + 6px); min-width: 170px; }
@media (max-width: 520px) {
  /* no room beside the parent on a phone: expand underneath */
  .menu-subpanel { position: static; min-width: 0; margin: 2px 0 2px 14px; padding: 0; border: 0; box-shadow: none; background: transparent; }
}

/* ---------- dialog ---------- */
.dialog { width: min(480px, calc(100vw - 32px)); max-height: 90vh; padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: var(--overlay); }
.dialog-panel { padding: 24px; }
.choice-row { display: flex; gap: 10px; margin-bottom: 14px; }
.choice { display: flex; align-items: center; gap: 8px; flex: 1; padding: 10px 12px; font-weight: 600; font-size: 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; margin: 0; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.choice.is-disabled { opacity: 0.55; cursor: not-allowed; }
.choice input { width: auto; }
