:root {
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-alt: #EEF2F6;
  --surface-sunken: #E7ECF1;
  --border: #DCE3EA;
  --border-strong: #C4CEDA;
  --text: #1A2433;
  --text-muted: #5C6B7A;
  --text-faint: #8B98A6;
  --accent: #1E6E77;
  --accent-strong: #15525A;
  --accent-soft: #DCEEEF;
  --accent-contrast: #FFFFFF;
  --ok: #2E7D4F;
  --ok-bg: #E4F3E9;
  --neutral-stat: #3E5C8A;
  --neutral-stat-bg: #E7ECF5;
  --warn: #A66A2E;
  --warn-bg: #FBF0DD;
  --crit: #B23B3B;
  --crit-bg: #FBE6E6;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 8px 24px -12px rgba(20, 30, 45, 0.18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 25, 40, 0.35);
  --radius: 10px;
  --radius-sm: 7px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10161D; --surface: #171F28; --surface-alt: #1E2733; --surface-sunken: #131920;
    --border: #2A3542; --border-strong: #38465569;
    --text: #E6ECF2; --text-muted: #9FAEBD; --text-faint: #6B7A89;
    --accent: #56BDB7; --accent-strong: #7ED0CB; --accent-soft: #1C3838; --accent-contrast: #0B1512;
    --ok: #55BE85; --ok-bg: #17301F;
    --neutral-stat: #86A6DA; --neutral-stat-bg: #1B2740;
    --warn: #E0A73E; --warn-bg: #332711;
    --crit: #E2827B; --crit-bg: #37201E;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
    --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10161D; --surface: #171F28; --surface-alt: #1E2733; --surface-sunken: #131920;
  --border: #2A3542; --border-strong: #38465569;
  --text: #E6ECF2; --text-muted: #9FAEBD; --text-faint: #6B7A89;
  --accent: #56BDB7; --accent-strong: #7ED0CB; --accent-soft: #1C3838; --accent-contrast: #0B1512;
  --ok: #55BE85; --ok-bg: #17301F;
  --neutral-stat: #86A6DA; --neutral-stat-bg: #1B2740;
  --warn: #E0A73E; --warn-bg: #332711;
  --crit: #E2827B; --crit-bg: #37201E;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .display {
  font-family: "Manrope", "Segoe UI", system-ui, sans-serif; font-weight: 700;
  text-wrap: balance; margin: 0; color: var(--text);
}
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
button { font-family: inherit; }
::selection { background: var(--accent-soft); }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- Login ---------- */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(circle at 20% 15%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 32px 30px; box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 42px; height: 42px; border-radius: 11px; background: linear-gradient(155deg, var(--accent), var(--accent-strong)); display: flex; align-items: center; justify-content: center; color: var(--accent-contrast); font-family: "Manrope"; font-weight: 800; font-size: 17px; }
.login-brand strong { font-family: "Manrope"; font-size: 18px; font-weight: 800; display: block; }
.login-brand span { font-size: 12.5px; color: var(--text-faint); }
.login-card h1 { font-size: 16px; margin-bottom: 4px; }
.login-card .sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.login-error {
  display: none; background: var(--crit-bg); color: var(--crit); border-radius: var(--radius-sm);
  padding: 9px 12px; font-size: 13px; margin-bottom: 14px;
}
.login-error.show { display: block; }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--text-faint); line-height: 1.6; border-top: 1px solid var(--border); padding-top: 14px; }
.login-hint code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px; }

/* ---------- App shell ---------- */
.app { display: none; grid-template-columns: 236px 1fr; min-height: 100vh; }
.app.visible { display: grid; }

.sidebar { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(155deg, var(--accent), var(--accent-strong)); display: flex; align-items: center; justify-content: center; color: var(--accent-contrast); font-family: "Manrope"; font-weight: 800; font-size: 15px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: "Manrope"; font-size: 15.5px; font-weight: 800; }
.brand-text span { font-size: 11.5px; color: var(--text-faint); letter-spacing: .02em; }

nav.mainnav { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; }
.navgroup-items { display: flex; flex-direction: column; gap: 2px; }
.navgroup + .navgroup { border-top: 1px solid var(--border); padding-top: 6px; }
.navgroup-head { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 0; cursor: pointer; font: inherit; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); padding: 6px 10px 4px; border-radius: var(--radius-sm); text-align: left; }
.navgroup-head:hover { color: var(--text-muted); }
.navgroup-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.navgroup-head .chev { width: 14px; height: 14px; margin-left: auto; transition: transform .15s ease; }
.navgroup.collapsed .navgroup-head .chev { transform: rotate(-90deg); }
.navgroup.collapsed .navgroup-items { display: none; }
.navgroup-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--crit); display: none; }
.navgroup.collapsed.has-alert .navgroup-dot { display: inline-block; }
.mainnav.solo .navgroup-head { display: none; }
.mainnav.solo .navgroup { border-top: 0; padding-top: 0; }
.navlink { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none; cursor: pointer; border: 1px solid transparent; background: none; font-size: 14px; text-align: left; width: 100%; }
.navlink svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.navlink:hover { background: var(--surface-alt); color: var(--text); }
.navlink.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.navlink .count { margin-left: auto; font-size: 11.5px; color: var(--text-faint); background: var(--surface-sunken); padding: 1px 7px; border-radius: 20px; font-family: "JetBrains Mono"; }
.navlink.active .count { color: var(--accent-strong); background: var(--surface); }

