/* =====================================================================
   M-servis — Material 2 (Google, 2018–2020), ужатый.
   Правила: белый фон, один шрифт (Roboto), только 4 размера: 12 / 14 / 16 / 20.
   Поверхности — тенями (карточки 1dp, шапка 4dp, меню 8dp, диалог 24dp), радиус 4px, кнопки капсом, поля с подписью в рамке,
   нажатие — волна (ripple), переходы cubic-bezier(.4, 0, .2, 1).
   Никакого моноширинного шрифта. Цвет — только акценты, основное — серые.
   ===================================================================== */

/* ---------- Шрифты (локально, без CDN) ---------- */
@font-face { font-family: Roboto; font-style: normal; font-weight: 400; font-display: swap; src: url(../lib/roboto/roboto-latin-400-normal.woff2) format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 500; font-display: swap; src: url(../lib/roboto/roboto-latin-500-normal.woff2) format("woff2");
    unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 400; font-display: swap; src: url(../lib/roboto/roboto-latin-ext-400-normal.woff2) format("woff2");
    unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 500; font-display: swap; src: url(../lib/roboto/roboto-latin-ext-500-normal.woff2) format("woff2");
    unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 400; font-display: swap; src: url(../lib/roboto/roboto-cyrillic-400-normal.woff2) format("woff2");
    unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 500; font-display: swap; src: url(../lib/roboto/roboto-cyrillic-500-normal.woff2) format("woff2");
    unicode-range: U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 400; font-display: swap; src: url(../lib/roboto/roboto-cyrillic-ext-400-normal.woff2) format("woff2");
    unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: Roboto; font-style: normal; font-weight: 500; font-display: swap; src: url(../lib/roboto/roboto-cyrillic-ext-500-normal.woff2) format("woff2");
    unicode-range: U+0460-052F,U+1C80-1C88,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: "Material Icons Outlined"; font-style: normal; font-weight: 400; font-display: block;
    src: url(../lib/material-icons/material-icons-outlined.woff2) format("woff2"); }

/* ---------- Токены ---------- */
:root {
    --primary: #1a73e8;
    --primary-dark: #1967d2;
    --primary-hover: #1765cc;
    --primary-light: #e8f0fe;
    --primary-border: #d2e3fc;

    --text: #202124;
    --text-2: #5f6368;
    --text-3: #70757a;
    --divider: #dadce0;
    --divider-2: #e8eaed;
    --hover: #f1f3f4;
    --hover-2: #f8f9fa;
    --bg: #ffffff;
    --card: #ffffff;          /* карточка на цветной подложке */
    --menu: #ffffff;          /* меню, диалоги */
    --on-primary: #ffffff;
    --primary-active: #185abc;
    --primary-hover-bg: #f8fbff;
    --error-hover-bg: #fef7f6;
    --border-hover: #bdc1c6;
    --attn-bg: #fffbf0;
    --success-border: #ceead6;
    --snackbar: #323232;
    --on-snackbar: #ffffff;
    --tooltip: #3c4043;
    --plate-bg: #ffffff;

    --error: #c5221f;
    --error-bg: #fce8e6;
    --warning: #b06000;
    --warning-bg: #fef7e0;
    --success: #188038;
    --success-bg: #e6f4ea;

    --fs-12: 12px;
    --fs-14: 14px;
    --fs-16: 16px;
    --fs-20: 20px;

    --radius: 4px;
    --radius-s: 4px;
    /* высоты Material 2: 1dp, 2dp, 4dp, 8dp, 24dp */
    --shadow-1: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
    --shadow-b: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
    --shadow-2: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
    --shadow-3: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
    --shadow-24: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12);
    --shadow-menu-1: 0 1px 2px 0 rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
    --shadow-menu-2: 0 1px 3px 0 rgba(60,64,67,.3), 0 4px 8px 3px rgba(60,64,67,.15);
    --shadow-fab: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14), 0 1px 18px 0 rgba(0,0,0,.12);
    --ease: cubic-bezier(.4, 0, .2, 1);
    --surface: var(--panel);  /* фон под подписью поля */
    --panel: #ffffff;
    --field-line: rgba(0,0,0,.38);
    --field-line-hover: rgba(0,0,0,.87);

    --appbar: 64px;
    --drawer: 256px;
    --bottom-nav: 56px;

    /* статусы: цвет только у точки */
    --st-Planned: #9aa0a6;
    --st-Received: #12b5cb;
    --st-Diagnostics: #a142f4;
    --st-WaitingApproval: #f9ab00;
    --st-WaitingParts: #e8710a;
    --st-InProgress: #1a73e8;
    --st-QualityCheck: #e52592;
    --st-Done: #1e8e3e;
    --st-HandedOver: #5f6368;
    --st-Cancelled: #d93025;

    color-scheme: light;

    /* bootstrap → наши значения */
    --bs-body-font-family: Roboto, Arial, sans-serif;
    --bs-body-font-size: 14px;
    --bs-body-line-height: 20px;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--bg);
    --bs-emphasis-color: var(--text);
    --bs-secondary-color: var(--text-2);
    --bs-border-color: var(--divider);
    --bs-border-radius: 4px;
    --bs-primary: #1a73e8;
    --bs-primary-rgb: 26,115,232;
    --bs-link-color: #1967d2;
    --bs-link-color-rgb: 25,103,210;
    --bs-link-hover-color: #1765cc;
    --bs-link-hover-color-rgb: 23,101,204;
    --bs-danger: #d93025;
    --bs-danger-rgb: 217,48,37;
    --bs-success: #188038;
    --bs-success-rgb: 24,128,56;
}
@media (max-width: 991.98px) { :root { --appbar: 56px; } }

