:root {
  --f-display: 'Bricolage Grotesque', sans-serif;
  --f-body: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-num: 'JetBrains Mono', ui-monospace, monospace;

  --bg: #eaeef6;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f9;
  --line: #e6eaf2;
  --line-strong: #d3dae8;
  --ink: #0b1220;
  --ink-2: #1b2438;
  --muted: #515a6e;
  --muted-2: #6b7488;

  --accent: #2b59ff;
  --accent-d: #1e44e0;
  --accent-soft: #e9eeff;
  --accent-2: #11b3a3;

  --good: #0f9d6b;
  --good-soft: #e2f6ec;
  --bad: #e0483d;
  --bad-soft: #fdeceb;
  --amber: #e08a00;
  --violet: #7c5cfc;

  --shadow-xs: 0 1px 2px rgba(13, 22, 45, .05);
  --shadow-sm: 0 1px 3px rgba(13, 22, 45, .06), 0 1px 2px rgba(13, 22, 45, .04);
  --shadow: 0 2px 6px rgba(13, 22, 45, .05), 0 12px 28px rgba(13, 22, 45, .07);
  --shadow-md: 0 6px 16px rgba(13, 22, 45, .08), 0 20px 48px rgba(13, 22, 45, .12);
  --shadow-lg: 0 24px 70px rgba(11, 18, 32, .28);
  --glow: 0 8px 24px rgba(43, 89, 255, .35);
  --glow-bad: 0 8px 22px rgba(224, 72, 61, .32);

  --r: 18px;
  --r-sm: 12px;
  --r-xs: 9px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  min-height: 100vh;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1000px 640px at 6% -8%, rgba(43, 89, 255, .14), transparent 58%),
    radial-gradient(860px 620px at 102% -2%, rgba(17, 179, 163, .12), transparent 55%),
    radial-gradient(700px 520px at 55% 4%, rgba(124, 92, 252, .07), transparent 60%),
    linear-gradient(180deg, #eef2f9, #e7ebf4);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(rgba(13, 22, 45, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 22, 45, .035) 1px, transparent 1px);
  background-size: 140px 140px, 44px 44px, 44px 44px;
  -webkit-mask-image: radial-gradient(circle at 50% 0%, #000, transparent 85%);
  mask-image: radial-gradient(circle at 50% 0%, #000, transparent 85%);
}

svg { display: block; }
.ic, .icon-btn svg, .modal-ic svg, .brand-mark svg, .empty-ic svg,
.section-title .sic, .kpi-ic svg, .metric-ic svg, .toast .tic, .card-ic svg,
.chart-head .cic svg, .edit-section-title svg, .delta svg {
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ic { width: 17px; height: 17px; }

.app { max-width: 1340px; margin: 0 auto; padding: 22px 26px 70px; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
.reveal { animation: fadeUp .5s cubic-bezier(.2, .7, .2, 1) both; }

/* ============ Шапка ============ */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 11px 14px 11px 16px; margin-bottom: 24px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .9);
  border-radius: var(--r);
  position: sticky; top: 12px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: var(--r-sm); color: #fff;
  background: linear-gradient(140deg, #3a67ff 0%, #2b59ff 45%, #11b3a3 130%);
  display: grid; place-items: center; box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.brand-mark svg { width: 24px; height: 24px; stroke-width: 2.4; }
.brand-text { display: flex; flex-direction: column; line-height: 1.18; }
.brand-text strong { font-family: var(--f-display); font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.brand-text span { font-size: 11.5px; color: var(--muted-2); font-weight: 500; }

.month-tabs {
  display: flex; gap: 4px; margin-left: 6px; flex: 1; overflow-x: auto;
  padding: 5px; background: var(--surface-3); border-radius: var(--r-sm); border: 1px solid var(--line);
}
.month-tabs::-webkit-scrollbar { height: 0; }
.month-tab {
  flex: 0 0 auto; padding: 8px 15px; border-radius: var(--r-xs); border: none; background: transparent;
  color: var(--muted); font-family: var(--f-body); font-weight: 600; font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: .18s ease; letter-spacing: -.01em;
}
.month-tab:hover { color: var(--ink); background: rgba(255, 255, 255, .6); }
.month-tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.tab-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); margin-left: 7px; vertical-align: 1.5px; }

.topbar-actions { display: flex; gap: 9px; }

/* ============ Кнопки ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  font-family: var(--f-body); font-weight: 600; font-size: 13.5px; letter-spacing: -.01em;
  padding: 10px 16px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid transparent; transition: transform .14s ease, box-shadow .2s ease, background .18s ease, border-color .18s, opacity .15s;
  white-space: nowrap; position: relative;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; box-shadow: var(--shadow-xs); }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite;
}
.btn-ghost.is-loading::after, .btn-danger-ghost.is-loading::after { border-color: rgba(43, 89, 255, .3); border-top-color: var(--accent); }
.btn-lg { padding: 13px 22px; font-size: 14.5px; border-radius: 14px; }
.btn-primary { background: linear-gradient(180deg, #3a67ff, #2b59ff); color: #fff; box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(43, 89, 255, .45), inset 0 1px 0 rgba(255, 255, 255, .35); background: linear-gradient(180deg, #3a67ff, #1e44e0); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.btn-ghost:hover { transform: translateY(-1px); background: var(--surface-2); border-color: #c3cbdd; box-shadow: var(--shadow-sm); }
.btn-danger { background: linear-gradient(180deg, #e85a4f, #e0483d); color: #fff; box-shadow: var(--glow-bad), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-danger:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(224, 72, 61, .45); background: linear-gradient(180deg, #e85a4f, #c5392f); }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: #f3c7c3; }
.btn-danger-ghost:hover { background: var(--bad-soft); border-color: #eaa9a3; }
.btn:focus-visible, .month-tab:focus-visible, .icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.btn-primary:focus-visible { box-shadow: 0 0 0 4px rgba(43, 89, 255, .3), var(--glow); }
.btn-danger:focus-visible { box-shadow: 0 0 0 4px rgba(224, 72, 61, .3), var(--glow-bad); }

/* ============ Заголовок месяца ============ */
.month-head { display: flex; align-items: center; gap: 14px; margin: 6px 2px 18px; flex-wrap: wrap; }
.month-head h1 { font-family: var(--f-display); font-size: 30px; font-weight: 800; margin: 0; letter-spacing: -.025em; }
.month-head .vs { font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 5px 12px 5px 9px; border-radius: 20px; box-shadow: var(--shadow-xs); display: inline-flex; align-items: center; gap: 6px; }
.month-head .vs svg { width: 14px; height: 14px; color: var(--accent); }
.month-head .vs b { color: var(--ink); font-weight: 600; }

/* ============ KPI ============ */
.kpi-grid { display: grid; gap: 15px; margin-bottom: 24px; grid-template-columns: repeat(4, 1fr); }
.kpi {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 17px 19px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .22s ease, border-color .18s;
}
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #d8deec; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: -.01em; }
.kpi-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto; }
.kpi-ic svg { width: 18px; height: 18px; }
.kpi-mid { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi-value { font-family: var(--f-num); font-size: 25px; font-weight: 700; margin: 11px 0 9px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 11.5px; color: var(--muted-2); font-weight: 500; }
.kpi-foot { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; min-height: 22px; }
.spark { width: 96px; height: 34px; flex: 0 0 auto; margin-bottom: 11px; opacity: .95; }
.kpi.hero .spark { width: 150px; height: 46px; }

/* Гейдж маржи против ориентира */
.gauge { position: relative; height: 5px; border-radius: 4px; background: var(--surface-3); margin: 2px 0 8px; overflow: hidden; }
.gauge i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--amber); transition: width .6s cubic-bezier(.2, .7, .2, 1); }
.gauge i.ok { background: var(--good); }

/* Баннер незаполненного месяца */
.notice {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
  background: linear-gradient(90deg, #fdf3dd, #fdf8ec 70%); border: 1px solid #f0dcb2;
  border-radius: var(--r); padding: 14px 18px; box-shadow: var(--shadow-xs);
}
.notice-ic { width: 38px; height: 38px; border-radius: 11px; background: var(--amber); color: #fff; display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 6px 16px rgba(224, 138, 0, .3); }
.notice-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.notice-tx { flex: 1; min-width: 0; }
.notice-tx b { font-family: var(--f-display); font-size: 14px; display: block; }
.notice-tx span { font-size: 12.5px; color: #8a6a1f; }

.kpi.hero {
  grid-column: span 2; border: none; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #21306b 0%, #131a37 55%, #0e1430 100%);
  box-shadow: var(--shadow-md);
}
.kpi.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(420px 180px at 90% -10%, rgba(43, 89, 255, .55), transparent 60%), radial-gradient(360px 200px at 10% 120%, rgba(17, 179, 163, .35), transparent 60%); pointer-events: none; }
.kpi.hero .kpi-label { color: #aebbe0; }
.kpi.hero .kpi-ic { background: rgba(255, 255, 255, .12); color: #cdd8ff; }
.kpi.hero .kpi-value { font-size: 36px; color: #fff; }
.kpi.hero .kpi-sub { color: #b8c4e6; }

.delta { display: inline-flex; align-items: center; gap: 4px; font-family: var(--f-num); font-size: 12px; font-weight: 700; padding: 3px 9px 3px 7px; border-radius: 8px; font-variant-numeric: tabular-nums; }
.delta svg { width: 13px; height: 13px; stroke-width: 2.6; }
.delta.up { color: var(--good); background: var(--good-soft); }
.delta.down { color: var(--bad); background: var(--bad-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); }
.kpi.hero .delta.up { background: rgba(15, 157, 107, .22); color: #57e1a4; }
.kpi.hero .delta.down { background: rgba(224, 72, 61, .22); color: #ff998e; }
.kpi.hero .delta.flat { background: rgba(255, 255, 255, .14); color: #c2cdf0; }

/* ============ Секции ============ */
.section { margin-bottom: 26px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 2px 14px; }
.section-title .sic { width: 30px; height: 30px; border-radius: var(--r-xs); background: var(--ink); color: #fff; display: grid; place-items: center; }
.section-title .sic svg { width: 16px; height: 16px; stroke-width: 2.1; }
.section-title h2 { font-family: var(--f-display); font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -.015em; }
.section-title .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-2 > .col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--line); font-family: var(--f-display); font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.card-head .lead { display: flex; align-items: center; gap: 9px; }
.card-ic { width: 30px; height: 30px; border-radius: var(--r-xs); display: grid; place-items: center; flex: 0 0 auto; }
.card-ic svg { width: 16px; height: 16px; stroke-width: 2.1; }
.card-head .muted { font-family: var(--f-body); font-weight: 500; color: var(--muted-2); font-size: 11.5px; }

/* ============ Таблица аккаунтов ============ */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
.table-scroll table { min-width: 520px; }
thead th { text-align: right; font-size: 11px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .03em; padding: 11px 18px; border-bottom: 1px solid var(--line); }
thead th:first-child { text-align: left; }
tbody td { padding: 12px 18px; text-align: right; font-size: 13px; font-family: var(--f-num); font-weight: 500; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--line); color: var(--ink-2); }
tbody tr:last-child td { border-bottom: none; }
tbody td:first-child { text-align: left; font-family: var(--f-body); font-weight: 600; color: var(--ink); white-space: nowrap; }
tbody tr { transition: background .14s; }
tbody tr:hover { background: var(--surface-2); }
.acc-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 10px; vertical-align: middle; }
.tag-cv { display: inline-block; padding: 2px 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; font-family: var(--f-num); white-space: nowrap; }
td.rank-best { color: var(--good); font-weight: 700; }
td.rank-worst { color: var(--bad); }
.rank-hint { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted-2); font-family: var(--f-body); font-weight: 500; }
.rank-hint i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
tfoot td { padding: 13px 18px; text-align: right; font-size: 13px; font-family: var(--f-num); font-weight: 700; border-top: 2px solid var(--line-strong); background: var(--surface-2); color: var(--ink); white-space: nowrap; }
tfoot td:first-child { text-align: left; font-family: var(--f-body); font-weight: 700; }

/* ============ Метрики ============ */
.metric-list { display: flex; flex-direction: column; }
.metric-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); transition: background .14s; }
.metric-row:last-child { border-bottom: none; }
.metric-row:hover { background: var(--surface-2); }
.metric-ic { width: 30px; height: 30px; border-radius: var(--r-xs); background: var(--surface-3); color: var(--muted); display: grid; place-items: center; flex: 0 0 auto; }
.metric-ic svg { width: 16px; height: 16px; }
.metric-row .ml { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.metric-row .ml b { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.metric-row .ml small { font-size: 11px; color: var(--muted-2); }
.metric-row .mr { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.metric-row .mv { font-family: var(--f-num); font-size: 14.5px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.metric-row.accent { background: linear-gradient(90deg, var(--accent-soft) 0%, rgba(233, 238, 255, .4) 55%, transparent 100%); }
.metric-row.accent .metric-ic { background: var(--accent); color: #fff; }
.metric-row.accent .mv { color: var(--accent); }
.metric-row.profit { background: linear-gradient(90deg, var(--good-soft) 0%, rgba(226, 246, 236, .4) 55%, transparent 100%); }
.metric-row.profit .metric-ic { background: var(--good); color: #fff; }
.metric-row.profit .mv { color: var(--good); }

/* ============ Графики ============ */
.donut-wrap { position: relative; height: 250px; padding: 14px 16px 10px; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 17px 19px; transition: transform .18s, box-shadow .22s; }
.chart-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.chart-head { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.chart-head .cic { width: 30px; height: 30px; border-radius: var(--r-xs); display: grid; place-items: center; flex: 0 0 auto; }
.chart-head .cic svg { width: 16px; height: 16px; stroke-width: 2.1; }
.chart-head-tx h4 { font-family: var(--f-display); margin: 0; font-size: 13.5px; font-weight: 700; }
.chart-head-tx .sub { font-size: 11.5px; color: var(--muted-2); margin: 1px 0 0; }
.chart-wrap { position: relative; height: 240px; }

/* ============ Пустое состояние ============ */
.empty { display: grid; place-items: center; padding: 70px 0; }
.empty-card { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 44px 54px; box-shadow: var(--shadow); }
.empty-ic { width: 60px; height: 60px; border-radius: 16px; margin: 0 auto 18px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.empty-ic svg { width: 28px; height: 28px; }
.empty-card h2 { font-family: var(--f-display); margin: 0 0 7px; font-size: 21px; }
.empty-card p { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.empty-card .btn { margin: 0 auto; }

/* ============ Модалки ============ */
@keyframes overlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-overlay { position: fixed; inset: 0; background: rgba(9, 14, 28, .48); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; padding: 22px; animation: overlayIn .22s ease both; }
.modal { background: var(--surface); border-radius: 22px; width: min(900px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border: 1px solid var(--line); animation: modalIn .32s cubic-bezier(.2, .8, .2, 1) both; overflow: hidden; }
.modal-sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head-title { display: flex; align-items: center; gap: 13px; }
.modal-ic { width: 42px; height: 42px; border-radius: var(--r-sm); background: linear-gradient(140deg, #3a67ff, #2b59ff); color: #fff; display: grid; place-items: center; box-shadow: var(--glow); flex: 0 0 auto; }
.modal-ic.danger { background: linear-gradient(140deg, #e85a4f, #e0483d); box-shadow: var(--glow-bad); }
.modal-ic svg { width: 20px; height: 20px; stroke-width: 2.1; }
.modal-head h3 { font-family: var(--f-display); margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.015em; }
.modal-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted-2); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 10px; padding: 15px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--muted); display: grid; place-items: center; transition: .16s; flex: 0 0 auto; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--bad-soft); color: var(--bad); border-color: #f0c4bf; }

.edit-block { margin-bottom: 20px; }
.edit-block:last-child { margin-bottom: 0; }
.edit-section-title { display: flex; align-items: center; gap: 8px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin: 0 0 12px; }
.edit-section-title svg { width: 15px; height: 15px; color: var(--accent); }
.edit-table { width: 100%; }
.edit-table th { text-align: right; padding: 4px 8px 8px; font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .02em; font-weight: 700; }
.edit-table th:first-child { text-align: left; }
.edit-table td { padding: 4px 8px; }
.edit-table td:first-child { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.field-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.field-grid-4 { grid-template-columns: repeat(4, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; font-weight: 600; color: var(--muted); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .unit { position: absolute; right: 13px; font-size: 12px; font-weight: 600; color: var(--muted-2); pointer-events: none; font-family: var(--f-body); }
input, select { font-family: var(--f-body); font-size: 14px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); width: 100%; transition: .16s; }
.num-input, .input-wrap input { font-family: var(--f-num); font-weight: 600; text-align: right; padding-right: 34px; font-variant-numeric: tabular-nums; }
.field-row input { padding-right: 12px; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
select {
  cursor: pointer; -webkit-appearance: none; appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7488' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 17px;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: #fff; }
input.field-error { border-color: var(--bad); box-shadow: 0 0 0 4px var(--bad-soft); }
.hint { font-size: 12.5px; color: var(--bad); min-height: 16px; margin: 10px 0 0; font-weight: 500; display: flex; align-items: center; gap: 6px; opacity: 1; transition: opacity .15s; }
.hint:empty { opacity: 0; }
.hint-foot { margin: 0; padding: 0 22px 14px; }

/* ============ Тосты ============ */
.toast-wrap { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
.toast { display: flex; align-items: center; gap: 11px; padding: 13px 17px 13px 14px; background: var(--ink); color: #fff; border-radius: 13px; box-shadow: var(--shadow-md); font-size: 13.5px; font-weight: 600; animation: toastIn .3s cubic-bezier(.2, .8, .2, 1) both; }
.toast.out { animation: toastOut .25s ease forwards; }
.toast .tic { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.toast .tic svg { width: 15px; height: 15px; stroke-width: 2.4; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.toast.ok .tic { background: rgba(15, 157, 107, .25); color: #57e1a4; }
.toast.del .tic { background: rgba(224, 72, 61, .25); color: #ff998e; }

/* ============ Адаптив ============ */
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi.hero { grid-column: span 2; }
  .grid-2, .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { padding: 14px 13px 50px; }
  .topbar { flex-wrap: wrap; padding: 11px; }
  .month-tabs { order: 3; width: 100%; margin-left: 0; }
  .topbar-actions { flex: 1; }
  .topbar-actions .btn { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .kpi.hero { grid-column: span 2; }
  .kpi-value { font-size: 21px; }
  .kpi.hero .kpi-value { font-size: 30px; }
  .spark { width: 70px; height: 28px; }
  .kpi.hero .spark { width: 110px; height: 38px; }
  .field-grid, .field-grid-4 { grid-template-columns: 1fr 1fr; }
  .month-head h1 { font-size: 24px; }
  thead th, tbody td, tfoot td { padding: 10px 12px; font-size: 12px; }
  .chart-wrap { height: 210px; }
  .chart-card { padding: 15px 15px; }
  .notice { flex-wrap: wrap; }
  .notice .btn { width: 100%; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn-danger-ghost { order: 3; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
