/* ===== базовая палитра ===== */
:root {
  /* Тёмная тема: чёрно-серый, без синевы */
  --bg: #0A0A0A;
  --bg-elev: #141414;
  --bg-elev-2: #1C1C1C;
  --line: #2A2A2A;
  --line-soft: #1F1F1F;
  --text: #EDEDED;
  --text-dim: #A0A0A0;
  --text-muted: #6B6B6B;
  --brand: #FFFFFF;
  --brand-2: #BDBDBD;
  --brand-on: #0A0A0A;          /* контрастный цвет текста поверх .brand */
  --brand-grad: linear-gradient(135deg, #FFFFFF 0%, #BDBDBD 100%);
  --shadow-card: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 32px rgba(0,0,0,.45);
  --shadow-pop: 0 24px 80px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.05);

  /* Цвета категорий событий — слегка приглушены для хармонии с нейтральной базой */
  --t-dividend: #6EE7B7;
  --t-report:   #93C5FD;
  --t-meeting:  #FCD34D;
  --t-investor: #D8B4FE;
  --t-ipo:      #FBCFE8;
  --t-legal:    #FCA5A5;
  --t-other:    #CBD5E1;
  --t-bond:     #38BDF8;

  --radius-sm: 10px;
  --radius:    14px;
  --radius-lg: 20px;
}

[data-theme="light"] {
  /* Светлая тема: чисто бело-чёрный */
  --bg: #FAFAFA;
  --bg-elev: #FFFFFF;
  --bg-elev-2: #F4F4F4;
  --line: #E0E0E0;
  --line-soft: #EEEEEE;
  --text: #0A0A0A;
  --text-dim: #525252;
  --text-muted: #8A8A8A;
  --brand: #0A0A0A;
  --brand-2: #404040;
  --brand-on: #FFFFFF;
  --brand-grad: linear-gradient(135deg, #0A0A0A 0%, #404040 100%);
  --shadow-card: 0 1px 0 rgba(0,0,0,.02) inset, 0 8px 24px rgba(0,0,0,.06);
  --shadow-pop: 0 24px 80px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.06);

  /* Категории на светлом фоне — насыщеннее */
  --t-dividend: #059669;
  --t-report:   #2563EB;
  --t-meeting:  #D97706;
  --t-investor: #9333EA;
  --t-ipo:      #DB2777;
  --t-legal:    #DC2626;
  --t-other:    #64748B;
  --t-bond:     #0284C7;
}

* { box-sizing: border-box; }