.sidebar-foot { margin-top: auto; padding: 10px 4px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.foot-actions { display: flex; gap: 6px; }
.foot-actions .btn { flex: 1; justify-content: center; padding-left: 6px; padding-right: 6px; }
.foot-actions #btn-logout { flex: 0 0 auto; }
.who { display: flex; align-items: center; gap: 9px; }
.who .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-sunken); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.who .who-text { line-height: 1.25; min-width: 0; }
.who .who-text strong { font-size: 13px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .who-text span { font-size: 11px; color: var(--text-faint); }
.theme-toggle { display: flex; gap: 4px; background: var(--surface-alt); border-radius: 20px; padding: 3px; }
.theme-toggle button { flex: 1; border: none; background: none; padding: 5px 0; border-radius: 16px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.theme-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.data-note { font-size: 11px; color: var(--text-faint); padding: 0 2px; line-height: 1.45; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 26px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar h1 { font-size: 19px; }
.topbar .subtitle { font-size: 12.5px; color: var(--text-faint); margin-top: 1px; }
.search-box { margin-left: auto; position: relative; width: 300px; max-width: 34vw; }
.search-box input { width: 100%; padding: 8px 12px 8px 34px; border-radius: 20px; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text); font-size: 13.5px; }
.search-box input:focus { background: var(--surface); }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.topbar .btn.logout-btn { flex-shrink: 0; }

.view { display: none; padding: 24px 26px 60px; flex: 1; }
.view.active { display: block; }

.btn { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; padding: 8px 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: nowrap; }
.btn:hover { background: var(--surface-alt); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.loading { opacity: .8; cursor: wait; }
.btn.loading::before { content: ""; width: 13px; height: 13px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btn-spin .6s linear infinite; flex-shrink: 0; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-alt); }
.btn.danger { color: var(--crit); }
.btn.danger:hover { background: var(--crit-bg); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn svg { width: 15px; height: 15px; }
/* "Тільки мої" toggle buttons on onboarding/dismissals — pressed state reuses
   the accent-soft treatment active nav links already use, so it reads as
   "on" at a glance next to the plain filter dropdowns beside it. */
.btn.toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); color: var(--accent-strong); }
.icon-btn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-muted); }
.icon-btn:hover { background: var(--surface-alt); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.stat-card .stat-label { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.stat-card .stat-value { font-family: "Manrope"; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-faint); }
.stat-card.attn .stat-value { color: var(--warn); }

.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.panel h2 { font-size: 14.5px; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }
.panel h2 .btn { font-size: 12px; padding: 5px 10px; }

.activity-row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 13px; }
.activity-row:first-of-type { border-top: none; }
.activity-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; background: var(--accent); }
.activity-row .when { color: var(--text-faint); font-size: 11.5px; white-space: nowrap; margin-left: auto; padding-left: 8px; }

.attn-row { cursor: pointer; border-radius: var(--radius-sm); margin: 0 -8px; padding: 9px 8px; }
.attn-row:hover { background: var(--surface-alt); }
.attn-row:first-of-type { border-top: none; }
.attn-row .attn-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.attn-row .attn-text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-row .attn-text span { font-size: 11.5px; color: var(--text-faint); }
.attn-row .activity-dot.warn { background: var(--warn); }
.attn-row .activity-dot.neutral { background: var(--neutral-stat); }
.attn-row .activity-dot.crit { background: var(--crit); }

.status-bar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; margin: 6px 0 12px; background: var(--surface-sunken); }
.status-bar span { height: 100%; }
.status-legend { display: flex; flex-direction: column; gap: 7px; }
.status-legend .row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted); }
.status-legend .swatch { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.status-legend .n { margin-left: auto; font-family: "JetBrains Mono"; color: var(--text); }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .filter-input { padding: 7px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; min-width: 0; }
.toolbar .search-inline { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.toolbar .search-inline svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-faint); }
.toolbar .search-inline input { width: 100%; padding-left: 30px; }
.toolbar .spacer { flex: 1; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.neutral { background: var(--neutral-stat-bg); color: var(--neutral-stat); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.crit { background: var(--crit-bg); color: var(--crit); }

/* "N днів" chip next to a "Нова" status pill — see agingBadgeHtml() in
   app.js. Muted by default, turns crit-colored once a request has gone
   unhandled for OVERDUE_DAYS or more. */
.aging-tag { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--text-faint); }
.aging-tag.overdue { color: var(--crit); font-weight: 700; }

.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; margin-top: 6px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.status-row-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }

.form-card { background: var(--surface-alt); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; }
.form-card .form-section-title { margin: 0; }

