/* v1.0.6 — history, previous-month leader and "Космос" theme refinements */

.birthday-card,
.previous-leader-card { grid-column:auto !important; }
.previous-leader-card {
  --panel-accent:var(--green);
  border-color:color-mix(in srgb,var(--green) 28%,var(--panel-border));
  padding:14px 15px;
}
.previous-leader-card .section-kicker { color:var(--green); }
.previous-leader-content { margin-top:9px; position:relative; z-index:1; }
.previous-leader-name { font-size:16px; font-weight:820; letter-spacing:-.025em; color:var(--text); }
.previous-leader-value { font-size:24px; line-height:1; font-weight:900; letter-spacing:-.045em; color:var(--green); margin-top:8px; }
.previous-leader-percent { color:var(--muted); font-size:10.5px; margin-top:7px; }
.history-loading,.history-empty-card { color:var(--muted); font-size:10.5px; line-height:1.45; }

.history-settings-card { padding-bottom:12px; }
.history-card-head { gap:18px; align-items:flex-start; }
.history-note { margin:4px 0 0; max-width:680px; }
.history-toolbar { display:flex; align-items:center; gap:10px; margin:12px 0 10px; }
.history-month-label { color:var(--muted); font-size:10px; font-weight:700; }
.history-month-select { width:220px; }
.history-source-badge { display:inline-flex; align-items:center; min-height:28px; padding:5px 9px; border-radius:999px; background:color-mix(in srgb,var(--brand) 10%,transparent); color:var(--brand); font-size:9.5px; font-weight:800; border:1px solid color-mix(in srgb,var(--brand) 20%,transparent); }
.history-summary { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:7px; margin-bottom:10px; }
.history-summary-card { min-width:0; border:1px solid var(--panel-border); border-radius:10px; padding:8px 9px; background:color-mix(in srgb,var(--panel-2) 82%,transparent); position:relative; overflow:hidden; }
.history-summary-card:before { content:""; position:absolute; inset:0 auto 0 0; width:2px; background:var(--history-accent,var(--brand)); }
.history-summary-card span { display:block; color:var(--muted); font-size:8.5px; margin-bottom:4px; }
.history-summary-card strong { display:block; color:var(--text); font-size:11.5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.history-revenue { --history-accent:var(--cyan); }
.history-deposits { --history-accent:var(--green); }
.history-objects { --history-accent:var(--orange); }
.history-applications { --history-accent:var(--violet); }
.history-selections { --history-accent:var(--brand); }
.history-showings { --history-accent:#58c9c4; }
.history-reductions { --history-accent:var(--red); }
.history-table-wrap { max-height:310px; overflow:auto; border:1px solid var(--panel-border); border-radius:11px; }
.history-table { width:100%; border-collapse:collapse; font-size:9.6px; }
.history-table thead { position:sticky; top:0; z-index:2; background:var(--bg-soft); }
.history-table th { padding:7px 8px; text-align:right; color:var(--muted); font-size:8.5px; text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid var(--panel-border); }
.history-table th:nth-child(2),.history-table td:nth-child(2) { text-align:left; }
.history-table td { padding:7px 8px; text-align:right; color:var(--text); border-bottom:1px solid color-mix(in srgb,var(--panel-border) 70%,transparent); }
.history-table tbody tr:last-child td { border-bottom:0; }
.history-table tbody tr:hover td { background:color-mix(in srgb,var(--brand) 4%,transparent); }
.history-empty { text-align:center !important; color:var(--muted) !important; padding:18px !important; }
.history-status { color:var(--muted); font-size:9.5px; line-height:1.45; margin-top:8px; }

body[data-theme-preset="light"] {
  --text:#102033 !important;
  --muted:#667d94 !important;
  --muted-2:#7f92a7 !important;
}
body[data-theme-preset="light"] .brand-title,
body[data-theme-preset="light"] .period-block strong,
body[data-theme-preset="light"] .clock,
body[data-theme-preset="light"] .panel-header h2,
body[data-theme-preset="light"] .accent-panel h3,
body[data-theme-preset="light"] .birthday-name,
body[data-theme-preset="light"] .previous-leader-name,
body[data-theme-preset="light"] .kpi-main,
body[data-theme-preset="light"] .ratio,
body[data-theme-preset="light"] .ratio strong,
body[data-theme-preset="light"] .rev-cell strong,
body[data-theme-preset="light"] .name-cell,
body[data-theme-preset="light"] .team-table tbody td,
body[data-theme-preset="light"] .event-title,
body[data-theme-preset="light"] .settings-modal,
body[data-theme-preset="light"] .settings-head h2,
body[data-theme-preset="light"] .settings-card h3,
body[data-theme-preset="light"] .service-item strong,
body[data-theme-preset="light"] .history-table td,
body[data-theme-preset="light"] .history-summary-card strong,
body[data-theme-preset="light"] .code-modal h2 { color:#102033 !important; }
body[data-theme-preset="light"] .brand-subtitle,
body[data-theme-preset="light"] .kpi-plan,
body[data-theme-preset="light"] .kpi-hint,
body[data-theme-preset="light"] .team-meta,
body[data-theme-preset="light"] .ratio .plan,
body[data-theme-preset="light"] .event-note,
body[data-theme-preset="light"] .field-label,
body[data-theme-preset="light"] .field-note,
body[data-theme-preset="light"] .birthday-countdown,
body[data-theme-preset="light"] .previous-leader-percent,
body[data-theme-preset="light"] .history-status,
body[data-theme-preset="light"] .history-note,
body[data-theme-preset="light"] .history-month-label { color:#687f96 !important; }
body[data-theme-preset="light"] .team-table thead th,
body[data-theme-preset="light"] .section-kicker,
body[data-theme-preset="light"] .eyebrow { color:#688198; }
body[data-theme-preset="light"] .text-input,
body[data-theme-preset="light"] .text-area,
body[data-theme-preset="light"] .theme-select { background:#fff !important; color:#102033 !important; border-color:rgba(26,67,105,.14) !important; }
body[data-theme-preset="light"] .team-table tbody tr,
body[data-theme-preset="light"] .event-item,
body[data-theme-preset="light"] .settings-card,
body[data-theme-preset="light"] .history-summary-card { background:rgba(255,255,255,.74) !important; }
body[data-theme-preset="light"] .settings-modal,
body[data-theme-preset="light"] .code-modal { background:#f7fbff !important; }
body[data-theme-preset="light"] .history-table thead { background:#edf4fa; }

body[data-theme-preset="graphite"] {
  --text:#f4f8fd !important;
  --muted:#8298ad !important;
  --muted-2:#668097 !important;
  background:radial-gradient(circle at 86% -10%,rgba(42,111,161,.20),transparent 35%),radial-gradient(circle at 8% 100%,rgba(31,79,111,.11),transparent 34%),linear-gradient(145deg,#040b12 0%,#061522 48%,#081a29 100%) !important;
}
body[data-theme-preset="graphite"] .app-shell { background:transparent; }
body[data-theme-preset="graphite"] .topbar { position:relative; }
body[data-theme-preset="graphite"] .topbar:after { content:""; position:absolute; left:0; right:0; bottom:-7px; height:1px; background:linear-gradient(90deg,transparent,rgba(63,124,167,.16),transparent); }
body[data-theme-preset="graphite"] .kpi-card,
body[data-theme-preset="graphite"] .panel { background:linear-gradient(150deg,rgba(8,27,41,.96),rgba(6,20,31,.98)) !important; border-color:rgba(84,129,160,.22) !important; box-shadow:0 10px 30px rgba(0,0,0,.16),inset 0 1px 0 rgba(255,255,255,.015) !important; }
body[data-theme-preset="graphite"] .team-table tbody tr,
body[data-theme-preset="graphite"] .event-item,
body[data-theme-preset="graphite"] .settings-card,
body[data-theme-preset="graphite"] .history-summary-card { background:rgba(8,30,45,.58) !important; border-color:rgba(82,131,164,.12) !important; }
body[data-theme-preset="graphite"] .settings-modal,
body[data-theme-preset="graphite"] .code-modal { background:linear-gradient(145deg,#071827,#06131f) !important; border-color:rgba(91,144,180,.2) !important; }
body[data-theme-preset="graphite"] .text-input,
body[data-theme-preset="graphite"] .text-area,
body[data-theme-preset="graphite"] .theme-select { background:#06131f !important; border-color:rgba(84,129,160,.22) !important; color:#f4f8fd !important; }
body[data-theme-preset="graphite"] .brand-mark { background:linear-gradient(145deg,#38a0ff,#286fc6) !important; color:#06101a; box-shadow:0 8px 22px rgba(49,136,224,.22); }
body[data-theme-preset="graphite"] .drawer-toggle,
body[data-theme-preset="graphite"] .icon-btn { background:rgba(6,24,37,.92) !important; border-color:rgba(85,137,172,.26) !important; }
body[data-theme-preset="graphite"] .history-table thead { background:#071827; }
body[data-theme-preset="graphite"] .leader-row { background:linear-gradient(90deg,rgba(50,153,198,.10),rgba(8,30,45,.52)) !important; }

@media (max-width:1500px) {
  .history-summary { grid-template-columns:repeat(4,minmax(0,1fr)); }
}