/* Промо-карточка нашего Telegram-бота — показывается над контентом, можно скрыть */
.promo {
  max-width: 1440px; margin: 16px auto -4px; padding: 14px 18px;
  display: flex; align-items: center; gap: 14px;
  position: relative;
  background: linear-gradient(135deg,
    color-mix(in oklab, #2C36FF 16%, var(--bg-elev)) 0%,
    color-mix(in oklab, #8D02FF 14%, var(--bg-elev)) 50%,
    color-mix(in oklab, #FF1861 14%, var(--bg-elev)) 100%);
  border: 1px solid color-mix(in oklab, #8D02FF 30%, var(--line));
  border-radius: var(--radius);
  box-shadow: 0 6px 22px rgba(141,2,255,.10);
}
.promo__icon {
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2C36FF, #8D02FF, #FF1861);
  color: white;
  box-shadow: 0 4px 14px rgba(141,2,255,.4);
}
.promo__text { flex: 1; min-width: 0; line-height: 1.35; }
.promo__title { font-size: 14px; font-weight: 700; color: var(--text); }
.promo__sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.promo__cta {
  flex: 0 0 auto;
  height: 36px; padding: 0 14px; border-radius: 10px;
  display: inline-flex; align-items: center;
  background: linear-gradient(135deg, #2C36FF, #8D02FF);
  color: white; font-weight: 600; font-size: 13px;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 4px 14px rgba(44,54,255,.35);
  transition: transform .12s, box-shadow .15s;
}
.promo__cta:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(141,2,255,.45); }
.promo__close {
  width: 28px; height: 28px; padding: 0; flex: 0 0 auto;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center;
  transition: color .15s, background .15s;
}
.promo__close:hover { color: var(--text); background: color-mix(in oklab, var(--text) 8%, transparent); }
@media (max-width: 700px) {
  .promo { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  .promo__text { flex: 1 1 100%; order: 2; }
  .promo__icon { order: 1; }
  .promo__close { order: 1; margin-left: auto; }
  .promo__cta { order: 3; flex: 1 1 100%; justify-content: center; }
}

/* Постоянная промо-плашка внизу страницы */
.promo-strip {
  display: flex; align-items: center; gap: 12px;
  max-width: 1440px; margin: 24px auto 12px; padding: 12px 18px;
  background: linear-gradient(135deg,
    color-mix(in oklab, #2C36FF 12%, var(--bg-elev)),
    color-mix(in oklab, #FF1861 12%, var(--bg-elev)));
  border: 1px solid color-mix(in oklab, #8D02FF 24%, var(--line));
  border-radius: var(--radius);
  text-decoration: none; color: var(--text);
  transition: transform .15s, box-shadow .15s;
}
.promo-strip:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(141,2,255,.18); }
.promo-strip__icon {
  width: 36px; height: 36px; flex: 0 0 auto;
  border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2C36FF, #8D02FF, #FF1861);
  color: white; box-shadow: 0 3px 10px rgba(141,2,255,.35);
}
.promo-strip__text { flex: 1; min-width: 0; line-height: 1.3; display: flex; flex-direction: column; gap: 1px; }
.promo-strip__text b { font-size: 13px; font-weight: 700; }
.promo-strip__text small { font-size: 11.5px; color: var(--text-dim); }
.promo-strip__arrow {
  font-size: 18px; color: var(--text-dim); flex: 0 0 auto;
  transition: transform .12s, color .12s;
}
.promo-strip:hover .promo-strip__arrow { color: var(--text); transform: translateX(2px); }
@media (max-width: 800px) {
  .promo-strip { margin: 16px 12px 92px; padding: 10px 14px; }
  .promo-strip__text b { font-size: 12px; }
  .promo-strip__text small { font-size: 10.5px; }
}

/* Банер устаревших данных */
.stale-banner {
  position: sticky; top: 0; z-index: 50;
  padding: 10px 22px; text-align: center;
  font-size: 13px; line-height: 1.4;
  background: linear-gradient(90deg, #F59E0B22, #F59E0B11);
  color: #FBBF24; border-bottom: 1px solid #F59E0B55;
}
[data-theme="light"] .stale-banner {
  background: #FEF3C7; color: #92400E; border-color: #FCD34D;
}

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
  min-height: 100%;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(255,255,255,.04), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(255,255,255,.025), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="light"] body::before {
  background:
    radial-gradient(900px 500px at 8% -10%, rgba(0,0,0,.025), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(0,0,0,.015), transparent 60%);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ===== topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--line-soft);
}
.topbar__inner {
  max-width: 1440px; margin: 0 auto; padding: 14px 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 24px;
  row-gap: 8px;
}
.brand { grid-column: 1; grid-row: 1 / span 2; }
.topbar__right { grid-column: 3; grid-row: 1 / span 2; }
.sectionswitch { grid-column: 2; grid-row: 1; }
.viewswitch { grid-column: 2; grid-row: 2; }
.brand {
  display: inline-flex; align-items: center;
  text-decoration: none; color: var(--text);
  transition: opacity .15s;
}
.brand:hover { opacity: .85; }
.brand__logo {
  height: 38px; width: auto; display: block;
}

.sectionswitch {
  justify-self: center;
  display: inline-flex; gap: 0;
}
.sectionswitch__btn {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent;
  padding: 6px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  position: relative;
  transition: color .15s;
}
.sectionswitch__btn::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 0;
  height: 2px; border-radius: 2px;
  background: transparent; transition: background .2s;
}
.sectionswitch__btn:hover { color: var(--text); }
.sectionswitch__btn.is-active { color: var(--text); }
.sectionswitch__btn.is-active::after { background: var(--brand); }

.viewswitch {
  justify-self: center;
  display: inline-flex; padding: 4px;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: 12px;
}
.viewswitch__btn {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 7px 14px; border-radius: 8px; font-weight: 500; font-size: 13px;
  transition: background .2s, color .2s, transform .15s;
}
.viewswitch__btn:hover { color: var(--text); }
.viewswitch__btn.is-active {
  background: var(--brand-grad); color: var(--brand-on);
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}

.topbar__right { display: flex; gap: 8px; align-items: center; }
.iconbtn {
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--text); border-radius: 10px; font-weight: 500; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: border-color .15s, background .15s, transform .1s;
}
.iconbtn:hover { border-color: color-mix(in oklab, var(--brand) 55%, var(--line)); }
.iconbtn:active { transform: translateY(1px); }
.iconbtn--icon { width: 36px; padding: 0; justify-content: center; }
.icon-sun { display: none; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ===== toolbar ===== */
.toolbar { position: sticky; top: 65px; z-index: 20; background: color-mix(in oklab, var(--bg) 72%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-soft); }
.toolbar__inner { max-width: 1440px; margin: 0 auto; padding: 14px 22px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; }

.monthnav { display: inline-flex; align-items: center; gap: 8px; }
.monthnav__arrow {
  width: 36px; height: 36px;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--text); border-radius: 10px; display: grid; place-items: center;
  transition: border-color .15s, background .15s;
}
.monthnav__arrow:hover { border-color: color-mix(in oklab, var(--brand) 55%, var(--line)); }
.monthnav__title { margin: 0 6px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; min-width: 220px; text-transform: capitalize; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; justify-self: center; }
.chip {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--text-dim);
  padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  transition: color .15s, border-color .15s, background .15s, transform .1s;
}
.chip:hover { color: var(--text); border-color: color-mix(in oklab, var(--brand) 50%, var(--line)); }
.chip.is-active {
  color: var(--text); border-color: color-mix(in oklab, var(--brand) 65%, var(--line));
  background: color-mix(in oklab, var(--brand) 14%, var(--bg-elev));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 14%, transparent);
}
.chip__cnt {
  font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 600;
  background: var(--bg-elev-2); color: var(--text-dim);
  border: 1px solid var(--line-soft);
  padding: 1px 7px; border-radius: 999px; min-width: 22px; text-align: center;
}
.chip.is-active .chip__cnt { background: color-mix(in oklab, var(--brand) 22%, var(--bg-elev-2)); color: var(--text); }

.dot { width: 6px; height: 6px; border-radius: 999px; }
.dot--dividend { background: var(--t-dividend); color: var(--t-dividend); }
.dot--report   { background: var(--t-report);   color: var(--t-report); }
.dot--meeting  { background: var(--t-meeting);  color: var(--t-meeting); }
.dot--investor { background: var(--t-investor); color: var(--t-investor); }
.dot--ipo      { background: var(--t-ipo);      color: var(--t-ipo); }
.dot--legal    { background: var(--t-legal);    color: var(--t-legal); }
.dot--other    { background: var(--t-other);    color: var(--t-other); }
.dot--bond     { background: var(--t-bond);     color: var(--t-bond); }

.search {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; height: 36px; min-width: 280px;
  color: var(--text-muted); position: relative;
}
.search:focus-within { border-color: color-mix(in oklab, var(--brand) 65%, var(--line)); box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 16%, transparent); }
.search input { background: transparent; border: 0; outline: 0; color: var(--text); font-size: 13px; width: 100%; height: 100%; }
.search__suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
  box-shadow: var(--shadow-pop);
  max-height: 360px; overflow: auto;
}
.search__opt {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 6px;
  background: transparent; border: 0; cursor: pointer;
  text-align: left; color: var(--text);
}
.search__opt:hover, .search__opt.is-active { background: var(--bg-elev-2); }
.search__opt-tx { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.search__opt-tx b { font-size: 12px; font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .02em; }
.search__opt-tx span { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

/* ===== content ===== */
.content { max-width: 1440px; margin: 0 auto; padding: 22px; position: relative; z-index: 1; }

/* ===== месяц — классическая 7×N сетка ===== */
.calendar.is-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.mcal__wd {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 0 4px 4px; text-align: left;
}
.mcal__cell {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 8px;
  min-height: 88px; cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  text-align: left; color: var(--text);
  transition: border-color .12s, background .12s;
}
.mcal__cell:hover { border-color: var(--line); background: color-mix(in oklab, var(--bg-elev) 60%, var(--bg-elev-2)); }
.mcal__cell--out { opacity: .35; }
.mcal__cell--weekend { background: color-mix(in oklab, var(--bg-elev) 92%, var(--brand) 6%); }
.mcal__cell--today {
  border-color: color-mix(in oklab, var(--brand) 60%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--brand) 14%, transparent);
}
.mcal__num {
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center;
}
.mcal__cell--today .mcal__num {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--brand); color: var(--brand-on);
}
.mcal__events { display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow: hidden; }
.mcal__pill {
  font-size: 10.5px; line-height: 1.4;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-elev-2);
  border-left: 2px solid var(--t-other);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.mcal__pill[data-type="dividend"]        { border-left-color: var(--t-dividend); }
.mcal__pill[data-type="report"]          { border-left-color: var(--t-report); }
.mcal__pill[data-type="meeting"]         { border-left-color: var(--t-meeting); }
.mcal__pill[data-type="investor"]        { border-left-color: var(--t-investor); }
.mcal__pill[data-type="ipo"]             { border-left-color: var(--t-ipo); }
.mcal__pill[data-type="bond_offer"],
.mcal__pill[data-type="bond_redemption"] { border-left-color: var(--t-bond); }
.mcal__pill[data-buy="true"] {
  background: color-mix(in oklab, var(--t-dividend) 14%, var(--bg-elev-2));
  border-left-color: var(--t-dividend);
  font-weight: 600;
}
.mcal__more { font-size: 10px; color: var(--text-muted); padding: 1px 4px; }

@media (max-width: 800px) {
  .calendar.is-month { gap: 4px; }
  .mcal__cell { min-height: 56px; padding: 6px; }
  .mcal__pill { font-size: 9px; padding: 1px 4px; }
  .mcal__wd { font-size: 9px; padding: 0 2px 2px; text-align: center; }
}

/* ===== год — heatmap ===== */
.calendar.is-year {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.ymon {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow-card);
}
.ymon__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ymon__name { font-size: 13px; font-weight: 700; text-transform: capitalize; }
.ymon__cnt { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ymon__wd, .ymon__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.ymon__wd { margin-bottom: 4px; }
.ymon__wd span {
  text-align: center; font-size: 9px; color: var(--text-muted);
  text-transform: uppercase; font-weight: 600;
}
.ymon__cell {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-variant-numeric: tabular-nums;
  border: 0; border-radius: 4px;
  background: color-mix(in oklab, var(--t-dividend) calc(var(--heat,0) * 60%), var(--bg-elev-2));
  color: color-mix(in oklab, var(--text) calc(40% + var(--heat,0) * 60%), transparent);
  cursor: pointer; transition: outline-color .12s;
  outline: 1px solid transparent;
}
.ymon__cell:hover { outline-color: var(--text); }
.ymon__cell--empty { background: transparent; cursor: default; pointer-events: none; }
.ymon__cell--zero { background: var(--bg-elev-2); color: var(--text-muted); opacity: .55; }
.ymon__cell--today { outline: 2px solid var(--text) !important; }

@media (max-width: 1100px) { .calendar.is-year { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 800px) { .calendar.is-year { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .calendar.is-year { grid-template-columns: 1fr; } }

/* ===== сегодня — одна большая карточка ===== */
.calendar.is-today { display: flex; justify-content: center; }
.today-card {
  width: 100%; max-width: 880px;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  overflow: hidden;
}
.today-card__head {
  display: flex; align-items: center; gap: 16px;
  padding: 22px 26px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 9%, var(--bg-elev)), var(--bg-elev));
  border-bottom: 1px solid var(--line-soft);
}
.today-card__date { display: flex; flex-direction: column; gap: 2px; }
.today-card__big {
  display: flex; align-items: baseline; gap: 8px;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.today-card__big b { font-size: 44px; font-weight: 800; letter-spacing: -.03em; }
.today-card__big span { font-size: 18px; color: var(--text-dim); font-weight: 600; }
.today-card__sub { font-size: 12px; color: var(--text-muted); text-transform: lowercase; letter-spacing: .04em; }
.today-card__cnt {
  margin-left: auto; font-size: 13px; color: var(--text-dim);
  background: color-mix(in oklab, var(--brand) 14%, var(--bg-elev-2));
  border-radius: 999px; padding: 6px 14px;
}
.today-card__cnt b { font-weight: 800; color: var(--text); margin-right: 4px; }
.today-card__stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; padding: 14px 26px 6px;
}
.today-card__stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; background: var(--bg-elev-2);
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  line-height: 1.2;
}
.today-card__stat b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.today-card__stat span { font-size: 11px; color: var(--text-muted); }
.today-card__body { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.today-card__empty {
  text-align: center; padding: 50px 20px; color: var(--text-muted);
  font-size: 14px; line-height: 1.6;
}
.today-card__empty kbd {
  display: inline-block; padding: 1px 6px; margin: 0 1px;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  border-radius: 4px; font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px; color: var(--text-dim);
}

/* ===== неделя — 7 колонок с широкими карточками ===== */
.calendar.is-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}
.wcol {
  background: var(--bg-elev);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  min-height: 320px;
  box-shadow: var(--shadow-card);
  transition: border-color .15s;
}
.wcol--weekend { background: color-mix(in oklab, var(--bg-elev) 94%, var(--brand) 4%); }
.wcol--today {
  border-color: color-mix(in oklab, var(--brand) 60%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 14%, transparent), var(--shadow-card);
}
.wcol__head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 5%, var(--bg-elev)), var(--bg-elev));
  border-top-left-radius: var(--radius); border-top-right-radius: var(--radius);
}
.wcol--today .wcol__head { background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 14%, var(--bg-elev)), var(--bg-elev)); }
.wcol__wd {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--text-muted); text-transform: uppercase;
}
.wcol--today .wcol__wd { color: color-mix(in oklab, var(--brand-2) 60%, var(--text)); }
.wcol__date { display: flex; align-items: baseline; gap: 4px; margin-left: auto; }
.wcol__date b { font-size: 18px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.wcol__date small { font-size: 11px; color: var(--text-muted); text-transform: lowercase; }
.wcol__cnt {
  margin-left: 8px; min-width: 22px; padding: 2px 8px; text-align: center;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  border-radius: 999px;
  background: color-mix(in oklab, var(--brand) 18%, var(--bg-elev-2));
  color: var(--text);
}
.wcol__body { display: flex; flex-direction: column; gap: 8px; padding: 10px; flex: 1; }
.wcol__empty {
  margin: auto; padding: 20px 0; color: var(--text-muted); font-size: 12px; text-align: center;
}

.evcard {
  display: flex; gap: 0; align-items: stretch;
  background: var(--bg-elev-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 0; cursor: pointer;
  text-align: left; overflow: hidden;
  transition: transform .12s, border-color .15s, background .15s;
}
.evcard:hover {
  border-color: color-mix(in oklab, var(--brand) 50%, var(--line));
  transform: translateY(-1px);
  background: color-mix(in oklab, var(--bg-elev-2) 60%, var(--bg-elev));
}
.evcard__bar { width: 3px; flex: 0 0 auto; }
.evcard[data-type="dividend"] .evcard__bar { background: var(--t-dividend); }
.evcard[data-type="report"]   .evcard__bar { background: var(--t-report); }
.evcard[data-type="meeting"]  .evcard__bar { background: var(--t-meeting); }
.evcard[data-type="investor"] .evcard__bar { background: var(--t-investor); }
.evcard[data-type="ipo"]      .evcard__bar { background: var(--t-ipo); }
.evcard[data-type="legal"]    .evcard__bar { background: var(--t-legal); }
.evcard[data-type="other"]    .evcard__bar { background: var(--t-other); }
.evcard[data-type="bond_offer"] .evcard__bar,
.evcard[data-type="bond_redemption"] .evcard__bar { background: var(--t-bond); }
.evcard__main { flex: 1; min-width: 0; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; }
.evcard__top { display: flex; align-items: center; gap: 8px; }
.evcard__id { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; flex: 1; }
.evcard__ticker { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.evcard__name { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evcard__time {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-elev); border: 1px solid var(--line-soft); border-radius: 6px;
  padding: 2px 6px; flex: 0 0 auto;
}
.evcard__title {
  font-size: 12.5px; line-height: 1.4; color: var(--text);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.evcard__money {
  font-size: 12px; font-weight: 700; color: var(--t-dividend);
  background: color-mix(in srgb, var(--t-dividend) 12%, transparent);
  border-radius: 6px; padding: 3px 7px; align-self: flex-start;
  font-variant-numeric: tabular-nums;
}
.evcard__forecast,
.forecast-tag {
  font-size: 9.5px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 999px; padding: 1px 6px; line-height: 1.55;
  margin-left: 4px; flex: 0 0 auto;
}
.evcard[data-forecast="true"] {
  border-style: dashed;
  background: color-mix(in oklab, var(--bg-elev-2) 96%, transparent);
}
.evcard[data-forecast="true"] .evcard__money {
  color: var(--text-dim);
  background: transparent;
  border: 1px dashed var(--line);
}
.evcard[data-forecast="true"] .evcard__bar {
  background: repeating-linear-gradient(180deg, var(--text-muted) 0 4px, transparent 4px 7px);
  opacity: .6;
}

/* ===== лента ===== */
.calendar.is-agenda { display: flex; flex-direction: column; gap: 18px; }
.agenda-day {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-card);
}
.agenda-day__head {
  padding: 14px 18px; display: flex; align-items: baseline; gap: 14px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 7%, var(--bg-elev)), var(--bg-elev));
}
.agenda-day__date { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.agenda-day__weekday { color: var(--text-dim); font-size: 13px; text-transform: capitalize; }
.agenda-day__count { margin-left: auto; font-size: 12px; color: var(--text-muted); }

.agenda-list { display: flex; flex-direction: column; }
.agenda-item {
  display: grid; grid-template-columns: 48px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 18px; border-top: 1px solid var(--line-soft); cursor: pointer;
  transition: background .15s;
}
.agenda-item:first-child { border-top: 0; }
.agenda-item:hover { background: var(--bg-elev-2); }
.agenda-item__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.agenda-item__top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-item__ticker { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; font-weight: 700; letter-spacing: .02em; padding: 2px 7px; border-radius: 6px; background: var(--bg-elev-2); border: 1px solid var(--line-soft); }
.agenda-item__name { color: var(--text-dim); font-size: 13px; }
.agenda-item__title { font-size: 14px; font-weight: 500; line-height: 1.35; }
.agenda-item__right { display: flex; align-items: center; gap: 10px; }
.agenda-item__time { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; color: var(--text-dim); padding: 4px 8px; border: 1px solid var(--line-soft); border-radius: 8px; }
.agenda-item__money { font-size: 13px; font-weight: 700; color: var(--t-dividend); }

.typetag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 500;
  line-height: 1.6; letter-spacing: .01em;
  color: var(--text-muted);
  background: color-mix(in oklab, var(--bg-elev-2) 70%, transparent);
  border: 1px solid var(--line-soft);
}
.typetag .dot { width: 5px; height: 5px; flex: 0 0 auto; }
/* На светлой теме у тегов чуть-чуть подсвечен текст, дот всё равно носитель цвета категории */
[data-theme="light"] .typetag { background: var(--bg-elev-2); border-color: var(--line); }

/* ===== звёздочка избранного ===== */
.starbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0;
  background: transparent; border: 0; border-radius: 6px;
  color: var(--text-muted); cursor: pointer;
  transition: color .15s, background .15s, transform .12s;
  flex: 0 0 auto;
}
.starbtn:hover { color: #FFD43B; background: color-mix(in oklab, #FFD43B 12%, transparent); }
.starbtn:active { transform: scale(.92); }
.starbtn.is-on { color: #FFD43B; }
.evcard__star { margin-left: auto; }
.agenda-item__star { margin-left: 4px; }

/* чип «Избранное» — иконка звёздочки + лейбл */
.chip--star { color: var(--text-dim); }
.chip--star.is-active { color: #FFD43B; border-color: color-mix(in oklab, #FFD43B 50%, var(--line)); }
.chip--star.is-active .chip__cnt { background: color-mix(in oklab, #FFD43B 20%, var(--bg-elev-2)); }

/* чип «Купить до» — приоритетный приём с дивидендным цветом */
.chip--buy { color: var(--text-dim); }
.chip--buy.is-active { color: var(--t-dividend); border-color: color-mix(in oklab, var(--t-dividend) 55%, var(--line)); }
.chip--buy.is-active .chip__cnt { background: color-mix(in oklab, var(--t-dividend) 22%, var(--bg-elev-2)); color: var(--text); }

/* Подсветка карточек/айтемов «Купить до» — приоритетные события для инвестора */
.evcard[data-buy="true"] {
  background: color-mix(in oklab, var(--t-dividend) 6%, var(--bg-elev-2));
  border-color: color-mix(in oklab, var(--t-dividend) 35%, var(--line));
}
.evcard[data-buy="true"] .evcard__bar { background: var(--t-dividend); width: 4px; }
.evcard[data-buy="true"] .evcard__money {
  color: var(--brand-on);
  background: var(--t-dividend);
  border: 0;
}
.agenda-item[data-buy="true"] {
  border-color: color-mix(in oklab, var(--t-dividend) 35%, var(--line));
  background: color-mix(in oklab, var(--t-dividend) 4%, var(--bg-elev));
}
.agenda-item[data-buy="true"] .agenda-item__money {
  color: var(--brand-on);
  background: var(--t-dividend);
  padding: 4px 10px;
  border-radius: 8px;
}

/* ===== icon ===== */
.tk-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line-soft);
  overflow: hidden; flex: 0 0 auto;
  display: grid; place-items: center;
  position: relative;
}
.tk-icon img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.tk-icon--fallback span {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700; color: white; letter-spacing: .02em;
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
  font-size: 13px;
}
.tk-icon[style*="20px"] .tk-icon--fallback span,
.tk-icon[style*="22px"] .tk-icon--fallback span { font-size: 9px; }

/* мини-иконка в pill */
.evpill .tk-icon { width: 20px; height: 20px; border-radius: 6px; }
.evpill .tk-icon--fallback span { font-size: 8.5px; }

/* ===== empty ===== */
.empty {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg); padding: 48px 24px; text-align: center;
  box-shadow: var(--shadow-card);
}
.empty__art { font-size: 42px; margin-bottom: 8px; }
.empty h3 { margin: 6px 0; font-size: 17px; }
.empty p { margin: 0; color: var(--text-dim); font-size: 13px; }

/* ===== footer ===== */
.footer { padding: 30px 0 50px; color: var(--text-muted); font-size: 12px; position: relative; z-index: 1; }
.footer__inner { max-width: 1440px; margin: 0 auto; padding: 0 22px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--text-dim); border-bottom: 1px dashed var(--line); }
.footer a:hover { color: var(--text); }
.footer__meta { font-variant-numeric: tabular-nums; }

/* ===== modal ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; }
.modal__backdrop {
  position: absolute; inset: 0; background: color-mix(in oklab, #000 65%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fadeIn .18s ease;
}
.modal__card {
  position: relative; z-index: 1;
  width: min(560px, 100%); max-height: calc(100vh - 36px); overflow: auto;
  background: var(--bg-elev); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  border: 1px solid var(--line-soft);
  animation: pop .22s cubic-bezier(.2,.7,.3,1);
}
.modal__close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; display: grid; place-items: center;
  border-radius: 8px; background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  color: var(--text-dim);
}
.modal__close:hover { color: var(--text); border-color: color-mix(in oklab, var(--brand) 50%, var(--line)); }
.modal__head { padding: 22px 24px 0; display: flex; gap: 14px; align-items: center; }
.modal__head .tk-icon { width: 56px; height: 56px; border-radius: 14px; }
.modal__head .tk-icon--fallback span { font-size: 18px; }
.modal__title { display: flex; flex-direction: column; gap: 4px; }
.modal__title b { font-size: 18px; }
.modal__title small { color: var(--text-dim); font-size: 13px; }
.modal__body { padding: 18px 24px 24px; }
.modal__row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px dashed var(--line-soft); }
.modal__row:first-child { border-top: 0; }
.modal__row span:first-child { color: var(--text-dim); font-size: 12px; }
.modal__row span:last-child { font-weight: 600; font-size: 13px; }

/* История дивидендов в попапе */
.modal__history { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.modal__history-title { font-size: 12px; color: var(--text-dim); margin-bottom: 10px; font-weight: 600; }
.modal__bars {
  display: flex; align-items: flex-end; gap: 4px;
  height: 80px; padding: 4px;
  background: var(--bg-elev-2); border-radius: var(--radius-sm);
  border: 1px solid var(--line-soft);
}
.modal__bar {
  flex: 1; height: 100%; min-width: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 2px; cursor: default;
}
.modal__bar span {
  width: 100%; min-height: 4px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--t-dividend) 0%, color-mix(in oklab, var(--t-dividend) 60%, transparent) 100%);
}
.modal__bar em {
  font-size: 9px; color: var(--text-muted); font-style: normal;
  font-variant-numeric: tabular-nums;
}
.modal__hist-rows { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.modal__hist-row {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 12px; padding: 5px 8px;
  background: var(--bg-elev-2); border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.modal__hist-row span { color: var(--text-dim); font-family: 'JetBrains Mono', ui-monospace, monospace; }
.modal__hist-row b { color: var(--t-dividend); }
.modal__actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.modal__actions a,
.modal__actions button {
  flex: 1; min-width: 140px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  background: var(--brand-grad); color: var(--brand-on); font-weight: 600; font-size: 13px;
  border: 0; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
}
.modal__actions a.secondary,
.modal__actions button.secondary {
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--line-soft); box-shadow: none;
}
.modal__actions a:hover,
.modal__actions button:hover { transform: translateY(-1px); }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98) } to { opacity: 1; transform: none } }