.kadry-card { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.kadry-card .form-section-title { color: var(--accent-strong); }
.kadry-card .detail-grid { font-size: 13px; }
.kadry-card .status-row { background: var(--surface); }

.kb-layout { display: grid; grid-template-columns: 210px 1fr; gap: 18px; align-items: start; }
.cat-list { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.cat-item { display: flex; justify-content: space-between; gap: 6px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; color: var(--text-muted); background: none; border: none; text-align: left; width: 100%; }
.cat-item:hover { background: var(--surface-alt); color: var(--text); }
.cat-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.cat-item .n { color: var(--text-faint); font-family: "JetBrains Mono"; font-size: 11.5px; }
.cat-item.active .n { color: var(--accent-strong); }

.article-list { display: flex; flex-direction: column; gap: 10px; }
.article-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.article-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.article-card .title { font-family: "Manrope"; font-weight: 700; font-size: 15px; }
.article-card .meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--text-faint); }
.article-card .snippet { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tag { background: var(--surface-sunken); color: var(--text-muted); border-radius: 20px; padding: 2px 9px; font-size: 11.5px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-faint); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty-state svg { width: 30px; height: 30px; margin-bottom: 10px; opacity: .6; }
.empty-state p { font-size: 13.5px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); flex-shrink: 0; }
/* Small "Показано X з Y" counter under a list/table, shown only once a
   filter has actually narrowed the results — see renderEquipment/renderKB. */
.list-count { font-size: 12px; color: var(--text-faint); padding: 8px 2px 0; text-align: right; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
/* A table nested inside a modal (e.g. the equipment list on an employee's
   card) has no room for the 640px list tables assume — that min-width just
   pushed the last column past the modal edge. */
.nested-table table { min-width: 0; }
thead th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--surface-alt); position: sticky; top: 0; }
/* Clickable column headers — equipment & employees tables. The arrow only
   shows on the active sort column; see bindSortableHeaders()/updateSortHeaders()
   in app.js. */
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); }
thead th.sortable::after { content: ""; display: inline-block; width: 8px; margin-left: 3px; font-size: 9px; vertical-align: middle; }
thead th.sortable.sort-asc::after { content: "▲"; color: var(--accent); }
thead th.sortable.sort-desc::after { content: "▼"; color: var(--accent); }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-alt); }
td.actions { white-space: nowrap; text-align: right; }
td.actions > * + * { margin-left: 5px; }
.cell-muted { color: var(--text-faint); }
.file-name { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.file-ext-badge { width: 30px; height: 30px; border-radius: 7px; background: var(--surface-sunken); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; font-family: "JetBrains Mono"; flex-shrink: 0; }
tbody tr.clickable { cursor: pointer; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(10,16,24,.5); display: none; align-items: flex-start; justify-content: center; padding: 6vh 20px; z-index: 50; overflow-y: auto; backdrop-filter: blur(2px); }
.modal-backdrop.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; border: 1px solid var(--border); }
.modal.small { max-width: 400px; }
.modal.wide { max-width: 640px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16.5px; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.field .hint { font-size: 11.5px; color: var(--text-faint); font-weight: 400; }
.field input, .field select, .field textarea { padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit; width: 100%; }
.field textarea { resize: vertical; min-height: 100px; line-height: 1.55; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-error { font-size: 12px; color: var(--crit); display: none; }
.field-error.show { display: block; }

.form-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 4px 0 -4px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text); cursor: pointer; }
.check-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
/* Sub-category label inside a long check-grid (e.g. the onboarding checklist's
   "Облікові записи" / "Доступи до систем" groups) — spans both columns. */
.check-subhead { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); margin-top: 6px; }
.check-subhead:first-child { margin-top: 0; }

.detail-grid { display: grid; grid-template-columns: 132px 1fr; gap: 9px 14px; font-size: 13.5px; }
.detail-grid dt { color: var(--text-muted); margin: 0; }
.detail-grid dd { margin: 0; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--accent-soft); color: var(--accent-strong); border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 600; }

