:root {
  /* Default Vedic Sacred Light Theme */
  --theme-mode: light;
  --background: #fbf9f4;
  --surface-dark: #ffffff;
  --surface-elevated: #f4efe4;
  --surface-highlight: #ece3d3;

  /* Saffron Gold & Temple Accents */
  --gold: #d97706;
  --gold-light: #92400e;
  --gold-dark: #b45309;
  --gold-border: rgba(217, 119, 6, 0.22);
  --lavender: #7c3aed;

  /* Typography */
  --text: #1c1917;
  --text-secondary: #574e45;
  --text-muted: #8c7e70;
  --text-gold: #92400e;

  /* Tags & status */
  --upright: #059669;
  --reversed: #e11d48;
  --error: #dc2626;

  --gold-gradient: linear-gradient(135deg, #d97706, #b45309);
  --header-bg: rgba(255, 255, 255, 0.94);
  --overlay-bg: rgba(30, 24, 18, 0.52);
  --card-shadow: 0 4px 20px rgba(130, 90, 20, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --cosmos-bg: radial-gradient(circle at 50% 15%, #fffdf8 0%, #faf6ec 45%, #f1e7d6 100%);
  --chat-bg: #fbf9f4;
  --bubble-user: #f3ece0;
  --bubble-pandit: #ffffff;

  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --theme-mode: dark;
  --background: #11141d;
  --surface-dark: #181c27;
  --surface-elevated: #20293d;
  --surface-highlight: #28334d;

  --gold: #f7b64d;
  --gold-light: #f0cc90;
  --gold-dark: #d69430;
  --gold-border: rgba(247, 182, 77, 0.25);
  --lavender: #8437f1;

  --text: #f3ece3;
  --text-secondary: #7f89a5;
  --text-muted: #58668d;
  --text-gold: #f0cc90;

  --upright: #7ae5b0;
  --reversed: #f5879e;
  --error: #ff6584;

  --gold-gradient: linear-gradient(135deg, #f7b64d, #e59c35);
  --header-bg: rgba(24, 28, 39, 0.92);
  --overlay-bg: rgba(8, 10, 16, 0.72);
  --card-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
  --cosmos-bg: linear-gradient(180deg, #181c27, #11141d);
  --chat-bg: #11141d;
  --bubble-user: #20293d;
  --bubble-pandit: #181c27;
}

* { box-sizing: border-box; }

/* Sleek custom golden scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(217, 119, 6, 0.22);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(217, 119, 6, 0.45); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { background: rgba(247, 182, 77, 0.28); }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: rgba(247, 182, 77, 0.55); }

html, body {
  margin: 0;
  height: 100%;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.6; }
[hidden] { display: none !important; }

#cosmos {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background: var(--cosmos-bg);
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 880px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.tag {
  font-size: 10.5px;
  letter-spacing: 2.4px;
  font-weight: 600;
  color: var(--gold-light);
  text-transform: uppercase;
}
.muted { color: var(--text-secondary); }
.small { font-size: 12.5px; }
.center { text-align: center; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(217, 119, 6, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.logo {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  overflow: hidden;
  border: 1.6px solid var(--gold);
  box-shadow: 0 0 14px rgba(217, 119, 6, 0.28);
  display: grid; place-items: center; font-size: 22px;
  transition: transform 240ms ease, box-shadow 240ms ease;
}
.logo:hover {
  transform: rotate(8deg) scale(1.05);
  box-shadow: 0 0 20px rgba(217, 119, 6, 0.42);
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
.brand { flex: 1; min-width: 0; }
.brand-row { display: flex; align-items: center; gap: 8px; }
.brand h1 { margin: 0; font-family: var(--font-serif); font-size: 17.5px; font-weight: 700; letter-spacing: -0.2px; }
.brand p { margin: 0; font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-tag {
  font-size: 9px; letter-spacing: 1px; font-weight: 700; color: var(--gold-light);
  padding: 2px 7px; border-radius: 60px;
  background: var(--surface-elevated); border: 0.8px solid rgba(217, 119, 6, 0.35);
}
.icon-btn {
  background: none; border: none; color: var(--text-secondary);
  font-size: 18px; width: 36px; height: 36px; border-radius: 50%;
}
.icon-btn:hover { background: rgba(127, 137, 165, 0.12); }
.theme-btn {
  font-size: 19px; display: grid; place-items: center;
  transition: transform 200ms ease;
}
.theme-btn:hover { transform: rotate(18deg) scale(1.08); background: rgba(127, 137, 165, 0.15); }

.quota-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 60px;
  background: var(--surface-elevated); border: 1px solid var(--gold-border);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.account-btn {
  width: 36px; height: 36px; flex: none; border-radius: 50%; overflow: hidden; padding: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 15px;
  background: var(--surface-elevated); border: 1px solid var(--gold-border); color: var(--gold-light);
}
.account-btn img { width: 100%; height: 100%; object-fit: cover; }
.account-btn[hidden] { display: none; }
.quota-badge.empty { border-color: rgba(255, 101, 132, 0.5); color: #ff8b8b; }
.quota-badge .plus {
  background: var(--gold); color: var(--background);
  font-size: 9px; font-weight: 800; padding: 1px 6px; border-radius: 60px;
}

/* Segmented tabs */
.tabs-wrap {
  padding: 8px 16px;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(217, 119, 6, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.tabs {
  max-width: 560px; margin: 0 auto; display: flex; padding: 4px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface-elevated); border-radius: 25px;
  border: 1px solid var(--gold-border);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}
.tab {
  flex: 1 0 auto; padding: 8px 12px; border: none; border-radius: 22px;
  background: transparent; color: var(--text-secondary);
  font-size: 12.5px; font-weight: 500; letter-spacing: 0.3px;
  transition: all 200ms ease;
}
.tab:hover:not(.active) { color: var(--text); }
.tab.active {
  background: var(--gold-gradient); color: #ffffff; font-weight: 700;
  box-shadow: 0 3px 12px rgba(217, 119, 6, 0.35);
}
[data-theme="dark"] .tab.active {
  color: var(--background);
}

main { flex: 1; min-height: 0; position: relative; }
.tab-panel { display: none; height: 100%; }
.tab-panel.active { display: flex; flex-direction: column; }
.tab-panel.scroll.active { display: block; overflow-y: auto; padding: 20px 16px 30px; }

/* Lunar banner */
.lunar-banner {
  display: flex; align-items: center; gap: 14px; text-align: left;
  margin: 6px 16px; padding: 13px 18px; border-radius: 20px;
  background: var(--surface-dark); border: 1.2px solid var(--gold-border);
  box-shadow: var(--card-shadow);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.lunar-banner:hover {
  transform: translateY(-1.5px);
  border-color: var(--gold);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.12);
}
.moon-disc {
  width: 46px; height: 46px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px;
  background: radial-gradient(circle at 35% 35%, #3d4a66, #181c27);
  border: 1.5px solid rgba(240, 204, 144, 0.7);
  box-shadow: 0 0 16px rgba(247, 182, 77, 0.28), inset 0 0 6px rgba(255, 255, 255, 0.2);
  transition: transform 260ms ease;
}
.lunar-banner:hover .moon-disc {
  transform: rotate(15deg) scale(1.06);
}
.lunar-text { flex: 1; min-width: 0; }
.lunar-title { display: flex; align-items: center; gap: 8px; }
.lunar-title strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lunar-title .pill-tag { font-size: 9.5px; letter-spacing: 0; white-space: nowrap; }
.lunar-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chev { color: var(--text-secondary); font-size: 18px; }

/* Chat messages */
.msg { display: flex; gap: 10px; padding: 8px 16px; align-items: flex-start; }
.msg.user { justify-content: flex-end; }
.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px;
  background: var(--surface-elevated); border: 1px solid rgba(240, 204, 144, 0.5);
}
.bubble {
  max-width: min(640px, 82%); padding: 14px 18px; border-radius: 20px;
  background: var(--surface-dark); border: 1px solid var(--gold-border);
  overflow-wrap: anywhere;
}
.msg.user .bubble {
  background: var(--surface-elevated); border-color: rgba(127, 137, 165, 0.2);
  border-bottom-right-radius: 6px;
}
.msg.pandit .bubble { border-top-left-radius: 6px; }
.bubble .meta { font-size: 10.5px; color: var(--text-muted); margin-top: 6px; }
.msg.user .meta { text-align: right; }

.md p { margin: 0 0 10px; }
.md h2, .md h3, .md h4, .md h5 { font-family: var(--font-serif); color: var(--gold-light); margin: 14px 0 6px; font-size: 15.5px; font-weight: 600; }
.md h2 { font-size: 17px; }
.md strong { color: var(--text); font-weight: 600; }
.md em { color: var(--text-gold); }
.md ul { margin: 0 0 10px; padding-left: 4px; list-style: none; }
.md li { margin-bottom: 6px; padding-left: 14px; position: relative; }
.md li::before { content: '•'; position: absolute; left: 0; color: var(--gold); }
.md blockquote {
  margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--gold);
  background: rgba(247, 182, 77, 0.06); border-radius: 0 10px 10px 0; color: var(--text-gold);
}
.md hr { border: none; border-top: 1px solid rgba(127, 137, 165, 0.2); margin: 14px 0; }
.md > :last-child { margin-bottom: 0; }

.spinner {
  display: inline-block; width: 15px; height: 15px; vertical-align: -2px;
  border: 2px solid rgba(240, 204, 144, 0.25); border-top-color: var(--gold-light);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.btn {
  height: 48px; padding: 0 22px; border-radius: 25px; font-weight: 700; font-size: 14px;
  border: none; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 140ms ease, box-shadow 180ms ease, filter 180ms ease;
  position: relative;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-gold {
  background: var(--gold-gradient); color: #ffffff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.32);
  overflow: hidden;
}
.btn-gold:hover:not(:disabled) {
  filter: brightness(1.08);
  box-shadow: 0 6px 18px rgba(217, 119, 6, 0.42);
}
.btn-gold::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -80%;
  width: 50%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
  transform: rotate(25deg);
  pointer-events: none;
  animation: btnSheen 4.5s ease-in-out infinite;
}
@keyframes btnSheen {
  0%, 65% { left: -80%; }
  100% { left: 150%; }
}
[data-theme="dark"] .btn-gold { color: var(--background); }
.btn-outline { background: transparent; color: var(--gold-light); border: 1px solid var(--gold-border); }
#askBtn { height: 50px; }
.link-btn { background: none; border: none; padding: 2px 6px; color: var(--gold-light); font-weight: 700; text-decoration: underline; font-size: 12.5px; }
.link-btn.gold { text-decoration: none; font-weight: 600; font-size: 14px; }

/* Chart strip */
.chart-strip {
  display: flex; align-items: center; gap: 12px; text-align: left;
  margin: 0 16px 6px; padding: 12px 18px; border-radius: 20px;
  background: var(--surface-elevated); border: 1px dashed var(--gold-border);
  box-shadow: var(--card-shadow);
  font-size: 12.5px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
.chart-strip.ready {
  border-style: solid; border-color: var(--gold-border); border-left: 3.5px solid var(--gold);
  background: var(--surface-dark);
}
.chart-strip:hover {
  transform: translateY(-1.5px);
  border-color: var(--gold);
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.12);
}
.chart-strip .glyph-badge {
  width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-elevated); border: 1.2px solid rgba(217, 119, 6, 0.45); color: var(--gold-light); font-size: 18px;
}
.chart-strip .facts { flex: 1; min-width: 0; }
.chart-strip .facts strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-strip .facts span { color: var(--text-secondary); font-size: 11.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* South Indian chart */
.si-chart {
  display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr);
  width: 100%; max-width: 340px; aspect-ratio: 1; margin: 0 auto;
  border: 1.2px solid rgba(240, 204, 144, 0.55); border-radius: 10px; overflow: hidden;
  background: linear-gradient(160deg, #1a2130, #10141e);
}
.si-cell {
  position: relative; border: 0.5px solid rgba(240, 204, 144, 0.22);
  padding: 4px; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 1px 4px;
  font-size: 11px; line-height: 1.25; min-width: 0;
}
.si-cell .sign { position: absolute; right: 4px; bottom: 2px; font-size: 9px; color: var(--text-muted); }
.si-cell.lagna { background: rgba(247, 182, 77, 0.1); }
.si-cell.lagna::before {
  content: ''; position: absolute; left: 0; top: 0; width: 14px; height: 14px;
  background: linear-gradient(135deg, var(--gold) 50%, transparent 50%);
}
.si-cell .p { font-weight: 600; color: var(--text); }
.si-cell .p.mo { color: var(--gold-light); }
.si-cell .p.ret::after { content: 'ᴿ'; color: var(--reversed); font-size: 9px; }
.si-center {
  grid-column: 2 / span 2; grid-row: 2 / span 2; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 8px;
  border: 0.5px solid rgba(240, 204, 144, 0.22);
}
.si-center .t { font-family: var(--font-serif); font-size: 14px; font-weight: 600; color: var(--gold-light); }
.si-center .s { font-size: 10.5px; color: var(--text-secondary); margin-top: 2px; }


/* Daily Rashifal */
.daily { display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 600px; margin: 0 auto; }
.daily h2, .codex-head h2 { font-family: var(--font-serif); font-size: 24px; margin: 8px 0 4px; font-weight: 600; }
.daily > p { margin: 0 0 16px; }
.rashi-picker { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; width: 100%; margin-bottom: 18px; }
.rashi-pick {
  padding: 8px 2px; border-radius: 14px; background: var(--surface-elevated);
  border: 1px solid rgba(127, 137, 165, 0.2); font-size: 11px; color: var(--text-secondary);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.rashi-pick .g { font-size: 18px; color: var(--gold-light); }
.rashi-pick.active { background: var(--gold); color: var(--background); border-color: var(--gold); font-weight: 700; }
.rashi-pick.active .g { color: var(--background); }
@media (max-width: 520px) { .rashi-picker { grid-template-columns: repeat(4, 1fr); } }

.rashifal { width: 100%; text-align: left; }
.rf-card {
  padding: 22px; border-radius: 24px; background: var(--surface-dark);
  border: 1px solid rgba(247, 182, 77, 0.3); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  animation: fadeUp 400ms ease both; margin-bottom: 16px;
}
.rf-head { display: flex; align-items: center; gap: 14px; }
.rf-glyph {
  width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 28px;
  color: var(--gold-light); background: radial-gradient(circle, #28344e, var(--surface-dark)); border: 1.2px solid rgba(240, 204, 144, 0.5);
}
.rf-head h3 { font-family: var(--font-serif); font-size: 19px; margin: 0; font-weight: 600; }
.stars { color: var(--gold); letter-spacing: 2px; font-size: 14px; }
.stars .off { color: rgba(127, 137, 165, 0.35); }
.rf-card p { margin: 12px 0 0; }
.rf-warn {
  margin-top: 12px; padding: 10px 14px; border-radius: 14px; font-size: 13px;
  background: rgba(245, 135, 158, 0.1); border: 1px solid rgba(245, 135, 158, 0.5); color: var(--reversed);
}
.rf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.rf-item { padding: 10px 12px; border-radius: 14px; background: var(--surface-elevated); font-size: 12.5px; }
.rf-item .k { display: block; font-size: 10px; letter-spacing: 1.4px; color: var(--gold-light); font-weight: 600; text-transform: uppercase; margin-bottom: 2px; }
@media (max-width: 520px) { .rf-grid { grid-template-columns: 1fr; } }

.affirmation {
  width: 100%; padding: 22px; border-radius: 24px; background: var(--surface-dark); text-align: center;
  border: 1px solid rgba(247, 182, 77, 0.3); box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  animation: fadeUp 500ms ease both;
}
.affirmation .quote { font-family: var(--font-serif); font-style: italic; font-size: 16.5px; color: var(--text-gold); margin: 14px 0; }
.affirmation .btn { width: 100%; margin-top: 8px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }

/* Rashi Codex */
.codex-head { text-align: center; margin-bottom: 16px; }
.codex-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 12px; }
@media (max-width: 650px) { .codex-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 420px) { .codex-grid { grid-template-columns: repeat(2, 1fr); } }
.rashi-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 18px 8px 14px; border-radius: 20px; text-align: center;
  background: var(--surface-dark); border: 1.2px solid var(--gold-border);
  box-shadow: var(--card-shadow);
}
[data-theme="dark"] .rashi-tile {
  background: linear-gradient(160deg, #1a2130, #10141e); border: 1.2px solid rgba(240, 204, 144, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.rashi-tile:hover { transform: translateY(-3px); border-color: var(--gold); transition: transform 180ms ease; }
.rashi-tile .num { position: absolute; top: 8px; left: 12px; font-size: 10px; color: var(--text-muted); font-family: var(--font-serif); }
.rashi-tile .yours {
  position: absolute; top: 8px; right: 8px; font-size: 8.5px; font-weight: 700; letter-spacing: 0.8px;
  padding: 1px 6px; border-radius: 60px; background: var(--gold); color: var(--background);
}
.rashi-tile .g {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; margin-bottom: 6px;
  color: var(--gold-light); background: var(--surface-dark); border: 1.2px solid rgba(240, 204, 144, 0.4);
  box-shadow: 0 0 16px rgba(247, 182, 77, 0.2);
}
.rashi-tile .n { font-family: var(--font-serif); font-size: 15px; font-weight: 600; }
.rashi-tile .h { font-size: 12px; color: var(--text-gold); }
.rashi-tile .e { font-size: 10.5px; color: var(--text-secondary); }

/* Tables inside sheets */
.graha-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 8px; }
.graha-table th { text-align: left; font-size: 10px; letter-spacing: 1.2px; color: var(--gold-light); font-weight: 600; padding: 6px 4px; border-bottom: 1px solid rgba(127, 137, 165, 0.2); }
.graha-table td { padding: 6px 4px; border-bottom: 1px solid rgba(127, 137, 165, 0.08); }
.graha-table .r { color: var(--reversed); font-size: 10.5px; }
.graha-table tr.now td { color: var(--gold-light); font-weight: 600; }
.traits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.traits span { font-size: 11.5px; padding: 3px 10px; border-radius: 60px; background: var(--surface-elevated); border: 1px solid rgba(122, 229, 176, 0.4); color: var(--upright); }
.traits.neg span { border-color: rgba(245, 135, 158, 0.4); color: var(--reversed); }

/* Birth form */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { margin: 8px 0; }
.field select {
  height: 46px; padding: 0 10px; border-radius: 14px; background: var(--surface-elevated);
  border: 1px solid rgba(127, 137, 165, 0.25); color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.field input[type="date"], .field input[type="time"] { color-scheme: light; }
[data-theme="dark"] .field input[type="date"], [data-theme="dark"] .field input[type="time"] { color-scheme: dark; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); margin: 2px 0 6px; }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }
.form-error { color: var(--error); font-size: 13px; margin: 6px 0 0; }
#birthForm .row-btns { margin-top: 14px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; gap: 0; } }

/* Overlays & dialogs */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: var(--overlay-bg); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade 220ms ease both;
}
@keyframes fade { from { opacity: 0; } }
.dialog {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 32px); overflow-y: auto;
  padding: 24px; border-radius: 24px; background: var(--surface-dark);
  border: 1.2px solid var(--gold-border); box-shadow: var(--card-shadow), 0 16px 40px rgba(0, 0, 0, 0.25);
  animation: dialogScale 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes dialogScale {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.dialog h3 { font-family: var(--font-serif); font-size: 19px; margin: 0; font-weight: 600; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.paywall { max-width: 500px; }
.paywall h3 { text-align: center; margin-top: 10px; }
.lotus {
  width: 60px; height: 60px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  font-size: 30px; background: var(--surface-elevated); border: 1.2px solid var(--gold-border);
}
.plan-list { display: flex; flex-direction: column; gap: 12px; margin: 18px 0; }
.plan {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px;
  background: var(--surface-elevated); border: 1px solid rgba(127, 137, 165, 0.2);
}
.plan.popular { background: var(--surface-highlight); border: 1.5px solid var(--gold); }
.plan-info { flex: 1; min-width: 0; }
.plan-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.plan.popular .plan-title { color: var(--gold-light); }
.plan-badge { font-size: 9px; font-weight: 700; padding: 2px 7px; border-radius: 60px; background: var(--surface-dark); }
.plan.popular .plan-badge { background: var(--gold); color: var(--background); }
.plan-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.plan-price { font-family: var(--font-serif); font-size: 18px; font-weight: 700; color: var(--gold-light); }
.plan .btn { height: 34px; padding: 0 14px; font-size: 12.5px; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; font-size: 12.5px; color: var(--text-secondary); }
.field input {
  height: 46px; padding: 0 14px; border-radius: 14px; background: var(--surface-elevated);
  border: 1px solid rgba(127, 137, 165, 0.25); color: var(--text); font: inherit; outline: none;
}
.field input:focus { border-color: var(--gold); }
.row-btns { display: flex; gap: 10px; }
.row-btns .btn { flex: 1; padding: 0 12px; }

/* Bottom sheet */
.sheet-overlay { place-items: end center; padding: 0; }
.sheet {
  width: 100%; max-width: 880px; max-height: 88dvh; overflow-y: auto; padding: 24px;
  background: var(--surface-dark); border: 1px solid rgba(247, 182, 77, 0.3); border-bottom: none;
  border-radius: 28px 28px 0 0; box-shadow: 0 -6px 35px rgba(0, 0, 0, 0.6);
  animation: slideUp 260ms ease-out both;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }
.sheet .handle { width: 40px; height: 4px; margin: 0 auto 20px; border-radius: 10px; background: rgba(127, 137, 165, 0.3); }
.sheet h4 { font-family: var(--font-serif); font-size: 18px; margin: 0; font-weight: 600; }
.sheet hr { border: none; border-top: 1px solid rgba(127, 137, 165, 0.15); margin: 18px 0; }
.sheet .section { margin-bottom: 20px; }
.sheet .section p { margin: 6px 0 0; }
.sheet .remedy { padding: 14px; border-radius: 16px; background: var(--surface-elevated); border: 1px solid rgba(247, 182, 77, 0.3); color: var(--text-gold); margin-top: 8px; }
.sheet .moon-head { display: flex; align-items: center; gap: 14px; }
.sheet .moon-head .moon-disc { width: 50px; height: 50px; font-size: 26px; border-color: var(--gold-light); }
.tip-row { display: flex; gap: 10px; font-size: 13px; margin-top: 8px; }
.tip-row .label { width: 140px; flex: none; color: var(--gold-light); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px;
  background: var(--surface-elevated); border: 1px solid var(--gold); font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); animation: fadeUp 240ms ease both;
}

@media (max-width: 520px) {
  .app-header { padding: 10px 12px; gap: 8px; }
  .pill-tag { display: none; }
  .brand-row .pill-tag { display: none; }
  .lunar-title .pill-tag { display: inline; }
  .bubble { max-width: 88%; }
  #askBtn { padding: 0 16px; }
  .tip-row { flex-direction: column; gap: 2px; }
  .tip-row .label { width: auto; }
}

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

/* Sign-in and account */
.login { text-align: center; }
.login h3 { margin-top: 12px; }
.google-btn { display: flex; justify-content: center; min-height: 44px; margin: 20px 0 8px; }
.account-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.account-head h2 { margin: 0; font-family: var(--font-serif); font-size: 20px; }
.account-head p { margin: 2px 0 0; }
.avatar-img {
  width: 54px; height: 54px; border-radius: 50%; object-fit: cover; flex: none;
  display: grid; place-items: center; font-size: 22px; font-weight: 700;
  background: var(--surface-elevated); border: 1px solid var(--gold-border); color: var(--gold-light);
}

/* Astrologer list */
.tabs::-webkit-scrollbar { display: none; }
.tab[hidden] { display: none; }
#tab-astrologers .lunar-banner, #tab-astrologers .chart-strip { width: 100%; margin: 0 0 8px; }
.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 18px 0 10px; }
.list-head h2 { margin: 0; font-family: var(--font-serif); font-size: 20px; }
.list-head p { margin: 2px 0 0; }
.astro-list { display: flex; flex-direction: column; gap: 12px; }
.astro-card {
  position: relative;
  display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 22px;
  background: var(--surface-dark); border: 1.2px solid var(--gold-border);
  box-shadow: var(--card-shadow);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 220ms cubic-bezier(0.2, 0.8, 0.2, 1), border-color 220ms ease;
}
.astro-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 10px 28px rgba(217, 119, 6, 0.12), 0 2px 6px rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] .astro-card:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 16px rgba(247, 182, 77, 0.18);
}
.astro-avatar {
  position: relative; width: 58px; height: 58px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 26px; font-weight: 700; color: var(--gold-light);
  background: radial-gradient(circle at 35% 35%, #fffbf2, var(--surface-elevated));
  border: 1.8px solid var(--gold);
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.18);
  transition: transform 240ms ease, box-shadow 240ms ease;
}
[data-theme="dark"] .astro-avatar {
  background: radial-gradient(circle at 35% 35%, #2a334a, #181c27);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.astro-card:hover .astro-avatar {
  transform: scale(1.06);
  box-shadow: 0 0 18px rgba(217, 119, 6, 0.32);
}
.astro-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.astro-avatar .dot {
  position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--surface-dark); background: var(--text-muted);
}
.astro-avatar.online .dot {
  background: var(--upright);
  box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.7);
  animation: radarPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.astro-avatar.busy .dot { background: var(--gold); }
@keyframes radarPulse {
  0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0.75); }
  70% { box-shadow: 0 0 0 8px rgba(5, 150, 105, 0); }
  100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}
.astro-info { flex: 1; min-width: 0; }
.astro-name { font-weight: 700; font-size: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.astro-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.astro-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.astro-tags span {
  font-size: 11px; padding: 3px 9px; border-radius: 60px; color: var(--gold-light);
  background: rgba(217, 119, 6, 0.08); border: 1px solid var(--gold-border);
  font-weight: 500;
}
.astro-bio {
  margin: 8px 0 0; font-size: 12.5px; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.astro-bio.full { display: block; }
.astro-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.astro-cta .btn { height: 38px; padding: 0 18px; font-size: 13px; }
.astro-cta .btn:disabled { opacity: 0.45; box-shadow: none; }
.astro-status { font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-muted); text-transform: uppercase; }
.astro-status.online { color: var(--upright); }
.astro-status.busy { color: var(--gold); }
@media (max-width: 480px) {
  .astro-card { flex-wrap: wrap; }
  .astro-info { flex-basis: calc(100% - 70px); }
  .astro-cta { flex-direction: row; justify-content: space-between; align-items: center; width: 100%; }
}

.my-chats { margin-top: 22px; }
.chat-row {
  width: 100%; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px;
  text-align: left; padding: 12px 14px; margin-top: 8px; border-radius: 16px; color: var(--text);
  background: var(--surface-dark); border: 1px solid rgba(127, 137, 165, 0.15);
}
.chat-row .who { font-weight: 600; }
.chat-row .chev { grid-row: 1 / 3; grid-column: 2; align-self: center; }

/* Live chat room */
body.in-room { overflow: hidden; }
.chat-room {
  position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column;
  max-width: 880px; margin: 0 auto; background: var(--chat-bg);
  border-left: 1px solid rgba(127, 137, 165, 0.12); border-right: 1px solid rgba(127, 137, 165, 0.12);
}
.chat-room[hidden] { display: none; }
.room-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--header-bg); border-bottom: 1px solid rgba(127, 137, 165, 0.15);
  backdrop-filter: blur(8px);
}
.room-head .icon-btn { font-size: 26px; line-height: 1; }
.room-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.room-title strong { font-family: var(--font-serif); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#roomStatus { font-size: 12px; color: var(--gold-light); font-variant-numeric: tabular-nums; }
.room-head .btn { height: 36px; padding: 0 14px; font-size: 13px; }
.btn-end { background: rgba(255, 101, 132, 0.12); color: #ff8b8b; border: 1px solid rgba(255, 101, 132, 0.45); }
.btn-delete { background: rgba(255, 101, 132, 0.12); color: #ff8b8b; border: 1px solid rgba(255, 101, 132, 0.45); cursor: pointer; }
.btn-delete:hover { background: rgba(255, 101, 132, 0.22); }
.room-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  margin: 10px 12px 0; padding: 10px 14px; border-radius: 16px; font-size: 13px;
  background: var(--surface-elevated); border: 1px solid var(--gold-border);
}
.room-banner[hidden] { display: none; }
.room-banner .btn { height: 34px; padding: 0 14px; font-size: 12.5px; }
.room-messages { flex: 1; overflow-y: auto; padding: 10px 0 16px; }
.room-messages .msg { padding: 5px 12px; }
.room-messages .bubble {
  padding: 10px 14px; border-radius: 18px; max-width: 80%; white-space: normal;
  background: var(--bubble-pandit); border: 1px solid var(--gold-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.room-messages .msg.user .bubble {
  background: var(--bubble-user); border-color: rgba(217, 119, 6, 0.25);
}
.room-note { margin: 10px 16px; font-size: 12.5px; color: var(--text-secondary); text-align: center; }
.room-form {
  display: flex; gap: 10px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--header-bg); border-top: 1px solid rgba(127, 137, 165, 0.15);
  backdrop-filter: blur(8px);
}
.room-form textarea {
  flex: 1; min-width: 0; max-height: 120px; resize: none; padding: 12px 16px; border-radius: 22px;
  background: var(--surface-dark); border: 1px solid rgba(127, 137, 165, 0.25); color: var(--text);
  font: inherit; font-size: 15px; outline: none;
}
.room-form textarea:focus { border-color: var(--gold); }
.room-form textarea:disabled { opacity: 0.6; }
.room-form .btn { height: 46px; }

/* Incoming request */
.lotus.ring { animation: ring 1.2s ease-in-out infinite; margin: 14px auto; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-14deg); } 40% { transform: rotate(14deg); } 60% { transform: rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .lotus.ring { animation: none; } }

/* Astrologer desk & application */
.desk-card {
  padding: 18px; border-radius: 22px; background: var(--surface-dark); border: 1px solid var(--gold-border);
}
.desk-card h3 { font-family: var(--font-serif); margin: 6px 0; font-size: 18px; }
.desk-card .btn { margin-top: 12px; }
.online-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.online-row p { margin: 2px 0 0; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 30px; background: var(--surface-elevated);
  border: 1px solid rgba(127, 137, 165, 0.35); transition: background 200ms ease; cursor: pointer;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--text-secondary); transition: transform 200ms ease, background 200ms ease;
}
.switch input:checked + span { background: rgba(122, 229, 176, 0.2); border-color: var(--upright); }
.switch input:checked + span::after { transform: translateX(22px); background: var(--upright); }
.switch input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.stat { padding: 12px; border-radius: 16px; background: var(--surface-elevated); text-align: center; }
.stat .v { display: block; font-family: var(--font-serif); font-size: 20px; color: var(--gold-light); }
.stat .k { font-size: 11px; color: var(--text-secondary); }
.chip-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-check span {
  display: inline-block; padding: 6px 12px; border-radius: 60px; font-size: 12.5px; cursor: pointer; color: var(--text);
  background: var(--surface-elevated); border: 1px solid rgba(127, 137, 165, 0.25);
}
.chip-check input:checked + span { background: rgba(247, 182, 77, 0.15); border-color: var(--gold); color: var(--gold-light); }
.chip-check input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 2px; }
.field textarea {
  padding: 12px 14px; border-radius: 14px; background: var(--surface-elevated); resize: vertical;
  border: 1px solid rgba(127, 137, 165, 0.25); color: var(--text); font: inherit; outline: none;
}
.field textarea:focus, .field input[type="number"]:focus { border-color: var(--gold); }
#applyForm .row-btns { margin-top: 14px; }