/* ---------- Тёмная тема ---------- */
:root[data-bs-theme="dark"] {
    --primary: #8ab4f8;
    --primary-dark: #8ab4f8;
    --primary-hover: #aecbfa;
    --primary-active: #aecbfa;
    --primary-light: #2b3a52;
    --primary-border: #4a6aa0;
    --primary-hover-bg: #28303d;
    --on-primary: #202124;

    --text: #e8eaed;
    --text-2: #a8adb3;
    --text-3: #8f959b;
    --divider: #46494d;
    --divider-2: #37393c;
    --hover: #2d2f31;
    --hover-2: #27282b;
    --bg: #202124;
    --card: #35363a;
    --panel: #292a2d;         /* в тёмной теме высота — осветлением */
    --field-line: rgba(255,255,255,.38);
    --field-line-hover: rgba(255,255,255,.87);
    --menu: #2d2e31;
    --border-hover: #6f747a;

    --error: #f28b82;
    --error-bg: #482b2b;
    --error-hover-bg: #3a2728;
    --warning: #fdd663;
    --warning-bg: #433a22;
    --success: #81c995;
    --success-bg: #24382b;
    --success-border: #3c5c47;
    --attn-bg: #332e20;
    --snackbar: #e8eaed;
    --on-snackbar: #202124;
    --tooltip: #5f6368;
    --plate-bg: #f1f3f4;

    --st-InProgress: #669df6;
    --st-Done: #5bb974;
    --st-HandedOver: #9aa0a6;
    --st-Planned: #bdc1c6;
    --st-Diagnostics: #af5cf7;
    --st-Cancelled: #f28b82;

    --bs-link-color: #8ab4f8;
    --bs-link-color-rgb: 138,180,248;
    --bs-link-hover-color: #aecbfa;
    --bs-link-hover-color-rgb: 174,203,250;
    --bs-body-color-rgb: 232,234,237;
    color-scheme: dark;
}
/* тёмные эмблемы на тёмном не видны — кладём на светлую подложку */
[data-bs-theme="dark"] .make { background: #e8eaed; border-radius: 4px; padding: 2px 3px; }
[data-bs-theme="dark"] .logo-mark { background: #fff; border-radius: 50%; }

/* ---------- База ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: Roboto, Arial, sans-serif;
    font-size: var(--fs-14);
    line-height: 20px;
    letter-spacing: .2px;
    font-variant-numeric: tabular-nums;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { margin: 0; color: var(--text); letter-spacing: 0; }
h1 { font-size: var(--fs-20); font-weight: 500; line-height: 28px; }
h2, h3 { font-size: var(--fs-16); font-weight: 500; line-height: 24px; }
h4, h5, h6 { font-size: var(--fs-14); font-weight: 500; line-height: 20px; }
p { margin: 0 0 8px; }
small, .small { font-size: var(--fs-12); line-height: 16px; }
b, strong { font-weight: 500; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary-hover); text-decoration: underline; }
a.plain, a.plain:hover { color: inherit; text-decoration: none; }
.text-muted, .t2 { color: var(--text-2) !important; }
.text-danger { color: var(--error) !important; }
.text-success { color: var(--success) !important; }
.fw-500 { font-weight: 500; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pre { white-space: pre-line; }
.min-w-0 { min-width: 0; }

/* иконки Material (лигатуры: <i class="mi">add</i>) */
.mi {
    font-family: "Material Icons Outlined";
    font-weight: normal; font-style: normal; font-size: 20px; line-height: 1;
    letter-spacing: normal; text-transform: none; white-space: nowrap; word-wrap: normal; direction: ltr;
    display: inline-block; vertical-align: middle; flex: 0 0 auto;
    -webkit-font-smoothing: antialiased; font-feature-settings: "liga"; user-select: none;
    width: 1em; overflow: hidden;
}
.mi.s18 { font-size: 18px; }
.mi.s16 { font-size: 16px; }
.mi.s24 { font-size: 24px; }

/* ---------- Кнопки ---------- */
.btn {
    --bs-btn-font-size: var(--fs-14);
    --bs-btn-font-weight: 500;
    --bs-btn-line-height: 20px;
    --bs-btn-padding-y: 0;
    --bs-btn-padding-x: 16px;
    --bs-btn-border-radius: var(--radius-s);
    --bs-btn-focus-box-shadow: none;
    height: 36px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; text-decoration: none !important;
    transition: background-color .2s var(--ease), box-shadow .28s var(--ease), border-color .2s var(--ease);
}
.btn .mi { font-size: 18px; margin-left: -4px; }
.btn-primary {
    --bs-btn-color: var(--on-primary); --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-color: var(--on-primary); --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-color: var(--on-primary); --bs-btn-active-bg: var(--primary-active); --bs-btn-active-border-color: var(--primary-active);
    --bs-btn-disabled-color: var(--on-primary); --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary);
}
.btn-primary { box-shadow: var(--shadow-b); }
.btn-primary:hover, .btn-primary:focus-visible { box-shadow: var(--shadow-2); }
.btn-primary:active { box-shadow: var(--shadow-3) !important; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn-outline {
    --bs-btn-color: var(--primary-dark); --bs-btn-bg: transparent; --bs-btn-border-color: var(--divider);
    --bs-btn-hover-color: var(--primary-dark); --bs-btn-hover-bg: var(--primary-hover-bg); --bs-btn-hover-border-color: var(--primary-border);
    --bs-btn-active-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-light); --bs-btn-active-border-color: var(--primary-border);
}
.btn-text {
    --bs-btn-color: var(--primary-dark); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--primary-dark); --bs-btn-hover-bg: var(--primary-hover-bg); --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--primary-dark); --bs-btn-active-bg: var(--primary-light); --bs-btn-active-border-color: transparent;
    --bs-btn-padding-x: 8px;
}
.btn-text.danger, .btn-outline.danger { --bs-btn-color: var(--error); --bs-btn-hover-color: var(--error); --bs-btn-hover-bg: var(--error-hover-bg); --bs-btn-active-color: var(--error); --bs-btn-active-bg: var(--error-bg); }
.btn-sm { height: 32px; --bs-btn-padding-x: 12px; --bs-btn-font-size: var(--fs-14); --bs-btn-border-radius: var(--radius-s); }
.btn-text.btn-sm { --bs-btn-padding-x: 8px; }
.icon-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--text-2);
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0;
}
.icon-btn .mi { font-size: 24px; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .mi { font-size: 20px; }
.icon-btn.danger:hover { color: var(--error); background: var(--error-bg); }
@media (pointer: coarse) { .btn { height: 40px; } .btn-sm { height: 36px; } }

/* ---------- Верхняя панель ---------- */
.appbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 1030; height: var(--appbar);
    background: var(--panel); box-shadow: var(--shadow-2);
    display: flex; align-items: center; gap: 8px; padding: 0 8px;
}
.logo { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: var(--fs-20); font-weight: 400; padding: 0 8px; }
.logo:hover { color: var(--text-2); text-decoration: none; }
.appbar .logo { width: calc(var(--drawer) - 16px); }
.logo-mark { width: 40px; height: 40px; flex: 0 0 auto; }
.login-box .logo-mark { width: 72px; height: 72px; }
.search { position: relative; flex: 1 1 auto; max-width: 720px; min-width: 0; }
.search > .mi { position: absolute; left: 12px; top: 12px; color: var(--text-2); font-size: 24px; pointer-events: none; }
.search input {
    width: 100%; height: 48px; border: 0; border-radius: var(--radius); background: var(--hover);
    padding: 0 16px 0 48px; font-size: var(--fs-16); color: var(--text); outline: none;
}
.search input::placeholder { color: var(--text-2); }
.search input:focus { background: var(--menu); box-shadow: var(--shadow-1); }
.search input::-webkit-search-cancel-button { display: none; }
.appbar-end { margin-left: auto; display: flex; align-items: center; gap: 4px; padding-left: 8px; }
.avatar-btn { border: 0; background: transparent; padding: 4px; border-radius: 50%; }
.avatar-btn:hover { background: var(--hover); }
@media (max-width: 991.98px) {
    .appbar { padding: 0 4px; gap: 4px; }
    .appbar .logo { display: none; }
    .search input { height: 40px; padding-left: 44px; }
    .search > .mi { top: 8px; left: 10px; }
}

