/* Callobok — Main Styles */

:root {
    /* Brand palette — портал-стиль (тёмный хедер, оранжевый акцент) */
    --primary: #ff7234;            /* orange — главный акцент */
    --primary-dark: #e65a18;
    --primary-light: #fff3ec;      /* лёгкий оранжевый тинт для hover/active */
    --primary-rgb: 255,114,52;     /* для rgba() focus-теней */

    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0ea5e9;
    --info-light: #f0f9ff;
    --secondary: #6b7280;
    --secondary-light: #f4f5f7;

    --bg: #f5f6f8;                 /* мягкий серый фон */
    --bg-card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #eef0f3;

    /* Тёмный хедер и тёмные шапки таблиц — портал-look */
    --header-bg: #333333;
    --header-text: #e9e9e9;
    --header-text-muted: #9c9c9c;
    --header-divider: #232323;
    --table-head-bg: #333333;
    --table-head-text: #f5f5f5;

    --radius: .25rem;
    --radius-sm: .25rem;
    --radius-lg: .25rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);

    --header-h: 58px;
    --sidenav-w: 240px;
    --bottomnav-h: 64px;
    --transition: 0.2s ease;
    /* Контент центрируется в максимуме 1800px, как у портала
       (div.container.mx-auto с max-width 1800). По бокам — минимум 24px. */
    --page-max: 1800px;
    --page-gutter: max(24px, calc((100vw - var(--page-max)) / 2));
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: .875rem;          /* 14px — как у портала (--text-sm) */
    color: #333;                  /* --color-dark на портале */
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* ─── Top Header (dark, portal-style) ────────────── */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-divider);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--page-gutter);
    z-index: 100;
    box-shadow: 0 1px 0 rgba(0,0,0,0.4);
}

.top-header__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: var(--header-text);
}
.top-header__logo:hover { color: var(--primary); }
.logo-icon {
    display: inline-flex;
    align-items: center;
    padding: 6px;             /* как .p-1.5 на портале — 6px вокруг */
}
.logo-icon img { width: 96px; height: 30px; display: block; }

/* ─── Horizontal top nav (desktop) ────────────────── */
.top-nav {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-left: 28px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    height: 100%;
}
.top-nav::-webkit-scrollbar { display: none; }

.top-nav__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    padding: 0;
    height: 100%;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
    position: relative;
}
.top-nav__item:hover,
.top-nav__item.active {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.top-nav__item .badge {
    transform: translateY(-1px);
}

/* Page heading with icon */
.page-heading { display: flex; align-items: center; gap: 10px; }
.page-heading .page-heading__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: var(--primary-light); color: var(--primary); flex-shrink: 0;
}
.page-heading .page-heading__icon .material-icons-round { font-size: 22px; }
/* Счётчик-бейдж рядом с заголовком страницы — крупнее дефолтного .badge,
   чтобы не выглядел мелким на фоне h1. */
.page-heading h1 .badge {
    font-size: 14px;
    padding: 3px 10px;
    vertical-align: middle;
    margin-left: 6px;
}

/* Когда заголовок страницы стоит в одной строке с кнопкой «Назад» (.d-flex.items-center > [btn] + .page-heading),
   нижний отступ заголовка ломал визуальный центр — кнопка оказывалась ниже иконки/h1.
   Снимаем mb внутри строки и принудительно центрируем кнопку и сам page-heading. */
.d-flex.items-center > .page-heading,
.d-flex.items-center > .page-heading.mb-2 { margin-bottom: 0; align-self: center; }
.d-flex.items-center > .btn.btn-icon { align-self: center; }
.d-flex.items-center > .page-heading h1 { line-height: 36px; }

/* Inline icon helper (replaces emojis) */
.ico { display: inline-flex; align-items: center; vertical-align: middle; }
.ico .material-icons-round { font-size: 18px; margin-right: 4px; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--header-text);
    padding: 4px;
    border-radius: var(--radius-sm);
}
.menu-toggle:hover { background: rgba(255,255,255,0.08); }

.top-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--header-text-muted);
}
.user-info .material-icons-round { color: var(--header-text-muted); }
.user-name { font-weight: 500; color: var(--header-text); }