/* AI astrologers */
.astro-card.ai {
  background: radial-gradient(100% 120% at 0% 0%, rgba(217, 119, 6, 0.06), transparent 70%),
              linear-gradient(135deg, rgba(124, 58, 237, 0.05), var(--surface-dark) 55%);
  border: 1.2px solid rgba(217, 119, 6, 0.28);
}
[data-theme="dark"] .astro-card.ai {
  background: radial-gradient(100% 120% at 0% 0%, rgba(247, 182, 77, 0.1), transparent 70%),
              linear-gradient(135deg, rgba(132, 55, 241, 0.16), var(--surface-dark) 60%);
  border-color: rgba(247, 182, 77, 0.35);
}
.astro-card.ai .astro-avatar { font-size: 26px; border-color: var(--gold); }
.ai-badge {
  font-size: 9.5px; font-weight: 800; letter-spacing: 1px; padding: 2px 8px; border-radius: 60px;
  color: #fff; background: linear-gradient(135deg, #7c3aed, #a855f7);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}
.bubble.typing { display: inline-flex; gap: 5px; align-items: center; padding: 14px 16px; }
.bubble.typing span:not(.sr) {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gold-light); opacity: 0.4;
  animation: typing 1s infinite ease-in-out;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Chat history */
.history-actions-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; padding: 0 4px;
}
.btn-clear-history {
  background: none; border: 1px solid rgba(255, 101, 132, 0.35); color: #ff8b8b;
  border-radius: 20px; padding: 5px 12px; font-size: 11.5px; font-weight: 600; cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.btn-clear-history:hover { background: rgba(255, 101, 132, 0.15); border-color: rgba(255, 101, 132, 0.6); }
.history-item-wrap {
  position: relative; display: flex; align-items: stretch; gap: 8px; margin-bottom: 10px;
}
.history-item-wrap .history-card { flex: 1; min-width: 0; margin-bottom: 0; }
.btn-delete-chat {
  flex: none; width: 44px; display: grid; place-items: center; border-radius: 18px;
  background: var(--surface-dark); border: 1px solid rgba(127, 137, 165, 0.18);
  color: #ff8b8b; font-size: 16px; cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.btn-delete-chat:hover {
  background: rgba(255, 101, 132, 0.15); border-color: rgba(255, 101, 132, 0.45);
}
.history-card {
  width: 100%; display: flex; flex-direction: column; gap: 4px; text-align: left; color: var(--text);
  padding: 14px 16px; margin-bottom: 10px; border-radius: 18px;
  background: var(--surface-dark); border: 1px solid rgba(127, 137, 165, 0.18);
}
.history-card:hover { border-color: var(--gold-border); }
.history-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.history-top .who { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.history-status { font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); }
.history-status.ended { color: var(--gold-light); }
.history-status.active, .history-status.requested { color: var(--upright); }
.history-preview {
  margin: 4px 0 0; font-size: 13px; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Continued chats and payment history */
.room-divider { display: flex; align-items: center; gap: 10px; margin: 14px 16px; font-size: 11.5px; color: var(--gold-light); }
.room-divider::before, .room-divider::after { content: ''; flex: 1; border-top: 1px dashed var(--gold-border); }
.cont-tag { font-size: 10.5px; font-weight: 600; color: var(--text-secondary); }
.seg {
  display: flex; gap: 4px; max-width: 320px; margin: 0 auto 16px; padding: 3px; border-radius: 25px;
  background: var(--surface-elevated); border: 1px solid var(--gold-border);
}
.seg button { flex: 1; padding: 8px 10px; border: none; border-radius: 22px; background: none; color: var(--text-secondary); font-size: 12.5px; font-weight: 600; }
.seg button.active { background: var(--gold); color: #ffffff; }
[data-theme="dark"] .seg button.active { color: var(--background); }
.history-card.payment { cursor: default; }
.pay-amount { font-family: var(--font-serif); font-size: 17px; color: var(--gold-light); }
.history-status.failed { color: #ff8b8b; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; overflow-wrap: anywhere; }
.pay-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pay-summary > div { padding: 12px; border-radius: 16px; background: var(--surface-elevated); text-align: center; }
.pay-summary .v { display: block; font-family: var(--font-serif); font-size: 20px; color: var(--gold-light); }
.pay-summary .k { font-size: 11px; color: var(--text-secondary); }

/* Luck & Cosmic Meters (Health, Emotional, Intelligence) */
.meter-tabs {
  display: flex; gap: 8px; overflow-x: auto; margin-bottom: 14px; padding: 2px 2px 6px;
  -webkit-overflow-scrolling: touch;
}
.meter-tabs::-webkit-scrollbar { display: none; }
.meter-tab {
  flex: 1; min-width: 90px; padding: 8px 12px; border-radius: 16px; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  background: var(--surface-elevated); border: 1px solid rgba(127, 137, 165, 0.22); color: var(--text-secondary);
  transition: all 180ms cubic-bezier(0.2, 0.8, 0.2, 1); white-space: nowrap;
}
.meter-tab b { font-family: var(--font-serif); font-size: 14px; color: var(--gold-light); }
.meter-tab.active {
  background: var(--surface-highlight); border-color: var(--gold); color: var(--text);
  box-shadow: 0 3px 12px rgba(217, 119, 6, 0.2);
  transform: translateY(-1px);
}
.meter-tab.active b { color: var(--gold); font-weight: 700; }
.meter-tab:hover:not(.active) { border-color: rgba(217, 119, 6, 0.45); transform: translateY(-1px); }

.mini-meters {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0 12px;
}
.mini-meter {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 10px 8px; border-radius: 16px; background: var(--surface-elevated);
  border: 1px solid rgba(127, 137, 165, 0.2); color: var(--text); cursor: pointer; text-align: center;
  transition: all 180ms ease;
  position: relative;
  overflow: hidden;
}
.mini-meter:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(217, 119, 6, 0.16);
}
.mini-meter .m-icon { font-size: 20px; line-height: 1; }
.mini-meter .m-name { font-size: 10px; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; }
.mini-meter .m-score { font-family: var(--font-serif); font-size: 16px; font-weight: 700; color: var(--gold-light); line-height: 1.1; }
.mini-meter .m-lvl { font-size: 10.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

.mini-meter-bar {
  width: 82%; height: 4px; border-radius: 4px; background: rgba(127, 137, 165, 0.2);
  margin: 3px 0 2px; overflow: hidden;
}
.mini-meter-fill {
  height: 100%; border-radius: 4px; background: var(--gold-gradient);
  transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.luck-card {
  margin: 0 0 12px; padding: 18px; border-radius: 24px;
  background: radial-gradient(120% 120% at 0% 0%, rgba(217, 119, 6, 0.09), transparent 60%), var(--surface-dark);
  border: 1.2px solid var(--gold-border);
  box-shadow: var(--card-shadow), 0 8px 26px rgba(217, 119, 6, 0.06);
}
.luck-card[hidden] { display: none; }
.luck-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.luck-body { display: flex; gap: 16px; align-items: center; }
.gauge { position: relative; width: 172px; flex: none; }
.gauge svg { width: 100%; display: block; overflow: visible; }
.gauge-track, .gauge-fill { fill: none; stroke-width: 14; stroke-linecap: round; }
.gauge-track { stroke: rgba(127, 137, 165, 0.18); }
.gauge-fill {
  stroke: url(#luckGrad);
  filter: drop-shadow(0 0 6px rgba(217, 119, 6, 0.35));
  transition: stroke-dashoffset 1.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.gauge-needle { transform-origin: 100px 100px; transform-box: view-box; transition: transform 1.7s cubic-bezier(0.34, 1.4, 0.64, 1); }
.gauge-needle line { stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
.gauge-needle circle { fill: var(--gold); stroke: var(--surface-dark); stroke-width: 3; }
.gauge-value { margin-top: 4px; text-align: center; line-height: 1.1; }
.luck-loading { display: flex; align-items: center; gap: 10px; padding: 18px 4px; color: var(--text-gold); font-size: 13.5px; }
.gauge-value .num {
  display: block; font-family: var(--font-serif); font-size: 32px; font-weight: 700;
  color: var(--gold-light); font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 8px rgba(217, 119, 6, 0.18);
}
.gauge-value .lvl { font-size: 11.5px; color: var(--text-secondary); font-weight: 600; }
.luck-text { flex: 1; min-width: 0; }
.luck-text strong { font-family: var(--font-serif); font-size: 16.5px; }
.luck-text p { margin: 4px 0 8px; font-size: 13px; color: var(--text-secondary); }
.luck-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.luck-chips span { font-size: 11.5px; padding: 3px 9px; border-radius: 60px; background: var(--surface-elevated); border: 1px solid rgba(127, 137, 165, 0.2); }
.luck-chips .warn { border-color: rgba(255, 101, 132, 0.5); color: #ff8b8b; }
.luck-tips { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.luck-tips li { font-size: 13px; padding: 8px 12px; border-radius: 14px; background: var(--surface-elevated); }
.luck-why { margin-top: 10px; font-size: 13px; }
.luck-why summary { cursor: pointer; color: var(--gold-light); font-weight: 600; font-size: 12.5px; }
.luck-why ul { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; }
.luck-empty { display: flex; gap: 12px; align-items: center; }
.luck-empty .btn { height: 38px; padding: 0 16px; flex: none; }
.luck-empty p { margin: 2px 0 0; }
.luck-emoji { font-size: 30px; }
@media (max-width: 480px) {
  .luck-body { flex-direction: column; }
  .gauge { width: 190px; }
}
@media (prefers-reduced-motion: reduce) { .gauge-fill, .gauge-needle { transition: none; } }

/* Panchang details */
.panchang-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.panchang-grid > div { padding: 9px 12px; border-radius: 14px; background: var(--surface-elevated); font-size: 13px; }
.panchang-grid .k, .guide-list .k { display: block; font-size: 10.5px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 2px; }
.guide-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.guide-list .k { width: 100%; }
.guide-list span:not(.k) { font-size: 12.5px; padding: 4px 10px; border-radius: 60px; background: var(--surface-elevated); }
.guide-list.good span:not(.k) { border: 1px solid rgba(122, 229, 176, 0.35); }
.guide-list.bad span:not(.k) { border: 1px solid rgba(255, 101, 132, 0.35); }
.guide-tip { padding: 10px 12px; border-radius: 14px; background: rgba(247, 182, 77, 0.08); border: 1px solid var(--gold-border); }

/* ---------------------------------------------------------------------------
   Admin Panel Styles: Sub-tabs, Search, Responsive Cards, Monospace Chips & Transcripts
--------------------------------------------------------------------------- */

/* Admin controls bar */
.admin-controls-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.admin-subtabs {
  max-width: 100%;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--surface-elevated);
  border: 1px solid var(--gold-border);
  padding: 4px;
  border-radius: 28px;
}

.admin-subtabs button {
  flex: 1 1 auto;
  min-width: 110px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 22px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
  text-align: center;
}

.admin-subtabs button:hover:not(.active) {
  color: var(--text);
  background: rgba(217, 119, 6, 0.08);
}

.admin-subtabs button.active {
  background: var(--gold);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.25);
}

[data-theme="dark"] .admin-subtabs button.active {
  color: var(--background);
}

/* Search bar */
.admin-search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.admin-search-icon {
  position: absolute;
  left: 14px;
  font-size: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.admin-search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  border-radius: 22px;
  background: var(--surface-dark);
  border: 1.2px solid rgba(127, 137, 165, 0.22);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.admin-search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.admin-search-clear {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 50%;
}

.admin-search-clear:hover {
  color: var(--text);
}

/* Admin subviews */
.admin-subview {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-subview[hidden] {
  display: none !important;
}

/* Summary stats & count bar */
.admin-list-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px 6px;
  font-size: 12.5px;
}

.admin-empty-state {
  padding: 48px 16px;
  text-align: center;
  background: var(--surface-dark);
  border-radius: 20px;
  border: 1px dashed var(--gold-border);
}

/* Payment revenue & metric summary cards */
.admin-pay-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.admin-pay-stats .stat-card {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface-dark);
  border: 1px solid var(--gold-border);
  box-shadow: var(--card-shadow);
  text-align: center;
}

.admin-pay-stats .stat-value {
  display: block;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-light);
  line-height: 1.2;
}

.admin-pay-stats .stat-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

/* Base Admin Card */
.admin-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 20px;
  background: var(--surface-dark);
  border: 1.2px solid var(--gold-border);
  box-shadow: var(--card-shadow);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.admin-card:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.1), 0 2px 6px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .admin-card:hover {
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4), 0 0 14px rgba(247, 182, 77, 0.15);
}

.admin-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

/* Chat Card */
.admin-chat-participants {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-participant-seeker, .admin-participant-astro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

.admin-chat-arrow {
  color: var(--gold);
  font-size: 14px;
  opacity: 0.8;
}

.admin-role-tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
}

.admin-role-tag.seeker {
  background: rgba(124, 58, 237, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.25);
}

[data-theme="dark"] .admin-role-tag.seeker {
  background: rgba(132, 55, 241, 0.2);
  color: #a855f7;
}

.admin-role-tag.astro {
  background: rgba(217, 119, 6, 0.12);
  color: var(--gold-dark);
  border: 1px solid var(--gold-border);
}

[data-theme="dark"] .admin-role-tag.astro {
  color: var(--gold);
}

/* Status Badges */
.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--surface-elevated);
  color: var(--text-secondary);
  border: 1px solid rgba(127, 137, 165, 0.2);
}

.admin-badge.paid, .admin-badge.approved, .admin-badge.active {
  background: rgba(5, 150, 105, 0.12);
  color: var(--upright);
  border-color: rgba(5, 150, 105, 0.3);
}

.admin-badge.failed, .admin-badge.rejected, .admin-badge.declined {
  background: rgba(220, 38, 38, 0.12);
  color: var(--error);
  border-color: rgba(220, 38, 38, 0.3);
}

.admin-badge.pending, .admin-badge.requested, .admin-badge.created {
  background: rgba(217, 119, 6, 0.12);
  color: var(--gold);
  border-color: var(--gold-border);
}

.admin-badge.ended {
  background: var(--surface-elevated);
  color: var(--text-muted);
}

/* Meta row */
.admin-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.admin-card-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Last message preview */
.admin-chat-preview {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  padding: 8px 12px;
  background: var(--surface-elevated);
  border-radius: 10px;
  border-left: 3px solid var(--gold);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.admin-chat-preview .preview-label {
  font-style: normal;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.admin-card-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* Monospace chips for IDs */
.mono-chip {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-elevated);
  color: var(--gold-dark);
  border: 1px solid rgba(127, 137, 165, 0.22);
  letter-spacing: 0.2px;
  word-break: break-all;
}

[data-theme="dark"] .mono-chip {
  color: var(--gold-light);
}

/* Payment Card specifics */
.admin-pay-amount-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-pay-amount {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--gold-light);
}

.admin-pay-details-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  padding: 10px 14px;
  background: var(--surface-elevated);
  border-radius: 14px;
}

.pay-detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}

.pay-detail-item .detail-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.pay-detail-item .detail-value {
  color: var(--text);
  font-weight: 500;
}

/* ---------------------------------------------------------------------------
   Chat Transcript Inspection Dialog (#adminTranscriptOverlay)
--------------------------------------------------------------------------- */
.admin-transcript-dialog {
  max-width: 680px;
  width: 100%;
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.admin-transcript-summary-card {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--gold-border);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-transcript-summary-card .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-transcript-summary-card .summary-row.meta-details {
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px dashed rgba(127, 137, 165, 0.2);
  padding-top: 8px;
}

/* Birth details card in transcript */
.admin-birth-card {
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(217, 119, 6, 0.06);
  border: 1px solid var(--gold-border);
  margin-bottom: 14px;
}

.admin-birth-card.empty {
  background: var(--surface-elevated);
  border-color: rgba(127, 137, 165, 0.2);
  padding: 10px 14px;
}

.birth-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 8px;
}

.birth-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 14px;
  font-size: 12.5px;
}

