:root {
  --bg: #141519;
  --bg-grad: radial-gradient(1200px 600px at 70% -10%, rgba(59,130,246,.10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(236,72,153,.07), transparent 60%);
  --card: rgba(36,37,43,.72);
  --card-solid: #24252b;
  --card-2: rgba(255,255,255,.04);
  --line: rgba(255,255,255,.07);
  --line-2: rgba(255,255,255,.12);
  --hi: inset 0 1px 0 rgba(255,255,255,.06);
  --text: #f3f4f6;
  --muted: #9ca3af;
  --dim: #6b7280;
  --accent: #3b82f6;
  --accent-2: #60a5fa;
  --pink: #ec4899;
  --green: #22c55e;
  --cyan: #22d3ee;
  --orange: #f59e0b;
  --red: #f43f5e;
  --purple: #a78bfa;
  --shadow: 0 10px 40px rgba(0,0,0,.35);
  --r: 22px;
  --r-sm: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef0f4;
  --bg-grad: radial-gradient(1200px 600px at 70% -10%, rgba(59,130,246,.10), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(236,72,153,.06), transparent 60%);
  --card: rgba(255,255,255,.78);
  --card-solid: #ffffff;
  --card-2: rgba(15,23,42,.035);
  --line: rgba(15,23,42,.07);
  --line-2: rgba(15,23,42,.12);
  --hi: inset 0 1px 0 rgba(255,255,255,.9);
  --text: #111827;
  --muted: #6b7280;
  --dim: #9ca3af;
  --shadow: 0 10px 30px rgba(15,23,42,.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-grad), var(--bg); background-attachment: fixed;
  color: var(--text);
  font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; left: 14px; top: 14px; bottom: 14px; width: 64px; z-index: 20;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 0;
  background: var(--card); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 32px; box-shadow: var(--shadow), var(--hi);
}
.logo { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px;
  background: linear-gradient(140deg, var(--accent-2), var(--accent)); box-shadow: 0 6px 20px rgba(59,130,246,.45); color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -.5px; }
.nav-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; position: relative; transition: .18s; }
.nav-btn:hover { color: var(--text); background: var(--card-2); }
.nav-btn.active { color: var(--accent-2); background: rgba(59,130,246,.14); box-shadow: inset 0 0 0 1px rgba(96,165,250,.25); }
.nav-btn svg { width: 20px; height: 20px; }
.nav-btn .badge { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--pink); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.nav-spacer { flex: 1; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(140deg, var(--pink), var(--purple)); border: 0; cursor: pointer; }
.tip { position: absolute; left: 56px; white-space: nowrap; background: var(--card-solid); border: 1px solid var(--line); padding: 4px 10px; border-radius: 8px; font-size: 12px; color: var(--text); opacity: 0; pointer-events: none; transition: .15s; box-shadow: var(--shadow); }
.nav-btn:hover .tip { opacity: 1; }

