:root {
  --bg: #f4f6f5; --card: #fff; --text: #1d2422; --muted: #6b7672; --line: #e2e7e5;
  --accent: #0b5345; --accent-2: #e6f1ed; --warn: #c0392b; --neg: #2463b8; --ok: #1f7a4d;
  --we: #f7f1e8; --gold: #b8892f; --gold-2: #e9c873; --em-1: #021410; --em-2: #06302a; --em-3: #0f5a4a; --radius: 12px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1210; --card: #121c19; --text: #e4ebe8; --muted: #93a09b; --line: #2c3533;
    --accent: #45b396; --accent-2: #17332c; --gold: #d9b45c; --warn: #ef7b6c; --neg: #7aa9ec; --ok: #5cc48d; --we: #2a2620; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.08rem; margin: 0 0 .75rem; }
h3 { font-size: .98rem; margin: 1rem 0 .5rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .05em; }
.mt { margin-top: .6rem; } .inline { display: inline; }

/* Шапка */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem; padding-top: max(.6rem, env(safe-area-inset-top)); background: var(--accent); color: #fff; }
.brand { color: #fff; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: .15rem; flex-wrap: wrap; flex: 1; }
.nav a, .nav .linkbtn { color: rgba(255,255,255,.9); padding: .35rem .6rem; border-radius: 8px; font-size: .92rem; }
.nav a.on, .nav a:hover, .nav .linkbtn:hover { background: rgba(255,255,255,.16); color: #fff; text-decoration: none; }
.nav-sep { flex: 1; }
.menu-btn { display: none; margin-left: auto; background: none; border: 0; color: #fff; font-size: 1.5rem; cursor: pointer; }
@media (max-width: 860px) {
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; background: var(--accent); padding: .4rem .6rem .8rem; box-shadow: 0 6px 16px rgba(0,0,0,.2); }
  .nav a, .nav .linkbtn { padding: .7rem .8rem; font-size: 1rem; text-align: left; width: 100%; }
  .nav-sep { display: none; }
  body.nav-open .nav { display: flex; }
}

.wrap { max-width: 1280px; margin: 0 auto; padding: 1rem 16px 5rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin: .4rem 0 1rem; }
.page-head h2 { margin: 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; margin-bottom: 1rem; border: 1px solid var(--line); }
.card.narrow { max-width: 440px; margin: 2rem auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* Формы */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .7rem; }
label > input, label > select { display: block; width: 100%; margin-top: .25rem; }
label.check { display: flex; gap: .5rem; align-items: center; color: var(--text); font-size: .92rem; }
label.check input { width: auto; margin: 0; }
input, select { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; min-height: 38px; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input.auto::placeholder { color: var(--muted); opacity: .9; font-style: italic; }
.row-fields { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.row-fields > label { flex: 1 1 150px; }
.row-fields > .grow { flex: 3 1 220px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .3rem; font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; min-height: 40px; }
.btn:hover { text-decoration: none; border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.sm { padding: .3rem .7rem; min-height: 34px; }
.btn.wide { width: 100%; }
.linkbtn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.linkbtn.danger, .danger { color: var(--warn); }
.sticky-save { position: sticky; bottom: 0; padding: .7rem 0; padding-bottom: max(.7rem, env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); z-index: 5; }

.flash { padding: .7rem .9rem; border-radius: 10px; margin-bottom: 1rem; background: var(--accent-2); border: 1px solid var(--line); }
.flash.err { background: #fdecea; color: #8a1f14; border-color: #f5c6c0; }
.flash.info { background: #eef4fb; color: #234b78; border-color: #cfe0f3; }
@media (prefers-color-scheme: dark) { .flash.err { background: #3a1f1c; color: #f3b5ad; border-color: #5b2b26; } .flash.info { background: #1d2a39; color: #b9d3f2; border-color: #2b3d52; } }
.big-note { font-size: 1.02rem; line-height: 1.7; }

.badge { display: inline-block; font-size: .74rem; padding: .1rem .45rem; border-radius: 99px; background: var(--line); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge.ok { background: var(--accent-2); color: var(--ok); }
.badge.warn { background: #fdecea; color: var(--warn); }

/* Таблицы */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: .78rem; font-weight: 600; color: var(--muted); white-space: nowrap; background: var(--card); }
.tbl td { white-space: nowrap; }
.tbl tfoot td { font-weight: 700; border-bottom: 0; border-top: 2px solid var(--line); }
.tbl.compact td, .tbl.compact th { padding: .4rem .45rem; }
.tbl tr.dim td { opacity: .55; }
.tbl .nm { position: sticky; left: 0; background: var(--card); z-index: 1; }
.tbl.edit input.num { width: 100px; padding: .35rem .45rem; min-height: 34px; }
.tbl.edit input.num.sm { width: 64px; }
.tbl.edit input.cmt { width: 160px; padding: .35rem .45rem; min-height: 34px; }
.r { text-align: right !important; } .b { font-weight: 700; }
.warn { color: var(--warn); } .neg { color: var(--neg); } .okc { color: var(--ok); } .up { color: var(--ok); } .down { color: var(--warn); }
.tbl.cmp th.ca, .tbl.cmp td.ca { background: rgba(31,111,92,.04); }
.tbl.cmp th.cb { border-left: 2px solid var(--line); }

/* Табель */
.tbl.ts td, .tbl.ts th { padding: .2rem; text-align: center; }
.tbl.ts input { width: 38px; min-height: 32px; padding: .2rem; text-align: center; border-radius: 6px; }
.tbl.ts input.mark { background: #eceeed; color: #55605c; }
.tbl.ts .we { background: var(--we); }
@media (prefers-color-scheme: dark) { .tbl.ts input.mark { background: #2a312f; color: #b5c0bc; } .tbl.ts input.h-diff, .ts-day.h-diff, .hl-demo { background: #4a3f12; color: #ffe08a; border-color: #6b5a1a; } }

/* Расчётка */
.big { font-size: 2rem; font-weight: 800; letter-spacing: -.01em; margin: .1rem 0 .8rem; font-variant-numeric: tabular-nums; }
.big small { font-size: 1rem; font-weight: 600; color: var(--muted); }
.lines { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.lines td { padding: .45rem 0; border-bottom: 1px dashed var(--line); vertical-align: top; }
.lines td.r { padding-left: 1rem; white-space: nowrap; }
.lines tr.sub td { font-weight: 600; border-bottom-style: solid; }
.lines tr.total td { font-weight: 800; border-bottom: 0; border-top: 2px solid var(--text); font-size: 1.05rem; }
.note { background: var(--accent-2); padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; }
.chips { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .6rem; margin-bottom: .4rem; -webkit-overflow-scrolling: touch; }
.chip { flex: none; padding: .4rem .8rem; border-radius: 99px; background: var(--card); border: 1px solid var(--line); color: var(--text); font-size: .88rem; white-space: nowrap; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.ts-mini { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.ts-day { border: 1px solid var(--line); border-radius: 6px; padding: .25rem; text-align: center; min-height: 46px; }
.ts-day span { display: block; font-size: .7rem; color: var(--muted); }
.ts-day b { font-size: .95rem; }
.ts-day.we { background: var(--we); }
.ts-day.mark b { color: #a06c00; }

.monthpick { display: flex; gap: .35rem; align-items: center; }
.monthpick select { min-width: 160px; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 .8rem; }
.ch-grid label.mp input { border-color: #b9d3f2; }
.ch-grid label.exp input { border-color: #f5c6c0; }
.totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem; }
.totals span { display: block; color: var(--muted); font-size: .82rem; }
.totals b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.actions form { margin-right: .5rem; }

/* Вход */
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; text-align: center; padding: 2rem 1.5rem; }
.login-card img { border-radius: 14px; }
.login-card h1 { margin: .6rem 0 .2rem; }
.login-card label { text-align: left; }

.row-fields > label.fixed { flex: 0 0 190px; }
details summary { cursor: pointer; color: var(--accent); margin: .5rem 0; }

/* ---------- v2 ---------- */
textarea { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; width: 100%; display: block; margin-top: .25rem; }
select.sm { min-height: 30px; padding: .2rem .4rem; font-size: .82rem; }
select.need { border-color: var(--warn); }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .4rem 0; }
label.plain { display: inline; color: inherit; font-size: inherit; margin: 0; cursor: pointer; }
.cnt { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 99px; background: #fff; color: var(--accent); font-size: .75rem; font-weight: 700; text-align: center; }
a.taskbar { display: block; }

/* автоматически рассчитываемые столбцы */
:root { --ac: #eceeed; --ac-in: #f5f6f5; --ma: #0b5345; --ma-bg: #eaf4f0; --mb: #2d5fa8; --mb-bg: #eaf0fa; }
@media (prefers-color-scheme: dark) { :root { --ac: #262d2b; --ac-in: #202725; --ma: #4fb397; --ma-bg: #1b2e29; --mb: #7aa9ec; --mb-bg: #1c2738; } }
.tbl th.ac, .tbl td.ac { background: var(--ac); }
.tbl td.ac input { background: var(--ac-in); border-style: dashed; }
.legend { font-size: .85rem; color: var(--muted); margin: -.2rem 0 .7rem; }
.legend .sw { display: inline-block; border-color: #b9c0bd !important; width: 1.1em; height: 1.1em; vertical-align: -.2em; border-radius: 4px; background: var(--ac); border: 1px solid var(--line); margin-right: .3em; }

/* табель: отметки */
.tbl.ts input.m-от { background: #dff3e6; color: #17603a; }
.tbl.ts input.m-бл { background: #fde7e4; color: #9a2b1f; }
.tbl.ts input.m-н { background: #e9e4f7; color: #4b3a8f; }
details.card > summary { margin: 0; }
.import-form { margin-top: .8rem; }

/* сводная: фильтры и два месяца */
.filters details.pick { flex: 1 1 260px; border: 1px solid var(--line); border-radius: 8px; padding: .45rem .7rem; }
.filters details.pick summary { margin: 0; color: var(--text); }
.pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .1rem .8rem; margin-top: .5rem; max-height: 260px; overflow: auto; }
.pick-list label.check { margin: .15rem 0; font-size: .88rem; }
.filters label.mo-a select { border-color: var(--ma); border-width: 2px; }
.filters label.mo-b select { border-color: var(--mb); border-width: 2px; }
.saved { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.saved .chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .4rem .25rem .7rem; }
.saved .chip.on a { color: #fff; }
.saved .chip .x { background: none; border: 0; cursor: pointer; color: inherit; font-size: 1.05rem; line-height: 1; opacity: .6; padding: 0 .2rem; }
.save-filter { display: flex; gap: .4rem; margin-left: auto; flex-wrap: wrap; }
.save-filter input { min-width: 230px; min-height: 34px; padding: .3rem .5rem; }
.tbl.cmp th.mh { text-align: left; padding-left: .9rem !important; color: #fff; font-size: .9rem; padding: .45rem; }
.tbl.cmp th.ma { background: var(--ma); border-radius: 8px 8px 0 0; }
.tbl.cmp th.mb { background: var(--mb); border-radius: 8px 8px 0 0; }
.tbl.cmp th.ca, .tbl.cmp td.ca { background: var(--ma-bg); }
.tbl.cmp th.cb, .tbl.cmp td.cb { background: var(--mb-bg); border-left: 0; }
.tbl.cmp th.gap, .tbl.cmp td.gap { width: 14px; min-width: 14px; padding: 0; background: var(--card); border-bottom: 0; }
.tbl.cmp tr.grp td { font-weight: 700; background: var(--card); padding-top: 1rem; border-bottom: 2px solid var(--line); }
.tbl.cmp tr.sum td { font-weight: 700; }
.tbl.cmp tfoot td { border-top: 2px solid var(--text); }

/* задачи */
.task-list { display: grid; gap: .5rem; }
.task { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .7rem .9rem; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.task:hover { text-decoration: none; border-color: var(--accent); }
.task.done { opacity: .65; }
.task-items td.chk, .task-items th.chk { width: 44px; text-align: center; }
.task-items input[type=checkbox], #chkall { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
.task-foot { align-items: center; margin-top: .8rem; }
.big-btn { min-width: 200px; min-height: 48px; font-size: 1.05rem; }
.filters .row-fields { align-items: flex-start; }

/* часы, отличные от 8 */
.tbl.ts input.h-diff, .ts-day.h-diff, .hl-demo { background: #ffe98a; color: #5c4500; border-color: #e6c84a; font-weight: 600; }
.hl-demo { padding: 0 .35em; border-radius: 4px; border: 1px solid #e6c84a; }

.formula { background: var(--accent-2); border-radius: 8px; padding: .6rem .8rem; font-size: .9rem; line-height: 1.6; margin: .2rem 0 0; }

.task.mine { border-left: 4px solid var(--accent); }
.task-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: .6rem; }
.task-actions .ta { border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; }
.task-actions h3 { margin: 0 0 .6rem; }
@media (max-width: 700px) { .task-actions { grid-template-columns: 1fr; } }

/* вход: «Я не робот» */
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
label.robot { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; margin: .2rem 0 1rem; color: var(--text); font-size: 1rem; cursor: pointer; background: var(--bg); }
label.robot input { width: 24px; height: 24px; min-height: 0; margin: 0; accent-color: var(--accent); }
.smart-captcha { margin-bottom: 1rem; }

/* v4: доходы и расходы */
.fin-totals b { font-size: 1.35rem; }
.item-form { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.item-form input[name=name] { min-width: 240px; min-height: 34px; padding: .3rem .5rem; }
.item-form input[readonly] { background: var(--ac); border-style: dashed; }
td.wrap { white-space: normal !important; min-width: 180px; max-width: 420px; }
.ms-box details { margin-top: .6rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

#msprogress .bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .5rem 0 .4rem; }
#msprogress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }

/* крупнейшие расходы: сумма, доля в продажах и полоска доли */
.top-exp td { vertical-align: top; white-space: nowrap; }
.top-exp .share { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; }
.top-exp .sbar { display: block; height: 4px; margin-top: 3px; background: transparent; }
.top-exp .sbar b { display: block; height: 4px; margin-left: auto; background: var(--accent); border-radius: 2px; }

/* ===== Оформление: тёмный изумруд с золотыми линиями ===== */
.top {
  background:
    linear-gradient(62deg, transparent calc(82% - 1px), rgba(233,200,115,.5) 82%, transparent calc(82% + 1px)),
    linear-gradient(62deg, transparent 82%, rgba(15,90,74,.75) 82%),
    linear-gradient(90deg, var(--em-1) 0%, var(--em-1) 55%, var(--em-2) 100%);
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.top::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: linear-gradient(90deg, transparent, #b8862f 15%, var(--gold-2) 50%, #b8862f 85%, transparent); }
.brand { color: var(--gold-2); letter-spacing: .02em; }
.nav a.on { background: rgba(233,200,115,.14); box-shadow: inset 0 -2px 0 var(--gold-2); color: #fff; }
.nav a:hover, .nav .linkbtn:hover { background: rgba(255,255,255,.1); }
@media (max-width: 860px) { .nav { background: var(--em-2); border-bottom: 2px solid var(--gold); } }
.btn.primary { background: linear-gradient(135deg, var(--em-3), var(--em-2)); border-color: var(--em-2); color: #fff; box-shadow: inset 0 0 0 1px rgba(233,200,115,.35); }
.btn.primary:hover { background: linear-gradient(135deg, #137060, #0a3d33); border-color: var(--gold); }
.page-head h1 { padding-left: .7rem; border-left: 3px solid var(--gold); }
.card.totals { border-top: 2px solid var(--gold); }
.tbl tfoot td { border-top-color: var(--gold); }
.login-page {
  background:
    linear-gradient(118deg, transparent calc(30% - 1px), rgba(233,200,115,.6) 30%, transparent calc(30% + 2px)),
    linear-gradient(62deg, transparent calc(72% - 1px), rgba(233,200,115,.5) 72%, transparent calc(72% + 2px)),
    linear-gradient(118deg, rgba(15,90,74,.7) 0 30%, transparent 30%),
    linear-gradient(62deg, transparent 72%, rgba(15,90,74,.75) 72%),
    radial-gradient(ellipse at 50% 45%, #06302a 0%, #010b09 75%);
  background-attachment: fixed;
}
.login-card { border: 1px solid rgba(233,200,115,.55); box-shadow: 0 10px 40px rgba(0,0,0,.45); }
/* годовая таблица: сворачиваемые группы каналов */
.yeartbl.hide-shop .g-shop, .yeartbl.hide-mp .g-mp { display: none; }
.yeartbl .g-shop, .yeartbl .g-mp { background: var(--accent-2); }
.colgrp { font: inherit; font-weight: inherit; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; white-space: nowrap; }
.colgrp::before { content: "▸ "; }
.colgrp[aria-expanded=true]::before { content: "◂ "; }
.colgrp:hover { text-decoration: underline; }

/* остатки на начало и конец периода: все поля в одну строку */
.bal-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: .5rem; }
.bal-grid label { margin-bottom: .4rem; white-space: nowrap; font-size: .8rem; }
.bal-grid input { padding: .4rem .45rem; min-height: 34px; font-size: .88rem; }
.bal-grid .linkbtn { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 860px) { .bal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.bal-grid { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.kindsel { font-size: .8rem; padding: .15rem .3rem; min-height: 28px; max-width: 190px; }
.kindsel.non { border-color: var(--gold); background: var(--we); }
.item-form .kindsel { max-width: 260px; }
@media (max-width: 860px) { .bal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.flash.bday { background: var(--we); border-color: var(--gold); border-left: 4px solid var(--gold); color: var(--text); }

/* логотип */
.brand { display: flex; align-items: center; }
.brand img { height: 34px; width: auto; display: block; }
.login-logo { background: linear-gradient(135deg, var(--em-1), var(--em-2)); border-radius: 12px; padding: 18px 20px; margin: -.4rem 0 1rem; border: 1px solid rgba(233,200,115,.45); }
.login-card .login-logo img { width: 100%; max-width: 250px; height: auto; border-radius: 0; display: block; margin: 0 auto; }
@media (max-width: 860px) { .brand img { height: 30px; } }

/* выплаты: список по отделам, подробности по нажатию на фамилию */
.paylist { --cols: minmax(0, 1fr) 110px 110px 110px 130px; }
.paylist.only-sum { --cols: minmax(0, 1fr) 130px; }
.paylist.only-sum .pc { display: none; }
.payhead, .payrow { display: grid; grid-template-columns: var(--cols); gap: .3rem .6rem; align-items: center; padding: .35rem .2rem; border-bottom: 1px solid var(--line); }
.payhead { font-size: .8rem; color: var(--muted); font-weight: 600; }
.paygrp { margin-top: .9rem; padding: .35rem .5rem; font-weight: 700; font-size: .9rem; background: var(--accent-2); border-left: 3px solid var(--gold); border-radius: 4px; }
.paylist .r { text-align: right; font-variant-numeric: tabular-nums; }
.payname { font: inherit; text-align: left; background: none; border: 0; padding: .45rem 0; color: var(--text); cursor: pointer; min-height: 40px; }
.payname::before { content: "▸"; color: var(--accent); display: inline-block; width: 1.1em; }
.payname[aria-expanded=true]::before { content: "▾"; }
.payname:hover { color: var(--accent); }
.payrow input.amt { width: 100%; }
.paydet { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; padding: .5rem .7rem; margin-bottom: .2rem; background: var(--we); border-radius: 8px; font-size: .9rem; }
.paydet[hidden] { display: none; }
.paydet span { color: var(--muted); } .paydet b { color: var(--text); } .paydet b.warn { color: var(--warn); }
.small-btn { min-height: 32px; padding: .25rem .7rem; font-size: .85rem; }
@media (max-width: 700px) {
  .paylist, .paylist.only-sum { --cols: minmax(0, 1fr) 112px; }
  .paylist .pc { display: none; }
  .paydet span { flex: 1 1 45%; }
}

.kids-tbl select, .kids-tbl input[type=date] { min-height: 34px; padding: .3rem .5rem; }
.kids-tbl label.check { margin: 0; }

.cal-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: .5rem; }
.cal-grid label { margin-bottom: .4rem; font-size: .8rem; }
.cal-grid input { padding: .4rem .45rem; min-height: 34px; }
.cal-grid span { display: block; margin-top: .15rem; white-space: nowrap; }
@media (max-width: 900px) { .cal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* начисления: список с раскрытием */
.acc { --cols: minmax(150px, 1.6fr) repeat(7, minmax(84px, 1fr)); }
.acc-head, .acc-row { display: grid; grid-template-columns: var(--cols); gap: .2rem .6rem; align-items: center; padding: .3rem .2rem; border-bottom: 1px solid var(--line); }
.acc-head { font-size: .8rem; color: var(--muted); font-weight: 600; }
.acc .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc .b { font-weight: 700; }
.acc-name { font: inherit; text-align: left; background: none; border: 0; padding: .4rem 0; color: var(--accent); cursor: pointer; min-height: 38px; }
.acc-name::before { content: "▸"; display: inline-block; width: 1.1em; }
.acc-name[aria-expanded=true]::before { content: "▾"; }
.acc-sum { font-weight: 700; border-top: 2px solid var(--gold); border-bottom: 0; padding-top: .5rem; }
.acc-det { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: center; padding: .5rem .7rem; margin-bottom: .2rem; background: var(--we); border-radius: 8px; font-size: .9rem; }
.acc-det[hidden] { display: none; }
.acc-det span { color: var(--muted); } .acc-det b { color: var(--text); } .acc-det b.warn { color: var(--warn); } .acc-det b.neg { color: var(--neg); }
@media (max-width: 900px) {
  .acc { --cols: minmax(0, 1fr) 88px 88px; }
  .acc .wide { display: none; }
  .acc-det span { flex: 1 1 45%; }
}
@media (min-width: 901px) { .acc-det span { display: none; } .acc-det { background: none; padding: 0 0 .4rem 1.1em; } }
/* сводная */
.viewsw { display: flex; gap: .5rem; flex-wrap: wrap; padding: .6rem .8rem; }
.metric-chips { margin-bottom: .8rem; }
.one-metric { width: 100%; }
.one-metric td, .one-metric th { padding-left: .35rem; padding-right: .35rem; }
.one-metric td:first-child { white-space: normal; }
.one-metric tr.grp td { background: var(--accent-2); font-weight: 700; border-left: 3px solid var(--gold); }
.one-metric tr.sum td { font-weight: 700; }
.tbl.cmp tr.grp td { background: var(--accent-2); font-weight: 700; }
.grp-stick { position: sticky; left: .6rem; display: inline-block; }
.tbl.cmp .nm { box-shadow: 1px 0 0 var(--line); min-width: 130px; }
@media (max-width: 700px) { .one-metric { font-size: .86rem; } .tbl.cmp .nm { min-width: 110px; max-width: 130px; white-space: normal; } }
.metric-chips { flex-wrap: wrap; overflow-x: visible; }
.one-metric th, .one-metric td.r { white-space: nowrap; }
@media (max-width: 700px) { .one-metric td, .one-metric th { padding: .45rem .2rem; } .one-metric { font-size: .82rem; } }
@media (max-width: 380px) { .one-metric { font-size: .76rem; } .one-metric td, .one-metric th { padding: .4rem .15rem; } }
.acc-det b, .paydet b { white-space: nowrap; }

/* сводная: несколько показателей рядом */
.one-metric .nm { position: sticky; left: 0; background: var(--card); z-index: 1; }
.one-metric.multi .mh { text-align: center; border-bottom: 2px solid var(--gold); }
.one-metric.multi .ms { border-left: 1px solid var(--line); }
.one-metric.multi .nm { box-shadow: 1px 0 0 var(--line); min-width: 120px; }
.one-metric.multi td, .one-metric.multi th { white-space: nowrap; }
.one-metric.multi td.nm { white-space: normal; }
.one-metric tr.sum td.nm, .one-metric tfoot td.nm { background: var(--card); }

.one-metric.multi .ma { background: var(--ma-bg); color: var(--ma); }
.one-metric.multi .mb { background: var(--mb-bg); color: var(--mb); }
.one-metric.multi td.cb, .one-metric.multi th.cb { background: var(--mb-bg); }
.one-metric.multi thead tr:nth-child(2) th { white-space: normal; font-size: .76rem; line-height: 1.2; vertical-align: bottom; }
.one-metric.multi td.ca, .one-metric.multi th.ca { background: var(--ma-bg); }
.paymove { display: inline-block; margin-right: .6rem; }
.paymove summary { cursor: pointer; list-style: none; display: inline; color: var(--accent, #0f766e); }
.paymove summary::-webkit-details-marker { display: none; }
.paymove[open] form { margin: .4rem 0; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--card); white-space: normal; }
.paymove + form { display: inline; }
/* Планируемый отпуск */
.plan-x td { background: rgba(200, 40, 30, .08); }
.plan-warn { flex-basis: 100%; margin: .2rem 0 0; }
.plan-warn.warn { color: #a3261b; font-weight: 600; }
.plan-mates { margin: .3rem 0 0 1.1rem; padding: 0; }
.plan-tl { margin: .3rem 0 .8rem; }
.plan-tl-row { display: flex; align-items: center; gap: .5rem; padding: .18rem 0; border-bottom: 1px solid var(--line); }
.plan-tl-name { flex: 0 0 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.plan-tl-bar { position: relative; flex: 1; height: 14px; background: repeating-linear-gradient(90deg, transparent 0 calc(100%/12 - 1px), var(--line) calc(100%/12 - 1px) calc(100%/12)); border-radius: 3px; }
.plan-tl-bar b { position: absolute; top: 1px; bottom: 1px; background: var(--accent, #0f766e); border-radius: 3px; min-width: 3px; }
.plan-tl-bar b.x { background: #c62828; }
.plan-tl-head .plan-tl-bar { background: none; height: 1rem; }
.plan-tl-head i { position: absolute; font-style: normal; font-size: .7rem; color: var(--muted); }
.plan-tl-days { flex: 0 0 3.2rem; font-size: .85rem; }
.plan-list { margin-bottom: 1rem; }
@media (max-width: 640px) { .plan-tl-name { flex-basis: 6.5rem; font-size: .8rem; } .plan-tl-head i { font-size: .6rem; } }
/* Внутри Весточки: без своей шапки и меню */
.embed-nav { display: none; }
body.embed header.top { display: none; }
body.embed .embed-nav { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
body.embed .embed-nav a { padding: .35rem .7rem; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
body.embed .embed-nav a.on { background: var(--accent-2); border-color: var(--gold); }
body.embed .flash.bday { display: none; }
.plan-years { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .6rem; }
.plan-years a { padding: .3rem .7rem; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; font-size: .9rem; }
.plan-years a.on { background: var(--accent-2); border-color: var(--gold); font-weight: 600; }
/* Ввод данных: изменение ширины столбцов */
.tbl.edit thead th { position: relative; }
.tbl.edit thead th.nm { position: sticky; }
.tbl.edit td { overflow: hidden; }
.col-grip { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 3; }
.col-grip::after { content: ''; position: absolute; top: 20%; bottom: 20%; left: 3px; width: 1px; background: var(--line); }
.col-grip:hover::after, .col-resizing .col-grip::after { background: var(--gold); width: 2px; }
.col-resizing, .col-resizing * { cursor: col-resize !important; user-select: none; }
.task-items input.task-amt { width: 110px; text-align: right; padding: .3rem .45rem; min-height: 32px; display: inline-block; }
/* Ввод данных: цифры прошлого месяца для сравнения */
.prev, .prev-inline { font-style: italic; color: #2f6fd6; font-size: .8rem; }
.prev { margin-top: .15rem; white-space: nowrap; }
@media (prefers-color-scheme: dark) { .prev, .prev-inline { color: #7fb0ff; } }
/* Ввод данных: все цифры по правому краю и на одной линии; прошлый месяц — ровно под цифрой */
.entry-form .tbl.edit td { vertical-align: top; text-align: right; }
.entry-form .tbl.edit th { text-align: right; }
.entry-form .tbl.edit th.nm, .entry-form .tbl.edit td.nm, .entry-form .tbl.edit th:last-child, .entry-form .tbl.edit td:last-child { text-align: left; }
.entry-form .tbl.edit td input.num { display: block; margin-left: auto; }
.entry-form .tbl.edit td:not(:has(input)):not(.nm) { padding-top: calc(.5rem + 8px); }
.entry-form .tbl.edit td.nm { padding-top: calc(.5rem + 8px); }
.entry-form .tbl.edit .prev { text-align: right; padding-right: calc(.45rem + 1px); font-weight: 400; line-height: 1.3; margin-top: .2rem; }
.entry-form .tbl.edit td:not(:has(input)) .prev { padding-right: 0; }
.entry-form .tbl.edit td .muted.small, .entry-form .tbl.edit td .small { text-align: right; }
.entry-form .tbl.edit td.nm .muted.small { text-align: left; }
