:root {
  --gold: #7a5c2e; --gold-light: #b08a3e; --gold-pale: #f0e6cf;
  --bg: #f6f1e7; --card: #fffdf6; --ink: #2c2416; --dim: #8a7f6c;
  --accent: #c0392b; --ok: #2e7d32; --warn-bg: #fdeeea; --warn-border: #e5b1a8;
  --line: #e5dcc8; --chip-bg: #f6efdd; --nav-bg: #f9f4e8;
  --shadow: 0 2px 10px rgba(122, 92, 46, .08);
}
[data-theme="dark"] {
  --gold: #d4b06a; --gold-light: #caa14f; --gold-pale: #3a3222;
  --bg: #191611; --card: #211d16; --ink: #e8dfc9; --dim: #9a8f79;
  --accent: #e57368; --ok: #7cb76f; --warn-bg: #3a2420; --warn-border: #6e3a30;
  --line: #3a3325; --chip-bg: #2a251b; --nav-bg: #1e1a13;
  --shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; font: 16px/1.65 "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.hero { text-align: center; padding: 44px 16px 28px; background: linear-gradient(180deg, var(--gold-pale), var(--bg)); border-bottom: 1px solid var(--line); }
.hero h1 { margin: 0 0 6px; color: var(--gold); font-size: 2.1rem; }
.hero .sub { color: var(--dim); margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px 28px; margin: 18px 0; box-shadow: var(--shadow); }
h1 { color: var(--gold); font-size: 1.9rem; }
h2 { color: var(--gold); border-bottom: 2px solid var(--line); padding-bottom: 8px; margin-top: 0; }
h3 { color: var(--gold); margin-bottom: 6px; }

/* форма */
.form .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form .span2 { grid-column: span 2; }
label { display: flex; flex-direction: column; gap: 6px; font-size: .92rem; color: var(--dim); }
input, select { padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; background: var(--card); color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--gold-light); border-color: var(--gold-light); }
input[name="time"] { width: 110px; text-align: center; font-size: 1.05rem; font-variant-numeric: tabular-nums; letter-spacing: 0.08em; }
.btn { display: inline-block; margin-top: 14px; padding: 12px 30px; background: linear-gradient(135deg, #8a6a34, var(--gold-light)); color: #fff; border: 0; border-radius: 11px; font-size: 1.04rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--chip-bg); color: var(--gold); border: 1px solid var(--line); }
.hint { font-size: .82rem; color: var(--dim); }
.city-list { list-style: none; margin: -8px 0 12px; padding: 4px; max-height: 230px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; position: relative; z-index: 20; box-shadow: var(--shadow); }
.city-list li { padding: 9px 11px; cursor: pointer; font-size: .9rem; border-radius: 7px; }
.city-list li:hover { background: var(--chip-bg); }
.city-list .city-loading { cursor: default; color: var(--dim); font-style: italic; }
.city-list .city-loading:hover { background: transparent; }
.chips-popular { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip-btn { padding: 6px 13px; background: var(--chip-bg); border: 1px solid var(--line); border-radius: 999px; font-size: .84rem; cursor: pointer; color: var(--ink); }
.chip-btn:hover { border-color: var(--gold-light); }
.expert { margin: 18px 0 0; color: var(--dim); }
.expert .grid { margin-top: 10px; }
.feat-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.feat-grid li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; font-size: .92rem; }
footer { text-align: center; color: var(--dim); font-size: .8rem; padding: 26px; }

/* отчёт: шапка и сайдбар */
.rep-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; max-width: 1180px; margin: 0 auto; padding: 12px 16px; }
.rh-right { display: flex; gap: 8px; flex-wrap: wrap; }
.rh-right .btn { margin-top: 0; }
.back { color: var(--gold); text-decoration: none; align-self: center; }
.layout { display: grid; grid-template-columns: 168px 1fr; gap: 12px; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.side { position: sticky; top: 12px; align-self: start; display: flex; flex-direction: column; gap: 2px; background: var(--nav-bg); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; max-height: calc(100vh - 24px); overflow: auto; }
.side a { text-decoration: none; color: var(--dim); font-size: .84rem; padding: 6px 10px; border-radius: 8px; }
.side a:hover { color: var(--gold); background: var(--chip-bg); }
.side a.active { color: var(--card); background: var(--gold); font-weight: 600; }

/* чипы паспорта */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 14px; }
.chip { background: var(--chip-bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: .87rem; }
.chip b { color: var(--gold); font-weight: 600; }
.meta { color: var(--dim); font-size: .9rem; }

/* таблицы */
table { width: 100%; border-collapse: collapse; font-size: .88rem; margin: 10px 0; }
th, td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
th { background: var(--chip-bg); color: var(--gold); }
tr.active-row { background: var(--warn-bg); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dim { color: var(--dim); font-size: .85rem; }
.bar { position: relative; background: var(--chip-bg); border-radius: 6px; height: 18px; min-width: 110px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-light), var(--gold)); border-radius: 6px; }
.bar span { position: absolute; right: 6px; top: 0; font-size: .72rem; line-height: 18px; color: var(--ink); }

/* карты и вкладки */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 4px 0 14px; }
.tab { padding: 8px 16px; border: 1px solid var(--line); background: var(--chip-bg); color: var(--ink); border-radius: 999px; cursor: pointer; font-size: .88rem; }
.tab.active { background: var(--gold); color: var(--card); font-weight: 600; border-color: var(--gold); }
.tab.small { padding: 6px 12px; font-size: .8rem; }
.style-toggle { margin-left: auto; display: flex; gap: 6px; }
.charts-row { display: flex; flex-wrap: wrap; gap: 22px; justify-content: center; }
.chart-box { width: 400px; max-width: 94vw; }
.chart-box.hidden { display: none; }
.legend { font-size: .82rem; color: var(--dim); }
.chart-svg { width: 100%; height: auto; }
.chart-svg .bgc { fill: var(--card); stroke: var(--gold); stroke-width: 2; }
.chart-svg .ln { stroke: var(--gold); stroke-width: 1.6; fill: none; }
.chart-svg .ttl { font-size: 14px; fill: var(--gold); font-weight: 700; }
.chart-svg .cs { font-size: 10px; fill: var(--gold-light); }
.chart-svg .hn { font-size: 10px; fill: var(--dim); }
.chart-svg .asc-mark { font-size: 11px; fill: var(--accent); font-weight: 700; }
.chart-svg .asc-line { stroke: var(--accent); stroke-width: 2.6; }
.chart-svg .pl { font-size: 13px; font-weight: 700; fill: var(--ink); }
.chart-svg .dg { font-size: 9px; fill: var(--dim); }

