/* ===== базовая палитра ===== */
: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 auto;
  align-items: center;
  column-gap: 24px;
  row-gap: 8px;
}
.brand { grid-column: 1; grid-row: 1 / span 3; }
.topbar__right { grid-column: 3; grid-row: 1 / span 3; }
.appswitch { grid-column: 2; grid-row: 1; }
.sectionswitch { grid-column: 2; grid-row: 2; }
.viewswitch { grid-column: 2; grid-row: 3; }

/* В режиме «Портфель» секция и виды не нужны — это календарные элементы */
body[data-app="portfolio"] .sectionswitch,
body[data-app="portfolio"] .viewswitch { display: none; }
.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;
}

.appswitch {
  justify-self: center;
  display: inline-flex; gap: 4px;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 4px;
}
.appswitch__btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent;
  padding: 6px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer;
  transition: color .15s, background .15s;
}
.appswitch__btn:hover { color: var(--text); }
.appswitch__btn.is-active {
  background: var(--brand-grad); color: var(--brand-on);
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}

.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; }

/* ===== auth UI: кнопка входа + меню профиля ===== */
.userbox { position: relative; }
.iconbtn--user {
  width: 36px; padding: 0; justify-content: center;
  background: var(--bg-elev);
}
.useravatar {
  width: 24px; height: 24px; border-radius: 999px;
  background: var(--brand-grad); color: var(--brand-on);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  overflow: hidden;
}
.useravatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.iconbtn--google {
  background: var(--bg-elev);
}

.usermenu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 220px; max-width: 280px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 12px; padding: 6px;
  box-shadow: var(--shadow-pop);
  z-index: 40;
}
.usermenu__head {
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}
.usermenu__name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.usermenu__email {
  font-size: 11.5px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.usermenu__btn {
  width: 100%;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  background: transparent; border: 0; color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; text-align: left;
  transition: background .12s;
}
.usermenu__btn:hover { background: var(--bg-elev-2); }

/* ===== 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; }

.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; }

/* ===== портфель ===== */
.calendar.is-portfolio { display: flex; flex-direction: column; gap: 18px; }

.pf-stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
}
.pf-stat {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-card);
}
.pf-stat__label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.pf-stat__value { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
/* «За день» — краткосрочный индикатор, намеренно мельче чтобы не конкурировать
   взглядом с ключевыми «Стоимость» и «Прибыль» */
.pf-stat--day .pf-stat__value { font-size: 18px; }
.pf-stat__sub { font-size: 12px; color: var(--text-dim); }
.pf-stat--pos .pf-stat__value, .pf-stat--pos .pf-stat__sub { color: var(--t-dividend); }
.pf-stat--neg .pf-stat__value, .pf-stat--neg .pf-stat__sub { color: var(--t-legal); }
.pf-stat--div .pf-stat__value { color: var(--t-dividend); }

.pf-header { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 10px; flex-wrap: wrap; }
.pf-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.pf-title--sub { margin-top: 14px; }
.pf-add {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 10px;
  background: var(--brand-grad); color: var(--brand-on);
  border: 0; font-weight: 600; font-size: 13px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.pf-add:hover { transform: translateY(-1px); }
.pf-add--secondary {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--line); box-shadow: none;
}
.pf-add--secondary:hover { border-color: color-mix(in oklab, var(--brand) 55%, var(--line)); }

/* ===== Дневник сделок ===== */
.pf-trades-section { display: flex; flex-direction: column; gap: 10px; }
.pf-trades-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.pf-trades-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 0; cursor: pointer; padding: 0;
  color: var(--text);
}
.pf-trades-toggle .pf-title { margin: 0; }
.pf-trades-chevron { transition: transform .15s; color: var(--text-muted); }
.pf-trades-section.is-collapsed .pf-trades-chevron { transform: rotate(-90deg); }
.pf-trades-toggle:hover .pf-trades-chevron { color: var(--text); }

.pf-trades-size { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.pf-trades-size__select {
  appearance: none; -webkit-appearance: none;
  height: 30px; padding: 0 26px 0 10px;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft); border-radius: 8px;
  color: var(--text); font-size: 12px; font-family: inherit; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2.4' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
}
[data-theme="light"] .pf-trades-size__select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23525252' stroke-width='2.4' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