.btn-icon {
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: var(--radius-sm);
    color: var(--header-text-muted);
    transition: var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* ─── User menu (dropdown в хедере) ───────────────── */
.user-menu { position: relative; }
.user-menu__trigger {
    background: none;
    border: none;
    color: var(--header-text);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: var(--transition);
}
.user-menu__trigger:hover { background: rgba(255,255,255,0.08); }
.user-menu__trigger .material-icons-round { font-size: 30px; }

.user-menu__dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    padding: 6px;
    display: none;
    z-index: 200;
}
.user-menu.open .user-menu__dropdown { display: block; }

.user-menu__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 4px;
}
.user-menu__header-icon {
    font-size: 32px !important;
    color: var(--text-secondary);
}
.user-menu__header-text { min-width: 0; }
.user-menu__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-menu__role {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.user-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text);
    border-radius: var(--radius);
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition);
}
.user-menu__item:hover { background: var(--bg); color: var(--text); }
.user-menu__item .material-icons-round {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Кнопка "К компании" — на тёмном хедере должна быть на светлом тоне */
.top-header__right .btn-outline {
    background: rgba(255,255,255,0.08);
    color: var(--header-text);
    border-color: rgba(255,255,255,0.15);
}
.top-header__right .btn-outline:hover {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

/* ─── Side Navigation (mobile drawer) ─────────────── */
/* На десктопе скрыт — навигация в .top-nav внутри header.
   На <=768px показывается как выезжающий drawer (см. медиа-запрос ниже). */
.side-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidenav-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 90;
    padding: 12px 8px;
    transform: translateX(-100%);
    transition: transform var(--transition);
}

.side-nav__items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.side-nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}
.side-nav__item:hover {
    background: var(--secondary-light);
    color: var(--text);
}
.side-nav__item.active {
    background: var(--primary-light);
    color: var(--primary);
}
.side-nav__item .material-icons-round { font-size: 20px; }

.nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.3);
    z-index: 85;
}

/* ─── Bottom Navigation (mobile) ─────────────────── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-h);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 4px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    position: relative;
    transition: var(--transition);
}
.bottom-nav__item.active { color: var(--primary); }
.bottom-nav__item .material-icons-round { font-size: 22px; }

/* ─── Main Content ───────────────────────────────── */
.main-content {
    margin-left: 0;
    margin-top: var(--header-h);
    min-height: calc(100vh - var(--header-h));
    padding: 24px var(--page-gutter);
}

.page-content {
    max-width: none;     /* во всю ширину десктопа, как на портале */
    margin: 0 auto;
}

/* ─── Cards ──────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
}
.card + .card { margin-top: 16px; }

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 { font-size: 16px; font-weight: 600; }

.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--secondary-light);
}

/* ─── Buttons ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;   /* нормализация высоты: outline-варианты добавят цвет, остальные останутся прозрачными */
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.4;
    text-decoration: none;
    box-sizing: border-box;
    min-height: 38px;   /* единая высота обычных кнопок = высоте .form-control */
}
.btn .material-icons-round { font-size: 18px; line-height: 1; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; color: #fff; }
.btn-warning, a.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover, a.btn-warning:hover { background: var(--warning); color: #fff; opacity: 0.9; }
.btn-warning .material-icons-round { color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }
.btn-secondary { background: var(--secondary-light); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); color: var(--text); }
.btn-sm {
    padding: 0 10px !important;
    font-size: .8125rem;        /* 13px */
    height: 32px !important;
    min-height: 32px !important; /* перебивает .btn min-height:38px — иначе sm-кнопки вырастали бы */
    min-width: 32px !important;
    line-height: 1 !important;
    justify-content: center;
    box-sizing: border-box;
    vertical-align: middle;     /* выравнивание по центру строки, а не по baseline — чтобы кнопки в строке не плыли */
}
/* Иконки внутри action-кнопок — единый размер 18px, перебивает любые inline font-size */
.btn-sm > .material-icons-round {
    font-size: 18px !important;
    line-height: 1 !important;
}
/* Кнопка только с иконкой → квадрат 32×32.
   Ставится явным классом .btn-icon, а не magic :has — раньше правило ложно срабатывало
   при <button><span class="material-icons-round">x</span> Текст</button>, потому что CSS
   :only-child игнорирует text-nodes (текст «Добавить» рядом с иконкой не считается siblings),
   и кнопка схлопывалась в 32px с обрезанным текстом. */
.btn-sm.btn-icon {
    width: 32px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
    box-sizing: border-box;
    min-height: 38px;   /* единая высота полей = высоте обычных кнопок (.btn) */
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.18);
}
.form-control::placeholder { color: var(--text-muted); }

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 16px;
    align-items: flex-start;
}
.form-row > .form-group {
    flex: 0 0 240px;     /* фиксированная ширина: не растягиваем на весь блок */
    margin-bottom: 0;    /* отступ снизу делаем через row-gap */
    min-width: 0;
}
.form-row > .form-group--xs { flex: 0 0 100px; }   /* Дом / Корпус / Кв. */
.form-row > .form-group--sm { flex: 0 0 140px; }   /* Серия / Номер / Индекс */
.form-row > .form-group--md { flex: 0 0 200px; }   /* ИНН / КПП / ОГРН */
.form-row > .form-group--lg { flex: 0 0 380px; }   /* Улица / Банк */
.form-row > .form-group--xl { flex: 0 0 540px; }   /* Название организации */
.form-row > .form-group--fluid { flex: 1 1 240px; max-width: 540px; }