/* выпадающие списки (меню пользователя, результаты поиска) */
.dropdown-menu {
    --bs-dropdown-border-width: 0; --bs-dropdown-border-radius: var(--radius); --bs-dropdown-padding-y: 8px;
    --bs-dropdown-font-size: var(--fs-14); --bs-dropdown-color: var(--text);
    --bs-dropdown-link-color: var(--text); --bs-dropdown-link-hover-color: var(--text); --bs-dropdown-link-hover-bg: var(--hover);
    --bs-dropdown-link-active-color: var(--primary-dark); --bs-dropdown-link-active-bg: var(--primary-light);
    --bs-dropdown-item-padding-x: 16px; --bs-dropdown-item-padding-y: 8px;
    --bs-dropdown-divider-bg: var(--divider); --bs-dropdown-divider-margin-y: 8px;
    --bs-dropdown-bg: var(--menu); --surface: var(--menu); box-shadow: var(--shadow-3); min-width: 240px;
}
.dropdown-item { display: flex; align-items: center; gap: 16px; min-height: 40px; }
.dropdown-item .mi { color: var(--text-2); }
.dropdown-item.active .mi { color: var(--primary-dark); }
.dropdown-header { font-size: var(--fs-12); color: var(--text-2); padding: 8px 16px; }
.me-card { display: flex; align-items: center; gap: 12px; padding: 8px 16px 12px; }
.me-card .n { font-weight: 500; }

.search-results {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050;
    background: var(--menu); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 8px 0; max-height: 70vh; overflow-y: auto;
}
.search-results .sr-head { font-size: var(--fs-12); font-weight: 500; color: var(--text-2); padding: 8px 16px 4px; }
.search-results a { display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 48px; color: var(--text); text-decoration: none; }
.search-results a:hover, .search-results a.focus { background: var(--hover); color: var(--text); }
.search-results .sr-sub { color: var(--text-2); font-size: var(--fs-12); line-height: 16px; }
.search-results .sr-empty { padding: 12px 16px; color: var(--text-2); }
.search-results .mi { color: var(--text-2); }

/* ---------- Боковое меню ---------- */
.drawer { width: var(--drawer); background: var(--bg); display: flex; flex-direction: column; }
@media (min-width: 992px) {
    .drawer { position: fixed; top: var(--appbar); bottom: 0; left: 0; z-index: 1020; overflow-y: auto; padding: 8px 0 16px; }
    .main { margin-left: var(--drawer); }
}
@media (max-width: 991.98px) {
    .drawer.offcanvas-lg { --bs-offcanvas-width: 280px; padding: 0 0 16px; overflow-y: auto; }
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: 56px; padding: 0 4px 0 8px; border-bottom: 1px solid var(--divider); margin-bottom: 8px; }
.new-btn {
    display: inline-flex; align-items: center; gap: 12px; height: 48px; padding: 0 24px 0 12px; margin: 0 0 12px 8px;
    border-radius: 24px; background: var(--menu); color: var(--text); font-weight: 500; box-shadow: var(--shadow-menu-1);
    align-self: flex-start;
}
.new-btn .mi { font-size: 32px; width: 32px; color: var(--primary); }
.new-btn:hover { box-shadow: var(--shadow-menu-2); background: var(--hover-2); color: var(--text); text-decoration: none; }
.nav-i {
    display: flex; align-items: center; gap: 20px; height: 40px; padding: 0 12px 0 24px; margin-right: 8px;
    border-radius: 0 20px 20px 0; color: var(--text); font-weight: 500;
}
.nav-i .mi { color: var(--text-2); }
.nav-i:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-i.active { background: var(--primary-light); color: var(--primary-dark); }
.nav-i.active .mi { color: var(--primary-dark); }
.nav-n { margin-left: auto; font-size: var(--fs-12); color: var(--error); }
.nav-div { height: 1px; background: var(--divider); margin: 8px 0; }

/* ---------- Контент ---------- */
.main { padding-top: var(--appbar); }
.content { padding: 24px; max-width: 1440px; }
@media (max-width: 991.98px) {
    .content { padding: 16px 16px calc(var(--bottom-nav) + 88px); }
}
.page-head { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 16px; min-height: 40px; }
.page-head .grow { flex: 1 1 auto; min-width: 0; }
.page-sub { color: var(--text-2); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); margin-bottom: 8px; height: 32px; }
.back:hover { color: var(--text); text-decoration: none; }

/* панели (outlined card) */
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 8px 8px 16px; }
.panel-head h2 { flex: 1 1 auto; min-width: 0; }
.panel-head .cnt { color: var(--text-2); font-weight: 400; margin-left: 4px; }
.panel-body { padding: 0 16px 16px; }
.panel-section { padding: 16px; }
.panel-section + .panel-section { border-top: 1px solid var(--divider-2); }
.panel-section > h2 { margin-bottom: 16px; }
.hint { color: var(--text-2); font-size: var(--fs-12); line-height: 16px; }
.empty { color: var(--text-2); text-align: center; padding: 32px 16px; }
.empty .mi { display: block; margin: 0 auto 8px; font-size: 40px; color: var(--border-hover); }
.note-box { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); background: var(--warning-bg); }
.note-box .mi { color: var(--warning); }
.form-narrow > .note-box { margin: 16px 16px 0; }
.lead-box { background: var(--primary-light); }
.lead-box > .mi { color: var(--primary); }
.lead-box details > summary { cursor: pointer; }
.lead-box .pre { overflow-wrap: anywhere; }
.note-box[hidden] { display: none; }
.note-box.err { background: var(--error-bg); }
.note-box.err .mi { color: var(--error); }