.birth-card-grid .k {
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  margin-right: 4px;
}

.birth-card-grid .v {
  font-weight: 600;
  color: var(--text);
}

.admin-transcript-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin: 6px 0 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(127, 137, 165, 0.15);
}

/* Transcript messages container */
.admin-transcript-messages {
  flex: 1;
  min-height: 180px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 6px 16px;
}

.admin-msg-row {
  display: flex;
  width: 100%;
}

.admin-msg-row.seeker-msg {
  justify-content: flex-end;
}

.admin-msg-row.astro-msg {
  justify-content: flex-start;
}

.admin-msg-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.admin-msg-row.seeker-msg .admin-msg-bubble {
  background: var(--bubble-user);
  border: 1px solid rgba(217, 119, 6, 0.28);
  border-bottom-right-radius: 4px;
}

.admin-msg-row.astro-msg .admin-msg-bubble {
  background: var(--bubble-pandit);
  border: 1px solid var(--gold-border);
  border-bottom-left-radius: 4px;
}

.admin-msg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 11px;
}

.admin-msg-author {
  font-weight: 700;
  color: var(--gold-light);
}

.admin-msg-time {
  color: var(--text-muted);
}

.admin-msg-text {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  word-break: break-word;
}

@media (max-width: 580px) {
  .admin-pay-stats {
    grid-template-columns: 1fr;
  }
  .admin-pay-details-grid {
    grid-template-columns: 1fr;
  }
  .birth-card-grid {
    grid-template-columns: 1fr;
  }
  .admin-msg-bubble {
    max-width: 92%;
  }
}
