/* ПростоСклад: единая полировка интерфейса поверх базовых стилей. */

:root {
    --ps-page-max: none;
    --ps-card-border: #c9d3df;
    --ps-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 12px 28px -24px rgba(15, 23, 42, 0.45);
    --ps-card-shadow-hover: 0 2px 5px rgba(15, 23, 42, 0.08), 0 18px 38px -26px rgba(15, 23, 42, 0.55);
    --ps-control-h: 38px;
    --ps-shell-x: clamp(16px, 1.85vw, 34px);
    --ps-ink: #07111f;
    --ps-panel: #ffffff;
    --ps-topbar: #0a1020;
    --ps-topbar-2: #111c31;
}

body {
    background:
        linear-gradient(180deg, rgba(247, 249, 252, 0.98) 0%, rgba(238, 243, 249, 0.98) 100%);
    color: var(--ps-ink);
    font-weight: 700;
}

.app-main {
    width: 100%;
    min-width: 0;
}

.content-wrap {
    width: 100%;
    min-width: 0;
}

.main {
    width: 100%;
    max-width: var(--ps-page-max);
    margin: 20px 0 30px;
    padding-left: var(--ps-shell-x);
    padding-right: var(--ps-shell-x);
}

.primary-topbar {
    min-height: 66px;
    padding-left: var(--ps-shell-x);
    padding-right: var(--ps-shell-x);
    gap: 16px;
    background:
        linear-gradient(180deg, rgba(23, 36, 62, 0.98), rgba(8, 14, 27, 0.99)),
        var(--ps-topbar);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 28px -22px rgba(15, 23, 42, 0.95);
}

.primary-brand {
    min-height: 44px;
    font-weight: 900;
    letter-spacing: 0;
    padding-right: 4px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0) 38%),
        linear-gradient(135deg, #2563eb 0%, #0f766e 100%);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 8px 20px -12px rgba(37, 99, 235, 0.95);
}

.brand-text {
    letter-spacing: 0;
}

.primary-nav {
    gap: 6px;
    padding: 4px 0;
}

.primary-link {
    min-height: 42px;
    padding: 0 13px;
    color: #d7e1ef;
    border: 1px solid transparent;
    font-weight: 900;
    border-radius: 10px;
    letter-spacing: 0;
}

.primary-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.primary-link.active {
    background: #f8fafc;
    color: #07111f;
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 10px 22px -16px rgba(255, 255, 255, 0.9);
}

.primary-link.active .primary-ico {
    color: #1d4ed8;
}

.primary-right {
    gap: 8px;
}

.primary-icon-link,
.appbar-logout,
.appbar-user {
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.045);
}

.primary-icon-link:hover,
.appbar-logout:hover,
.appbar-user:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-weight: 900;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 40%),
        linear-gradient(135deg, #2563eb, #0f766e);
}

.subtabs {
    min-height: 48px;
    padding-left: var(--ps-shell-x);
    padding-right: var(--ps-shell-x);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid #cfd8e3;
    box-shadow: 0 8px 18px -20px rgba(15, 23, 42, 0.48);
}

.subtab {
    border: 1px solid transparent;
    color: #334155;
    font-weight: 900;
    border-radius: 9px;
    min-height: 34px;
}

.subtab:hover {
    background: #eef4ff;
    border-color: #c9d8f8;
    color: #1d4ed8;
}

.subtab.active {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
    box-shadow: 0 8px 16px -14px rgba(29, 78, 216, 0.9);
}

.toolbar,
.doc-header,
.dash-hero,
.price-preview-head {
    border-bottom-color: #d5dde8;
    gap: 14px;
}

.toolbar h1,
.doc-title h1,
.form-card h1,
.dash-hero h1 {
    color: #07111f;
    font-weight: 900;
    letter-spacing: 0;
}

.toolbar,
.doc-header,
.form-card,
.doc-section,
.dash-card,
.card,
.empty,
.empty-state,
.plugin-card {
    border-radius: 10px;
}

.doc-section,
.form-card,
.card,
.dash-card,
.plugin-card,
.empty,
.empty-state {
    border-color: var(--ps-card-border) !important;
    box-shadow: var(--ps-card-shadow);
}

.doc-section,
.form-card,
.dash-card {
    background: #fff;
}

.doc-section:hover,
.form-card:hover,
.dash-card:hover,
.plugin-card:hover {
    box-shadow: var(--ps-card-shadow-hover);
}

.doc-section-title,
.dash-card-head,
.table-tools-top,
.li-toolbar {
    background: #f8fafc;
    border-color: #d8e0ea;
}

.doc-section-title,
.field label,
.dash-card-head h2 {
    color: #111827;
    font-weight: 900;
}

