:root {
  --ink: #1c2430; --ink-soft: #55606f; --muted: #98a1af; --faint: #b9c0cb;
  --accent: #2563eb; --accent-soft: #eaf1fd; --accent-line: #bcd4f5; --accent-ink: #1d4ed8;
  --red: #c0392b; --green: #15803d; --amber-bg: #fdf0cf; --amber-tx: #8a6316;
  --line: #eaecef; --line-strong: #dbdfe4;
  --canvas: #f4f6f9; --white: #ffffff; --panel: #f8fafc; --row-alt: #f9fbfd; --tot-bg: #f1f4f8; --sel: #dbe8fd;
  --weekend: #f5f7fa;
  --radius: 10px; --radius-sm: 7px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--canvas); font-size: 13.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
.num, .col-day, .day-cell, .total-cell, .wk-title, .stat .v, .quick button, .hourpop .hinput { font-variant-numeric: tabular-nums; }
.app { display: flex; min-height: 100vh; }

/* ---- Login ---- */
.login-screen { min-height: 100vh; display: grid; place-items: center; }
.login-card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 34px 36px; width: 360px; box-shadow: 0 8px 40px rgba(20,30,50,0.08); display: flex; flex-direction: column; gap: 12px; }
.login-logo { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; margin-bottom: 4px; }
.login-card h1 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.login-error { color: var(--red); font-size: 12.5px; min-height: 16px; }
.btn.wide { width: 100%; justify-content: center; padding: 10px; }

/* ---- Sidebar / topbar ---- */
.sidebar { width: 216px; background: var(--white); border-right: 1px solid var(--line); flex-shrink: 0; padding-top: 6px; }
.side-group { padding: 12px 0 4px; }
.side-cap { font-size: 10.5px; letter-spacing: 0.09em; color: var(--faint); font-weight: 600; padding: 0 22px 6px; text-transform: uppercase; }
.side-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 22px; color: var(--ink-soft); cursor: pointer; font-size: 13.5px; border-left: 2px solid transparent; }
.side-item:hover { background: var(--panel); color: var(--ink); }
.side-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 500; border-left: 2px solid var(--accent); }
.side-badge { font-size: 11.5px; color: var(--muted); background: var(--canvas); border-radius: 20px; padding: 1px 8px; }

.topbar { height: 52px; background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 22px; color: var(--ink-soft); gap: 9px; }
.topbar .crumb { font-size: 13.5px; }
.topbar .crumb.b { font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.topbar .crumb.b::before { content: ""; width: 16px; height: 16px; border-radius: 5px; background: var(--accent); display: inline-block; }
.topbar .crumb.lnk { color: var(--accent-ink); cursor: pointer; }
.topbar .sp { opacity: 0.4; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { padding: 22px 30px; overflow-x: auto; }

/* ---- Action bar ---- */
.actionbar { display: flex; align-items: center; gap: 10px; padding: 11px 24px; border-bottom: 1px solid var(--line); background: var(--white); position: relative; }
.save-state { font-size: 12.5px; color: var(--muted); }
.save-state.saving { color: var(--accent-ink); }
.abtn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--ink); border: 1px solid transparent; background: transparent; font-family: var(--font); }
.abtn:hover { background: var(--panel); }
.abtn.disabled { color: var(--faint); cursor: default; }
.abtn.disabled:hover { background: transparent; }
.abtn .ic { font-size: 15px; color: var(--ink-soft); }
.abtn.send { color: #fff; background: var(--accent); }
.abtn.send:hover { background: var(--accent-ink); }
.abtn.send .play { width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,0.22); display: grid; place-items: center; font-size: 8px; }
.abtn.approve { color: #fff; background: var(--green); }
.abtn.approve:hover { filter: brightness(0.92); }
.abtn.rejectb { color: var(--red); border-color: var(--line-strong); background: var(--white); }
.backlink { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-soft); cursor: pointer; font-size: 14px; }
.backlink:hover { color: var(--ink); }

