:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #d9dce1;
  --text: #1c1f24;
  --text-muted: #6b7280;
  --accent: #2f6feb;
  --accent-contrast: #ffffff;
  --lagna-bg: #fff2cc;
  --lagna-border: #d9a520;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1b1e24;
  --border: #2e333c;
  --text: #e6e8eb;
  --text-muted: #9aa1ac;
  --accent: #5b9dff;
  --accent-contrast: #0b1220;
  --lagna-bg: #3a3010;
  --lagna-border: #d9a520;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

[lang="ta"] {
  font-family: "Noto Sans Tamil", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.app {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  font-size: 26px;
  margin: 0 0 4px;
}

.app-description {
  color: var(--text-muted);
  margin: 0 0 20px;
  font-size: 14px;
}
.small {
  font-size: 13px;
}

/* --- site header --- */
.site-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.site-header__brand {
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.site-header__brand:hover {
  text-decoration: underline;
}
.site-header__divider {
  color: var(--text-muted);
  font-weight: 400;
}
.site-header__title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-muted);
  white-space: nowrap;
}
.toolbar-spacer {
  flex: 1;
}

.btn,
.toggle-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover,
.toggle-btn:hover {
  border-color: var(--accent);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
  font-weight: 600;
}
.icon-btn {
  padding: 6px 10px;
}

/* --- toolbar/form --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.toolbar label {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}
.toolbar select,
.toolbar input[type="text"] {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.toolbar select:focus,
.toolbar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- location search --- */
.location-search {
  position: relative;
}
.location-search__results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 10;
  min-width: 220px;
  max-height: 260px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.location-search__results li {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}
.location-search__results li:hover,
.location-search__results li:focus {
  background: var(--bg);
  outline: none;
}
.location-status {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0;
}

.notice-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}

/* --- result panels --- */
.result-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.result-panel h2 {
  font-size: 18px;
  margin: 0 0 8px;
}
.result-panel h3 {
  font-size: 14px;
  margin: 0 0 8px;
  text-align: center;
  color: var(--text-muted);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
}
.detail-table tr {
  border-bottom: 1px solid var(--border);
}
.detail-table tr:last-child {
  border-bottom: none;
}
.detail-table td,
.detail-table th {
  padding: 8px 4px;
  font-size: 14px;
  text-align: left;
}
.detail-table td:first-child {
  color: var(--text-muted);
  width: 40%;
}
.planet-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
}
.planet-table td:first-child {
  width: auto;
}
.table-scroll {
  overflow-x: auto;
}

.disclaimer {
  margin-top: 24px;
}

/* --- South Indian chart --- */
.charts-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.chart-block {
  flex: 0 0 auto;
}
.south-chart {
  display: grid;
  grid-template-columns: repeat(4, 68px);
  grid-template-rows: repeat(4, 68px);
  gap: 2px;
  background: var(--border);
  border: 2px solid var(--border);
}
.south-chart__cell {
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  position: relative;
}
.south-chart__cell--lagna {
  background: var(--lagna-bg);
  box-shadow: inset 0 0 0 2px var(--lagna-border);
}
.south-chart__center {
  grid-row: 2 / span 2;
  grid-column: 2 / span 2;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}
.south-chart__grahas {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  font-size: 12px;
  line-height: 1.3;
}
.south-chart__graha {
  color: var(--text);
}
.south-chart__lagna-mark {
  color: var(--lagna-border);
  font-weight: 700;
  font-size: 11px;
}

/* --- Vimshottari Dasha drill-down --- */
.dasha-level {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  padding: 6px 10px;
  background: var(--bg);
}
.dasha-level summary {
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dasha-level--antar {
  margin: 6px 0 0;
  background: var(--surface);
}
.dasha-range {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: auto;
}
.dasha-pratyantar-table {
  margin-top: 6px;
}
.dasha-pratyantar-table td {
  font-size: 13px;
  padding: 4px;
}

@media (max-width: 480px) {
  .toolbar-group {
    gap: 6px;
  }
  .south-chart {
    grid-template-columns: repeat(4, 60px);
    grid-template-rows: repeat(4, 60px);
  }
}