.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select,
.table-filter,
.bulk-bar select,
.li-cols-btn,
.table-tool-btn {
    min-height: var(--ps-control-h);
    border-color: #aebacc;
    border-radius: 9px;
    background: #fff;
    color: #0b1220;
    font-weight: 800;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus,
.table-filter:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
    outline: none;
}

.field textarea {
    line-height: 1.35;
}

.field .help,
.helptext {
    color: #64748b;
    font-weight: 700;
}

.btn-primary,
.btn-primary-small,
.btn-secondary,
.btn-danger,
.bulk-act,
.table-tool-btn,
.wms-btn {
    font-weight: 900;
    letter-spacing: 0;
}

.btn-primary,
.btn-primary-small {
    background: linear-gradient(180deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    box-shadow: 0 1px 2px rgba(29, 78, 216, 0.22), 0 10px 18px -14px rgba(29, 78, 216, 0.7);
}

.btn-secondary,
.table-tool-btn,
.bulk-act {
    border-color: #b6c2d2;
    background: #fff;
    color: #172033;
}

.btn-secondary:hover,
.table-tool-btn:hover,
.bulk-act:hover {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
}

.table {
    border-color: #c9d3df;
    box-shadow: var(--ps-card-shadow);
    overflow: hidden;
    width: 100%;
}

.table thead th {
    background: #eef3f8;
    color: #111827;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
    border-bottom-color: #cbd5e1;
    white-space: nowrap;
    height: 42px;
}

.table tbody td {
    color: #111827;
    font-weight: 800;
    border-bottom-color: #e1e7ef;
    vertical-align: middle;
}

.table tbody tr:hover td {
    background: #f8fbff;
}

.table .num,
.lines-table .num,
.li-sum {
    font-variant-numeric: tabular-nums;
    font-weight: 850;
}

.table tbody td strong,
.table tbody td strong a,
.table tbody td a strong {
    font-weight: 900;
}

.table th:has(> input[type="checkbox"]),
.table td:has(> input[type="checkbox"]) {
    text-align: center;
}

input[type="checkbox"] {
    accent-color: #2563eb;
}

.badge {
    border: 1px solid rgba(15, 23, 42, 0.08);
    font-weight: 900;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.cell-sub,
.small,
.muted {
    color: #526174;
    font-weight: 750;
}

.bulk-bar {
    border-color: #b9c4d4;
    box-shadow: var(--ps-card-shadow);
}

.list-cols-menu,
.li-cols-menu,
.bulk-menu,
.status-picker-menu {
    border-color: #c4cfdd;
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.16);
}

.lines-table {
    border-color: #c9d3df;
    box-shadow: var(--ps-card-shadow);
}

.lines-table th {
    background: #f1f5f9;
    color: #172033;
    font-weight: 900;
}

.lines-table input,
.lines-table select {
    font-weight: 800;
    color: #0b1220;
}

.thumb {
    border: 1px solid #d7dee8;
    background: #eef2f6;
}

.attn-card,
.mini-stat,
.quick-row {
    border-color: #c9d3df;
}

.attn-card:hover,
.mini-stat:hover,
.quick-row:hover,
.card:hover {
    border-color: #9fb2cc;
}

.attn-card,
.mini-stat,
.quick-row,
.card,
.dash-card,
.doc-section,
.form-card {
    transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.mini-stat:hover,
.quick-row:hover,
.attn-card:hover {
    transform: translateY(-1px);
}

.dash-card-head h2,
.doc-section-title h2,
.doc-section-title strong {
    letter-spacing: 0;
}

.table-tools,
.table-tools-left,
.table-tools-actions {
    align-items: center;
}

.table-tools-top {
    margin-left: auto;
    justify-content: flex-end;
}

.table-tools-standard {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 8px 10px;
    border: 1px solid #c9d3df;
    border-bottom: 0;
    border-radius: 10px 10px 0 0;
    background: #f8fafc;
}

.table-tools-standard + .table,
.table-tools-standard + .table-wrap .table,
.table-tools-standard + .list-table {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.table-tools-standard .table-tools-left {
    flex: 1 1 auto;
    min-width: 260px;
}

.table-tools-standard .table-tools-actions {
    margin-left: auto;
}

.table-tools-standard .li-cols,
.table-tools-standard .list-cols {
    margin-left: auto;
}

.table-filter {
    width: min(340px, 46vw);
    min-height: 36px;
    border-radius: 9px;
    font-weight: 800;
}

.table-count {
    color: #526174;
    font-weight: 850;
}

.table-clear {
    min-height: 34px;
}

.lc-btn,
.li-cols-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    white-space: nowrap;
}

.lc-menu,
.li-cols-menu {
    text-align: left;
}

.table th:first-child:has(input[type="checkbox"]),
.table td:first-child:has(input[type="checkbox"]),
.lines-table .col-select {
    width: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: center;
}

.table input[type="checkbox"],
.lines-table input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    vertical-align: middle;
}

.sort-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.sort-link:hover {
    color: #1d4ed8;
    text-decoration: none;
}

.sort-link span {
    min-width: 12px;
    color: #1d4ed8;
    font-weight: 900;
    text-align: center;
}

.table thead th {
    position: sticky;
    top: calc(var(--topnav-h) + var(--subnav-h));
    z-index: 8;
}

.doc-status-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid #c9d3df;
    border-radius: 10px;
    background: #f8fafc;
}