/* ---------- Списки (MD list) ---------- */
.list { border-top: 1px solid var(--divider-2); }
.li {
    display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 8px 16px;
    color: var(--text); border-bottom: 1px solid var(--divider-2);
}
.li:last-child { border-bottom: 0; }
a.li:hover { background: var(--hover-2); color: var(--text); text-decoration: none; }
.li-main { flex: 1 1 auto; min-width: 0; }
.li-t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-t.wrap { white-space: normal; }
.li-s { color: var(--text-2); font-size: var(--fs-12); line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.li-end { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.li-lead { width: 40px; height: 40px; border-radius: 50%; background: var(--hover); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.li-lead.on { background: var(--primary-light); color: var(--primary-dark); }
.li-count { font-size: var(--fs-16); font-weight: 500; min-width: 24px; text-align: right; }
.li-count.zero { color: var(--text-3); font-weight: 400; }
@media (max-width: 575.98px) { .li { gap: 12px; } }

/* ---------- Госномер ---------- */
.plate {
    display: inline-flex; align-items: stretch; height: 26px; overflow: hidden;
    border: 1px solid #5f6368; border-radius: var(--radius-s); background: var(--plate-bg); color: #202124;
    font-size: var(--fs-14); font-weight: 500; letter-spacing: .5px; line-height: 1; white-space: nowrap; vertical-align: middle;
}
.plate .n { display: inline-flex; align-items: center; padding: 0 6px; }
.plate .cc { flex: 0 0 auto; aspect-ratio: 26 / 40; height: 100%; background: #003399 center / 100% 100% no-repeat; }
.plate .cc.cz { background-image: url(../img/plate-cz.svg); }
.plate .cc.sk { background-image: url(../img/plate-sk.svg); }
.plate .cc.ua { background-image: url(../img/plate-ua.svg); }
.plate .cc.tr { aspect-ratio: 10 / 40; background: #d93025; }
.plate.sm { height: 22px; font-size: var(--fs-12); }
.plate.sm .n { padding: 0 5px; }
.plate.lg { height: 36px; font-size: var(--fs-20); }
.plate.lg .n { padding: 0 10px; }
.car-id { display: inline-flex; align-items: center; gap: 8px; vertical-align: middle; }
.li-t .car-id, .li-s .car-id, .dtable .car-id { margin-right: 4px; }
.car-id + * { vertical-align: middle; }
.make { width: 28px; height: 22px; object-fit: contain; flex: 0 0 auto; vertical-align: middle; }
.plate.lg + .make { width: 44px; height: 34px; }
.cars { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.stk { width: 25px; height: 22px; vertical-align: middle; }
.stk-date { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tooltip { --bs-tooltip-bg: var(--tooltip); --bs-tooltip-color: #fff; --bs-tooltip-opacity: 1; --bs-tooltip-font-size: 12px; --bs-tooltip-padding-x: 8px; --bs-tooltip-padding-y: 6px; --bs-tooltip-border-radius: 4px; --bs-tooltip-arrow-height: 0; font-family: Roboto, Arial, sans-serif; pointer-events: none; }

/* ---------- Статусы, метки, аватары ---------- */
.status {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 8px; border-radius: 12px;
    background: var(--hover); color: var(--text); font-size: var(--fs-12); font-weight: 500; white-space: nowrap; line-height: 1; vertical-align: middle;
}
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: 0 0 auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--c); flex: 0 0 auto; }
.tag {
    display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: var(--radius-s);
    background: var(--hover); color: var(--text-2); font-size: var(--fs-12); font-weight: 500; white-space: nowrap; line-height: 1; vertical-align: middle;
}
.tag .mi { font-size: 16px; }
.tag.ok { background: var(--success-bg); color: var(--success); }
.tag.warn { background: var(--warning-bg); color: var(--warning); }
.tag.err { background: var(--error-bg); color: var(--error); }
.tag.info { background: var(--primary-light); color: var(--primary-dark); }
a.tag:hover { text-decoration: none; filter: brightness(.97); }
.avatar {
    width: 32px; height: 32px; border-radius: 50%; background: var(--primary-light); color: var(--primary-dark);
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    font-size: var(--fs-12); font-weight: 500; letter-spacing: 0; line-height: 1;
}
.avatar.sm { width: 24px; height: 24px; }
.avatar.lg { width: 40px; height: 40px; font-size: var(--fs-16); }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-weight: 500; white-space: nowrap; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex: 0 0 auto; animation: live 2s ease-in-out infinite; }
@keyframes live { 50% { opacity: .35; } }

/* ---------- Чипы и переключатели ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; flex: 0 0 auto;
    border: 0; border-radius: 16px; background: var(--divider-2); color: var(--text);
    font-size: var(--fs-14); font-weight: 400; white-space: nowrap; line-height: 1; cursor: pointer; transition: background-color .15s var(--ease);
}
.chip:hover { background: var(--divider); color: var(--text); text-decoration: none; }
.chip.on { background: var(--primary-light); color: var(--primary-dark); }
.chip .mi { font-size: 18px; margin-left: -4px; }
.chip b { font-weight: 500; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--divider); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    position: relative; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; flex: 0 0 auto;
    color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap;
}
.tabs a:hover { background: var(--hover-2); color: var(--text); text-decoration: none; }
.tabs a b { font-size: var(--fs-12); font-weight: 400; }
.tabs a.on { color: var(--primary-dark); }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--primary); }
.toggle { display: inline-flex; border: 1px solid var(--divider); border-radius: var(--radius-s); overflow: hidden; height: 36px; }
.toggle a { display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--text-2); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.toggle a + a { border-left: 1px solid var(--divider); }
.toggle a:hover { background: var(--hover-2); text-decoration: none; color: var(--text); }
.toggle a.on { background: var(--primary-light); color: var(--primary-dark); }
.toggle .mi { font-size: 18px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.field-search { position: relative; flex: 1 1 240px; max-width: 400px; }
.field-search .mi { position: absolute; left: 10px; top: 10px; color: var(--text-2); pointer-events: none; }
.field-search .form-control { padding-left: 40px; }

/* ---------- Таблицы ---------- */
.dtable { width: 100%; border-collapse: collapse; }
.dtable th {
    font-size: var(--fs-12); font-weight: 500; color: var(--text-2); text-align: left; white-space: nowrap;
    height: 40px; padding: 0 16px; border-bottom: 1px solid var(--divider);
}
.dtable td { height: 52px; padding: 6px 16px; border-bottom: 1px solid var(--divider-2); vertical-align: middle; }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable tr.click { cursor: pointer; }
@media (hover: hover) { .dtable tr.click:hover td { background: var(--hover-2); } }
.dtable .r { text-align: right; white-space: nowrap; }
.dtable .shrink { width: 1%; white-space: nowrap; }
.row-btns { display: inline-flex; gap: 8px; }
@media (max-width: 575.98px) { .row-btns { flex-wrap: wrap; } }
.dtable tr.attn td { background: var(--attn-bg); }
.m-only { display: none; }
@media (max-width: 767.98px) {
    .dtable.resp, .dtable.resp tbody { display: block; width: 100%; }
    .dtable.resp thead { display: none; }
    .dtable.resp tr.click:hover td { background: transparent; }
    .dtable.resp tr.attn { background: var(--attn-bg); }
    .dtable.resp tr.attn td { background: transparent; }
    .dtable.resp tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 16px; border-bottom: 1px solid var(--divider-2); }
    .dtable.resp tbody tr:last-child { border-bottom: 0; }
    .dtable.resp td { display: block; height: auto; padding: 0; border: 0; }
    .dtable.resp td.shrink { width: auto; }
    .dtable.resp td.m-full { flex: 1 0 100%; min-width: 0; }
    .dtable.resp td.m-hide { display: none; }
    .dtable.resp td.m-end { margin-left: auto; }
    .dtable.resp td.m-sub { color: var(--text-2); font-size: var(--fs-12); }
    .dtable.resp .r { text-align: left; }
    .dtable.resp .m-only { display: block; }
}

/* ---------- Формы ---------- */
/* Outlined text field: подпись сидит в рамке, у пустого поля — внутри него */
.form-label {
    position: relative; z-index: 2; display: block; width: fit-content; max-width: calc(100% - 16px); margin: 0 0 -8px 8px; padding: 0 4px;
    font-size: var(--fs-12); line-height: 16px; font-weight: 400; color: var(--text-2); background: var(--surface);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform-origin: 4px 50%;
    transition: transform .15s var(--ease), color .15s var(--ease);
}
.form-label .hint { font-weight: 400; }
:has(> .form-control:placeholder-shown:not(:focus):not([readonly])) > .form-label,
:has(> :is(.affix, .combo, .whenf, .position-relative) > .form-control:placeholder-shown:not(:focus)) > .form-label {
    transform: translateY(24px) scale(1.1667); max-width: calc(86% - 24px); background: transparent; pointer-events: none;
}
:has(> textarea.form-control:placeholder-shown:not(:focus)) > .form-label { transform: translateY(21px) scale(1.1667); }
:has(> .form-label) > .form-control:not(:focus)::placeholder,
:has(> .form-label) > :is(.affix, .combo, .whenf, .position-relative) > .form-control:not(:focus)::placeholder { color: transparent; }
:has(> .form-label) > .affix > .form-control:placeholder-shown:not(:focus) ~ .suffix { opacity: 0; }
:is(div, section):focus-within > .form-label { color: var(--primary-dark); }
.form-control, .form-select {
    height: 48px; padding: 0 12px; font-size: var(--fs-14); line-height: 20px; color: var(--text);
    background-color: transparent; border: 1px solid var(--field-line); border-radius: var(--radius-s); box-shadow: none;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-control:focus, .form-select:focus { background-color: transparent; color: var(--text); }
.form-select { padding-right: 36px; }
.form-select option { background: var(--menu); color: var(--text); }
textarea.form-control { height: auto; min-height: 80px; padding: 14px 12px; }
.form-control:hover, .form-select:hover { border-color: var(--field-line-hover); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
input[type="file"].form-control { padding: 13px 12px; }
.toolbar .form-control { height: 40px; }
.form-control::placeholder { color: var(--text-3); }
.form-control[readonly] { background: var(--hover-2); }
.whenf > .form-control[readonly] { background: transparent; }
.form-control.sm, .form-select.sm { height: 36px; padding: 0 8px; }
.form-select.sm { padding-right: 28px; background-position: right 6px center; }
.input-validation-error { border-color: var(--error) !important; }
.field-validation-error, .validation-summary-errors { color: var(--error); font-size: var(--fs-12); line-height: 16px; display: block; margin-top: 4px; }
.validation-summary-errors ul { margin: 0; padding-left: 16px; }
.validation-summary-valid { display: none; }
.form-check { display: flex; align-items: center; gap: 12px; padding: 0; min-height: 40px; }
.form-check .form-check-input { float: none; margin: 0; flex: 0 0 auto; }
.form-check-input { border: 2px solid var(--text-2); background-color: transparent; }
.form-check-input[type=checkbox] { width: 18px; height: 18px; border-radius: 2px; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-check-input:focus { box-shadow: none; border-color: var(--primary); }
.form-check-label { cursor: pointer; }
/* Material switch: дорожка и кружок с тенью */
.form-switch .form-check-input[type=checkbox] {
    position: relative; width: 36px; height: 14px; border: 0; border-radius: 7px; background: var(--field-line) none !important; cursor: pointer;
    transition: background-color .2s var(--ease);
}
.form-switch .form-check-input::after {
    content: ""; position: absolute; left: -2px; top: -3px; width: 20px; height: 20px; border-radius: 50%; background: #fafafa; box-shadow: var(--shadow-1);
    transition: transform .2s var(--ease), background-color .2s var(--ease);
}
.form-switch .form-check-input:checked { background-color: color-mix(in srgb, var(--primary) 50%, transparent) !important; }
.form-switch .form-check-input:checked::after { transform: translateX(20px); background: var(--primary); }
.form-switch .form-check-input:focus-visible::after { box-shadow: var(--shadow-1), 0 0 0 10px color-mix(in srgb, var(--primary) 12%, transparent); }
.plate-input { height: 48px; font-size: var(--fs-20); font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }
.plate-input::placeholder { font-weight: 400; letter-spacing: 1px; }
@media (pointer: coarse) {
    .form-control, .form-select { font-size: var(--fs-16); }
    .form-control.sm, .form-select.sm { height: 40px; }
    .plate-input { height: 52px; font-size: var(--fs-20); }
}
.form-actions {
    display: flex; gap: 8px; justify-content: flex-end; align-items: center;
    padding: 12px 16px; border-top: 1px solid var(--divider-2); background: var(--panel);
    border-radius: 0 0 var(--radius) var(--radius); position: sticky; bottom: 0; z-index: 5;
}
@media (max-width: 991.98px) {
    .form-actions { bottom: var(--bottom-nav); }
    .form-actions .btn { flex: 1 1 auto; min-width: 0; --bs-btn-padding-x: 8px; }
}
.form-narrow { max-width: 800px; }
/* число с кнопками − + */
.stepper { position: relative; display: flex; align-items: stretch; border: 1px solid var(--field-line); border-radius: var(--radius-s); }
.stepper:hover { border-color: var(--field-line-hover); }
.stepper:focus-within { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.stepper > button { flex: 0 0 36px; border: 0; background: transparent; color: var(--text-2); padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-s); }
.stepper > button:hover { background: var(--hover); color: var(--text); }
.stepper > button .mi { font-size: 18px; }
.stepper .form-control { flex: 1 1 0; min-width: 0; height: 46px; padding: 0 2px; border: 0 !important; box-shadow: none !important; background: transparent; text-align: center; }
.stepper .suffix { align-self: center; color: var(--text-2); margin-left: -2px; padding-right: 2px; }
/* поле с единицей справа */
.affix { position: relative; }
.affix .form-control { padding-right: 44px; }
.affix .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
/* список + свой вариант */
.combo { position: relative; }
.combo .form-control { padding-right: 36px; }
.combo-btn { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 34px; border: 0; background: transparent; color: var(--text-2); padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-s); }
.combo-btn:hover { background: var(--hover); }
.combo-menu { position: absolute; top: calc(100% + 4px); left: 0; min-width: 100%; z-index: 1060; background: var(--menu); border-radius: var(--radius-s); box-shadow: var(--shadow-3); padding: 8px 0; max-height: 264px; overflow-y: auto; }
.combo-menu button { display: block; width: 100%; border: 0; background: none; text-align: left; padding: 6px 12px; min-height: 36px; color: var(--text); white-space: nowrap; }
.combo-menu button:hover { background: var(--hover); }
.combo-menu button[hidden] { display: none; }
@media (pointer: coarse) { .stepper > button { flex-basis: 44px; } .combo-menu button { min-height: 44px; } }
.item-total { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--divider); font-size: var(--fs-16); }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
    flex: 1 1 160px; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
    border: 1px solid var(--divider); border-radius: var(--radius); padding: 10px 12px; transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.choice label:hover { background: var(--hover-2); }
.choice label .t { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.choice label .t .mi { color: var(--text-2); }
.choice input:checked + label { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); background: var(--primary-light); }
.choice input:checked + label .t, .choice input:checked + label .t .mi { color: var(--primary-dark); }
.choice input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 575.98px) { .choice.compact .mi { display: none; } }
.choice.compact { flex-wrap: nowrap; }
.choice.compact label { flex: 1 1 0; align-items: center; padding: 8px; }
.found { border: 1px solid var(--primary-border); background: var(--primary-light); border-radius: var(--radius); padding: 12px 16px; }
.found .row1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Главная ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { display: block; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 12px 16px; color: var(--text); transition: box-shadow .28s var(--ease); }
a.stat:hover { box-shadow: var(--shadow-2); color: var(--text); text-decoration: none; }
.stat .v { font-size: var(--fs-20); font-weight: 500; line-height: 28px; white-space: nowrap; }
.stat .v .of { color: var(--text-2); font-weight: 400; }
.stat .l { color: var(--text-2); font-size: var(--fs-12); line-height: 16px; margin-top: 2px; }
.stat.ok .v { color: var(--success); }
.stat.warn .v { color: var(--warning); }
.stat.err .v { color: var(--error); }

/* ---------- Канбан ---------- */
.board-outer { position: relative; margin: 0 -24px; }
/* посветление по краям: дальше есть ещё колонки */
.board-outer::before, .board-outer::after { content: ""; position: absolute; top: 0; bottom: 20px; width: 96px; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .15s; }
.board-outer::after { right: 0; background: linear-gradient(to left, var(--bg) 8%, transparent); }
.board-outer::before { left: 0; background: linear-gradient(to right, var(--bg) 8%, transparent); }
.board-outer.more-right::after, .board-outer.more-left::before { opacity: 1; }
.board-wrap { overflow-x: auto; padding: 0 24px 8px; -webkit-overflow-scrolling: touch; cursor: grab; }
.board-wrap.panning { cursor: grabbing; user-select: none; }
.board-wrap .order-card { cursor: pointer; }
.board { display: flex; gap: 12px; align-items: flex-start; min-height: 60vh; }
.board-col {
    flex: 0 0 280px; background: var(--hover); border-radius: var(--radius); display: flex; flex-direction: column;
    max-height: calc(100vh - var(--appbar) - 160px);
}
/* пустая колонка сложена в узкую полоску */
@media (min-width: 992px) {
    .board-col.empty-col { flex: 0 0 44px; min-height: 240px; }
    .board-col.empty-col .board-col-head { writing-mode: vertical-rl; padding: 12px; color: var(--text-2); font-weight: 400; }
    .board-col.empty-col .board-col-head .sum { display: none; }
    .board-col.empty-col .board-cards { padding: 0; min-height: 120px; }
    .board-col.empty-col .order-card { width: 44px; overflow: hidden; }
}
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; font-weight: 500; }
.board-col-head .cnt { color: var(--text-2); font-weight: 400; }
.board-col-head .sum { margin-left: auto; color: var(--text-2); font-weight: 400; font-size: var(--fs-12); }
.board-cards { flex: 1 1 auto; overflow-y: auto; min-height: 64px; display: flex; flex-direction: column; gap: 8px; padding: 0 8px 8px; }
.order-card {
    display: block; background: var(--card); border-radius: var(--radius); padding: 12px; color: var(--text);
    box-shadow: var(--shadow-1); cursor: grab; transition: box-shadow .28s var(--ease);
}
.order-card:hover { box-shadow: var(--shadow-2); color: var(--text); text-decoration: none; }
.order-card .r1 { display: flex; align-items: center; gap: 8px; }
.order-card .r1 .num { margin-left: auto; color: var(--text-2); font-size: var(--fs-12); }
.order-card .car { font-weight: 500; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-card .cust { color: var(--text-2); font-size: var(--fs-12); line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-card .txt { color: var(--text-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.order-card .foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: var(--fs-12); color: var(--text-2); }
.order-card .foot .when { display: inline-flex; align-items: center; gap: 4px; }
.order-card .foot .when.late { color: var(--error); }
.order-card .foot .money { margin-left: auto; color: var(--text); font-size: var(--fs-14); font-weight: 500; }
.order-card.sortable-ghost { opacity: .4; }
.order-card.sortable-chosen { box-shadow: var(--shadow-3); }
@media (max-width: 991.98px) {
    .board-outer { margin: 0 -16px; }
    .board-outer::before, .board-outer::after { width: 48px; }
    .board-wrap { padding: 0 16px 8px; scroll-snap-type: x proximity; scroll-padding-left: 16px; }
    .board-outer::before { display: none; }
    .board-col, .board-col.empty-col { flex-basis: calc(100vw - 56px); max-height: none; scroll-snap-align: start; }
}

/* ---------- Календарь ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--panel); box-shadow: var(--shadow-1); border-radius: var(--radius); }
.cal-day { padding: 0 8px 12px; min-height: 55vh; min-width: 0; display: flex; flex-direction: column; }
.cal-day + .cal-day { border-left: 1px solid var(--divider-2); }
.cal-day.weekend { background: var(--hover-2); }
.cal-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; color: var(--text-2); }
.cal-day.today .cal-head span { color: var(--primary-dark); font-weight: 500; }
.cal-list { display: flex; flex-direction: column; gap: 8px; min-height: 80px; flex: 1 0 auto; }
.cal-item { display: block; border: 1px solid var(--divider); border-left: 3px solid var(--c); border-radius: var(--radius-s); padding: 6px 8px; background: var(--card); color: var(--text); overflow: hidden; }
.cal-item:hover { background: var(--hover-2); color: var(--text); text-decoration: none; }
.cal-item .tm { font-weight: 500; }
.cal-item .who, .cal-item .txt { font-size: var(--fs-12); line-height: 16px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item .who { color: var(--text); margin-top: 2px; }
.cal-item .car-id { gap: 4px; }
.cal-item.late .tm { color: var(--error); }
.cal-sub { color: var(--text-2); font-size: var(--fs-12); margin: 12px 0 4px; }
.cal-item.out { margin-bottom: 8px; }
@media (max-width: 991.98px) {
    .cal { display: block; }
    .cal-day { min-height: 0; padding: 0 16px 12px; }
    .cal-day + .cal-day { border-left: 0; border-top: 1px solid var(--divider-2); }
    .cal-list { min-height: 8px; }
    .cal-day.free { padding-bottom: 0; }
}

/* ---------- Карточка заказа ---------- */
.head { padding: 16px; }
.head-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.head-top .num { color: var(--text-2); }
.head-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.head-title .t { font-size: var(--fs-20); font-weight: 500; line-height: 28px; color: var(--text); }
.head-title a.t:hover { text-decoration: none; color: var(--primary-dark); }
.head-contact { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; margin-top: 8px; }
.head-contact .who { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.head-contact .who .mi { color: var(--text-2); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px 24px; margin-top: 16px; }
@media (max-width: 575.98px) { .facts { grid-template-columns: 1fr 1fr; gap: 12px 16px; } }
.fact .l { color: var(--text-2); font-size: var(--fs-12); line-height: 16px; margin-bottom: 4px; }
.fact .v { min-height: 20px; }
.fact .form-control.sm { border-color: var(--divider); }
.fact .form-control.sm:hover { border-color: var(--field-line-hover); }
.fact .form-control.sm:focus { border-color: var(--primary); }
.fact .form-select.sm { border-color: var(--divider); }
.fact.late .whenf .form-control { color: var(--error); }
.fact .v.big { font-size: var(--fs-16); font-weight: 500; }
.steps { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; border-top: 1px solid var(--divider-2); scrollbar-width: thin; }
.steps form { flex: 0 0 auto; margin: 0; }
.steps button {
    display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 16px;
    border: 0; background: var(--divider-2); color: var(--text-2); font-size: var(--fs-14); white-space: nowrap; transition: background-color .15s var(--ease);
}
.steps button:hover { background: var(--divider); color: var(--text); }
.steps button .dot { opacity: .45; }
.steps button.past { color: var(--text); }
.steps button.past .dot { opacity: 1; }
.steps button.cur { background: var(--primary-light); border-color: transparent; color: var(--primary-dark); font-weight: 500; }
.steps button.cur .dot { opacity: 1; }
.steps .cancel { margin-left: auto; }
.steps .cancel button { color: var(--error); background: transparent; }
.steps .cancel button:hover { background: var(--error-bg); }
.work {
    display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 12px 16px;
    border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow-1);
}
.work.running { background: var(--success-bg); }
.work .grow { flex: 1 1 240px; min-width: 0; }
.work .t { font-size: var(--fs-16); font-weight: 500; line-height: 24px; }
.work .s { color: var(--text-2); }
@media (max-width: 575.98px) { .work .btn { flex: 1 1 100%; } }
.tl-i { position: relative; padding: 0 0 20px 32px; }
.tl-i::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--divider-2); }
.tl-i:last-child { padding-bottom: 0; }
.tl-i:last-child::before { display: none; }
.tl-i > .avatar { position: absolute; left: 0; top: 0; }
.tl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 24px; }
.tl-head .who { font-weight: 500; }
.tl-head .when { color: var(--text-2); font-size: var(--fs-12); }
.tl-body { margin-top: 4px; }
.stage { margin-top: 12px; }
.stage-t { font-weight: 500; }
.tl-rec { display: flex; gap: 8px; margin-top: 12px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--warning-bg); }
.tl-rec .mi { color: var(--warning); font-size: 18px; }
details.raw { margin-top: 8px; }
details.raw summary { color: var(--text-2); font-size: var(--fs-12); cursor: pointer; }
details.raw div { color: var(--text-2); margin-top: 4px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 8px; }
.photos .ph { position: relative; }
.photos a { display: block; aspect-ratio: 1; border-radius: var(--radius-s); overflow: hidden; background: var(--hover); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos .del { position: absolute; top: 4px; right: 4px; margin: 0; }
.photos .del button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(32,33,36,.6); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.photos .del .mi { font-size: 18px; }
.totals { margin-left: auto; max-width: 320px; padding: 8px 0 0; }
.totals .tr { display: flex; justify-content: space-between; gap: 16px; padding: 4px 0; color: var(--text-2); }
.totals .tr span:last-child { color: var(--text); }
.totals .tr.grand { border-top: 1px solid var(--divider); margin-top: 4px; padding-top: 8px; font-size: var(--fs-16); font-weight: 500; color: var(--text); }
.txt-field + .txt-field { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--divider-2); }
.txt-field .lbl { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--fs-12); line-height: 16px; min-height: 32px; }
.txt-field .lbl .hint { flex: 1 1 auto; }
.txt-field .lbl .icon-btn { margin-left: auto; }
.txt-field .val { white-space: pre-line; cursor: pointer; }
.txt-field .val.none { color: var(--text-3); }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.hist-row .when { color: var(--text-2); font-size: var(--fs-12); white-space: nowrap; flex: 0 0 auto; }

/* ---------- Нижняя навигация и FAB (телефон) ---------- */
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    height: calc(var(--bottom-nav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--panel); box-shadow: var(--shadow-3); display: flex;
}
.bottom-nav a { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-2); font-size: var(--fs-12); line-height: 16px; min-width: 0; }
.bottom-nav a span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
.bottom-nav a .mi { font-size: 24px; }
.bottom-nav a:hover { text-decoration: none; color: var(--text); }
.bottom-nav a.active { color: var(--primary-dark); }
.fab {
    position: fixed; right: 16px; bottom: calc(var(--bottom-nav) + 16px + env(safe-area-inset-bottom)); z-index: 1030;
    width: 56px; height: 56px; border-radius: 50%; background: var(--primary); color: var(--on-primary);
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-fab);
}
.fab .mi { font-size: 24px; }
.fab:hover { color: var(--on-primary); background: var(--primary-hover); }

