:root {
    --bg: #f4f6f9;
    --bg-card: #ffffff;
    --text: #1a1d26;
    --text-muted: #5c6370;
    --border: #dde2eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-hover: #eef4ff;
    --navbar-bg: #1e293b;
    --navbar-text: #f8fafc;
    --overlay: rgba(15, 23, 42, 0.45);
    --status-prinyat: #16a34a;
    --status-ne-prinyat: #dc2626;
    --status-odobren: #9acd32;
    --status-na-rasmotrenie: #ca8a04;
    --status-otpravlen: #2563eb;
    --status-zaproshen: #9333ea;
    --status-otkazano: #722f37;
}

[data-theme="dark"] {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --bg-hover: #263449;
    --navbar-bg: #020617;
    --navbar-text: #e2e8f0;
    --overlay: rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Админ-навбар */
.admin-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--navbar-bg);
    color: var(--navbar-text);
    border-bottom: 1px solid var(--border);
}

.admin-navbar-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0.6rem 0.5rem 0.6rem 0.65rem;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.65rem;
}

.admin-navbar-groups {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    min-width: 0;
    flex: 1 1 auto;
}

.admin-navbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-navbar-divider {
    width: 1px;
    height: 1.75rem;
    background: rgba(255, 255, 255, 0.24);
    margin: 0 0.1rem;
    flex-shrink: 0;
}

.admin-navbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.admin-navbar-home-btn {
    margin-right: 0;
}

.admin-user-menu {
    position: relative;
}

.admin-user-toggle {
    max-width: 280px;
}

.admin-user-chevron {
    font-size: 0.65rem;
    opacity: 0.75;
}

.admin-user-dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.35rem 0;
    z-index: 120;
    box-shadow: none;
}

.admin-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.55rem 0.9rem;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
}

.admin-dropdown-item:hover {
    background: var(--bg-hover);
}

.settings-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.settings-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.settings-menu-btn:hover {
    background: var(--bg-hover);
}

.panel-hint {
    margin: 0 0 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-profile-summary {
    padding: 0.85rem 1rem 0.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-hover);
}

.admin-profile-summary-fio {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 0.65rem;
}

.admin-profile-summary-list {
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.admin-profile-summary-row {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 0.5rem;
    font-size: 0.82rem;
    line-height: 1.45;
}

.admin-profile-summary-row dt {
    margin: 0;
    color: var(--text-muted);
    font-weight: 600;
}

.admin-profile-summary-row dd {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.admin-profile-summary-empty {
    color: var(--text-muted);
    font-style: italic;
}

.btn-create-return {
    margin-top: 0.65rem;
    width: 100%;
    justify-content: center;
}

.role-perms-hint {
    display: block;
    font-style: italic;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: inherit;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.28);
}

.icon-btn {
    padding: 0.45rem 0.65rem;
}

/* Шапка */
.site-header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.25rem 1rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}

.site-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-primary,
.btn-secondary {
    border: none;
    border-radius: 8px;
    padding: 0.55rem 1rem;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s, transform 0.1s;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-edit {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
}

.btn-edit:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
    flex: 1;
    width: 100%;
}

body.page-orders-full main.container {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

body.page-warehouse-full main.container {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

body.page-cashbox-full main.container {
    max-width: none;
    width: 100%;
    padding: 0;
}

body.page-clients-full main.container,
body.page-statistics-full main.container,
body.page-returns-full main.container,
body.page-stock-full main.container,
body.page-tasks-full main.container,
body.page-vin-requests-full main.container {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

body.page-clients-full .clients-view,
body.page-statistics-full .statistics-view,
body.page-returns-full .returns-view,
body.page-stock-full .stock-view,
body.page-tasks-full .tasks-view,
body.page-vin-requests-full .vin-requests-view {
    width: 100%;
    margin: 0;
}

body.page-cashbox-full .cashbox-view {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 3.25rem);
    width: 100%;
    margin: 0;
    font-size: 0.82rem;
}

.warehouse-view {
    width: 100%;
    margin: 0;
}

.home-view {
    min-height: 0;
}

.public-shop-toolbar {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.public-shop-toolbar.hidden {
    display: none;
}

.public-shop-toolbar--home {
    min-height: 46vh;
    justify-content: center;
}

.public-shop-toolbar--home.public-shop-toolbar--results {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 1rem;
}

.public-shop-toolbar--search {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 1rem;
}

.public-shop-toolbar .public-search-hero {
    width: min(860px, 100%);
}

.public-shop-toolbar .public-loading,
.public-shop-toolbar .public-results {
    width: 100%;
}

.home-view.home-view--shop {
    justify-content: flex-start;
    min-height: auto;
    padding-top: 1rem;
}

.home-view h2 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.public-search-hero {
    width: min(860px, 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.public-vin-cta {
    width: 100%;
    display: flex;
    justify-content: center;
}

.public-vin-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.35rem;
    font-size: 1rem;
    font-weight: 600;
}

.public-search-row {
    width: 100%;
    display: flex;
    align-items: stretch;
    gap: 0.65rem;
}

.public-search-field {
    position: relative;
    flex: 1;
    min-width: 220px;
}

.public-search-row input {
    width: 100%;
    min-width: 0;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
}

.public-search-history {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.35rem 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    text-align: left;
}

.public-search-history.hidden {
    display: none;
}

.public-search-history-item {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    line-height: 1.35;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: baseline;
}

.public-search-history-item:hover,
.public-search-history-item:focus {
    background: var(--bg-hover);
    outline: none;
}

.public-search-history-prefix {
    color: var(--text-muted);
    white-space: nowrap;
}

.public-search-history-text {
    color: var(--text);
    word-break: break-word;
}

.public-cart-btn {
    position: relative;
    width: 48px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--primary);
    cursor: pointer;
}

.public-cart-btn span {
    position: absolute;
    top: -7px;
    right: -7px;
    min-width: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.75rem;
    line-height: 20px;
}

.public-loading,
.public-results,
.public-cart-view,
.public-checkout-view {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.public-cart-view-page {
    padding: 0 1rem 1.5rem;
}

.public-cart-page-header {
    max-width: 1100px;
    margin: 0 auto 0.75rem;
}

.public-checkout-view {
    margin-top: 1rem;
}

.public-loading {
    padding: 2.5rem 1rem;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.public-shop-page {
    width: 100%;
    text-align: left;
}

.public-shop-title,
.public-cart-title {
    margin: 0 0 0.75rem;
    color: #2563eb;
    font-size: 1.35rem;
    font-weight: 600;
    text-align: center;
}

.public-cart-summary {
    margin: 0 0 1rem;
    text-align: center;
    color: var(--text);
}

.public-brand-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
}

.public-brand-chip {
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #1f2937;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.public-brand-chip.active {
    background: #fef08a;
    border-color: #eab308;
}

.public-brand-stock {
    background: #dcfce7;
    color: #166534;
    border-radius: 999px;
    padding: 0.05rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
}

.public-offers-wrap {
    overflow-x: auto;
    border: 1px solid #dbeafe;
    border-radius: 4px;
    background: #fff;
}

.public-offers-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.78rem;
}

.public-price-legend {
    margin: 0 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.public-offers-table thead {
    background: #dbeafe;
}

.public-offers-table th,
.public-offers-table td {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

.public-offers-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.public-offers-table input[type="number"] {
    width: 56px;
    padding: 0.2rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    text-align: center;
}

.public-link {
    color: #2563eb;
    font-weight: 600;
}

.public-name-cell {
    max-width: 280px;
}

.public-term {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
    font-size: 0.72rem;
}

.public-term--pickup {
    background: #fef9c3;
    color: #854d0e;
}

.public-qty-high {
    color: #16a34a;
    font-weight: 700;
}

.public-price-green {
    color: #16a34a;
    font-weight: 700;
}

.public-price-role {
    color: #2563eb;
    font-weight: 700;
}

.public-price-personal {
    color: #16a34a;
    font-weight: 700;
}

.public-icon-cell {
    color: #2563eb;
    text-align: center;
}

.public-source-cell {
    color: var(--text-muted);
    white-space: nowrap;
}

.public-buy-btn {
    border: none;
    background: transparent;
    color: #2563eb;
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}

.public-buy-btn:hover {
    text-decoration: underline;
}

.public-empty {
    padding: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    text-align: center;
}

.public-cart-page,
.public-checkout-page {
    padding-bottom: 2rem;
}

.public-cart-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: flex-end;
}

.public-cart-remove {
    border: none;
    background: transparent;
    color: #dc2626;
    cursor: pointer;
    font-size: 1rem;
}

.public-checkout-main-btn {
    display: block;
    margin: 1.25rem auto 0;
    padding: 0.55rem 2rem;
    border: 2px solid #2563eb;
    border-radius: 999px;
    background: #fff;
    color: #2563eb;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.public-checkout-main-btn:hover {
    background: #eff6ff;
}

.public-shop-disclaimer {
    margin: 1rem auto 0;
    max-width: 980px;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-muted);
    text-align: justify;
}

.public-cart-added-modal {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    padding: 1rem;
}

.public-cart-added-window {
    width: min(520px, 100%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
    padding: 1rem 1.25rem 1.25rem;
    position: relative;
    text-align: center;
}

.public-cart-added-window h3 {
    margin: 0 0 0.75rem;
    color: #2563eb;
    font-size: 1.2rem;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.65rem;
}

.public-cart-added-close {
    position: absolute;
    top: 0.55rem;
    right: 0.7rem;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 1.4rem;
    cursor: pointer;
}

.public-cart-added-text {
    margin: 0.75rem 0;
    line-height: 1.45;
}

.public-cart-added-warning {
    margin: 0.5rem 0 0.75rem;
    color: #dc2626;
    font-weight: 600;
}

.public-cart-added-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
}

.public-cart-added-qty input {
    width: 52px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0.25rem;
}

.public-qty-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
}

.public-cart-added-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.field-readonly {
    background: #f3f4f6 !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

.public-checkout-form {
    width: min(480px, 100%);
    margin: 1rem auto 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
}

.public-checkout-form label {
    display: grid;
    grid-template-columns: 140px 1fr;
    align-items: center;
    gap: 0.6rem;
    text-align: right;
    font-size: 0.9rem;
}

.public-checkout-form input,
.public-checkout-form select {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--text);
}

.public-checkout-form .public-agreement {
    grid-template-columns: auto 1fr;
    text-align: left;
    font-size: 0.8rem;
}

.public-checkout-form .public-agreement input {
    width: auto;
}

.btn-home-vin {
    font-size: 1rem;
    padding: 0.7rem 1.25rem;
}

.vin-view {
    max-width: 1000px;
    margin: 0 auto;
}

.vin-page-title {
    margin: 0.5rem 0 1.25rem;
    text-align: center;
}

.vin-page-title h2 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.vin-page-title p {
    margin: 0.35rem 0 0;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.vin-request-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.vin-form-card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1rem;
}

.vin-car-card {
    border: 14px solid rgba(37, 99, 235, 0.08);
}

[data-theme="dark"] .vin-car-card {
    border-color: rgba(59, 130, 246, 0.13);
}

.vin-form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr);
    gap: 1.25rem;
}

.vin-left,
.vin-extra-fields {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.vin-car-row,
.vin-contact-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

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

.vin-field {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.vin-field input,
.vin-field select,
.vin-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.62rem 0.7rem;
    font: inherit;
    font-size: 0.95rem;
    outline: none;
}

.vin-field textarea {
    min-height: 158px;
    resize: vertical;
}

.vin-code-field input {
    padding-right: 4.8rem;
    text-transform: uppercase;
}

.vin-counter {
    position: absolute;
    right: 0.7rem;
    top: 2.05rem;
    color: #c1c7d0;
    font-weight: 700;
}

.vin-extra-toggle {
    align-self: flex-start;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    background: #eff6ff;
    color: var(--primary);
    cursor: pointer;
}

[data-theme="dark"] .vin-extra-toggle {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
}

.vin-contact-card {
    max-width: 520px;
    padding-top: 0;
    overflow: hidden;
}

.vin-contact-card h3 {
    margin: 0 -1rem 1rem;
    padding: 0.6rem 1rem;
    background: #e8f1ff;
    border-bottom: 1px solid var(--border);
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    text-transform: uppercase;
}

[data-theme="dark"] .vin-contact-card h3 {
    background: rgba(59, 130, 246, 0.12);
}

.vin-submit-btn {
    min-width: 220px;
    justify-content: center;
}

.vin-info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.vin-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
}

.vin-info-card h3 {
    margin: 0 0 0.5rem;
    color: var(--primary);
}

.vin-info-card p {
    margin: 0;
    color: var(--text-muted);
}

.vin-requests-view {
    font-size: 0.82rem;
}

.vin-requests-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.vin-requests-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.vin-requests-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: stretch;
}

.vin-requests-filters__select,
.vin-requests-filters__search,
.vin-requests-filters__btn {
    height: 34px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.82rem;
    line-height: 1.2;
}

.vin-requests-filters__select,
.vin-requests-filters__search {
    background: var(--bg-card);
    color: var(--text);
    padding: 0 0.55rem;
}

.vin-requests-filters__select {
    min-width: 210px;
    max-width: 260px;
}

.vin-requests-filters__search {
    flex: 1 1 180px;
    min-width: 160px;
}

.vin-requests-filters__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.75rem;
    white-space: nowrap;
}

.vin-requests-filters__btn--clear {
    min-width: 88px;
    padding: 0 0.55rem;
    font-size: 0.78rem;
}

.vin-requests-filters__btn--find {
    min-width: 96px;
}

.vin-status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    padding: 0.45rem;
    background: #eef6ff;
    border: 1px solid var(--border);
}

[data-theme="dark"] .vin-status-tabs {
    background: rgba(59, 130, 246, 0.1);
}

.vin-status-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.45);
    color: var(--text-muted);
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
    cursor: pointer;
    opacity: 0.72;
    transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.vin-status-tab:hover:not(.active) {
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.7);
}

.vin-status-tab strong {
    color: inherit;
    font-weight: 600;
}

.vin-status-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: #fff;
    opacity: 1;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.12);
}

.vin-status-tab.active strong {
    color: var(--primary);
}

[data-theme="dark"] .vin-status-tab {
    background: rgba(15, 23, 42, 0.35);
}