.main { flex: 1; margin-left: 92px; padding: 18px 24px 40px 12px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; }
.island { display: inline-flex; align-items: center; gap: 10px; padding: 7px 16px 7px 10px; border-radius: 999px; background: #0b0b0d; color: #f3f4f6; border: 1px solid rgba(255,255,255,.08); font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.island .dot { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #f59e0b; border-right-color: transparent; }
.island b { color: #f59e0b; font-weight: 600; }
.tools { display: inline-flex; gap: 4px; padding: 5px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--hi); backdrop-filter: blur(20px); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: .15s; }
.icon-btn:hover { background: var(--card-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
h1 { font-size: 30px; line-height: 1.15; margin: 0; letter-spacing: -.6px; font-weight: 700; }
.sub { color: var(--muted); margin-top: 4px; }
h2 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -.2px; }
.card-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); cursor: pointer; font-weight: 500; transition: .15s; white-space: nowrap; box-shadow: var(--hi); }
.btn:hover { background: var(--card-2); border-color: var(--line-2); filter: brightness(1.1); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(180deg, #4f8ff7, var(--accent)); border-color: transparent; color: #fff; box-shadow: 0 6px 22px rgba(59,130,246,.45), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.pink { background: linear-gradient(180deg, #f0609f, var(--pink)); border-color: transparent; color: #fff; box-shadow: 0 6px 22px rgba(236,72,153,.4), inset 0 1px 0 rgba(255,255,255,.25); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.danger { color: var(--red); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--hi); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--muted); height: 30px; padding: 0 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; font-weight: 500; font-size: 13px; position: relative; }
.seg button:hover { color: var(--text); }
.seg button.active { background: rgba(255,255,255,.1); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
:root[data-theme="light"] .seg button.active { background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.1); }
.seg button.has::after { content: ""; position: absolute; top: 5px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.seg button.closed::after { background: var(--accent-2); }
.seg button.ovs::after { background: var(--orange); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.input, select.input, textarea.input { height: 38px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card-2); outline: none; transition: .15s; min-width: 0; }
textarea.input { height: auto; padding: 10px 14px; resize: vertical; min-height: 80px; line-height: 1.45; }
.input:focus { border-color: rgba(96,165,250,.6); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
select.input option, select.input optgroup { background: var(--card-solid); color: var(--text); }
label.field { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
label.field .input { color: var(--text); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--line-2); transition: .2s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(16px); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow), var(--hi); backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3); position: relative; min-width: 0; animation: rise .45s cubic-bezier(.2,.8,.2,1) both; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-link { color: var(--accent-2); font-size: 13px; font-weight: 500; cursor: pointer; background: none; border: 0; padding: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.grid { display: grid; gap: 14px; }
.g-dash { grid-template-columns: repeat(12, 1fr); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 16px 12px; min-width: 150px; box-shadow: var(--hi); flex: 1 1 150px; animation: rise .45s both; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; white-space: nowrap; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.delta { font-size: 12px; font-weight: 600; margin-top: 2px; }
.up { color: var(--green); } .down { color: var(--red); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.blue { background: rgba(59,130,246,.15); color: #7fb0fb; }
.chip.green { background: rgba(34,197,94,.14); color: #4ade80; }
.chip.orange { background: rgba(245,158,11,.14); color: #fbbf24; }
.chip.pink { background: rgba(236,72,153,.14); color: #f472b6; }
.chip.gray { background: var(--card-2); color: var(--muted); }
.chip.red { background: rgba(244,63,94,.14); color: #fb7185; }
:root[data-theme="light"] .chip.blue { color: #2563eb; } :root[data-theme="light"] .chip.green { color: #16a34a; }
:root[data-theme="light"] .chip.orange { color: #b45309; } :root[data-theme="light"] .chip.pink { color: #db2777; } :root[data-theme="light"] .chip.red { color: #e11d48; }

/* rings */
.rings-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; padding: 6px 0; }
.ring-legend { display: grid; gap: 12px; }
.ring-legend .it { border-left: 3px solid; padding-left: 10px; }
.ring-legend .t { font-size: 12px; color: var(--muted); }
.ring-legend .v { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.ring-legend .v small { font-size: 12px; color: var(--muted); font-weight: 500; }

/* lists */
.list { display: grid; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.li:first-child { border-top: 0; }
.li .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.li .name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li .val { font-weight: 600; white-space: nowrap; }
.li .pct { width: 52px; text-align: right; color: var(--muted); font-weight: 600; }
.bar-track { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; border-radius: 3px; transition: width .6s cubic-bezier(.2,.8,.2,1); }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; }
.tbl-wrap { overflow-x: auto; }

/* ---------- PNL table ---------- */
.pnl-wrap { overflow: auto; max-height: calc(100vh - 210px); border-radius: var(--r); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow), var(--hi); backdrop-filter: blur(24px); }
table.pnl { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; }
.pnl th, .pnl td { padding: 0 10px; height: 34px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.pnl thead th { position: sticky; top: 0; z-index: 3; background: var(--card-solid); font-weight: 600; font-size: 12px; color: var(--muted); text-align: right; height: 52px; vertical-align: middle; }
.pnl thead th:first-child { text-align: left; left: 0; z-index: 4; }
.pnl td:first-child, .pnl th:first-child { position: sticky; left: 0; background: var(--card-solid); z-index: 2; min-width: 300px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--line); }
.pnl td.v { text-align: right; min-width: 104px; font-variant-numeric: tabular-nums; }
.pnl td.tot { background: rgba(255,255,255,.025); font-weight: 600; min-width: 120px; text-align: right; }
.pnl .mh { display: grid; justify-items: end; gap: 4px; cursor: pointer; }
.pnl .mh:hover .mname { color: var(--text); }
.pnl tr.section td { height: 40px; font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--card-solid); border-bottom: 1px solid var(--line-2); }
.pnl tr.section td.fill { background: var(--card-solid); }
.pnl tr.total td { font-weight: 700; }
.pnl tr.total.big td { font-size: 14px; height: 40px; }
.pnl tr.total.big td:first-child { color: var(--accent-2); }
.pnl tr.sub td { font-weight: 600; }
.pnl tr.pct td { color: var(--muted); font-size: 12px; height: 28px; }
.pnl tr.pct td:first-child { font-weight: 400; padding-left: 26px; }
.pnl tr.leaf td:first-child { padding-left: 42px; color: var(--muted); }
.pnl tr.meta td:first-child { color: var(--muted); }
.pnl .ind1 { padding-left: 26px !important; }
.pnl tr.pct .ind1 { padding-left: 42px !important; }
/* редактируемые ячейки — мягкая голубая подложка; итоги, проценты и закрытые месяцы без подсветки */
.pnl td.edit { cursor: cell; position: relative; background-color: rgba(59,130,246,.055); box-shadow: inset 2px 0 0 rgba(96,165,250,.22); }
.pnl tbody tr:hover td.edit { background-color: rgba(59,130,246,.08); }
.pnl td.edit:hover, .pnl tbody tr:hover td.edit:hover { background-color: rgba(59,130,246,.14); box-shadow: inset 0 0 0 1px rgba(96,165,250,.45); }
:root[data-theme="light"] .pnl td.edit { background-color: rgba(59,130,246,.06); }
.pnl td.edit.locked, .pnl td.edit.locked:hover, .pnl tbody tr:hover td.edit.locked { cursor: default; background-color: transparent; box-shadow: none; }
.pnl td.sel { background: rgba(59,130,246,.18) !important; box-shadow: inset 0 0 0 1.5px var(--accent) !important; }
.pnl td.auto { color: var(--purple); font-style: italic; }
.pnl td.hascomment::after { content: ""; position: absolute; top: 0; right: 0; border: 5px solid transparent; border-top-color: var(--orange); border-right-color: var(--orange); }
.pnl td.hascash::before { content: ""; position: absolute; top: 4px; left: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
.pnl td.neg { color: var(--red); }
.pnl td.ok { color: var(--green); }
.pnl td.bad { color: var(--red); }
.pnl td.warn { color: var(--orange); }
.pnl td.empty { color: var(--dim); }
.pnl tbody tr:hover td { background-color: rgba(255,255,255,.025); }
.pnl tbody tr:hover td:first-child { background: var(--card-solid); }
.namecell { display: flex; align-items: center; gap: 6px; }
.namecell .lbl { overflow: hidden; text-overflow: ellipsis; }
.chev { width: 18px; height: 18px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; flex: none; padding: 0; transition: transform .2s; }
.chev.open { transform: rotate(90deg); }
.chev svg { width: 12px; height: 12px; }
.mini { opacity: 0; border: 0; background: var(--card-2); color: var(--muted); width: 22px; height: 22px; border-radius: 7px; cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.mini svg { width: 13px; height: 13px; }
tr:hover .mini { opacity: 1; }
.mini:hover { color: var(--text); background: var(--line-2); }
.artname { cursor: pointer; }
.artname:hover { color: var(--text); text-decoration: underline dotted; text-underline-offset: 3px; }
.legend-row { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }

/* popover / modal */
.pop { position: fixed; z-index: 50; width: 330px; max-width: calc(100vw - 24px); background: var(--card-solid); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.45); padding: 16px; animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.pop h3 { margin: 0 0 2px; font-size: 14px; }
.pop .info { font-size: 12px; color: var(--muted); background: var(--card-2); border-radius: 10px; padding: 8px 10px; margin-top: 10px; display: grid; gap: 4px; }
.pop .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.pop .stack { display: grid; gap: 10px; margin-top: 12px; }
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 460px; max-width: 100%; max-height: calc(100vh - 32px); overflow: auto; background: var(--card-solid); border: 1px solid var(--line-2); border-radius: 24px; padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.5); animation: pop .18s; }
.modal h2 { font-size: 18px; margin-bottom: 14px; }
.modal .stack { display: grid; gap: 12px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90; background: #0b0b0d; color: #f3f4f6; border: 1px solid rgba(255,255,255,.1); padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,.4); font-weight: 500; animation: pop .2s; max-width: calc(100vw - 32px); }
.toast.err { border-color: rgba(244,63,94,.5); }

/* cash */
.cash-form { display: grid; grid-template-columns: 150px 130px auto 1fr 1fr auto; gap: 10px; align-items: end; }
.cash-row { display: grid; grid-template-columns: 70px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.cash-row:first-child { border-top: 0; }
.cash-row .date { color: var(--muted); font-size: 12.5px; }
.cash-row .desc { font-weight: 500; }
.cash-row .meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: 12px; color: var(--muted); }
.cash-row .right { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.cash-row .amt { font-weight: 700; min-width: 90px; text-align: right; }
.cash-row.archived { opacity: .55; }
.cash-row select.input { height: 30px; font-size: 12.5px; max-width: 230px; border-radius: 10px; }

/* смена: таблицы с вводом прямо в ячейках */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 300px); border-radius: var(--r); border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow), var(--hi); }
table.sheet { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; }
.sheet th { position: sticky; top: 0; z-index: 2; background: var(--card-solid); color: var(--muted); font-weight: 600; font-size: 11.5px; text-align: right; padding: 8px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.sheet th.l, .sheet td.l { text-align: left; }
.sheet td { padding: 0 8px; height: 34px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.sheet td.inp { padding: 0; background: rgba(59,130,246,.055); box-shadow: inset 2px 0 0 rgba(96,165,250,.18); }
.sheet td.inp:focus-within { background: rgba(59,130,246,.16); box-shadow: inset 0 0 0 1.5px var(--accent); }
.sheet tr.today td { background-color: rgba(245,158,11,.07); }
.sheet tr.today td.inp { background-color: rgba(245,158,11,.10); }
.sheet tr.wkend td:first-child, .sheet tr.wkend td:nth-child(2) { color: var(--pink); }
.sheet tr.future td:not(.inp) { color: var(--dim); }
.sheet tfoot td { position: sticky; bottom: 0; background: var(--card-solid); font-weight: 700; border-top: 1px solid var(--line-2); }
.sheet td.sticky, .sheet th.sticky { position: sticky; left: 0; z-index: 1; background: var(--card-solid); text-align: left; }
.sheet th.sticky { z-index: 3; }
.ci { width: 100%; min-width: 72px; height: 34px; border: 0; background: transparent; padding: 0 8px; text-align: right; outline: none; font-variant-numeric: tabular-nums; }
.ci.l { text-align: left; }
.ci.w-s { min-width: 54px; } .ci.w-m { min-width: 110px; } .ci.w-l { min-width: 220px; } .ci.w-xl { min-width: 320px; }
select.ci { appearance: none; text-align: left; cursor: pointer; }
select.ci option { background: var(--card-solid); color: var(--text); }
.ci[type="date"] { min-width: 132px; text-align: left; }
.ci.late { color: var(--red); font-weight: 600; }
.ci.early { color: var(--orange); font-weight: 600; }
/* скидки: значок комментария в ячейке */
.dcell { display: flex; align-items: center; }
.dcm { flex: none; width: 22px; height: 22px; margin-right: 4px; border: 0; border-radius: 6px; background: transparent; color: var(--dim); cursor: pointer; display: grid; place-items: center; padding: 0; opacity: 0; }
.dcell .ci { flex: 1; }
.dcm svg { width: 13px; height: 13px; }
td:hover .dcm, .dcm:focus { opacity: 1; }
.dcm:hover { background: var(--line-2); color: var(--text); }
.dcm.has { opacity: 1; color: var(--orange); }
.ci:disabled { opacity: 1; color: inherit; -webkit-text-fill-color: currentColor; cursor: default; }
.ci.late:disabled { color: var(--red); } .ci.early:disabled { color: var(--orange); }
.ci.saving { color: var(--orange); }
.day-card { margin-bottom: 12px; padding: 14px 16px; }
.day-card .tbl td { padding: 0 6px; height: 36px; }
.day-card .tbl td.inp { padding: 0; }
.mini-stat { display: inline-flex; gap: 6px; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.mini-stat b { color: var(--text); font-size: 14px; }
.alert-card { border-color: rgba(244,63,94,.45) !important; }
.pnl tr.ovsrow td { color: var(--purple); font-weight: 500; font-size: 12.5px; }
.pnl tr.ovsrow td.neg { color: var(--red); }
.tabs-row { margin-bottom: 14px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 380px; max-width: 100%; padding: 30px; }
.login .logo { margin: 0 0 18px; width: 52px; height: 52px; border-radius: 16px; font-size: 18px; }
.login form { display: grid; gap: 12px; margin-top: 20px; }
.err-text { color: var(--red); font-size: 13px; min-height: 18px; }

.empty-state { text-align: center; padding: 40px 10px; color: var(--muted); }
.notes-box { white-space: pre-wrap; font-size: 13px; color: var(--muted); line-height: 1.6; }
.loader { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
svg text { font-family: inherit; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; } .g-dash .md-6 { grid-column: span 6; } }
@media (max-width: 860px) { .g-dash .md-6 { grid-column: span 12; } .cash-form { grid-template-columns: 1fr 1fr; } .cash-form .desc-f { grid-column: span 2; } .cash-form .kind-f { grid-column: span 2; } }
@media (max-width: 720px) {
  .sidebar { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; height: 62px; flex-direction: row; justify-content: space-around; padding: 0 8px; border-radius: 24px; }
  .logo, .nav-spacer, .tip { display: none; }
  .main { margin-left: 0; padding: 14px 16px 96px; }
  h1 { font-size: 24px; }
  .island { display: none; }
  .stat { min-width: calc(50% - 5px); flex: 1 1 calc(50% - 5px); }
  .stat .v { font-size: 20px; }
  .pnl td:first-child, .pnl th:first-child { min-width: 170px; max-width: 190px; }
  .pnl-wrap { max-height: calc(100vh - 250px); }
  .cash-row { grid-template-columns: 1fr; gap: 6px; }
  .cash-row .right { justify-content: flex-start; }
  .card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- роли: несколько ролей с салонами ---------- */
.chip.violet { background: rgba(139,92,246,.16); color: #a78bfa; }
:root[data-theme="light"] .chip.violet { color: #7c3aed; }
.roles-cell { display: grid; gap: 4px; }
.role-line { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.grants { display: grid; gap: 8px; }
.grant { border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; display: grid; gap: 8px; background: var(--card-2); }
.grant .gsal { display: none; }
.grant.on .gsal { display: inline-flex; }
.seg.sm button { height: 26px; padding: 0 11px; font-size: 12.5px; }

/* ---------- найм ---------- */
.hr-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.hr-form .res-f { grid-column: 1 / -1; display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.vac-form { display: grid; grid-template-columns: 160px 180px 120px 150px 1fr auto; gap: 10px; align-items: end; }
.wrap-cell { white-space: normal !important; min-width: 180px; max-width: 340px; font-size: 13px; }
.nowrap { white-space: nowrap; }
.nowrap .btn + .btn { margin-left: 6px; }
.hr-tbl td { vertical-align: top; }
.alert-card .iv-late { display: flex; gap: 10px; overflow-x: auto; margin-top: 10px; padding-bottom: 4px; }
.iv-late-i { min-width: 220px; display: grid; gap: 4px; }
.iv-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.iv-day { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 8px; min-height: 160px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--hi); }
.iv-day.today { border-color: rgba(59,130,246,.6); }
.iv-day.past { opacity: .8; }
.iv-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 2px 4px; }
.iv-head b { color: var(--text); font-size: 13px; }
.iv-day.today .iv-head b { color: #7fb0fb; }
.iv-empty { color: var(--dim, var(--muted)); text-align: center; font-size: 12px; margin-top: 18px; opacity: .5; }
.iv-card { position: relative; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 9px; display: grid; gap: 3px; font-size: 13px; }
.iv-card.st-sent { border-color: rgba(245,158,11,.4); }
.iv-card.st-hired { border-color: rgba(34,197,94,.4); }
.iv-card.st-rejected, .iv-card.st-no_show, .iv-card.st-trial_fail { opacity: .7; }
.iv-name { font-weight: 600; font-size: 14px; }
.iv-note { font-size: 12px; color: var(--muted); white-space: normal; }
.iv-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.iv-acts .btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.iv-cm { position: absolute; right: 6px; bottom: 6px; opacity: .6; }
.funnel { display: grid; gap: 10px; }
.fn-row { display: grid; grid-template-columns: 240px 1fr 70px 56px; gap: 12px; align-items: center; }
.fn-name { font-weight: 500; }
.fn-bar { height: 26px; border-radius: 8px; background: var(--card-2); overflow: hidden; }
.fn-bar span { display: block; height: 100%; border-radius: 8px; background: linear-gradient(90deg, #3b82f6, #8b5cf6); animation: grow .6s both; transform-origin: left; }
.fn-v { font-size: 20px; font-weight: 700; text-align: right; }
.fn-p { color: var(--muted); font-weight: 600; text-align: right; }
@keyframes grow { from { transform: scaleX(0); } }
@media (max-width: 1200px) { .hr-form { grid-template-columns: 1fr 1fr 1fr; } .vac-form { grid-template-columns: 1fr 1fr 1fr; } .iv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .hr-form, .vac-form { grid-template-columns: 1fr 1fr; } .hr-form .grow-f, .vac-form .grow-f { grid-column: 1 / -1; }
  .iv-grid { grid-template-columns: 1fr; } .iv-day { min-height: 0; } .iv-day .iv-empty { display: none; }
  .fn-row { grid-template-columns: 1fr 60px 48px; } .fn-bar { grid-column: 1 / -1; grid-row: 2; height: 14px; }
}
.iv-card .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.reason-li { flex-wrap: wrap; } .reason-li .name { white-space: normal; }
.g-dash > * { min-width: 0; }
.card-head { flex-wrap: wrap; row-gap: 8px; }
.list { grid-template-columns: minmax(0, 1fr); }