/* ---------- Snackbar ---------- */
.snackbar {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1090;
    min-width: 344px; max-width: 672px; padding: 14px 16px; border-radius: var(--radius-s);
    background: var(--snackbar); color: var(--on-snackbar); box-shadow: var(--shadow-fab); transition: opacity .2s; animation: snack .15s var(--ease);
}
@keyframes snack { from { opacity: 0; scale: .9; } }
.snackbar.hide { opacity: 0; pointer-events: none; }
@media (max-width: 991.98px) {
    .snackbar { left: 8px; right: 8px; transform: none; min-width: 0; max-width: none; bottom: calc(var(--bottom-nav) + 8px + env(safe-area-inset-bottom)); }
}

/* ---------- Диалоги ---------- */
.modal-content { background: var(--menu); --surface: var(--menu); border: 0; border-radius: var(--radius); box-shadow: var(--shadow-24); }
.modal-header { border: 0; padding: 20px 24px 8px; }
.modal-title { font-size: var(--fs-20); font-weight: 500; line-height: 28px; }
.modal-body { padding: 8px 24px 16px; }
.modal-footer { border: 0; padding: 8px 16px 16px; gap: 8px; }
.modal-footer > * { margin: 0; }
.modal-header .icon-btn { margin: -4px -8px -4px auto; }
#work:not(:has(*)) { display: none; }
@media (max-width: 575.98px) { .modal-fullscreen-sm-down .modal-content { border-radius: 0; } }
.spinner-border-sm { width: 16px; height: 16px; border-width: 2px; }