.reader-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 4px; }
.reader-body { white-space: pre-wrap; line-height: 1.7; font-size: 14.5px; color: var(--text); max-width: 68ch; margin-top: 16px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; cursor: pointer; background: none; border: none; padding: 0 0 14px; }
.back-link:hover { color: var(--accent); }
.back-link svg { width: 15px; height: 15px; }
.linked-files { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.linked-file-row { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; }

#toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; opacity: 0; transform: translateY(6px); animation: toast-in .2s ease-out forwards; }
.toast.error { background: var(--crit); color: #fff; }
@keyframes toast-in { to { opacity: 1; transform: translateY(0); } }

.role-badge { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 7px; border-radius: 10px; }
.role-badge.admin { background: var(--accent-soft); color: var(--accent-strong); }
.role-badge.agent { background: var(--surface-sunken); color: var(--text-muted); }
.role-badge.hr { background: var(--warn-bg); color: var(--warn); }
.role-badge.kadry { background: var(--ok-bg); color: var(--ok); }
.role-badge.manager { background: var(--neutral-stat-bg); color: var(--neutral-stat); }

@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; overflow-x: auto; align-items: center; padding: 10px 14px; position: static; height: auto; }
  .sidebar-foot, .navgroup-head { display: none !important; }
  nav.mainnav { flex-direction: row; overflow: visible; margin: 0; padding: 0; }
  .navgroup, .navgroup-items, .navgroup.collapsed .navgroup-items { display: contents; }
  .navgroup + .navgroup { border-top: 0; padding-top: 0; }
  .navlink { white-space: nowrap; width: auto; flex-shrink: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid, .kb-layout, .field-row, .check-grid, .detail-grid { grid-template-columns: 1fr; }
  .search-box { width: 160px; }
}

/* Пагінація таблиць */
.pager { align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 2px 0; font-size: 12.5px; color: var(--text-muted); }
.pager-info { margin-right: auto; }
.pager-pages { display: inline-flex; gap: 4px; align-items: center; }
.pager-pages .btn { min-width: 32px; justify-content: center; }
.pager-pages .btn.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.pager-gap { padding: 0 4px; color: var(--text-faint); }
.pager-size select { margin-left: 4px; padding: 4px 6px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12.5px; }

/* Історія змін у картках */
.history-block { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 10px; }
.history-block summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--text-muted); padding: 4px 0; user-select: none; }
.history-block summary:hover { color: var(--text); }
.history-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; max-height: 320px; overflow-y: auto; }
.history-entry { border-left: 2px solid var(--accent-soft); padding: 2px 0 2px 12px; font-size: 13px; }
.history-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.history-meta { margin-left: auto; color: var(--text-faint); font-size: 12px; white-space: nowrap; }
.history-badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--neutral-stat-bg); color: var(--neutral-stat); }
.history-changes { margin: 4px 0 0; padding-left: 16px; color: var(--text-muted); }
.history-changes li { margin: 2px 0; white-space: pre-wrap; word-break: break-word; }
.history-label { color: var(--text); font-weight: 600; }
.history-old { text-decoration: line-through; color: var(--text-faint); }
.history-new { color: var(--text); }
.history-empty { color: var(--text-faint); font-size: 13px; }
.history-empty.error { color: var(--crit); }

/* Редактор статей і HTML-вміст статті */
.modal.editor-modal { max-width: 920px; }
.editor-modal .tox-tinymce { border-radius: var(--radius-sm); border-color: var(--border); }
.reader-body.rich { white-space: normal; max-width: 80ch; }
.reader-body.rich > :first-child { margin-top: 0; }
.reader-body.rich p { margin: 0 0 .8em; }
.reader-body.rich h2, .reader-body.rich h3, .reader-body.rich h4 { margin: 1.3em 0 .5em; line-height: 1.3; }
.reader-body.rich h2 { font-size: 19px; } .reader-body.rich h3 { font-size: 17px; } .reader-body.rich h4 { font-size: 15px; }
.reader-body.rich ul, .reader-body.rich ol { margin: 0 0 .9em; padding-left: 1.6em; }
.reader-body.rich li { margin: .2em 0; }
.reader-body.rich a { color: var(--accent); }
.reader-body.rich img { max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); margin: .4em 0; }
.reader-body.rich blockquote { margin: 0 0 .9em; padding: .4em 1em; border-left: 3px solid var(--accent-soft); color: var(--text-muted); }
.reader-body.rich pre { background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; overflow-x: auto; font-family: "JetBrains Mono", monospace; font-size: 13px; line-height: 1.5; white-space: pre; }
.reader-body.rich code { font-family: "JetBrains Mono", monospace; font-size: .92em; }
.reader-body.rich :not(pre) > code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px; }
.reader-body.rich table { border-collapse: collapse; margin: 0 0 1em; font-size: 14px; max-width: 100%; display: block; overflow-x: auto; }
.reader-body.rich th, .reader-body.rich td { border: 1px solid var(--border-strong); padding: 6px 9px; vertical-align: top; }
.reader-body.rich th { background: var(--surface-alt); }
.reader-body.rich hr { border: none; border-top: 1px solid var(--border); margin: 1.2em 0; }

