:root {
    --app-bg: #f4efe8;
    --app-surface: rgba(255, 255, 255, 0.84);
    --app-surface-strong: rgba(255, 255, 255, 0.94);
    --app-line: rgba(56, 67, 79, 0.1);
    --app-line-strong: rgba(185, 79, 22, 0.16);
    --app-text: #23313b;
    --app-muted: #667584;
    --app-accent: #d86b2d;
    --app-accent-strong: #b94f16;
    --app-success: #2e8d5f;
    --app-danger: #b23a3a;
    --app-blue: #2b5f9f;
    --app-shadow: 0 22px 48px rgba(26, 34, 45, 0.12);
}

html {
    scroll-behavior: smooth;
    /* Резервирует место для скроллбара перманентно.
       Скроллбар появляется/исчезает без сдвига контента. */
    scrollbar-gutter: stable;
}

body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Bootstrap 4 при открытии модалки добавляет padding-right inline-стилем
   (компенсация ширины скроллбара). С scrollbar-gutter: stable это не нужно —
   layout уже стабилен. !important побеждает inline-стиль Bootstrap. */
body.modal-open {
    padding-right: 0 !important;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible {
    outline: 3px solid rgba(43, 95, 159, 0.34);
    outline-offset: 2px;
}

.container {
    position: relative;
    overflow: hidden;
}

.container::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at top right, rgba(216, 107, 45, 0.06), transparent 26%),
        radial-gradient(circle at bottom left, rgba(43, 95, 159, 0.05), transparent 24%);
}

.container > * {
    position: relative;
    z-index: 1;
}

.app-fade-in {
    animation: appFadeIn 0.28s ease-out;
}

@keyframes appFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding: 18px 20px;
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(255, 249, 244, 0.94), rgba(255, 255, 255, 0.82)),
        linear-gradient(135deg, rgba(216, 107, 45, 0.08), rgba(43, 95, 159, 0.06));
    border: 1px solid var(--app-line-strong);
    box-shadow: 0 14px 30px rgba(24, 34, 46, 0.06);
}

.page-hero__content {
    min-width: 0;
}

.page-hero__title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    color: #20303b;
    font-size: clamp(1.5rem, 2vw, 2rem);
    font-weight: 800;
    line-height: 1.05;
}

.page-hero__title-icon {
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--app-accent), var(--app-accent-strong));
    box-shadow: 0 12px 24px rgba(185, 79, 22, 0.24);
}

.page-hero__title-icon svg {
    width: 22px;
    height: 22px;
}

