:root {
  --bg: #f2f2f4;
  --ink: #0b0b0c;
  --ink-2: #3b3b40;
  --muted: #7b7b83;
  --faint: #a7a7ae;
  --line: rgba(11, 11, 12, .08);
  --line-2: rgba(11, 11, 12, .16);
  --glass: rgba(255, 255, 255, .56);
  --glass-2: rgba(255, 255, 255, .86);
  --glass-border: rgba(255, 255, 255, .8);
  --fill: rgba(11, 11, 12, .05);
  --fill-2: rgba(11, 11, 12, .09);
  --shadow: 0 1px 2px rgba(0, 0, 0, .03), 0 24px 60px -30px rgba(0, 0, 0, .22);
  --shadow-sm: 0 1px 1px rgba(0, 0, 0, .03), 0 10px 30px -18px rgba(0, 0, 0, .18);
  --r: 22px;
  --r-m: 16px;
  --r-s: 12px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv11" 1, "ss01" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 26px; letter-spacing: -.02em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
[hidden] { display: none !important; }

/* фон: белые и серые пятна, мягко размытые */
.bg {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(55% 45% at 8% 0%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(45% 40% at 92% 8%, #dfdfe4 0%, rgba(223, 223, 228, 0) 60%),
    radial-gradient(40% 40% at 75% 95%, #e7e7ea 0%, rgba(231, 231, 234, 0) 60%),
    radial-gradient(45% 45% at 18% 85%, #ffffff 0%, rgba(255, 255, 255, 0) 60%),
    var(--bg);
}
.bg::before, .bg::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px);
}
.bg::before { width: 560px; height: 560px; left: -140px; top: 28%; background: rgba(255, 255, 255, .95); }
.bg::after { width: 680px; height: 680px; right: -200px; top: -160px; background: rgba(196, 196, 204, .5); }

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  backdrop-filter: blur(22px) saturate(1.2);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.glass-2 {
  background: var(--glass-2);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
  backdrop-filter: blur(28px) saturate(1.2);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

/* каркас */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 14px; height: calc(100vh - 28px); margin: 14px 0 14px 14px;
  border-radius: var(--r); display: flex; flex-direction: column; padding: 18px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.logo {
  width: 36px; height: 36px; border-radius: 12px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 20px; letter-spacing: -.04em;
}
.brand-name { font-weight: 700; letter-spacing: -.02em; font-size: 16px; line-height: 1.1; }
.brand-sub { color: var(--muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--fill); color: var(--ink); }
.nav a.on { background: var(--ink); color: #fff; box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); }
.nav a .ico { display: inline-flex; opacity: .85; }
.nav a .badge {
  margin-left: auto; background: var(--fill-2); border-radius: 999px; padding: 1px 8px;
  font-size: 12px; font-weight: 600; color: var(--ink);
}
.nav a.on .badge { background: rgba(255, 255, 255, .22); color: #fff; }
.nav-group { margin-top: 14px; padding: 0 12px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 14px; background: rgba(255, 255, 255, .5); border: 1px solid var(--line); }
.user-card .name { font-weight: 600; font-size: 13px; line-height: 1.2; }
.user-card .sub { color: var(--muted); font-size: 12px; }
.user-card select { margin-left: auto; }

.main { padding: 14px 20px 48px 20px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 4px 20px; }
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.crumbs b { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--faint); }
.top-actions { display: flex; align-items: center; gap: 10px; }

.month-picker { display: flex; align-items: center; gap: 2px; border-radius: 999px; padding: 4px 6px; }
.month-picker button { width: 28px; height: 28px; border-radius: 999px; font-size: 18px; line-height: 1; color: var(--ink-2); }
.month-picker button:hover { background: var(--fill); }
.month-picker span { min-width: 128px; text-align: center; font-weight: 600; text-transform: capitalize; font-size: 13px; }

.search { display: flex; align-items: center; gap: 8px; border-radius: 999px; padding: 0 14px; height: 38px; width: 320px; color: var(--muted); }
.search input { flex: 1; border: 0; background: none; outline: 0; color: var(--ink); min-width: 0; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; position: relative; color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .9); }
.icon-btn.ghost { background: var(--fill); border: 0; box-shadow: none; }
.icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); border: 2px solid #fff; }
.icon-btn .dot[hidden] { display: none; }
.ico { display: inline-flex; line-height: 0; }
.ico svg { width: 18px; height: 18px; }

/* экран */
.screen { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 0 4px; flex-wrap: wrap; }
.page-head > div:first-child { min-width: 0; }
.page-head .lead { color: var(--muted); margin-top: 4px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid.kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.3fr 1fr; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card { border-radius: var(--r); padding: 20px 22px; min-width: 0; }
.card.tight { padding: 14px 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head > div { min-width: 0; }
.card-head h3 { font-size: 15px; }
.card-head .hint { color: var(--muted); font-size: 12px; }

.kpi .k-label { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .01em; }
.kpi .k-value { font-size: 30px; font-weight: 600; letter-spacing: -.03em; margin: 6px 0 2px; line-height: 1.05; }
.kpi .k-sub { color: var(--muted); font-size: 12px; }
.kpi .k-sub b { color: var(--ink); font-weight: 600; }
.kpi.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.dark .k-label, .kpi.dark .k-sub { color: rgba(255, 255, 255, .62); }
.kpi.dark .k-sub b { color: #fff; }

/* таблицы */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
  font-weight: 600; padding: 6px 12px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr.row:hover { background: rgba(255, 255, 255, .7); cursor: pointer; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .mono { font-variant-numeric: tabular-nums; }
.tbl .svc-col { width: 34%; min-width: 180px; }
.tbl.compact td { padding: 10px 9px; }
.tbl.compact th { padding: 6px 9px 10px; letter-spacing: .05em; }
.tbl.compact .chip { padding: 2px 8px 2px 7px; font-size: 11.5px; }
.tbl .muted { color: var(--muted); }
.tbl .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--muted); font-size: 12px; margin-top: 2px; max-width: 420px; overflow: hidden; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line-2); border-bottom: 0; padding-top: 12px; }
.tbl .section td { padding-top: 18px; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; border-bottom: 0; }
.tbl .subtotal td { color: var(--ink-2); font-weight: 600; background: rgba(11, 11, 12, .025); }
.tbl .total td { font-weight: 700; font-size: 15px; border-top: 2px solid var(--ink); }
.tbl .faded td { color: var(--muted); }
.tbl .faded .svc { color: var(--muted); }

/* чипы статусов — монохром, различаются заливкой и иконкой */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4;
}
.chip .ico svg { width: 13px; height: 13px; }
.chip.pending { border: 1px dashed var(--line-2); color: var(--ink-2); background: rgba(255, 255, 255, .55); }
.chip.confirmed { background: var(--ink); color: #fff; }
.chip.disputed { background: #fff; border: 1.5px solid var(--ink); color: var(--ink); }
.chip.paid { background: var(--fill-2); color: var(--ink-2); }
.chip.soft { background: var(--fill); color: var(--ink-2); font-weight: 500; }
.chip.dark { background: var(--ink); color: #fff; }
.chip.outline { border: 1px solid var(--line-2); color: var(--ink-2); background: rgba(255, 255, 255, .5); font-weight: 500; }

/* кнопки */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 13.5px; border: 1px solid var(--ink);
  transition: transform .08s, opacity .15s, background .15s; white-space: nowrap;
}
.btn:hover { opacity: .9; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn .ico svg { width: 16px; height: 16px; }
.btn.ghost { background: rgba(255, 255, 255, .7); color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: #fff; opacity: 1; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn.xs { padding: 5px 10px; font-size: 12px; border-radius: 9px; }
.btn.danger { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn.danger:hover { border-color: var(--ink); }
.link { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; cursor: pointer; }
.link:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* сегментированный переключатель */
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--fill); gap: 2px; }
.seg button { padding: 7px 12px; border-radius: 9px; font-weight: 600; font-size: 12.5px; color: var(--muted); transition: all .15s; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 12px -6px rgba(0, 0, 0, .2); }
.seg.dark { background: rgba(255, 255, 255, .5); }
.seg.dark button.on { background: var(--ink); color: #fff; }
.role-switch { width: 100%; }
.role-switch button { flex: 1; }

/* поля */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .8); border-radius: 12px;
  padding: 10px 12px; outline: 0; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(11, 11, 12, .08); }
.select { appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230b0b0c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; }
.select.inline { width: auto; padding: 8px 32px 8px 12px; border-radius: 10px; font-weight: 500; font-size: 13px; }
.textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.calc { margin-top: 4px; border-radius: 14px; background: var(--fill); padding: 14px 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc .lbl { font-size: 12px; color: var(--muted); }
.calc .val { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }

/* фильтры */
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filters .spacer { flex: 1; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: rgba(255, 255, 255, .55); border: 1px solid var(--line); }
.pill:hover { border-color: var(--line-2); color: var(--ink); }
.pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* аватар */
.avatar {
  width: 30px; height: 30px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 12px; flex: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.avatar.ghost { background: var(--fill-2); color: var(--ink); }
.avatar.ring { background: #fff; color: var(--ink); border: 1.5px solid var(--ink); }
.who { display: inline-flex; align-items: center; gap: 8px; }
.who .n { font-weight: 500; }

/* полосы-диаграммы */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.bar-row .lbl { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .lbl small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.bar { height: 10px; border-radius: 999px; background: var(--fill); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; background: var(--ink); }
.bar i.soft { background: rgba(11, 11, 12, .28); }
.bar i.dash { background: repeating-linear-gradient(135deg, rgba(11,11,12,.35) 0 4px, rgba(11,11,12,.12) 4px 8px); }
.bar-row .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.bar-row .val small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--ink); vertical-align: -1px; margin-right: 6px; }
.legend i.soft { background: rgba(11, 11, 12, .28); }
.legend i.dash { background: repeating-linear-gradient(135deg, rgba(11,11,12,.35) 0 3px, rgba(11,11,12,.12) 3px 6px); }

/* списки */
.list { display: flex; flex-direction: column; }
.list .item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list .item:last-child { border-bottom: 0; }
.list .item .grow { flex: 1; min-width: 0; }
.list .item .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item .s { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item .r { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

/* карточки проектов / сотрудников */
.pcard { display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.pcard:hover { transform: translateY(-2px); box-shadow: 0 1px 2px rgba(0,0,0,.03), 0 30px 60px -28px rgba(0,0,0,.3); }
.pcard .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pcard .top > * { min-width: 0; }
.pcard .title { font-weight: 600; font-size: 16px; letter-spacing: -.01em; }
.pcard .client { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.pcard .sum { font-size: 24px; font-weight: 600; letter-spacing: -.03em; }
.pcard .meta { display: flex; gap: 14px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.pcard .meta b { color: var(--ink); font-weight: 600; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: var(--fill); color: var(--ink-2); font-weight: 500; }

/* карточки работ сотрудника */
.wcard { display: flex; flex-direction: column; gap: 12px; }
.wcard .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.wcard .svc { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.wcard .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.wcard .comment { padding: 10px 12px; border-radius: 12px; background: var(--fill); color: var(--ink-2); font-size: 13px; }
.wcard .money { display: flex; align-items: baseline; gap: 8px; }
.wcard .money b { font-size: 20px; letter-spacing: -.02em; }
.wcard .money span { color: var(--muted); font-size: 12.5px; }
.wcard .foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.wcard .head > div { min-width: 0; }

.big { font-size: 40px; font-weight: 600; letter-spacing: -.035em; line-height: 1; }
.big small { font-size: 14px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 8px; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.kv .v.minus::before { content: "− "; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.note { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-2); padding: 0 4px; }
.tabs button { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-color: var(--ink); }
.callout { border-radius: var(--r-m); border: 1.5px solid var(--ink); background: rgba(255, 255, 255, .7); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.callout .ico { margin-top: 2px; }
.callout b { display: block; margin-bottom: 2px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; cursor: pointer; margin-bottom: 6px; }
.back:hover { color: var(--ink); }

/* drawer */
.drawer-root { position: fixed; inset: 0; z-index: 50; }
.drawer-root .overlay { position: absolute; inset: 0; background: rgba(20, 20, 24, .18); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .2s ease; }
.drawer {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 540px; max-width: calc(100vw - 24px);
  border-radius: var(--r); display: flex; flex-direction: column; animation: slide .25s cubic-bezier(.2, .8, .2, 1);
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 22px 24px 14px; }
.drawer-kicker { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 4px; }
.drawer-body { padding: 6px 24px 24px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { padding: 14px 24px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.drawer-foot:empty { display: none; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* тосты */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 999px; font-weight: 500; font-size: 13px; box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .5); animation: pop .25s cubic-bezier(.2, .8, .2, 1); display: flex; gap: 10px; align-items: center; }
.toast .ico svg { width: 15px; height: 15px; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 1180px) {
  .grid.kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
  .search { width: 220px; }
}
/* узкие окна: сайдбар становится верхней панелью */
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; margin: 12px 12px 0; padding: 10px 14px;
    flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px 14px; border-radius: var(--r-m);
  }
  .brand { padding: 0; gap: 10px; }
  .brand-sub { display: none; }
  .logo { width: 30px; height: 30px; border-radius: 10px; font-size: 17px; }
  .nav { flex-direction: row; flex-wrap: wrap; gap: 2px; flex: 1; }
  .nav a { padding: 7px 10px; font-size: 13px; }
  .nav a .ico { display: none; }
  .sidebar-foot { margin-top: 0; margin-left: auto; flex-direction: row; align-items: center; gap: 8px; }
  .role-switch { width: auto; }
  .role-switch button { padding: 6px 10px; }
  .user-card { padding: 4px 6px; gap: 8px; }
  .user-card .sub, .user-card .name { display: none; }
  .user-card select { display: block; }
  .main { padding: 10px 12px 40px; }
  .topbar { padding: 8px 0 14px; }
  .crumbs { display: none; }
  .top-actions { width: 100%; justify-content: space-between; }
  .search { flex: 1; width: auto; }
  .page-head h1 { font-size: 22px; }
  .card { padding: 16px 18px; }
  .kpi .k-value { font-size: 26px; }
}
@media (max-width: 640px) {
  .grid.kpi { grid-template-columns: 1fr; }
  .search { display: none; }
  .tbl td, .tbl th { padding-left: 8px; padding-right: 8px; }
}

/* ===== дополнения рабочей версии (поверх стилей макета) ===== */
.grow { flex: 1; }
.strong { font-weight: 500; }
.ink { color: var(--ink); }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.clickable { cursor: pointer; }
.list .item.clickable:hover { background: rgba(255, 255, 255, .6); }
.list .item.unread .t::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); margin-right: 8px; vertical-align: 1px; }
.date-col { width: 44px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.h-sec { padding: 4px 4px 12px; }
.h-sub { font-size: 14px; margin-bottom: 10px; }
.tbl .sub.ink { color: var(--ink); }
.tbl td.chev { width: 36px; color: var(--faint); }
.tbl .sec-link { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 8px; font-size: 12px; opacity: 0; transition: opacity .15s; }
.tbl tr.section:hover .sec-link { opacity: 1; }
.tbl .line-row .icon-btn { margin-left: 6px; vertical-align: middle; }
.chip.xs { font-size: 11px; padding: 1px 7px; margin-left: 6px; vertical-align: 1px; }
.icon-btn.xs { width: 28px; height: 28px; display: inline-grid; color: var(--muted); }
.icon-btn.xs .ico svg { width: 15px; height: 15px; }
.icon-btn.xs:hover { background: var(--fill); color: var(--ink); }
.card-head.pad { padding: 8px 12px 0; }
.card-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.callout.soft { border-width: 1px; border-color: var(--line-2); }
.comment-box { padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.big { margin: 10px 0 18px; }
.kv .v.muted { color: var(--muted); }
.k-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.bar-row.clickable:hover .lbl { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
a.btn { text-decoration: none; }
.btn.wide { width: 100%; justify-content: center; padding: 12px 16px; }
.note.center { justify-content: center; text-align: center; }
.search.sm { height: 36px; width: 260px; }
.textarea.short { min-height: 64px; }
.seg.scroll { max-width: 100%; overflow-x: auto; }
.nav a { text-decoration: none; }

/* статусы оплаты сметы и «не вошла» - монохром */
.chip.void { background: transparent; border: 1px dashed var(--line-2); color: var(--muted); }
.chip.pay-awaiting { border: 1px dashed var(--ink-2); color: var(--ink-2); background: rgba(255, 255, 255, .6); }
.chip.pay-partial { background: #fff; border: 1.5px solid var(--ink); color: var(--ink); }
.chip.pay-paid { background: var(--ink); color: #fff; }
.r.strike { text-decoration: line-through; }
.tbl td.nowrap { white-space: nowrap; }
.grid.est { grid-template-columns: minmax(0, 1.9fr) minmax(260px, 1fr); align-items: start; }
.note.pad-x { padding: 0 4px 10px; }

/* исполнители и доли в форме работы */
.perf { display: flex; flex-direction: column; gap: 8px; }
.perf-row { display: flex; gap: 8px; align-items: center; }
.perf-row .select { flex: 1; min-width: 0; }
.perf-share { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.perf-share .input { width: 70px; text-align: right; }
.perf-add { align-self: flex-start; font-size: 13px; font-weight: 500; }
.calc-sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 2px; }

/* журнал постинга */
.post-items { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.post-item { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) 64px 28px; gap: 6px; align-items: center; }
.post-item .input { text-align: right; }
.post-parts { display: flex; flex-wrap: wrap; gap: 6px; }
.post-part { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border-radius: 999px; background: rgba(255, 255, 255, .6); border: 1px solid var(--line); font-size: 12.5px; white-space: nowrap; }
.post-part:hover { border-color: var(--line-2); background: #fff; }
.post-part .chip { padding: 2px 5px; }

/* чекбоксы */
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); margin: 0; }

/* «ещё» в форме работы */
details.more { border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; background: rgba(255, 255, 255, .5); }
details.more summary { cursor: pointer; padding: 11px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 16px; line-height: 1; }
details.more[open] summary::before { transform: rotate(90deg); }
.form-grid.inner { padding-bottom: 14px; }
.input:disabled { opacity: .5; }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* ошибка формы */
.form-error { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; background: #fff; border: 1.5px solid var(--ink); font-size: 13px; font-weight: 500; }
.form-error[hidden] { display: none; }
.form-error .ico { margin-top: 1px; }

/* пользователь в сайдбаре */
.user-card { flex-wrap: wrap; }
.user-btn { display: flex; align-items: center; gap: 10px; text-align: left; flex: 1; min-width: 0; border-radius: 10px; }
.user-btn > div { min-width: 0; }
.user-btn .name, .user-btn .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn:hover .name { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.user-card .dev-switch { flex: 1 0 100%; width: 100%; margin: 2px 0 0; }

/* история работы */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.tl-item { display: flex; gap: 12px; align-items: flex-start; font-size: 13px; }
.tl-item .s { color: var(--muted); font-size: 12px; }
.tl-item .c { color: var(--ink-2); margin: 2px 0; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; border: 1.5px solid var(--ink); background: #fff; }
.tl-dot.confirmed, .tl-dot.paid { background: var(--ink); }
.tl-dot.created, .tl-dot.updated, .tl-dot.carried { border-style: dashed; }

/* приглашение */
.invite { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.invite .field { width: 100%; }
.invite .help { font-size: 12px; color: var(--muted); }

/* вход */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; border-radius: var(--r); padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-card .brand { padding: 0 0 6px; }
.auth-card h1 { font-size: 22px; }
.dev-login { display: flex; flex-direction: column; gap: 10px; }
.fatal { padding: 40px; font-family: var(--font); }

@media (max-width: 1180px) {
  .grid.est { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { min-width: 0; }
  .user-btn .name, .user-btn .sub { display: none; }
  .user-card { flex-wrap: nowrap; background: none; border: 0; padding: 0; }
  .user-card .dev-switch { flex: none; width: auto; margin: 0; }
  .search.sm { width: 100%; }
}
@media (max-width: 640px) {
  .nav { order: 3; flex: 1 0 100%; min-width: 0; max-width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; flex: none; }
  .sidebar-foot { order: 2; }
  .drawer { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: calc(100vh - 40px); }
  .form-grid { grid-template-columns: 1fr; }
  .post-item { grid-template-columns: minmax(0, 1fr) 64px 28px; }
  .post-item .pi-emp { grid-column: 1 / -1; grid-row: 2; }
  .filters .select.inline { flex: 1; }
  .page-head .actions { width: 100%; }
  .auth-card { padding: 22px 18px; }
}
