:root {
  --bg: #f5ecd7;           /* royal gold parchment */
  --ink: #3a2418;
  --muted: #8a7350;
  --accent: #7a1f2b;       /* royal maroon */
  --accent-dark: #5e141f;
  --gold: #c8a04a;
  --line: #e3d2a8;
  --card: #fffaf0;         /* warm ivory */
  --warn: #b00020;
  --good: #1d7a46;
  --dstart: #0b6e4f;       /* bottle green (dasha start) */
  --dend: #9c3a1a;         /* brick red (dasha end) */
  --vchart-size: 260px;   /* divisional chart size; adjustable via the workspace slider */
}

* { box-sizing: border-box; }

/* Fluid base typography — the root font size scales smoothly with the viewport,
   so text (and everything sized in rem) stays legible and proportionate on any
   device: ~16px on phones, ~17px on tablets, up to 18px on large desktops. No
   hard jumps between breakpoints. text-size-adjust stops mobile browsers from
   inflating text unexpectedly (e.g. iOS landscape). */
html { font-size: clamp(16px, 15.2px + 0.22vw, 18px); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

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

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 22px; background: #fdf6ea; color: var(--ink);
  border-bottom: 2px solid var(--gold);
}
.topbar .brand { color: var(--accent-dark); font-weight: 700; font-size: 1.5rem; letter-spacing: .3px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brandlogo { height: 60px; width: 60px; border-radius: 50%; background: #fff8ee; padding: 4px; object-fit: contain; display: block; box-shadow: 0 0 0 2px var(--gold); }
.topbar nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
.topbar nav a {
  color: var(--accent); border: 1px solid var(--gold); padding: 6px 15px;
  border-radius: 18px; font-size: .92rem; font-weight: 500; white-space: nowrap;
}
.topbar nav a:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }
.topbar .who { color: var(--muted); font-size: .9rem; white-space: nowrap; }
/* Language picker — tidy label + dropdown grouped together */
.langwrap { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; white-space: nowrap; }
.langlabel { font-size: .82rem; color: var(--muted); white-space: nowrap; }

/* ── Celestial auth pages (login / register) ─────────────────────────── */
.jv-sky { position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background: radial-gradient(1200px 820px at 80% 14%, #fff7e9 0%, #fbeed6 40%, #f3dcbe 72%, #ecd0ad 100%); }
.jv-sky .wheel { position: absolute; top: 50%; right: -200px; transform: translateY(-50%);
  width: 760px; height: 760px; opacity: .12; }
.jv-sky .floaty { position: absolute; color: #7a1f2b; opacity: .07; font-size: 92px; line-height: 1; user-select: none; }
.jv-top { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 38px; align-items: start; padding: 14px 2px 4px; }
.jv-hero h1.brandline { font-family: Georgia, "Iowan Old Style", serif; font-size: 2.7rem; line-height: 1.06; color: #7a1f2b; margin: 4px 0 4px; letter-spacing: .3px; }
.jv-hero h1.brandline span { color: #b5451b; }
.jv-hero .sanskrit { font-size: 1rem; color: #9a6a18; letter-spacing: 2px; margin: 0 0 8px; font-style: italic; }
.jv-hero .lede { font-size: 1.05rem; color: #4a3a2a; max-width: 60ch; line-height: 1.55; margin: 0; }
.jv-rule { height: 2px; background: linear-gradient(90deg, var(--gold), rgba(197,133,13,0)); margin: 8px 0 18px; }
.jv-feats { display: grid; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); gap: 14px; margin: 10px 0 40px; }
.feat { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: start;
  background: rgba(255,255,255,.66); border: 1px solid #e7d3ad; border-radius: 14px; padding: 13px 15px;
  box-shadow: 0 6px 18px -14px rgba(122,31,43,.5); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.feat:hover { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 10px 26px -16px rgba(122,31,43,.6); }
.feat .ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 21px; color: #b5451b; background: radial-gradient(circle at 30% 25%, #fff5e2, #f3dcb8); box-shadow: 0 0 0 2px var(--gold) inset; }
.feat h3 { margin: 1px 0 3px; font-size: .96rem; color: #7a1f2b; font-family: Georgia, serif; }
.feat p { margin: 0; font-size: .82rem; color: #5a4836; line-height: 1.42; }
.jv-card { background: linear-gradient(180deg, #fffdf8, #fdf4e3); border: 1px solid var(--gold); border-radius: 18px; padding: 24px 24px 20px; box-shadow: 0 26px 60px -30px rgba(122,31,43,.55); }
.jv-card h2 { text-align: center; margin: 2px 0 2px; color: #7a1f2b; font-family: Georgia, serif; font-size: 1.45rem; }
.jv-card .sub { text-align: center; color: var(--muted); font-size: .82rem; margin: 0 0 14px; }
.jv-card form label { display: block; margin: 0 0 11px; font-size: .9rem; color: #5a4836; font-weight: 600; }
.jv-card form input { width: 100%; margin-top: 5px; padding: 11px 13px; font-size: 1rem; border: 1px solid #e0c89a; border-radius: 10px; background: #fffdfa; box-sizing: border-box; }
.jv-card form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(181,69,27,.16); }
.jv-card button.primary { width: 100%; margin-top: 4px; padding: 12px; font-size: 1.02rem; border-radius: 10px; }
.jv-card .foot { text-align: center; margin: 13px 0 0; color: var(--muted); font-size: .9rem; }
.jv-card .error { background: #fdecec; border: 1px solid #e7b4b4; color: #9a2b2b; padding: 9px 12px; border-radius: 9px; font-size: .9rem; margin: 0 0 12px; }
.jv-trust { margin: 14px 2px 0; text-align: center; color: #8a6a3a; font-size: .78rem; letter-spacing: .3px; }
/* Plans strip on the auth landing */
.jv-plans { margin: 24px 0 6px; max-width: 580px; background: linear-gradient(180deg, #fffdf8, #fbf0db);
  border: 1px solid var(--gold); border-radius: 16px; padding: 14px 18px 16px; box-shadow: 0 16px 36px -26px rgba(122,31,43,.55); }
.jv-plans-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 11px; }
.jv-plans-head .lbl { font-family: Georgia, serif; color: #7a1f2b; font-size: 1.05rem; font-weight: 700; letter-spacing: .3px; }
.ccy-shown { font-size: .72rem; font-weight: 700; letter-spacing: .04em; color: #8a6a3a; border: 1px solid var(--gold); border-radius: 999px; padding: 3px 11px; background: rgba(255,255,255,.45); }
.jv-plans-row { display: flex; flex-wrap: wrap; gap: 10px; }
.jv-plans .plan { flex: 1 1 120px; min-width: 108px; background: rgba(255,255,255,.72); border: 1px solid #e7d3ad; border-radius: 12px; padding: 10px 12px; text-align: center; }
.jv-plans .plan .nm { display: block; color: #7a1f2b; font-weight: 700; font-size: .8rem; letter-spacing: .2px; }
.jv-plans .plan .px { display: block; color: #b5451b; font-family: Georgia, serif; font-size: 1.4rem; line-height: 1.12; margin: 3px 0 1px; }
.jv-plans .plan .pd { display: block; color: var(--muted); font-size: .74rem; }
.jv-plans .plan.free .px { font-size: 1.15rem; color: #2e7d32; }
.jv-plans .cta { display: block; text-align: center; margin: 13px 0 0; background: linear-gradient(180deg, #b5451b, #8f3414); color: #fff5e6; border-radius: 11px; padding: 11px 16px; font-weight: 600; font-size: .94rem; text-decoration: none; }
.jv-plans .cta:hover { filter: brightness(1.07); text-decoration: none; }
.jv-plans .note { margin: 9px 2px 0; color: var(--muted); font-size: .76rem; text-align: center; }
@media (max-width: 880px) {
  .jv-top { grid-template-columns: 1fr; gap: 22px; }
  .jv-feats { grid-template-columns: 1fr 1fr; }
  .jv-sky .wheel { right: -320px; opacity: .08; }
  .jv-hero h1.brandline { font-size: 2.2rem; }
}
@media (max-width: 520px) { .jv-feats { grid-template-columns: 1fr; } }
.topbar .btn-logout {
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); padding: 5px 14px; border-radius: 20px; font-size: .85rem; font-weight: 600;
}
.topbar .btn-logout:hover { background: var(--accent); color: #fff; }

.container { max-width: 980px; margin: 26px auto; padding: 0 18px; }

.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 30px 0; }
.footlinks { margin-top: 8px; font-size: .78rem; color: var(--muted); }
.footlinks a { color: var(--muted); text-decoration: none; }
.footlinks a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; margin: 0 0 14px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; color: var(--accent-dark); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.card.narrow { max-width: 420px; margin: 40px auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.cards .card { margin-bottom: 0; }

.rowhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

.muted { color: var(--muted); margin: 4px 0; }
.small { font-size: .85rem; }
.big { font-size: 1.4rem; font-weight: 700; margin: 4px 0; }
.right { text-align: right; }
.error { background: #fdecea; color: var(--warn); border: 1px solid #f5c6c2; padding: 8px 12px; border-radius: 7px; }

label { display: block; margin: 10px 0; font-size: .9rem; color: var(--ink); }
input, select {
  display: block; width: 100%; margin-top: 5px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 7px; font-size: 1rem; background: #fff;
}
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.formgrid .wide { grid-column: 1 / -1; }

button { cursor: pointer; font-size: 1rem; color: var(--ink); }
.primary {
  background: var(--accent); color: #fff; border: none; padding: 10px 18px;
  border-radius: 8px; font-weight: 600; display: inline-block;
}
.primary:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.linkbtn { background: none; border: none; color: var(--accent); padding: 0; font-size: .9rem; }
.linkbtn.danger { color: var(--warn); }
/* In the admin users table, render each action as a tidy themed pill button */
.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; white-space: normal; }
.actions-cell .inline { display: inline-flex; margin: 0; }
.actions-cell .linkbtn { border: 1px solid var(--line); background: var(--card); color: var(--accent-dark);
  padding: 4px 11px; border-radius: 14px; font-size: .78rem; line-height: 1.45; cursor: pointer; transition: background .12s, color .12s; }
.actions-cell .linkbtn:hover { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
.actions-cell .linkbtn.danger { color: var(--warn); border-color: #efc8c4; }
.actions-cell .linkbtn.danger:hover { background: var(--warn); color: #fff; border-color: var(--warn); }
.actions-cell .featbox { flex: 1 0 100%; margin-top: 4px; }
.inline { display: inline; }

table.grid { width: 100%; border-collapse: collapse; background: var(--card); }
table.grid th, table.grid td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.grid th { font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
table.grid.compact td, table.grid.compact th { padding: 5px 10px; font-size: .9rem; }
table.grid tr.current { background: #fff3ec; font-weight: 600; }

/* Saved-chart row actions — proper buttons (Open / Edit / Delete) */
.rowacts { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.rowacts .inline { display: inline-flex; margin: 0; }
.btn-sm { display: inline-block; padding: 5px 11px; border: 1px solid var(--accent); color: var(--accent);
  background: var(--card); border-radius: 7px; font-size: .82rem; font-weight: 500; line-height: 1.4;
  cursor: pointer; white-space: nowrap; transition: background .12s ease, color .12s ease; }
.usertable .actions-cell { white-space: nowrap; }

/* Lagna row in the planetary tables + computed-values box on the new-chart form */
table.grid tr.lagna-row { background: #fbeee0; }
table.grid tr.lagna-row td:first-child { color: var(--accent-dark); }
.computed-box { display: flex; flex-wrap: wrap; gap: 16px; align-items: baseline; padding: 8px 13px;
  background: #fbf3e6; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0 6px; }
.computed-box b { color: var(--accent-dark); }

/* Saved-charts table: the action buttons must never wrap; let Place wrap instead. */
#charts-table td:last-child { white-space: nowrap; width: 1%; }
#charts-table td:nth-child(5) { white-space: normal; min-width: 120px; }
.btn-sm:hover { background: var(--accent); color: #fff; text-decoration: none; }
.btn-sm.solid { background: var(--accent); color: #fff; }
.btn-sm.solid:hover { background: var(--accent-dark); color: #fff; }
.btn-sm.danger { border-color: #e0b6ba; color: var(--warn); }
.btn-sm.danger:hover { background: var(--warn); color: #fff; border-color: var(--warn); }

/* Sortable table headers (saved-charts dashboard) */
table.grid th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
table.grid th.sortable:hover { color: var(--accent); }
table.grid th.sortable .car { color: var(--accent); font-size: .8em; }

.tag { display: inline-block; font-size: .72rem; padding: 1px 6px; border-radius: 5px; background: #eee; color: #444; }
.tag.warn { background: #fde2e0; color: var(--warn); }

.actions { display: flex; align-items: center; gap: 18px; }
.saved { color: var(--good); font-weight: 600; }

@media (max-width: 620px) {
  .formgrid { grid-template-columns: 1fr; }
}

/* ---- Chart workspace ---- */
.actionbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.ghost { background: #fff; border: 1px solid var(--accent); color: var(--accent); padding: 7px 12px; border-radius: 7px; }
.ghost:hover { background: var(--accent); color: #fff; }

/* Tabs are a wrapping set of chips: every tab is visible on any width,
   flowing onto as many tidy rows as needed (no sideways scrolling). */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 18px; }
.tab { background: var(--card); border: 1px solid var(--line); padding: 8px 14px; font-size: .9rem;
       color: var(--accent-dark); border-radius: 8px; margin: 0; cursor: pointer;
       white-space: nowrap; line-height: 1.2; }
.tab:hover { background: #fbeee6; border-color: var(--gold); color: var(--ink); }
.tab.active, .tab.active:hover, .tab.active:focus { background: var(--accent); color: #fff;
  border-color: var(--accent-dark); font-weight: 600; box-shadow: 0 6px 16px -8px rgba(122,31,43,.55); }

.panel { display: none; }
.panel.active { display: block; }

/* dasha drill-down tree */
.dasha-tree { font-size: .92rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.dhead { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.dnode:last-child > .dhead { border-bottom: none; }
.dhead:hover { background: #fff3ec; }
.dtog { display: inline-block; width: 1em; color: var(--accent); font-weight: 700; }
.dlvl { float: right; font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; padding-top: 2px; }

.chart-row { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.chart-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px; text-align: center; }
.chart-box .vchart { width: 440px; max-width: 94vw; height: auto; }
.chart-box.rasi-main .vchart { width: 450px; max-width: 95vw; }
.chart-box.small .vchart { width: var(--vchart-size, 260px); max-width: 88vw; }
.cap { margin: 6px 0 0; font-size: .8rem; color: var(--muted); }
.grow { flex: 1; min-width: 260px; }
.varga-grid { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.varga-grid .chart-box { flex: 0 0 auto; }
.sizebar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.sizebar input[type=range] { width: 240px; max-width: 60vw; accent-color: var(--accent); }

.vchart { display: block; margin: 0 auto; }
.vc-frame { fill: #fffaf3; stroke: var(--accent-dark); stroke-width: 2; }
.vc-line { fill: none; stroke: var(--accent-dark); stroke-width: 1.1; }
.vc-sign { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.vc-pl { font-size: 12px; fill: var(--ink); text-anchor: middle; font-weight: 600; }
.vc-bindu { font-size: 18px; fill: var(--accent-dark); text-anchor: middle; font-weight: 700; }

.yoga { padding: 8px 0; border-bottom: 1px solid var(--line); }
.yoga:last-child { border-bottom: none; }
table.av th, table.av td { padding: 4px 6px; text-align: center; font-size: .8rem; }
table.av td:first-child, table.av th:first-child { text-align: left; }

.ephem-wrap { overflow-x: auto; }
.gp-steppers { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.gp-step { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; font-size: .8rem; }
.gp-step button, .gp-now-btn { border: 1px solid var(--line); background: var(--card); color: var(--accent-dark); border-radius: 5px; padding: 1px 8px; cursor: pointer; font-size: .9rem; line-height: 1.4; font-weight: 600; }
.gp-step button:hover, .gp-now-btn:hover { background: var(--accent); color: #fff; }
.gp-now { font-weight: 600; color: var(--accent-dark); margin-right: 4px; }
.gp-wrap { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }
#gochar-wheel { width: 560px; max-width: 96vw; height: auto; }
#gp-table { flex: 1; min-width: 240px; }
.ephem { width: 100%; min-width: 640px; height: auto; display: block; }

/* ---- Subscriptions / admin ---- */
.banner { background: #fff3ec; border: 1px solid #f3d6c4; color: #8c3413; padding: 10px 14px; border-radius: 8px; margin: 12px 0; }
.banner.good { background: #e9f7ef; border-color: #bfe6cd; color: #1d7a46; }
.banner.warn { background: #fdecea; border-color: #f5c6c2; color: #b00020; }
.topbar nav a.upsell { background: linear-gradient(180deg, #b5451b, #8f3414); color: #fff5e6 !important; padding: 6px 16px; border-radius: 999px; font-weight: 700; border: 1px solid #8f3414; box-shadow: 0 1px 8px rgba(143,52,20,.34); letter-spacing: .2px; }
.topbar nav a.upsell:hover { background: linear-gradient(180deg, #c14e22, #9c3a17); color: #fff5e6 !important; filter: brightness(1.04); }
.region { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.chip { border: 1px solid var(--line); padding: 6px 12px; border-radius: 20px; font-size: .85rem; color: var(--muted); }
.chip.on { border-color: var(--accent); color: var(--accent-dark); font-weight: 600; background: #fff3ec; }
.plan { text-align: center; }
.plan .price { font-size: 2rem; font-weight: 700; color: var(--accent-dark); margin: 8px 0; }
.plan .per { font-size: 1rem; color: var(--muted); font-weight: 400; }
.stat { text-align: center; }
.table-wrap { overflow-x: auto; }
td.num { text-align: center; }
/* Timezone correction note on the cast chart page */
.tznote { margin: 8px 0 4px; padding: 7px 12px; border-radius: 8px; font-size: .9rem;
  background: #f1ece0; color: #4a3a24; border: 1px solid var(--line); }
.tznote.dst { background: #eaf4ea; border-color: #bcdcbc; }
.tznote.wartime { background: #fbeede; border-color: #e6c79a; }
.tznote .tz-flag { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 9px;
  font-size: .72rem; font-weight: 700; background: var(--accent); color: #fff; }
.tznote.wartime .tz-flag { background: #b5651d; }
/* Actions wrap within a bounded width so the row never forces a horizontal scrollbar. */
.actions-cell { white-space: normal; max-width: 330px; vertical-align: top; }
/* User identity cell: email on its own line, status tags beneath. */
.urow td { vertical-align: top; }
.uemail { font-weight: 600; word-break: break-all; }
.utags { margin-top: 3px; display: flex; gap: 4px; flex-wrap: wrap; }
/* Feature-access panel sits in its own full-width row, not in the cramped actions cell. */
.featrow td { background: #fbf4e6; border-top: none; padding: 4px 10px 10px; }
.featrow .featbox { margin: 0; }
.featform { padding-top: 8px; }
.featgrid { margin-bottom: 8px; }
.featfoot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.limitsform { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.limitsform .lim { font-size: .82rem; display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.limitsform .lim input { width: 96px; }
.limitnote { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }

/* Admin Users table — clear column lines and a strong divider between each user. */
.usertable { border-collapse: collapse; }
.usertable th, .usertable td { border: 1px solid #e6d6ad; }
.usertable thead th { border-bottom: 2px solid var(--accent-dark); background: #f3e7cf; }
.usertable tr.urow > td { border-top: 3px solid var(--accent); }
.usertable tr.featrow > td { border-top: 1px dashed #d8c79a; }

/* Muhurta location picker */
.mu-place { margin: 8px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #faf4e7; }
.mu-place > input[type=text] { width: 100%; margin: 4px 0 6px; }
.mu-place-row { display: flex; gap: 8px; flex-wrap: wrap; }
.mu-place-row label { font-size: .8rem; }
.mu-place-row input { width: 110px; }
.mu-place-row label:first-child { flex: 1; }
.mu-place-row label:first-child input { width: 100%; }

/* Matchmaking (Kundli Milan) tab */
.match-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.match-pick select { min-width: 240px; padding: 6px; }
.match-head { text-align: center; }
.match-total .big { font-size: 2.2rem; font-weight: 800; color: var(--accent); }
.match-rec { font-weight: 700; color: var(--accent-dark); margin-top: 2px; }
.match-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .match-charts { grid-template-columns: 1fr; } }
.match-col h3 { color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.match-col h4 { margin: 12px 0 4px; color: var(--accent-dark); }
.match-jaimini { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.match-jaimini .chip { background: #f4ead3; border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 8px; font-size: .82rem; }

/* Import (Parashara's Light / JHora) box on the new-chart page. */
.importbox { margin: 6px 0 14px; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; background: #faf4e7; }
.importbox summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.importform { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.featbox { margin-top: 6px; }
.featbox summary { cursor: pointer; color: var(--accent); font-size: .85rem; font-weight: 600; }
.featbox form { padding: 8px 0 2px; }
.featchk { display: block; font-size: .85rem; margin: 4px 0; font-weight: 400; }
.featchk input { width: auto; display: inline; margin: 0 6px 0 0; }

/* --- light visual polish --- */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.card { border-radius: 12px; box-shadow: 0 1px 3px rgba(43,33,24,.05); transition: box-shadow .15s ease; }
.card:hover { box-shadow: 0 3px 10px rgba(43,33,24,.07); }
.tab { border-radius: 8px; transition: color .12s ease, background .12s ease, border-color .12s ease;
  -webkit-tap-highlight-color: transparent; }
.primary, .ghost, .btn-logout { transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.primary:hover { box-shadow: 0 2px 8px rgba(122,31,43,.28); }
.chart-box { transition: box-shadow .15s ease; }
.chart-box:hover { box-shadow: 0 3px 12px rgba(43,33,24,.08); }

/* --- parchment theme + branding + dasha colours + AV markers --- */
body { background-color: var(--bg);
  background-image: linear-gradient(180deg, rgba(255,251,243,.5), rgba(255,251,243,0) 340px); }
h1, h2, h3, .topbar .brand { font-family: Georgia, "Iowan Old Style", "Times New Roman", serif; letter-spacing: .2px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brandlogo { height: 60px; width: 60px; border-radius: 50%; background: #fff8ee; padding: 4px; object-fit: contain; display: block; box-shadow: 0 0 0 2px var(--gold); }
.d-start { color: var(--dstart); font-weight: 600; }
.d-end { color: var(--dend); font-weight: 600; }
.cardstack { display: block; }
.cardstack .card { width: 100%; }
.cardstack table.grid.compact td { white-space: nowrap; }
.vc-mark { fill: rgba(181,69,27,.14); stroke: var(--accent); stroke-width: 1; }
.vc-mpl { font-size: 11px; fill: var(--accent-dark); text-anchor: middle; font-weight: 700; }
.tag.good { background: #e9f7ef; color: #1d7a46; }

/* ---- Responsive ---- */
.navtoggle { display: none; }
.navburger { display: none; font-size: 1.5rem; color: var(--accent-dark); cursor: pointer; user-select: none; line-height: 1; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .navburger { display: block; margin-left: auto; }
  .topbar nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px 2px 4px; }
  .navtoggle:checked ~ nav { display: flex; }
  .topbar nav .inline { width: 100%; }
  table.grid:not([data-rz]) { display: block; overflow-x: auto; white-space: nowrap; }
  .tabs { flex-wrap: wrap; overflow: visible; }
  .container { margin: 16px auto; }
  h1 { font-size: 1.3rem; }
  .rowhead { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
  .chart-box .vchart { width: 100%; }
  .plan .price { font-size: 1.6rem; }
}

/* ---- Admin settings ---- */
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.setrow:last-child { border-bottom: none; }
.setrow label { margin: 0; flex: 1; }
.setrow input[type="text"], .setrow input[type="number"], .setrow select { width: auto; max-width: 320px; }
.setrow input[type="checkbox"] { width: 20px; height: 20px; }

/* ---- Map place search (new chart) ---- */
.place-map { height: 280px; width: 100%; border-radius: 8px; border: 1px solid var(--line); margin-top: 8px; z-index: 0; }
.langsel { margin-left: 8px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--card); color: var(--accent-dark); font-size: .85rem; cursor: pointer; }
.place-results { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.place-opt { text-align: left; border: 1px solid var(--line); background: var(--card); padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: .82rem; color: var(--ink); line-height: 1.3; }
.place-opt:hover { background: #fff3ec; border-color: var(--accent); }
.leaflet-container { font: inherit; }

/* ---- Admin: subscription tier editor ---- */
.tier-card { border-left: 4px solid var(--gold); }
.tier-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tier-name { font-size: 1.1rem; font-weight: 700; flex: 1; max-width: 360px; }
.tier-head .remove-tier { margin-left: auto; color: var(--warn); }
.tier-fields { display: flex; gap: 16px; flex-wrap: wrap; margin: 6px 0; }
.tier-fields label { display: flex; flex-direction: column; font-size: .82rem; color: var(--muted); gap: 3px; }
.tier-fields input, .tier-fields select { width: 130px; }
.featgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.featgrid .featchk.all { grid-column: 1 / -1; }
.tier-feats { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; font-size: .85rem; }
.tier-feats li { padding: 2px 0; color: var(--good); }
.tier-feats li.off { color: var(--muted); opacity: .6; }

/* ---- Dasha timeline band ---- */
.band-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.dasha-band { width: 100%; min-width: 720px; height: auto; display: block; }
.outer-row td { color: var(--muted); }

/* ---- Natal Panchanga table ---- */
table.panchanga th { text-align: left; white-space: nowrap; color: var(--accent-dark); width: 130px; vertical-align: top; }
table.panchanga td { text-align: left; vertical-align: top; }
table.panchanga .pa-meta { text-align: right; color: var(--ink); }

/* ---- Special / mantras formatting ---- */
.plainlist { margin: 4px 0 10px; padding-left: 18px; }
.plainlist li { margin: 2px 0; }
.mantra-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.mantra-item:last-child { border-bottom: none; }
.mantra-item p { margin: 3px 0; }

/* ---- Bigger chakras (Chakras tab) ---- */
.panel[data-panel="chakras"] .chart-box { max-width: 640px; }
.panel[data-panel="chakras"] .chart-box svg { width: 580px; max-width: 94vw; height: auto; display: block; }
.panel[data-panel="chakras"] .chart-row { gap: 24px; }

/* ---- In-app light Jyotish background motif (logged-in pages) ---- */
.jv-appbg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.jv-appbg svg { width: 100%; height: 100%; display: block; }

/* ---- Mobile polish + safety net (whole app) ---- */
img, .container svg { max-width: 100%; }
@media (max-width: 760px) {
  .container { margin: 14px auto; padding-left: 13px; padding-right: 13px; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .table-wrap, .ephem-wrap, .band-wrap { max-width: 100%; }
  main.container table { font-size: .84rem; }
  main.container th, main.container td { padding: 6px 8px; }
  /* wide tables scroll within their box, not the whole page */
  main.container table:not([data-rz]) { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  input, select, textarea { max-width: 100%; }
  button, .ghost, .tabs a, .tabs button { min-height: 38px; }
  .actionbar, .rowhead, .actions { flex-wrap: wrap; gap: 10px; }
  .setrow { flex-wrap: wrap; align-items: flex-start; gap: 6px; }
  .setrow input[type="text"], .setrow input[type="number"], .setrow select { width: 100%; max-width: 100%; }
  .tier-fields input, .tier-fields select { width: 100%; }
  .featgrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .container { padding-left: 10px; padding-right: 10px; }
  h1 { font-size: 1.2rem; }
  h2 { font-size: 1.08rem; }
  .topbar .brand { font-size: 1.18rem; }
  .topbar .brandlogo { height: 44px !important; width: 44px !important; }
  .tabs a, .tabs button { font-size: .82rem; padding: 6px 9px; }
  .jv-plans .plan { flex: 1 1 100%; }
  .featgrid { grid-template-columns: 1fr; }
  .jv-hero h1.brandline { font-size: 1.9rem; }
}

/* ================================================================= */
/* Responsive hardening — guarantee the app fits ANY screen width.    */
/*                                                                    */
/* Root cause of the "content goes past the screen edge" report: the  */
/* charts were capped in viewport units (max-width: 95vw / 88vw /     */
/* 82vw). Once the card padding + the .container side padding were    */
/* added on top, the chart box became wider than the viewport and     */
/* scrolled the whole page sideways. Cap charts to their container    */
/* (100%) instead, let flex children shrink, and add a page-level     */
/* guard so nothing can ever spill past the screen edge again.        */
/* ================================================================= */
html, body { overflow-x: hidden; }
body { max-width: 100%; }

.chart-box { max-width: 100%; }
.chart-box .vchart,
.chart-box.rasi-main .vchart,
.chart-box.small .vchart,
.panel[data-panel="chakras"] .chart-box svg { max-width: 100%; }
#gochar-wheel { max-width: 100%; }
/* Let flex/grid items shrink below their content width, so wide content wraps
   or scrolls inside them instead of pushing the whole column past the screen
   edge (which overflow-x:hidden would then clip = truncated text). */
.chart-row, .varga-grid, .gp-wrap, .match-charts, .cards, .region, .actionbar, .gp-steppers,
.chart-row > *, .varga-grid > *, .gp-wrap > *, .match-charts > *, .cards > *, .region > * { min-width: 0; }

@media (max-width: 760px) {
  /* Dasha drill-down trees: keep the "Planet  start → end  LEVEL" rows within
     the card — smaller text, the level tag flows inline, long rows may wrap. */
  .dasha-tree { font-size: .8rem; }
  .dhead { overflow-wrap: break-word; }
  .dlvl { float: none; display: inline-block; margin-left: 6px; padding-top: 0; }
  /* Jaimini arudhas / upapada chips wrap their long text instead of overflowing */
  .match-jaimini .chip { overflow-wrap: anywhere; }
}

/* Mobile navigation — a tidy, full-width, left-aligned menu list so   */
/* every item (links, username, log-out, language) shares one left     */
/* edge instead of being nudged out of line by stray margins.          */
@media (max-width: 760px) {
  .topbar nav { align-items: stretch; gap: 8px; }
  .topbar nav a { display: block; text-align: left; }
  .topbar nav .inline { width: 100%; }
  .topbar nav .btn-logout { width: 100%; text-align: left; }
  .topbar nav .who { padding: 4px 2px 0; }
  .langwrap { margin-left: 0; width: 100%; justify-content: flex-start; padding-top: 2px; }
  /* tabs wrap into tidy rows (see the .tabs base rule) — all visible */
  .tab { font-size: .84rem; padding: 7px 12px; }
}

/* ================================================================= */
/* Responsive data tables — on phones a wide table reflows into a      */
/* vertical stack of cards (one card per row; each cell shown as a     */
/* "LABEL   value" line) instead of running off the side of the        */
/* screen. Add class "cardify" to the table and a data-label to each   */
/* <td>; the thead is hidden and its labels come from data-label.      */
/* ================================================================= */
/* Wide grids (planets, ashtakavarga, ephemeris…) scroll inside a tidy rounded
   frame instead of stretching the page. .rt-scroll is added by the script. */
.rt-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line); border-radius: 10px; scrollbar-width: thin; }
.rt-scroll > table { margin: 0; }
@media (max-width: 760px) {
  .rt-scroll > table, .rt-scroll > table.grid { width: auto; min-width: 100%;
    max-width: none; white-space: nowrap; }
  /* a table shrunk just enough to fit keeps tight, tidy cells */
  table.rt-fit td, table.rt-fit th { padding: 5px 6px; }
}

/* Record tables (dashas, panoti, remedies, muhurta, saved charts…) collapse
   into a stack of cards on phones: each row is a card and each cell a
   "LABEL   value" line (the label comes from the column header via data-label). */
@media (max-width: 760px) {
  table.cardify { display: block !important; width: 100%; border: none !important;
    overflow: visible !important; white-space: normal !important; background: none; }
  table.cardify thead { display: none; }
  table.cardify tbody, table.cardify tr, table.cardify td { display: block; width: 100%; }
  table.cardify tr { background: var(--card); border: 1px solid var(--line); border-radius: 14px;
    padding: 6px 16px; margin: 0 0 14px; box-shadow: 0 10px 26px -20px rgba(122,31,43,.5); }
  table.cardify tr.current, table.cardify tr.lagna-row { border-color: var(--accent); border-width: 2px; }
  table.cardify td { border: none !important; padding: 8px 0 !important; font-size: .92rem;
    display: grid; grid-template-columns: 42% 1fr; gap: 12px; align-items: baseline; text-align: left; }
  table.cardify td + td { border-top: 1px solid #f2e8d2 !important; }
  table.cardify td[data-label]::before { content: attr(data-label); font-weight: 700; color: var(--muted);
    font-size: .66rem; text-transform: uppercase; letter-spacing: .5px; line-height: 1.4; }
  table.cardify td:not([data-label]) { display: block; text-align: left; padding-top: 10px !important; }
  table.cardify td:empty { display: none; }
  table.cardify .rowacts { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; }
  table.cardify .btn-sm { flex: 0 0 auto; }
}