/* ---------- Вход ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 420px; background: var(--panel); box-shadow: var(--shadow-1); border-radius: var(--radius); padding: 40px 40px 32px; }
.login-box .logo { padding: 0; margin-bottom: 24px; }
.login-box h1 { margin-bottom: 4px; }
.login-box .page-sub { margin-bottom: 24px; }
.login-foot { width: 100%; max-width: 420px; display: flex; gap: 4px; margin-top: 8px; }
.login-foot button { border: 0; background: none; color: var(--text-2); font-size: var(--fs-12); padding: 8px; border-radius: var(--radius-s); }
.login-foot button:hover { background: var(--hover); }
.login-foot button.on { color: var(--primary-dark); font-weight: 500; }
@media (max-width: 575.98px) {
    .login { justify-content: flex-start; padding-top: 48px; }
    .login-box { box-shadow: none; background: none; --surface: var(--bg); padding: 0 8px; }
    .login-foot { padding: 0 8px; }
}

/* ---------- Волна от нажатия, полоса загрузки ---------- */
.ripple-layer { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .16; transform: scale(0); animation: ripple .55s var(--ease) forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
.progress-top { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 2000; overflow: hidden; background: color-mix(in srgb, var(--primary) 24%, transparent); animation: show .2s .25s both; }
.progress-top[hidden] { display: none; }
.progress-top::after { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; background: var(--primary); animation: progress 1.4s var(--ease) infinite; }
@keyframes progress { to { left: 100%; } }
@keyframes show { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ripple, .snackbar { animation: none; } }

/* ---------- Выбор даты и времени ---------- */
.whenf { position: relative; }
.whenf > .form-control { padding-right: 40px; cursor: pointer; }
.whenf > .mi { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--text-2); cursor: pointer; }
.whenf > .form-control.sm { padding-right: 34px; }
.whenf > .form-control.sm + .mi { right: 8px; }
.when-layer { position: fixed; inset: 0; z-index: 1080; pointer-events: none; }
.when-pop { position: absolute; pointer-events: auto; background: var(--menu); --surface: var(--menu); border-radius: var(--radius); box-shadow: var(--shadow-3); padding: 12px; animation: show .12s var(--ease); }
.when-quick { display: flex; gap: 8px; margin-bottom: 8px; }
.when-main { display: flex; gap: 16px; }
.when-cal { width: 280px; }
.when-head { display: flex; align-items: center; justify-content: space-between; height: 40px; }
.when-title { border: 0; background: none; color: var(--text); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 4px; }
.when-title::first-letter { text-transform: uppercase; }
.when-title:hover { background: var(--hover); }
.when-days { display: grid; grid-template-columns: repeat(7, 40px); text-align: center; }
.when-days span { font-size: var(--fs-12); color: var(--text-2); line-height: 28px; }
.when-days button { width: 36px; height: 36px; margin: 1px 2px; border: 0; border-radius: 50%; background: none; color: var(--text); padding: 0; }
.when-days button.we { color: var(--text-2); }
.when-days button.out { color: var(--text-3); opacity: .6; }
.when-days button.today { box-shadow: inset 0 0 0 1px var(--primary); color: var(--primary-dark); }
.when-days button:hover, .when-hours button:hover, .when-years button:hover { background: var(--hover); }
.when-days button.on, .when-hours button.on, .when-years button.on { background: var(--primary); color: var(--on-primary); opacity: 1; }
.when-hours { display: grid; grid-template-columns: repeat(3, 60px); grid-auto-rows: 32px; gap: 2px; align-content: start; max-height: 300px; }
.when-hours button, .when-years button { border: 0; border-radius: 16px; background: none; color: var(--text); padding: 0; height: 32px; }
.when-years { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; height: 266px; overflow-y: auto; }
.when-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.when-typed { width: 112px; }
@media (max-width: 575.98px) {
    .when-layer { pointer-events: auto; background: rgba(0,0,0,.32); }
    .when-pop { left: 0 !important; right: 0; bottom: 0; top: auto !important; border-radius: 8px 8px 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); max-height: 96vh; overflow-y: auto; }
    .when-main { flex-direction: column; gap: 8px; }
    .when-cal { width: 100%; }
    .when-days { grid-template-columns: repeat(7, 1fr); }
    .when-days button { margin: 0 auto; }
    .when-hours { grid-template-columns: repeat(6, 1fr); grid-auto-rows: 36px; border-top: 1px solid var(--divider-2); padding-top: 8px; }
    .when-hours button { height: 36px; border-radius: 18px; }
}

