/* ==========================================================================
   Учёт приборов и документации — оформление интерфейса
   Палитра выведена из логотипа: медь #B97D3F, сталь #84A0D0, чёрный #151515.
   Медь — только для акцентов (шильдик, активный пункт меню), не для кнопок:
   иначе её путали бы с жёлтым статусом «скоро истекает».
   ========================================================================== */

:root {
    --steel: #3E6096;
    --steel-ink: #2E4A76;
    --steel-soft: color-mix(in srgb, var(--steel) 12%, transparent);
    --copper: #B97D3F;

    --bg: #F1F3F6;
    --surface: #FFFFFF;
    --surface-2: #F7F8FA;
    --surface-3: #EEF1F5;
    --plate: #FCFCFD;
    --line: #DCE0E6;
    --line-strong: #C3C9D2;
    --ink: #151515;
    --ink-2: #3D454F;
    --muted: #656E7A;

    --ok: #14713F;
    --ok-bg: #E4F2E9;
    --warn: #96560A;
    --warn-bg: #FBEEDC;
    --bad: #A81F17;
    --bad-bg: #FBE7E5;
    --none: #5A6470;
    --none-bg: #ECEFF3;

    --focus: #1F6FEB;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-1: 0 1px 2px rgba(15, 22, 33, .06), 0 1px 1px rgba(15, 22, 33, .04);
    --shadow-2: 0 4px 14px rgba(15, 22, 33, .08);
    --shadow-pop: 0 12px 34px rgba(15, 22, 33, .18), 0 2px 6px rgba(15, 22, 33, .08);
    --header-h: 60px;
    --ease: cubic-bezier(.2, .7, .2, 1);

    --f-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --f-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
    --steel: #8FAAD8;
    --steel-ink: #A9BFE4;
    --copper: #CE9257;

    --bg: #12151A;
    --surface: #1A1E24;
    --surface-2: #212630;
    --surface-3: #262C36;
    --plate: #1E232B;
    --line: #2C323C;
    --line-strong: #3A424E;
    --ink: #E9ECF1;
    --ink-2: #C3CAD4;
    --muted: #96A0AD;

    --ok: #62C08C;
    --ok-bg: #16301F;
    --warn: #E3A75C;
    --warn-bg: #33260F;
    --bad: #F08279;
    --bad-bg: #38191A;
    --none: #98A2AE;
    --none-bg: #262C35;

    --focus: #6EA8FF;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 4px 14px rgba(0, 0, 0, .35);
    --shadow-pop: 0 12px 34px rgba(0, 0, 0, .55), 0 2px 6px rgba(0, 0, 0, .3);
}

/* Главная причина «тёмных» галочек, полей и невидимого значка календаря:
   встроенные элементы браузера следовали тёмной теме Windows, а не теме сайта. */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }
html.theme-anim, html.theme-anim * { transition: background-color .3s, border-color .3s, color .2s !important; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 15px/1.5 var(--f-sans);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
body.nav-locked, body.modal-locked { overflow: hidden; }

img { max-width: 100%; height: auto; display: block; }
a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { flex: 0 0 auto; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--surface); padding: 8px 12px; border-radius: var(--radius); }
.skip:focus { left: 8px; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(2px); } 30%, 50%, 70% { transform: translateX(-4px); } 40%, 60% { transform: translateX(4px); } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--bad) 45%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
@keyframes kenburns { from { transform: scale(1.1); } to { transform: scale(1); } }

.page-enter > * { animation: fadeUp .32s var(--ease) both; }
.page-enter > *:nth-child(2) { animation-delay: .03s; }
.page-enter > *:nth-child(3) { animation-delay: .06s; }
.page-enter > *:nth-child(4) { animation-delay: .09s; }
.page-enter > *:nth-child(n+5) { animation-delay: .12s; }

/* --------------------------------------------------------------- шапка */
.hdr {
    position: sticky; top: 0; z-index: 40;
    height: var(--header-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 12px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.6) blur(10px);
    backdrop-filter: saturate(1.6) blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); flex: 1 1 auto; }
.brand:hover { text-decoration: none; }
.brand img { width: 36px; height: 36px; object-fit: contain; flex: 0 0 auto; transition: transform .3s var(--ease); }
.brand:hover img { transform: rotate(-6deg) scale(1.05); }
.brand-text { min-width: 0; line-height: 1.2; display: flex; flex-direction: column; }
.brand-org { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 760px) { .brand-text { flex-direction: row; align-items: baseline; gap: 8px; } .brand-sub { font-size: 12.5px; } }
@media (max-width: 400px) { .brand-sub { display: none; } }

.hdr-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 8px;
    border: 1px solid transparent; border-radius: var(--radius);
    background: none; color: var(--ink-2);
    font: 600 13px/1 var(--f-sans);
    cursor: pointer;
    transition: background .15s, color .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.icon-btn--sm { min-width: 32px; height: 32px; padding: 0 6px; }
.icon-btn--sm svg { width: 17px; height: 17px; }
.icon-btn--danger:hover { color: var(--bad); background: var(--bad-bg); }
.lang-btn { letter-spacing: .04em; }

/* Солнце/луна: показываем ту иконку, в которую переключит кнопка. */
.i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: block; }

