@font-face { font-family: "Saravali"; src: url("../fonts/Saravali.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("../fonts/CinzelDecorative-Bold.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/NotoSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/NotoSans-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
    --page: #e0d9cf;
    --card: #f5f1eb;
    --menu: #f9f8fa;
    --input: #fffdf9;
    --ink: #4b3f37;
    --muted: #857d76;
    --line: #d8d0c8;
    --accent: #6c564b;
    --accent-warm: #c0785f;
    --sign: #7c868f;
    --map-line: #a3877a;
    --shadow: 0 4px 15px rgba(0, 0, 0, .1);
    --toolbar-height: 58px;
}

body.dark-theme {
    --page: #1d2430;
    --card: #2a3444;
    --menu: #222a36;
    --input: #202834;
    --ink: #f8f9fa;
    --muted: #adb5bd;
    --line: #495667;
    --accent: #ce9243;
    --accent-warm: #e1a25c;
    --sign: #9aa6b2;
    --map-line: #596779;
    --shadow: 0 4px 20px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
    overflow: hidden;
    color: var(--ink);
    background-color: var(--page);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
    font-family: "Noto Sans", system-ui, sans-serif;
    transition: color .2s ease, background-color .2s ease;
}
body.dark-theme { background-image: none; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }
.super-toolbar {
    position: fixed;
    top: .5rem;
    left: .75rem;
    right: .75rem;
    z-index: 1000;
    height: var(--toolbar-height);
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .45rem .65rem;
    border: 1px solid var(--line);
    border-radius: .3rem;
    background: var(--card);
    box-shadow: var(--shadow);
}
body:not(.dark-theme) .super-toolbar,
body:not(.dark-theme) .dashboard-panel {
    background-image: radial-gradient(circle, rgba(255,255,255,.11), rgba(0,0,0,.035)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}
.toolbar-brand { color: var(--ink); text-decoration: none; }
.brand-name { font: 700 .94rem/1 "Cinzel", serif; }
.toolbar-divider { width: 1px; height: 31px; background: var(--line); }
.product-identity { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.product-icon { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 31px; border-radius: .35rem; color: #fff; background: var(--accent); }
.product-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.product-copy { display: flex; flex-direction: column; line-height: 1.15; }
.product-copy strong { font-size: .7rem; letter-spacing: .12em; }
.product-copy small { color: var(--muted); font-size: .64rem; white-space: nowrap; }
.toolbar-spacer { flex: 1; }
.toolbar-button, .toolbar-icon-button {
    min-height: 32px;
    border: 1px solid var(--line);
    color: var(--accent);
    background: var(--menu);
    cursor: pointer;
    transition: transform .16s ease, color .16s ease, border-color .16s ease, background .16s ease;
}
.toolbar-button:hover:not(:disabled), .toolbar-icon-button:hover { transform: scale(1.035); border-color: var(--accent); color: #fff; background: var(--accent); }
.toolbar-button:disabled { opacity: .42; cursor: not-allowed; }
.pdf-button { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .65rem; border-radius: .3rem; font-size: .69rem; font-weight: 700; }
.pdf-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.toolbar-icon-button { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; padding: 0; border-radius: 999px; text-decoration: none; font-size: 1rem; }
.hathion-link { font-weight: 700; }

.dashboard-workspace {
    height: 100vh;
    padding: calc(var(--toolbar-height) + 1.55rem) .75rem .75rem;
    display: grid;
    grid-template-columns: minmax(270px, .78fr) minmax(410px, 1.25fr) minmax(370px, 1fr);
    gap: .75rem;
}
.dashboard-panel {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: .35rem;
    background-color: var(--card);
    box-shadow: var(--shadow);
}
.panel-header {
    height: 86px;
    min-height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--line);
}
.panel-kicker { display: block; margin-bottom: .18rem; color: var(--accent-warm); font-size: .59rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.panel-header h1, .panel-header h2 { margin: 0; font-family: Georgia, serif; font-size: 1.25rem; font-weight: 400; line-height: 1.15; }
.panel-header h1, .panel-header h2, .panel-intro, .field label, td, .panel-placeholder h3 { color: var(--ink); }
.panel-number { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 .48rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .58rem; }
.panel-scroll { min-height: 0; overflow-y: auto; padding: 1rem 1.15rem; scrollbar-width: thin; }
.panel-intro { margin: 0 0 1rem; color: var(--muted); font-family: Georgia, serif; font-size: .82rem; line-height: 1.5; }

.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(105px, .62fr); gap: .65rem; }
.field { position: relative; min-width: 0; margin-bottom: .8rem; }
.field label { display: block; margin-bottom: .3rem; font-size: .65rem; font-weight: 700; }
.field label span { color: var(--muted); font-weight: 400; }
.field input { width: 100%; min-width: 0; height: 40px; padding: 0 .65rem; border: 1px solid var(--line); border-radius: .25rem; outline: none; color: var(--ink); background: var(--input); font-size: .76rem; }
body.dark-theme .field input[type="date"], body.dark-theme .field input[type="time"] { color-scheme: dark; }
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.field input::placeholder { color: var(--muted); opacity: .7; }
.field small { display: block; margin-top: .28rem; color: var(--muted); font-size: .57rem; line-height: 1.35; }
.location-details { margin: -.15rem 0 .8rem; padding: .65rem; border: 1px solid var(--line); border-radius: .25rem; background: color-mix(in srgb, var(--input) 72%, transparent); }
.coordinate-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.coordinate-field { margin-bottom: .55rem; }
.coordinate-field input { height: 36px; }
.timezone-summary { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; padding-top: .55rem; border-top: 1px solid var(--line); font-size: .62rem; }
.timezone-summary span { color: var(--muted); }
.timezone-summary strong { overflow: hidden; color: var(--ink); font-size: .64rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.location-details > small { display: block; margin-top: .45rem; color: var(--muted); font-size: .54rem; line-height: 1.4; }
.location-input-wrap { position: relative; }
.location-input-wrap input { padding-right: 42px; }
.search-button { position: absolute; inset: 4px 4px 4px auto; width: 32px; border: 0; border-radius: .2rem; color: #fff; background: var(--accent); cursor: pointer; }
.location-results { position: absolute; top: calc(100% - .8rem); left: 0; right: 0; z-index: 20; overflow: hidden; border: 1px solid var(--line); background: var(--menu); box-shadow: var(--shadow); }
.location-option { display: block; width: 100%; padding: .65rem .7rem; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: transparent; text-align: left; cursor: pointer; font-size: .68rem; }
.location-option:hover, .location-option:focus { outline: 0; background: color-mix(in srgb, var(--accent) 10%, var(--menu)); }
.form-message { min-height: 20px; margin: -.2rem 0 .4rem; color: #b34e42; font-size: .63rem; }
.form-message.success { color: color-mix(in srgb, var(--accent) 75%, #3f7f58); }
.primary-button { width: 100%; min-height: 42px; display: flex; align-items: center; justify-content: space-between; padding: 0 .8rem; border: 1px solid var(--accent); border-radius: .25rem; color: #fff; background: var(--accent); cursor: pointer; font-size: .67rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.primary-button:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.primary-button:disabled { opacity: .65; cursor: wait; }
.privacy-note { margin: .62rem 0 0; color: var(--muted); text-align: center; font-size: .55rem; line-height: 1.4; }

.chart-content, .positions-content { min-height: 0; flex: 1; position: relative; }
.panel-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; color: var(--muted); text-align: center; }
.placeholder-symbol { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 50%; color: var(--sign); font: 400 2.3rem/1 "Saravali"; }
.panel-placeholder h3 { margin: 0 0 .4rem; color: var(--ink); font-family: Georgia, serif; font-size: 1.08rem; font-weight: 400; }
.panel-placeholder p { max-width: 280px; margin: 0; font-size: .66rem; line-height: 1.5; }
.positions-placeholder-icon { margin-bottom: .8rem; color: var(--accent-warm); font-size: 1.2rem; }
.chart-panel-header > div { min-width: 0; }
.chart-result { height: 100%; min-height: 0; padding: .8rem 1rem; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.result-subtitle { max-width: 100%; margin: .22rem 0 0; overflow: hidden; color: var(--muted); font-size: .56rem; font-weight: 400; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.vedic-chart { position: relative; width: min(100%, calc(100vh - 190px)); max-width: 540px; aspect-ratio: 1; flex: 0 1 auto; background: color-mix(in srgb, var(--card) 92%, transparent); }
.chart-grid { position: absolute; inset: 0; width: 100%; height: 100%; shape-rendering: geometricPrecision; }
.chart-grid .chart-frame, .chart-grid line { fill: none; stroke: var(--map-line); stroke-width: 2; stroke-linecap: square; stroke-linejoin: miter; }
.chart-grid .chart-junction { fill: var(--map-line); }
.chart-sign, .chart-planets { position: absolute; width: 32%; height: 32%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; }
.chart-sign { z-index: 1; width: auto; height: auto; color: var(--sign); font: 400 clamp(.72rem, 1.3vw, 1rem)/1 "Saravali"; }
.chart-planets { z-index: 2; flex-direction: column; color: var(--ink); font: 400 clamp(1.25rem, 2.2vw, 2rem)/.92 "Saravali"; pointer-events: none; }
.chart-planets.corner { font-size: clamp(1rem, 1.8vw, 1.65rem); }
.chart-planet { position: relative; display: inline-block; white-space: nowrap; pointer-events: auto; }
.sign-mark, .planet-mark { display: inline-block; pointer-events: none; transform-origin: center; transition: transform .18s cubic-bezier(.2, .8, .2, 1); }
.planet-mark .retro { position: relative; top: -.45em; margin-left: .06em; font: 700 .36em/1 "Noto Sans"; }
.pos-planets-1 { top: 25%; left: 50%; } .pos-sign-1 { top: 44.5%; left: 50%; }
.pos-planets-2 { top: 6%; left: 25%; } .pos-sign-2 { top: 20.5%; left: 25%; }
.pos-planets-3 { top: 25%; left: 6%; } .pos-sign-3 { top: 25%; left: 20%; }
.pos-planets-4 { top: 50%; left: 25%; } .pos-sign-4 { top: 50.5%; left: 45%; }
.pos-planets-5 { top: 75%; left: 6%; } .pos-sign-5 { top: 75.5%; left: 20%; }
.pos-planets-6 { top: 94%; left: 25%; } .pos-sign-6 { top: 80%; left: 25%; }
.pos-planets-7 { top: 75%; left: 50%; } .pos-sign-7 { top: 55.5%; left: 50%; }
.pos-planets-8 { top: 94%; left: 75%; } .pos-sign-8 { top: 80%; left: 75%; }
.pos-planets-9 { top: 75%; left: 94%; } .pos-sign-9 { top: 75.5%; left: 80%; }
.pos-planets-10 { top: 50%; left: 75%; } .pos-sign-10 { top: 50.5%; left: 55%; }
.pos-planets-11 { top: 25%; left: 94%; } .pos-sign-11 { top: 25%; left: 80%; }
.pos-planets-12 { top: 6%; left: 75%; } .pos-sign-12 { top: 20.5%; left: 75%; }
.chart-sign[data-relation-kind], .chart-planet[data-relation-kind], tr[data-relation-kind], .planet-cell[data-relation-kind], .sign-cell[data-relation-kind] { cursor: pointer; }
.chart-sign[data-relation-kind], .chart-planet[data-relation-kind] { transition: color .18s ease, filter .18s ease; }
.chart-sign[data-relation-kind]:focus-visible, .chart-planet[data-relation-kind]:focus-visible, .planet-cell[data-relation-kind]:focus-visible, .sign-cell[data-relation-kind]:focus-visible { outline: 2px solid var(--accent-warm); outline-offset: 3px; }
.chart-sign.is-related { z-index: 5; color: var(--accent-warm); filter: drop-shadow(0 0 5px color-mix(in srgb, var(--accent-warm) 50%, transparent)); }
.chart-sign.is-related .sign-mark { transform: scale(1.65); }
.chart-sign.is-context { z-index: 4; color: var(--accent-warm); opacity: .9; }
.chart-sign.is-context .sign-mark { transform: scale(1.28); }
.chart-planet.is-related { z-index: 5; color: var(--accent-warm); text-shadow: 0 0 9px color-mix(in srgb, var(--accent-warm) 55%, transparent); }
.chart-planet.is-related .planet-mark { transform: scale(1.38); }
.chart-sign.is-locked, .chart-planet.is-locked { filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent-warm) 75%, transparent)); }

.table-wrap { height: 100%; overflow: auto; padding: .55rem .85rem .8rem; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; }
th { padding: .48rem .32rem; color: var(--muted); font-size: .52rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: .43rem .32rem; border-top: 1px solid var(--line); font-size: .64rem; }
.planet-cell, .sign-cell { display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.planet-glyph, .sign-glyph { display: inline-grid; place-items: center; width: 20px; flex: 0 0 20px; font-family: "Saravali"; line-height: 1; }
.planet-glyph { color: var(--ink); font-size: 1.25rem; }
.sign-glyph { color: var(--sign); font-size: .95rem; }
.movement-retro { color: var(--accent-warm); font-weight: 700; }
.movement-direct { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.retrograde-note { margin: .65rem .3rem 0; color: var(--muted); font-size: .54rem; }
.retrograde-note strong { color: var(--accent-warm); }
tr[data-relation-kind] td { transition: color .18s ease, background-color .18s ease, border-color .18s ease; }
.sign-cell[data-relation-kind] { width: fit-content; border-radius: .2rem; transition: color .18s ease, transform .18s ease; }
tr.is-related td { color: var(--ink); background: color-mix(in srgb, var(--accent-warm) 14%, transparent); border-color: color-mix(in srgb, var(--accent-warm) 38%, var(--line)); }
tr.is-related td:first-child { box-shadow: inset 2px 0 0 var(--accent-warm); }
tr.is-related .planet-glyph, tr.is-related .sign-glyph, .sign-cell.is-related { color: var(--accent-warm); }
.sign-cell.is-related { transform: translateX(2px) scale(1.04); }
tr.is-locked td { background: color-mix(in srgb, var(--accent-warm) 20%, transparent); }

.pdf-sheet {
    position: fixed;
    left: -10000px;
    top: 0;
    z-index: -1;
    width: 794px;
    min-height: 1123px;
    padding: 54px;
    color: #111;
    background: #fff;
    font-family: "Noto Sans", sans-serif;
}
.pdf-sheet.is-rendering { display: block; }
.pdf-header { display: flex; align-items: center; gap: 18px; padding-bottom: 20px; border-bottom: 1px solid #d5d5d5; }
.pdf-brand { padding-right: 18px; border-right: 1px solid #d5d5d5; font: 700 20px/1 "Cinzel"; }
.pdf-header div { display: flex; flex-direction: column; }
.pdf-header strong { font: 400 20px/1.2 Georgia, serif; }
.pdf-header small { color: #111; font-size: 10px; }
.pdf-native-data { padding: 24px 0 20px; text-align: center; }
.pdf-native-data h2 { margin: 0 0 5px; font: 400 20px/1.2 Georgia, serif; }
.pdf-native-data p { margin: 0; color: #111; font-size: 10px; }
.pdf-grid { display: flex; flex-direction: column; gap: 24px; }
.pdf-grid > div:first-child { display: flex; flex-direction: column; align-items: center; }
.pdf-grid > div:first-child h3 { align-self: stretch; }
.pdf-grid > div > h3 { text-align: center; }
.pdf-grid h3 { margin: 0 0 12px; color: #111; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.pdf-chart { width: 470px; background: #fbfaf7; }
.pdf-chart .chart-grid .chart-frame, .pdf-chart .chart-grid line { stroke: #51433d; }
.pdf-chart .chart-grid .chart-junction { fill: #51433d; }
.pdf-chart .chart-sign { color: #111; font-size: 14px; }
.pdf-chart .chart-planets { color: #111; font-size: 24px; }
.pdf-chart .chart-planets.corner { font-size: 20px; }
.pdf-sheet th { color: #111; font-size: 7px; }
.pdf-sheet td { padding: 6px 4px; border-color: #d8d8d8; color: #111; font-size: 9px; }
.pdf-sheet .planet-glyph { color: #111; font-size: 16px; }
.pdf-sheet .sign-glyph { color: #111; font-size: 13px; }

@media (max-width: 1080px) {
    body { overflow: auto; }
    .dashboard-workspace { height: auto; min-height: 100vh; grid-template-columns: minmax(260px, .75fr) minmax(390px, 1.25fr); }
    .positions-panel { grid-column: 1 / -1; min-height: 520px; }
    .input-panel, .chart-panel { min-height: calc(100vh - var(--toolbar-height) - 2.3rem); }
}

@media (max-width: 720px) {
    .super-toolbar { left: .45rem; right: .45rem; gap: .45rem; padding-left: .5rem; padding-right: .5rem; }
    .product-copy small, .pdf-button span, .hathion-link { display: none; }
    .pdf-button { width: 32px; padding: 0; justify-content: center; border-radius: 999px; }
    .dashboard-workspace { padding: calc(var(--toolbar-height) + 1.35rem) .45rem .45rem; grid-template-columns: 1fr; gap: .55rem; }
    .input-panel, .chart-panel, .positions-panel { min-height: auto; grid-column: auto; }
    .input-panel { min-height: 560px; }
    .chart-panel { min-height: 520px; }
    .positions-panel { min-height: 570px; }
    .vedic-chart { width: min(100%, 430px); }
    .chart-planets { font-size: clamp(1.2rem, 7vw, 1.8rem); }
    .chart-planets.corner { font-size: clamp(1rem, 5.8vw, 1.5rem); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