/* ---------- Фотогалерея ---------- */
.gal { position: relative; padding-bottom: 16px; }
.gal-track { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding: 16px; padding: 0 16px 4px; scrollbar-width: thin; }
.gal-i { position: relative; flex: 0 0 auto; scroll-snap-align: start; }
.gal-i > a { display: block; height: 160px; min-width: 120px; border-radius: var(--radius); overflow: hidden; background: var(--hover); position: relative; }
.gal-i img { height: 100%; width: auto; min-width: 120px; max-width: 320px; object-fit: cover; display: block; }
.gal-i a > span { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 8px 6px; font-size: var(--fs-12); line-height: 16px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.gal-i .del, .gal-i .del button { position: absolute; top: 0; right: 0; margin: 0; }
.gal-i .del button { top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(32,33,36,.6); color: #fff; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.gal-i .del .mi { font-size: 18px; }
.gal-nav { position: absolute; top: 60px; z-index: 3; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--menu); color: var(--text); box-shadow: var(--shadow-2); display: flex; align-items: center; justify-content: center; padding: 0; }
.gal-nav[hidden] { display: none; }
.gal-nav.prev { left: 8px; } .gal-nav.next { right: 8px; }
@media (pointer: coarse) { .gal-nav { display: none; } }
@media (max-width: 575.98px) { .gal-i > a { height: 128px; } }
.lb { position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,0,.92); display: flex; flex-direction: column; animation: show .15s var(--ease); outline: 0; }
.lb-open { overflow: hidden; }
.lb-top { display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 8px 0 16px; color: #fff; flex: 0 0 auto; }
.lb-cap { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .icon-btn { color: #fff; } .lb .icon-btn:hover { background: rgba(255,255,255,.16); }
.lb .btn-text { --bs-btn-color: #8ab4f8; --bs-btn-hover-color: #aecbfa; --bs-btn-hover-bg: rgba(255,255,255,.1); }
.lb-track { flex: 1 1 auto; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-track > div { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; padding: 0 8px 16px; min-height: 0; height: 100%; }
.lb-track img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-nav { position: absolute; top: 50%; margin-top: -20px; background: rgba(0,0,0,.4); }
.lb-nav.prev { left: 12px; } .lb-nav.next { right: 12px; }

/* ---------- Приём товара: строки ---------- */
.rline + .rline { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--divider-2); }

/* ---------- Подсказка «на робочий стіл» ---------- */
.install { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bottom-nav) + 8px + env(safe-area-inset-bottom)); z-index: 1040;
    display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 16px; border-radius: var(--radius); background: var(--menu); box-shadow: var(--shadow-3); }
.install > .mi { color: var(--primary); }
.install .grow { flex: 1 1 auto; min-width: 0; }
@media (min-width: 992px) { .install { display: none; } }

/* ---------- QR, PIN ---------- */
.qr { width: 120px; height: 120px; background: #fff; padding: 4px; border-radius: var(--radius-s); flex: 0 0 auto; image-rendering: pixelated; }
.pin { border: 0; background: none; color: var(--text); font-weight: 500; padding: 2px 4px; display: inline-flex; align-items: center; gap: 8px; }
.pin .mi { color: var(--text-2); }

/* ---------- Переключатель темы, полный экран ---------- */
.dropdown-item.switch { cursor: pointer; }
.dropdown-item.switch .form-switch { margin: 0 0 0 auto; padding: 0; min-height: 0; line-height: 0; }
.dropdown-item.switch .form-check-input { margin: 0; float: none; cursor: pointer; }
.fs-btn { display: none; }
@media (min-width: 992px) and (hover: hover) and (pointer: fine) { .fs-btn { display: inline-flex; } }
#fsFrame { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; z-index: 3000; background: var(--bg); visibility: hidden; }
body.fs-shell { overflow: hidden; }
body.fs-shell > :not(#fsFrame) { display: none !important; }
body.fs-shell > #fsFrame { visibility: visible; }