/* ---------- Пошук по всій CRM (Ctrl+K) ---------- */
.search-results { position: absolute; top: calc(100% + 6px); right: 0; width: min(440px, 90vw); max-height: 70vh; overflow-y: auto; z-index: 40;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; }
.sr-group { display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-faint); padding: 8px 8px 4px; }
.sr-more { border: none; background: none; color: var(--accent); font: inherit; text-transform: none; letter-spacing: 0; cursor: pointer; }
.sr-item { padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.sr-item.active { background: var(--accent-soft); }
.sr-cmd .sr-title::before { content: "›"; color: var(--accent); font-weight: 700; margin-right: 7px; }
.sr-hint { font-size: 12px; color: var(--text-faint); padding: 8px 10px 4px; border-top: 1px solid var(--border); margin-top: 4px; }
.sr-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sr-sub { font-size: 12px; color: var(--text-muted); }
.sr-empty { padding: 12px; font-size: 13px; color: var(--text-faint); }

/* ---------- Сповіщення ---------- */
.notif-wrap { position: relative; flex-shrink: 0; }
.notif-btn { position: relative; width: 36px; height: 36px; }
.notif-btn svg { width: 18px; height: 18px; }
.notif-badge { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--crit); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center; }
.notif-panel { position: absolute; top: calc(100% + 6px); right: 0; width: min(360px, 92vw); z-index: 40; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.notif-head { padding: 10px 14px; font-weight: 700; font-size: 13.5px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--border); background: none; padding: 10px 14px; cursor: pointer; color: var(--text); font: inherit; }
.notif-item:hover { background: var(--surface-alt); }
.notif-item.unread { background: var(--accent-soft); }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-text { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.notif-meta { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }
.notif-empty { padding: 18px 14px; font-size: 13px; color: var(--text-faint); }

/* ---------- Заявки: швидкі дії, прогрес, терміни ---------- */
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.progress-pill { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 10px; background: var(--surface-alt); color: var(--text-muted); margin-left: 6px; text-transform: none; letter-spacing: 0; }
.progress-pill:empty { display: none; }
.progress-pill.complete, .progress-chip.complete { background: var(--ok-bg); color: var(--ok); }
.progress-chip { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 9px; background: var(--surface-alt); color: var(--text-muted); vertical-align: middle; }
.deadline-tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); vertical-align: middle; }
.deadline-tag.overdue { background: var(--crit-bg); color: var(--crit); }
.employee-preview { margin: -4px 0 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.section-with-action { display: flex; align-items: center; gap: 10px; }
.section-with-action .btn { margin-left: auto; text-transform: none; letter-spacing: 0; }
#dr-checklist select { padding: 4px 6px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; }

/* ---------- Техніка: вибір і масові дії ---------- */
.col-check { width: 34px; text-align: center; }
.col-check input { width: 15px; height: 15px; cursor: pointer; }
tr.selected td { background: var(--accent-soft); }
.bulk-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; margin-bottom: 10px; border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: var(--radius); background: var(--accent-soft); font-size: 13px; }
.bulk-bar .filter-input { padding: 6px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; }
.bulk-bar[hidden] { display: none; }

/* ---------- Вибір техніки зі складу ---------- */
.stock-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stock-row { display: grid; grid-template-columns: 22px 110px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13.5px; }
.stock-row:last-child { border-bottom: none; }
.stock-row:hover { background: var(--surface-alt); }
.stock-row.requested { background: color-mix(in srgb, var(--ok-bg) 55%, transparent); }
.stock-name { min-width: 0; }

/* ---------- Довідники ---------- */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.dir-add { display: flex; gap: 8px; margin: 6px 0 12px; }
.dir-add input, .dir-rename-input { flex: 1; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px; }
.dir-row { display: flex; align-items: center; gap: 6px; padding: 5px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.dir-name { flex: 1; min-width: 0; }
.dir-unlisted { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.dir-unlisted-title { flex-basis: 100%; font-size: 12px; color: var(--text-faint); }
.chip-add { border: 1px dashed var(--border-strong); background: none; cursor: pointer; color: var(--text-muted); }
.chip-add:hover { border-color: var(--accent); color: var(--accent); }
#equip-tbody td.mono { white-space: nowrap; }
tr.selected td.actions { background: var(--accent-soft); }

/* Ліцензії */
.lic-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.lic-summary:empty { display: none; }
.lic-summary .stat-chip { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: 12.5px; color: var(--text-muted); }
.lic-summary .stat-chip b { color: var(--text); font-size: 15px; margin-right: 4px; }
.seat-bar { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--surface-alt); vertical-align: middle; margin-left: 8px; overflow: hidden; }
.seat-bar > span { display: block; height: 100%; background: var(--ok); }
.seat-bar.full > span { background: var(--warn); }
.lic-assign-row { display: flex; gap: 8px; margin-bottom: 10px; }
.lic-assign-row input { flex: 1; }
.chip.lic-chip { cursor: pointer; }
.deadline-tag.soon { background: var(--warn-bg); color: var(--warn); }
.deadline-tag.later { background: var(--surface-alt); color: var(--text-muted); font-weight: 600; }

/* Журнал входів */
.login-journal { margin-top: 22px; }
.panel-head-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.panel-head-row h2 { margin-bottom: 0; }
.login-journal .hint { margin-bottom: 10px; }
.login-journal .table-wrap { margin-top: 0; }
.ua-cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Кошик */
.trash-kind { font-size: 11.5px; font-weight: 700; color: var(--text-muted); white-space: nowrap; }
td.trash-actions { white-space: nowrap; text-align: right; }
td.trash-actions .btn { margin-left: 6px; }

/* ---- Перевірка обліку ---- */
.navlink .count.alert { background: var(--crit-bg); color: var(--crit); font-weight: 700; }
#issues-groups { display: grid; gap: 14px; }
.issue-group h2 { justify-content: flex-start; gap: 8px; margin-bottom: 4px; }
.issue-group .hint { margin-bottom: 8px; }
.issue-group.crit { border-left: 3px solid var(--crit); }
.issue-group.warn { border-left: 3px solid var(--warn); }

/* ---- Гарантія і ремонти ---- */
.warranty-state { font-size: 11.5px; font-weight: 600; margin-left: 6px; text-transform: none; letter-spacing: 0; }
.warranty-state.active { color: var(--ok); }
.warranty-state.soon { color: var(--warn); }
.warranty-state.over { color: var(--text-faint); }
.warranty-state.over-crit { color: var(--crit); }
.repairs-sum { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text-faint); }
.repair-form { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 10px 0; background: var(--surface-sunken); display: grid; gap: 10px; }
.repair-form .field { margin: 0; }
.repair-form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
#e-repairs-tbody .actions { white-space: nowrap; }
.repair-when { white-space: nowrap; font-size: 12.5px; }
.repair-when div { color: var(--text-muted); margin-top: 2px; }
#e-repairs-tbody .actions .btn { margin-right: 4px; }