/* ---- Header block ---- */
.wk-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.wk-nav { width: 30px; height: 30px; border: 1px solid var(--line-strong); background: var(--white); border-radius: 8px; font-size: 16px; color: var(--ink-soft); cursor: pointer; display: grid; place-items: center; transition: .12s; }
.wk-nav:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-ink); }
.wk-title { font-size: 21px; font-weight: 600; letter-spacing: -0.015em; color: var(--ink); }
.stats { margin-left: auto; display: flex; gap: 8px; }
.stat { text-align: center; padding: 7px 16px; border-radius: 10px; min-width: 76px; }
.stat.hero { background: var(--accent-soft); }
.stat .v { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.stat.hero .v { color: var(--accent-ink); }
.stat .l { font-size: 10.5px; color: var(--muted); margin-top: 1px; letter-spacing: 0.02em; }
.meta-row { display: flex; align-items: center; gap: 18px; margin: 12px 0 18px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.chip { background: var(--white); border: 1px solid var(--line-strong); color: var(--ink-soft); font-size: 11.5px; font-weight: 600; padding: 4px 11px; border-radius: 20px; display: inline-flex; align-items: center; gap: 6px; }
.chip.st-draft { }
.chip.st-submitted { background: var(--amber-bg); color: var(--amber-tx); border-color: transparent; }
.chip.st-approved { background: #dcf3e4; color: var(--green); border-color: transparent; }
.chip.st-rejected { background: #fde8e6; color: var(--red); border-color: transparent; }

/* ---- Toolbar / buttons ---- */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; position: relative; }
.btn { border: 1px solid var(--line-strong); background: var(--white); border-radius: 8px; padding: 8px 15px; font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; color: var(--ink); transition: .12s; font-family: var(--font); }
.btn:hover { background: var(--panel); border-color: var(--muted); }
.btn.icon { padding: 8px 10px; color: var(--ink-soft); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-ink); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn:disabled:hover { background: var(--white); border-color: var(--line-strong); }
.inp { border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 13px; font-size: 13px; font-family: var(--font); background: var(--white); color: var(--ink); }
.inp::placeholder { color: var(--faint); }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.inp {
  cursor: pointer;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2398a1af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 32px;
}

/* ---- Timesheet grid ---- */
.grid-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: visible; background: var(--white); box-shadow: 0 1px 2px rgba(20,30,50,0.03); }
table.grid { border-collapse: collapse; width: 100%; }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); }
table.grid th.vline, table.grid td.vline { border-left: 1px solid var(--line); }
table.grid th { font-size: 12.5px; font-weight: 600; text-align: left; padding: 11px 14px; vertical-align: middle; background: var(--panel); position: relative; color: var(--ink-soft); }
table.grid tr:first-child th:first-child { border-top-left-radius: 12px; }
table.grid tr:first-child th:last-child { border-top-right-radius: 12px; }
.col-day { width: 58px; text-align: center !important; font-size: 12px; font-weight: 500; }
.col-day.today { color: var(--accent); font-weight: 700; }
.col-day.weekend { background: var(--weekend); color: var(--faint); }
.th-cpw { min-width: 310px; }
.th-vid { width: 148px; }
.th-tarif { width: 116px; }
.th-total { width: 66px; text-align: center !important; }
.cb { width: 40px; text-align: center !important; }
input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