/* ===== адаптив ===== */
@media (max-width: 1100px) {
  .toolbar__inner { grid-template-columns: 1fr; }
  .filters { justify-self: start; }
  .search { min-width: 0; width: 100%; }
}
@media (max-width: 1100px) {
  .calendar.is-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  /* 3 колонки + dense — лого слева, тема в правом углу, переключатель видов растягивается на 2-й строке */
  .topbar__inner {
    grid-template-columns: auto 1fr auto;
    grid-auto-flow: dense;
    row-gap: 10px; gap: 12px;
  }
  .brand__logo { height: 32px; }
  .viewswitch { grid-column: 1 / -1; justify-self: stretch; }
  .viewswitch__btn { flex: 1; }
  .topbar__right { grid-column: 3; justify-self: end; }
  .monthnav__title { font-size: 18px; min-width: 0; flex: 1; }
  .calendar.is-week { grid-template-columns: 1fr; }
  .wcol { min-height: 0; }
  .agenda-item { grid-template-columns: 40px 1fr; }
  .agenda-item__right { grid-column: 1 / -1; padding-left: 54px; }

  /* Фильтры на мобильной — фиксированная панель внизу с горизонтальным скроллом.
     ВАЖНО: backdrop-filter у .toolbar создаёт containing block для fixed-детей, поэтому
     убираем его на мобильной (фон у toolbar уже сплошной полупрозрачный — выглядит ок). */
  .toolbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .filters {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 25;
    margin: 0; padding: 10px 12px max(10px, env(safe-area-inset-bottom)) 12px;
    background: var(--bg);
    border-top: 1px solid var(--line);
    display: flex; flex-wrap: nowrap; overflow-x: auto;
    gap: 6px; scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    justify-self: stretch;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; scroll-snap-align: start; }
  /* Содержимому даём отступ снизу, чтобы оно не пряталось под нижней панелью */
  body { padding-bottom: 76px; }
}

/* ===== light theme tweaks ===== */
[data-theme="light"] .day--weekend { background: #FAFBFE; }
[data-theme="light"] .agenda-day__head { background: linear-gradient(180deg, #F7F1FF, #FFFFFF); }
[data-theme="light"] .evpill { background: #FFFFFF; }