@media (max-width: 768px) {
    .form-row > .form-group,
    .form-row > .form-group[class*="--"] { flex: 1 1 100%; max-width: none; }
}

select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Tables ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;             /* 14px — как у портала (--text-sm) */
    line-height: calc(1.25 / .875); /* портал: --text-sm--line-height */
}
th, td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
th {
    font-weight: 600;
    color: var(--table-head-text);
    background: var(--table-head-bg);
    font-size: .875rem;
    text-transform: none;
    letter-spacing: 0.01em;
    border-bottom: none;
    height: 53px;
    padding-top: 0;
    padding-bottom: 0;
    vertical-align: middle;
}
th a, th a:hover { color: var(--table-head-text); }
tr:hover td { background: var(--secondary-light); }
td a { font-weight: 500; }

/* ─── Badges ─────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
}
.badge-primary   { background: var(--primary-light);  color: var(--primary); }
.badge-success   { background: var(--success-light);  color: var(--success); }
.badge-warning   { background: var(--warning-light);  color: var(--warning); }
.badge-danger    { background: var(--danger-light);    color: var(--danger); }
.badge-info      { background: var(--info-light);      color: var(--info); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary); }
.badge-sm { padding: 1px 6px; font-size: 10px; }
.badge-xs {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

/* ─── Alerts ─────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #bbf7d0; }
.alert-error, .alert-danger { background: var(--danger-light); color: var(--danger); border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--info-light); color: #0369a1; border: 1px solid #bae6fd; }
.alert-close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: 0.6; }
.alert-close:hover { opacity: 1; }

.flash-message { animation: fadeIn 0.3s ease; }

/* ─── Stat Cards ─────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
}
.stat-card__value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card__label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}
.stat-card__icon .material-icons-round { font-size: 22px; color: #fff; }

/* ─── Pagination ─────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    margin-top: 20px;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.pagination a:hover { background: var(--secondary-light); color: var(--text); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ─── Modal ──────────────────────────────────────── */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-backdrop.show { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--secondary-light); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border-light); display: flex; gap: 8px; justify-content: flex-end; }

/* ─── App dialogs (Modal.alert/confirm/prompt) ───────
   Программные попапы, заменяют системные window.alert/confirm/prompt.
   Поверх обычной .modal — но уже и аккуратнее, чтобы выглядели как
   диалог приложения, а не как полноценное модальное окно. */
.modal-backdrop.app-dialog {
    z-index: 250;
    background: rgba(33, 33, 33, 0.45);
    animation: appDialogFadeIn .12s ease-out;
}
.app-dialog__box {
    max-width: 440px;
    width: 100%;
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.18), 0 2px 4px rgba(0,0,0,0.08);
    animation: appDialogPopIn .15s ease-out;
}
.app-dialog__box .modal-header { padding: 14px 18px; }
.app-dialog__box .modal-header h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.app-dialog__box .modal-body   { padding: 14px 18px 8px; font-size: 14px; line-height: 1.5; color: var(--text-primary); }
.app-dialog__box .modal-footer { padding: 12px 18px; }
.app-dialog__text { white-space: normal; word-wrap: break-word; }
.app-dialog__input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}
.app-dialog__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 114, 52, 0.15);
}
@keyframes appDialogFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes appDialogPopIn  { from { transform: translateY(-8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ─── Search-specific styles ─────────────────────── */
.search-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 12px;
}
.search-inputs .separator { color: var(--text-muted); font-weight: 600; padding: 0 2px; }
.code-input, .num-input {
    width: 36px;
    height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}
.code-input:focus, .num-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.quick-codes {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.quick-codes .btn { font-size: 12px; padding: 4px 10px; }

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    transition: var(--transition);
}
.search-result-item:hover { background: var(--secondary-light); }
.search-result-number {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* Number grid — card layout */
.number-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 8px;
    padding: 12px;
}
.number-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all .15s ease;
    user-select: none;
    background: #fff;
}
.number-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 2px 8px rgba(99,102,241,.12);
}
.number-card.in-cart {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}
.number-card.in-cart:hover {
    background: #4338ca;
    border-color: #4338ca;
}
.number-card__num {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.01em;
}
.number-card__btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    color: var(--primary);
    background: var(--primary-light);
    transition: all .15s;
}
.number-card.in-cart .number-card__btn {
    color: #fff;
    background: rgba(255,255,255,.2);
}
@media (max-width: 600px) {
    .number-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; padding: 8px; }
    .number-card { padding: 8px 10px; }
    .number-card__num { font-size: 13px; }
}