.pf-trade-row--more {
  display: block !important; padding: 12px 16px; text-align: center;
  font-size: 12px; color: var(--text-dim);
  background: var(--bg-elev-2);
}
.pf-trades-wrap {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pf-trades-table {
  display: flex; flex-direction: column;
  font-variant-numeric: tabular-nums;
  min-width: 800px;
}
.pf-trade-row {
  display: grid;
  grid-template-columns: 100px 130px minmax(120px, 1fr) 80px 100px 110px 90px 36px;
  gap: 10px; padding: 10px 14px; align-items: center;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.pf-trade-row--head {
  font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg-elev-2); border-top: 0;
}
.pf-trade-date { color: var(--text-dim); white-space: nowrap; }
.pf-trade-type {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 5px;
  background: var(--bg-elev-2); color: var(--text); width: fit-content;
}
.pf-trade-type--buy {
  background: color-mix(in oklab, var(--t-dividend) 18%, var(--bg-elev-2));
  color: var(--t-dividend);
}
.pf-trade-type--sell {
  background: color-mix(in oklab, var(--t-legal) 18%, var(--bg-elev-2));
  color: var(--t-legal);
}
.pf-trade-type--dividend, .pf-trade-type--coupon {
  background: color-mix(in oklab, var(--t-bond) 18%, var(--bg-elev-2));
  color: var(--t-bond);
}
.pf-trade-type--fee {
  background: var(--bg-elev-2); color: var(--text-muted);
}
.pf-trade-tk { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 700; font-size: 12px; }
.pf-trade-total { font-weight: 700; }
.pf-trade-act { display: flex; justify-content: flex-end; }

/* Тип сделки в форме — полнее, на всю ширину */
.pf-trade-types {
  display: grid !important; grid-template-columns: repeat(2, 1fr);
  gap: 4px; align-self: stretch;
}
@media (min-width: 480px) {
  .pf-trade-types { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 700px) {
  .pf-trade-row {
    grid-template-columns: 60px 100px 1fr 70px 36px;
    font-size: 12px;
  }
  .pf-trade-row > span:nth-child(5),
  .pf-trade-row > span:nth-child(7) { display: none; }
}

.pf-empty {
  background: var(--bg-elev); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 40px 24px; text-align: center;
  color: var(--text-muted);
}

/* ===== График стоимости портфеля ===== */
.pf-chart-section { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.pf-chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pf-chart-sub { font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.pf-chart-wrap {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px;
  min-height: 260px;
  position: relative;
}
.pf-chart-svg { display: block; width: 100%; }
.pf-chart-grid line { stroke: var(--line-soft); stroke-dasharray: 2 4; }
.pf-chart-axis { fill: var(--text-muted); font-size: 10.5px; font-family: 'JetBrains Mono', ui-monospace, monospace; }
.pf-chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pf-chart-line--portfolio { stroke: var(--brand); }
.pf-chart-line--imoex { stroke: var(--text-muted); stroke-dasharray: 4 3; stroke-width: 1.5; opacity: .8; }
.pf-chart-area { fill: var(--brand); opacity: .08; }

/* Подсказка для XIRR в карточке прибыли — мелко-пунктирное подчёркивание + помощь-курсор */
.pf-xirr,
.pf-help {
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

.pf-section-title {
  margin: 18px 0 6px; font-size: 13px; font-weight: 600;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em;
}

/* Селектор активного портфеля */
.pf-selector {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); flex-wrap: wrap;
}
.pf-selector__left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-selector__label {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600;
}
.pf-selector__name {
  font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -.01em;
}
.pf-selector__select {
  appearance: none; -webkit-appearance: none;
  height: 36px; padding: 0 32px 0 12px;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.pf-selector__select:focus {
  outline: 2px solid color-mix(in oklab, var(--brand) 60%, transparent); outline-offset: 0;
  border-color: var(--brand);
}
[data-theme="light"] .pf-selector__select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23525252' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
.pf-selector__right { display: flex; align-items: center; gap: 6px; }
.pf-selector__btn {
  height: 32px; padding: 0 10px;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft); border-radius: 8px;
  color: var(--text-dim); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500;
  transition: color .12s, border-color .12s, background .12s;
}
.pf-selector__btn:hover { color: var(--text); border-color: var(--line); background: var(--bg-elev); }
.pf-selector__btn:disabled { opacity: .4; cursor: not-allowed; }
.pf-selector__btn--danger:hover:not(:disabled) {
  color: var(--t-legal); border-color: color-mix(in oklab, var(--t-legal) 50%, var(--line));
}
.pf-selector__btn--primary {
  background: var(--brand-grad); color: var(--brand-on); border-color: transparent;
  font-weight: 600;
}
.pf-selector__btn--primary:hover { transform: translateY(-1px); color: var(--brand-on); border-color: transparent; background: var(--brand-grad); }

.pf-tg-btn { color: #2AABEE; }
.pf-tg-btn:hover { border-color: color-mix(in oklab, #2AABEE 50%, var(--line)); color: #2AABEE; }
.pf-tg-btn.is-connected {
  background: color-mix(in oklab, #2AABEE 14%, var(--bg-elev-2));
  border-color: color-mix(in oklab, #2AABEE 40%, var(--line));
  color: #2AABEE;
}

/* ===== Модалка настроек Telegram ===== */
.tg-settings { gap: 14px; }
.tg-settings__intro {
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
  padding: 10px 12px; background: var(--bg-elev-2); border-radius: 10px;
  border: 1px solid var(--line-soft);
}
.tg-settings__group { display: flex; flex-direction: column; gap: 2px; }
.tg-toggle {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start;
  padding: 12px; border-radius: 10px; cursor: pointer; user-select: none;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.tg-toggle:hover { background: var(--bg-elev-2); }
.tg-toggle input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.5px solid var(--line); border-radius: 6px;
  background: var(--bg-elev-2); cursor: pointer; position: relative;
  transition: background .15s, border-color .15s;
  flex: none;
}
.tg-toggle input[type="checkbox"]:hover { border-color: color-mix(in oklab, #2AABEE 50%, var(--line)); }
.tg-toggle input[type="checkbox"]:checked {
  background: #2AABEE; border-color: #2AABEE;
}
.tg-toggle input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.tg-toggle__text { display: flex; flex-direction: column; gap: 3px; }
.tg-toggle__title { font-size: 14px; font-weight: 500; color: var(--text); }
.tg-toggle__hint { font-size: 12px; color: var(--text-dim); line-height: 1.4; }

.tg-settings__price {
  display: flex; flex-direction: column; gap: 6px;
  padding: 12px; border-radius: 10px;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
}
.tg-settings__price-row {
  display: flex; align-items: center; gap: 8px; margin-top: 6px;
}
.tg-settings__price input {
  width: 90px; padding: 8px 10px; font-size: 14px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.tg-settings__price input:focus {
  outline: 2px solid color-mix(in oklab, #2AABEE 60%, transparent); outline-offset: 0;
  border-color: #2AABEE;
}
.tg-settings__unit { font-size: 14px; color: var(--text-dim); }

.tg-settings__danger { color: var(--t-legal); margin-left: auto; }
.tg-settings__danger:hover {
  border-color: color-mix(in oklab, var(--t-legal) 50%, var(--line));
  color: var(--t-legal);
}

/* ===== Чекбокс синхронизации токена T-Bank ===== */
.pf-token-sync {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start;
  padding: 10px; border-radius: 8px; cursor: pointer; user-select: none;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  margin-top: 4px;
}
.pf-token-sync:hover { border-color: var(--line); }
.pf-token-sync input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; margin: 1px 0 0;
  border: 1.5px solid var(--line); border-radius: 6px;
  background: var(--bg-elev); cursor: pointer; position: relative;
  transition: background .15s, border-color .15s; flex: none;
}
.pf-token-sync input[type="checkbox"]:checked {
  background: var(--brand); border-color: var(--brand);
}
.pf-token-sync input[type="checkbox"]:checked::after {
  content: ''; position: absolute; left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid var(--brand-on); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.pf-token-sync__text { display: flex; flex-direction: column; gap: 4px; }
.pf-token-sync__text b { font-size: 13px; font-weight: 500; color: var(--text); }
.pf-token-sync__text small { font-size: 11.5px; color: var(--text-dim); line-height: 1.4; }

.pf-table {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden;
}
.pf-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) 0.7fr 0.9fr 0.9fr 1.1fr 1.1fr 1.2fr 1.0fr 70px;
  gap: 12px; padding: 12px 16px; align-items: center;
  font-variant-numeric: tabular-nums;
  border-top: 1px solid var(--line-soft);
}
/* Акции: 9 колонок (добавлено «Получено дивидендов» из истории владения) */
.pf-row--stock {
  grid-template-columns: minmax(160px, 1.4fr) 0.7fr 0.9fr 0.9fr 1.1fr 1.1fr 1.2fr 1.0fr 70px;
}
/* Облигации: 9 колонок («До погашения» вместо «Получено», «Купоны/год» вместо «Дивиденды/год») */
.pf-row--bond {
  grid-template-columns: minmax(160px, 1.4fr) 0.6fr 0.8fr 0.8fr 1.0fr 1.0fr 1.1fr 1.0fr 70px;
}
.pf-col-coupon, .pf-col-mat, .pf-col-recd {
  display: flex; flex-direction: column; gap: 1px; line-height: 1.2;
}
.pf-col-coupon b, .pf-col-mat b, .pf-col-recd b { font-size: 13px; font-weight: 700; }
.pf-col-coupon b { color: var(--t-bond); }
.pf-col-recd b { color: var(--t-dividend); }
.pf-col-coupon small, .pf-col-mat small, .pf-col-recd small { font-size: 11px; color: var(--text-dim); }
.pf-row--head {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; padding: 10px 16px;
  background: var(--bg-elev-2); border-top: 0;
}
.pf-col-tk { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pf-tk-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pf-tk-text b { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 13px; }
.pf-tk-text small { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-col-pl, .pf-col-div, .pf-col-cur { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.pf-col-pl b, .pf-col-div b, .pf-col-cur b { font-size: 13px; font-weight: 700; }
.pf-col-pl small, .pf-col-div small, .pf-col-cur small { font-size: 11px; color: var(--text-dim); }
.pf-col-pl.is-pos b, .pf-col-pl.is-pos small,
.pf-col-cur.is-pos small { color: var(--t-dividend); }
.pf-col-pl.is-neg b, .pf-col-pl.is-neg small,
.pf-col-cur.is-neg small { color: var(--t-legal); }
.pf-col-div b { color: var(--t-dividend); }
.pf-dim { color: var(--text-muted); font-size: 12px; }
.pf-col-act { display: flex; gap: 4px; justify-content: flex-end; }
.pf-icon-btn {
  width: 28px; height: 28px; padding: 0;
  background: transparent; border: 1px solid var(--line-soft); border-radius: 6px;
  color: var(--text-dim); cursor: pointer; display: grid; place-items: center;
  transition: color .12s, border-color .12s;
}
.pf-icon-btn:hover { color: var(--text); border-color: var(--line); }
.pf-icon-btn--danger:hover { color: var(--t-legal); border-color: color-mix(in oklab, var(--t-legal) 50%, var(--line)); }

/* Календарь выплат — матрица "тикер × месяц" с цветовой индикацией прошедшие/будущие */
.pf-payouts-table-section { display: flex; flex-direction: column; gap: 10px; }
.pf-payouts-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pf-payouts-empty {
  background: var(--bg-elev); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 24px; text-align: center;
  color: var(--text-muted); font-size: 13px;
}
.pf-year-tabs {
  display: inline-flex; gap: 0;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 3px;
}
.pf-year-tab {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: 0; background: transparent; color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 7px;
  transition: color .12s, background .12s;
}
.pf-year-tab:hover { color: var(--text); }
.pf-year-tab.is-active { background: var(--brand-grad); color: var(--brand-on); }
.pf-pay-wrap {
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.pf-pay-table {
  display: flex; flex-direction: column;
  min-width: 1200px;
  font-variant-numeric: tabular-nums;
}
.pf-pay-row {
  display: grid;
  grid-template-columns:
    minmax(140px, 1.4fr) 60px
    repeat(12, minmax(70px, 1fr))
    minmax(90px, 1.1fr) minmax(80px, 0.9fr);
  gap: 4px; padding: 6px 8px;
  border-top: 1px solid var(--line-soft);
  align-items: center;
}
.pf-pay-row--head {
  font-size: 10.5px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--bg-elev-2); border-top: 0;
}
.pf-pay-row--head > span { text-align: center; }
.pf-pay-row--head .pf-pay-tk { text-align: left; }
.pf-pay-row--total {
  background: color-mix(in oklab, var(--brand) 6%, var(--bg-elev-2));
  border-top: 2px solid var(--line);
  font-weight: 600;
}
.pf-pay-tk { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.pf-pay-tk b { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }
.pf-pay-tk small { font-size: 10.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-pay-share { font-size: 11px; color: var(--text-dim); text-align: center; }
.pf-pay-cell {
  font-size: 11px; padding: 6px 4px; border-radius: 4px; text-align: center;
  background: var(--bg-elev-2); color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-pay-cell--empty { background: transparent; opacity: .4; }
.pf-pay-cell--past {
  background: color-mix(in oklab, var(--t-dividend) 18%, var(--bg-elev-2));
  color: var(--t-dividend); font-weight: 600;
}
.pf-pay-cell--future {
  background: color-mix(in oklab, #F59E0B 18%, var(--bg-elev-2));
  color: #FBBF24; font-weight: 600;
}
[data-theme="light"] .pf-pay-cell--future { color: #B45309; }
.pf-pay-total {
  font-size: 11.5px; padding: 6px 4px; text-align: right;
  font-weight: 600; color: var(--text);
}
.pf-pay-total b { font-size: 12px; }
.pf-pay-tax {
  font-size: 11px; padding: 6px 4px; text-align: right;
  color: var(--t-legal);
}

.pf-pay-legend {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 8px 4px;
  font-size: 12px; color: var(--text-dim);
}
.pf-pay-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.pf-pay-legend__item i { width: 8px; height: 8px; border-radius: 999px; display: inline-block; }
.pf-pay-legend__total { color: var(--text); font-weight: 600; margin-left: auto; }

.pf-payouts { display: flex; flex-direction: column; gap: 6px; }

/* Прогнозные события (Dohod) — пунктир + приглушённая сумма */
.pf-payout--forecast {
  border-style: dashed;
  background: color-mix(in oklab, var(--bg-elev) 96%, transparent);
}
.pf-payout--forecast .pf-payout__money b {
  color: var(--text-dim); font-weight: 600;
}
.pf-payout__top .forecast-tag { margin-left: 4px; flex: 0 0 auto; }
.pf-payout {
  display: grid; grid-template-columns: 56px 1fr auto;
  gap: 14px; padding: 12px 16px; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  transition: border-color .12s;
}
.pf-payout:hover { border-color: color-mix(in oklab, var(--t-dividend) 40%, var(--line)); }
.pf-payout__date { display: flex; flex-direction: column; align-items: center; line-height: 1; gap: 2px; }
.pf-payout__date b { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pf-payout__date span { font-size: 10px; color: var(--text-muted); text-transform: lowercase; }
.pf-payout__main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-payout__top { display: flex; align-items: center; gap: 10px; }
.pf-payout__top b { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 12px; }
.pf-payout__name { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-payout__title { font-size: 13px; line-height: 1.4; color: var(--text); }
.pf-payout__money { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; gap: 1px; }
.pf-payout__money b { color: var(--t-dividend); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-payout__money small { font-size: 10.5px; color: var(--text-muted); }

/* Форма добавления */
.pf-form { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.pf-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-dim); }
.pf-form input {
  height: 38px; padding: 0 12px;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  border-radius: 10px; color: var(--text); font-size: 14px; font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.pf-form input:focus { outline: 2px solid color-mix(in oklab, var(--brand) 60%, transparent); outline-offset: 0; border-color: var(--brand); }
.pf-form input:disabled { opacity: .6; cursor: not-allowed; }

/* Переключатель Акция/Облигация в форме */
.pf-kind-toggle {
  display: inline-flex; gap: 4px;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 4px; align-self: flex-start;
}
.pf-kind-btn {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent;
  padding: 6px 14px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer;
  transition: color .15s, background .15s;
}
.pf-kind-btn:hover { color: var(--text); }
.pf-kind-btn.is-active { background: var(--brand-grad); color: var(--brand-on); }
.pf-kind-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Двухколоночный ряд в форме (цена + количество, дата + комиссия) */
.pf-form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 480px) {
  .pf-form-row { grid-template-columns: 1fr; }
}
/* ===== Импорт сделок ===== */
.pf-import-drop {
  border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 28px 20px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-dim); transition: border-color .15s, background .15s, color .15s;
}
.pf-import-drop:hover, .pf-import-drop.is-dragover {
  border-color: color-mix(in oklab, var(--brand) 60%, var(--line));
  background: color-mix(in oklab, var(--brand) 5%, transparent);
  color: var(--text);
}
.pf-import-drop__text { display: flex; flex-direction: column; gap: 3px; line-height: 1.3; }
.pf-import-drop__text b { font-size: 14px; color: var(--text); }
.pf-import-drop__text span { font-size: 12px; }
.pf-import-status {
  font-size: 13px; line-height: 1.5; min-height: 20px;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.pf-import-preview-table {
  display: flex; flex-direction: column;
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  border-radius: 8px; overflow: hidden;
  font-variant-numeric: tabular-nums; font-size: 12px;
}
.pf-import-preview-row {
  display: grid; grid-template-columns: 90px 80px minmax(80px, 1fr) 80px 80px;
  gap: 8px; padding: 7px 12px;
  border-top: 1px solid var(--line-soft);
}
.pf-import-preview-row:first-child { border-top: 0; }
.pf-import-preview-row--head {
  font-size: 10.5px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600;
  background: var(--bg-elev);
}
.pf-import-preview-row--more { color: var(--text-muted); display: block; text-align: center; padding: 6px; }
.pf-import-help {
  font-size: 12px; color: var(--text-dim); line-height: 1.5;
  background: var(--bg-elev-2); border-radius: 8px; padding: 12px 14px;
}
.pf-import-help b { color: var(--text); display: block; margin-bottom: 4px; }
.pf-import-help ol { margin: 4px 0; padding-left: 20px; }
.pf-import-help li { margin: 2px 0; }

/* Импорт через API: список счетов с radio */
.pf-import-mode { display: flex; flex-direction: column; gap: 12px; }
.pf-import-accounts {
  background: var(--bg-elev-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px;
}
.pf-import-accounts__title {
  font-size: 11px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600; padding: 4px 8px;
}
.pf-import-account {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  transition: background .12s;
}
.pf-import-account:hover { background: var(--bg-elev); }
.pf-import-account input[type="radio"] { margin: 0; cursor: pointer; }
.pf-import-account span { display: flex; flex-direction: column; line-height: 1.25; }
.pf-import-account span b { font-size: 13px; font-weight: 600; color: var(--text); }
.pf-import-account span small { font-size: 11px; color: var(--text-dim); }

.pf-fee-wrap { display: flex; flex-direction: column; gap: 6px; }
.pf-fee-presets {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.pf-fee-preset {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border: 1px solid var(--line-soft); background: var(--bg-elev-2);
  color: var(--text-dim); font-size: 11.5px; font-weight: 500;
  padding: 4px 9px; border-radius: 6px;
  transition: color .12s, border-color .12s, background .12s;
}
.pf-fee-preset:hover { color: var(--text); border-color: var(--line); }
.pf-fee-preset.is-active {
  color: var(--brand-on); background: var(--brand-grad); border-color: transparent;
  font-weight: 600;
}

.pf-form-hint {
  font-size: 11.5px; color: var(--text-muted);
  margin-top: -8px; padding-left: 4px;
  font-variant-numeric: tabular-nums;
  min-height: 14px;
}

/* Выпадающий список с подсказками для поля тикера в форме портфеля */
.pf-ticker-label { position: relative; }
.pf-ticker-wrap { position: relative; }
.pf-suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 10;
  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: 280px; overflow: auto;
}
.pf-suggest__opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: 6px;
  background: transparent; border: 0; cursor: pointer; text-align: left;
  color: var(--text);
}
.pf-suggest__opt:hover, .pf-suggest__opt.is-active { background: var(--bg-elev-2); }
.pf-suggest__main { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; flex: 1; }
.pf-suggest__main b {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px; letter-spacing: .02em; font-weight: 700;
}
.pf-suggest__main span {
  font-size: 11px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pf-suggest__meta {
  font-size: 11px; color: var(--text-muted);
  font-variant-numeric: tabular-nums; flex: 0 0 auto;
}

/* Информационный «event-tag» вместо суммы — для событий без выплаты (отчёты, СД и т.п.) */
.pf-payout__money--info { align-items: flex-end; }

/* В режиме портфеля верхний навигатор и empty-состояние календаря не нужны */
body[data-app="portfolio"] .toolbar,
body[data-app="portfolio"] #empty { display: none; }

@media (max-width: 1100px) {
  .pf-stats { grid-template-columns: repeat(3, 1fr); }
  .pf-row, .pf-row--stock {
    grid-template-columns: minmax(140px, 1.2fr) 0.7fr 0.9fr 1.1fr 1.1fr 1.0fr 70px;
  }
  .pf-row--bond {
    grid-template-columns: minmax(140px, 1.2fr) 0.6fr 0.8fr 1.0fr 1.0fr 1.0fr 70px;
  }
  .pf-col-cur, .pf-col-div, .pf-col-mat { display: none; }
  .pf-row--head .pf-col-cur, .pf-row--head .pf-col-div, .pf-row--head .pf-col-mat { display: none; }
}
@media (max-width: 700px) {
  .pf-stats { grid-template-columns: 1fr 1fr; }

  /* Карточный layout вместо таблицы — каждая позиция занимает 3 строки. */
  .pf-row, .pf-row--stock, .pf-row--bond {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-areas:
      "tk  tk  tk"
      "qty avg cur"
      "val val pl"
      "act act act";
    gap: 8px 10px;
    padding: 12px 14px;
    align-items: start;
    font-size: 13px;
  }
  /* Заголовочную строку прячем — у каждой ячейки теперь свой мини-лейбл */
  .pf-row--head { display: none !important; }

  .pf-col-tk  { grid-area: tk; }
  .pf-col-qty { grid-area: qty; display: block !important; }
  .pf-col-avg { grid-area: avg; display: block !important; }
  .pf-col-cur { grid-area: cur; display: flex !important; flex-direction: column; gap: 0; }
  .pf-col-val { grid-area: val; display: block !important; }
  .pf-col-pl  { grid-area: pl; display: flex !important; flex-direction: column; gap: 0; align-items: flex-end; text-align: right; }
  .pf-col-act { grid-area: act; justify-self: end; margin-top: 2px; }

  /* Менее важное на мобиле скрываем (всё ещё доступно на десктопе) */
  .pf-col-div, .pf-col-coupon, .pf-col-mat, .pf-col-recd { display: none !important; }

  /* Inline-лейблы над значениями — заменяют отсутствующий thead */
  .pf-col-qty::before, .pf-col-avg::before, .pf-col-cur::before,
  .pf-col-val::before, .pf-col-pl::before {
    display: block;
    color: var(--text-muted); font-size: 10px;
    text-transform: uppercase; letter-spacing: 0.04em;
    margin-bottom: 2px; font-weight: 500;
  }
  .pf-col-qty::before { content: 'Кол-во'; }
  .pf-col-avg::before { content: 'Сред. цена'; }
  .pf-col-cur::before { content: 'Текущая'; }
  .pf-col-val::before { content: 'Стоимость'; }
  .pf-col-pl::before  { content: 'P/L'; text-align: right; }

  .pf-payout { grid-template-columns: 48px 1fr auto; gap: 10px; padding: 10px 12px; }
  .pf-payout__title { font-size: 12px; }
}

/* ===== месяц — классическая 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; }

/* Подсветка карточек/айтемов «Купить до» — приоритетные события для инвестора */
.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: auto 1fr; }
  .search { min-width: 0; width: 100%; }
  .calendar.is-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  /* На мобильной: лого + тема в первой строке, остальные переключатели — отдельными строками во всю ширину */
  .topbar__inner {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto auto auto;
    row-gap: 10px; gap: 12px;
  }
  .brand__logo { height: 32px; }
  .brand { grid-column: 1; grid-row: 1; }
  .topbar__right { grid-column: 3; grid-row: 1; justify-self: end; }
  .appswitch { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .sectionswitch { grid-column: 1 / -1; grid-row: 3; justify-self: stretch; }
  .viewswitch { grid-column: 1 / -1; grid-row: 4; justify-self: stretch; }
  .appswitch__btn, .viewswitch__btn { flex: 1; }
  body[data-app="portfolio"] .sectionswitch,
  body[data-app="portfolio"] .viewswitch { display: none; }
  .toolbar__inner { grid-template-columns: 1fr; gap: 10px; }
  .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; }
}

/* ===== 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; }