td { padding: 0; height: 50px; vertical-align: middle; }
td.pad { padding: 9px 14px; }
tbody tr.datarow:hover td { background: var(--row-alt); }
.cpw-cell { cursor: pointer; }
.cpw-path { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.cpw-work { font-size: 13.5px; color: var(--ink); font-weight: 500; margin-top: 1px; }
.cpw-empty { color: var(--faint); font-size: 13px; }

.sel-cell { padding: 8px 12px; cursor: pointer; color: var(--ink); font-size: 13px; }
.sel-cell.ph { color: var(--faint); }
.sel-cell:hover { color: var(--accent-ink); }

.day-cell { text-align: center; font-size: 14px; cursor: pointer; position: relative; color: var(--ink); }
.day-cell:hover { background: var(--accent-soft) !important; box-shadow: inset 0 0 0 1px var(--accent-line); }
.day-cell.weekend { background: var(--weekend); }
.day-cell.active { box-shadow: inset 0 0 0 2px var(--accent) !important; background: var(--accent-soft) !important; }
.day-cell.ro { cursor: default; }
.day-cell.ro:hover { background: inherit !important; box-shadow: none !important; }
.day-cell .cmt { position: absolute; top: 5px; left: 7px; font-size: 10px; color: var(--accent); opacity: 0.7; }
.total-cell { text-align: center; font-size: 14px; font-weight: 600; color: var(--ink); }
.row-total td { background: var(--tot-bg); font-weight: 700; height: 46px; }
.row-total .day-cell { font-size: 14px; color: var(--ink); cursor: default; }
.row-total td:hover { background: var(--tot-bg) !important; box-shadow: none !important; }
.empty-state { text-align: center; padding: 56px 20px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.7; }
.empty-state a { color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 500; }
.over { color: var(--red) !important; }

/* ---- Popovers ---- */
.pop { position: absolute; z-index: 40; background: var(--white); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 16px 48px rgba(20,30,50,0.16); overflow: hidden; }
.cascade { width: 760px; display: flex; flex-direction: column; }
.cascade-cols { display: flex; height: 296px; }
.casc-col { flex: 1; border-right: 1px solid var(--line); overflow-y: auto; }
.casc-col:last-child { border-right: none; }
.casc-cap { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; color: var(--muted); padding: 13px 16px 8px; position: sticky; top: 0; background: #fff; text-transform: uppercase; }
.casc-item { padding: 8px 16px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 6px; border-radius: 7px; margin: 0 6px; }
.casc-item:hover { background: var(--panel); }
.casc-item.sel { background: var(--accent); color: #fff; }
.casc-item.dim { color: var(--muted); font-style: italic; }
.casc-item.dim.sel { color: #fff; }
.casc-empty { padding: 40px 16px; text-align: center; color: var(--faint); font-size: 12.5px; }
.casc-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); }

.menu { position: absolute; z-index: 40; background: #fff; border: 1px solid var(--line-strong); border-radius: 11px; box-shadow: 0 16px 48px rgba(20,30,50,0.16); min-width: 210px; padding: 6px; }
.menu.scroll { max-height: 300px; overflow-y: auto; }
.menu-item { padding: 8px 12px; cursor: pointer; font-size: 13px; border-radius: 7px; }
.menu-item:hover { background: var(--accent-soft); color: var(--accent-ink); }
.menu-item.sel { background: var(--accent); color: #fff; }

.hourpop { z-index: 45; width: 300px; padding: 14px; }
.hourpop textarea { width: 100%; height: 78px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 11px; font-family: var(--font); font-size: 13px; resize: none; margin-bottom: 11px; }
.hourpop textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.quick { display: flex; gap: 5px; }
.quick button { flex: 1; border: 1px solid var(--line-strong); background: #fff; border-radius: var(--radius-sm); padding: 7px 0; font-size: 12px; cursor: pointer; color: var(--ink-soft); transition: .1s; font-family: var(--font); }
.quick button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.hourpop .hinput { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 9px 12px; font-size: 14px; margin-bottom: 10px; }
.hourpop .hinput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hourpop .hp-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---- Expenses list ---- */
.filters { display: flex; gap: 10px; margin-bottom: 16px; }
.inp.search { width: 260px; }
.list { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 13px 18px; border-bottom: 1px solid var(--line); background: var(--panel); }
.list th.r, .list td.r { text-align: right; }
.list td { padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; height: auto; }
.list tr.row { cursor: pointer; }
.list tr.row:hover td { background: var(--row-alt); }
.list .name { color: var(--accent-ink); font-weight: 500; }
.list .proj { color: var(--accent-ink); }
.list .sum { font-weight: 600; }
.list tr:last-child td { border-bottom: none; }
.list-foot { display: flex; justify-content: space-between; padding: 14px 18px 2px; font-size: 13.5px; font-weight: 600; }
.list-foot .lbl { color: var(--ink-soft); }
.stpill { display: inline-block; background: #6b7280; color: #fff; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.stpill.st-approved { background: var(--green); }
.stpill.st-submitted { background: var(--amber-tx); }
.stpill.st-rejected { background: var(--red); }
.avatar { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: 11px; font-weight: 600; display: inline-grid; place-items: center; margin-right: 8px; vertical-align: middle; }

/* Сводка по команде: неделя-таблица и матрица недель */
.util-bar { position: relative; width: 110px; height: 8px; border-radius: 4px; background: var(--panel); overflow: hidden; display: inline-block; vertical-align: middle; }
.util-bar > i { position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); background: var(--green); border-radius: 4px; display: block; }
.util-bar.mid > i { background: var(--amber-tx); }
.util-bar.low > i { background: var(--red); }
.util-bar.none > i { background: var(--faint); }

.mx-wrap { overflow-x: auto; }
.mx-table { border-collapse: separate; border-spacing: 9px 1px; }
.mx-table th { text-align: center; font-size: 11px; font-weight: 600; color: var(--ink-soft); padding: 0 0 8px; white-space: nowrap; }
.mx-table th.emp-h, .mx-table td.emp-c { text-align: left; font-size: 13.5px; white-space: nowrap; padding-right: 18px; }
.mx-table td.emp-c { cursor: pointer; color: var(--accent-ink); font-weight: 500; }
.mx-cell { width: 84px; height: 42px; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 700; cursor: pointer; }
.mx-cell:hover { outline: 2px solid var(--accent-line); outline-offset: 1px; }
.mx-cell .pct { font-size: 10.5px; font-weight: 500; opacity: .8; }
.mx-cell.high { background: #dcf3e4; color: var(--green); }
.mx-cell.mid { background: var(--amber-bg); color: var(--amber-tx); }
.mx-cell.low { background: #fde8e6; color: var(--red); }
.mx-cell.none { background: var(--panel); color: var(--faint); }
/* Перегрузка >100%: не яркий сигнал тревоги, просто тонкая обводка "обрати внимание". */
.mx-cell.over-cap { box-shadow: inset 0 0 0 0.5px #2f6fed; }
.mx-legend { display: flex; gap: 16px; align-items: center; font-size: 12px; color: var(--muted); margin-top: 14px; }
.mx-legend .over-cap-sw { box-shadow: inset 0 0 0 1px #2f6fed; background: var(--panel); }
.mx-legend .sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: middle; }

/* ---- Expense card ---- */
.card-head { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 6px; }
.card-title { font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.card-metrics { margin-left: auto; display: flex; gap: 26px; padding-top: 6px; }
.metric { text-align: right; }
.metric .v { font-size: 18px; font-weight: 600; }
.metric .l { font-size: 11.5px; color: var(--muted); }
.card-meta { display: flex; align-items: center; gap: 18px; margin: 12px 0 24px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.card-meta a { color: var(--accent-ink); font-weight: 500; }

/* Плитки-показатели (аналитика проекта/клиента) — крупная карточка вместо строки */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 26px; }
.tile {
  border: 1px solid var(--line); border-radius: 14px; background: var(--white);
  padding: 18px 20px; box-shadow: 0 1px 3px rgba(20,30,50,0.05);
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.tile:hover { box-shadow: 0 6px 18px rgba(20,30,50,0.09); border-color: var(--accent-line); transform: translateY(-1px); }
.tile .l { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.tile .v { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin-top: 10px; }
.tile .v .u { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; max-width: 1100px; margin-bottom: 20px; }
.field label { display: block; font-size: 13px; color: var(--ink); margin-bottom: 7px; }
.field .control { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 10px 13px; font-size: 13.5px; background: var(--white); color: var(--ink); font-family: var(--font); display: flex; align-items: center; justify-content: space-between; cursor: pointer; position: relative; }
.field .control.ph { color: var(--faint); }
.field .control:hover { border-color: var(--muted); }
.field .control .cev { color: var(--muted); font-size: 12px; }
.field .control:not([data-keep]) { cursor: default; background: var(--panel); }
.field .control:not([data-keep]):hover { border-color: var(--line-strong); }
.field.full { grid-column: 1 / -1; max-width: 1100px; }
textarea.desc { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; padding: 11px 13px; font-size: 13.5px; font-family: var(--font); min-height: 92px; resize: vertical; color: var(--ink); }
textarea.desc:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.lines-tools { display: flex; gap: 10px; margin-bottom: 12px; }
.lines { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lines th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.lines th.c, .lines td.c { text-align: center; }
.lines th.r, .lines td.r { text-align: right; }
.lines td { padding: 0; border-bottom: 1px solid var(--line); font-size: 13.5px; height: 52px; }
.lines td.pad { padding: 12px 16px; }
.lines tr:last-child td { border-bottom: none; }
.lines .cell { padding: 12px 16px; cursor: pointer; height: 52px; display: flex; align-items: center; }
.lines .cell.ph { color: var(--faint); }
.lines .cell:hover { background: var(--row-alt); }
.lines .req { border-left: 3px solid var(--red); }
.lines .amount { font-weight: 500; }
.lines .check { color: var(--green); font-size: 15px; }
.lines .lc { display: flex; align-items: center; justify-content: center; height: 52px; cursor: pointer; }
/* .del используется как крестик/кнопка удаления по всему фронтенду, не только
   внутри .lines — без этого правила браузер ставил курсор по умолчанию
   (I-образный, как в тексте) на кнопках вида "Удалить договор" вне .lines. */
.del { cursor: pointer; }
.lines .del { color: var(--faint); font-size: 15px; padding: 0 10px; }
.lines .del:hover { color: var(--red); }

.hint { font-size: 12px; color: var(--muted); margin-top: 20px; line-height: 1.65; max-width: 900px; }

/* ---- Плашки-свойства (docs/18-client-card.md) — цвет = смысл, не украшение.
   Заливка пастельная, border-radius 5px (угловатее пилюли — деловой вид). ---- */
.prop-pill { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 5px; }
.prop-pill.pp-green { background: #EAF3DE; color: #3B6D11; }
.prop-pill.pp-amber { background: #FAEEDA; color: #854F0B; }
.prop-pill.pp-blue { background: #E6F1FB; color: #0C447C; }
.prop-pill.pp-gray { background: #F1EFE8; color: #444441; }
.prop-pill.pp-red { background: #FBE9E7; color: #8C3B2E; }

/* ---- Карточка клиента: плашки в шапке + секции-подложки (docs/18) ---- */
.client-block { border: 1px solid var(--line); border-radius: 14px; background: var(--white); padding: 18px 20px; margin-bottom: 16px; }
.client-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.client-block-head .sec-head { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }
.iconbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--white); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-soft); transition: .12s; }
.iconbtn:hover { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
.iconbtn.danger:hover { color: var(--red); border-color: #f3c9c3; background: #fde8e6; }
.id-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.id-view-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px; font-size: 13.5px; }
.id-view-grid .l { color: var(--muted); margin-right: 6px; }
.lnk-inline { color: var(--accent-ink); font-weight: 500; cursor: pointer; }
.lnk-inline:hover { text-decoration: underline; }
.add-link { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-size: 13px; font-weight: 500; cursor: pointer; margin-top: 4px; }
.add-link:hover { text-decoration: underline; }
.add-link .ic { font-size: 13px; }

.contact-row { padding: 12px 4px; display: flex; align-items: center; gap: 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.contact-row:last-of-type { border-bottom: none; }
.contact-row:hover { background: var(--row-alt); }
.contact-avatar { width: 38px; height: 38px; font-size: 13px; flex-shrink: 0; margin-right: 0; }
.contact-main { flex: 1; min-width: 0; font-size: 13.5px; }
.contact-main .nm { font-weight: 600; }
.contact-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.contact-side { text-align: right; font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; flex-shrink: 0; }
.spoiler-head { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 12px; font-weight: 700; letter-spacing: 0.07em; color: var(--ink-soft); text-transform: uppercase; }
.spoiler-head .arw { display: inline-block; transition: transform .15s; font-size: 10px; }
.spoiler-head.open .arw { transform: rotate(90deg); }
.spoiler-body { margin-top: 14px; }

/* ---- Tabs (карточка клиента) ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 18px 0 20px; }
.tab { padding: 9px 16px; font-size: 13.5px; color: var(--ink-soft); cursor: pointer; border: 1px solid transparent; border-bottom: none; border-radius: 9px 9px 0 0; margin-bottom: -1px; }
.tab:hover { color: var(--ink); background: var(--panel); }
.tab.on { background: var(--white); border-color: var(--line); color: var(--ink); font-weight: 600; }

/* ---- Секции формы ---- */
.sec { margin-bottom: 26px; }
.sec-head { font-size: 12px; font-weight: 700; letter-spacing: 0.07em; color: var(--ink-soft); text-transform: uppercase; border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 16px; }
.ro-val { padding: 10px 0; font-size: 13.5px; color: var(--ink); }

/* ---- Переключатель ---- */
.switch-row { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink); cursor: default; margin-top: 4px; }
.switch { width: 40px; height: 22px; border-radius: 20px; background: var(--line-strong); position: relative; cursor: pointer; transition: .15s; flex-shrink: 0; display: inline-block; }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.switch.on { background: var(--accent); }
.switch.on .knob { left: 20px; }

/* ---- Доска проектов (канбан) ---- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col { flex: 0 0 260px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: 72vh; }
.board-col-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.board-count { background: var(--white); border-radius: 20px; padding: 1px 8px; font-size: 11px; color: var(--muted); }
.board-col-body { padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.board-card { position: relative; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; }
.board-card:hover { border-color: var(--accent-line); }
#salesBody .board-card { border-left: 3px solid var(--accent); padding-left: 9px; }
#salesBody .board-card.urgent { border-left-color: var(--red); }
.board-card-menu { position: absolute; top: 6px; right: 8px; color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 4px; }
.board-card-menu:hover { background: var(--panel); color: var(--ink); }
.board-card-name { font-size: 13.5px; font-weight: 500; color: var(--ink); margin-bottom: 3px; }
.board-card-meta { font-size: 11.5px; color: var(--muted); }
.board-card-mgr { display: flex; align-items: center; margin-top: 6px; font-size: 12px; color: var(--ink-soft); }
.board-card-sum { font-weight: 600; color: var(--ink); }
.board-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.tag-pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.tagcell { display: flex; flex-wrap: wrap; gap: 5px; }

.swatch-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-bottom: 12px; }
.tag-swatch { width: 100%; aspect-ratio: 1; border-radius: 7px; cursor: pointer; border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08); }
.tag-swatch.on { border-color: var(--ink); }
.board-empty { text-align: center; color: var(--faint); font-size: 12px; padding: 20px 0; }
.tag-chip { border-width: 1px; border-style: solid; }

.dropzone { border: 1.5px dashed var(--line-strong); border-radius: 10px; padding: 22px 12px; text-align: center; color: var(--muted); font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--ink-soft); }

/* ---- Модалка мультивыбора сотрудников (добавление в команду/доп.менеджеры) ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(20,30,50,0.4); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.emp-picker { background: var(--white); border-radius: 14px; width: 640px; max-width: 100%; max-height: 84vh; display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(20,30,50,0.3); }
.emp-picker-search { padding: 16px 18px 10px; }
.emp-picker-search input { width: 100%; }
.emp-picker-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 10px; }
.emp-picker-list { overflow-y: auto; padding: 2px 18px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.emp-picker-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 10px; cursor: pointer; }
.emp-picker-row:hover { border-color: var(--muted); }
.emp-picker-row.checked { border-color: var(--accent); background: var(--accent-soft); }
.emp-picker-row .nm { font-size: 13px; font-weight: 500; }
.emp-picker-row .ps { font-size: 11px; color: var(--muted); margin-top: 1px; }
.emp-picker-row .l { display: flex; align-items: center; gap: 9px; min-width: 0; }
.emp-picker-row .l .avatar { flex: none; }
.emp-picker-row input[type="checkbox"] { flex: none; pointer-events: none; }
.emp-picker-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--line-strong); font-size: 13px; color: var(--muted); }

/* ---- Договоры: блоки договор → поручения (отступ), файлы, PDF-модалка ---- */
.ctr-block { border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; max-width: 900px; }
.ctr-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.ctr-files { display: flex; flex-direction: column; gap: 5px; margin: 8px 0 0; }
.ctr-file-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.ctr-order { margin: 10px 0 0 22px; padding: 10px 12px; border-left: 2px solid var(--line-strong); background: var(--panel); border-radius: 0 8px 8px 0; }
.pdf-viewer { background: var(--white); border-radius: 12px; width: min(900px, 92vw); height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(20,30,50,0.3); overflow: hidden; }
.pdf-viewer-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; }
.pdf-viewer iframe { flex: 1; border: 0; width: 100%; }

/* ---- Toast ---- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: 10px; z-index: 100; box-shadow: 0 8px 30px rgba(0,0,0,0.25); opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--red); }