/* Cart */
.cart-panel {
    background: var(--primary-light);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}
.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}
.cart-count { font-weight: 600; color: var(--primary); }
.cart-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.cart-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 12px;
    font-family: monospace;
}
.cart-item-remove {
    cursor: pointer;
    color: var(--danger);
    font-size: 14px;
    line-height: 1;
}

/* Region modal */
.region-list {
    max-height: 400px;
    overflow-y: auto;
}
.region-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}
.region-item:hover { background: var(--primary-light); }
.region-city { font-weight: 500; }
.region-code { font-family: monospace; color: var(--primary); font-weight: 600; }

/* ─── Status indicator (кружок на странице профиля) ── */
.status-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 50%;
    color: #fff;
}
.status-indicator .material-icons-round { font-size: 18px; }
.status-indicator--success { background: var(--success); }
.status-indicator--warning { background: var(--warning); }
.status-indicator--danger  { background: var(--danger); }

/* ─── Empty state ────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .material-icons-round { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state .btn .material-icons-round { font-size: 18px; margin-bottom: 0; opacity: 1; display: inline-flex; color: inherit; vertical-align: middle; }
.empty-state p { font-size: 14px; }

/* ─── Steps (wizard) ─────────────────────────────── */
.steps {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
}
.step {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 3px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}
.step.active { color: var(--primary); border-color: var(--primary); }
.step.completed { color: var(--success); border-color: var(--success); }
.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    margin-right: 6px;
}
.step.active .step-number { background: var(--primary); color: #fff; }
.step.completed .step-number { background: var(--success); color: #fff; }

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
    :root { --page-gutter: 16px; }

    .menu-toggle { display: flex; }

    /* На мобиле — горизонтальное меню прячем, открываем боковой drawer через menu-toggle */
    .top-nav { display: none; }

    .side-nav { box-shadow: var(--shadow-lg); }
    .side-nav.open { transform: translateX(0); }
    .nav-overlay.show { display: block; }

    .bottom-nav { display: flex; }

    .main-content {
        margin-bottom: var(--bottomnav-h);
        padding: 16px var(--page-gutter);
    }

    .top-header .user-name,
    .top-header .user-role,
    .btn-text { display: none; }

    .form-row { grid-template-columns: 1fr; }

    .stats-grid { grid-template-columns: repeat(2, 1fr); }

    .code-input, .num-input { width: 30px; height: 36px; font-size: 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .search-inputs { flex-wrap: wrap; }
}

/* ─── Animations ─────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Utils ──────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.font-mono { font-family: 'SF Mono', 'Consolas', monospace; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }       /* использовалась в разметке, но не была определена → flex по умолчанию растягивал кнопки */
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* Кнопки в flex-рядах не растягиваются по высоте (default align-items:stretch
   делал «Показать» выше соседних полей). Держим единую высоту .btn (38px), центр по вертикали.
   .btn-block (full-width) исключаем — у него важна ширина. */
.d-flex > .btn:not(.btn-block) { align-self: center; }
/* В рядах с выравниванием по низу (label сверху + поле) кнопка должна стоять
   на одной нижней линии с полями, а не по центру. */
.d-flex.items-end > .btn:not(.btn-block) { align-self: flex-end; }
/* form-group по умолчанию имеет margin-bottom:16px — в горизонтальном ряду это
   опускало кнопку (выровненную по flex-end) на 16px ниже поля. Обнуляем. */
.d-flex.items-end > .form-group,
.d-flex.items-center > .form-group { margin-bottom: 0; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Wizard Steps ──────────────────────────────── */
.steps { display: flex; gap: 4px; overflow-x: auto; }
.step {
    flex: 1; min-width: 0;
    padding: 10px 12px; border-radius: var(--radius);
    background: var(--card-bg); border: 2px solid var(--border);
    cursor: pointer; font-size: 13px; text-align: center;
    transition: all .2s; white-space: nowrap;
}
.step:hover { border-color: var(--primary-light); }
.step.active { border-color: var(--primary); background: rgba(79,70,229,.08); font-weight: 600; }
.step.completed { border-color: var(--success); background: rgba(16,185,129,.06); }
.step-number {
    display: inline-flex; width: 22px; height: 22px; border-radius: 50%;
    background: var(--border); color: var(--text-muted); font-size: 12px; font-weight: 700;
    align-items: center; justify-content: center; margin-right: 4px; vertical-align: middle;
}
.step.active .step-number { background: var(--primary); color: #fff; }
.step.completed .step-number { background: var(--success); color: #fff; }

/* ─── Empty State ───────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .material-icons-round { font-size: 48px; opacity: .4; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 15px; margin-bottom: 8px; }

/* ─── Extra ─────────────────────────────────────── */
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.card-footer { padding: 12px 16px; border-top: 1px solid var(--border); }

/* ─── Validation Error Highlight ────────────────── */
.input-error { border-color: #ea4335 !important; box-shadow: 0 0 0 2px rgba(234,67,53,.15) !important; }
.input-error:focus { border-color: #ea4335 !important; box-shadow: 0 0 0 3px rgba(234,67,53,.2) !important; }

/* ─── Missing Utility Classes ───────────────────── */
.gap-half { gap: 4px; }
.ml-1 { margin-left: 8px; }
.ml-2 { margin-left: 16px; }
.mr-1 { margin-right: 8px; }

/* ─── Responsive Tables ─────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive table { min-width: 600px; }
@media (max-width: 768px) {
    .table-responsive table { min-width: 500px; }
    .table th, .table td { padding: 8px 6px; font-size: 13px; }
}

/* ─── Card-body with tables: auto scroll on mobile ── */
.card-body > table, .card-body > .table-wrap > table { width: 100%; }
.card-body { overflow-x: auto; }

/* ─── Tab Buttons (shared: numbers, users, orders) ── */
.num-tabs { display:flex; gap:6px; flex-wrap:wrap; }
.num-tab {
    display:inline-flex; align-items:center; gap:6px;
    min-height:38px; box-sizing:border-box;   /* единая высота с кнопками и полями */
    padding:8px 16px; border-radius: var(--radius); font-size:14px; font-weight:500;
    background:var(--bg-card); border:1px solid var(--border); color:var(--text-secondary);
    text-decoration:none; cursor:pointer; transition:all .15s;
}
.num-tab:hover { border-color:var(--primary); color:var(--primary); }
.num-tab.active { background:var(--primary); border-color:var(--primary); color:#fff; }
.num-tab.active .num-tab__count { background:rgba(255,255,255,.25); color:#fff; }
.num-tab--free.active { background:var(--success); border-color:var(--success); }
.num-tab--occupied.active { background:var(--info); border-color:var(--info); }
.num-tab--pending.active { background:var(--warning); border-color:var(--warning); color:#000; }
.num-tab--pending.active .num-tab__count { color:#000; }
.num-tab--deleted.active { background:var(--secondary); border-color:var(--secondary); }
.num-tab__count {
    display:inline-flex; align-items:center; justify-content:center;
    min-width:22px; height:22px; padding:0 6px; border-radius: var(--radius);
    font-size:12px; font-weight:700; background:var(--border-light); color:var(--text-secondary);
}

/* ─── OKVED autocomplete ─────────────────────────── */
.okved-suggest {
    position: absolute; z-index: 1000; margin-top: 2px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(0,0,0,.08);
    max-height: 280px; overflow-y: auto; min-width: 320px; max-width: 640px;
    font-size: 13px;
}
.okved-suggest__item {
    padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border-light);
    line-height: 1.35; display: flex; gap: 8px; align-items: baseline;
}
.okved-suggest__item:last-child { border-bottom: none; }
.okved-suggest__item:hover { background: var(--secondary-light); }
.okved-suggest__item b { color: var(--primary); white-space: nowrap; min-width: 64px; }
.okved-suggest__item span { color: var(--text); }
.okved-suggest__empty { padding: 10px 12px; color: var(--text-muted); font-style: italic; font-size: 13px; }