.bell { position: relative; }
.bell .dot {
    position: absolute; top: 4px; right: 4px;
    min-width: 17px; height: 17px; padding: 0 4px;
    border-radius: 9px; background: var(--bad); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
    animation: pulse 2s infinite;
}

/* --------------------------------------------------------------- каркас */
.shell { display: block; }
.main { padding: 16px 12px 110px; min-width: 0; }
.wrap { max-width: 1180px; margin: 0 auto; }
.shell--solo .main { padding-top: 28px; }

.nav {
    position: fixed; inset: 0 auto 0 0;
    width: 280px; max-width: 86vw; z-index: 60;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 12px 10px 24px;
    overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(-102%);
    transition: transform .25s var(--ease);
}
.nav.open { transform: none; box-shadow: var(--shadow-pop); }
.nav-scrim {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(10, 14, 20, .45);
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.nav-scrim.on { opacity: 1; pointer-events: auto; }

.nav-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.nav-user-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.nav-user-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-pos { font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.nav-group {
    margin: 16px 0 4px; padding: 0 10px;
    font-size: 11px; font-weight: 700; color: var(--muted);
    letter-spacing: .06em; text-transform: uppercase;
}
.nav a {
    position: relative;
    display: flex; align-items: center; gap: 11px;
    min-height: 40px; padding: 0 10px; margin: 1px 0;
    border-radius: var(--radius);
    color: var(--ink-2); font-size: 14px;
    transition: background .15s, color .15s, padding .15s;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--steel-soft); color: var(--ink); font-weight: 600; }
.nav a.active::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
    border-radius: 3px; background: var(--copper);
}
.nav a svg { width: 19px; height: 19px; fill: currentColor; opacity: .75; }
.nav a.active svg { opacity: 1; color: var(--steel); }
.nav .count {
    margin-left: auto; min-width: 22px; padding: 0 6px; height: 20px;
    border-radius: 10px; background: var(--bad); color: #fff;
    font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
}

@media (min-width: 1024px) {
    .shell:not(.shell--solo) { display: grid; grid-template-columns: 260px minmax(0, 1fr); }
    .nav {
        position: sticky; top: var(--header-h);
        height: calc(100vh - var(--header-h));
        transform: none; max-width: none; width: auto; box-shadow: none;
    }
    .nav-scrim, .nav-toggle { display: none !important; }
    .main { padding: 24px 28px 64px; }
}

/* --------------------------------------------------------------- типографика */
h1 { font-size: 22px; line-height: 1.25; margin: 0 0 4px; letter-spacing: -.015em; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 10px; }
@media (min-width: 760px) { h1 { font-size: 26px; } }
.section-title { margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }

.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.page-head h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.page-head .sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.mono { font-family: var(--f-mono); font-size: .94em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.req { color: var(--bad); font-weight: 700; }
.lang-tag { display: inline-block; padding: 0 5px; border-radius: 4px; background: var(--surface-3); color: var(--muted); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; vertical-align: 1px; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--steel); }

/* --------------------------------------------------------------- кнопки */
.btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 42px; padding: 0 16px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--ink);
    font: 600 14.5px/1 var(--f-sans);
    cursor: pointer; text-align: center; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .1s, color .15s;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: color-mix(in srgb, var(--line-strong) 70%, var(--ink)); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

