/* Стили окна календаря. Цвета — темы Telegram (CSS-переменные WebApp),
   с запасными значениями для десктоп-браузера. */
:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --sec: var(--tg-theme-secondary-bg-color, #f1f1f1);
  --text: var(--tg-theme-text-color, #111111);
  --hint: var(--tg-theme-hint-color, #8f8f8f);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --link: var(--tg-theme-link-color, #2481cc);
  --sep: var(--tg-theme-section-separator-color, rgba(0, 0, 0, 0.08));
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 14px 12px 24px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

/* ── «404 nginx» вне Telegram ── */
.n { margin: 40px auto; max-width: 600px; padding: 0 16px; }
.n h1 { font-size: 20px; font-weight: 400; margin: 0 0 8px; }
.n hr { border: 0; border-top: 1px solid var(--sep); margin: 16px 0; }
.n center { color: var(--hint); }
.dbg {
  margin-top: 22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #b00020;
  background: rgba(176, 0, 32, 0.08);
  border: 1px solid rgba(176, 0, 32, 0.25);
  border-radius: 8px;
  padding: 10px;
  white-space: pre-wrap;
  word-break: break-all;
  text-align: left;
}

/* ── Шапка ── */
h1 { font-size: 22px; margin: 4px 0 10px; }
#cal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
#cal-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}
button.nav {
  background: var(--sec);
  color: var(--text);
  border: 0;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
button.nav:active { opacity: 0.7; }
button.today {
  background: var(--sec);
  color: var(--link);
  border: 0;
  border-radius: 10px;
  width: 100%;
  height: 34px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 10px;
}
button.today:active { opacity: 0.7; }

/* ── Сетка месяца ── */
.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 14px;
}
.grid .wd {
  text-align: center;
  color: var(--hint);
  font-size: 12px;
  padding: 4px 0;
}
.cell {
  position: relative;
  background: var(--sec);
  border-radius: 8px;
  min-height: 42px;
  padding: 4px;
  cursor: pointer;
  border: 1.5px solid transparent;
}
.cell.empty { background: transparent; cursor: default; }
.cell .num {
  font-size: 13px;
  opacity: 0.9;
}
.cell.has .num { font-weight: 700; }
.cell.now { border-color: var(--link); }
.cell.sel {
  background: var(--btn);
  color: var(--btn-text);
}
.cell.sel .num { opacity: 1; }
.cell .dots {
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 3px;
  display: flex;
  gap: 2px;
  overflow: hidden;
}
.cell .dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--btn);
}
.cell.sel .dots i { background: var(--btn-text); }

/* ── Списки событий ── */
section { margin-top: 18px; }
h2 {
  font-size: 15px;
  color: var(--hint);
  font-weight: 600;
  margin: 0 0 8px;
}
.item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  background: var(--sec);
  border-radius: 10px;
  margin-bottom: 6px;
}
.item .time {
  flex: 0 0 auto;
  min-width: 58px;
  color: var(--hint);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.item .body { min-width: 0; }
.item .cal {
  color: var(--hint);
  font-size: 13px;
  white-space: nowrap;
}
.item .d {
  display: block;
  color: var(--hint);
  font-size: 13px;
  margin-top: 1px;
}
.empty-hint { color: var(--hint); padding: 6px 2px; }

footer {
  margin-top: 22px;
  color: var(--hint);
  font-size: 12px;
  text-align: center;
}
.build {
  color: var(--hint);
  font-size: 11px;
  text-align: center;
  opacity: 0.6;
  margin-top: 4px;
}