/* ---- Витрати ---- */
:root { --series-equipment: #2a78d6; --series-repairs: #eb6834; --series-licenses: #1baf7a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --series-equipment: #3987e5; --series-repairs: #d95926; --series-licenses: #199e70; }
}
:root[data-theme="dark"] { --series-equipment: #3987e5; --series-repairs: #d95926; --series-licenses: #199e70; }
.s-equipment { background: var(--series-equipment); }
.s-repairs { background: var(--series-repairs); }
.s-licenses { background: var(--series-licenses); }
.s-created { background: var(--series-equipment); }
.s-done { background: var(--series-repairs); }
#costs-body > .panel, .costs-grid { margin-bottom: 16px; }
.costs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .costs-grid { grid-template-columns: 1fr; } }
.costs-chart-panel { position: relative; }
.costs-legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px; }
.costs-legend .item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.costs-chart .plot { position: relative; height: 220px; margin: 8px 0 26px 52px; }
.costs-chart .gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--border); }
.costs-chart .gridline span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.costs-chart .cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--cols, 12), 1fr); gap: 6px; }
.costs-chart .col { position: relative; height: 100%; cursor: default; outline: none; border-radius: 6px; }
.costs-chart .col:hover, .costs-chart .col:focus-visible { background: var(--surface-alt); }
.costs-chart .stack { position: absolute; left: 22%; right: 22%; bottom: 0; top: 0; display: flex; flex-direction: column-reverse; gap: 2px; }
.costs-chart .stack .seg { display: block; width: 100%; min-height: 2px; flex: none; }
.costs-chart .stack .seg:last-child { border-radius: 4px 4px 0 0; }
.costs-chart .peak { position: absolute; left: 50%; transform: translate(-50%, -4px); font-size: 11px; font-weight: 600; color: var(--text-muted); white-space: nowrap; margin-bottom: 2px; }
.costs-chart .mlabel { position: absolute; top: 100%; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--text-muted); padding-top: 6px; }
.costs-tooltip { position: absolute; z-index: 5; min-width: 190px; pointer-events: none; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.costs-tooltip strong { display: block; margin-bottom: 6px; }
.costs-tooltip .row { display: flex; align-items: center; gap: 6px; color: var(--text-muted); padding: 1px 0; }
.costs-tooltip .row b { margin-left: auto; color: var(--text); font-weight: 600; padding-left: 12px; }
.costs-tooltip .row.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 5px; color: var(--text); }
.costs-table-toggle summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.total-row td { border-top: 2px solid var(--border-strong); font-weight: 600; }

/* ---- Статистика заявок ---- */
.costs-chart .pair { position: absolute; left: 18%; right: 18%; top: 0; bottom: 0; display: flex; align-items: flex-end; gap: 2px; }
.costs-chart .pair .bar { flex: 1; border-radius: 4px 4px 0 0; min-height: 0; }
.stat-chip.crit b { color: var(--crit); }

/* ---- План заміни ---- */
.lc-buckets { margin-bottom: 16px; }
.lc-chip { cursor: pointer; font: inherit; text-align: left; }
.lc-chip:hover { border-color: var(--border-strong); }
.lc-buckets .lc-chip.active { border-color: var(--accent, var(--text)); box-shadow: 0 0 0 1px var(--accent, var(--text)) inset; }
.lc-buckets .lc-chip.crit b { color: var(--crit); }
.lc-budget-year { padding: 4px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.lc-budget-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13.5px; }
.lc-budget-head b { font-size: 18px; white-space: nowrap; }
.lc-budget-table { width: 100%; margin-top: 6px; font-size: 13px; }
.lc-budget-table td { padding: 3px 0; border: 0; }
.lc-years { white-space: nowrap; }
.lc-years input { width: 64px; padding: 5px 8px; }
#view-lifecycle .toolbar { margin-top: 4px; }
.costs-grid > * { min-width: 0; }
#lc-tbody .mono { white-space: nowrap; }

/* Коментарі в заявках */
.comments-block { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 10px; }
.comments-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; margin: 6px 0 10px; }
.comment { background: var(--surface-alt); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
.comment.mine { background: var(--accent-soft); }
.comment-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.comment-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; line-height: 1.45; }
.comment-del { border: 0; background: none; color: var(--text-faint); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.comment-del:hover { color: var(--crit); }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; resize: vertical; min-height: 42px; padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; line-height: 1.45; }
#emp-d-equip-tbody .mono { white-space: nowrap; }

/* Підписані акти в картці співробітника */
.act-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--border); font-size: 13px; }
.act-row:last-child { border-bottom: 0; }
.act-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.act-main .cell-muted { font-size: 12px; overflow-wrap: anywhere; }
.act-noscan { font-size: 12px; white-space: nowrap; }