.btn--primary { background: var(--steel); border-color: var(--steel); color: #fff; box-shadow: 0 1px 2px color-mix(in srgb, var(--steel) 40%, transparent); }
html[data-theme="dark"] .btn--primary { color: #10141a; }
.btn--primary:hover { background: var(--steel-ink); border-color: var(--steel-ink); box-shadow: 0 4px 14px color-mix(in srgb, var(--steel) 35%, transparent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn--danger { color: var(--bad); }
.btn--danger:hover { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 40%, transparent); color: var(--bad); }
.btn--danger-solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn--danger-solid:hover { background: color-mix(in srgb, var(--bad) 85%, #000); }
html[data-theme="dark"] .btn--danger-solid { color: #1a0d0c; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn--sm svg { width: 16px; height: 16px; }
.btn--lg { min-height: 48px; font-size: 15.5px; }
.btn--icon { padding: 0; width: 34px; }
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row form { margin: 0; }
.btn-row--end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack form { margin: 0; }

/* Кнопка «в работе»: крутилка вместо текста, ширина не прыгает. */
.btn.is-busy { color: transparent !important; pointer-events: none; }
.btn.is-busy svg { opacity: 0; }
.btn.is-busy::after {
    content: ""; position: absolute; left: 50%; top: 50%;
    width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border: 2px solid currentColor; border-radius: 50%;
    border-color: #fff #fff transparent transparent;
    animation: spin .7s linear infinite;
}
.btn:not(.btn--primary):not(.btn--danger-solid).is-busy::after { border-color: var(--steel) var(--steel) transparent transparent; }

.linkbtn {
    border: 0; background: none; padding: 2px 0; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 600; color: var(--steel);
}
.linkbtn:hover { text-decoration: underline; }
.linkbtn[disabled] { opacity: .4; cursor: default; text-decoration: none; }
.linkbtn--muted { color: var(--muted); }

/* --------------------------------------------------------------- формы */
.field { margin-bottom: 16px; min-width: 0; }
.field > label, .label {
    display: block; margin-bottom: 6px;
    font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.field--narrow { max-width: 280px; }
.hint { margin-top: 6px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }

input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]):not([type=color]):not([type=range]),
select, textarea {
    width: 100%; min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--ink);
    /* 16px обязателен: при меньшем размере Safari на iPhone масштабирует страницу. */
    font: 400 16px/1.4 var(--f-sans);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input.mono { font-family: var(--f-mono); font-size: 15px; }
textarea { min-height: 88px; resize: vertical; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
input:hover:not(:focus):not([readonly]):not([disabled]), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--ink)); }
input[readonly], input[disabled], textarea[disabled], select[disabled] { background: var(--surface-2); color: var(--muted); }
select {
    appearance: none; -webkit-appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='none' stroke='%23656E7A' stroke-width='1.7' d='M1 1l5 5 5-5'/></svg>");
    background-repeat: no-repeat; background-position: right 13px center; background-size: 12px;
    padding-right: 36px;
}
html[data-theme="dark"] select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path fill='none' stroke='%2396A0AD' stroke-width='1.7' d='M1 1l5 5 5-5'/></svg>");
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--steel);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--steel) 22%, transparent);
}
input[type=color] { width: 64px; height: 44px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

/* Поле с иконкой слева (поиск, логин, пароль). */
.input-icon { position: relative; }
.input-icon > svg { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; margin-top: -9px; fill: var(--muted); pointer-events: none; transition: fill .15s; }
.input-icon > input { padding-left: 40px !important; }
.input-icon:focus-within > svg { fill: var(--steel); }
.input-icon--noicon > input { padding-left: 12px !important; }
.input-icon--action > input { padding-right: 46px !important; }
.pw-eye {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 36px; border: 0; border-radius: 6px; background: none; cursor: pointer;
    display: grid; place-items: center; color: var(--muted);
}
.pw-eye:hover { background: var(--surface-2); color: var(--ink); }
.pw-eye.on { color: var(--steel); }
.pw-eye svg { width: 20px; height: 20px; fill: currentColor; }
.caps-hint { margin-top: 6px; font-size: 12.5px; color: var(--warn); font-weight: 600; }

.grid-2 { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* Свои галочки — одинаковые в светлой и тёмной теме и во всех браузерах. */
input[type=checkbox] {
    appearance: none; -webkit-appearance: none;
    width: 20px; height: 20px; margin: 0; flex: 0 0 auto;
    border: 1.6px solid var(--line-strong); border-radius: 5px;
    background: var(--surface) no-repeat center / 14px 14px;
    cursor: pointer; display: inline-grid; place-content: center;
    transition: background-color .15s, border-color .15s, transform .1s;
}
input[type=checkbox]:hover:not(:disabled) { border-color: var(--steel); }
input[type=checkbox]:checked {
    background-color: var(--steel); border-color: var(--steel);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/></svg>");
}
html[data-theme="dark"] input[type=checkbox]:checked {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='%2310141a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/></svg>");
}
input[type=checkbox]:active:not(:disabled) { transform: scale(.9); }
input[type=checkbox]:disabled { opacity: .55; cursor: not-allowed; }
input[type=checkbox]:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 0; font-size: 14px; cursor: pointer; }
.check-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.check--card {
    min-height: 44px; padding: 8px 12px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); transition: border-color .15s, background .15s;
}
.check--card:hover { border-color: var(--line-strong); background: var(--surface-2); }
.check--card:has(input:checked) { border-color: color-mix(in srgb, var(--steel) 55%, transparent); background: var(--steel-soft); }
.check--card > span:not(.from-role) { flex: 1 1 auto; line-height: 1.3; }
.from-role { font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--surface-3); border-radius: 4px; padding: 1px 5px; letter-spacing: .02em; }

/* Переключатель. */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; font-weight: 500; min-height: 40px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 40px; height: 23px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background .2s; flex: 0 0 auto; }
.switch-track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .2s var(--ease); }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(17px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .6; }

/* Секции формы. */
.form-card { max-width: 640px; }
.form-card--wide { max-width: 960px; }
.fs { border: 0; margin: 0 0 10px; padding: 0 0 8px; min-width: 0; }
.fs + .fs, .fs + .field { border-top: 1px solid var(--line); padding-top: 18px; }
.fs legend { padding: 0; margin-bottom: 14px; font-size: 15.5px; font-weight: 700; float: left; width: 100%; }
.fs legend + * { clear: both; }
.fs-tools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; justify-content: space-between; margin-bottom: 12px; clear: both; }
.fs-tools .hint { margin: 0; }
.fs-tools--bar { padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.fs-tools-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.counter { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.perm-group { margin-bottom: 14px; }
.perm-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 6px 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.perm-group-head .linkbtn { text-transform: none; letter-spacing: 0; font-size: 12.5px; }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.form-actions--sticky {
    position: sticky; bottom: 0; z-index: 5;
    margin: 8px -16px -16px; padding: 12px 16px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
@media (min-width: 760px) { .form-actions--sticky { margin: 8px -22px -20px; padding: 14px 22px; } }

.alert { padding: 12px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; font-size: 14px; animation: fadeUp .25s var(--ease); }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert--err { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad); }
.alert--err strong { color: var(--bad); }

/* Диапазон + единица в одной строке. */
.combo-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(110px, 42%); gap: 8px; }

/* --------------------------------------------------------------- карточки */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-1);
}
@media (min-width: 760px) { .card { padding: 20px 22px; } }
.card--flush { padding: 0 !important; overflow: hidden; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 13px 16px; border-bottom: 1px solid var(--line);
    font-weight: 650; font-size: 15px;
}
.pill { display: inline-block; min-width: 22px; padding: 0 7px; height: 21px; line-height: 21px; border-radius: 11px; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; vertical-align: 2px; }

.tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 6px;
    background: var(--steel-soft); color: var(--steel-ink);
    font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; line-height: 1.5;
}
html[data-theme="dark"] .tag { color: var(--steel-ink); }
.tag--lg { font-size: 13px; padding: 3px 10px; }
.tag--xs { font-size: 10.5px; padding: 0 5px; }
.tag--ok { background: var(--ok-bg); color: var(--ok); }
.tag--bad { background: var(--bad-bg); color: var(--bad); }
.tag--muted { background: var(--surface-3); color: var(--muted); }

.avatar {
    display: inline-grid; place-items: center; flex: 0 0 auto;
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--steel), color-mix(in srgb, var(--steel) 55%, var(--copper)));
    color: #fff; font-weight: 700; font-size: 15px; text-transform: uppercase;
}
.avatar--sm { width: 32px; height: 32px; font-size: 13px; }
.avatar--xs { width: 24px; height: 24px; font-size: 11px; border: 2px solid var(--surface); margin-left: -6px; }
.avatar--xs:first-child { margin-left: 0; }
.avatar--lg { width: 56px; height: 56px; font-size: 22px; }
.avatars { display: flex; align-items: center; gap: 0; }
.avatars .small { margin-left: 8px; color: var(--ink-2); }
.user-cell { display: flex; align-items: center; gap: 10px; }

/* ---------------------------------------------- поисковый экран мастера */
.hero { padding: 18px 0 10px; }
.hero h1 { font-size: 24px; }
.hero p { margin: 6px 0 18px; color: var(--muted); font-size: 14.5px; }
@media (min-width: 760px) { .hero { padding: 36px 0 18px; } .hero h1 { font-size: 32px; } }

.searchbar { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.searchbar-field { position: relative; flex: 1 1 auto; min-width: 0; }
.searchbar-field svg { display: none; position: absolute; left: 96%; top: 43%; width: 22px; height: 22px; margin-top: -11px; fill: var(--muted); pointer-events: none; }
.searchbar input[type=search] {
    min-height: 56px; padding-left: 48px; font-size: 17px;
    border-width: 2px; border-radius: 12px; box-shadow: var(--shadow-2);
}
.searchbar .btn { min-height: 56px; padding: 0 22px; border-radius: 12px; font-size: 15.5px; }
@media (max-width: 420px) { .searchbar .btn { padding: 0 16px; } }

/* ------------------------------------------------- плашка статуса поверки */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px 3px 8px;
    border: 1px solid transparent; border-radius: 999px;
    font-size: 12.5px; font-weight: 650; line-height: 1.5; white-space: nowrap;
}
.badge i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge-sub { font-weight: 400; opacity: .85; }
.badge--valid { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.badge--soon { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 34%, transparent); }
.badge--expired { color: var(--bad); background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 34%, transparent); }
.badge--expired i { border-radius: 2px; animation: pulse 2s infinite; }
.badge--soon i { border-radius: 2px; transform: rotate(45deg); }
.badge--unknown { color: var(--none); background: var(--none-bg); border-color: var(--line); }
.badge--unknown i { border-radius: 1px; height: 3px; width: 11px; }