[data-theme="dark"] .vin-status-tab:hover:not(.active) {
    background: rgba(15, 23, 42, 0.5);
}

[data-theme="dark"] .vin-status-tab.active {
    background: rgba(59, 130, 246, 0.22);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.2);
}

.status-dot {
    margin-right: 0.25rem;
}

.status-new { color: #2563eb; }
.status-call { color: #16a34a; }
.status-done { color: #64748b; }
.status-order { color: #0ea5e9; }
.status-decline { color: #dc2626; }
.status-wait { color: #ca8a04; }
.status-test { color: #7c3aed; }

.vin-fio {
    line-height: 1.45;
    white-space: nowrap;
}

.vin-request-toggle-row td {
    padding: 0.15rem 0.65rem 0.45rem !important;
    border-top: none;
    background: transparent;
}

.vin-request-spacer td {
    height: 10px;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    line-height: 0;
    font-size: 0;
}

.vin-request-toggle-cell {
    text-align: right;
}

.vin-details-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.5rem;
    max-width: 8.5rem;
    padding: 0.18rem 0.45rem;
    font-size: 0.68rem;
    line-height: 1.2;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.vin-details-toggle-btn:hover,
.vin-details-toggle-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-hover);
}

.vin-request-main-row--expanded td {
    border-bottom-color: transparent;
}

.vin-request-detail-row.hidden {
    display: none;
}

.vin-request-detail-row td {
    background: #f8fafc;
    padding: 0.75rem 0.9rem !important;
}

[data-theme="dark"] .vin-request-detail-row td {
    background: rgba(15, 23, 42, 0.35);
}

.vin-request-detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
    gap: 1rem;
    align-items: start;
}

.vin-request-detail-main {
    min-width: 0;
}

.vin-request-detail-side {
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.vin-detail-side-title {
    margin: 0;
    font-size: 0.9rem;
}

.vin-parts-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vin-parts-toolbar {
    display: flex;
    justify-content: flex-end;
}

.vin-show-supplier-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.vin-parts-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.vin-parts-table th,
.vin-parts-table td {
    border: 1px solid var(--border);
    padding: 0.4rem 0.5rem;
    vertical-align: top;
}

.vin-parts-table th {
    background: #eff6ff;
    color: #1e3a8a;
    text-align: left;
}

[data-theme="dark"] .vin-parts-table th {
    background: rgba(59, 130, 246, 0.13);
    color: var(--navbar-text);
}

.vin-parts-empty {
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 0.5rem 0;
}

@media (max-width: 900px) {
    .vin-request-detail {
        grid-template-columns: 1fr;
    }

    .vin-request-detail-side {
        border-left: none;
        border-top: 1px solid var(--border);
        padding-left: 0;
        padding-top: 0.75rem;
    }
}

.vin-comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.vin-comment-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.7rem;
}

.vin-comment-item header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.vin-comment-item p {
    margin: 0;
    white-space: pre-wrap;
}

.vin-comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    max-width: 640px;
}

.vin-comment-label {
    font-weight: 600;
    color: var(--text);
}

.vin-comment-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.55rem 0.7rem;
    font: inherit;
    resize: vertical;
}

.vin-comment-send {
    align-self: flex-start;
}

.vin-processing-view,
.orders-view {
    font-size: 0.86rem;
}

.orders-view {
    margin: 0;
    width: 100%;
}

.vin-processing-header {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0 1rem;
}

.vin-processing-header h2 {
    margin: 0;
    color: var(--primary);
    font-weight: 500;
}

.orders-page-header {
    background: var(--border);
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.orders-page-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
}

.clients-view {
    font-size: 0.86rem;
    margin: 0 -1rem;
    width: calc(100% + 2rem);
}

.clients-page-header {
    background: var(--border);
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.clients-page-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text);
}

.clients-filter-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.clients-filter-select,
.clients-search-input {
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    padding: 0.35rem 0.65rem;
}

.clients-search-input {
    flex: 1 1 220px;
    min-width: 180px;
}

.clients-table-wrap {
    overflow: auto;
    padding: 0 1rem 1.25rem;
}

.clients-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.clients-table th,
.clients-table td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.55rem;
    vertical-align: top;
}

.clients-table th {
    background: var(--border);
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.clients-table td.num {
    text-align: right;
    white-space: nowrap;
}

.clients-row--inactive {
    opacity: 0.65;
}

.clients-data-fio {
    font-weight: 600;
}

.clients-data-login,
.clients-data-address {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.clients-cell-contacts div + div {
    margin-top: 0.15rem;
}

.clients-cell-actions {
    white-space: nowrap;
}

.clients-action-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    margin-right: 0.25rem;
}

.clients-action-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.clients-action-btn--active {
    border-color: #2563eb;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.client-admin-modal-window {
    max-width: 520px;
}

.client-admin-modal-body {
    padding: 1rem 1.25rem;
}

.client-admin-modal-hint,
.client-admin-modal-user {
    margin: 0 0 0.85rem;
    color: var(--text-muted);
}

.client-admin-modal-user {
    color: var(--text);
    font-weight: 600;
}

.client-admin-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.client-admin-field input,
.client-admin-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    padding: 0.45rem 0.65rem;
}

.orders-top-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) min(280px, 30%);
    gap: 0;
    border-bottom: 1px solid var(--border);
}

.orders-top-main {
    min-width: 0;
}

.orders-top-side {
    border-left: 1px solid var(--border);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
}

.orders-top-side .orders-filter-checkboxes {
    margin: 0;
    padding: 0.75rem 1rem 0.35rem;
}

.orders-top-side .orders-vin-summary {
    padding: 0.35rem 1rem 0.85rem;
    flex: 1;
}

.orders-mine-notice {
    padding: 0.55rem 1.25rem;
    background: rgba(37, 99, 235, 0.08);
    border-bottom: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--primary);
}

.orders-vin-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.orders-vin-stats-table td {
    padding: 0.15rem 0.35rem 0.15rem 0;
    vertical-align: baseline;
}

.orders-vin-stats-table td:last-child {
    font-weight: 700;
    color: var(--text);
    text-align: right;
    white-space: nowrap;
}

.orders-vin-money {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.orders-filter-panel {
    background: var(--bg-hover);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}

.orders-search-input,
.orders-filter-select {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.45rem 0.65rem;
    font-size: 0.86rem;
}

.orders-search-input {
    width: min(280px, 100%);
}

.orders-filter-select {
    min-width: 160px;
}

.orders-filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.orders-filter-checkboxes label {
    cursor: pointer;
}

.orders-clear-btn {
    padding-inline: 0.65rem;
}

#orders-only-open-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-hover);
}

.orders-vin-summary {
    padding: 0.85rem 1.25rem;
    background: var(--bg-card);
}

.orders-vin-box {
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.orders-vin-box--warning {
    border-left-color: #ca8a04;
    background: rgba(202, 138, 4, 0.1);
}

.orders-vin-box-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.orders-vin-box-text {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.orders-stats-panel {
    background: var(--bg-hover);
    padding: 0.75rem 1rem;
    display: flex;
    gap: 0.45rem;
    align-items: stretch;
    flex-wrap: wrap;
    border-bottom: none;
}

.orders-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
    cursor: pointer;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    min-width: 88px;
    max-width: 110px;
    transition: background 0.15s, border-color 0.15s;
}

.orders-stat-item:hover {
    background: var(--bg-card);
}

.orders-stat-item.active {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.orders-stat-item--inactive {
    opacity: 0.48;
    filter: saturate(0.65);
}

.orders-stat-item--inactive:hover {
    opacity: 0.72;
    filter: saturate(0.85);
}

.orders-list-controls {
    margin: 0 1rem 0.75rem;
}

.orders-list-controls-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05);
}

.orders-list-controls-panel--plain {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.orders-list-controls-panel--plain .orders-list-controls-inner {
    padding: 0;
}

.orders-search-results-banner {
    padding: 0.7rem 0.95rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    background: rgba(37, 99, 235, 0.07);
    border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .orders-search-results-banner {
    background: rgba(37, 99, 235, 0.14);
}

.orders-list-controls-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.95rem;
}

.orders-list-controls-left {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.orders-list-controls-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.orders-pagination {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.orders-list-controls-right {
    margin-left: auto;
}

.orders-per-page-label {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.orders-per-page-caption {
    white-space: nowrap;
}

.orders-per-page-select {
    min-width: 240px;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.85rem;
}

.orders-page-btn {
    min-width: 2.1rem;
    height: 2.1rem;
    padding: 0 0.45rem;
}

.orders-page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

#orders-list-controls-bottom {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}

.orders-stat-icon-lg {
    font-size: 1.65rem;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.orders-stat-name {
    font-size: 0.62rem;
    color: var(--text-muted);
    line-height: 1.15;
    margin-bottom: 0.2rem;
    hyphens: auto;
}

.orders-stat-count {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.orders-stat-count--alert {
    color: #dc2626;
}

.order-not-all-ordered {
    color: #dc2626;
    font-weight: 700;
}

.order-source-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.15rem;
    font-size: 0.7rem;
    line-height: 1;
}

.order-source-badge--vin {
    color: #ca8a04;
}

.order-source-badge--cart {
    color: #2563eb;
}

.orders-last-comment {
    max-width: 220px;
    line-height: 1.25;
}

.orders-last-comment-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
    font-size: 0.78rem;
}

.orders-last-comment-meta {
    margin-top: 0.18rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    white-space: nowrap;
}

.orders-status-cell,
.orders-days-cell {
    text-align: center;
}

.orders-positions-cell {
    text-align: center;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
}

.orders-finance-cell {
    line-height: 1.35;
    white-space: nowrap;
}

.orders-table-wrap {
    margin: 1rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow-x: auto;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.orders-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1180px;
}

.orders-table th {
    padding: 0.65rem 0.55rem;
    text-align: left;
    font-weight: 500;
    font-size: 0.78rem;
    background: var(--primary);
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.orders-table th:last-child {
    border-right: none;
}

.orders-table td {
    padding: 0.55rem;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    vertical-align: top;
}

.orders-table td:last-child {
    border-right: none;
}

[data-theme="dark"] .orders-table th {
    background: #1e40af;
}

.orders-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.035);
}

[data-theme="dark"] .orders-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.035);
}

.order-row {
    cursor: pointer;
    transition: background 0.15s;
}

.order-row:hover {
    background: var(--bg-hover);
}

.orders-table tbody tr.order-row--declined td {
    opacity: 0.55;
    color: var(--text-muted);
}

.orders-table tbody tr.order-row--declined:hover td {
    opacity: 0.78;
}

.orders-table tbody tr.order-row--declined .order-number-link {
    color: var(--text-muted);
}

.orders-table tbody tr.order-row--declined .order-task-line,
.orders-table tbody tr.order-row--declined .order-amount {
    color: var(--text-muted);
    font-weight: 400;
}

.order-number-link {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.order-status-icon {
    font-size: 1.1rem;
}

.order-amount {
    font-weight: 700;
    color: var(--text);
}

.order-debt {
    color: var(--text);
    font-weight: 700;
}

.order-debt--alert {
    color: #dc2626;
}

.order-task-line {
    line-height: 1.35;
}

.orders-table tbody tr.order-row--has-task {
    background: #ffe4e6 !important;
}

.orders-table .order-task-line {
    color: var(--text);
    font-weight: 400;
    font-size: 0.8rem;
}

[data-theme="dark"] .orders-table tbody tr.order-row--has-task {
    background: rgba(239, 68, 68, 0.14) !important;
}

.order-comment-icon {
    color: var(--primary);
}

.warehouse-page-header {
    background: var(--border);
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.warehouse-page-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.warehouse-page-header span {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.warehouse-mode-menu {
    display: flex;
    align-items: stretch;
    gap: 0.45rem;
    padding: 0.65rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.warehouse-mode {
    min-width: 112px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    cursor: pointer;
    display: grid;
    justify-items: center;
    gap: 0.15rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.warehouse-mode i {
    font-size: 1.45rem;
    color: var(--text-muted);
}

.warehouse-mode-name {
    font-weight: 700;
    color: var(--text);
    font-size: 0.82rem;
}

.warehouse-mode-desc {
    font-size: 0.7rem;
}

.warehouse-mode:hover,
.warehouse-mode.active {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.warehouse-mode.active i {
    color: var(--primary);
}

.warehouse-mode--disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.warehouse-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.warehouse-tabs,
.warehouse-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.warehouse-tab {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 4px;
    padding: 0.3rem 0.55rem;
    font-size: 0.76rem;
    cursor: default;
}

.warehouse-tab.active {
    border-color: var(--primary);
    font-weight: 600;
}

.warehouse-tab.muted {
    color: var(--text-muted);
    opacity: 0.72;
}

.warehouse-tab span {
    color: #dc2626;
    margin-left: 0.2rem;
}

.warehouse-tab i {
    margin-left: 0.25rem;
    color: var(--text-muted);
}

.warehouse-search-row {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.45rem 0.65rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
}

.warehouse-search-row input {
    width: min(320px, 100%);
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.35rem 0.5rem;
    font-size: 0.78rem;
}

.warehouse-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
}

.warehouse-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
}

.warehouse-table th,
.warehouse-table td {
    padding: 0.35rem 0.45rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.74rem;
    text-align: left;
    vertical-align: top;
}

.warehouse-table th {
    background: var(--bg-hover);
    color: var(--text);
    font-weight: 600;
}

.warehouse-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.035);
}

[data-theme="dark"] .warehouse-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.035);
}

.stock-view {
    margin: 0 -1rem;
    width: calc(100% + 2rem);
}

.stock-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.65rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.stock-tabs {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.stock-table .stock-row {
    cursor: pointer;
}

.stock-table .stock-row:hover {
    background: rgba(37, 99, 235, 0.08);
}

.stock-name {
    font-weight: 600;
}

.stock-sub {
    color: var(--text-muted);
    font-size: 0.68rem;
    margin-top: 0.1rem;
}

.warehouse-remaining {
    color: #dc2626;
    white-space: nowrap;
}

.warehouse-order-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.warehouse-order-link:hover {
    text-decoration: underline;
}

.warehouse-history-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.55rem 0.65rem;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}

.warehouse-history-tab {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 4px;
    padding: 0.35rem 0.55rem;
    font-size: 0.76rem;
}

.warehouse-history-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.warehouse-history-tab--disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.warehouse-history-row {
    cursor: pointer;
}

.warehouse-supply-row {
    cursor: pointer;
}

.warehouse-supply-row:hover {
    background: rgba(37, 99, 235, 0.08);
}

.warehouse-history-row:hover {
    background: rgba(37, 99, 235, 0.08);
}

.warehouse-receipt-summary {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.warehouse-receipt-content {
    padding: 0.75rem;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.warehouse-receipt-group + .warehouse-receipt-group {
    margin-top: 0.9rem;
}

.warehouse-receipt-group h4 {
    margin: 0 0 0.45rem;
    font-size: 0.9rem;
}

.warehouse-receipt-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.035);
}

[data-theme="dark"] .warehouse-receipt-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.035);
}