/* Збережені фільтри */
.saved-filters { position: relative; }
.sf-btn .chev { width: 13px; height: 13px; }
.sf-btn .sf-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-btn.active-filter { border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-strong); background: var(--accent-soft); }
.sf-menu[hidden] { display: none; }
.sf-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; min-width: 260px; max-width: 340px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg, var(--shadow)); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.sf-item { display: flex; align-items: center; border-radius: 6px; }
.sf-item:hover, .sf-item.current { background: var(--surface-alt); }
.sf-item.current .sf-apply { font-weight: 600; color: var(--accent-strong); }
.sf-apply, .sf-action { flex: 1; text-align: left; background: none; border: 0; padding: 7px 9px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; border-radius: 6px; }
.sf-action:hover:not(:disabled) { background: var(--surface-alt); }
.sf-action:disabled { color: var(--text-faint); cursor: default; }
.sf-del { background: none; border: 0; color: var(--text-faint); font-size: 16px; padding: 4px 9px; cursor: pointer; }
.sf-del:hover { color: var(--crit); }
.sf-empty { font-size: 12.5px; color: var(--text-muted); padding: 6px 9px; line-height: 1.45; }
.sf-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.sf-save-form { display: flex; gap: 6px; padding: 4px; }
.sf-save-form input { flex: 1; min-width: 0; }

/* Нагадування в дзвіночку */
.notif-section { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); padding: 10px 14px 4px; }
.notif-item.reminder { border-left: 3px solid var(--warn); padding-left: 11px; }
.notif-item.reminder.crit { border-left-color: var(--crit); }

/* Журнал доступів у картці співробітника */
.jr-tabs { display: inline-flex; gap: 4px; margin-left: auto; text-transform: none; letter-spacing: 0; }
.chip-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text-muted); border-radius: 20px; padding: 3px 10px; font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; }
.chip-btn b { font-weight: 700; margin-left: 2px; }
.chip-btn.active { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.jr-table td { font-size: 13px; vertical-align: top; }
.jr-table tr.jr-closed td { color: var(--text-muted); }
.jr-table .jr-act { text-align: right; width: 1%; white-space: nowrap; }
.jr-src { font-size: 12px; color: var(--accent-strong); }
div.jr-src { color: var(--text-faint); }
.jr-add { display: flex; gap: 8px; margin: 8px 0 4px; }
.jr-add input { flex: 1; padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; }
.jr-requests { display: flex; flex-direction: column; gap: 4px; }
.jr-request { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); text-decoration: none; color: var(--text); font-size: 13px; }
.jr-request:hover { background: var(--surface-alt); }
.jr-request .pill { margin-left: auto; }

/* Комплекти */
.kit-chip { display: inline-block; font-size: 11px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); border-radius: 10px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
.kit-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.kit-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kit-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.kit-note { font-size: 12.5px; margin-top: 2px; }
.kit-items-list { margin: 6px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.kit-items-list a { color: var(--accent-strong); text-decoration: none; }
.kit-items { display: flex; flex-direction: column; gap: 4px; }
.count-inline { color: var(--text-faint); font-weight: 500; }
#cons-tbody .row-actions { text-align: right; white-space: nowrap; }

/* Імпорт з Excel, масові дії */
.imp-table { max-height: 380px; overflow-y: auto; margin-top: 8px; }
.imp-err { color: var(--crit); font-size: 12.5px; margin-top: 3px; }
.bulk-sep { width: 1px; align-self: stretch; background: var(--border); margin: 0 2px; }

/* ---------- Резервні копії ---------- */
.bk-status { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); margin-bottom: 14px; border-left: 4px solid var(--ok); }
.bk-status strong { font-size: 15px; }
.bk-status span { color: var(--text-muted); font-size: 13px; }
.bk-status.warn { border-left-color: var(--warn); }
.bk-status.crit { border-left-color: var(--crit); background: var(--crit-bg); }
.bk-status.crit strong { color: var(--crit); }
.bk-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.bk-panel { padding: 14px 16px; }
.bk-steps { margin: 6px 0 8px 18px; padding: 0; font-size: 13px; line-height: 1.6; }
.bk-steps code, .bk-panel code { font-size: 12px; background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; }
.bk-log { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; }
.bk-log li { padding: 5px 0; border-bottom: 1px solid var(--border); }
.bk-log li:last-child { border-bottom: 0; }
@media (max-width: 900px) { .bk-bottom { grid-template-columns: 1fr; } }

/* ---------- Локації ---------- */
.loc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.loc-card { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; color: var(--text); font: inherit; display: flex; flex-direction: column; gap: 6px; }
.loc-card:hover { border-color: var(--border-strong); }
.loc-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.loc-card.none strong { color: var(--text-muted); font-style: italic; }
.loc-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.loc-card-head b { font-size: 20px; }
.loc-card-sub { font-size: 12.5px; color: var(--text-muted); }
.loc-cats { display: flex; flex-wrap: wrap; gap: 4px; }
.loc-cats span { font-size: 11.5px; background: var(--surface-alt); border-radius: 999px; padding: 2px 8px; color: var(--text-muted); }
.loc-detail { margin-top: 14px; padding: 14px 16px; }
.field[hidden], .field-row[hidden] { display: none; }

