:root {
  --bg: #f6f5f1; --card: #fff; --text: #1c1c1c; --muted: #6b6b6b; --line: #e4e2dc;
  --accent: #ffdd2d; --accent-text: #1c1c1c; --good: #1f8a4c; --bad: #c4352b;
  --work: #ffffff; --off: #ece9e1; --holiday: #ffd9d4; --vac: #fff3a8;
}
/* Тёмная тема: по системе или по colorScheme Telegram (классы .dark/.light на <html> выставляет app.js) */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg: #151515; --card: #1f1f1f; --text: #eee; --muted: #9a9a9a; --line: #333;
    --good: #4cc27d; --bad: #ff6b5e;
    --work: #262626; --off: #333; --holiday: #5a2a26; --vac: #5c5216;
  }
}
:root.dark {
  --bg: #151515; --card: #1f1f1f; --text: #eee; --muted: #9a9a9a; --line: #333;
  --good: #4cc27d; --bad: #ff6b5e;
  --work: #262626; --off: #333; --holiday: #5a2a26; --vac: #5c5216;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 28px; margin: 0 0 4px; }
.lead { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
input[type=number], input[type=date] {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
}
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; color: var(--text); font-size: 15px; }
.hidden { display: none; }
.verdict { font-size: 20px; font-weight: 600; margin: 0 0 14px; }
.verdict.good { color: var(--good); } .verdict.bad { color: var(--bad); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 13px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 6px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; }
.scroll { overflow-x: auto; }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.month h3 { font-size: 15px; margin: 0 0 6px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; font-size: 12px; }
.days div { text-align: center; padding: 4px 0; border-radius: 6px; background: var(--work); }
.days .wd { background: none; color: var(--muted); }
.days .off { background: var(--off); color: var(--muted); }
.days .hol { background: var(--holiday); }
.days .vac { background: var(--vac); font-weight: 600; outline: 1px solid var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.note { font-size: 13px; color: var(--muted); }
.warn { color: var(--bad); font-size: 14px; }
details summary { cursor: pointer; font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 16px; }
.btn { padding: 10px 16px; font: inherit; font-weight: 600; border: 0; border-radius: 10px;
       background: var(--accent); color: var(--accent-text); cursor: pointer; }
.toast { font-size: 13px; color: var(--muted); align-self: center; }
.legend .swatch-vac { background: var(--vac); }
.legend .swatch-hol { background: var(--holiday); }
.legend .swatch-off { background: var(--off); }
.days .vac.hol { background: var(--holiday); }
@media (max-width: 520px) {
  table { font-size: 13px; }
  th, td { padding: 8px 4px; }
  .wide { display: none; }
  th { white-space: normal; }
}

/* Внутри Telegram: заголовок уже есть в шапке Mini App, отступы компактнее */
.tg main { padding-top: 12px; }
.tg h1 { display: none; }
