/* CRM ИНПРОМСЕРВИС: three themes by role (the interface concept v0.2).
   A · Чертёж — a neat technical document; B · Диспетчерская — a graphite control desk;
   C · Сервис — calm white cards. Functions are the same; colours, type, density and the
   navigation differ. */

:root {
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --head: var(--font);
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --logo-blue: #13B7E1;
}

/* A · Чертёж: #EEF1F4 #FFFFFF #141B24 #2A3BA8 #A3461C #156B78 */
.theme-a {
  color-scheme: light;
  --bg: #EEF1F4; --surface: #FFFFFF; --surface-2: #F6F8FA; --ink: #141B24; --muted: #56616D; --faint: #8A949F;
  --line: #DDE2E8; --line-2: #C8D0D9; --hover: #F1F4F7;
  --accent: #2A3BA8; --accent-ink: #FFFFFF; --accent-soft: #E8EBF8;
  --warn: #A3461C; --warn-soft: #F7EAE2; --info: #156B78; --info-soft: #E1F0F2;
  --danger: #B3261E; --danger-soft: #FAE8E6; --ok: #1F7A4D; --ok-soft: #E2F2E9;
  --p-claim: #A3461C; --p-trip: #156B78; --p-contract: #2A3BA8; --p-mail: #5E7A1C; --p-request: #6B7480; --p-invoice: #7A4E9C;
  --radius: 6px; --radius-s: 4px; --shadow: none; --row: 40px;
  --head: 'IBM Plex Sans', var(--font);
  --nav-bg: #FFFFFF; --nav-ink: var(--ink);
}

/* B · Диспетчерская: #11161C #171E25 #DCE3EA #E3A23B #5FC08C #EF6B62 */
.theme-b {
  color-scheme: dark;
  --bg: #11161C; --surface: #171E25; --surface-2: #1C242D; --ink: #DCE3EA; --muted: #97A3AF; --faint: #6C7885;
  --line: #252F39; --line-2: #33404D; --hover: #1E2731;
  --accent: #E3A23B; --accent-ink: #1A1206; --accent-soft: #2C2414;
  --warn: #E3A23B; --warn-soft: #2C2414; --info: #5DB7C6; --info-soft: #13262A;
  --danger: #EF6B62; --danger-soft: #34191A; --ok: #5FC08C; --ok-soft: #142A1F;
  --p-claim: #F08A4B; --p-trip: #5DB7C6; --p-contract: #8C9BF2; --p-mail: #9BC46A; --p-request: #97A3AF; --p-invoice: #C29BE0;
  --radius: 3px; --radius-s: 3px; --shadow: none; --row: 32px;
  --nav-bg: #0D1217; --nav-ink: var(--ink);
}

/* C · Сервис: #F2F5F4 #FFFFFF #17201E #0F7B6C #A86A12 #C2412D */
.theme-c {
  color-scheme: light;
  --bg: #F2F5F4; --surface: #FFFFFF; --surface-2: #F7F9F8; --ink: #17201E; --muted: #55635F; --faint: #889490;
  --line: #E2E8E5; --line-2: #D2DAD6; --hover: #F0F4F2;
  --accent: #0F7B6C; --accent-ink: #FFFFFF; --accent-soft: #E0F1EE;
  --warn: #A86A12; --warn-soft: #FBEFDC; --info: #2E6E9E; --info-soft: #E5EFF7;
  --danger: #C2412D; --danger-soft: #FAE7E3; --ok: #0F7B6C; --ok-soft: #E0F1EE;
  --p-claim: #B4561F; --p-trip: #1D7590; --p-contract: #3F55B8; --p-mail: #5E7A1C; --p-request: #6B7480; --p-invoice: #7A4E9C;
  --radius: 14px; --radius-s: 10px; --row: 44px;
  --shadow: 0 1px 2px rgba(23, 32, 30, .05), 0 6px 18px rgba(23, 32, 30, .06);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --head: var(--font);
  --nav-bg: #FFFFFF; --nav-ink: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
.theme-c body, body.theme-c { font-size: 15px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--head); margin: 0; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.boot { padding: 40px; color: #8A949F; font: 14px system-ui, sans-serif; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; display: grid; }
.theme-a .shell { grid-template-columns: 236px minmax(0, 1fr); }
.theme-b .shell { grid-template-columns: 72px minmax(0, 1fr); }
.theme-c .shell { grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr); }

.nav { background: var(--nav-bg); color: var(--nav-ink); display: flex; position: sticky; top: 0; z-index: 30; }
.theme-a .nav, .theme-b .nav { height: 100vh; flex-direction: column; border-right: 1px solid var(--line); }
.theme-a .nav { padding: 18px 12px 12px; gap: 2px; overflow-y: auto; }
.theme-b .nav { padding: 12px 6px; gap: 2px; align-items: stretch; overflow-y: auto; }
.theme-c .nav { height: 64px; align-items: center; gap: 2px; padding: 0 24px; border-bottom: 1px solid var(--line); min-width: 0; }
.theme-c .nav-item.minor { display: none; }

.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none !important; }
.brand img.logo { height: 34px; width: auto; display: block; }
.brand .crm { font: 600 12px/1 var(--mono); letter-spacing: .12em; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line-2); }
.brand img.mark { width: 36px; height: 36px; display: block; }
.theme-a .brand { padding: 0 6px 18px; }
.theme-b .brand { justify-content: center; padding: 4px 0 14px; }
.theme-c .brand { margin-right: 18px; }
.theme-c .brand img.logo { height: 30px; }

.nav-group { font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 16px 10px 6px; }
.theme-b .nav-group, .theme-c .nav-group { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius);
  color: var(--nav-ink); text-decoration: none !important; position: relative; white-space: nowrap; cursor: pointer;
  border: 0; background: none; text-align: left;
}
.nav-item:hover { background: var(--hover); }
.nav-item .label { flex: 1; }
.nav-item .count { font: 500 12px var(--mono); color: var(--faint); }
.nav-item .badge { font: 600 11px/1 var(--mono); background: var(--accent); color: var(--accent-ink); padding: 3px 6px; border-radius: 9px; }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.theme-a .nav-item.active .count { color: var(--accent); }
.theme-b .nav-item { flex-direction: column; gap: 3px; padding: 8px 2px 6px; font-size: 10px; text-align: center; color: var(--muted); }
.theme-b .nav-item svg.i { width: 20px; height: 20px; }
.theme-b .nav-item .label { flex: none; letter-spacing: .01em; }
.theme-b .nav-item .count { display: none; }
.theme-b .nav-item .badge { position: absolute; top: 3px; right: 9px; padding: 2px 4px; font-size: 9.5px; }
.theme-b .nav-item.active { background: var(--accent); color: var(--accent-ink); }
.theme-b .nav-item.active .badge { background: var(--accent-ink); color: var(--accent); }
.theme-c .nav-item { padding: 8px 13px; border-radius: 999px; font-weight: 600; font-size: 14.5px; }
.theme-c .nav-item svg.i { display: none; }
.theme-c .nav-item .count { display: none; }
.theme-c .nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.theme-c .nav-item .badge { padding: 3px 7px; }
.theme-c .nav-item .short, .theme-a .nav-item .short { display: none; }
.theme-b .nav-item .full { display: none; }
.nav-spacer { flex: 1; }

.me-block { display: flex; gap: 10px; align-items: center; padding: 12px 8px 4px; border: 0; border-top: 1px solid var(--line); background: none; color: inherit; font: inherit; text-align: left; margin-top: 10px; cursor: pointer; border-radius: var(--radius); }
.me-block:hover { background: var(--hover); }
.me-block .who { min-width: 0; }
.me-block .name { font-weight: 600; font-size: 13px; }
.me-block .sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-b .me-block { justify-content: center; border-top: 0; padding: 8px 0; }
.theme-b .me-block .who { display: none; }
.theme-c .me-block { display: none; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font: 600 11.5px var(--font); letter-spacing: .02em;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.theme-b .avatar.gray { background: #26303A; color: var(--ink); border: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 14px; padding: 12px 24px; min-height: 64px;
  background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.theme-b .top { background: var(--surface); min-height: 56px; padding: 8px 18px; }
.theme-c .top { background: transparent; border: 0; position: static; padding: 26px 32px 6px; min-height: 0; }
.top .titles { min-width: 0; flex: 1; }
.top h1 { font-size: 18px; font-weight: 700; line-height: 1.2; }
.theme-b .top h1 { font-size: 16px; }
.theme-c .top h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; display: inline; margin-right: 12px; }
.top .subtitle { font-size: 12px; color: var(--muted); }
.theme-c .top .subtitle { display: inline; font-size: 14px; }
.tools { display: flex; align-items: center; gap: 10px; }
.theme-c .nav .tools { margin-left: auto; flex: none; }
/* Theme C keeps every main section in one row: items get tighter on mid-size screens and, as a last
   resort, shorten with an ellipsis (the full name stays in the tooltip) instead of pushing the
   search, notifications and profile off the screen. */
.theme-c .nav > .brand { flex: none; }
.theme-c .nav-item { flex: 0 1 auto; min-width: 0; }
.theme-c .nav-item .label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Breakpoints keep about 100px of spare room: with «Счета» (0.1.72) the full row needs ~1640px,
   compact ~1465px, compact with short names ~1240px (fonts and task counters may add a little). */
@media (min-width: 861px) and (max-width: 1779px) {
  .theme-c .nav { padding: 0 16px; }
  .theme-c .brand { margin-right: 8px; }
  .theme-c .nav-item { padding: 8px 9px; font-size: 13.5px; }
  .theme-c .nav .tools { gap: 6px; }
}
@media (min-width: 861px) and (max-width: 1579px) {
  .theme-c .nav-item .full { display: none; }
  .theme-c .nav-item .short { display: inline; }
}
@media (min-width: 861px) and (max-width: 1359px) {
  .theme-c .brand .crm { display: none; }
  .theme-c .nav .tools .hide-sm { display: none; }
  .theme-c .nav-item { padding: 7px 7px; font-size: 13px; }
}
.icon-btn.menu-btn { display: none; }

.search { position: relative; }
.search input {
  width: 340px; padding: 8px 12px 8px 34px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface-2); outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface); }
.search > svg.i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); width: 16px; height: 16px; }
.theme-c .search input { width: 260px; border-radius: 999px; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; width: 460px; max-height: 70vh; overflow: auto; z-index: 50;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 12px 30px rgba(0, 0, 0, .18); padding: 6px;
}
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid transparent;
  background: none; cursor: pointer; color: var(--muted); position: relative;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.theme-c .icon-btn { border-radius: 50%; background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }

.page { padding: 20px 24px 40px; min-width: 0; flex: 1; }
.theme-b .page { padding: 14px 18px 30px; }
.theme-c .page { padding: 14px 32px 48px; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; font-weight: 500; white-space: nowrap;
  text-decoration: none !important; line-height: 1.2;
}
.btn:hover { background: var(--hover); }
.btn svg.i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: default; }
.theme-c .btn { border-radius: 999px; padding: 9px 18px; }
.theme-c .btn.sm { padding: 6px 12px; }
.theme-b .btn { padding: 6px 12px; }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.theme-b .input { background: var(--bg); }
textarea.input { min-height: 72px; resize: vertical; }
.field { display: grid; gap: 5px; margin-bottom: 12px; align-content: start; }
.field > label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field > label .req { color: var(--danger); }
.checks { display: grid; gap: 4px; max-height: 240px; overflow: auto; padding: 8px; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); }
.theme-b .checks { background: var(--bg); }
.checks label { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; cursor: pointer; }
.checks input { margin-top: 3px; accent-color: var(--accent); }
.checks label[hidden] { display:none; }
.multi-dropdown { border:1px solid var(--line-2); border-radius:var(--radius-s); background:var(--surface); }
.multi-dropdown summary { cursor:pointer; padding:10px 12px; overflow-wrap:anywhere; }
.multi-dropdown-body { padding:0 8px 8px; }
.tag-entry-box { display:flex; align-items:center; flex-wrap:wrap; gap:3px; min-height:40px; padding:4px 8px; border:1px solid var(--line-2); border-radius:var(--radius-s); background:var(--surface); }
.tag-entry-box:focus-within { outline:2px solid var(--accent); outline-offset:1px; }
.tag-chips { display:inline; overflow-wrap:anywhere; }
.tag-chip { display:inline-flex; align-items:center; gap:2px; border-radius:4px; background:var(--hover); padding:2px 4px; }
.tag-remove { border:0; background:transparent; color:inherit; cursor:pointer; opacity:.6; padding:0 2px; font-size:16px; line-height:1; }
.tag-remove:hover,.tag-remove:focus-visible { opacity:1; color:var(--accent); }
.tag-entry { min-width:130px; flex:1; border:0; outline:0; padding:5px 2px; background:transparent; color:inherit; font:inherit; }
.tag-suggestions { margin-top:4px; }
.tag-suggestions[hidden] { display:none; }
.draft-header { display:flex; align-items:center; justify-content:space-between; gap:12px; max-width:820px; }
.draft-list-row { display:flex; align-items:center; gap:10px; padding:12px; border-bottom:1px solid var(--line-2); }
.draft-list-row > a { flex:1; min-width:0; overflow-wrap:anywhere; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; color: var(--muted); font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.theme-b .seg button.on { background: var(--accent); color: var(--accent-ink); }
.theme-c .seg { border-radius: 999px; }
.toggle { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); }
.toggle.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.theme-c .toggle { border-radius: 999px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.theme-c .panel { border-color: transparent; }
.panel-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-b { padding: 14px 16px; }
.cap { font: 600 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 18px 0 8px; }
.cap:first-child { margin-top: 0; }
.theme-c .cap { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 700; color: var(--ink); }

.chip {
  --c: var(--p-request); display: inline-flex; align-items: center; font: 600 11px/1 var(--mono); padding: 4px 6px; border-radius: var(--radius-s);
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 28%, transparent); white-space: nowrap;
}
.theme-c .chip { border-radius: 6px; }
.chip.claims { --c: var(--p-claim); } .chip.trips { --c: var(--p-trip); } .chip.contracts { --c: var(--p-contract); } .chip.mail { --c: var(--p-mail); } .chip.requests { --c: var(--p-request); } .chip.invoices { --c: var(--p-invoice); }
.pill { display: inline-flex; align-items: center; gap: 5px; font: 600 11.5px/1 var(--mono); padding: 4px 7px; border-radius: var(--radius-s); background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.pill.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.pill.danger { color: var(--danger); background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill.accent { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pill svg.i { width: 13px; height: 13px; }
.stamp { display: inline-block; font: 700 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 4px 7px; border: 1.5px solid currentColor; border-radius: 3px; color: var(--accent); transform: rotate(-1.5deg); }
.stamp.rework { color: var(--warn); } .stamp.reject { color: var(--danger); } .stamp.ok { color: var(--ok); }
.theme-c .stamp { text-transform: none; transform: none; border-radius: 999px; border-width: 0; background: var(--ok-soft); color: var(--ok); font-family: var(--font); letter-spacing: 0; text-transform: none; }
.theme-c .stamp.rework { background: var(--warn-soft); color: var(--warn); } .theme-c .stamp.reject { background: var(--danger-soft); color: var(--danger); }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }
.note { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.note svg.i { width: 15px; height: 15px; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ---------- My tasks ---------- */
.split { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 0; align-items: start; }
.theme-a .split, .theme-b .split { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: calc(100vh - 120px); }
.theme-c .split { gap: 22px; }
.tasklist { border-right: 1px solid var(--line); min-height: 100%; }
.theme-c .tasklist { border: 0; }
.tl-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.theme-c .tl-head { border: 0; padding: 0 0 10px; }
.tl-group { display: flex; justify-content: space-between; font: 600 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); padding: 14px 14px 8px; }
.tl-group.overdue { color: var(--danger); }
.theme-c .tl-group { padding: 12px 4px 8px; }
.task-item { display: block; padding: 11px 14px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important; border-left: 3px solid transparent; cursor: pointer; }
.task-item:hover { background: var(--hover); }
.task-item.sel { border-left-color: var(--accent); background: var(--accent-soft); }
.theme-b .task-item { padding: 8px 12px 9px; }
.theme-b .task-item.sel { background: #2A2416; }
.theme-c .task-item { background: var(--surface); border: 1.5px solid transparent; border-radius: var(--radius-s); box-shadow: var(--shadow); margin-bottom: 10px; padding: 12px 14px; }
.theme-c .task-item.sel { border-color: var(--accent); background: var(--surface); }
.ti-top { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--faint); margin-bottom: 6px; }
.ti-top .stage { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ti-due { font: 600 11px var(--mono); color: var(--muted); white-space: nowrap; }
.ti-due.overdue { color: var(--danger); }
.ti-due.today { color: var(--warn); }
.theme-b .ti-due.overdue { border: 1px solid var(--danger); padding: 1px 4px; border-radius: 2px; }
.ti-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.theme-c .ti-title { font-size: 14.5px; font-weight: 700; }
.ti-line { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.taskview { padding: 18px 26px 28px; min-width: 0; }
.theme-b .taskview { padding: 14px 20px; }
.theme-c .taskview { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 28px; }
.tv-top { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--faint); }
.tv-top .grow { flex: 1; }
.taskview h2 { font-size: 22px; font-weight: 700; margin: 12px 0 2px; line-height: 1.25; }
.theme-b .taskview h2 { font-size: 19px; }
.theme-c .taskview h2 { font-size: 23px; font-weight: 800; }
.tv-sub { color: var(--muted); font-size: 13px; }
.tv-info { margin: 0; max-width: 760px; }
.facts { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 6px 16px; font-size: 13px; max-width: 760px; }
.facts .k { color: var(--muted); }
/* Paths and logins have no spaces: they wrap inside the column instead of widening the page. */
.facts > * { min-width: 0; overflow-wrap: anywhere; }
.theme-b .facts { gap: 4px 16px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; }
.file {
  display: inline-flex; align-items: center; gap: 9px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none !important; max-width: min(320px, 100%); min-width: 0;
}
.file:hover { border-color: var(--accent); }
.file .ext { font: 700 9.5px/1 var(--mono); padding: 6px 4px; border-radius: 3px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); min-width: 34px; text-align: center; text-transform: uppercase; }
.file .ext.docx { color: #2B579A; } .file .ext.pdf { color: #C2412D; } .file .ext.png, .file .ext.jpg { color: var(--info); }
.theme-b .file .ext.docx { color: #7FA3E0; }
.file .fn { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .fs { font-size: 11px; color: var(--faint); }
.file .fr { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .x.trash { color: var(--muted); }
.file .x.trash:hover { color: var(--danger, #C2412D); }
.task-ai { margin-top: 14px; max-width: 760px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.file .x { margin-left: 4px; border: 0; background: none; cursor: pointer; color: var(--faint); padding: 0 2px; }
.members { display: grid; gap: 8px; max-width: 760px; }
.member { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.theme-c .member { background: var(--surface-2); border-color: transparent; }
.member .who { flex: 1; min-width: 0; }
.member .nm { font-weight: 600; font-size: 13px; }
.member .tt { font-size: 11.5px; color: var(--muted); }
.member .quote { font-size: 12.5px; color: var(--muted); font-style: italic; margin-top: 3px; }
.member .st { font: 600 11.5px var(--mono); white-space: nowrap; color: var(--muted); }
.member .st.done { color: var(--ok); } .member .st.neg { color: var(--warn); } .member .st.me { color: var(--accent); }
.decide { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); max-width: 760px; }
.theme-c .decide { background: var(--surface-2); border-color: transparent; }
.decide .buttons { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
/* Long decision names («Рекламация закрыта с заменой подшипника») wrap instead of leaving the screen. */
.decide .buttons .btn { white-space: normal; text-align: left; max-width: 100%; }
.decide .hint { font-size: 12px; color: var(--faint); margin-left: 6px; }
.done-box { margin-top: 18px; padding: 12px 14px; border-radius: var(--radius); background: var(--ok-soft); color: var(--ok); max-width: 760px; font-size: 13px; }
.back-link { display: none; margin-bottom: 10px; }

/* ---------- Sections: kanban and table ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.company-list-filters { display: grid; gap: 10px; margin-bottom: 14px; }
.company-list-toolbar { display: flex; align-items: stretch; gap: 8px; min-width: 0; }
.company-list-toolbar > .input { flex: 1 1 auto; min-width: 0; }
.company-list-toolbar > .btn { flex: 0 0 auto; justify-content: center; }
.outgoing-search { width: min(340px, 100%); }
.company-add-button { min-width: 40px; padding-inline: 10px; }
.company-filter-button.on { color: var(--accent); border-color: var(--accent); }
.company-filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; }
.company-filter-count[hidden] { display: none; }
.company-filter-content { display: grid; gap: 10px; width: min(280px, calc(100vw - 44px)); padding: 8px; max-height: min(70vh, 440px); overflow-y: auto; }
.company-filter-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.company-list-filter { display: grid; gap: 4px; min-width: 0; font-size: 12px; color: var(--muted); }
.company-list-filter .input { width: 100%; }
@media (max-width: 400px) { .company-filter-label { display: none; } }
.tabs { display: inline-flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { padding: 8px 12px; border: 0; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tab .n { font: 500 11.5px var(--mono); color: var(--faint); margin-left: 4px; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.theme-c .tabs { border: 0; background: var(--surface); border-radius: 999px; padding: 4px; box-shadow: var(--shadow); }
.theme-c .tab { border-radius: 999px; border: 0; margin: 0; padding: 7px 14px; }
.theme-c .tab.on { background: var(--accent-soft); color: var(--accent); }
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { flex: 0 0 248px; background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.theme-b .col { flex-basis: 236px; background: #141A21; }
.theme-c .col { background: transparent; border: 0; }
.col-h { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.col-h .n { font: 500 12px var(--mono); color: var(--faint); }
.col-b { padding: 0 8px 8px; display: grid; gap: 8px; overflow-y: auto; }
.col.closed { flex-basis: 200px; opacity: .92; }
.col.drop-target { outline: 2px solid var(--accent); outline-offset: 2px; }
.col .auto { font-size: 12px; color: var(--faint); padding: 8px 6px; }
.kcard { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 11px; color: var(--ink); text-decoration: none !important; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--accent); }
.kcard[draggable="true"] { cursor: grab; }
.kcard.dragging { opacity: .55; cursor: grabbing; }
.theme-b .kcard { background: var(--surface-2); padding: 8px 10px; }
.kc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 6px; }
.kc-num { font: 600 11px var(--mono); color: var(--muted); }
.days { font: 600 10.5px/1 var(--mono); padding: 3px 5px; border-radius: 3px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.days.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.days.late { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.kc-title { font-weight: 600; font-size: 13px; line-height: 1.3; }
.kc-co { font-size: 12px; color: var(--muted); margin-top: 3px; }
.kc-sub { font: 500 11px var(--mono); color: var(--faint); margin-top: 2px; }
.kc-wait { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); }
.kc-wait .avatar { width: 20px; height: 20px; font-size: 8.5px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; font: 600 10.5px/1.3 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 9px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; background: var(--surface); }
table.grid td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.theme-b table.grid td { padding: 6px 10px; }
table.grid tr.click { cursor: pointer; }
table.grid tr.click:hover td { background: var(--hover); }
.theme-c table.grid th { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 12.5px; }

/* ---------- Card ---------- */
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.card-head { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.card-head .t { flex: 1; min-width: 280px; }
.card-head .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); }
.card-head h2 { font-size: 24px; font-weight: 700; margin: 8px 0 3px; line-height: 1.2; }
.theme-c .card-head h2 { font-size: 26px; font-weight: 800; }
.card-head .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.route { display: flex; gap: 3px; margin: 18px 0 12px; align-items: stretch; }
.route .steps { display: flex; gap: 3px; flex: 1; min-width: 0; }
.step { flex: 1; min-width: 0; padding: 8px 8px 7px; font-size: 11.5px; color: var(--faint); border-top: 3px solid var(--line-2); background: var(--surface); line-height: 1.25; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.step.done { color: var(--muted); border-top-color: color-mix(in srgb, var(--accent) 45%, var(--line-2)); }
.step.current { color: var(--accent); border-top-color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.step .cy { display: block; font: 500 10.5px var(--mono); }
.theme-b .step { background: var(--surface-2); }
.theme-b .step.current { background: var(--accent); color: var(--accent-ink); }
.theme-c .step { border-top: 0; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); padding: 9px 10px; }
.theme-c .step.current { background: var(--accent); color: var(--accent-ink); }
.theme-c .step.done { background: var(--surface); color: var(--ink); }
.route .ends { display: grid; gap: 3px; flex: 0 0 150px; }
.end { font-size: 10.5px; color: var(--faint); padding: 4px 7px; border: 1px solid var(--line); background: var(--surface); line-height: 1.2; border-radius: var(--radius-s); }
.end.current { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); font-weight: 700; }
.route .stage-action { cursor: pointer; font-family: inherit; text-align: left; }
.route .step.stage-action { border-left: 0; border-right: 0; border-bottom: 0; }
.route .stage-action:hover, .route .stage-action:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.now-banner { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1.5px solid color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); border-radius: var(--radius); margin-bottom: 10px; }
.now-banner .tx { flex: 1; min-width: 0; }
@media (max-width: 600px) {
  .now-banner { flex-wrap: wrap; }
  .now-banner .tx { min-width: calc(100% - 40px); }
  .now-banner > .btn { flex: 1 1 100%; }
}
.now-banner .h { font-weight: 700; }
.now-banner .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.now-banner.closed { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: var(--ok-soft); }
.theme-c .now-banner { border: 0; }
.card-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; margin-top: 12px; }
.card-detail-grid { grid-template-columns: minmax(0, 1fr) 16px minmax(270px, var(--card-side-share, 380px)); gap: 0; }
.card-detail-grid > * { min-width: 0; }
.card-divider { align-self: stretch; min-height: 100px; position: relative; cursor: col-resize; touch-action: none; }
.card-divider::before { content: '⋮'; display: block; position: sticky; top: 90px; z-index: 1; margin-top: 20px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; font-size: 13px; line-height: 22px; text-align: center; }
.card-divider::after { content: ''; position: absolute; top: 0; bottom: 14px; left: 7px; width: 2px; border-radius: 2px; background: var(--line-2); }
.card-divider:hover::after, .card-divider.dragging::after, .card-divider:focus-visible::after { background: var(--accent); width: 4px; left: 6px; }
.card-divider:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.fgroup { margin-bottom: 14px; }
.fgroup .panel-b { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 7px 16px; font-size: 13px; }
.fgroup .k { color: var(--muted); }
.fgroup .v { white-space: pre-wrap; word-break: break-word; }
.fgroup .v.empty-v { color: var(--faint); }
.fgroup .v .files { gap: 6px; }
.fgroup.editing .panel-b { grid-template-columns: 1fr; }
.side .panel { margin-bottom: 14px; }
.plink { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius-s); margin-bottom: 8px; color: inherit; text-decoration: none !important; }
a.plink:hover { border-color: var(--accent); }
.plink .who { min-width: 0; flex: 1; }
.plink .nm { font-weight: 600; font-size: 13px; }
.plink .tt { font-size: 11.5px; color: var(--muted); }
.theme-c .plink { border: 0; background: var(--surface-2); }
.timeline { display: grid; grid-template-columns: minmax(0,1fr); min-width: 0; gap: 0; }
.tl-item { position: relative; min-width: 0; overflow-wrap: anywhere; padding: 0 0 14px 22px; border-left: 1.5px solid var(--line-2); margin-left: 5px; }
.tl-item:last-child { border-left-color: transparent; }
.tl-item::before { content: ""; position: absolute; left: -6px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--faint); }
.tl-item.tl-decision::before { border-color: var(--accent); background: var(--accent); }
.tl-item.tl-comment::before { border-color: var(--info); }
.tl-item.tl-stage::before { border-color: var(--accent); }
.tl-item .h { font-size: 12.5px; }
.tl-item .h b { font-weight: 600; }
.tl-item .h .t { font: 500 11px var(--mono); color: var(--faint); margin-left: 6px; }
.tl-item .x { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tl-system-event .h, .tl-system-event .x, .tl-system-event .q { color: var(--muted); }
.tl-item.tl-system-event::before { background: var(--surface); border-color: var(--faint); }
.tl-comment .x, .tl-decision .x { color: var(--ink); }
.tl-item[hidden] { display: none; }
.timeline-system-toggle { font-size: 11px; white-space: nowrap; }
.tl-item .q { font-size: 12.5px; font-style: italic; color: var(--muted); margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--line-2); }
.tl-item .files { margin-top: 6px; }
.tl-item .file { padding: 4px 8px 4px 4px; }
.tl-item .file .ext { padding: 4px 3px; min-width: 30px; font-size: 8.5px; }
.comment-box { display: flex; gap: 8px; margin-bottom: 14px; align-items: flex-start; }
.comment-box textarea { min-width: 0; min-height: 54px; height: 54px; }
.sheet-table td, .sheet-table th { font-size: 12px; }

/* ---------- Summary ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { padding: 14px 16px; }
.tile .n { font: 700 28px/1.1 var(--head); }
.theme-b .tile .n { font-family: var(--mono); font-weight: 600; }
.tile .l { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.tile.danger .n { color: var(--danger); } .tile.warn .n { color: var(--warn); } .tile.ok .n { color: var(--ok); }
.person-head { margin-bottom: 16px; display: grid; gap: 12px; }
.modal.person-modal { width: min(1120px, 100%); }
.modal.person-modal .panel-b { background: var(--bg); }
.modal.person-modal .panel .panel-b { background: var(--surface); }
.tile-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; align-items: start; }
.tile-groups .panel-h a { color: inherit; }
/* Overdue (0.1.69): a red stripe on the left, a light red tint, how long. */
.kcard.overdue { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); box-shadow: inset 3px 0 0 var(--danger); }
.theme-b .kcard.overdue { background: color-mix(in srgb, var(--danger) 12%, var(--surface-2)); }
.kcard.doc.overdue { box-shadow: none; }
table.grid tr.overdue td { background: color-mix(in srgb, var(--danger) 7%, transparent); }
table.grid tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.overdue-badge { white-space: nowrap; font: 600 10.5px/1.2 var(--mono); }
.sum-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.bars { display: grid; gap: 5px; }
.bar { display: grid; grid-template-columns: 210px minmax(0, 1fr) 32px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar .name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { height: 10px; background: var(--surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.bar .fill { height: 100%; background: var(--accent); border-radius: 2px; }
.bar.closed .fill { background: var(--ok); }
.bar .num { font: 600 12px var(--mono); text-align: right; }
.proc-block { padding: 12px 16px 14px; border-bottom: 1px solid var(--line); }
.proc-block:last-child { border-bottom: 0; }
.proc-block .ph { display: flex; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }

/* ---------- Absences ---------- */
.gantt { overflow-x: auto; }
.gantt table { border-collapse: collapse; font-size: 12px; }
.gantt th, .gantt td { border-bottom: 1px solid var(--line); padding: 0; height: 30px; }
.gantt th.day { width: 26px; min-width: 26px; font: 500 10px/1.15 var(--mono); color: var(--faint); text-align: center; border-left: 1px solid var(--line); }
.gantt th.day.we, .gantt td.we { background: color-mix(in srgb, var(--surface-2) 75%, var(--bg)); }
.gantt th.day.today { color: var(--accent); font-weight: 700; }
.gantt td.today { box-shadow: inset 2px 0 0 var(--accent); }
.gantt td.pn { padding: 0 12px 0 4px; white-space: nowrap; min-width: 210px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.gantt td.c { border-left: 1px solid var(--line); position: relative; }
.gantt .b { position: absolute; inset: 6px 0; }
.gantt .b.start { left: 3px; border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.gantt .b.end { right: 3px; border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.k-otpusk { background: color-mix(in srgb, var(--info) 55%, transparent); }
.k-bolnichny { background: color-mix(in srgb, var(--danger) 55%, transparent); }
.k-komandirovka { background: color-mix(in srgb, var(--warn) 60%, transparent); }
.k-otgul { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Popovers, modal, toast ---------- */
.pop {
  position: absolute; z-index: 60; min-width: 260px; max-width: 380px; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: 0 14px 34px rgba(0, 0, 0, .2); padding: 6px;
}
.pop .pi { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--radius-s); border: 0; background: none; cursor: pointer; color: var(--ink); text-decoration: none !important; font-size: 13px; }
.pop .pi:hover { background: var(--hover); }
.pop .ph { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop .notice { padding: 8px 10px; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.pop .notice.unread { background: var(--accent-soft); }
.pop .notice .t { font: 500 10.5px var(--mono); color: var(--faint); }
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 18, .45); z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-bg[hidden] { display:none; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal .panel-h h3 { font-size: 16px; flex: 1; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #141B24; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: calc(100vw - 32px); }
.toast.bad { background: #8F1D16; }
.toast-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.version-banner { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 101; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: #141B24; color: #fff; padding: 10px 12px 10px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: calc(100vw - 32px); }

/* ---------- Demo sign-in ---------- */
.login { min-height: 100vh; background: #EEF1F4; color: #141B24; font-family: 'Golos Text', system-ui, sans-serif; padding: 40px 24px 60px; }
.login-in { max-width: 1180px; margin: 0 auto; }
.login-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }
.login-head img { height: 54px; }
.login-head .crm { font: 600 13px/1 'JetBrains Mono', monospace; letter-spacing: .14em; color: #56616D; border-left: 1px solid #C8D0D9; padding-left: 16px; }
.login h1 { font: 700 26px/1.2 'IBM Plex Sans', 'Golos Text', sans-serif; margin: 22px 0 6px; }
.login .lead { color: #56616D; max-width: 820px; margin: 0 0 22px; }
.login-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.lcol { border-radius: 10px; padding: 14px; }
.lcol.b { background: #11161C; color: #DCE3EA; }
.lcol.a { background: #FFFFFF; border: 1px solid #DDE2E8; }
.lcol.c { background: #F2F5F4; border: 1px solid #DDE5E2; }
.lcol h2 { font: 600 15px/1.3 'Golos Text', sans-serif; margin: 0 0 2px; }
.lcol.c h2 { font-family: 'Manrope', sans-serif; font-weight: 800; }
.lcol .who-for { font-size: 12px; opacity: .7; margin-bottom: 12px; }
.lperson { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; padding: 9px 10px; border-radius: 8px; border: 1px solid transparent; background: none; cursor: pointer; color: inherit; margin-bottom: 4px; }
.lcol.a .lperson:hover { background: #E8EBF8; border-color: #C9CFF0; }
.lcol.b .lperson:hover { background: #2C2414; border-color: #E3A23B; }
.lcol.c .lperson { background: #fff; box-shadow: 0 1px 2px rgba(23, 32, 30, .05); }
.lcol.c .lperson:hover { border-color: #0F7B6C; }
.lperson .avatar { width: 34px; height: 34px; }
.lcol.a .avatar { background: #2A3BA8; color: #fff; } .lcol.b .avatar { background: #E3A23B; color: #1A1206; } .lcol.c .avatar { background: #0F7B6C; color: #fff; }
.lperson .nm { font-weight: 600; font-size: 13.5px; }
.lperson .tt { font-size: 12px; opacity: .72; }
.lperson .grow { flex: 1; min-width: 0; }
.lperson .cnt { font: 600 11px 'JetBrains Mono', monospace; padding: 3px 6px; border-radius: 9px; background: rgba(127, 127, 127, .15); white-space: nowrap; }
.lperson .cnt.late { background: #FAE8E6; color: #B3261E; }
.lcol.b .lperson .cnt.late { background: #34191A; color: #EF6B62; }
.login-foot { margin-top: 22px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: #56616D; font-size: 13px; }

/* ---------- Small things shared by the admin panel and the profile ---------- */
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.hint-line { font-size: 11.5px; }
.late-text { color: var(--danger); font-weight: 600; }
table.grid tr.off td { color: var(--faint); }
table.grid tr.off td b { color: var(--muted); }
.check-line { display: flex; gap: 8px; align-items: center; font-size: 13px; cursor: pointer; margin-bottom: 6px; }
.check-line input { accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.inline-checks { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: none; }
.modal.wide { width: min(860px, 100%); }
.modal .foot .grow { flex: 1; }
.modal .panel-b > p:first-child { margin-top: 0; }
.contract-route-dialog h4 { margin: 16px 0 8px; }
.contract-route-person { align-items: flex-start; padding: 5px 0; }
.contract-route-person > span { min-width: 0; }
.contract-route-dialog select { display: block; width: 100%; margin-top: 6px; }

/* ---------- Administration ---------- */
.admin { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.admin-nav { position: sticky; top: 16px; display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.theme-c .admin-nav { border-color: transparent; }
.admin-nav a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--radius-s); color: var(--ink); text-decoration: none !important; font-size: 13.5px; white-space: nowrap; }
.admin-nav a:hover { background: var(--hover); }
.admin-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.theme-b .admin-nav a.on { background: var(--accent); color: var(--accent-ink); }
.admin-nav svg.i { width: 17px; height: 17px; }
.admin-body { min-width: 0; }
.apanel { margin-bottom: 16px; }
.apanel .panel-h { gap: 10px; }
.atiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
a.tile { color: inherit; text-decoration: none !important; }
a.tile:hover { border-color: var(--accent); }
.warn-row { display: flex; gap: 10px; align-items: baseline; padding: 9px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.warn-row:last-child { border-bottom: 0; }
.warn-row:hover { background: var(--hover); }
.warn-row .dotm { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--info); transform: translateY(-1px); }
.warn-row.danger .dotm { background: var(--danger); }
.warn-row.warn .dotm { background: var(--warn); }
.temp-facts { margin-bottom: 12px; }
.temp-pass { font-size: 26px; font-weight: 600; letter-spacing: .12em; text-align: center; padding: 16px; border: 1.5px dashed var(--accent); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent); user-select: all; word-break: break-all; }
.handover { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; margin-bottom: 10px; }
.handover .hh { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.handover ul.hl { margin: 6px 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--muted); max-height: 110px; overflow: auto; }
.journal-filters select.input, .journal-filters input.input { width: auto; max-width: 220px; }
.journal-filters .dates { display: inline-flex; gap: 6px; align-items: center; color: var(--faint); }
table.grid.journal td { word-break: break-word; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; }
ul.rules { margin: 14px 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
ul.rules li { margin-bottom: 4px; }
.setting { padding: 4px 0 12px; }
.setting.risky b { color: var(--danger); }
.setting + .setting { border-top: 1px solid var(--line); padding-top: 12px; }
.admin-card .panel-h { gap: 8px; color: var(--accent); }
.admin-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.now-banner.trash { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: var(--danger-soft); }
.now-banner.trash > svg.i { color: var(--danger); }
td.person-col { min-width: 230px; }

/* Second part of the admin panel */
.k-other { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.tool-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.tool { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px 14px; display: grid; gap: 8px; align-content: start; }
.tool h4 { margin: 0; font-size: 14px; }
.tool p { margin: 0; }
.step-process { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 16px 0 6px; }
.theme-c .step-process { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 13px; }
table.steps-table td { vertical-align: middle; }
table.steps-table td.term { width: 260px; }
table.steps-table td.term select { padding: 5px 8px; }
.weekdays { display: flex; gap: 14px; flex-wrap: wrap; }
.weekdays .check-line { margin: 0; }
.date-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; }
.date-chip { display: inline-flex; align-items: center; gap: 4px; font: 500 12px var(--mono); padding: 3px 4px 3px 8px; border-radius: var(--radius-s); background: var(--surface-2); border: 1px solid var(--line); }
.date-chip button { border: 0; background: none; cursor: pointer; color: var(--faint); font-size: 14px; line-height: 1; padding: 0 3px; }
textarea.input.mono-area { font: 12.5px/1.5 var(--mono); }
.demo-note, .err-note { margin-bottom: 14px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--warn-soft); color: var(--warn); }
.err-note { background: var(--danger-soft); color: var(--danger); }
details.restore { margin-top: 14px; font-size: 13px; }
details.restore summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.restore code { font: 12px var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 3px; word-break: break-all; }
details.restore li { margin-bottom: 6px; }
.list-values { max-height: 420px; overflow: auto; }
.directory-group > summary { cursor: pointer; list-style: none; border-bottom: 0; border-radius: var(--radius); }
.directory-group > summary::-webkit-details-marker { display: none; }
.directory-group > summary:hover { background: var(--hover); }
.directory-group > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.directory-group[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.directory-chevron { font-size: 22px; line-height: 1; color: var(--faint); }
.directory-group[open] > summary .directory-chevron { transform: rotate(90deg); }
table.events-table td:first-child { width: 45%; }
table.events-table .check-line { margin: 0; }
.companies-admin { max-height: 460px; overflow: auto; margin-bottom: 16px; }

/* ---------- The company's structure ---------- */
.org-scroll { overflow: auto; max-height: max(320px, calc(100vh - 245px)); padding: 8px 0 24px; cursor: grab; overscroll-behavior: contain; }
.org-scroll.panning { cursor: grabbing; user-select: none; }
.org-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Client passport: the same panels and colours as the rest of CRM. */
.passport-tabs, .passport-filters { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:0 0 14px; }
.passport-filters > input[type=search] { min-width:160px; flex:1 1 240px; }
.passport-filters > select { width:auto; min-width:160px; flex:1 1 170px; }
.passport-list-row, .passport-file-row, .passport-related, .passport-history-row { display:flex; align-items:center; gap:10px; padding:11px 14px; border-bottom:1px solid var(--line); }
.passport-list-row { color:inherit; text-decoration:none; }
.passport-list-row:hover { background:var(--hover); }
.passport-list-row .grow { display:flex; flex-direction:column; gap:3px; min-width:0; }
.passport-file-row { flex-wrap:wrap; }
.passport-file-row .faint { flex:1; }
.passport-history-row { align-items:flex-start; flex-direction:column; }
.passport-history-row pre { white-space:pre-wrap; overflow-wrap:anywhere; max-height:320px; overflow:auto; }
/* Contacts with their data at once (0.1.71). */
.passport-contacts { display:grid; grid-template-columns:repeat(auto-fill,minmax(min(360px,100%),1fr)); gap:12px; align-items:start; }
.passport-contact { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:14px 16px; display:grid; gap:10px; min-width:0; }
.panel-b > .passport-contact { border:0; padding:0; max-width:640px; }
.passport-contact.archived { opacity:.75; }
.passport-contact.click { cursor:pointer; transition:border-color .12s, box-shadow .12s; }
.passport-contact.click:hover { border-color:var(--accent); box-shadow:0 2px 10px rgba(20,27,36,.06); }
.pc-head { display:flex; gap:12px; align-items:flex-start; }
.pc-head .avatar { width:40px; height:40px; font-size:13px; }
.pc-who { flex:1; min-width:0; display:grid; gap:2px; }
.pc-name { font-weight:650; font-size:15px; color:var(--ink); text-decoration:none; overflow-wrap:anywhere; }
a.pc-name:hover { text-decoration:underline; }
.pc-pos { color:var(--ink-2,var(--ink)); }
.pc-deps { font-size:12.5px; color:var(--muted); }
.pc-deps a { color:inherit; }
.pc-ways { display:grid; gap:4px; }
.pc-way { display:flex; align-items:center; gap:8px; min-width:0; }
.pc-way > .i { width:16px; height:16px; color:var(--muted); flex:none; }
.pc-way > a { font-variant-numeric:tabular-nums; overflow-wrap:anywhere; min-width:0; }
.pc-copy { width:26px; height:26px; margin-left:auto; opacity:.55; }
.pc-copy .i { width:14px; height:14px; }
.pc-way:hover .pc-copy, .pc-copy:focus-visible { opacity:1; }
.pc-role, .pc-comment { font-size:13px; overflow-wrap:anywhere; }
.pc-comment { color:var(--muted); white-space:pre-wrap; border-left:2px solid var(--line); padding-left:8px; }
.pc-comment.clamp { display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }
.pc-none { font-style:italic; }
@media (max-width:600px) { .pc-way > a { padding:4px 0; } .pc-copy { opacity:1; } }
.passport-facts { display:grid; grid-template-columns:minmax(145px,220px) minmax(0,1fr); gap:10px 16px; }
.passport-facts > div { min-width:0; white-space:pre-wrap; overflow-wrap:anywhere; }
.passport-counts { display:grid; grid-template-columns:repeat(auto-fit,minmax(135px,1fr)); gap:10px; }
.passport-count { display:flex; flex-direction:column; align-items:flex-start; gap:5px; padding:16px; color:var(--ink); text-align:left; cursor:pointer; }
.passport-count strong { font-size:22px; }
.passport-form { display:grid; gap:12px; }
.passport-form .field { margin:0; }
.passport-checks { display:flex; flex-wrap:wrap; gap:8px 16px; max-height:180px; overflow:auto; padding:8px; border:1px solid var(--line); border-radius:var(--radius-s); }
.passport-checks label, .passport-archive-toggle { display:inline-flex; gap:6px; align-items:center; }
.passport-map-frame { width:100%; height:320px; border:1px solid var(--line); border-radius:var(--radius-s); background:var(--surface); }
.passport-osm-map { width:100%; height:320px; border:1px solid var(--line); border-radius:var(--radius-s); background:var(--surface-2); isolation:isolate; }
.passport-map-error[hidden] { display:none; }
@media (max-width:600px) { .passport-facts { grid-template-columns:1fr; gap:4px; } .passport-facts > div:nth-child(2n) { margin-bottom:8px; } .passport-map-frame, .passport-osm-map { height:260px; } }
.org-tools { flex-wrap: wrap; }
.org-zoom-controls { display: inline-flex; align-items: center; gap: 6px; }
.org-zoom-value { min-width: 3.4em; text-align: center; font-size: 12px; color: var(--muted); }
.org { display: inline-block; min-width: 100%; }
.org ul { display: flex; justify-content: center; padding: 24px 0 0; margin: 0; position: relative; }
.org > ul { padding-top: 0; }
.org li { list-style: none; position: relative; padding: 24px 7px 0; display: flex; flex-direction: column; align-items: center; }
.org > ul > li { padding-top: 0; }
/* The connectors: a line across over the siblings, one down to each card. */
.org li::before, .org li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 24px; border-top: 2px solid var(--line-2); }
.org li::after { right: auto; left: 50%; border-left: 2px solid var(--line-2); }
.org li:only-child::before, .org li:only-child::after { display: none; }
.org li:only-child { padding-top: 0; }
.org li:first-child::before, .org li:last-child::after { border: 0 none; }
.org li:last-child::before { border-right: 2px solid var(--line-2); border-radius: 0 8px 0 0; }
.org li:first-child::after { border-radius: 8px 0 0 0; }
.org ul ul::before { content: ''; position: absolute; top: 0; left: 50%; height: 24px; border-left: 2px solid var(--line-2); }
.org ul ul > li:only-child { padding-top: 24px; }
.org ul ul > li:only-child::after { display: block; border-top: 0; border-left: 2px solid var(--line-2); border-radius: 0; left: 50%; width: 0; }
/* A card as Bitrix24 draws it: the department, its head with everyone under them, the
   subordinates, the departments below. The cards of a level are as tall as the tallest. */
.org-card { position: relative; width: 236px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 12px 0; cursor: pointer; color: var(--ink); font: inherit; display: flex; flex-direction: column; gap: 9px; }
.theme-c .org-card { border-color: transparent; }
.org-card:hover { border-color: var(--accent); }
.org-card.root { width: 270px; border-top: 3px solid var(--accent); }
.org-card.mine { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.org-card.open, .org-card.hit { border-color: var(--accent); background: var(--accent-soft); }
.org-badge { position: absolute; top: -9px; right: 10px; font: 600 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; background: var(--accent); color: var(--accent-ink); padding: 4px 6px; border-radius: 4px; }
.org-name { display: flex; gap: 6px; align-items: flex-start; font-weight: 700; font-size: 13.5px; line-height: 1.3; }
.org-name svg.i { width: 16px; height: 16px; flex: none; color: var(--accent); margin-top: 1px; }
.org-head { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; min-width: 0; }
.org-head .avatar { flex: none; margin-top: 1px; }
.org-head .nm { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.org-head .tt { font-size: 11.5px; color: var(--muted); }
.org-head.none { color: var(--faint); font-size: 12px; }
.org-under { display: inline-flex; align-items: center; gap: 3px; font: 600 11px/1 var(--font); color: var(--muted); background: var(--hover); border: 1px solid var(--line); border-radius: 999px; padding: 2px 6px 2px 5px; }
.org-under svg.i { width: 12px; height: 12px; }
.org-label { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.org-foot { margin: auto -12px 0; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--faint); text-align: center; }
.org-foot.has { color: var(--accent); font-weight: 600; background: var(--accent-soft); border-radius: 0 0 var(--radius) var(--radius); }
.org .org-print-list, .org-print-table, .org-print-head { display: none; }
.org-found { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 10px; }
.org-hit { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 4px 10px 4px 4px; cursor: pointer; color: var(--ink); font-size: 12.5px; }
.org-hit svg.i { width: 15px; height: 15px; margin-left: 4px; }
.org-hit:hover { border-color: var(--accent); }
.org-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: var(--surface); box-shadow: -14px 0 40px rgba(0, 0, 0, .18); z-index: 75; display: flex; flex-direction: column; }
@media screen and (min-width: 861px) {
  .org-drawer { width: min(400px, 38vw); }
  body.org-drawer-open .org-page { margin-right: min(400px, 38vw); }
}
.org-drawer-h { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.org-drawer-h h3 { flex: 1; font-size: 17px; }
.org-drawer-b { padding: 12px 18px 24px; overflow: auto; }
.org-count { display: inline-block; margin: 8px 0 10px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: 4px 9px; }
.org-count b { color: var(--ink); }
.org-sec { font: 600 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 16px 0 6px; }
.org-sec span { color: var(--faint); }
.theme-c .org-sec { font-family: var(--font); text-transform: none; letter-spacing: 0; font-size: 13px; }
.org-person, .org-sub { display: flex; width: 100%; gap: 10px; align-items: center; text-align: left; border: 0; background: none; padding: 7px 6px; border-radius: var(--radius-s); cursor: pointer; color: var(--ink); font: inherit; }
.org-person:hover, .org-sub:hover { background: var(--hover); }
.org-person .nm { font-weight: 600; font-size: 13.5px; }
.org-person .tt { font-size: 12px; color: var(--muted); }
.away { font-size: 11.5px; color: var(--warn); margin-top: 2px; }
.org-pc { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.org-pc .nm { font-weight: 700; font-size: 16px; }
.avatar.lg { width: 52px; height: 52px; font-size: 16px; }
@media screen and (max-width: 860px) {
  .org-drawer { top: auto; max-height: 38vh; width: 100%; box-shadow: 0 -8px 28px rgba(0, 0, 0, .2); }
  body.org-drawer-open .org-page { padding-bottom: calc(38vh + 30px); }
  body.org-drawer-open .org-scroll { max-height: min(38vh, max(100px, calc(62vh - 220px))); }
  /* A phone gets the tree as an indented list (paper keeps the tree). */
  body:not(.org-printing) .org ul { display: block; padding: 0 0 0 18px; }
  body:not(.org-printing) .org > ul { padding-left: 0; }
  body:not(.org-printing) .org li { display: block; padding: 8px 0 0; }
  body:not(.org-printing) .org li::before, body:not(.org-printing) .org li::after, body:not(.org-printing) .org ul ul::before { display: none; }
  body:not(.org-printing) .org li li { border-left: 2px solid var(--line-2); padding-left: 10px; }
  body:not(.org-printing) .org-card { width: 100%; }
}
/* The chart as it prints (the class is on while printing): every person on the cards. */
.org-printing .org-card { box-shadow: none !important; border: 1px solid #9aa3ad !important; background: #fff !important; color: #000; width: 236px; }
.org-printing .org-card.root { width: 380px; border-top: 3px solid #2b3a9e !important; }
.org-printing .org-badge { display: none; }
.org-printing .org-foot.has { background: #f1f3f6; color: #222; }
.org-printing .org .org-print-list { display: block; margin: -2px 0 0; padding: 6px 0 2px; border-top: 1px solid #d5dbe1; font-size: 10px; line-height: 1.4; }
.org-printing .org-print-list span { color: #555; }
.org-printing .org li { padding-left: 4px; padding-right: 4px; }
@media print {
  .nav, .top, .org-tools, .org-found, .org-hint, .org-drawer, .toast, .modal-bg { display: none !important; }
  body, .page, .main, .shell { background: #fff !important; color: #000 !important; display: block !important; padding: 0 !important; }
  .org-scroll { overflow: visible; max-height: none; padding: 0; }
  body.org-drawer-open .org-page { margin-right: 0; padding-bottom: 0; }
  .org-card { break-inside: avoid; }
  .org-print-head { display: block; margin-bottom: 14px; }
  .org-print-head h1 { font-size: 20px; margin: 0 0 2px; }
  .org-print-head div { font-size: 11px; color: #444; }
  .org-print-table { display: block; break-before: page; font-size: 11px; columns: 2; column-gap: 28px; }
  .org-print-table h2 { font-size: 16px; margin-bottom: 10px; column-span: all; }
  .org-print-dept { break-inside: avoid; margin-bottom: 12px; }
  .org-print-dept h3 { font-size: 13px; margin: 0 0 4px; }
  .org-print-dept h3 span { font-weight: 400; color: #555; }
  .org-print-dept table { border-collapse: collapse; width: 100%; }
  .org-print-dept td { border-bottom: 1px solid #e1e5ea; padding: 3px 6px; }
  .org-print-dept td:first-child { width: 45%; }
  .org-print-dept td:last-child { width: 18%; color: #555; }
}
/* Only the structure prints on A3 across; other pages keep the printer's paper. */
@page org { size: A3 landscape; margin: 10mm; }
@page flow { size: A3 portrait; margin: 12mm 12mm 16mm; }
@media print { .org-print-head, .org-scroll, .org-print-table { page: org; } }

/* ---------- Profile ---------- */
.profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.profile-grid .panel { margin-bottom: 16px; }
.form-b { max-width: 460px; }

/* ---------- Sign-in with a password ---------- */
.login-only { display: grid; place-items: start center; padding-top: 10vh; }
.login-box { width: min(420px, 100%); background: #FFFFFF; border: 1px solid #DDE2E8; border-radius: 10px; padding: 28px 28px 22px; }
.login-box .login-head img { height: 44px; }
.login-box h1 { margin-top: 18px; }
.login-box .faint { color: #8A949F; font-size: 13px; }
.login-form { display: grid; gap: 2px; margin-top: 14px; }
.login .login-form .input { background: #FFFFFF; color: #141B24; border-color: #C8D0D9; }
.login .login-form .field > label { color: #56616D; }
.login .login-form .btn.primary { background: #2A3BA8; border-color: #2A3BA8; color: #FFFFFF; justify-self: start; padding: 9px 22px; margin-top: 4px; }
.login .btn.ghost { color: #56616D; margin-top: 10px; padding-left: 0; }
details.login-pass { margin-top: 26px; max-width: 420px; }
details.login-pass summary { cursor: pointer; color: #2A3BA8; font-weight: 600; }
details.login-pass .faint { color: #8A949F; font-size: 13px; }

/* ---------- Document viewer ---------- */
.viewer-bg { z-index: 90; padding: 16px; }
.viewer { width: min(1240px, 100%); height: calc(100vh - 32px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: hidden; }
.viewer-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--line); }
.viewer-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.viewer-title .fn { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-title .fs { font-size: 11.5px; color: var(--faint); }
.viewer-title .ext { font: 700 9.5px/1 var(--mono); padding: 7px 4px; border-radius: 3px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); min-width: 36px; text-align: center; text-transform: uppercase; }
.viewer-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.viewer-ver { width: auto; max-width: 260px; padding: 5px 8px; font-size: 12.5px; }
.viewer-note { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--warn-soft); color: var(--warn); font-size: 13px; border-bottom: 1px solid var(--line); }
.viewer-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface-2); }
.viewer-body > .empty { margin: auto; }
.msg-view { flex: 1; min-height: 0; overflow: auto; padding: 24px; color: var(--ink); }
.msg-facts { display: grid; grid-template-columns: 95px minmax(0,1fr); gap: 7px 12px; margin: 0 0 18px; }
.msg-facts dt { color: var(--muted); }
.msg-facts dd { margin: 0; overflow-wrap: anywhere; }
.msg-content { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.msg-view h3 { margin: 20px 0 8px; font-size: 15px; }
.msg-attachments { display: grid; gap: 7px; }
.msg-attachment { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
.msg-attachment-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pdf-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pdf-count { font: 500 12px var(--mono); color: var(--muted); margin-left: 6px; }
.pdf-pages { flex: 1; overflow: auto; padding: 16px; background: #5B6168; }
.theme-b .pdf-pages { background: #0B0F13; }
.pdf-page { margin: 0 auto 14px; background: #FFFFFF; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
.pdf-page canvas { display: block; width: 100%; height: 100%; }
.pdf-native { flex: 1; min-height: 0; width: 100%; border: 0; background: #5B6168; }
.pdf-fail { display: flex; flex-direction: column; gap: 6px; padding: 24px; color: #1F2329; font-size: 14px; line-height: 1.45; }
.docx-host { flex: 1; overflow: auto; background: #5B6168; }
.docx-host .docx-wrapper { background: transparent; padding: 20px; }
.docx-host .docx-wrapper > section.docx { box-shadow: 0 2px 10px rgba(0, 0, 0, .35); margin-bottom: 18px; color: #000; }
.sheet-view { flex: 1; overflow: auto; background: var(--surface); }
table.sheet { border-collapse: collapse; font-size: 12.5px; font-family: var(--font); }
table.sheet th, table.sheet td { border: 1px solid var(--line); padding: 3px 8px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.sheet thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--faint); font: 600 11px var(--mono); z-index: 1; }
table.sheet th.rn { position: sticky; left: 0; background: var(--surface-2); color: var(--faint); font: 500 11px var(--mono); text-align: right; z-index: 2; }
table.sheet td.num { text-align: right; font-family: var(--mono); }
.sheet-tabs { display: flex; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--line); background: var(--surface); overflow-x: auto; flex: none; }
.sheet-tabs button { border: 1px solid transparent; background: none; padding: 5px 12px; border-radius: var(--radius-s); cursor: pointer; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.sheet-tabs button.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); font-weight: 600; }
.text-view { flex: 1; margin: 0; overflow: auto; padding: 16px 20px; background: var(--surface); font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
textarea.text-edit { flex: 1; border: 0; border-radius: 0; padding: 16px 20px; font: 13px/1.55 var(--mono); resize: none; min-height: 0; box-shadow: none !important; }
.viewer-foot { padding: 8px 16px; font-size: 12px; color: var(--muted); background: var(--surface); border-top: 1px solid var(--line); flex: none; }
.viewer-image { flex: 1; overflow: auto; display: grid; place-items: center; padding: 16px; background: #5B6168; }
.viewer-image img { max-width: 100%; height: auto; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); background: #FFFFFF; }
.file .ext.xlsx, .file .ext.xls { color: #1F7244; } .file .ext.txt, .file .ext.csv { color: var(--muted); }
.theme-b .file .ext.xlsx, .theme-b .file .ext.xls { color: #6CC495; }

/* ---------- Narrow screens ---------- */
@media (max-width: 1100px) {
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .card-detail-grid { gap: 0; }
  .card-divider { display: none; }
  .sum-grid { grid-template-columns: minmax(0, 1fr); }
  .search input { width: 220px; }
  .route { flex-direction: column; }
  .route .ends { flex: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .route .steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .step { overflow-wrap: break-word; }
}
@media (max-width: 860px) {
  .theme-a .shell, .theme-b .shell, .theme-c .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .theme-c .nav-item.minor { display: flex; }
  .nav, .theme-a .nav, .theme-b .nav, .theme-c .nav {
    position: fixed; top: 0; left: 0; bottom: 0; width: 264px; height: 100vh; flex-direction: column; align-items: stretch;
    height: 100dvh; box-sizing:border-box; padding: 16px 12px max(16px, env(safe-area-inset-bottom)); transform: translateX(-105%); transition: transform .18s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .3); z-index: 70; overflow-y: auto;
  }
  .pop { z-index:76; }
  body.nav-open .nav { transform: none; }
  .theme-b .nav-item, .theme-c .nav-item { flex-direction: row; gap: 10px; padding: 9px 10px; font-size: 14px; text-align: left; border-radius: var(--radius); }
  .theme-b .nav-item .full, .theme-c .nav-item svg.i { display: inline; }
  .theme-b .nav-item .short { display: none; }
  .theme-b .nav-item .badge { position: static; }
  .theme-b .brand, .theme-c .brand { justify-content: flex-start; margin: 0 0 12px; }
  .theme-c .nav .tools { margin: 12px 0 0; }
  .theme-c .me-block { display: flex; }
  .icon-btn.menu-btn { display: inline-grid; }
  .top, .theme-c .top { padding: 10px 14px; position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--line); }
  .theme-c .top h1 { font-size: 18px; display: block; }
  .theme-c .top .subtitle { display: block; font-size: 12px; }
  .search input { width: 100%; }
  .top .search { display: none; }
  .page, .theme-b .page, .theme-c .page { padding: 14px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split.has-detail .tasklist { display: none; }
  .split:not(.has-detail) .taskview { display: none; }
  .back-link { display: inline-flex; }
  .tasklist { border-right: 0; }
  .facts, .fgroup .panel-b { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .facts .k, .fgroup .k { margin-top: 6px; font-size: 12px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bar { grid-template-columns: 120px minmax(0, 1fr) 28px; }
  .login-cols { grid-template-columns: 1fr; }
  .search-results { width: calc(100vw - 28px); }
  .taskview, .theme-c .taskview { padding: 14px; }
  .btn .hide-sm { display: none; }
}
@media (max-width: 1100px) {
  .admin { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .admin-nav { position: static; display: flex; overflow-x: auto; padding: 6px; }
  .admin-nav a { flex: none; }
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .atiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .inline-checks, .tool-grid { grid-template-columns: minmax(0, 1fr); }
  table.steps-table td.term { width: auto; }
  .journal-filters select.input, .journal-filters input.input { max-width: none; width: 100%; }
  .journal-filters .dates { width: 100%; }
  .viewer-bg { padding: 0; }
  .viewer { height: 100vh; height: 100dvh; border-radius: 0; }
  .viewer-head { padding: 8px 8px 8px 12px; gap: 8px; flex-wrap: wrap; }
  .viewer-actions { flex-wrap: wrap; }
  .viewer-ver { max-width: 150px; }
  .msg-view { padding: 14px; }
  .msg-facts { grid-template-columns: 60px minmax(0,1fr); }
  .pdf-pages, .docx-host .docx-wrapper { padding: 8px; }
  .login-only { padding-top: 24px; }
  .login-box { padding: 20px 18px 16px; }
}
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); margin-top: 4px; max-width: 320px; overflow: hidden; }
.meter > div { height: 100%; background: var(--accent); }
.meter > div.full { background: var(--danger); }
.ok-note { padding: 10px 12px; border-radius: var(--radius-s); background: var(--ok-soft); color: var(--ok); }
.import-sum .pill { margin-right: 4px; }
table.grid tr.import-bad td { background: color-mix(in srgb, var(--danger-soft) 60%, transparent); }
ol.rules { padding-left: 20px; }

/* Personal login and mandatory fields. */
.login-remember { display:flex; gap:8px; align-items:center; margin:4px 0 16px; }
.required-hint { color:var(--danger); font-size:12px; margin-top:4px; }
.field-invalid > .input, .field-invalid > div { outline:2px solid var(--danger); outline-offset:2px; }
.field-invalid > .required-hint { outline:0; }
.note .req { color:var(--danger); font-weight:700; }

/* Employee names and sortable table headers (0.1.4). */
.staff-table th { white-space: nowrap; }
.staff-sort { display: inline-flex; align-items: center; gap: 7px; border: 0;
  padding: 6px 0; background: transparent; color: inherit; font: inherit;
  letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.staff-sort:hover { color: var(--accent); }
.staff-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.staff-sort-arrow { font-size: 10px; min-width: 10px; }
.staff-table th[aria-sort] { color: var(--accent); }
.staff-name-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.staff-name-review { color: var(--warn); }
@media (max-width: 640px) { .staff-name-grid { grid-template-columns: 1fr; } }
/* Staff dialog: account tools in one row above the footer, which only cancels or saves. */
.account-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-s); }
@media (max-width: 640px) {
  .account-tools > .btn { flex: 1 1 100%; }
  .staff-foot > .grow { display: none; }
  .staff-foot > .btn { flex: 1 1 0; }
}
/* Maroon: actions that hand over the highest authority. */
.btn.maroon { background: #7b1e2c; border-color: #7b1e2c; color: #fff; }
.btn.maroon:hover:not(:disabled) { background: #641722; border-color: #641722; }
.btn.maroon:disabled { opacity: .5; cursor: not-allowed; }

/* 0.1.7: selected-row review and explicit local tax corrections. */
.review-toolbar, .review-bulk, .review-apply { display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin:12px 0; }
.review-toolbar > .input { width:auto; max-width:360px; }
.review-bulk { padding:12px; border:1px solid var(--line); background:var(--surface); border-radius:var(--radius); }
.review-bulk > .input { width:auto; max-width:380px; }
.review-bulk [hidden] { display:none; }
.review-table { min-width:1160px; }
.review-table td { vertical-align:top; }
.review-table td:nth-child(2) { min-width:190px; max-width:280px; overflow-wrap:anywhere; }
.review-table td:nth-child(3), .review-table td:nth-child(4), .review-table td:nth-child(6) { min-width:140px; max-width:240px; overflow-wrap:anywhere; }
.review-table .review-selected td { background:var(--accent-soft, #edf0fc); }
.review-table td:first-child { width:42px; text-align:center; }
.review-table input[type=checkbox], .review-bulk input[type=checkbox], .tax-table input[type=checkbox] { min-width:18px; width:18px; height:18px; }
.review-pager { justify-content:space-between; gap:12px; margin:14px 0; }
.review-preview { max-height:52vh; overflow:auto; }
.review-preview table { min-width:640px; }
.review-preview th { position:sticky; top:0; background:var(--surface); z-index:1; }
.tax-raw { white-space:pre-wrap; overflow-wrap:anywhere; font-family:var(--mono, monospace); font-size:12px; }
.tax-table { min-width:850px; }
.tax-table td { vertical-align:top; }
.tax-table td:nth-child(2), .tax-table td:nth-child(3) { max-width:360px; }
.review-editor .note:empty { display:none; }
@media (max-width:650px) {
  .review-toolbar > .input, .review-bulk > .input { max-width:100%; width:100%; }
  .review-bulk { align-items:stretch; }
}

/* 0.1.9: one whole-snapshot frame, one entry per source manager. */
.review-manager-conflicts{border:1px solid var(--line,#d5dce5);border-radius:8px;padding:18px;margin:18px 0;background:var(--card,#fff)}
.review-manager-conflicts h3{margin-top:0}.manager-conflict{border-top:1px solid var(--line,#d5dce5);padding:12px 0}
.manager-conflict summary{font-weight:600;cursor:pointer;overflow-wrap:anywhere}.manager-conflict .input{max-width:640px}
.manager-conflict .mono{overflow-wrap:anywhere}.manager-conflict .err:empty{display:none}

/* 0.1.10: company search, groups and admin controls. */
.company-picker { position:relative; min-width:0; }
.company-picker-input { display:flex;align-items:center;gap:2px; }
.company-picker-input .input {min-width:0;flex:1;}
.company-picker-popup {position:fixed;z-index:110;overflow:auto;overscroll-behavior:contain;background:var(--surface);border:1px solid var(--line-2);border-radius:var(--radius);box-shadow:0 8px 24px #0003;padding:5px;text-align:left;}
.company-picker-popup[hidden] {display:none;}
.company-picker-group {padding:8px 6px;cursor:pointer;font-weight:600;border-radius:4px;}
.company-picker-group > [role=group] {font-weight:400;}
.company-picker-option,.company-picker-more {padding:8px 10px 8px 22px;cursor:pointer;display:flex;flex-direction:column;gap:3px;white-space:normal;overflow-wrap:anywhere;border-radius:4px;}
.company-picker-more {font-size:12px;color:var(--accent);}
.company-picker-create { margin:6px; max-width:calc(100% - 12px); white-space:normal; text-align:left; overflow-wrap:anywhere; }
.company-picker-option:hover,.company-picker-option.active,.company-picker-group.active {background:var(--hover);outline:1px solid var(--accent);}
.company-picker-option[aria-selected=true] {font-weight:600;color:var(--accent);}
.company-picker-status {padding-top:4px;}
.company-picked {display:flex;gap:5px;flex-wrap:wrap;}
.company-chip {display:inline-flex;align-items:center;gap:5px;padding:3px 6px;border:1px solid var(--line);border-radius:4px;font-size:12px;}
.company-filters {display:flex;gap:12px;flex-wrap:wrap;align-items:center;margin:12px 0;}
.company-filters > .input {width:auto;max-width:420px;flex:1 1 240px;}
.company-tri {border:0;padding:0;margin:0;min-width:0;display:flex;gap:0;}
.company-tri legend {font-size:11px;color:var(--muted);margin-bottom:5px;}
.company-tri label {position:relative;cursor:pointer;}
.company-tri input {position:absolute;opacity:0;width:1px;height:1px;}
.company-tri span {display:block;padding:7px 9px;border:1px solid var(--line-2);font-size:12px;}
.company-tri input:checked + span {background:var(--accent);color:var(--on-accent,#fff);border-color:var(--accent);}
.company-tri input:focus-visible + span {outline:2px solid var(--accent);outline-offset:2px;}
.company-directory-tools {display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:12px 0;}
.company-admin-group {border:1px solid var(--line);border-radius:var(--radius);margin:8px 0;}
.company-admin-group > summary {display:flex;align-items:center;gap:12px;padding:10px;cursor:pointer;font-weight:600;}
.company-admin-group > summary .icon-btn {margin-left:auto;}
.company-admin-group[open] > summary {border-bottom:1px solid var(--line);}
.group-hidden {display:inline-flex;align-items:center;gap:4px;color:var(--muted);font-weight:400;font-size:12px;}
.company-select-filtered {display:flex;gap:8px;align-items:center;margin:10px 0;font-size:13px;}
.company-selected td {background:var(--hover);}
.company-finder-list tr[data-company-id]:focus-visible {outline:2px solid var(--accent);outline-offset:-2px;}
.company-finder-list tr[data-company-id] {cursor:default;}
.company-finder-list .company-select-cell {width:38px;min-width:38px;cursor:pointer;}
.company-finder-list td[data-field="inn"], .company-finder-list td[data-field="kpp"] {white-space:nowrap;overflow-wrap:normal;word-break:normal;}
.company-window-tools {display:flex;align-items:center;gap:16px;flex-wrap:wrap;margin:10px 0;}
.company-window-control {display:flex;align-items:center;gap:8px;font-size:13px;}
.company-window-control select {width:auto;min-width:78px;}
.company-list-window {min-width:0;max-width:100%;max-height:890px;overflow:auto;scroll-padding-top:var(--company-window-header-offset,91px);border:1px solid var(--line);border-radius:var(--radius);}
.company-list-window:focus-visible {outline:2px solid var(--accent);outline-offset:2px;}
.company-list-window > .company-admin-group {margin:0;border:0;border-bottom:1px solid var(--line);border-radius:0;}
.company-list-window > .company-admin-group:last-child {border-bottom:0;}
.company-list-window > .company-admin-group > summary {position:sticky;top:0;z-index:3;background:var(--surface);}
.company-list-window .companies-admin {max-height:none;margin-bottom:0;overflow:visible;}
.company-list-window table.grid thead {position:sticky;top:var(--company-group-header-height,42px);z-index:2;background:var(--surface);}
.company-sort {display:inline-flex;align-items:center;gap:3px;min-height:30px;padding:0;border:0;background:transparent;color:inherit;font:inherit;font-weight:inherit;text-align:left;cursor:pointer;}
.company-sort:focus-visible {outline:2px solid var(--accent);outline-offset:3px;border-radius:3px;}
.company-sort:disabled {cursor:default;opacity:.6;}
.company-field-picker {position:relative;}
.company-field-picker > summary {list-style:none;cursor:pointer;}
.company-field-picker > summary::-webkit-details-marker {display:none;}
.company-field-options {position:fixed;z-index:145;max-width:calc(100vw - 16px);overflow:auto;padding:12px;border:1px solid var(--line-2);border-radius:var(--radius);background:var(--surface);box-shadow:0 8px 30px #0004;gap:9px;}
.company-field-picker:not([open]) > .company-field-options {display:none;}
.company-field-picker[open] > .company-field-options {display:grid;}
.company-field-options .check-line {margin:0;font-size:13px;cursor:pointer;}
.company-field-options input:disabled {cursor:default;}
.company-field-options .btn {margin-top:4px;justify-content:center;}
.company-context {position:fixed;z-index:150;max-height:75vh;overflow:auto;min-width:220px;max-width:calc(100vw - 16px);padding:5px;border:1px solid var(--line-2);border-radius:var(--radius);background:var(--surface);box-shadow:0 8px 30px #0004;}
.company-context button,.company-context summary {display:block;width:100%;padding:9px 12px;border:0;background:transparent;color:var(--text);font:inherit;text-align:left;cursor:pointer;}
.company-context button:hover,.company-context summary:hover {background:var(--hover);}
.company-context button:disabled {opacity:.4;cursor:default;}
.company-submenu > div {border-left:2px solid var(--line);margin-left:12px;}
@media (max-width:640px) {.company-filters > .input{max-width:100%;}.company-tri span{padding:7px;}.company-directory-tools .btn {font-size:12px;} }

/* Sidebar display is personal and independent of the role's color theme. */
.brand img.mark {display:none;}
.theme-b .brand img.mark {display:block;}
.theme-b .brand img.logo, .theme-b .brand .crm {display:none;}
/* On the dark theme B the logo text is light (web/logo-dark.png, scripts/generate-dark-logo.cjs). */
.brand img.logo-dark {display:none;}
.sidebar-toggle {display:none;}
.sidebar-toggle[data-compact="true"] svg {transform:rotate(180deg);}
.nav-item:focus-visible,.me-block:focus-visible,.sidebar-toggle:focus-visible {outline:2px solid var(--accent);outline-offset:2px;}
@media (min-width:861px) {
  .theme-a .sidebar-toggle,.theme-b .sidebar-toggle {display:inline-grid;}
  body[data-sidebar-mode="expanded"].theme-b .shell {grid-template-columns:236px minmax(0,1fr);}
  body[data-sidebar-mode="expanded"].theme-b .nav {padding:18px 12px 12px;}
  body[data-sidebar-mode="expanded"].theme-b .brand {justify-content:flex-start;padding:0 6px 18px;}
  body[data-sidebar-mode="expanded"].theme-b .brand img.logo:not(.logo-dark) {display:none;}
  body[data-sidebar-mode="expanded"].theme-b .brand img.logo-dark {display:block;}
  body[data-sidebar-mode="expanded"].theme-b .brand img.mark {display:none;}
  body[data-sidebar-mode="expanded"].theme-b .brand .crm {display:inline;}
  body[data-sidebar-mode="expanded"].theme-b .nav-group {display:block;}
  body[data-sidebar-mode="expanded"].theme-b .nav-item {flex-direction:row;gap:10px;padding:8px 10px;font-size:14px;text-align:left;}
  body[data-sidebar-mode="expanded"].theme-b .nav-item .label {flex:1;}
  body[data-sidebar-mode="expanded"].theme-b .nav-item .full {display:inline;}
  body[data-sidebar-mode="expanded"].theme-b .nav-item .short {display:none;}
  body[data-sidebar-mode="expanded"].theme-b .nav-item .count {display:inline;}
  body[data-sidebar-mode="expanded"].theme-b .nav-item .badge {position:static;}
  body[data-sidebar-mode="expanded"].theme-b .me-block {justify-content:flex-start;border-top:1px solid var(--line);padding:12px 8px 4px;}
  body[data-sidebar-mode="expanded"].theme-b .me-block .who {display:block;}
  body[data-sidebar-mode="collapsed"].theme-a .shell,body[data-sidebar-mode="collapsed"].theme-b .shell {grid-template-columns:72px minmax(0,1fr);}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .nav {padding:12px 6px;}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .nav-group,body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .nav-item .label,body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .nav-item .count,body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .me-block .who {display:none;}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .brand {justify-content:center;padding:4px 0 14px;}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .brand img.logo,body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .brand .crm {display:none;}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .brand img.mark {display:block;}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .nav-item {flex-direction:row;justify-content:center;gap:0;padding:10px 2px;}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .nav-item .badge {position:absolute;top:2px;right:2px;font-size:9px;padding:2px 4px;}
  body[data-sidebar-mode="collapsed"]:is(.theme-a,.theme-b) .me-block {justify-content:center;border-top:0;padding:8px 0;}
  /* The toggle is a small circle on the menu's border, level with the logo, in both widths. */
  :is(.theme-a,.theme-b) .sidebar-toggle {position:fixed;z-index:35;top:22px;left:59px;width:26px;height:26px;padding:0;border-radius:50%;border:1px solid var(--line-2);background:var(--surface);color:var(--muted);box-shadow:var(--shadow);}
  :is(.theme-a,.theme-b) .sidebar-toggle svg {width:14px;height:14px;}
  :is(.theme-a,.theme-b) .sidebar-toggle:hover {color:var(--ink);border-color:var(--accent);background:var(--surface);}
  body:not([data-sidebar-mode="collapsed"]).theme-a .sidebar-toggle,body[data-sidebar-mode="expanded"].theme-b .sidebar-toggle {left:223px;}
}

/* Built-in user guide */
.guide-page {max-width:1440px;}
.guide-intro {margin-bottom:24px;background:linear-gradient(125deg,var(--surface),var(--accent-soft));}
.guide-intro h2 {font-size:26px;line-height:1.25;margin:6px 0 12px;}
.guide-intro p {max-width:820px;line-height:1.65;}
.guide-kicker {font:500 11px var(--mono);letter-spacing:.04em;color:var(--accent);}
.guide-layout {display:grid;grid-template-columns:230px minmax(0,1fr);gap:24px;align-items:start;}
.guide-contents {position:sticky;top:84px;min-width:0;max-height:calc(100vh - 104px);overflow-y:auto;padding:2px;}
.guide-contents > label {display:block;font-weight:600;margin-bottom:8px;}
.guide-contents > .input {width:100%;font-size:12px;}
.guide-contents > button {margin-top:6px;}
.guide-links {display:grid;gap:3px;margin:12px 0;}
.guide-links button {text-align:left;background:none;border:0;border-left:2px solid var(--line);padding:9px 12px;color:var(--ink);font:inherit;font-size:12px;cursor:pointer;line-height:1.45;}
.guide-links button:hover,.guide-links button:focus-visible {background:var(--accent-soft);border-left-color:var(--accent);}
.guide-content {min-width:0;}
.guide-section,.guide-general {margin:0 0 16px;scroll-margin-top:96px;}
.guide-section > summary,.guide-general > summary {cursor:pointer;display:list-item;list-style-position:inside;}
.guide-section > summary h2,.guide-general > summary h2 {display:inline;font-size:17px;line-height:1.5;}
.guide-section[open] > summary,.guide-general[open] > summary {background:var(--accent-soft);}
.guide-content .panel-b {padding:22px 26px;}
.guide-content p,.guide-content li,.guide-content dd {line-height:1.65;}
.guide-content li {margin:8px 0;}
.guide-content ul,.guide-content ol {padding-left:23px;}
.guide-content h3 {font-size:17px;line-height:1.4;margin:30px 0 12px;}
.guide-content h3:first-child {margin-top:0;}
.guide-content h4 {font-size:14px;margin:22px 0 8px;}
.guide-purpose {font-size:15px;}
.guide-pdf {margin:16px 0 0;}
.guide-example {border-left:3px solid var(--accent);padding:12px 18px;background:var(--hover);}
.guide-pairs {margin:12px 0;}
.guide-pairs dt {font-weight:600;line-height:1.5;margin:16px 0 4px;}
.guide-pairs dd {margin:0;color:var(--muted);}
.guide-workflow {border-left:2px solid var(--line);padding-left:18px;}
.guide-content figure {margin:22px 0;}
.guide-screenshot {display:block;width:min(100%,820px);height:auto;border:1px solid var(--line);border-radius:var(--radius);}
.flow-map {overflow:hidden;border:1px solid #b8cde5;border-radius:14px;background:#fff;color:#142e52;}
.flow-map-head {position:relative;overflow:hidden;padding:28px 32px 26px;color:#102f57;background:#e8f1fd;border-bottom:1px solid #b8cde5;}
.flow-map-eyebrow {position:relative;z-index:1;font-size:10px;letter-spacing:.14em;font-weight:800;color:#315b85;}
.flow-map-title {position:relative;z-index:1;margin-top:10px;font-size:25px;font-weight:750;letter-spacing:-.025em;line-height:1.22;}
.guide-content .flow-map-intro {position:relative;z-index:1;max-width:640px;margin:9px 0 0;color:#375a7b;font-size:13px;line-height:1.5;}
.flow-map-body {padding:26px 30px 30px;}
.flow-tree-toolbar {display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:12px;}
.flow-tree-toolbar .btn {min-width:36px;padding:6px 10px;}
.flow-tree-level {min-width:64px;text-align:center;color:#536583;font-size:12px;font-weight:700;}
.flow-tree-viewport {max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;border:1px solid #dce4f3;border-radius:12px;background:#fff;}
.flow-tree-viewport:focus-visible {outline:3px solid #6c83cd;outline-offset:2px;}
.flow-tree-image {display:block;width:100%;max-width:none;height:auto;}
.guide-content .flow-tree-hint {margin:0 0 10px;color:#61718c;font-size:12px;line-height:1.45;}
.flow-tree-legend {display:flex;gap:6px 18px;flex-wrap:wrap;margin:12px 0 0;padding:0;list-style:none;color:#465569;font-size:12px;font-weight:600;}
.flow-tree-legend li {display:flex;align-items:center;gap:7px;}
.flow-tree-legend li::before {content:"";flex:none;width:22px;height:12px;border-radius:7px;box-sizing:border-box;}
.flow-legend-button::before {border:1.5px solid #2A3BA8;background:#fff;}
.flow-legend-auto::before {border:1.5px solid #5F6B78;background:#F1F3F5;}
.flow-legend-back::before {height:0!important;border-radius:0!important;border-top:2px dashed #B65A0B;}
.flow-legend-linked::before {border:1.5px dashed #6E3FB0;background:#F3EDFB;border-radius:3px!important;}
.flow-legend-end::before {background:linear-gradient(90deg,#E3F4EA 50%,#FDECEA 50%);border:1.5px solid #8a949f;}
.guide-content .flow-map-result {position:relative;z-index:1;max-width:640px;margin:6px 0 0;color:#375a7b;font-size:13px;line-height:1.5;}
.flow-map-steps {margin:10px 0 0;padding-left:18px;}
.flow-map-steps > li {margin:0 0 8px;}
.flow-map-steps ul {margin:4px 0 0;padding-left:18px;}
.flow-map-text {margin-top:14px;color:var(--muted);font-size:13px;}
.flow-map-text summary {cursor:pointer;font-weight:650;color:var(--accent);}
.guide-flow-open {margin-top:14px;}
.guide-content figcaption {font-size:12px;color:var(--muted);margin-top:8px;line-height:1.5;}
.guide-table-wrap {overflow-x:auto;}
.guide-table {border-collapse:collapse;width:100%;font-size:12px;}
.guide-table th,.guide-table td {padding:12px 10px;text-align:left;vertical-align:top;border-bottom:1px solid var(--line);overflow-wrap:anywhere;}
.guide-table th:first-child,.guide-table td:first-child {width:34%;}
.guide-table th {background:var(--surface-2);}
.guide-table p {margin:0 0 6px;}
.guide-field-timing {font-size:11px;color:var(--muted);margin-top:6px;}
.guide-field-example {color:var(--accent);line-height:1.5;}
.guide-options {margin-top:8px;}
.guide-options summary {cursor:pointer;color:var(--muted);}
.guide-page [hidden] {display:none!important;}
@media (max-width:1100px) {
  .guide-layout {grid-template-columns:1fr;gap:12px;}
  .guide-contents {position:static;max-height:none;overflow:visible;}
  .guide-links {grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media (max-width:600px) {
  .guide-content .panel-b {padding:16px;}
  .guide-intro h2 {font-size:23px;}
  .guide-links {grid-template-columns:1fr;gap:0;}
  .guide-table th,.guide-table td {padding:10px 6px;}
  .guide-table th:first-child,.guide-table td:first-child {width:37%;}
  .flow-map-head {padding:24px 20px;}
  .flow-map-title {font-size:22px;}
  .flow-map-body {padding:22px 14px 24px;}
}
@media print {
  .guide-contents,.guide-pdf,.guide-content a.btn {display:none!important;}
  .guide-layout,.guide-content {display:block;}
  .guide-page,.guide-intro,.guide-section,.guide-general {max-width:none!important;}
  .guide-flow-page {page:flow;break-before:page;break-after:page;}
  .guide-flow,.flow-map {break-inside:avoid;}
  .flow-map {overflow:visible;}
  .flow-map-head {break-inside:avoid;break-after:avoid;}
  .flow-tree-toolbar,.flow-tree-hint,.flow-map-text,.guide-flow-open {display:none!important;}
  .flow-tree-viewport {overflow:visible;border:0;}
  .flow-tree-image {width:100%!important;max-width:var(--flow-print-width,100%);height:auto;margin:auto;}
  .guide-content h2,.guide-content h3,.guide-content h4,.guide-content dt {break-after:avoid;}
  .guide-table tr {break-inside:avoid;}
}

/* The active dataset is visible independently of the sidebar's expanded state. */
.data-mode-badge { display:inline-block; font-size:11px; padding:2px 7px; border:1px solid var(--line); border-radius:5px; color:var(--muted); }
.data-mode-badge.is-demo { color:#8d4c00; background:#fff0cb; border-color:#e5b65c; font-weight:700; }
.data-mode-summary { margin:18px 0; }
.data-mode-stale { position:fixed; z-index:10000; left:50%; top:18%; transform:translateX(-50%); width:min(520px,calc(100vw - 32px)); padding:24px; background:var(--panel,#fff); color:var(--ink,#222); border:2px solid var(--accent,#3857b2); border-radius:12px; box-shadow:0 8px 60px #0005; }
.impersonation-head { position:sticky; top:0; z-index:60; }
.impersonation-head .top { position:static; }
.impersonation-banner { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:8px 16px; background:#ffefba; color:#3d2b00; border-bottom:1px solid #cfae49; }
.impersonation-banner .btn { color:#3d2b00; background:#fff7dc; border-color:#a98119; flex:none; }
@media(max-width:600px) { .impersonation-banner { flex-wrap:wrap; font-size:13px; } }

/* Interactive reconciliation of employees from the organisation chart. */
.structure-matches { margin-bottom: 16px; }
.structure-matches .panel-b { display: block; }
.structure-match-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.structure-match-actions { display: flex; flex-wrap: wrap; gap: 6px; }
/* 0.1.73: a blocked namesake is named in the dialog of the matching. */
.structure-match-blocked { display: block; color: var(--ink); background: var(--warn-soft); border-left: 3px solid var(--warn); padding: 8px 10px; border-radius: 6px; margin-top: 6px; }
@media (max-width: 600px) { .structure-match-row { align-items: flex-start; flex-direction: column; } }

.structure-match-similar[hidden], .structure-match-replace[hidden] { display:none; }
.structure-match-similar { flex-direction:column; align-items:flex-start; }

/* Contracts coloured by document type: a stripe on the left and a light fill (0.1.45) and a
   label with the type in the same colour (0.1.46); «Другое» is white. */
/* The stripe is its own element over the left border: a box-shadow list with the themes'
   `--shadow: none` is invalid and drew nothing on the board in themes A and B. */
.kcard.doc { position: relative; background: color-mix(in srgb, var(--doc) 12%, var(--surface)); border-color: color-mix(in srgb, var(--doc) 45%, var(--line)); padding-left: 14px; }
.kcard.doc::before { content: ''; position: absolute; left: -1px; top: -1px; bottom: -1px; width: 4px; background: var(--doc); border-radius: var(--radius-s) 0 0 var(--radius-s); pointer-events: none; }
.kcard.doc:hover { border-color: var(--accent); }
.kcard.doc-plain { border-color: var(--line); }
.kcard.doc-plain::before { box-shadow: inset 1px 0 0 var(--line); }
.doc-chip { display: inline-block; max-width: 100%; vertical-align: middle; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 17px;
  color: #fff; background: color-mix(in srgb, var(--doc, var(--muted)) 88%, #000); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-plain .doc-chip { color: #1d2433; background: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, #1d2433 25%, transparent); }
.kcard .doc-chip { margin-top: 5px; }
tr.doc .doc-chip { display: block; width: fit-content; margin-top: 4px; }
tr.doc > td { background: color-mix(in srgb, var(--doc) 10%, transparent); }
tr.doc > td:first-child { box-shadow: inset 4px 0 0 var(--doc); }
/* Client passport directory (0.1.45): sort by a heading, filter under it. */
.passport-directory th .sort-head { all: unset; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; white-space: nowrap; }
.passport-directory th .sort-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
.passport-directory th[aria-sort="ascending"], .passport-directory th[aria-sort="descending"] { color: var(--ink); }
.passport-directory .passport-filter-row th { padding: 4px 6px 8px; text-transform: none; letter-spacing: 0; font-family: var(--font); }
.passport-directory .passport-filter-row .input { width: 100%; min-width: 70px; height: 28px; padding: 2px 6px; font-size: 12.5px; box-sizing: border-box; }
.passport-directory th.num, .passport-directory td.num { text-align: right; }
.passport-directory td:first-child { min-width: 220px; }
.passport-directory td.mono { white-space: nowrap; }
.changes { display: grid; gap: 12px; max-width: 920px; }
.change.current { border-color: var(--accent); }
.change-items { margin: 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.45; }
/* Files dragged from the computer onto an upload area (0.1.48). */
.file-drop { border-radius: var(--radius-s); transition: background-color .12s, outline-color .12s; }
.file-field { border: 1px dashed var(--line-2); border-radius: var(--radius-s); padding: 8px 10px; background: var(--surface); }
.file-field > .files:empty { display: none; }
.file-field-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file-field > .files:not(:empty) + .file-field-row { margin-top: 6px; }
.file-drop.drop-over { outline: 2px dashed var(--accent); outline-offset: 4px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.modal.file-drop.drop-over { outline-offset: -6px; }
@media (hover: none) { .drop-hint { display: none; } }
/* A yes/no field: the checkbox with the field's name beside it. */
.check-line { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; color: var(--ink); }
.check-line input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

/* A slider between two values: «без НДС ⟷ с НДС» in the KP task (0.1.63). Both sides are
   values, not on and off, so the track keeps its colour and the chosen word is marked. */
.switch-line { display: inline-flex; align-items: center; gap: 10px; justify-self: start; font-size: 13.5px; user-select: none; }
.field > .input + .switch-line { margin-top: 3px; }
.switch-side { color: var(--muted); cursor: pointer; }
.switch-side.on { color: var(--ink); font-weight: 600; }
.switch { position: relative; display: inline-block; flex: none; width: 42px; height: 24px; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { position: absolute; inset: 0; border-radius: 999px; background: var(--accent); pointer-events: none; }
.switch-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* «Создать карточку клиента» under the client of «Создайте карточку клиента» (0.1.64). */
.field > .create-client { justify-self: start; margin-top: 4px; }
/* The KP of a request (0.1.64): «Актуальное» before the name, earlier versions quieter. */
.file .pill.actual { padding: 2px 5px; margin-right: 6px; font-size: 10px; vertical-align: 1px; }
.file.earlier { opacity: .72; }
.file.earlier:hover { opacity: 1; }