.page-hero__subtitle {
    margin: 7px 0 0;
    max-width: 780px;
    color: var(--app-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

.page-hero__meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(43, 95, 159, 0.14);
    color: #2c4f7d;
    font-size: 0.82rem;
    font-weight: 800;
    white-space: nowrap;
}

.surface-card,
.toolbar-card,
.form-shell,
.empty-state,
.summary-card {
    background: var(--app-surface-strong);
    border: 1px solid var(--app-line);
    border-radius: 22px;
    box-shadow: 0 14px 30px rgba(24, 34, 46, 0.06);
}

.surface-card,
.form-shell,
.summary-card,
.toolbar-card {
    content-visibility: auto;
    contain-intrinsic-size: 1px 600px;
}

.toolbar-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.summary-card {
    margin-top: 18px;
    padding: 14px 16px;
}

.summary-card__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.summary-card__item {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(247, 249, 252, 0.9);
    border: 1px solid rgba(56, 67, 79, 0.07);
}

.summary-card__label {
    display: block;
    margin-bottom: 4px;
    color: var(--app-muted);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.summary-card__value {
    display: block;
    color: var(--app-text);
    font-size: 1.1rem;
    font-weight: 800;
}

.page-status {
    display: none;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(56, 67, 79, 0.1);
    font-weight: 700;
    line-height: 1.45;
}

.page-status.is-visible {
    display: block;
}

.page-status--error {
    background: rgba(255, 241, 241, 0.92);
    border-color: rgba(178, 58, 58, 0.14);
    color: #a53535;
}

.page-status--success {
    background: rgba(240, 251, 245, 0.94);
    border-color: rgba(46, 141, 95, 0.16);
    color: #246c49;
}

.cell-truncate-200 {
    max-width: 200px;
}

.cell-nowrap {
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.is-pointer-blocked {
    pointer-events: none;
    opacity: 0.45;
    cursor: default;
}

.toolbar-chip-group,
.filter-chip-group,
.equipment-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-chip,
.filter-chip,
.equipment-toggle .btn {
    min-height: 42px;
    padding: 10px 16px;
    border-radius: 999px;
    font-weight: 700;
}

.filter-chip.btn-outline-primary:not(.btn-primary),
.equipment-toggle .btn-outline-primary {
    background: rgba(255, 255, 255, 0.88);
}

.empty-state {
    padding: 22px 20px;
    text-align: center;
    color: var(--app-muted);
    line-height: 1.6;
}

.empty-state__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(216, 107, 45, 0.12), rgba(43, 95, 159, 0.1));
    color: #91501f;
}

.empty-state__icon svg {
    width: 26px;
    height: 26px;
}

.empty-state strong {
    display: block;
    margin-bottom: 6px;
    color: var(--app-text);
    font-size: 1rem;
}

.form-shell {
    padding: 22px;
}

.form-shell__grid {
    display: grid;
    gap: 18px;
}

.form-shell__grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-panel {
    padding: 18px;
    border-radius: 18px;
    background: rgba(247, 250, 253, 0.9);
    border: 1px solid rgba(56, 67, 79, 0.08);
}

.form-panel__title {
    margin: 0 0 14px;
    color: #31465e;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.form-panel label {
    display: block;
    margin-bottom: 6px;
    color: #31465e;
    font-size: 0.9rem;
    font-weight: 700;
}

.form-panel .form-control,
.form-panel .custom-select {
    min-height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(56, 67, 79, 0.12);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.form-panel textarea.form-control {
    min-height: 112px;
}

.form-panel .form-control:focus,
.form-panel .custom-select:focus {
    border-color: rgba(216, 107, 45, 0.34);
    box-shadow: 0 0 0 0.2rem rgba(216, 107, 45, 0.12);
}

.form-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.form-actions-note {
    color: var(--app-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.suggestions-list {
    margin-top: 10px;
    padding: 8px;
    border: 1px solid rgba(43, 95, 159, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 16px 28px rgba(24, 34, 46, 0.08);
}

.suggestion-item {
    border: 0;
    border-radius: 12px;
    margin-bottom: 4px;
    color: var(--app-text);
    font-weight: 600;
    cursor: pointer;
}

.suggestion-item:last-child {
    margin-bottom: 0;
}

.suggestion-item:hover,
.suggestion-item:focus {
    background: rgba(216, 107, 45, 0.08);
}

.section-label {
    margin: 28px 0 12px;
    color: #243444;
    font-size: 1.1rem;
    font-weight: 800;
}

.queue-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(56, 67, 79, 0.1);
    background: rgba(255, 255, 255, 0.86);
    font-size: 0.8rem;
    font-weight: 800;
    color: #31465e;
}

.queue-type-badge--electric {
    color: #1a6a48;
    border-color: rgba(46, 141, 95, 0.18);
    background: rgba(239, 251, 245, 0.92);
}

.queue-type-badge--bike {
    color: #92511f;
    border-color: rgba(216, 107, 45, 0.18);
    background: rgba(255, 247, 241, 0.92);
}

.table-icon-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
}

.table-icon-btn svg {
    width: 20px;
    height: 20px;
}

.auth-shell {
    max-width: 460px;
    margin: 2.2rem auto;
}

.auth-card {
    padding: 24px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(56, 67, 79, 0.1);
    box-shadow: var(--app-shadow);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.auth-brand__mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(135deg, #21303b, #4a5a69);
}

.auth-brand__title {
    margin: 0;
    color: #20303b;
    font-size: 1.35rem;
    font-weight: 800;
}

.auth-brand__subtitle {
    margin: 5px 0 0;
    color: var(--app-muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.auth-card label {
    font-weight: 700;
    color: #31465e;
}

.auth-card .form-control {
    min-height: 48px;
    border-radius: 14px;
}

.auth-error {
    margin-top: 16px;
    border: 0;
    border-radius: 16px;
    background: rgba(255, 241, 241, 0.92);
    color: var(--app-danger);
    font-weight: 600;
}

.floating-selection-card {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2000;
    width: min(270px, calc(100vw - 40px));
    display: none;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(9, 36, 75, 0.1);
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(9, 36, 75, 0.14);
    backdrop-filter: blur(10px);
}

.floating-selection-card__head {
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(9, 36, 75, 0.08);
    font-weight: 800;
    color: #09244b;
}

.floating-selection-card__body {
    padding: 12px 16px 14px;
}

.floating-selection-card__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.floating-selection-card__row:last-child {
    margin-bottom: 0;
}

.floating-selection-card__label {
    color: #5f6b7a;
}

.floating-selection-card__value {
    color: #09244b;
    font-weight: 800;
}

/* Mobile record card view */
#records-mobile-view {
    margin-top: 4px;
}

.record-card {
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(56, 67, 79, 0.1);
    box-shadow: 0 8px 20px rgba(24, 34, 46, 0.07);
}

.record-card__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.record-card__check {
    margin: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.record-card__check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.record-card__num {
    color: #667584;
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 20px;
}

.record-card__date {
    font-size: 0.88rem;
    color: #667584;
    font-weight: 600;
    flex: 1;
}

.record-card__badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(46, 141, 95, 0.09);
    border: 1px solid rgba(46, 141, 95, 0.18);
    color: #2e8d5f;
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

.record-card__badge--warranty {
    background: rgba(43, 95, 159, 0.07);
    border-color: rgba(43, 95, 159, 0.14);
    color: #2b5f9f;
}

.record-card__title {
    font-size: 0.97rem;
    font-weight: 700;
    color: #23313b;
    margin-bottom: 8px;
    line-height: 1.35;
}

.record-card__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.record-card__master {
    font-size: 0.82rem;
    color: #667584;
    font-weight: 600;
}

.record-card__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(56, 67, 79, 0.1);
}

.record-card .btn-action-main {
    flex: 1;
    width: auto;
    min-width: 0;
    min-height: 44px;
    font-size: 0.88rem;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 991.98px) {
    .page-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .form-shell__grid--two,
    .summary-card__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .page-hero {
        padding: 16px;
        border-radius: 18px;
    }

    .page-hero__title {
        font-size: 1.35rem;
    }

    .page-hero__title-icon {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .form-shell,
    .auth-card {
        padding: 16px;
        border-radius: 18px;
    }

    .form-panel {
        padding: 14px;
    }

    .toolbar-card {
        padding: 12px;
    }

    .floating-selection-card {
        left: 12px;
        top: auto;
        bottom: 12px;
        transform: none;
        width: calc(100vw - 24px);
    }
}