/* аштакаварга */
.bav-table td, .bav-table th { text-align: center; padding: 5px 6px; }
.bav-table td:first-child, .bav-table th:first-child { text-align: left; }
.bav-table .b5 { background: #e3efdd; }
.bav-table .b0 { background: #f6e3de; }
.sav-row td { background: var(--chip-bg); }
.sav-bars { width: 100%; height: auto; }
.dasha-timeline { width: 100%; height: auto; }

/* йоги и теги */
.yogas li { margin-bottom: 11px; }
.tag { font-size: .72rem; padding: 2px 9px; border-radius: 999px; background: var(--chip-bg); color: var(--dim); vertical-align: middle; }
.tag.сильная, .tag.крепкая { background: #e3efdd; color: var(--ok); }
.tag.средняя { background: var(--gold-pale); color: var(--gold); }
.tag.слабая { background: #f6e3de; color: var(--accent); }

/* даши */
.current-dasha { background: var(--chip-bg); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; font-size: 1.02rem; }
.dashas details.maha { border: 1px solid var(--line); border-radius: 10px; margin: 7px 0; padding: 0 14px; background: var(--card); }
.dashas summary { cursor: pointer; padding: 11px 0; font-size: .95rem; list-style: none; }
.dashas summary::before { content: '▸ '; color: var(--gold); }
.dashas details[open] summary::before { content: '▾ '; }
.dashas details.active > summary { color: var(--accent); font-weight: 700; }
.maha-text { font-size: .9rem; color: var(--dim); border-left: 3px solid var(--gold-light); padding-left: 12px; }

.warn { background: var(--warn-bg); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 8px; }

/* справка */
.gloss { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 8px 0; }
.gloss summary { cursor: pointer; color: var(--gold); font-weight: 600; }
.footer-note { text-align: center; padding: 20px 0 40px; }

/* прогнозы и тематические секции */
.exec-summary { font-size: 1.08rem; line-height: 1.75; }
.forecast-month { border-left: 4px solid var(--line); padding: 12px 16px; margin: 12px 0; border-radius: 0 10px 10px 0; background: var(--chip-bg); }
.forecast-month.хорошо { border-left-color: var(--ok); }
.forecast-month.нейтрально { border-left-color: var(--gold-light); }
.forecast-month.осторожно { border-left-color: #e67e22; }
.forecast-month.сложно { border-left-color: var(--accent); }
.forecast-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.forecast-period { color: var(--dim); font-size: .85rem; margin: 2px 0 4px; }
.forecast-current { font-size: 1.05rem; line-height: 1.7; padding: 12px 16px; background: var(--chip-bg); border-radius: 10px; border-left: 4px solid var(--gold); }
.tag.хорошо { background: #e8f5e9; color: #2e7d32; }
.tag.нейтрально { background: #fff8e1; color: #9e7c0d; }
.tag.осторожно { background: #fff3e0; color: #e65100; }
.tag.сложно { background: #fdeeea; color: #c0392b; }
@media (prefers-color-scheme: dark), [data-theme="dark"] {
  .tag.хорошо { background: #1b3a1e; color: #7cb76f; }
  .tag.нейтрально { background: #3a3210; color: #d4b06a; }
  .tag.осторожно { background: #3a2a10; color: #e69540; }
  .tag.сложно { background: #3a2020; color: #e57368; }
}

/* оверрей загрузки */
#loading { position: fixed; inset: 0; background: rgba(20, 16, 8, .55); display: none; z-index: 50; backdrop-filter: blur(2px); }
#loading.on { display: flex; align-items: center; justify-content: center; }
#loading .box { background: var(--card); color: var(--gold); padding: 26px 42px; border-radius: 14px; font-size: 1.05rem; box-shadow: var(--shadow); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .7; } }

/* кнопка «наверх» */
.back-top { position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px; border-radius: 50%; background: var(--gold); color: #fff; border: none; font-size: 1.3rem; cursor: pointer; opacity: 0; transform: translateY(20px); transition: opacity .3s, transform .3s; z-index: 40; box-shadow: var(--shadow); }
.back-top.on { opacity: 1; transform: translateY(0); }
.back-top:hover { background: var(--gold-light); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; flex-direction: row; flex-wrap: wrap; max-height: none; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .form .grid { grid-template-columns: 1fr; }
  .form .span2 { grid-column: span 1; }
  .tbl-planets { font-size: .72rem; }
  .card { padding: 16px 14px; }
}
@media print {
  .no-print, .rep-header, .side, footer, .back-top { display: none !important; }
  .layout { display: block; }
  body { background: #fff; }
  .card { border: 1px solid #bbb; box-shadow: none; page-break-inside: avoid; }
  .chart-box.hidden[data-style="south"] { display: none !important; }
  .chart-box[data-style="north"] { display: block !important; }
  .forecast-month { page-break-inside: avoid; }
}

/* встроенное предупреждение у поля формы */
.field-warn { margin-top: 6px; font-size: .85rem; color: var(--accent); font-weight: 600; }
input[aria-invalid="true"] { border-color: var(--accent); }

/* ============ БЛОК ПОДДЕРЖКИ ПРОЕКТА ============ */
:root {
  --donate-bg1: #fdeeea; --donate-bg2: #fbe2dc;
  --donate-border: #e8b4aa; --donate-title: #a8321f;
  --donate-btn1: #d0452f; --donate-btn2: #b8331f;
}
[data-theme="dark"] {
  --donate-bg1: #35211d; --donate-bg2: #2c1a17;
  --donate-border: #6e3a30; --donate-title: #f0897b;
  --donate-btn1: #c14733; --donate-btn2: #9d3323;
}

.support-box {
  margin: 30px 0 22px;
  padding: 28px 30px;
  background: linear-gradient(135deg, var(--donate-bg1), var(--donate-bg2));
  border: 1px solid var(--donate-border);
  border-left: 5px solid var(--donate-btn1);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(192, 57, 43, .13);
}
.support-inner { display: flex; gap: 22px; align-items: flex-start; }
.support-icon { font-size: 2.7rem; line-height: 1; flex-shrink: 0; }
.support-text { flex: 1; min-width: 0; }
.support-box h2 {
  margin: 0 0 10px;
  color: var(--donate-title);
  font-size: 1.4rem;
  border-bottom: none;
  padding-bottom: 0;
}
.support-box p { margin: 0 0 16px; line-height: 1.7; color: var(--ink); }
.support-note { font-size: .9rem; color: var(--dim); margin: 14px 0 0 !important; font-style: italic; }
.support-actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }

.btn-donate {
  margin-top: 0;
  background: linear-gradient(135deg, var(--donate-btn1), var(--donate-btn2));
  box-shadow: 0 3px 12px rgba(192, 57, 43, .32);
  font-size: 1.06rem;
  padding: 13px 30px;
}
.btn-donate:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-newcalc {
  margin-top: 0;
  background: var(--card);
  color: var(--donate-title);
  border: 2px solid var(--donate-border);
  font-size: 1.02rem;
  padding: 11px 26px;
}
.btn-newcalc:hover { background: var(--donate-bg1); border-color: var(--donate-btn1); }
.btn-donate, .btn-newcalc { transition: filter .18s, transform .18s, background .18s, border-color .18s; }

@media (max-width: 620px) {
  .support-box { padding: 22px 18px; }
  .support-inner { flex-direction: column; gap: 12px; }
  .support-icon { font-size: 2.2rem; }
  .support-actions { flex-direction: column; align-items: stretch; }
  .support-actions .btn { text-align: center; width: 100%; }
}
