:root {
  --bg: #faf3e7;
  --paper: #fffdfa;
  --ink: #271b13;
  --muted: #776759;
  --line: #e7d6bd;
  --saffron: #d87827;
  --saffron-dark: #ad5218;
  --maroon: #672b26;
  --green: #2f765d;
  --red: #a23c31;
  --shadow: 0 18px 42px rgba(70, 42, 16, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Nirmala UI", "Mangal", Inter, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: radial-gradient(circle at 76% 2%, rgba(216,120,39,.14), transparent 34rem), var(--bg);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 33px;
  padding: 25px 19px;
  background: var(--maroon);
  color: #fff5e4;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 48px; height: 48px; display: grid; place-items: center;
  border-radius: 14px; background: #ffdc99; color: var(--maroon);
  font-size: 25px; font-weight: 800;
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 18px; }
.brand span { color: #e7c7a2; font-size: 13px; }
.nav { display: grid; gap: 8px; }
.nav-item {
  padding: 13px 14px; color: #eedac7; text-decoration: none;
  border: 1px solid transparent; border-radius: 12px; font-weight: 650;
}
.nav-item:hover, .nav-item.active {
  color: white; background: rgba(255,226,175,.12); border-color: rgba(255,226,175,.24);
}
.sidebar-card {
  margin-top: auto; padding: 17px; border: 1px solid rgba(255,223,169,.2);
  border-radius: 16px; background: rgba(27,12,10,.16);
}
.sidebar-card .eyebrow { color: #edbd7b; }
.sidebar-card strong { display: block; margin-bottom: 8px; font-size: 20px; }
.sidebar-card p { margin-bottom: 0; color: #e6c9b1; font-size: 13px; line-height: 1.65; }

.main { min-width: 0; max-width: 1260px; padding: 33px 38px 45px; }
.topbar { margin-bottom: 24px; }
.eyebrow {
  margin-bottom: 7px; color: #956636; font-size: 11px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
}
h1 { max-width: 780px; margin-bottom: 10px; font-size: clamp(38px, 4.7vw, 55px); line-height: 1.1; }
h1 span { color: var(--saffron-dark); }
.hero-copy { max-width: 740px; margin-bottom: 0; color: var(--muted); font-size: 17px; line-height: 1.6; }

.birth-panel, .chart-panel, .house-panel, .planet-panel, .method-panel {
  border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: var(--shadow);
}
.birth-panel { padding: 23px; margin-bottom: 24px; }
.panel-heading { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; margin-bottom: 20px; }
.panel-heading h2, .method-panel h2 { margin-bottom: 0; font-size: 27px; }
.text-button {
  padding: 7px 0; border: 0; background: transparent; color: var(--saffron-dark); font-weight: 750;
}
.input-grid {
  display: grid; grid-template-columns: 1fr 180px 160px minmax(270px, 1.35fr); gap: 13px;
}
label { display: grid; gap: 7px; color: #563b30; font-size: 13px; font-weight: 750; }
input {
  width: 100%; min-height: 47px; padding: 0 12px;
  border: 1px solid #dfceb6; border-radius: 11px; color: var(--ink); background: white;
}
input:focus { outline: 3px solid rgba(216,120,39,.18); border-color: var(--saffron); }
.place-row { display: flex; gap: 7px; }
.place-row input { min-width: 0; }
.primary-button, .secondary-button {
  min-height: 47px; padding: 0 16px; border-radius: 11px; font-weight: 760; white-space: nowrap;
}
.primary-button { color: white; border: 1px solid var(--saffron); background: var(--saffron); }
.primary-button:hover { background: var(--saffron-dark); border-color: var(--saffron-dark); }
.secondary-button { color: #654435; border: 1px solid var(--line); background: #fffaf4; }
.location-results {
  display: grid; gap: 7px; margin-top: 14px; padding: 10px; border-radius: 12px; background: #fff8ec;
}
.location-option {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid transparent; border-radius: 9px; background: transparent; text-align: left;
}
.location-option:hover { background: white; border-color: var(--line); }
.location-option span { color: var(--muted); font-size: 13px; }
.lookup-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.coordinates { margin-top: 14px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fffaf4; }
.coordinates summary { cursor: pointer; color: #6a4432; font-size: 14px; font-weight: 750; }
.coordinates .muted { margin: 12px 0; }
.coordinate-grid { display: grid; grid-template-columns: repeat(3, minmax(150px, 1fr)); gap: 12px; }
.muted { color: var(--muted); font-size: 13px; }
.calculation-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line);
}
.calculation-bar p { margin: 0; color: var(--muted); font-size: 14px; }
.status { min-height: 20px; margin: 16px 0 0; color: var(--green); font-weight: 650; }
.status.error { color: var(--red); }
.hidden { display: none !important; }
.report-mode .topbar,
.report-mode .birth-panel,
.report-mode .method-panel { display: none; }
.report-mode .nav-item[href="#birthInput"],
.report-mode .nav-item[href="#method"] { display: none; }
.report-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  margin-bottom: 20px; padding: 22px 24px; border-radius: 20px;
  color: #fff6eb; background: var(--maroon);
}
.report-header .eyebrow { color: #efbb78; }
.report-header h2 { margin-bottom: 6px; font-size: clamp(28px, 3vw, 35px); }
.report-header p:last-child { margin-bottom: 0; color: #f0d8c3; }
.report-header .secondary-button {
  color: #fff4df; border-color: rgba(255, 230, 186, .38); background: rgba(255, 245, 224, .1);
}

.summary-strip {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin-bottom: 20px;
}
.summary-card {
  padding: 15px 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--paper);
}
.summary-card span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.summary-card strong { display: block; color: #4c2921; font-size: 16px; }
.chart-grid { display: grid; grid-template-columns: minmax(510px, 1fr) 382px; align-items: start; gap: 18px; margin-bottom: 20px; }
.chart-panel { padding: 20px; }
.pill {
  padding: 7px 12px; border-radius: 99px; color: #99521c; background: #fff0da; font-size: 12px; font-weight: 750;
}
.kundli-chart { display: block; width: min(100%, 600px); margin: 0 auto 12px; }
.chart-paper { fill: #fffcf5; stroke: #633324; stroke-width: 3; }
.chart-lines { fill: none; stroke: #8e5843; stroke-width: 2.5; }
.chart-house { cursor: pointer; outline: none; }
.chart-house .selection {
  fill: transparent; stroke: transparent; stroke-width: 2; transition: fill .15s ease, stroke .15s ease;
}
.chart-house:hover .selection, .chart-house:focus .selection { fill: #fff2df; stroke: #df9642; }
.chart-house.active .selection { fill: #ffe1af; stroke: var(--saffron); }
.chart-house .rashi { fill: #a96327; text-anchor: middle; font-size: 13px; font-weight: 800; }
.chart-house .house-no { fill: #806456; text-anchor: middle; font-size: 10px; font-weight: 700; }
.chart-house .planet-label { fill: #332018; text-anchor: middle; font-size: 12px; font-weight: 750; }
.chart-house .asc-label { fill: var(--saffron-dark); font-size: 11px; font-weight: 800; }
.chart-caption {
  margin: 0; padding: 12px 13px; border-radius: 12px; color: var(--muted); background: #fbf4e9;
  font-size: 13px; line-height: 1.55;
}
.house-panel { position: sticky; top: 20px; padding: 23px; }
.house-panel h2 { margin-bottom: 5px; font-size: 28px; }
.house-sign { color: var(--saffron-dark); font-size: 17px; font-weight: 750; }
.house-focus { margin: 17px 0; color: var(--muted); line-height: 1.6; }
.placement-list { display: grid; gap: 10px; }
.placement {
  padding: 12px; border: 1px solid #edddc7; border-radius: 11px; background: #fff8ec;
}
.placement strong { display: block; margin-bottom: 4px; }
.placement span { color: var(--muted); font-size: 13px; }
.empty-placement { padding: 15px; color: var(--muted); border: 1px dashed var(--line); border-radius: 11px; font-size: 14px; }
.empty-placement strong { display: block; margin-bottom: 7px; color: #543329; font-size: 15px; }
.empty-placement p { margin: 0 0 9px; line-height: 1.55; }
.empty-placement span { display: block; color: var(--saffron-dark); font-weight: 650; line-height: 1.5; }

.planet-panel { padding: 23px; margin-bottom: 20px; }
.panel-copy { margin: 9px 0 0; color: var(--muted); line-height: 1.55; }
.house-reading-grid { display: grid; gap: 12px; margin-bottom: 20px; }
.house-reading {
  padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fffaf4;
}
.house-reading-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 13px;
}
.house-reading-head h3 { margin-bottom: 5px; font-size: 20px; }
.house-reading-head p { margin: 0; color: var(--saffron-dark); font-weight: 700; font-size: 13px; }
.graha-count {
  padding: 6px 10px; border-radius: 99px; color: #99521c; background: #ffebca; font-size: 12px; font-weight: 750;
}
.house-purpose { margin: 0 0 13px; color: var(--muted); line-height: 1.55; }
.graha-readings { display: grid; gap: 9px; }
.graha-reading {
  padding: 12px 13px; border-left: 3px solid var(--saffron); border-radius: 0 10px 10px 0; background: white;
}
.graha-reading strong { display: block; margin-bottom: 5px; color: #553027; }
.graha-reading p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.position-details { padding-top: 5px; }
.position-details summary {
  cursor: pointer; margin-bottom: 14px; color: var(--saffron-dark); font-weight: 760;
}
.planet-table { display: grid; gap: 6px; }
.table-header, .planet-row {
  display: grid; grid-template-columns: 1.3fr 1.05fr .9fr .65fr .7fr; gap: 12px; align-items: center;
}
.table-header { padding: 0 13px 8px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.planet-row { padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fffaf4; font-size: 14px; }
.planet-row strong { display: flex; align-items: center; gap: 8px; }
.symbol { display: inline-grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; color: var(--maroon); background: #ffe8c2; font-size: 17px; }
.retro { color: var(--red); font-size: 12px; font-weight: 750; }
.direct { color: var(--muted); font-size: 12px; }
.reading-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.reading-card { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fffaf4; }
.reading-card h3 { margin-bottom: 5px; font-size: 18px; }
.reading-meta { margin-bottom: 9px; color: var(--saffron-dark); font-size: 13px; font-weight: 750; }
.reading-card p { margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.56; }

.method-panel { padding: 23px; margin-top: 20px; }
.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.method-grid article { padding: 15px; border-radius: 13px; background: #fff8ec; }
.method-grid strong { display: block; margin-bottom: 7px; color: #552b22; }
.method-grid p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.attribution { margin: 19px 0 0; color: var(--muted); font-size: 13px; }
.attribution a { color: var(--saffron-dark); }

@media (max-width: 1080px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 18px; display: block; }
  .nav { display: flex; overflow-x: auto; margin-top: 16px; }
  .nav-item { white-space: nowrap; }
  .sidebar-card { display: none; }
  .main { padding: 26px 18px 38px; }
  .input-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
  .house-panel { position: static; }
}
@media (max-width: 720px) {
  .input-grid, .coordinate-grid, .summary-strip, .method-grid, .reading-grid { grid-template-columns: 1fr; }
  .calculation-bar { display: block; }
  .calculation-bar .primary-button { width: 100%; margin-top: 15px; }
  .chart-panel, .house-panel, .birth-panel, .planet-panel, .method-panel { padding: 16px; }
  .table-header { display: none; }
  .planet-row { grid-template-columns: 1fr 1fr; }
  .report-header, .house-reading-head { display: block; }
  .report-header .secondary-button { margin-top: 15px; width: 100%; }
  .graha-count { display: inline-block; margin-top: 10px; }
}