.doc-status-group,
.doc-status-actions {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.doc-status-label {
    color: #526174;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.status-picker {
    position: relative;
}

.status-picker summary {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 9px;
    border: 1px solid #b8c4d4;
    border-radius: 9px;
    background: #fff;
    color: #0b1220;
    cursor: pointer;
    list-style: none;
    font-weight: 900;
}

.status-picker summary::-webkit-details-marker {
    display: none;
}

.status-picker[open] summary {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.status-picker-value {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    max-width: min(420px, 54vw);
    overflow: hidden;
}

.status-picker-value .badge {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.status-picker-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 8px);
    z-index: 45;
    min-width: 260px;
    max-width: min(360px, calc(100vw - 24px));
    max-height: 360px;
    overflow: auto;
    padding: 8px;
    border: 1px solid #c4cfdd;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.status-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 850;
}

.status-check:hover {
    background: #f1f5f9;
}

.status-picker-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e1e7ef;
}

@media (min-width: 1180px) {
    .split-layout {
        gap: 26px;
    }

    .subsidebar {
        width: 260px;
    }
}

@media (max-width: 900px) {
    :root {
        --ps-shell-x: 14px;
    }

    .primary-topbar {
        min-height: 104px;
        align-items: flex-start;
        padding-top: 9px;
        padding-bottom: 8px;
    }

    .primary-brand {
        min-height: 36px;
    }

    .primary-nav {
        padding-bottom: 0;
    }

    .subtabs {
        position: sticky;
        top: 104px;
        min-height: 42px;
    }
}

.empty,
.empty-state {
    color: #526174;
    font-weight: 800;
}

@media (max-width: 900px) {
    .main {
        padding-left: 10px;
        padding-right: 10px;
    }

    .toolbar,
    .doc-header,
    .dash-hero {
        gap: 10px;
    }

    .primary-nav {
        scrollbar-width: none;
    }

    .primary-nav::-webkit-scrollbar,
    .subtabs::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 640px) {
    :root {
        --ps-control-h: 38px;
    }

    body {
        background: #f3f6fa;
    }

    .main {
        padding-left: 8px;
        padding-right: 8px;
    }

    .toolbar,
    .doc-header,
    .form-card,
    .doc-section,
    .dash-card {
        border-radius: 12px;
    }

    .toolbar h1,
    .doc-title h1,
    .form-card h1,
    .dash-hero h1 {
        font-size: 20px;
        line-height: 1.15;
    }

    .field input,
    .field select,
    .field textarea,
    .toolbar input,
    .toolbar select,
    .table-filter {
        font-size: 13px;
    }

    .table.list-table tr,
    .report-table tr,
    .dash-table tr {
        border-color: #c9d3df;
        box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
        background: #fff;
    }

    .table.list-table td::before,
    .report-table td::before,
    .dash-table td::before {
        color: #5b687a;
        letter-spacing: 0;
    }

    .doc-summary {
        grid-template-columns: 1fr;
    }

    .ds-item {
        border-color: #d3dbe7;
    }

    .messages {
        padding-left: 8px;
        padding-right: 8px;
    }

    .primary-topbar {
        box-shadow: 0 8px 18px -18px rgba(15, 23, 42, 0.9);
    }

    .primary-link {
        background: rgba(255, 255, 255, 0.06);
        color: #e2e8f0;
    }

    .primary-link.active {
        background: #fff;
        color: #0b1220;
    }

    .subtab {
        background: #fff;
        border-color: #d5dde8;
    }

    .table.list-table td,
    .report-table td,
    .dash-table td {
        font-weight: 800;
    }

    .table.list-table td::before,
    .report-table td::before,
    .dash-table td::before {
        font-weight: 900;
    }

    .table.list-table[data-list-key="products"] tr {
        border-color: #c7d2df;
        background: linear-gradient(180deg, #fff, #fbfdff);
    }

    .table.list-table[data-list-key="products"] .product-link strong {
        color: #07111f;
    }
}

/* Зебра в списках документов: чередование белый / светло-серый (кроме сканер-приложения) */
body:not(.wms) .table.list-table tbody tr:nth-child(even) { background: #f5f7fa; }
body:not(.wms) .table.list-table tbody tr:nth-child(even):hover td { background: #eef4ff; }
