:root {
    --bg: #0b0f14;
    --bg-soft: #111821;
    --panel: #151d27;
    --panel-2: #1b2531;
    --text: #e8eef5;
    --muted: #9fb0c3;
    --line: #263445;
    --accent: #4b83a6;
    --accent-2: #6aa6cc;
    --ok: #55c27a;
    --warn: #d6a74f;
    --danger: #c75b6a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    background: linear-gradient(90deg, var(--accent), #3f6f8d);
    color: #f6fbff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-badge {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-text h1 {
    margin: 0;
    font-size: 24px;
    line-height: 1.1;
}

.brand-text p {
    margin: 4px 0 0 0;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
}

.top-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.top-link {
    padding: 9px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.10);
    font-size: 14px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.top-link:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 24px 40px;
}

.messages-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.message {
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
}

.message.success {
    border-color: rgba(85, 194, 122, 0.35);
    background: rgba(85, 194, 122, 0.10);
}

.message.error {
    border-color: rgba(199, 91, 106, 0.35);
    background: rgba(199, 91, 106, 0.10);
}

.page-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.page-header h2 {
    margin: 0;
    font-size: 30px;
    line-height: 1.1;
}

.page-header p {
    margin: 8px 0 0 0;
    color: var(--muted);
    font-size: 15px;
}

.filter-panel {
    background: linear-gradient(180deg, var(--panel), #121922);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input,
.live-search-input,
.filter-select {
    width: 320px;
    max-width: 100%;
    height: 28px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: rgba(8, 16, 28, 0.95);
    color: var(--text);
    box-sizing: border-box;
}

.filter-select {
    width: 340px;
    cursor: pointer;
}

.table-panel {
    background: linear-gradient(180deg, var(--panel), #121922);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 8px 10px;
    margin-bottom: 16px;
    overflow-x: auto;
    scroll-margin-top: 18px;
}

table.items-table {
    width: 100%;
    min-width: 1080px;
    border-collapse: collapse;
}

.items-table th,
.items-table td {
    padding: 1px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    line-height: 1;
    font-size: 12px;
    vertical-align: middle;
}

.items-table td > * {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.items-table th {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    white-space: nowrap;
    letter-spacing: 0.03em;
    padding-top: 1px;
    padding-bottom: 1px;
    height: 24px;
}

.items-table tbody tr {
    height: 22px;
}

.items-table td:first-child,
.items-table th:first-child {
    width: 34px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

.items-table input[type="checkbox"] {
    width: 12px;
    height: 12px;
    accent-color: #62a8d8;
    cursor: pointer;
    margin: 0;
    vertical-align: middle;
}

.row-clickable {
    cursor: pointer;
    transition: background 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

.row-clickable:hover {
    background: rgba(255, 255, 255, 0.03);
}

.row-clickable.row-selected > td {
    background: rgba(63, 140, 220, 0.28) !important;
}

.row-clickable.row-selected {
    box-shadow: inset 3px 0 0 #62a8d8;
}

.already-in-cart td {
    background: rgba(98, 168, 216, 0.08);
}

.already-in-cart:not(.row-selected) {
    opacity: 0.72;
}

.col-item-code {
    white-space: nowrap;
    font-weight: 700;
}

.col-item-code strong {
    white-space: nowrap;
    display: inline-block;
}

.col-variant,
.col-qty {
    white-space: nowrap;
}

.col-price {
    text-align: right;
    white-space: nowrap;
    font-weight: 700;
}

.qty-input {
    -webkit-appearance: textfield !important;
    -moz-appearance: textfield !important;
    appearance: textfield !important;
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 10px !important;
    line-height: 16px !important;
    border-radius: 3px !important;
    border: 1px solid var(--line) !important;
    background: rgba(8, 16, 28, 0.95) !important;
    color: var(--text) !important;
    text-align: center !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.code-pill {
    display: inline-block;
    padding: 1px 6px;
    font-size: 9px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    line-height: 1;
}

.actions-row {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(75, 131, 166, 0.16);
    color: #d9edf9;
    cursor: pointer;
    text-decoration: none;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.muted {
    color: var(--muted);
    font-size: 11px;
}

.hidden-row {
    display: none;
}

.no-results {
    display: none;
    color: var(--muted);
    font-size: 12px;
    padding: 8px 4px 2px 4px;
}