.warehouse-invoice-window {
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.warehouse-invoice-window .warehouse-invoice-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.warehouse-invoice-form {
    padding: 0.75rem;
}

.warehouse-invoice-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
    margin-bottom: 0.75rem;
}

.warehouse-invoice-grid label {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem;
    align-items: center;
    font-size: 0.78rem;
}

.warehouse-invoice-grid span {
    color: var(--text-muted);
}

.warehouse-invoice-grid input,
.warehouse-invoice-grid select {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.35rem 0.45rem;
    font-size: 0.78rem;
}

.warehouse-invoice-table-wrap {
    max-height: min(640px, 68vh);
    overflow: auto;
    flex: 1;
    min-height: 280px;
    border: 1px solid var(--border);
}

.warehouse-invoice-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
}

.warehouse-invoice-table th,
.warehouse-invoice-table td {
    padding: 0.3rem 0.4rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.72rem;
    text-align: left;
}

.warehouse-invoice-table th {
    background: var(--bg-hover);
    font-weight: 600;
}

.warehouse-invoice-table input[type="number"] {
    width: 70px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.2rem 0.3rem;
    font-size: 0.72rem;
}

.warehouse-invoice-qty-cell {
    width: 72px;
}

.warehouse-invoice-group-row td {
    background: var(--bg-hover);
    color: var(--text);
    font-weight: 600;
    font-size: 0.76rem;
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.warehouse-invoice-item-row td {
    vertical-align: middle;
}

.warehouse-quick-receive-qty-row {
    display: grid;
    gap: 0.25rem;
}

.warehouse-quick-receive-ordered {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.warehouse-quick-receive-window {
    width: min(360px, calc(100vw - 1.5rem));
    display: flex;
    flex-direction: column;
    max-height: 92vh;
}

.warehouse-quick-receive-form {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.warehouse-quick-receive-form label {
    display: grid;
    gap: 0.22rem;
    font-size: 0.78rem;
}

.warehouse-quick-receive-form input,
.warehouse-quick-receive-form select {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.45rem 0.5rem;
    font-size: 0.84rem;
}

.warehouse-quick-receive-form input[readonly] {
    background: var(--bg-hover);
}

.warehouse-quick-receive-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.order-supplier-payments-table {
    margin-top: 0.75rem;
}

.stock-action-window {
    width: min(430px, calc(100vw - 1.5rem));
}

.stock-action-form,
.stock-action-content {
    display: grid;
    gap: 0.45rem;
    padding: 0.85rem;
}

.stock-action-form select {
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.45rem 0.5rem;
    font-size: 0.9rem;
}

.stock-item-window {
    width: min(440px, calc(100vw - 1.5rem));
    max-height: 94vh;
}

.stock-item-form {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.45rem 0.65rem;
    padding: 0.85rem;
    overflow: auto;
}

.stock-item-form label,
.stock-receipt-fields label {
    display: contents;
    font-size: 0.82rem;
}

.stock-item-form input,
.stock-item-form select {
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.36rem 0.45rem;
    min-width: 0;
}

.stock-sync-prices span:last-child {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.stock-item-separator,
.stock-form-hint,
.stock-receipt-fields,
.stock-item-form .form-error,
.stock-item-form .order-sub-modal-actions {
    grid-column: 1 / -1;
}

.stock-item-separator {
    border-top: 1px solid var(--border);
    margin: 0.25rem 0;
}

.stock-receipt-fields {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.45rem 0.65rem;
}

.stock-form-hint {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.35;
    font-size: 0.78rem;
}

.stock-action-card {
    display: grid;
    gap: 0.2rem;
    padding: 0.3rem 0.2rem 0.65rem;
    border-bottom: 1px solid var(--border);
}

.stock-action-card small {
    color: var(--text-muted);
}

.stock-action-btn {
    border: 1px solid var(--primary);
    border-radius: 5px;
    background: transparent;
    color: var(--primary);
    padding: 0.42rem 0.5rem;
    text-align: left;
    cursor: pointer;
    font-size: 0.86rem;
}

.stock-action-btn:hover,
.stock-action-btn--sell {
    background: rgba(37, 99, 235, 0.08);
}

.stock-price-window {
    width: min(760px, calc(100vw - 1.5rem));
}

.stock-price-form {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.48rem 0.75rem;
    padding: 0.85rem;
}

.stock-price-form label,
.stock-writeoff-form label {
    display: contents;
    font-size: 0.84rem;
}

.stock-price-form input,
.stock-price-form select,
.stock-writeoff-form input,
.stock-writeoff-form select {
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.36rem 0.45rem;
    min-width: 0;
}

.stock-price-updated,
.stock-price-form .form-error,
.stock-price-form .order-sub-modal-actions,
.stock-writeoff-form .form-error,
.stock-writeoff-form .order-sub-modal-actions {
    grid-column: 1 / -1;
}

.stock-price-updated {
    margin: 0.15rem 0 0.45rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.stock-duplicates-window {
    width: min(860px, calc(100vw - 1.5rem));
}

.stock-duplicates-scroll {
    max-height: 320px;
    overflow: auto;
    padding: 0.85rem;
}

.stock-duplicates-table,
.stock-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.stock-duplicates-table th,
.stock-duplicates-table td,
.stock-history-table th,
.stock-history-table td {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.stock-duplicates-table th,
.stock-history-table th {
    color: var(--primary);
    font-weight: 600;
}

.stock-duplicates-table tbody tr {
    cursor: pointer;
}

.stock-duplicates-table tbody tr:hover {
    background: var(--bg-hover);
}

.stock-writeoff-window {
    width: min(520px, calc(100vw - 1.5rem));
}

.stock-writeoff-form {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 0.5rem 0.75rem;
    padding: 0.85rem;
}

.stock-history-window {
    width: min(1120px, calc(100vw - 1.5rem));
}

.stock-history-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.85rem 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.stock-history-tabs button {
    border: 1px solid var(--border);
    border-bottom: none;
    background: transparent;
    color: var(--primary);
    padding: 0.55rem 0.9rem;
    cursor: pointer;
}

.stock-history-tabs button.active {
    background: var(--bg-card);
    color: var(--text);
}

.stock-history-content {
    padding: 0.85rem;
}

.stock-history-search {
    display: flex;
    max-width: 260px;
    margin-bottom: 0.65rem;
}

.stock-history-search input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 5px 0 0 5px;
    padding: 0.35rem 0.45rem;
}

.stock-history-search .btn-primary {
    border-radius: 0 5px 5px 0;
}

.stock-history-summary {
    margin: 1rem 0 0;
    text-align: center;
    color: var(--text-muted);
}

.stock-sale-window {
    width: min(1200px, 98vw);
    max-width: 98vw;
    min-height: min(520px, 85vh);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.stock-sale-form {
    padding: 1.25rem 1.5rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.stock-sale-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.92rem;
}

.stock-sale-table th,
.stock-sale-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.stock-sale-table th {
    background: var(--bg-hover);
    font-weight: 600;
}

.stock-sale-table td:nth-child(3) {
    min-width: 280px;
}

.stock-sale-table input {
    width: 110px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.45rem 0.55rem;
    font-size: 0.92rem;
}

.stock-sale-summary {
    margin: 0.85rem 0 1rem;
    font-size: 1.05rem;
}

.stock-sale-form .order-sub-modal-actions {
    margin-top: auto;
    padding-top: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.stock-sale-remove {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
}

.btn-warning {
    border: 1px solid #f59e0b;
    background: #f59e0b;
    color: #111827;
    border-radius: 5px;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
}

.btn-success {
    border: 1px solid #15803d;
    background: #15803d;
    color: #fff;
    border-radius: 5px;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
}

.cashbox-view {
    margin: 0 -1rem;
    width: calc(100% + 2rem);
    font-size: 0.82rem;
}

body.page-cashbox-full .cashbox-page-header {
    flex-shrink: 0;
}

body.page-cashbox-full .cashbox-toolbar {
    flex-shrink: 0;
}

body.page-cashbox-full .cashbox-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

body.page-cashbox-full .cashbox-table-footer {
    flex-shrink: 0;
}

body.page-cashbox-full .cashbox-tabs {
    position: sticky;
    bottom: 0;
    flex-shrink: 0;
    margin-top: auto;
    z-index: 20;
    box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.08);
}

.cashbox-page-header {
    background: var(--border);
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cashbox-page-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.cashbox-summary {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    color: var(--text-muted);
}

.cashbox-summary strong {
    color: var(--text);
}

.cashbox-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.65rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
    overflow-x: auto;
}

.cashbox-toolbar label {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.74rem;
    white-space: nowrap;
    margin: 0;
}

.cashbox-toolbar .cashbox-toolbar-control,
.cashbox-toolbar .btn-primary,
.cashbox-toolbar .btn-secondary {
    height: 1.75rem;
    min-height: 1.75rem;
    padding: 0 0.55rem;
    font-size: 0.74rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.cashbox-toolbar input[type="date"].cashbox-toolbar-control {
    width: 8.5rem;
    padding: 0 0.35rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    position: relative;
}

input[type="date"].date-input-clickable {
    cursor: pointer;
    position: relative;
}

input[type="date"].date-input-clickable::-webkit-calendar-picker-indicator {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
}

.cashbox-toolbar input,
.cashbox-payment-grid input,
.cashbox-payment-grid select {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.35rem 0.45rem;
    font: inherit;
}

.cashbox-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    min-height: 360px;
}

.cashbox-table-footer {
    padding: 0.35rem 0.65rem;
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--text-muted);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.cashbox-footer-income {
    color: #16a34a;
    font-weight: 600;
}

.cashbox-footer-expense {
    color: #dc2626;
    font-weight: 600;
}

.cashboxes-settings-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.cashbox-settings-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.cashbox-settings-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.cashbox-settings-name {
    flex: 1 1 12rem;
    min-width: 10rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.35rem 0.45rem;
    font: inherit;
}

.cashbox-settings-name[readonly] {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.cashbox-settings-balance {
    font-size: 0.74rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.cashbox-settings-badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-muted);
}

.cashbox-settings-hide-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.76rem;
    margin: 0;
    cursor: pointer;
}

.cashbox-settings-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.cashbox-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
}

.cashbox-table th,
.cashbox-table td {
    padding: 0.35rem 0.45rem;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-size: 0.76rem;
}

.cashbox-table th {
    background: var(--bg-hover);
    color: var(--text);
    font-weight: 600;
}

.cashbox-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.035);
}

[data-theme="dark"] .cashbox-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.035);
}

.cashbox-amount {
    white-space: nowrap;
    font-weight: 700;
}

.cashbox-amount--income {
    color: #16a34a;
}

.cashbox-amount--expense {
    color: #dc2626;
}

.cashbox-amount--transfer {
    color: var(--primary);
}

.cashbox-actions-cell {
    white-space: nowrap;
}

.cashbox-detail-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    cursor: pointer;
    user-select: none;
    padding: 0 0.15rem;
}

.cashbox-detail-toggle input {
    margin: 0;
}

.cashbox-row {
    cursor: pointer;
}

.cashbox-row--selected td {
    background: rgba(37, 99, 235, 0.12) !important;
}

.cashbox-row--supplier td {
    background: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .cashbox-row--supplier td {
    background: rgba(148, 163, 184, 0.12);
}

.cashbox-row--supplier.cashbox-row--selected td {
    background: rgba(37, 99, 235, 0.18) !important;
}

.cashbox-table--detailed .cashbox-row--detailed td {
    background: rgba(148, 163, 184, 0.18);
}

[data-theme="dark"] .cashbox-table--detailed .cashbox-row--detailed td {
    background: rgba(148, 163, 184, 0.12);
}

.cashbox-table--detailed .cashbox-row--selected td {
    background: rgba(37, 99, 235, 0.18) !important;
}

.cashbox-comment-cell {
    white-space: normal;
    min-width: 220px;
    line-height: 1.35;
}

.cashbox-order-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.cashbox-order-link:hover {
    text-decoration: underline;
}

.cashbox-action-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--text-muted);
}

.cashbox-tabs {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    background: var(--bg-hover);
    border-top: 1px solid var(--border);
    overflow-x: auto;
}