/* ------------------------------------------- «шильдик» — карточка прибора */
.plate {
    background: var(--plate);
    border: 1px solid var(--line-strong);
    border-top: 4px solid var(--copper);
    border-radius: 6px;
    padding: 16px 16px 8px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-2);
    position: relative;
}
.plate::before, .plate::after {
    content: ""; position: absolute; top: 10px; width: 7px; height: 7px; border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff 0, var(--line-strong) 60%);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
}
.plate::before { left: 8px; } .plate::after { right: 8px; }
.plate-top { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; justify-content: space-between; margin: 4px 6px 12px; }
.plate-name { font-size: 20px; font-weight: 700; line-height: 1.2; margin: 0; }
.plate-model { color: var(--muted); font-size: 14px; margin-top: 3px; }
.plate-rows { display: grid; grid-template-columns: 1fr; margin: 0; }
@media (min-width: 620px) { .plate-rows { grid-template-columns: 1fr 1fr; column-gap: 28px; } }
.plate-row { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; padding: 9px 0; border-bottom: 1px dotted var(--line-strong); font-size: 14px; }
.plate-row dt { color: var(--muted); flex: 0 0 auto; }
.plate-row dd { margin: 0; text-align: right; font-weight: 550; word-break: break-word; display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.plate-note { margin: 12px 0 6px; font-size: 13.5px; color: var(--ink-2); }
.plate-photo-link { display: inline-block; margin-bottom: 12px; border-radius: 6px; overflow: hidden; }
.plate-photo { width: 100%; max-width: 280px; border: 1px solid var(--line); border-radius: 6px; transition: transform .3s var(--ease); }
.plate-photo-link:hover .plate-photo { transform: scale(1.03); }
.copy-btn { border: 0; background: none; padding: 3px; border-radius: 5px; cursor: pointer; color: var(--muted); display: inline-grid; }
.copy-btn:hover { color: var(--steel); background: var(--surface-2); }
.copy-btn svg { width: 15px; height: 15px; fill: currentColor; }

/* --------------------------------------------------------- списки-таблицы */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.tbl th.num, .tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl--click tbody tr[data-href] { cursor: pointer; }
.row-dim { opacity: .6; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

@media (max-width: 760px) {
    .tbl--cards, .tbl--cards tbody, .tbl--cards tr, .tbl--cards td { display: block; width: 100%; }
    .tbl--cards thead { display: none; }
    .tbl--cards tr { border-bottom: 1px solid var(--line); padding: 8px 0; }
    .tbl--cards tbody tr:last-child { border-bottom: 0; }
    .tbl--cards td { border: 0; padding: 5px 14px; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; }
    .tbl--cards td.num { text-align: right; }
    .tbl--cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; flex: 0 0 auto; text-align: left; }
    .tbl--cards td:first-child { text-align: left; }
    .tbl--cards td:first-child::before { display: none; }
    .tbl--cards td:empty { display: none; }
    .tbl--cards td[data-label=""]::before { display: none; }
    .tbl--cards td[data-label=""] { justify-content: flex-end; }
}

/* ----------------------------------------------------- строки результатов */
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-item {
    display: block; padding: 14px 16px;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); color: inherit;
    box-shadow: var(--shadow-1);
    transition: border-color .15s, transform .15s var(--ease), box-shadow .15s;
}
.row-item:hover { text-decoration: none; border-color: color-mix(in srgb, var(--steel) 40%, var(--line)); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.row-top { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.row-title { font-weight: 650; font-size: 15px; }
.row-meta { margin-top: 5px; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 16px; }

/* ------------------------------------------------------------- документы */
.doc-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); transition: background .12s; }
.doc-item:hover { background: var(--surface-2); }
.doc-item:last-child { border-bottom: 0; }
.doc-ico {
    width: 40px; height: 44px; border-radius: 6px;
    display: grid; place-items: center; flex: 0 0 auto;
    background: var(--surface-3); color: var(--muted);
    font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .03em;
    position: relative; overflow: hidden;
}
.doc-ico::after { content: ""; position: absolute; right: 0; top: 0; border: 6px solid; border-color: var(--surface) var(--surface) transparent transparent; }
.doc-ico--pdf { background: #FBE3E1; color: #B42318; }
.doc-ico--doc, .doc-ico--docx { background: #E1EBFB; color: #1F4FA8; }
.doc-ico--xls, .doc-ico--xlsx { background: #E2F3E7; color: #17703A; }
.doc-ico--jpg, .doc-ico--jpeg, .doc-ico--png, .doc-ico--webp { background: #F2E8FA; color: #6B3FA0; }
html[data-theme="dark"] .doc-ico--pdf { background: #3a1d1b; color: #F2948B; }
html[data-theme="dark"] .doc-ico--doc, html[data-theme="dark"] .doc-ico--docx { background: #1c2a40; color: #93B5EE; }
html[data-theme="dark"] .doc-ico--xls, html[data-theme="dark"] .doc-ico--xlsx { background: #17301f; color: #79C995; }
html[data-theme="dark"] .doc-ico--jpg, html[data-theme="dark"] .doc-ico--jpeg, html[data-theme="dark"] .doc-ico--png { background: #2c2138; color: #C3A2E8; }
.doc-main { min-width: 0; flex: 1 1 auto; }
.doc-name { font-weight: 600; overflow-wrap: anywhere; color: var(--ink); }
.doc-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }
.doc-actions { display: flex; gap: 6px; flex: 0 0 auto; align-items: center; }
.doc-actions form { margin: 0; }

.empty {
    padding: 38px 18px; text-align: center; color: var(--muted);
    border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg);
    font-size: 14px; display: grid; justify-items: center; gap: 10px;
}
.empty svg { width: 40px; height: 40px; fill: var(--line-strong); }
.empty--flat { border: 0; border-radius: 0; padding: 30px 18px; }

/* ------------------------------------------------------------- уведомления */
.toasts {
    position: fixed; z-index: 120; right: 16px; top: calc(var(--header-h) + 12px);
    display: flex; flex-direction: column; gap: 10px; width: min(420px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 12px 12px 14px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-left: 4px solid var(--ok);
    border-radius: var(--radius); box-shadow: var(--shadow-pop);
    font-size: 14px; line-height: 1.4;
    animation: toastIn .35s var(--ease) both;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(24px) scale(.98); } to { opacity: 1; transform: none; } }
.toast--out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); height: 0; padding-top: 0; padding-bottom: 0; margin-top: -10px; } }
.toast--err { border-left-color: var(--bad); }
.toast--warn { border-left-color: var(--warn); }
.toast-ico { width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto; margin-top: 1px; background: var(--ok) center/12px no-repeat; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' d='M3.5 8.5l3 3 6-7'/></svg>"); }
.toast--err .toast-ico { background-color: var(--bad); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path stroke='white' stroke-width='2.4' stroke-linecap='round' d='M4.5 4.5l7 7M11.5 4.5l-7 7'/></svg>"); }
.toast--warn .toast-ico { background-color: var(--warn); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path stroke='white' stroke-width='2.4' stroke-linecap='round' d='M8 3.5v6M8 12.5v.01'/></svg>"); }
.toast-msg { flex: 1 1 auto; overflow-wrap: anywhere; }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; font-size: 14px; line-height: 20px; border-radius: 4px; }
.toast-x:hover { color: var(--ink); background: var(--surface-2); }
@media (max-width: 640px) {
    .toasts { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); right: 12px; left: 12px; width: auto; }
    @keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
}

/* ------------------------------------------------------------------ сводка */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stats--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat {
    display: block; padding: 14px 16px;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: var(--surface); color: inherit; box-shadow: var(--shadow-1);
    position: relative; overflow: hidden;
    transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
a.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-strong); }
.stat b { display: block; font-size: 28px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat--ok b { color: var(--ok); } .stat--ok::after { background: var(--ok); }
.stat--warn b { color: var(--warn); } .stat--warn::after { background: var(--warn); }
.stat--bad b { color: var(--bad); } .stat--bad::after { background: var(--bad); }
@media (max-width: 480px) { .stats--3 .stat { padding: 10px 12px; } .stats--3 .stat b { font-size: 22px; } }

/* --------------------------------------------------------------- выбор файла */
.filepick {
    position: relative; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 16px; border: 2px dashed var(--line-strong); border-radius: var(--radius-lg);
    background: var(--surface-2); cursor: pointer;
    transition: border-color .15s, background .15s;
}
.filepick:hover, .filepick.is-drag { border-color: var(--steel); background: var(--steel-soft); }
.filepick.is-drag { transform: scale(1.01); }
.filepick input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.filepick:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.filepick-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--steel); box-shadow: var(--shadow-1); flex: 0 0 auto; }
.filepick-ico svg { width: 24px; height: 24px; fill: currentColor; }
.filepick-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 200px; }
.filepick-text strong { font-size: 14.5px; }
.filepick--tall { flex-direction: column; text-align: center; padding: 26px 16px; }
.filepick--tall .filepick-text { align-items: center; flex: 0 0 auto; }
.filepick.has-file .filepick-ico, .filepick.has-file .filepick-text { display: none; }
.filepick-preview {
    position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 8px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
    animation: fadeUp .2s var(--ease); cursor: default;
}
.filepick-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.filepick-name { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; text-align: left; }
.filepick-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.photo-current { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.photo-current img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }

/* ------------------------------------------------------------ модальные окна */
.modal {
    position: fixed; inset: 0; z-index: 90;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12px; overflow-y: auto;
    background: rgba(10, 14, 20, .5);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .2s;
}
.modal.on { opacity: 1; }
.modal-box {
    background: var(--surface); border-radius: 14px;
    width: 100%; max-width: 580px; margin: 6vh auto 24px;
    box-shadow: var(--shadow-pop);
    transform: translateY(14px) scale(.98); transition: transform .25s var(--ease);
}
.modal.on .modal-box { transform: none; }
.modal-box--sm { max-width: 440px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; }
.modal-body { padding: 18px 20px 20px; display: block; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal--confirm { z-index: 110; }
.modal--confirm .modal-box { margin-top: 18vh; text-align: center; }
.modal--confirm .modal-foot { justify-content: center; border-top: 0; padding-top: 4px; }
.modal--confirm .modal-foot .btn { min-width: 120px; }
.confirm-ico { width: 52px; height: 52px; margin: 6px auto 12px; border-radius: 50%; background: var(--steel-soft) center/26px no-repeat; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%233E6096' d='M11 7h2v2h-2zm0 4h2v6h-2zm1-9a10 10 0 1010 10A10 10 0 0012 2z'/></svg>"); }
.modal--danger .confirm-ico { background-color: var(--bad-bg); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23A81F17' d='M6 19a2 2 0 002 2h8a2 2 0 002-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z'/></svg>"); }
.confirm-text { margin: 0 0 14px; font-size: 15px; line-height: 1.5; white-space: pre-line; }

/* --------------------------------------------------------------- всплывающие панели */
.pop {
    position: fixed; z-index: 130;
    background: var(--surface); border: 1px solid var(--line-strong);
    border-radius: 12px; box-shadow: var(--shadow-pop);
    opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top left;
    transition: opacity .14s, transform .16s var(--ease);
}
.pop.pop--up { transform-origin: bottom left; transform: translateY(4px) scale(.98); }
.pop.on { opacity: 1; transform: none; }

/* Календарь. */
.dp { position: relative; display: flex; }
.dp-input { padding-right: 46px !important; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.dp-btn {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 38px; height: 36px; border: 0; border-radius: 6px;
    background: none; color: var(--steel); cursor: pointer; display: grid; place-items: center;
    transition: background .15s;
}
.dp-btn:hover { background: var(--steel-soft); }
.dp-btn svg { width: 20px; height: 20px; fill: currentColor; }
.dp--bad .dp-input { border-color: var(--bad) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 18%, transparent) !important; }
.dp-pop { width: 296px; padding: 10px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 6px; }
.dp-title { flex: 1 1 auto; border: 0; background: none; border-radius: 8px; padding: 7px 6px; font: 700 14.5px var(--f-sans); color: var(--ink); cursor: pointer; text-transform: capitalize; }
.dp-title:hover { background: var(--surface-2); }
.dp-nav { width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; font-size: 22px; line-height: 1; color: var(--ink-2); cursor: pointer; }
.dp-nav:hover { background: var(--surface-2); color: var(--ink); }
.dp-grid { display: grid; gap: 2px; }
.dp-grid--days { grid-template-columns: repeat(7, 1fr); }
.dp-grid--months { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0; }
.dp-wd { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 4px 0 6px; text-transform: uppercase; }
.dp-wd.dp-we { color: color-mix(in srgb, var(--bad) 70%, var(--muted)); }
.dp-day, .dp-cell {
    height: 36px; border: 0; border-radius: 8px; background: none;
    font: 500 14px var(--f-sans); color: var(--ink); cursor: pointer;
    font-variant-numeric: tabular-nums; position: relative;
    transition: background .1s, color .1s;
}
.dp-cell { height: 46px; text-transform: capitalize; }
.dp-day:hover:not(:disabled), .dp-cell:hover { background: var(--surface-3); }
.dp-day.is-out { color: var(--muted); opacity: .55; }
.dp-day.dp-we:not(.is-sel) { color: color-mix(in srgb, var(--bad) 75%, var(--ink)); }
.dp-day.is-today::after, .dp-cell.is-today::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--steel); }
.dp-day.is-sel, .dp-cell.is-sel { background: var(--steel); color: #fff; font-weight: 700; }
html[data-theme="dark"] .dp-day.is-sel, html[data-theme="dark"] .dp-cell.is-sel { color: #10141a; }
.dp-day.is-sel::after { background: #fff; }
.dp-day:disabled { opacity: .25; cursor: not-allowed; text-decoration: line-through; }
.dp-day:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.dp-foot { display: flex; justify-content: space-between; padding: 8px 4px 2px; margin-top: 6px; border-top: 1px solid var(--line); }

/* Быстрый выбор межповерочного интервала. */
.quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.quick-label { font-size: 12.5px; color: var(--muted); margin-right: 2px; }

/* Список с поиском. */
.cb-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip: rect(0 0 0 0); }
.cb-btn {
    width: 100%; min-height: 44px; padding: 8px 34px 8px 12px; position: relative;
    display: flex; align-items: center; text-align: left;
    border: 1px solid var(--line-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--ink); cursor: pointer;
    font: 400 16px/1.3 var(--f-sans);
    transition: border-color .15s, box-shadow .15s;
}
.cb-btn:hover { border-color: color-mix(in srgb, var(--line-strong) 60%, var(--ink)); }
.cb-btn:focus-visible, .cb-btn[aria-expanded=true] { outline: none; border-color: var(--steel); box-shadow: 0 0 0 3px color-mix(in srgb, var(--steel) 22%, transparent); }
.cb-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cb-val--empty { color: var(--muted); }
.cb-caret { position: absolute; right: 13px; top: 50%; width: 12px; height: 8px; margin-top: -4px; fill: none; stroke: var(--muted); stroke-width: 1.7; transition: transform .2s; }
.cb-btn[aria-expanded=true] .cb-caret { transform: rotate(180deg); }
.cb-pop { max-width: min(440px, calc(100vw - 16px)); display: flex; flex-direction: column; max-height: min(400px, 70vh); }
.cb-search { padding: 8px; border-bottom: 1px solid var(--line); }
.cb-search input { min-height: 38px !important; padding: 7px 10px !important; font-size: 15px !important; }
.cb-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; overscroll-behavior: contain; }
.cb-group { position: sticky; top: -4px; z-index: 1; padding: 8px 10px 4px; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; background: var(--surface); }
.cb-item { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 14.5px; line-height: 1.35; }
.cb-item.is-active { background: var(--surface-3); }
.cb-item.is-sel { font-weight: 650; color: var(--steel); }
.cb-item.is-sel::before { content: "✓ "; }
.cb-item--none { color: var(--muted); }
.cb-empty { padding: 16px 10px; text-align: center; color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------- фильтры и чипы */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 34px; padding: 0 12px;
    border: 1px solid var(--line-strong); border-radius: 999px;
    font: 500 13px var(--f-sans); color: var(--ink-2); background: var(--surface);
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.chip:hover { text-decoration: none; border-color: var(--steel); color: var(--ink); }
.chip:active { transform: scale(.97); }
.chip.on { background: var(--steel); border-color: var(--steel); color: #fff; }
html[data-theme="dark"] .chip.on { color: #10141a; }
.chip.on .muted { color: inherit; opacity: .8; }
.chip--sm { min-height: 28px; padding: 0 10px; font-size: 12.5px; }
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.dot-expired { background: var(--bad); } .dot-soon { background: var(--warn); } .dot-valid { background: var(--ok); } .dot-unknown { background: var(--none); }
.chip.on i { background: currentColor; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.filters-right select { min-width: 200px; }
.filter-card { display: grid; gap: 12px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-q { flex: 1 1 260px; }
.filter-row select { flex: 0 1 220px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar-search { flex: 1 1 260px; max-width: 420px; }

.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 18px; flex-wrap: wrap; }

.split { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; } .split > aside { position: sticky; top: calc(var(--header-h) + 16px); } }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { color: var(--muted); }

.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.state--ok { color: var(--ok); } .state--warn { color: var(--warn); } .state--bad { color: var(--bad); }

.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------- справочники */
.unit-cat { margin-bottom: 14px; scroll-margin-top: calc(var(--header-h) + 14px); }
.unit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.unit-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 16px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 0; transition: background .12s; }
.unit-item:hover { background: var(--surface-2); }
.unit-sym { min-width: 74px; font: 700 14.5px var(--f-mono); color: var(--steel-ink); }
.unit-name { flex: 1 1 auto; min-width: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.35; }
.unit-actions { display: flex; gap: 2px; opacity: .55; transition: opacity .15s; }
.unit-actions form { margin: 0; }
.unit-item:hover .unit-actions, .unit-actions:focus-within { opacity: 1; }
@media (hover: none) { .unit-actions { opacity: 1; } }
.sym-pad { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: middle; }
.sym-pad .chip { min-width: 32px; justify-content: center; font-family: var(--f-mono); }

.user-list { display: grid; gap: 6px; max-height: 520px; overflow-y: auto; padding: 2px; }
.user-pick {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s;
}
.user-pick:hover { background: var(--surface-2); }
.user-pick:has(input:checked) { border-color: color-mix(in srgb, var(--steel) 55%, transparent); background: var(--steel-soft); }
.user-pick-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.user-pick-name { font-weight: 600; font-size: 14px; }

.profile-head { display: flex; align-items: center; gap: 16px; max-width: 640px; }
.profile-name { font-size: 18px; font-weight: 700; }

/* --------------------------------------------------------- просмотр документа */
.viewer { height: calc(100vh - var(--header-h) - 150px); min-height: 360px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow-1); }
.viewer iframe, .viewer embed, .viewer object, .viewer img { width: 100%; height: 100%; border: 0; display: block; object-fit: contain; }

.actionbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; gap: 8px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
}
.actionbar .btn { flex: 1 1 0; min-width: 0; }
@media (min-width: 760px) {
    .actionbar { position: static; border: 0; padding: 0; background: none; margin-top: 14px; backdrop-filter: none; }
    .actionbar .btn { flex: 0 0 auto; }
}

/* ================================================================ вход */
.auth-body { min-height: 100vh; min-height: 100dvh; background: #0E1520; color: var(--ink); overflow-x: hidden; }
.auth-bg {
    position: fixed; inset: 0; z-index: 0;
    background: #2a3340 url("/img/login-bg.jpg") center 60% / cover no-repeat;
    animation: kenburns 24s ease-out both;
}
@media (max-width: 760px) { .auth-bg { background-image: url("/img/login-bg-sm.jpg"); } }
.auth-shade {
    position: fixed; inset: 0; z-index: 1;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(14, 21, 32, .15) 0%, rgba(14, 21, 32, .55) 70%),
        linear-gradient(180deg, rgba(14, 21, 32, .35) 0%, rgba(14, 21, 32, .25) 40%, rgba(14, 21, 32, .75) 100%);
}
.auth-top { position: fixed; top: 14px; right: 14px; z-index: 3; display: flex; gap: 6px; }
.icon-btn--glass {
    color: #fff; background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.icon-btn--glass:hover { background: rgba(255, 255, 255, .26); color: #fff; }
.icon-btn--glass.on { background: rgba(255, 255, 255, .92); color: #1b2635; }
.auth-wrap {
    position: relative; z-index: 2;
    min-height: 100vh; min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 72px 16px calc(64px + env(safe-area-inset-bottom));
}
.auth-card {
    width: 100%; max-width: 420px;
    background: rgba(255, 255, 255, .93);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 18px;
    padding: 30px 28px 24px;
    box-shadow: 0 24px 60px rgba(5, 10, 18, .45), 0 2px 8px rgba(5, 10, 18, .2);
    animation: fadeUp .5s var(--ease) both .05s;
}
html[data-theme="dark"] .auth-card { background: rgba(26, 30, 36, .9); border-color: rgba(255, 255, 255, .08); }
@media (max-width: 420px) { .auth-card { padding: 24px 18px 18px; border-radius: 16px; } }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 22px; text-align: center; }
.auth-logo-img { width: 76px; height: 76px; border-radius: 20px; display: grid; place-items: center; background: #fff; box-shadow: 0 6px 18px rgba(15, 22, 33, .18); margin-bottom: 8px; }
.auth-logo-img img { width: 60px; height: 60px; object-fit: contain; }
.auth-logo .org { font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.auth-logo .sub { font-size: 13.5px; color: var(--muted); }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn--primary { margin-top: 6px; }
.auth-hint { margin: 16px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }
.auth-shake { animation: shake .45s both; }
.auth-foot { position: fixed; z-index: 2; left: 0; right: 0; bottom: calc(14px + env(safe-area-inset-bottom)); text-align: center; color: rgba(255, 255, 255, .72); font-size: 12px; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); pointer-events: none; }

/* --------------------------------------------------------------- печать */
@media print {
    .hdr, .nav, .actionbar, .btn, .nav-scrim, .no-print, .toasts, .form-actions { display: none !important; }
    body { background: #fff; color: #000; }
    .main { padding: 0; }
    .card, .plate { border-color: #999; break-inside: avoid; box-shadow: none; }
    .page-enter > * { animation: none !important; }
    a[href]::after { content: ""; }
}