/* ---------- Переведення й відсутність ---------- */
.tr-change { margin-bottom: 12px; }
.tr-change-table { border-collapse: collapse; font-size: 14px; width: auto; background: none; }
.tr-change-table th, .tr-change-table td { border: 0; background: none; text-transform: none; letter-spacing: 0; }
.tr-change-table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 4px 14px 4px 0; font-size: 12.5px; }
.tr-change-table td { padding: 4px 8px 4px 0; }
.tr-change-table .tr-arrow { color: var(--accent); font-weight: 700; }
.abs-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.abs-row:last-child { border-bottom: 0; }
.abs-row .pill { margin-left: 6px; }
.abs-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
#tr-d-presets { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 6px; }

/* ===== Календар ===== */
.cal-toolbar { gap: 8px; flex-wrap: wrap; }
.cal-title { margin: 0 4px; font-size: 18px; min-width: 150px; text-align: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--text-muted); }
.cal-kind { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.cal-kind input { margin: 0; }
.cal-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--k); flex: none; }
.k-start { --k: #2E8B57; } .k-transfer { --k: #3B6FD1; } .k-dismissal { --k: #B23B3B; } .k-absence { --k: #7A8794; }
.k-loan { --k: #C26A12; } .k-license { --k: #7B4FC9; } .k-warranty { --k: #8A6D1E; }
:root[data-theme="dark"] .k-start { --k: #5CC48A; } :root[data-theme="dark"] .k-transfer { --k: #7FA4EC; } :root[data-theme="dark"] .k-dismissal { --k: #E2827B; }
:root[data-theme="dark"] .k-absence { --k: #9AA7B4; } :root[data-theme="dark"] .k-loan { --k: #E39A4E; } :root[data-theme="dark"] .k-license { --k: #B497EE; } :root[data-theme="dark"] .k-warranty { --k: #C9AB5A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .k-start { --k: #5CC48A; } :root:not([data-theme="light"]) .k-transfer { --k: #7FA4EC; } :root:not([data-theme="light"]) .k-dismissal { --k: #E2827B; }
  :root:not([data-theme="light"]) .k-absence { --k: #9AA7B4; } :root:not([data-theme="light"]) .k-loan { --k: #E39A4E; } :root:not([data-theme="light"]) .k-license { --k: #B497EE; } :root:not([data-theme="light"]) .k-warranty { --k: #C9AB5A; }
}
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-wd { background: var(--surface-alt); padding: 6px 8px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.cal-wd.we { color: var(--text-faint); }
.cal-day { background: var(--surface); min-height: 104px; padding: 4px 4px 6px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.cal-day.we { background: color-mix(in srgb, var(--surface) 70%, var(--surface-alt)); }
.cal-day.other { background: var(--surface-sunken); }
.cal-day.other .cal-num { color: var(--text-faint); }
.cal-day.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { align-self: flex-end; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--text-muted); padding: 1px 6px; border-radius: 10px; cursor: pointer; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.cal-ev { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--k); background: color-mix(in srgb, var(--k) 12%, var(--surface)); color: var(--text);
  font: inherit; font-size: 12px; line-height: 1.3; padding: 2px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-ev:hover, .cal-ev:focus-visible { background: color-mix(in srgb, var(--k) 24%, var(--surface)); }
.cal-ev.done { opacity: .6; text-decoration: line-through; }
.cal-more { border: 0; background: none; font: inherit; font-size: 11.5px; color: var(--accent); text-align: left; padding: 0 5px; cursor: pointer; }
.cal-kind-tag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
@media (max-width: 880px) {
  .cal-day { min-height: 64px; }
  .cal-ev { font-size: 0; padding: 0; height: 6px; border-left-width: 0; background: var(--k); }
  .cal-more { font-size: 10.5px; }
}
.btn[hidden] { display: none; }
.asset-chip .cell-muted { font-size: 11.5px; margin-left: 4px; }
.as-holder { display: flex; flex-direction: column; gap: 8px; }
.as-holder[hidden] { display: none; }
#as-holder-section .lic-assign-row input, #as-holder-section .lic-assign-row select { padding: 7px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit; min-width: 0; }
#as-holder-free .lic-assign-row input[type="date"] { flex: 0 0 150px; }
#as-holder-issued .lic-assign-row select { flex: 0 0 auto; }
.k-purchase { --k: #12808A; } :root[data-theme="dark"] .k-purchase { --k: #4FC2C9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .k-purchase { --k: #4FC2C9; } }
.pr-status-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-alt); font-size: 13px; }
.pr-status-row[hidden] { display: none; }
.pr-status-row .spacer { flex: 1; }
.pr-row3 { grid-template-columns: 1fr 1fr 1fr; }
.rc-table input { width: 100%; padding: 6px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; }
.rc-table td:first-child { width: 28px; }
#modal-purchase-receive .check-item[hidden] { display: none; }
.u-deps { max-height: 180px; overflow-y: auto; margin-bottom: 6px; }
.u-deps:empty { display: none; }