.cashbox-tab {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
    font-size: 0.76rem;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    min-width: 7.5rem;
    transition: opacity 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cashbox-tab:not(.active) {
    opacity: 0.55;
    color: var(--text-muted);
    border-color: color-mix(in srgb, var(--border) 65%, transparent);
}

.cashbox-tab:not(.active):hover {
    opacity: 0.78;
}

.cashbox-tab:not(.active) .cashbox-tab-name {
    font-weight: 500;
    color: var(--text-muted);
}

.cashbox-tab:not(.active) .cashbox-tab-balance {
    opacity: 0.85;
}

.cashbox-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.cashbox-tab-name {
    font-weight: 600;
}

.cashbox-tab-balance {
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.cashbox-tab-balance--positive {
    color: #16a34a;
}

.cashbox-tab-balance--negative {
    color: #dc2626;
}

.cashbox-tab.active .cashbox-tab-balance--positive {
    color: #15803d;
}

.cashbox-tab.active .cashbox-tab-balance--negative {
    color: #b91c1c;
}

.cashbox-payment-window {
    width: min(520px, 96vw);
}

.cashbox-payment-form {
    padding: 0.4rem;
}

.cashbox-payment-tabs {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.cashbox-template-btn {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: var(--bg-card);
    border-radius: 4px;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.cashbox-template-btn.active,
.cashbox-template-btn:hover {
    background: rgba(37, 99, 235, 0.08);
}

.cashbox-payment-grid {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.45rem;
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 0.4rem 0.5rem;
    align-items: center;
}

.cashbox-payment-grid label {
    display: contents;
}

.cashbox-payment-grid label > input,
.cashbox-payment-grid label > select {
    width: 100%;
}

.order-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

.order-modal-window {
    width: min(1400px, 96vw);
    min-width: 720px;
    max-width: 98vw;
    max-height: 90vh;
    margin: 0;
    background: var(--bg-card);
    color: var(--text);
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

#order-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.order-modal-window.order-modal-window--sized {
    overflow: hidden;
    max-height: none;
}

.order-modal-resize {
    position: absolute;
    z-index: 20;
    background: transparent;
}

.order-modal-resize-e {
    top: 0;
    right: 0;
    width: 10px;
    height: 100%;
    cursor: ew-resize;
}

.order-modal-resize-w {
    top: 0;
    left: 0;
    width: 10px;
    height: 100%;
    cursor: ew-resize;
}

.order-modal-resize-s {
    left: 0;
    bottom: 0;
    width: 100%;
    height: 10px;
    cursor: ns-resize;
}

.order-modal-resize-se {
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.order-modal-header,
.order-modal-top-bar,
.order-modal-primary-info,
.order-modal-secondary-info,
.order-modal-tabs,
.order-modal-footer {
    flex-shrink: 0;
}

.order-client-bind-window {
    width: min(1400px, 98vw);
    max-width: 98vw;
}

.order-modal-header {
    padding: 1rem 1.25rem;
    background: var(--bg-hover);
    color: var(--text);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: move;
    user-select: none;
}

.order-modal-header--dragging {
    cursor: grabbing;
}

.order-modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    pointer-events: none;
}

.order-modal-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
    flex-shrink: 0;
}

.order-modal-close:hover {
    color: var(--text);
}

.order-modal-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.65rem 1.25rem;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}

.order-modal-print-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.order-modal-print-label {
    color: var(--text-muted);
    margin-right: 0.15rem;
}

.order-modal-print-btn {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.order-modal-print-btn:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.order-modal-print-btn:not(:disabled):hover {
    border-color: #2563eb;
    color: #2563eb;
}

.order-print-pane {
    padding: 0.75rem 0.25rem;
}

.order-print-pane-desc {
    margin: 0 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.order-print-pane-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.order-modal-status-block {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.order-modal-status-block .order-status-picker {
    min-width: 0;
    max-width: 220px;
    width: auto;
}

.order-modal-status-block .order-status-picker-toggle {
    min-height: 0;
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    gap: 0.3rem;
    border-radius: 6px;
}

.order-modal-status-block .order-status-picker-toggle-icon,
.order-modal-status-block .order-status-picker-option-icon {
    font-size: 0.78rem;
    width: 0.9rem;
}

.order-modal-status-block .order-status-picker-toggle-label {
    font-size: 0.75rem;
}

.order-modal-status-block .order-status-picker-caret {
    font-size: 0.55rem;
}

.order-modal-status-block .order-status-picker-menu {
    min-width: 180px;
    max-width: 240px;
    max-height: 240px;
    border-radius: 6px;
}

.order-modal-status-block .order-status-picker-option {
    padding: 0.3rem 0.55rem;
    gap: 0.3rem;
    font-size: 0.75rem;
}

.order-modal-footer-manager {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.order-manager-body {
    padding: 0.85rem 1rem 1rem;
}

.order-manager-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.order-manager-field select {
    min-height: 2.35rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 0.55rem;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.92rem;
}

.order-manager-window {
    width: min(420px, calc(100vw - 2rem));
}

.order-modal-status-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.order-modal-primary-info,
.order-modal-secondary-info {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.order-modal-primary-info {
    background: var(--bg-card);
}

.order-modal-secondary-info {
    background: var(--bg-hover);
    font-size: 0.82rem;
    line-height: 1.5;
}

.order-modal-info-table {
    width: 100%;
    border-collapse: collapse;
}

.order-modal-info-left {
    vertical-align: top;
    width: 55%;
    padding-right: 1rem;
}

.order-modal-info-right {
    vertical-align: top;
    text-align: right;
}

.order-primary-data {
    border-collapse: collapse;
    font-size: 0.84rem;
}

.order-primary-data td {
    padding: 0.2rem 0.5rem 0.2rem 0;
    vertical-align: top;
}

.order-primary-data td:first-child {
    width: 85px;
    color: var(--text-muted);
}

.order-financial-grid {
    display: inline-flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 1.75rem;
    text-align: left;
}

.order-financial-side {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.order-financial-side--extra {
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--text);
}

.order-financial-side--extra .order-financial-line span {
    font-weight: 400;
}

.order-financial-side--main {
    min-width: 170px;
}

.order-financial-line {
    white-space: nowrap;
    line-height: 1.35;
}

.order-financial-line--important {
    font-size: 1rem;
}

.order-financial-total {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
}

.order-financial-debt {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
}

.order-financial-debt--alert {
    color: #dc2626;
}

.order-payments-pane {
    padding: 0;
}

.order-payment-operation-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0.25rem 0.25rem 0;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}

.order-payment-operation-tab {
    border: 1px solid var(--border);
    border-bottom: 0;
    background: var(--bg-hover);
    color: var(--text);
    border-radius: 3px 3px 0 0;
    padding: 0.38rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    margin-right: 0.15rem;
}

.order-payment-operation-tab:hover {
    border-color: var(--primary);
    color: var(--text);
}

.order-payment-operation-tab.active {
    background: var(--bg-card);
    border-color: var(--primary) var(--border) var(--bg-card);
    color: var(--text);
}

.order-payment-operation-panels {
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0.25rem;
}

.order-payment-operation-panel {
    display: none;
}

.order-payment-operation-panels[data-order-payment-op-active="payment"] [data-order-payment-op-panel="payment"],
.order-payment-operation-panels[data-order-payment-op-active="balance_payment"] [data-order-payment-op-panel="balance_payment"],
.order-payment-operation-panels[data-order-payment-op-active="balance_topup"] [data-order-payment-op-panel="balance_topup"],
.order-payment-operation-panels[data-order-payment-op-active="physical_refund"] [data-order-payment-op-panel="physical_refund"],
.order-payment-operation-panels[data-order-payment-op-active="balance_refund"] [data-order-payment-op-panel="balance_refund"],
.order-payment-operation-panels[data-order-payment-op-active="repay_transfer"] [data-order-payment-op-panel="repay_transfer"],
.order-payment-operation-panels[data-order-payment-op-active="withhold"] [data-order-payment-op-panel="withhold"] {
    display: block;
}

.order-payment-inline-text {
    font-size: 0.82rem;
    color: var(--text);
    align-self: center;
}

.order-payment-credit-hint {
    margin: 0 0 0.75rem;
    font-size: 0.84rem;
    color: var(--text-muted);
}

.order-payment-inline-form {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    padding: 0;
    border: 0;
    background: transparent;
    margin-bottom: 0;
}

.order-payment-inline-form label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
}

.order-payment-inline-form input,
.order-payment-inline-form select {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.3rem 0.45rem;
    font: inherit;
}

.order-payment-inline-form input[name="payment_sum"],
.order-payment-inline-form input[name="amount"] {
    width: 92px;
}

.order-payment-inline-form input[name="comment"] {
    width: min(260px, 100%);
}

.order-payment-prepay {
    color: var(--text-muted);
}

.order-payment-inline-form .form-error {
    flex-basis: 100%;
    margin: 0.15rem 0 0;
}

.order-payments-history {
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.order-payment-history-tabs {
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
}

.order-payment-history-tab {
    border: none;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    cursor: pointer;
}

.order-payment-history-tab:last-child {
    border-right: none;
}

.order-payment-history-tab:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.order-payment-history-tab.active {
    color: var(--primary);
    font-weight: 600;
    background: var(--bg-hover);
}

.order-payment-history-panel {
    display: none;
}

.order-payment-history-panel.active {
    display: block;
}

.order-payments-table {
    width: 100%;
    border-collapse: collapse;
}

.order-payments-table th,
.order-payments-table td {
    padding: 0.35rem 0.5rem;
    border-top: 1px solid var(--border);
    text-align: left;
    font-size: 0.76rem;
}

.order-payments-table th {
    background: var(--bg-hover);
    font-weight: 600;
}

.order-payments-table tfoot td {
    font-weight: 700;
}

.va-top {
    vertical-align: top;
}

.order-modal-tabs {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 1rem;
    border-bottom: 2px solid var(--border);
    overflow-x: auto;
    background: var(--bg-card);
}

.order-modal-tabs-left,
.order-modal-tabs-right {
    display: flex;
    gap: 0.25rem;
    flex-wrap: nowrap;
}

.order-modal-tabs-right {
    margin-left: auto;
}

.order-modal-tab {
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-size: 0.84rem;
    white-space: nowrap;
}

.order-modal-tab:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.order-modal-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.order-modal-tab-new {
    color: #dc2626;
    font-weight: 700;
}

.order-modal-tab.active .order-modal-tab-new {
    color: #dc2626;
}

.order-modal-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.72rem;
    line-height: 1;
    font-weight: 700;
    vertical-align: middle;
}

.order-modal-tab.active .order-modal-tab-badge {
    background: #dc2626;
    color: #fff;
}

.order-modal-body {
    padding: 1rem 1.25rem 1.25rem;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.order-modal-pane {
    display: none;
    min-height: 0;
}

.order-modal-pane.active {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.order-modal-placeholder {
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.order-modal-placeholder i {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
    opacity: 0.65;
}

.order-modal-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.order-detail-section {
    background: var(--bg-hover);
    padding: 0.85rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.order-detail-row {
    display: flex;
    gap: 0.65rem;
    margin-bottom: 0.55rem;
    font-size: 0.82rem;
}

.order-detail-label {
    font-weight: 600;
    width: 130px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.order-detail-value {
    flex: 1;
    color: var(--text);
}

.order-modal-summary-box {
    text-align: right;
    padding: 1rem 1.25rem;
    background: var(--bg-hover);
    border-radius: 8px;
    border: 2px solid var(--primary);
    margin-top: 1rem;
}

.order-modal-summary-row {
    font-size: 0.95rem;
    margin-bottom: 0.45rem;
}

.order-modal-summary-total {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
}

.order-modal-summary-debt {
    font-size: 1.15rem;
    font-weight: 700;
    color: #dc2626;
}

.order-items-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.order-items-table th {
    background: var(--bg-hover);
    color: var(--text-muted);
    padding: 0.38rem 0.45rem;
    font-size: 0.74rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.order-items-table td {
    padding: 0.32rem 0.45rem;
    font-size: 0.76rem;
    line-height: 1.25;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.order-items-table .order-item-action-btn {
    width: 26px;
    height: 26px;
    font-size: 0.82rem;
    border-radius: 5px;
}

.order-items-table .order-item-actions-bar {
    gap: 0.15rem;
}

.order-items-table .order-item-details {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
}

.order-modal-footer {
    padding: 0.85rem 1.25rem;
    background: var(--bg-hover);
    border-top: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.order-modal-footer-info {
    font-size: 0.84rem;
    color: var(--text);
}

.order-status-select {
    width: 100%;
    max-width: 280px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    background: var(--bg-card);
    color: var(--text);
    font: inherit;
}

.order-status-picker {
    position: relative;
    min-width: 240px;
    max-width: 320px;
}

.order-status-picker-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 0.55rem;
    background: var(--bg-card);
    color: var(--text);
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.order-status-picker-toggle:hover {
    border-color: var(--primary);
}

.order-status-picker-toggle-icon,
.order-status-picker-option-icon {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

.order-status-picker-toggle-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.order-status-picker-caret {
    font-size: 0.65rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.order-status-picker-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 40;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    max-height: 320px;
    overflow-y: auto;
}

.order-status-picker-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    font-size: 0.88rem;
}

.order-status-picker-option:hover,
.order-status-picker-option--active {
    background: var(--bg-hover);
}

.order-status-picker--open .order-status-picker-toggle {
    border-color: var(--primary);
}

.order-modal-footer-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.order-open-customer-orders-btn {
    border-color: #dc2626;
    color: #dc2626;
}

.order-open-customer-orders-btn:hover {
    border-color: #b91c1c;
    color: #b91c1c;
}

@media (max-width: 900px) {
    .orders-top-grid {
        grid-template-columns: 1fr;
    }

    .orders-top-side {
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .order-modal-info-left,
    .order-modal-info-right {
        display: block;
        width: 100%;
        text-align: left;
        padding-right: 0;
    }

    .order-modal-info-table tr {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .order-financial-grid {
        flex-direction: column;
        gap: 0.5rem;
    }
}

.vin-processing-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.processing-card {
    background: #eefcff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
}

.processing-fio {
    background: #dcfce7;
}

.parts-editor {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem;
}

.parts-editor h3 {
    margin: 0 0 0.75rem;
}

.parts-table-wrap {
    overflow-x: auto;
}

.parts-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 920px;
}

.parts-table th,
.parts-table td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.55rem;
    vertical-align: middle;
}

.parts-table th {
    background: #eff6ff;
    color: #1e3a8a;
    font-weight: 600;
    font-size: 0.78rem;
    white-space: nowrap;
}

.parts-table .parts-col-index {
    width: 2.4rem;
    text-align: center;
}

.parts-table .parts-col-code {
    width: 7rem;
}

.parts-table .parts-col-name {
    width: auto;
    min-width: 9rem;
}

.parts-table .parts-col-supplier {
    width: 8.5rem;
}

.parts-table .parts-col-manufacturer {
    width: 8rem;
}

.parts-table .parts-col-price {
    width: 5.5rem;
}

.parts-table .parts-col-qty {
    width: 3.5rem;
}

.parts-table .parts-col-term {
    width: 8.5rem;
}

.parts-table .parts-col-picker {
    width: 8rem;
}

.parts-table .parts-col-actions {
    width: 4.2rem;
    text-align: center;
}

.parts-supplier-head {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.parts-supplier-head input {
    margin: 0;
}

.parts-supplier-mask {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
}

.parts-table--show-supplier .parts-supplier-mask {
    display: none;
}

.parts-table:not(.parts-table--show-supplier) .parts-supplier-field {
    display: none;
}

.parts-table--show-supplier .parts-supplier-field {
    display: block;
    width: 100%;
}

.parts-table .parts-supplier-field {
    font-size: 0.78rem;
    color: var(--text);
}

.order-vin-parts-section {
    margin-top: 0.75rem;
}

.order-vin-parts-section .parts-table-wrap {
    overflow-x: auto;
}

.order-vin-parts-request {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 0.82rem;
}

.parts-picker-cell {
    white-space: nowrap;
}

.parts-picker-name {
    display: inline-block;
    font-size: 0.78rem;
    color: var(--text);
}

.parts-col-actions .parts-remove-btn {
    margin: 0 auto;
}

[data-theme="dark"] .parts-table th {
    background: rgba(59, 130, 246, 0.13);
    color: var(--navbar-text);
}

.parts-table input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.35rem 0.45rem;
    font-size: 0.78rem;
}

.parts-table select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.35rem 0.4rem;
    font-size: 0.78rem;
}

.parts-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: flex-start;
}

.order-customer-contacts {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.order-customer-contact-line {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.order-field-edit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.68rem;
    line-height: 1;
}

.order-field-edit-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.order-customer-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.75rem 1rem 1rem;
}

.order-client-cabinet-link {
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.order-client-bind-edit-btn {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.order-client-bind-edit-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.order-client-bind-body {
    padding: 0.75rem 1rem 0.5rem;
}

.order-client-bind-current {
    margin: 0 0 0.35rem;
    font-weight: 600;
}

.order-client-bind-hint {
    margin: 0 0 0.85rem;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.order-client-bind-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
}

.order-client-bind-search select,
.order-client-bind-search input[type="search"] {
    min-height: 2.25rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0 0.65rem;
}

.order-client-bind-search select {
    min-width: 170px;
}

.order-client-bind-search input[type="search"] {
    flex: 1 1 220px;
    min-width: 180px;
}

.order-client-bind-results-wrap {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.order-client-bind-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.order-client-bind-table th,
.order-client-bind-table td {
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.order-client-bind-table th {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
    font-weight: 600;
}

.order-client-bind-action {
    width: 110px;
    text-align: right;
    white-space: nowrap;
}

.order-client-bind-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
}

.order-responsible-label {
    color: #dc2626;
    font-weight: 600;
}

.order-responsible-label-plain {
    font-weight: 600;
}

.order-staff-line {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 0.35rem;
}

.order-staff-line--above-source {
    margin-top: 0.15rem;
}

.order-author-line {
    margin-bottom: 0.35rem;
}

.order-selection-responsible-body {
    padding: 0.75rem 1rem 1rem;
}

.order-selection-responsible-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.order-selection-option {
    width: 100%;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    font-size: 0.92rem;
    line-height: 1.35;
}

.order-selection-option:hover {
    border-color: var(--accent);
}

.order-selection-option--active {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.08);
}

.order-contractor-pane {
    padding: 0.75rem 1rem 1.25rem;
}

.order-contractor-top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.order-contractor-section-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.order-contractor-section-label i {
    margin-right: 0.3rem;
}

.order-contractor-name {
    font-size: 1rem;
    font-weight: 600;
}

.order-contractor-top-right {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
}

.order-contractor-summary-stat strong {
    font-weight: 600;
}

.order-contractor-important {
    margin-bottom: 0.85rem;
    font-size: 0.88rem;
}

.order-contractor-stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.45rem;
    font-size: 0.84rem;
}

.order-contractor-stats-table td {
    padding: 0.35rem 0.5rem 0.35rem 0;
    vertical-align: top;
    border-bottom: 1px solid var(--border);
}

.order-contractor-stats-table td:first-child {
    width: 34%;
    min-width: 240px;
}

.order-contractor-stats-table td:nth-child(2) {
    width: 110px;
    white-space: nowrap;
}

.order-contractor-stat-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.order-contractor-stat-danger {
    color: #dc2626;
}

.order-contractor-stats-separator td {
    padding: 0.15rem 0;
    border-bottom: none;
}

@media (max-width: 900px) {
    .order-contractor-top {
        grid-template-columns: 1fr;
    }

    .order-contractor-stats-table td:first-child {
        min-width: 0;
    }
}

.order-comments-pane {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    max-width: 720px;
}

.order-comments-subtabs {
    display: flex;
    gap: 0.35rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.35rem;
}

.order-comments-subtab {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-muted);
    border-radius: 6px 6px 0 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.84rem;
    cursor: pointer;
}

.order-comments-subtab.active {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--primary);
    border-bottom-color: var(--bg-card);
    font-weight: 600;
}

.order-comments-subpane {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

.order-comments-subpane.active {
    display: flex;
}

.order-comments-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.order-comment-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
}

.order-comment-item header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.order-comment-item p {
    margin: 0 0 0.45rem;
    white-space: pre-wrap;
}

.order-comment-actions {
    display: flex;
    gap: 0.35rem;
}

.btn-small {
    padding: 0.25rem 0.55rem;
    font-size: 0.74rem;
}

.order-comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.order-comment-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.55rem 0.7rem;
    font: inherit;
    resize: vertical;
}

.order-comments-empty,
.order-history-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.order-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-width: 820px;
}

.order-history-item {
    display: grid;
    grid-template-columns: 150px 120px 1fr;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    font-size: 0.8rem;
    align-items: start;
}

.order-history-item time {
    color: var(--text-muted);
    white-space: nowrap;
}

.order-history-author {
    font-weight: 600;
}

.order-history-message {
    white-space: pre-wrap;
}

.order-item-not-ordered {
    background: var(--bg-card);
}

.order-item-ordered {
    background: var(--bg-card);
}

.order-item-issued {
    background: #e5e7eb;
}

[data-theme="dark"] .order-item-issued {
    background: #334155;
}

.order-item-returned {
    background: #fee2e2;
    color: #7f1d1d;
}

[data-theme="dark"] .order-item-returned {
    background: rgba(220, 38, 38, 0.28);
    color: #fecaca;
}

.order-item-arrived {
    background: #dcfce7;
}

.order-item-arrived-partial {
    background: #ecfccb;
}

[data-theme="dark"] .order-item-arrived {
    background: rgba(22, 163, 74, 0.2);
}

[data-theme="dark"] .order-item-arrived-partial {
    background: rgba(101, 163, 13, 0.22);
}

.order-item-declined {
    background: #fef3c7;
}

[data-theme="dark"] .order-item-declined {
    background: rgba(202, 138, 4, 0.18);
}

.order-item-out-of-stock {
    background: #fee2e2;
}

[data-theme="dark"] .order-item-out-of-stock {
    background: rgba(220, 38, 38, 0.16);
}

.item-cart-red {
    color: #dc2626;
}

.order-item-product-cell {
    min-width: 220px;
}

.order-item-product-main {
    line-height: 1.35;
}

.order-item-delivery {
    white-space: nowrap;
}

.order-item-cart-cell {
    text-align: center;
}

.order-items-actions-th {
    width: 72px;
    text-align: center;
}

.order-items-expand-all {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.order-items-expand-all:hover,
.order-items-expand-all.active {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.order-item-actions-cell {
    width: 72px;
    vertical-align: top;
}

.order-item-actions-bar {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
}

.order-item-actions-row {
    display: flex;
    gap: 0.2rem;
    justify-content: center;
}

.order-item-action-btn {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--primary);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.order-item-action-btn:hover,
.order-item-action-btn.active {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.order-item-action-btn--warn {
    color: #dc2626;
}

.order-item-action-btn--magic {
    color: #7c3aed;
}

.order-item-row--expanded {
    background: var(--bg-hover);
}

.order-item-details {
    margin-top: 0.65rem;
    padding-top: 0.65rem;
    border-top: 1px dashed var(--border);
}

.order-item-details-tab-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.55rem;
}

.order-item-detail-tab {
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.28rem 0.55rem;
    font-size: 0.72rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.order-item-detail-tab:hover {
    border-color: var(--primary);
    color: var(--text);
}

.order-item-detail-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.order-item-detail-pane {
    display: none;
}

.order-item-detail-pane.active {
    display: block;
}

.order-item-inner-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.order-item-inner-table th {
    background: var(--bg-hover);
    padding: 0.4rem 0.5rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.order-item-inner-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.order-item-mini-table {
    width: auto;
    min-width: 100%;
    max-width: 100%;
    font-size: 0.72rem;
}

.order-item-mini-table th,
.order-item-mini-table td {
    padding: 0.28rem 0.45rem;
    white-space: nowrap;
}

.order-item-mini-table th:first-child,
.order-item-mini-table td:first-child {
    width: 130px;
}

.order-item-info-table th,
.order-item-info-table td {
    white-space: normal;
}

.order-item-mini-empty {
    color: var(--text-muted);
    font-style: normal;
    white-space: normal;
}

.order-item-info-table td:first-child {
    width: 42%;
    color: var(--text-muted);
}

.order-item-empty-tab {
    padding: 0.65rem 0.75rem;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.order-item-magic-menu {
    position: absolute;
    z-index: 400;
    min-width: 240px;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
    padding: 0.35rem 0;
    max-height: min(420px, 70vh);
    overflow-y: auto;
}

.order-item-magic-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.order-item-magic-menu-item:hover {
    background: var(--bg-hover);
}

.order-item-magic-menu-item.active {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    font-weight: 600;
}

.order-item-magic-menu-item i {
    width: 16px;
    color: var(--text-muted);
}

.order-item-status-menu {
    min-width: 200px;
}

.order-provider-window {
    max-height: 92vh;
}

.order-provider-form {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.order-provider-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
    gap: 1rem;
    padding: 0.75rem 1rem;
    min-height: 420px;
}

.order-provider-search h4,
.order-provider-sidebar h4 {
    margin: 0 0 0.65rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 600;
}

.order-provider-search-body {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    min-height: 300px;
    padding: 1rem;
}

.order-provider-search-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.order-provider-search-result {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-provider-search-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.45;
}

.order-provider-search-hint {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.order-provider-search-empty {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.order-provider-stock-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: auto;
}

.order-provider-stock-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.order-provider-stock-table th,
.order-provider-stock-table td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.5rem;
    vertical-align: top;
    text-align: left;
}

.order-provider-stock-table thead th {
    background: var(--bg-muted);
    font-weight: 600;
}

.order-provider-stock-product {
    min-width: 220px;
}

.order-provider-stock-receive-btn {
    display: inline-block;
    margin-top: 0.35rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: #fff;
    color: var(--primary);
    font-size: 0.72rem;
    cursor: pointer;
}

.order-provider-stock-receive-btn:hover {
    background: var(--primary);
    color: #fff;
}

[data-theme="dark"] .order-provider-stock-receive-btn {
    background: transparent;
}

.order-provider-stock-qty {
    text-align: center;
    font-weight: 700;
    white-space: nowrap;
}

.order-provider-stock-depot {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.order-provider-stock-type,
.order-provider-stock-place {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.order-warehouse-receive-window {
    max-width: 420px;
}

.order-warehouse-receive-form {
    padding: 0.75rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.order-warehouse-receive-product {
    margin: 0;
    font-weight: 600;
    line-height: 1.45;
}

.order-warehouse-receive-stock {
    margin: 0;
    font-size: 0.85rem;
}

.order-warehouse-receive-hint {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.order-provider-sidebar {
    border-left: 1px solid var(--border);
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.8rem;
}

.order-provider-product-name {
    font-weight: 700;
    font-size: 0.92rem;
    margin-bottom: 0.15rem;
}

.order-provider-info-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.order-provider-manufacturer {
    color: var(--primary);
}

.order-provider-prices {
    display: grid;
    gap: 0.2rem;
    margin-top: 0.15rem;
}

.order-provider-price-line {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 0.45rem;
    align-items: baseline;
    font-size: 0.82rem;
}

.order-provider-price-purchase {
    color: var(--text);
    font-weight: 600;
}

.order-provider-price-sale {
    color: #16a34a;
    font-weight: 600;
}

.order-provider-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    margin-top: 0.15rem;
}

.order-provider-field input,
.order-provider-field select {
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.35rem 0.45rem;
    font: inherit;
    font-size: 0.78rem;
}

.order-provider-note-example {
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.order-provider-note-example span {
    color: var(--text);
}

.order-provider-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.order-provider-autorder {
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 0.45rem 0.55rem;
    margin-top: 0.25rem;
}

[data-theme="dark"] .order-provider-autorder {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.35);
}

.order-provider-checkbox--highlight {
    color: var(--text);
    font-weight: 600;
}

.btn-link {
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.74rem;
    padding: 0;
    text-decoration: underline;
}

.order-item-provider-btn {
    color: var(--primary);
}

.order-item-provider-btn:hover {
    color: #1d4ed8;
}

.order-item-provider-btn--pending {
    color: #dc2626;
    animation: order-provider-pulse 1.4s ease-in-out infinite;
}

.order-supplier-orders-table .order-supplier-order-row--declined {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.order-supplier-orders-table .order-supplier-order-row--declined td {
    color: #b91c1c;
}

.order-supplier-decline-btn {
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.74rem;
    padding: 0;
    text-decoration: underline;
    white-space: nowrap;
}

.order-supplier-decline-btn:hover {
    color: #1d4ed8;
}

@keyframes order-provider-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 0 rgba(220, 38, 38, 0));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 6px rgba(220, 38, 38, 0.75));
        transform: scale(1.08);
    }
}

.order-item-cart-btn {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    line-height: 1;
}

.order-item-cart-btn:hover .item-cart-red {
    opacity: 0.75;
}

.order-items-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

.order-items-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
}

.order-sub-modal {
    position: fixed;
    inset: 0;
    z-index: 350;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.order-sub-modal--site {
    align-items: flex-start;
    justify-content: center;
    padding: 1.25rem 0.75rem;
    overflow-y: auto;
}

.order-sub-modal-window {
    width: min(460px, 96vw);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.order-sub-modal-window--interactive {
    position: relative;
}

.order-sub-modal-window--interactive.order-sub-modal-window--sized {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: none;
}

.order-sub-modal-header--draggable {
    cursor: move;
    user-select: none;
}

.order-sub-modal-header--dragging {
    cursor: grabbing;
}

.order-sub-modal-window--site,
.order-sub-modal-window.warehouse-invoice-window,
.order-sub-modal-window.order-provider-window {
    width: min(1400px, 98vw);
    max-width: 98vw;
}

.order-sub-modal-window--wide {
    width: min(560px, 96vw);
}

.order-return-window {
    width: min(560px, 96vw);
}

.order-return-form {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.order-return-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
}

.order-return-field input,
.order-return-field select {
    width: 100%;
}

.order-return-supplier-rows {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.order-return-supplier-rows--multi {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-hover);
}

.order-return-supplier-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(88px, 0.6fr);
    gap: 0.65rem;
    align-items: end;
}

.order-return-field--quantity input {
    text-align: right;
}

.order-return-approve-line {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-hover);
    font-size: 0.86rem;
}

.order-return-approve-line input {
    margin-top: 0.15rem;
}

.order-return-result-window {
    width: min(520px, 96vw);
}

.order-sub-modal-header h3 i {
    margin-right: 0.35rem;
}

.order-sub-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: var(--bg-hover);
    border-bottom: 1px solid var(--border);
}

.order-sub-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.order-sub-modal-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.1rem 0.35rem;
}

.order-sub-modal-close:hover {
    color: var(--text);
}

.order-add-item-hint,
.markup-example {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.order-add-item-form {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.order-add-item-field {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 0.55rem;
    align-items: center;
    font-size: 0.84rem;
}

.order-add-item-field span {
    color: var(--text-muted);
}

.order-add-item-field input,
.order-add-item-field select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.45rem 0.55rem;
    font-size: 0.84rem;
}

.order-sub-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.order-issue-confirm-body {
    padding: 1.4rem 1rem 1rem;
    text-align: center;
    color: var(--text);
}

.order-issue-confirm-body small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
}

.order-issue-actions {
    padding: 1rem;
    margin-top: 0;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

@media (max-width: 520px) {
    .order-add-item-field {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }
}

.order-vin-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.order-vin-presentation {
    font-size: 0.84rem;
    line-height: 1.5;
}

.order-vin-presentation-table {
    width: 100%;
    border-collapse: collapse;
}

.order-vin-presentation-left,
.order-vin-presentation-right {
    vertical-align: top;
    padding: 0.25rem 1rem 0.25rem 0;
}

.order-vin-presentation-left {
    width: 50%;
}

.order-vin-section-title {
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.order-vin-info-line {
    margin-bottom: 0.35rem;
}

.order-vin-info-line--spaced {
    margin-top: 0.65rem;
}

.order-vin-info-line a {
    color: var(--primary);
    text-decoration: none;
}

.order-vin-info-line a:hover {
    text-decoration: underline;
}

.order-vin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.order-vin-auto-grid {
    width: 100%;
    border-collapse: collapse;
}

.order-vin-auto-col {
    vertical-align: top;
    width: 50%;
    padding-right: 0.75rem;
}

.order-vin-fields-table {
    width: 100%;
    border-collapse: collapse;
}

.order-vin-fields-table td {
    padding: 0.2rem 0.5rem 0.2rem 0;
    vertical-align: top;
}

.order-vin-fields-table td:first-child {
    color: var(--text-muted);
    white-space: nowrap;
    padding-right: 0.65rem;
}

.order-vin-parts-block {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 0.82rem;
}

@media (max-width: 900px) {
    .order-vin-presentation-table tr {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .order-vin-presentation-left,
    .order-vin-presentation-right {
        width: 100%;
        padding-right: 0;
    }

    .order-vin-auto-grid tr {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .order-vin-auto-col {
        width: 100%;
        padding-right: 0;
    }
}

.vin-requests-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.vin-requests-table {
    width: 100%;
    min-width: 1050px;
    border-collapse: collapse;
}

.vin-requests-table th,
.vin-requests-table td {
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    vertical-align: top;
}

.vin-requests-table th {
    color: #1e3a8a;
    font-weight: 600;
}

.vin-requests-table th:nth-child(1),
.vin-requests-table .vin-request-main-row td:nth-child(1) {
    background: #dbe4ff;
}

.vin-requests-table th:nth-child(2),
.vin-requests-table .vin-request-main-row td:nth-child(2) {
    background: #eef2ff;
}

.vin-requests-table th:nth-child(3),
.vin-requests-table .vin-request-main-row td:nth-child(3) {
    background: #e6ffed;
}

.vin-requests-table th:nth-child(4),
.vin-requests-table .vin-request-main-row td:nth-child(4) {
    background: #fff9db;
}

.vin-requests-table th:nth-child(5),
.vin-requests-table .vin-request-main-row td:nth-child(5) {
    background: #e3faff;
}

.vin-requests-table th:nth-child(6),
.vin-requests-table .vin-request-main-row td:nth-child(6) {
    background: #ffe3f3;
}

.vin-requests-table th:nth-child(7),
.vin-requests-table .vin-request-main-row td:nth-child(7) {
    background: #e8f5e9;
}

[data-theme="dark"] .vin-requests-table th {
    color: var(--navbar-text);
}

[data-theme="dark"] .vin-requests-table th:nth-child(1),
[data-theme="dark"] .vin-requests-table .vin-request-main-row td:nth-child(1) {
    background: rgba(99, 102, 241, 0.28);
}

[data-theme="dark"] .vin-requests-table th:nth-child(2),
[data-theme="dark"] .vin-requests-table .vin-request-main-row td:nth-child(2) {
    background: rgba(99, 102, 241, 0.18);
}

[data-theme="dark"] .vin-requests-table th:nth-child(3),
[data-theme="dark"] .vin-requests-table .vin-request-main-row td:nth-child(3) {
    background: rgba(34, 197, 94, 0.14);
}

[data-theme="dark"] .vin-requests-table th:nth-child(4),
[data-theme="dark"] .vin-requests-table .vin-request-main-row td:nth-child(4) {
    background: rgba(234, 179, 8, 0.14);
}

[data-theme="dark"] .vin-requests-table th:nth-child(5),
[data-theme="dark"] .vin-requests-table .vin-request-main-row td:nth-child(5) {
    background: rgba(6, 182, 212, 0.14);
}

[data-theme="dark"] .vin-requests-table th:nth-child(6),
[data-theme="dark"] .vin-requests-table .vin-request-main-row td:nth-child(6) {
    background: rgba(236, 72, 153, 0.14);
}

[data-theme="dark"] .vin-requests-table th:nth-child(7),
[data-theme="dark"] .vin-requests-table .vin-request-main-row td:nth-child(7) {
    background: rgba(34, 197, 94, 0.16);
}

.vin-request-parts {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px dashed var(--border);
    color: var(--text-muted);
}

.vin-request-status {
    width: 100%;
    max-width: 140px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    padding: 0.35rem;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.2;
    box-sizing: border-box;
}

.vin-request-actions {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 110px;
    max-width: 140px;
}

.vin-request-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
}

.vin-request-action-buttons .btn-secondary {
    width: 100%;
    max-width: 140px;
    justify-content: flex-start;
    gap: 0.35rem;
    padding: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.2;
    box-sizing: border-box;
}

.vin-action-btn--select {
    border-color: #2563eb;
    color: #2563eb;
}

.vin-action-btn--order {
    border-color: #16a34a;
    color: #16a34a;
}

.vin-action-btn--email {
    border-color: #7c3aed;
    color: #7c3aed;
}

.vin-action-btn--hide {
    border-color: #64748b;
    color: #64748b;
}

.vin-action-btn--copy {
    border-color: #ea580c;
    color: #ea580c;
}

/* Панель инструментов */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.status-legend {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend-item i {
    font-size: 0.5rem;
}

.search-block {
    text-align: right;
    min-width: 220px;
}

.total-count {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.search-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
}

.search-label input {
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.95rem;
    width: 200px;
    outline: none;
}

/* Вкладки */
.tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    border-bottom: 2px solid var(--border);
}

.tab {
    background: rgba(15, 23, 42, 0.04);
    border: none;
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s, opacity 0.15s, background 0.15s;
    opacity: 0.45;
}

.tab:hover {
    color: var(--text);
    opacity: 0.72;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
    opacity: 1;
    background: transparent;
}

[data-theme="dark"] .tab:not(.active) {
    background: rgba(255, 255, 255, 0.03);
}

/* Таблица */
.table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.returns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.returns-table th,
.returns-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.returns-table th {
    background: var(--bg);
    font-weight: 600;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

.returns-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.04);
}

[data-theme="dark"] .returns-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

.returns-table tbody tr {
    cursor: pointer;
}

.return-card-modal {
    position: fixed;
    inset: 0;
    z-index: 380;
    background: rgba(15, 23, 42, 0.25);
}

.return-card-window {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(960px, 96vw);
    height: min(500px, 90vh);
    min-width: 640px;
    min-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#return-card-content {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.return-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    cursor: move;
    user-select: none;
}

.return-card-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.return-card-close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
}

.return-card-tabs {
    display: flex;
    gap: 0.15rem;
    padding: 0.3rem 0.35rem 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.return-card-tab {
    border: 1px solid var(--border);
    border-bottom: 0;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.4rem 0.65rem;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
}

.return-card-tab.active {
    color: var(--primary);
    box-shadow: inset 0 2px 0 var(--primary);
}

.return-card-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.35rem;
}

.return-card-pane {
    display: none;
}

.return-card-pane.active {
    display: block;
}

.return-card-section {
    display: grid;
    grid-template-columns: 42px 1fr;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    min-height: 78px;
}

.return-card-client {
    background: #eef5ff;
}

.return-card-supplier {
    background: #dbffd9;
    min-height: 205px;
}

.return-card-result-section {
    background: #ffe0e0;
    min-height: 78px;
}

.return-card-side-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    color: var(--primary);
    border-left: 1px solid rgba(148, 163, 184, 0.35);
    border-right: 1px solid rgba(148, 163, 184, 0.35);
    font-weight: 500;
}

.return-card-main {
    padding: 0.7rem;
    min-width: 0;
}

.return-card-summary {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.return-card-store-label {
    float: right;
}

.return-card-result {
    margin-top: 0.45rem;
    color: var(--text-muted);
}

.return-supplier-card {
    width: 260px;
    min-height: 168px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.return-supplier-head,
.return-supplier-status,
.return-supplier-note {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.return-supplier-name {
    margin-top: 0.45rem;
    font-weight: 700;
}

.return-supplier-part {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.82rem;
}

.return-supplier-action {
    margin-top: 0.65rem;
}

.return-card-bottom-line {
    padding: 0.35rem 0;
}

.return-card-history {
    display: grid;
    gap: 0.6rem;
    padding: 0.75rem;
}

.return-card-history-row {
    display: grid;
    grid-template-columns: 160px 180px 1fr;
    gap: 0.65rem;
    padding: 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}

.return-card-history-row span,
.return-card-history-row em {
    color: var(--text-muted);
    font-style: normal;
}

.return-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.35rem;
    padding: 0.45rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.return-card-resize {
    position: absolute;
    z-index: 2;
}

.return-card-resize-e {
    top: 0;
    right: 0;
    width: 8px;
    height: 100%;
    cursor: ew-resize;
}

.return-card-resize-s {
    left: 0;
    bottom: 0;
    width: 100%;
    height: 8px;
    cursor: ns-resize;
}

.return-card-resize-se {
    right: 0;
    bottom: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
}

.loading-cell,
.empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

.accepted-cell .accepted-time,
.datetime-cell .sub-datetime {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-prinyat .status-badge,
.status-badge.status-prinyat {
    background: rgba(22, 163, 74, 0.15);
    color: var(--status-prinyat);
}

.status-ne-prinyat .status-badge,
.status-badge.status-ne-prinyat {
    background: rgba(220, 38, 38, 0.15);
    color: var(--status-ne-prinyat);
}

.status-na-rasmotrenie .status-badge,
.status-badge.status-na-rasmotrenie {
    background: rgba(202, 138, 4, 0.18);
    color: var(--status-na-rasmotrenie);
}

.status-odobren .status-badge,
.status-badge.status-odobren {
    background: rgba(154, 205, 50, 0.22);
    color: var(--status-odobren);
}

.status-otkazano .status-badge,
.status-badge.status-otkazano {
    background: rgba(114, 47, 55, 0.18);
    color: var(--status-otkazano);
}

.status-otpravlen .status-badge,
.status-badge.status-otpravlen {
    background: rgba(37, 99, 235, 0.15);
    color: var(--status-otpravlen);
}

.status-zaproshen .status-badge,
.status-badge.status-zaproshen {
    background: rgba(147, 51, 234, 0.15);
    color: var(--status-zaproshen);
}

.legend-item.status-prinyat i { color: var(--status-prinyat); }
.legend-item.status-ne-prinyat i { color: var(--status-ne-prinyat); }
.legend-item.status-na-rasmotrenie i { color: var(--status-na-rasmotrenie); }
.legend-item.status-odobren i { color: var(--status-odobren); }
.legend-item.status-otkazano i { color: var(--status-otkazano); }
.legend-item.status-otpravlen i { color: var(--status-otpravlen); }
.legend-item.status-zaproshen i { color: var(--status-zaproshen); }

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 1.25rem;
}

.page-btn {
    min-width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Футер */
.site-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.site-footer a {
    color: var(--primary);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Панели */
.overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.25s;
}

.overlay.visible {
    opacity: 1;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100vh;
    background: var(--bg-card);
    z-index: 210;
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slide-panel.open {
    transform: translateX(0);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.panel-header h2 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.panel-close:hover {
    color: var(--text);
}

.panel-form {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.panel-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.88rem;
    font-weight: 500;
}

.panel-form input,
.panel-form select,
.panel-form textarea {
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}

.panel-form input:focus,
.panel-form select:focus,
.panel-form textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 0;
}

.field-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.form-error {
    color: #dc2626;
    font-size: 0.85rem;
    margin: 0;
}

.form-success {
    color: #16a34a;
    font-size: 0.85rem;
    margin: 0;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--navbar-bg);
    color: var(--navbar-text);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    z-index: 300;
    border: 1px solid var(--border);
    transition: transform 0.3s;
    font-size: 0.9rem;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.slide-panel-wide {
    width: min(480px, 100vw);
}

.panel-subtitle {
    margin: 0 0 0.65rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
}

.admins-list-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.admins-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.admins-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.admins-list .admin-login {
    font-weight: 600;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    white-space: nowrap;
}

.admin-badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

.admin-badge-main {
    background: rgba(37, 99, 235, 0.15);
    color: var(--primary);
}

.admin-badge-regular {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.admin-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.admins-loading,
.admins-empty {
    justify-content: center;
    color: var(--text-muted);
}

.login-lockout {
    color: #ca8a04;
    font-size: 0.85rem;
    margin: 0;
    padding: 0.5rem 0.65rem;
    background: rgba(202, 138, 4, 0.12);
    border-radius: 6px;
}

#login-submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.nav-btn-main-only.hidden,
.nav-btn-admin-only.hidden,
.col-supplier.hidden,
.col-actions.hidden {
    display: none !important;
}

.statuses-manage-list li {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.statuses-manage-list .status-actions {
    display: flex;
    gap: 0.35rem;
}

.status-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.status-meta-line {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
}

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.checkbox-label input {
    width: auto;
}

.form-actions-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.legend-loading {
    color: var(--text-muted);
}

#reason-custom-wrap.hidden {
    display: none !important;
}

.status-badge-dynamic {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.statistics-view {
    margin: 0 -1rem;
    width: calc(100% + 2rem);
    font-size: 0.8rem;
    background: #f3f6fb;
    color: #1f2937;
}

[data-theme="dark"] .statistics-view {
    background: var(--bg);
    color: var(--text);
}

.statistics-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0.85rem;
    background: #fff;
    border-bottom: 1px solid #d7e0ef;
}

[data-theme="dark"] .statistics-page-header {
    background: var(--bg-card);
    border-bottom-color: var(--border);
}

.statistics-page-header h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1d4ed8;
}

.statistics-page-subtitle {
    color: #64748b;
    font-size: 0.82rem;
    white-space: nowrap;
}

.statistics-menu {
    display: grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.55rem 0.65rem;
    background: #fff;
    border-bottom: 1px solid #d7e0ef;
}

[data-theme="dark"] .statistics-menu {
    background: var(--bg-card);
    border-bottom-color: var(--border);
}

.statistics-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0.15rem;
    min-height: 92px;
    padding: 0.45rem 0.25rem 0.35rem;
    border: 2px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.statistics-menu-item:hover {
    background: #f8fafc;
}

.statistics-menu-item.active {
    border-color: #16a34a;
    background: #f0fdf4;
}

[data-theme="dark"] .statistics-menu-item:hover {
    background: color-mix(in srgb, var(--border) 30%, transparent);
}

[data-theme="dark"] .statistics-menu-item.active {
    border-color: #22c55e;
    background: color-mix(in srgb, #22c55e 12%, transparent);
}

.statistics-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    font-size: 1.45rem;
}

.statistics-menu-item[data-stat-color="green"] .statistics-menu-icon { color: #16a34a; }
.statistics-menu-item[data-stat-color="orange"] .statistics-menu-icon { color: #ea580c; }
.statistics-menu-item[data-stat-color="red"] .statistics-menu-icon { color: #dc2626; }
.statistics-menu-item[data-stat-color="blue"] .statistics-menu-icon { color: #2563eb; }
.statistics-menu-item[data-stat-color="yellow"] .statistics-menu-icon { color: #ca8a04; }
.statistics-menu-item[data-stat-color="purple"] .statistics-menu-icon { color: #7c3aed; }
.statistics-menu-item[data-stat-color="cyan"] .statistics-menu-icon { color: #0891b2; }
.statistics-menu-item[data-stat-color="lime"] .statistics-menu-icon { color: #65a30d; }
.statistics-menu-item[data-stat-color="navy"] .statistics-menu-icon { color: #1d4ed8; }

.statistics-menu-title {
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.1;
}

.statistics-menu-desc {
    color: #64748b;
    font-size: 0.68rem;
    line-height: 1.15;
}

.statistics-toolbar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.85rem;
    background: #fff;
    border-bottom: 1px solid #d7e0ef;
    flex-wrap: wrap;
}

[data-theme="dark"] .statistics-toolbar {
    background: var(--bg-card);
    border-bottom-color: var(--border);
}

.statistics-select {
    min-width: 92px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #fff;
    color: inherit;
    padding: 0.28rem 0.45rem;
    font: inherit;
}

.statistics-show-btn {
    min-width: 88px;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
}

.statistics-more-link {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: #2563eb;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.statistics-more-link:hover {
    text-decoration: underline;
}

.statistics-body {
    background: #fff;
    padding: 0.55rem 0.85rem 0.85rem;
}

[data-theme="dark"] .statistics-body {
    background: var(--bg-card);
}

.statistics-summary-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.25rem;
    padding: 0.35rem 0 0.75rem;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 0.65rem;
}

.statistics-summary-col h3 {
    margin: 0 0 0.45rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #334155;
}

.statistics-kpi-table {
    width: 100%;
    border-collapse: collapse;
}

.statistics-kpi-table td {
    padding: 0.12rem 0;
    vertical-align: top;
    line-height: 1.35;
}

.statistics-kpi-table td:first-child {
    color: #475569;
    padding-right: 0.5rem;
    white-space: nowrap;
}

.statistics-kpi-table td:last-child {
    font-weight: 600;
    white-space: nowrap;
}

.statistics-profit {
    color: #15803d;
    font-weight: 700;
}

.statistics-profit--loss {
    color: #b45309;
}

.statistics-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.45rem;
    flex-wrap: wrap;
}

.statistics-detail-head h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: #334155;
}

.statistics-search-box {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
}

.statistics-search-label {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    font-size: 0.72rem;
    color: #64748b;
}

.statistics-search-label input {
    width: 220px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #fff;
    color: inherit;
    padding: 0.28rem 0.45rem;
    font: inherit;
}

.statistics-search-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #cbd5e1;
    border-radius: 3px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
}

.statistics-table-wrap {
    overflow-x: auto;
    border: 1px solid #d7e0ef;
    background: #fff;
}

.statistics-table-wrap--scroll {
    max-height: 420px;
    overflow-y: auto;
}

.statistics-table {
    width: 100%;
    min-width: 1380px;
    border-collapse: collapse;
}

.statistics-table--compact {
    min-width: 520px;
}

.statistics-table th,
.statistics-table td {
    padding: 0.32rem 0.42rem;
    border: 1px solid #d7e0ef;
    vertical-align: middle;
    text-align: left;
    white-space: nowrap;
    font-size: 0.78rem;
}

.statistics-table th {
    background: linear-gradient(180deg, #4f86c6 0%, #3b6fb2 100%);
    color: #fff;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.statistics-table tbody tr:nth-child(even) {
    background: #f8fbff;
}

.statistics-table tbody tr:hover {
    background: #eef6ff;
}

.statistics-rub {
    font-size: 0.72rem;
}

.statistics-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.statistics-money--profit {
    color: #15803d;
    font-weight: 700;
}

.statistics-money--loss {
    color: #b45309;
    font-weight: 700;
}

.statistics-order-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.statistics-order-link:hover {
    text-decoration: underline;
}

.statistics-col-note {
    width: 28px;
    min-width: 28px;
    padding: 0.2rem !important;
}

.statistics-note-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #22c55e;
    color: #fff;
    font-size: 0.62rem;
    cursor: help;
}

.statistics-row-note {
    display: none;
}

.statistics-alt-head {
    margin-bottom: 0.55rem;
}

.statistics-alt-head h3 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
}

.statistics-alt-value {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: #15803d;
}

.statistics-more-panel {
    background: #fff;
    border-top: 1px solid #d7e0ef;
    padding: 0.65rem 0.85rem 0.85rem;
}

.statistics-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.75rem;
}

.statistics-details-block h3 {
    margin: 0 0 0.45rem;
    font-size: 0.88rem;
}

@media (max-width: 1100px) {
    .statistics-menu {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

@media (max-width: 768px) {
    .site-title {
        font-size: 1.5rem;
    }

    .vin-form-grid,
    .vin-info-grid {
        grid-template-columns: 1fr;
    }

    .vin-car-row,
    .vin-contact-row {
        grid-template-columns: 1fr;
    }

    .vin-car-card {
        border-width: 8px;
    }

    .toolbar {
        flex-direction: column;
    }

    .search-block {
        text-align: left;
        width: 100%;
    }

    .search-label input {
        width: 100%;
    }
}

.order-public-link {
    margin-top: 0.35rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: 0.72rem;
    text-decoration: underline dotted;
    cursor: pointer;
}

.order-public-link:hover {
    color: var(--primary-hover, #1d4ed8);
}

.vin-manager-cell {
    min-width: 140px;
}

.vin-manager-name {
    font-weight: 600;
    line-height: 1.25;
}

.vin-manager-edit-link {
    display: inline-block;
    margin-top: 0.2rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--primary);
    font-size: 0.72rem;
    text-decoration: underline dotted;
    cursor: pointer;
}

.vin-manager-edit-link:hover {
    color: var(--primary-hover, #1d4ed8);
}

.vin-manager-foreign {
    margin-top: 0.25rem;
    color: #b91c1c;
    font-size: 0.68rem;
    line-height: 1.25;
}

.vin-manager-select {
    width: 100%;
    max-width: 220px;
    margin-top: 0.15rem;
    font-size: 0.82rem;
}

.vin-manager-view.hidden,
.vin-manager-select.hidden {
    display: none;
}

.order-public-view {
    padding: 1.5rem 0 2.5rem;
}

body.order-print-page {
    background: #fff;
}

body.order-print-page main.container {
    max-width: none;
    padding: 0;
    margin: 0;
}

.order-print-view {
    padding: 12mm;
    font: 12px/1.35 Arial, sans-serif;
    color: #111;
}

.order-print-error {
    max-width: 480px;
    margin: 2rem auto;
    padding: 1rem 1.25rem;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #991b1b;
    text-align: center;
}

@media print {
    body.order-print-page #admin-navbar,
    body.order-print-page .site-header,
    body.order-print-page .site-footer,
    body.order-print-page .loading-cell,
    body.order-print-page .order-print-error {
        display: none !important;
    }

    body.order-print-page main.container,
    body.order-print-page .order-print-view {
        padding: 0;
        margin: 0;
    }
}

.order-public-content {
    max-width: 1100px;
    margin: 0 auto;
}

.order-public-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem 1.75rem 2rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.order-public-title {
    margin: 0 0 1.25rem;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1d4ed8;
}

.order-public-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    line-height: 1.65;
}

.order-public-meta-col--right {
    text-align: right;
}

.order-public-label {
    color: var(--text-muted);
}

.order-public-vehicle-select {
    min-width: 260px;
    max-width: 100%;
    margin-left: 8px;
}

.order-public-table-wrap {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.order-public-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.order-public-table thead th {
    background: #dbeafe;
    color: #1e3a8a;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.55rem 0.45rem;
    border: 1px solid #bfdbfe;
    white-space: nowrap;
}

.order-public-table tbody td {
    padding: 0.55rem 0.45rem;
    border: 1px solid var(--border);
    vertical-align: top;
}

.order-public-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.order-public-code span {
    color: #1d4ed8;
    font-weight: 600;
}

.order-public-brand-info {
    margin-left: 0.2rem;
    color: #60a5fa;
    font-size: 0.72rem;
}

.order-public-term-icon {
    color: #ef4444;
    margin-right: 0.15rem;
}

.order-public-price,
.order-public-total {
    font-weight: 700;
    color: #1d4ed8;
    white-space: nowrap;
}

.order-public-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 1rem 0 1.5rem;
    font-size: 0.84rem;
}

.order-public-qr {
    text-align: center;
}

.order-public-qr-toggle {
    border: 0;
    background: none;
    color: #1d4ed8;
    font-size: 0.84rem;
    cursor: pointer;
    text-decoration: none;
}

.order-public-qr-toggle:hover {
    text-decoration: underline;
}

.order-public-qr-block {
    margin-top: 1rem;
}

.order-public-qr-block img {
    display: inline-block;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
}

.order-public-error {
    text-align: center;
    padding: 2rem;
    color: #dc2626;
}

@media (max-width: 900px) {
    .order-public-meta,
    .order-public-summary {
        grid-template-columns: 1fr;
    }

    .order-public-meta-col--right {
        text-align: left;
    }
}

.stock-stats-panel {
    margin-bottom: 1rem;
}

.stock-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stock-stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: grid;
    gap: 0.35rem;
}

.stock-stats-card--warning {
    border-color: #f59e0b;
}

.stock-stats-label {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.stock-stats-value {
    font-size: 1.35rem;
}

.stock-stats-types h3 {
    font-size: 0.95rem;
    margin-bottom: 0.65rem;
}

.stock-row--warning {
    background: rgba(245, 158, 11, 0.08);
}

.warehouse-invoice-lookup-panel {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.warehouse-invoice-lookup-panel input {
    flex: 1;
}

.integrations-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.65rem;
}

.integrations-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    background: var(--bg-card);
}

.integrations-item-head {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.35rem;
}

.integrations-item-message {
    color: var(--text-muted);
    font-size: 0.82rem;
    word-break: break-all;
}

.integrations-status {
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    white-space: nowrap;
}

.integrations-status--ok {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.integrations-status--fail {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.integrations-status--configured {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
}

.integrations-status--off {
    background: var(--bg-hover);
    color: var(--text-muted);
}

.integrations-actions {
    margin-bottom: 1rem;
}

.vin-response-link-line {
    margin: 0.75rem 0 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.vin-response-public-view {
    padding: 1.5rem 0 2.5rem;
}

.vin-response-public-content {
    max-width: 1100px;
    margin: 0 auto;
}

.vin-response-public-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem 1.75rem 2rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.vin-response-public-title {
    margin: 0 0 1rem;
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1d4ed8;
}

.vin-response-public-intro,
.vin-response-public-note,
.vin-response-public-hint {
    margin: 0 0 0.85rem;
    line-height: 1.45;
}

.vin-response-public-table-wrap {
    overflow-x: auto;
    margin: 1rem 0;
}

.vin-response-public-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.vin-response-public-table thead th {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    padding: 0.45rem 0.5rem;
    text-align: left;
    white-space: nowrap;
}

.vin-response-public-table tbody td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.5rem;
    vertical-align: middle;
}

.vin-response-public-table tbody tr:nth-child(even) {
    background: rgba(148, 163, 184, 0.08);
}

.vin-response-public-price,
.vin-response-public-total {
    white-space: nowrap;
    font-weight: 600;
}

.vin-response-public-check {
    text-align: center;
    width: 2.5rem;
}

.vin-response-public-selection {
    margin: 0.75rem 0;
    font-weight: 600;
    color: var(--text);
}

.vin-response-public-actions {
    margin: 0.75rem 0 1rem;
}

.vin-response-public-expired {
    margin-top: 1.25rem;
    padding: 1rem;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.08);
}

.vin-response-public-expired p {
    margin: 0 0 0.75rem;
}

.vin-response-public-loading,
.vin-response-public-error {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
}

.vin-response-public-error {
    color: #b91c1c;
}

#vin-processing-request-wrap {
    margin-bottom: 0.75rem;
}

.vin-processing-view .parts-editor {
    margin-top: 0.75rem;
}

#vin-processing-request-wrap .vin-response-link-line {
    margin: 0.65rem 0 0;
}

.client-honeypot-wrap {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.client-auth-form .link-btn {
    border: none;
    background: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-decoration: underline;
}

.client-cabinet-nav {
    padding: 0 1rem;
}

.client-cabinet-nav.hidden + .client-cabinet-view,
.client-cabinet-nav:not(.hidden) + .client-cabinet-detail-view {
    padding-top: 0;
}

.client-cabinet-detail-view {
    padding: 0 1rem 1.5rem;
}

.client-cabinet-view {
    padding: 0 1rem 1.5rem;
}

.client-cabinet-header h2 {
    margin: 0 0 0.35rem;
    color: var(--primary);
    font-weight: 500;
}

.client-cabinet-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.client-cabinet-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.client-cabinet-nav-btn {
    pointer-events: auto;
}

.site-header .public-cart-btn {
    min-height: 38px;
}

.client-cabinet-greeting {
    margin: 0 0 0.85rem;
    color: var(--text-muted);
}

.client-cabinet-staff-notice {
    margin-bottom: 1rem;
}

.client-cabinet-staff-notice-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 1rem 1.15rem;
    color: var(--text);
    line-height: 1.55;
}

.client-cabinet-staff-notice-card p {
    margin: 0 0 0.75rem;
}

.client-cabinet-staff-notice-card p:last-child {
    margin-bottom: 0;
}

.client-cabinet-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.client-cabinet-tab {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0.45rem 0.85rem;
    cursor: pointer;
}

.client-cabinet-tab-summary {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    min-height: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.client-cabinet-tab-stat {
    white-space: nowrap;
}

.client-cabinet-tab-stat + .client-cabinet-tab-stat {
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.client-cabinet-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

.client-cabinet-cars-wrap {
    padding-bottom: 1rem;
}

.client-cars-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.client-cars-table input[type="text"] {
    width: 100%;
    min-width: 70px;
    box-sizing: border-box;
}

.client-cars-actions {
    white-space: nowrap;
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.client-cars-add-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.client-cars-add-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.client-cars-add-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem 0.75rem;
    margin-bottom: 0.85rem;
}

.client-cars-add-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.client-cars-add-grid input {
    min-height: 2.1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 0.55rem;
    background: var(--bg);
    color: var(--text);
}

.client-cars-row--edit td {
    vertical-align: middle;
}

.client-order-balance-pay {
    margin: 1.25rem 0 0;
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.05);
}

.client-order-balance-pay h3 {
    margin: 0 0 0.65rem;
    font-size: 1.1rem;
    color: var(--primary);
}

.client-order-balance-pay-note,
.client-order-balance-pay-hint {
    margin: 0 0 0.75rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.client-order-balance-pay-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
}

.client-order-balance-pay-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 180px;
}

.client-order-balance-pay-field span {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.client-order-balance-pay-field input {
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 1rem;
}

.vin-saved-cars {
    width: 100%;
}

.vin-saved-cars select {
    width: 100%;
    min-height: 2.35rem;
}

.vin-saved-cars-hint {
    margin: 0.5rem 0 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}

.client-cabinet-table-wrap {
    overflow-x: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
}

.client-cabinet-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.client-cabinet-table th,
.client-cabinet-table td {
    border: 1px solid var(--border);
    padding: 0.45rem 0.55rem;
    vertical-align: top;
}

.client-cabinet-table th {
    background: #eff6ff;
    color: #1e3a8a;
    text-align: left;
}

.client-cabinet-row--link {
    cursor: pointer;
}

.client-cabinet-row--link:hover td {
    background: var(--bg-hover);
}

.client-request-contacts {
    min-width: 180px;
}

.client-request-phone-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.client-request-phone-edit-btn {
    padding: 0;
    font-size: 0.85rem;
}

.client-request-email-line {
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.client-request-phone-edit {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.client-request-phone-input {
    width: 100%;
    min-width: 160px;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    font-size: 0.95rem;
}

.client-request-phone-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.client-order-back-wrap {
    max-width: 1100px;
    margin: 0 auto 0.75rem;
    padding: 0 1rem;
}

.settings-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.auth-mode-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0 1rem 0.75rem;
}

.auth-mode-tab {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0.45rem 0.65rem;
    cursor: pointer;
    font-size: 0.88rem;
}

.auth-mode-tab.active {
    border-color: var(--primary);
    color: var(--primary);
    background: #eff6ff;
}

.client-balance-amount--minus {
    color: #b91c1c;
    font-weight: 600;
}

.clients-cell-balance {
    white-space: nowrap;
}

.clients-balance-value {
    display: inline-block;
    min-width: 4.5rem;
}

.clients-balance-topup-btn {
    width: 24px;
    height: 24px;
    margin-left: 0.35rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
    padding: 0;
}

.clients-balance-topup-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.clients-cell-discount {
    white-space: nowrap;
}

.clients-discount-value {
    display: inline-block;
    min-width: 3rem;
}

.clients-discount-edit-btn {
    width: 24px;
    height: 24px;
    margin-left: 0.35rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
    padding: 0;
}

.clients-discount-edit-btn:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
}

.client-discount-admin-window {
    width: min(420px, 96vw);
}

.client-balance-admin-window {
    width: min(560px, 96vw);
}

.client-balance-admin-info {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 0.85rem;
}

.client-balance-admin-info th,
.client-balance-admin-info td {
    padding: 0.35rem 0.5rem 0.35rem 0;
    text-align: left;
    vertical-align: top;
}

.client-balance-admin-info th {
    width: 42%;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

.client-balance-admin-info td {
    color: var(--text);
}

.client-admin-field select {
    width: 100%;
    min-height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    padding: 0.45rem 0.65rem;
}

#panel-login .auth-mode-panel {
    padding-top: 0;
}

.client-cabinet-balance-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text);
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font: inherit;
}

.client-cabinet-balance-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.client-cabinet-balance-label {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.client-cabinet-balance-value {
    font-weight: 700;
    white-space: nowrap;
}

.client-balance-view {
    padding-top: 0;
}

.client-balance-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.15rem 1.25rem;
}

.client-balance-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin-bottom: 0.35rem;
}

.client-balance-summary {
    flex: 1 1 220px;
}

.client-balance-summary-label {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 0.2rem;
}

.client-balance-summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.15;
}

.client-balance-topup-btn[disabled] {
    opacity: 0.65;
    cursor: not-allowed;
}

.client-balance-topup-note {
    margin: 0 0 1rem;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.client-balance-history-title {
    margin: 0 0 0.65rem;
    font-size: 1.05rem;
    font-weight: 600;
}

.client-balance-table-wrap {
    overflow: auto;
}

.client-balance-amount--plus {
    color: #166534;
    font-weight: 600;
}

.client-balance-amount--minus {
    color: #b91c1c;
    font-weight: 600;
}

.header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-btn {
    position: relative;
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.68rem;
    line-height: 17px;
    font-weight: 700;
}

.tasks-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.tasks-page-header h2 {
    margin: 0;
}

.tasks-page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tasks-table-wrap,
.order-tasks-pane {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: auto;
}

.tasks-table,
.order-tasks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tasks-table th,
.tasks-table td,
.order-tasks-table th,
.order-tasks-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.45rem 0.55rem;
    text-align: left;
    vertical-align: top;
}

.tasks-table th,
.order-tasks-table th {
    background: var(--bg-muted);
    font-weight: 600;
}

.task-row--active {
    background: #fff0bb !important;
}

.order-task-row--active {
    background: #fecdd3 !important;
}

.task-row--done,
.order-task-row--done {
    opacity: 0.58;
    background: var(--bg-card);
}

.task-title-cell,
.order-tasks-table tbody td:nth-child(3) {
    color: var(--text);
    font-weight: 400;
    font-size: inherit;
}

.task-row--done .task-title-cell,
.order-task-row--done td:nth-child(3) {
    color: var(--text-muted);
    font-weight: 400;
}

.order-task-row--done {
    color: var(--text-muted);
    font-weight: 400;
}

.task-modal-window {
    width: min(92vw, 760px);
    max-width: 760px;
}

.task-card-window {
    width: min(94vw, 980px);
    max-width: 980px;
}

.task-card-body {
    padding: 0.85rem 1rem 1rem;
    max-height: min(78vh, 900px);
    overflow: auto;
}

.task-card-error {
    padding: 0.75rem;
    color: var(--danger);
}

.task-form,
.task-comment-form {
    display: grid;
    gap: 0.7rem;
}

.task-field {
    display: grid;
    gap: 0.3rem;
}

.task-field span {
    font-weight: 600;
}

.task-field input,
.task-field select,
.task-field textarea,
.task-comment-form textarea {
    width: 100%;
}

.task-card-main {
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem;
    border-radius: 8px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    margin-bottom: 0.75rem;
}

.task-card-main--done {
    opacity: 0.82;
}

.task-card-complete {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
    font-weight: 700;
}

.task-card-assignee {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.task-card-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.45;
    color: var(--text);
    white-space: pre-wrap;
}

.task-card-main--done .task-card-title {
    color: var(--text-muted);
}

.task-card-order {
    margin-bottom: 0.85rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}

.task-card-order-head {
    margin-bottom: 0.55rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.task-card-order-meta {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 0.65rem;
    font-size: 0.84rem;
    line-height: 1.45;
}

.task-card-order-label {
    color: var(--text-muted);
}

.task-card-debt--alert {
    color: var(--danger);
    font-weight: 700;
}

.task-card-items-wrap {
    overflow-x: auto;
    margin-bottom: 0.55rem;
}

.task-card-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.task-card-items-table th,
.task-card-items-table td {
    padding: 0.3rem 0.45rem;
    border: 1px solid var(--border);
    vertical-align: top;
}

.task-card-items-table th {
    background: var(--bg-hover);
    font-weight: 600;
    white-space: nowrap;
}

.task-card-selection {
    font-size: 0.84rem;
    color: var(--text-muted);
}

.task-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.task-quick-comments {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 0.75rem;
}

.task-comments-list {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.task-comment {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.55rem 0.65rem;
    background: var(--bg-card);
}

.task-comment strong {
    margin-right: 0.5rem;
}

.task-comment span {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.task-comment p {
    margin: 0.35rem 0 0;
}

.task-comments-empty {
    color: var(--text-muted);
}

.order-task-create-btn {
    margin: 0.75rem;
}

.pricelist-view {
    width: 100%;
    margin: 0;
    padding: 0 1rem 1.5rem;
}

.pricelist-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.pricelist-page-header h2 {
    margin: 0 0 0.35rem;
    color: var(--primary);
    font-weight: 500;
}

.pricelist-page-subtitle {
    margin: 0;
    color: var(--text-muted);
}

.pricelist-page-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.pricelist-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr) 320px;
    gap: 1rem;
    align-items: start;
}

.pricelist-sidebar,
.pricelist-events-panel,
.pricelist-editor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.pricelist-sidebar-head,
.pricelist-events-head {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

.pricelist-sidebar-actions {
    display: flex;
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.pricelist-active-filter {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
}

.pricelist-suppliers-list {
    max-height: calc(100vh - 260px);
    overflow: auto;
}

.pricelist-supplier-item {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    padding: 0.85rem 1rem;
    cursor: pointer;
}

.pricelist-supplier-item.active,
.pricelist-supplier-item:hover {
    background: rgba(59, 130, 246, 0.08);
}

.pricelist-supplier-id {
    display: inline-block;
    min-width: 2.5rem;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.pricelist-supplier-name {
    display: block;
    font-weight: 600;
    margin: 0.15rem 0;
}

.pricelist-supplier-meta,
.pricelist-supplier-status {
    display: block;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.pricelist-supplier-status.muted {
    color: #c0392b;
}

.pricelist-main {
    min-height: 420px;
}

.pricelist-welcome {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
}

.pricelist-welcome ul {
    margin: 0.75rem 0 0;
    padding-left: 1.2rem;
}

.pricelist-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.pricelist-editor-tabs {
    display: flex;
    gap: 0.35rem;
    padding: 0.75rem 1rem 0;
}

.pricelist-editor-tab {
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    background: var(--bg);
    padding: 0.45rem 0.85rem;
    cursor: pointer;
}

.pricelist-editor-tab.active {
    background: var(--bg-card);
    color: var(--primary);
}

.pricelist-editor-pane {
    padding: 1rem;
}

.pricelist-editor-pane label {
    display: block;
    margin-bottom: 0.85rem;
}

.pricelist-events-list {
    max-height: calc(100vh - 260px);
    overflow: auto;
    padding: 0.75rem;
}

.pricelist-event-item {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.65rem;
}

.pricelist-event-item--critical {
    border-left: 4px solid #c0392b;
}

.pricelist-event-meta {
    display: flex;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 0.35rem;
}

.pricelist-modal-content {
    width: min(640px, calc(100vw - 2rem));
}

.pricelist-help-body {
    padding: 0 1rem 1rem;
    line-height: 1.55;
}

.public-show-supplier-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 500;
}

.public-offers-table:not(.public-offers-table--show-supplier) .public-supplier-field {
    visibility: hidden;
}

.public-photo-btn {
    border: 0;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
}

.public-photo-modal {
    position: fixed;
    inset: 0;
    z-index: 230;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--overlay);
}

.public-photo-modal-content {
    position: relative;
    width: min(900px, calc(100vw - 2rem));
    padding: 0;
    overflow: hidden;
}

.public-photo-modal-content img {
    display: block;
    width: 100%;
    max-height: calc(100vh - 4rem);
    object-fit: contain;
    background: #111;
}

.public-photo-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
}

@media (max-width: 1100px) {
    .pricelist-layout {
        grid-template-columns: 1fr;
    }

    .pricelist-suppliers-list,
    .pricelist-events-list {
        max-height: none;
    }
}
