/* ==================== LOGIN ==================== */
.login-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px;
}
.login-box {
    background: var(--bg-1); border-radius: 10px;
    padding: 40px; width: 360px; max-width: 100%;
    border: 1px solid var(--line);
    box-shadow: 0 16px 40px rgba(0,0,0,.3);
    text-align: center; transition: background .2s;
}
[data-theme="light"] .login-box { box-shadow: 0 4px 24px rgba(0,0,0,.06); }
.login-box h1 { font-size: 18px; margin-bottom: 4px; font-weight: 600; letter-spacing: -0.01em; }
.login-box p { font-size: 12px; color: var(--fg-3); margin-bottom: 20px; font-family: var(--f-mono); }
.login-box input {
    width: 100%; height: 36px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: var(--r);
    font: 13px var(--f-sans); color: var(--fg);
    background: var(--bg-2); outline: none; margin-bottom: 10px;
    transition: border-color var(--t);
}
.login-box input:focus { border-color: var(--acc); }
.login-box button {
    width: 100%; height: 36px; border: none; border-radius: var(--r);
    background: var(--acc); color: var(--invert);
    font: 600 13px var(--f-sans); cursor: pointer; margin-top: 4px;
    transition: background var(--t);
}
.login-box button:hover { background: var(--acc-hi); }
.login-err { color: var(--bad); font-size: 11px; margin-top: 8px; display: none; font-family: var(--f-mono); }

/* ==================== ADMIN LAYOUT — SIDEBAR ==================== */
.admin { display: none; }
.admin.show { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px; min-width: 220px;
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 60; transition: transform .25s;
}
.sidebar-header {
    padding: 20px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header h1 {
    font-size: 15px; font-weight: 700; color: #fff;
    margin-bottom: 4px;
}
.sidebar-header a {
    font-size: 12px; color: var(--accent); text-decoration: none;
}
.sidebar-header a:hover { text-decoration: underline; }

.sidebar-nav { flex: 1; padding: 8px 0; overflow-y: auto; }
.si-group-label {
    font: 600 10px var(--f-sans);
    color: rgba(255,255,255,.35);
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 14px 19px 4px;
    user-select: none;
}
.si-group-label:first-child { padding-top: 4px; }
.sidebar-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; cursor: pointer;
    color: var(--sidebar-text); font-size: 13px; font-weight: 500;
    border-left: 3px solid transparent;
    transition: all .12s; position: relative;
    user-select: none;
}
.sidebar-item:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-item.on {
    background: var(--sidebar-active);
    color: #fff; border-left-color: var(--accent);
}
.sidebar-item .si-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-item .si-badge {
    margin-left: auto;
    min-width: 18px; height: 18px;
    padding: 0 5px; border-radius: 9px;
    background: var(--red); color: #fff;
    font-size: 10px; font-weight: 700;
    display: none; align-items: center; justify-content: center;
}
.sidebar-item .si-badge.show { display: flex; }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: 8px;
}
.sidebar-theme-btn {
    width: 32px; height: 32px;
    border: 1px solid rgba(255,255,255,.15); border-radius: 8px;
    background: transparent; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: #fff;
}
.sidebar-theme-btn:hover { background: rgba(255,255,255,.08); }

/* Mobile burger */
.burger {
    display: none; position: fixed; top: 12px; left: 12px; z-index: 70;
    width: 36px; height: 36px; border: none; border-radius: 8px;
    background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.15);
    cursor: pointer; font-size: 18px;
    align-items: center; justify-content: center;
}
.mobile-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 55;
}

/* ==================== MAIN CONTENT ==================== */
.main {
    flex: 1; margin-left: 220px;
    min-height: 100vh; display: flex; flex-direction: column;
}
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px; height: 52px;
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 50;
    transition: background .2s;
}
.topbar-title { font-size: 15px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.save-btn {
    height: 30px; padding: 0 14px; border: none; border-radius: var(--r);
    background: var(--acc); color: var(--invert);
    font: 600 12px var(--f-sans); cursor: pointer; flex-shrink: 0;
    transition: background var(--t);
}
.save-btn:hover { background: var(--acc-hi); }
.save-btn:disabled { opacity: .5; cursor: default; }
.save-msg {
    font-size: 11px; color: var(--ok);
    opacity: 0; transition: opacity .3s; white-space: nowrap;
    font-family: var(--f-mono);
}
.save-msg.show { opacity: 1; }

.content { flex: 1; padding: 20px 28px 60px; min-width: 0; }

/* ==================== TAB CONTENT ==================== */
.tab-content { display: none; }
.tab-content.show { display: block; }

/* ==================== RATE BANNER ==================== */
.rate-banner {
    display: none; padding: 10px 16px;
    background: var(--orange-bg); border: 1px solid var(--orange);
    border-radius: 10px; margin-bottom: 16px;
    font-size: 12px; color: var(--orange);
    align-items: center; gap: 8px;
}
.rate-banner.show { display: flex; }
.rate-banner strong { color: var(--text); }

/* ==================== BRAND SECTIONS ==================== */
.brand-sec { margin-bottom: 28px; }
.brand-title {
    font-size: 17px; font-weight: 700;
    padding-bottom: 8px; border-bottom: 2px solid var(--text);
    margin-bottom: 0;
}

/* ==================== PRICE TABLE ==================== */
.price-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px; margin-bottom: 4px;
}
/* Consolidated: previously had two `.price-table thead th` blocks where the
   second only overrode padding/font-size. Merged into the final values. */
.price-table thead th {
    position: sticky; top: 52px; z-index: 10;
    background: var(--surface); text-align: left;
    padding: 10px 12px; font-size: 11px; font-weight: 600;
    color: var(--text2); text-transform: uppercase;
    letter-spacing: .3px; border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.price-table { table-layout: fixed; }
.price-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .1s;
}
.price-table tbody tr:hover { background: var(--accent-bg); }
.price-table tbody tr.out { opacity: .5; }
.price-table td { padding: 8px 12px; vertical-align: middle; font-size: 13px; overflow: hidden; }
/* last (clear-btn) column: no right padding so the 28×28 button fits its ~36-40px col */
.price-table td:last-child { padding: 4px 4px 4px 0; overflow: visible; text-align: right; }
/* inline price + currency cell */
.pt-cell { display: flex; gap: 4px; align-items: center; }
.pt-cell .pt-input { flex: 1 1 auto; min-width: 0; }
.pt-cell .pt-select { flex: 0 0 auto; width: 50px; }

.pt-img {
    width: 36px; height: 36px; border-radius: 6px;
    overflow: hidden; background: var(--bg); flex-shrink: 0;
}
.pt-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pt-img .ph {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; color: var(--text3);
}

.pt-name { font-weight: 600; font-size: 13px; white-space: normal; word-break: break-word; }
.pt-desc { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-stock { font-size: 11px; color: var(--text3); }
.pt-api { font-size: 12px; color: var(--text2); white-space: nowrap; }
.pt-api b { color: var(--text); }

.pt-input {
    width: 100%; padding: 6px 8px;
    border: 1px solid var(--border); border-radius: 6px;
    font: 13px var(--f-sans); color: var(--text);
    background: var(--bg); outline: none; text-align: right;
    box-sizing: border-box;
}
.pt-input:focus { border-color: var(--accent); }
.pt-input.drop-input { border-color: var(--orange); }
.pt-input.drop-input:focus { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(255,149,0,.15); }
/* Per-row autosave visual feedback (H1). */
.pt-input.pt-saved { box-shadow: 0 0 0 2px var(--green) inset; transition: box-shadow .2s; }
.pt-input.pt-err   { box-shadow: 0 0 0 2px var(--red) inset; }

.pt-select {
    width: 100%; padding: 6px 4px; border: 1px solid var(--border);
    border-radius: 6px; font: 12px var(--f-sans);
    color: var(--text); background: var(--bg); outline: none;
    box-sizing: border-box;
}

.pt-clear {
    width: 28px; height: 28px; border: none; border-radius: 6px;
    background: transparent; color: var(--text3); font-size: 17px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.pt-clear:hover { background: var(--red); color: #fff; }

/* ==================== DELIVERY / SHIPMENTS ==================== */
.ship-hdr {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.ship-add-btn {
    padding: 8px 14px; border: none; border-radius: 8px;
    background: var(--accent); color: #fff;
    font: 600 12px var(--f-sans); cursor: pointer;
    transition: opacity .15s;
}
.ship-add-btn:hover { opacity: .88; }
.ship-hint { font-size: 11px; color: var(--text3); max-width: 520px; }

.ship-toolbar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px; flex-wrap: wrap;
}
.ship-status-group {
    display: inline-flex; background: var(--surface);
    border: 1px solid var(--border); border-radius: 8px; padding: 2px;
}
.ship-status-btn {
    padding: 5px 12px; border: none; background: transparent;
    color: var(--text2); font: 600 11px var(--f-sans);
    cursor: pointer; border-radius: 6px;
    display: inline-flex; align-items: center; gap: 5px;
    transition: background .15s, color .15s;
}
.ship-status-btn:hover { color: var(--text); }
.ship-status-btn.on { background: var(--accent); color: #fff; }
.ship-status-btn.on .ship-status-n { background: rgba(255,255,255,.25); color: #fff; }
.ship-status-n {
    font-size: 10px; padding: 1px 6px; border-radius: 10px;
    background: var(--bg); color: var(--text3); font-weight: 700;
}
.ship-search-input {
    flex: 1; min-width: 200px; padding: 7px 12px;
    border: 1px solid var(--border); border-radius: 8px;
    font: 12px var(--f-sans); color: var(--text);
    background: var(--surface); outline: none;
}
.ship-search-input:focus { border-color: var(--accent); }
.ship-search-input::placeholder { color: var(--text3); }

.ship-card {
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface); margin-bottom: 8px; overflow: hidden;
}
.ship-card.past { opacity: .55; }
.ship-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    cursor: pointer; user-select: none;
}
.ship-row:hover { background: var(--accent-bg); }
.ship-date { font: 700 14px var(--f-sans); color: var(--text); min-width: 100px; }
.ship-past-tag { font-size: 9px; color: var(--text3); font-weight: 500; margin-left: 4px; }
.ship-count { font-size: 12px; color: var(--text2); }
.ship-note { font-size: 12px; color: var(--text3); font-style: italic; flex: 1; }
.ship-toggle { font-size: 10px; color: var(--text3); margin-left: auto; transition: transform .2s; }
.ship-items { display: none; padding: 0 14px 12px; flex-wrap: wrap; gap: 6px; }
.ship-items.open { display: flex; }
.ship-item {
    font-size: 11px; padding: 3px 8px;
    background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
    color: var(--text2);
}
.ship-empty { font-size: 11px; color: var(--text3); font-style: italic; }
.ship-btn {
    width: 26px; height: 26px; border: none; border-radius: 6px;
    background: transparent; color: var(--text3); font-size: 12px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.ship-btn:hover { background: var(--accent-bg); color: var(--text); }
.ship-btn.danger:hover { background: var(--red); color: #fff; }

.ship-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.5); z-index: 100;
}
.ship-backdrop.open { display: block; }
.ship-modal {
    display: none; position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(640px, 92vw); max-height: 90vh;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; z-index: 101;
    flex-direction: column;
}
.ship-modal.open { display: flex; }
.ship-modal-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 18px; border-bottom: 1px solid var(--border);
    font: 700 15px var(--f-sans);
}
.ship-modal-close { cursor: pointer; color: var(--text3); font-size: 18px; }
.ship-modal-close:hover { color: var(--text); }
.ship-modal-body {
    padding: 14px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
}
.ship-field label {
    display: block; font-size: 11px; color: var(--text2);
    text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px;
}
.ship-field input[type="date"],
.ship-field input[type="text"] {
    width: 100%; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: 6px;
    font: 13px var(--f-sans); color: var(--text);
    background: var(--bg); outline: none; box-sizing: border-box;
}
.ship-field input:focus { border-color: var(--accent); }
.ship-sel-count { font-size: 10px; color: var(--accent); margin-left: 6px; font-weight: 600; }

.ship-product-list {
    max-height: 340px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 8px;
    padding: 6px;
}
.ship-brand { margin-bottom: 10px; }
.ship-brand:last-child { margin-bottom: 0; }
.ship-brand-title {
    font: 700 11px var(--f-sans); color: var(--text2);
    text-transform: uppercase; letter-spacing: .4px;
    padding: 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.ship-pi {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 8px; cursor: pointer; border-radius: 5px;
    font-size: 12px;
}
.ship-pi:hover { background: var(--accent-bg); }
.ship-pi.on { background: var(--accent-bg); }
.ship-pi input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }
.ship-pi-name { flex: 1; color: var(--text); }
.ship-pi-stock { font-size: 10px; color: var(--text3); }
.ship-pi-stock.low { color: var(--orange); font-weight: 600; }

.ship-modal-actions {
    display: flex; gap: 8px; align-items: center;
    padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px;
}
.ship-cancel, .ship-save {
    padding: 7px 16px; border: none; border-radius: 6px;
    font: 600 12px var(--f-sans); cursor: pointer;
}
.ship-cancel { background: transparent; color: var(--text2); border: 1px solid var(--border); }
.ship-cancel:hover { background: var(--accent-bg); color: var(--text); }
.ship-save { background: var(--accent); color: #fff; }
.ship-save:hover { opacity: .88; }
.ship-err { font-size: 11px; color: var(--red); margin-left: auto; }

/* ==================== DELIVERY TABLE (legacy, unused in new UI but kept for safety) ==================== */
.del-table {
    width: 100%; border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px; margin-bottom: 4px;
}
.del-table thead th {
    position: sticky; top: 52px; z-index: 10;
    background: var(--surface); text-align: left;
    padding: 10px 12px; font-size: 11px; font-weight: 600;
    color: var(--text2); text-transform: uppercase;
    letter-spacing: .3px; border-bottom: 2px solid var(--border);
}
.del-table tbody tr { border-bottom: 1px solid var(--border); }
.del-table tbody tr:hover { background: var(--accent-bg); }
.del-table td { padding: 8px 12px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
/* last (clear-btn) column: no inner padding so the 24×24 button fits its 40px col */
.del-table td:last-child { padding: 4px 4px 4px 0; overflow: visible; text-align: right; }
.del-table .pt-name { white-space: normal; word-break: break-word; }
.del-stock.low { color: var(--orange); font-weight: 600; }
.del-stock.out-stock { color: var(--red); font-weight: 600; }
.del-note-input {
    width: 100%; padding: 5px 8px;
    border: 1px solid var(--border); border-radius: 6px;
    font: 12px var(--f-sans); color: var(--text);
    background: var(--bg); outline: none;
    box-sizing: border-box;
}
.del-note-input:focus { border-color: var(--accent); }
.del-note-input::placeholder { color: var(--text3); }
.del-clear {
    width: 24px; height: 24px; border: none; border-radius: 6px;
    background: transparent; color: var(--text3); font-size: 15px;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.del-clear:hover { background: var(--red); color: #fff; }

/* ==================== RATE MONITOR ==================== */
.rate-header {
    display: flex; gap: 16px; flex-wrap: wrap;
    margin-bottom: 20px; padding: 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px;
}
.rate-card { text-align: center; min-width: 80px; }
.rate-card .rc-cur { font-size: 11px; font-weight: 600; color: var(--text2); }
.rate-card .rc-val { font-size: 18px; font-weight: 700; }

.alert-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--surface);
    border: 1px solid var(--orange); border-radius: 10px;
    margin-bottom: 6px;
}
.alert-info { flex: 1; min-width: 0; }
.alert-name { font-size: 13px; font-weight: 600; }
.alert-detail { font-size: 11px; color: var(--text2); margin-top: 2px; }
.alert-detail .up { color: var(--green); font-weight: 600; }
.alert-detail .down { color: var(--red); font-weight: 600; }

.alert-prices {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap;
}
.alert-old { font-size: 13px; color: var(--text3); text-decoration: line-through; }
.alert-suggested { font-size: 13px; font-weight: 600; color: var(--accent); }
.alert-input {
    width: 80px; padding: 5px 7px;
    border: 1px solid var(--border); border-radius: 6px;
    font: 600 14px var(--f-sans); color: var(--text);
    background: var(--bg); outline: none; text-align: right;
}
.alert-input:focus { border-color: var(--accent); }
.alert-cur { font-size: 11px; color: var(--text2); }
.alert-accept {
    padding: 5px 14px; border: none; border-radius: 6px;
    background: var(--accent); color: #fff;
    font: 600 11px var(--f-sans); cursor: pointer;
    white-space: nowrap;
}
.alert-accept:hover { opacity: .85; }

.no-alerts {
    text-align: center; padding: 40px;
    color: var(--green); font-size: 13px;
}

/* ==================== PRODUCT INFO TAB ==================== */
.info-product {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 16px; margin-bottom: 10px;
}
.info-header {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    margin-bottom: 0; transition: margin .15s;
}
.info-header.expanded { margin-bottom: 14px; }
.info-header .info-img {
    width: 40px; height: 40px; border-radius: 8px;
    overflow: hidden; background: var(--bg); flex-shrink: 0;
}
.info-header .info-img img { width: 100%; height: 100%; object-fit: cover; }
.info-header .info-name { font-size: 14px; font-weight: 600; flex: 1; }
.info-header .info-photo-count {
    font-size: 10px; color: var(--text3); background: var(--bg);
    padding: 3px 8px; border-radius: 20px;
}
.info-header .info-arrow {
    font-size: 12px; color: var(--text3); transition: transform .2s;
}
.info-header.expanded .info-arrow { transform: rotate(90deg); }
.info-body { display: none; }
.info-body.show { display: block; }

.info-photos {
    display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px;
    position: relative;   /* anchor for the .uploading overlay */
    transition: outline-color .15s, background .15s;
    outline: 2px dashed transparent;
    outline-offset: 4px;
    border-radius: 12px;
}
/* External-file drop hint: thick dashed accent border around the whole zone. */
.info-photos.drop-zone-active {
    outline-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
/* Spinner overlay while a batch upload is in flight. */
.info-photos.uploading::after {
    content: '\u0417\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F\u2026';
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.45); color: #fff;
    font: 600 12px var(--f-sans);
    border-radius: 12px;
    z-index: 2;
    pointer-events: none;
}
.info-photo-item {
    position: relative; width: 80px; height: 80px;
    border-radius: 8px; overflow: hidden; background: var(--bg);
    border: 1px solid var(--border);
    cursor: grab;
    transition: transform .12s, box-shadow .12s, opacity .12s, border-color .12s;
}
.info-photo-item:active { cursor: grabbing; }
/* While a tile is being dragged: ghost it. */
.info-photo-item.dragging {
    opacity: .35;
    transform: scale(.96);
}
/* Tile under the cursor during reorder: highlight as drop target. */
.info-photo-item.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}
.info-photo-item img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.info-photo-item .photo-del {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: var(--red); color: #fff;
    border: none; cursor: pointer;
    font-size: 12px; display: flex; align-items: center; justify-content: center;
    z-index: 1;   /* above the img so clicks always land */
}
.info-photo-item .photo-main {
    position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: rgba(0,0,0,0.55); color: #fff;
    border: none; cursor: pointer;
    font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center;
    z-index: 1;
}
.info-photo-item .photo-main:hover { background: rgba(0,0,0,0.8); }
.info-photo-item.is-main { border-color: gold; box-shadow: 0 0 0 2px rgba(255,215,0,0.35); }
.info-photo-item.is-main .photo-main { background: gold; color: #222; }
.info-upload-btn {
    width: 80px; height: 80px; border-radius: 8px;
    border: 2px dashed var(--border); background: var(--bg);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: var(--text3); transition: all .15s;
}
.info-upload-btn:hover { border-color: var(--accent); color: var(--accent); }

.info-field { margin-bottom: 10px; }
.info-field label {
    font-size: 10px; font-weight: 600; color: var(--text2);
    text-transform: uppercase; display: block; margin-bottom: 4px;
}
.info-field textarea, .info-field input {
    width: 100%; padding: 8px 12px;
    border: 1px solid var(--border); border-radius: 8px;
    font: 13px var(--f-sans); color: var(--text);
    background: var(--bg); outline: none; resize: vertical;
}
.info-field textarea:focus, .info-field input:focus { border-color: var(--accent); }
.info-save {
    padding: 8px 20px; border: none; border-radius: 8px;
    background: var(--accent); color: #fff;
    font: 600 12px var(--f-sans); cursor: pointer;
}
.info-save:hover { opacity: .9; }

/* ===== ADMIN ORDERS ===== */
.ord-filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }

/* Orders search bar — sits between status filters and the batch toolbar.
   Styled to mirror .users-search-inp so both tabs feel consistent. */
.ord-search { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.ord-search-inp {
    flex: 1 1 320px; min-width: 240px; max-width: 640px;
    height: 34px; padding: 0 12px;
    border: 1px solid var(--line, var(--border)); border-radius: 6px;
    background: var(--bg-2, var(--surface)); color: var(--fg, var(--text));
    font: 13px var(--f-sans); outline: none;
    transition: border-color .15s;
}
.ord-search-inp:focus { border-color: var(--acc, var(--accent)); }
.ord-search-clear {
    height: 34px; min-width: 34px; padding: 0 10px;
    border: 1px solid var(--line, var(--border)); border-radius: 6px;
    background: var(--bg-2, var(--surface)); color: var(--fg-2, var(--text2));
    cursor: pointer; font-size: 14px; line-height: 1;
}
.ord-search-clear:hover { border-color: var(--red); color: var(--red); }

/* Users tab toolbar: filters + smart search + create button in one row. */
.users-toolbar {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.users-toolbar .ord-filters { margin: 0; }
.users-search-inp {
    flex: 1 1 260px; min-width: 220px;
    height: 34px; padding: 0 12px;
    border: 1px solid var(--line, var(--border)); border-radius: 6px;
    background: var(--bg-2, var(--surface)); color: var(--fg, var(--text));
    font: 13px var(--f-sans); outline: none;
    transition: border-color .15s;
}
.users-search-inp:focus { border-color: var(--acc, var(--accent)); }
.users-toolbar .adm-create-drop { margin-bottom: 0; margin-left: auto; }
.ord-filter {
    padding: 6px 14px; border: 1.5px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text);
    font: 500 12px var(--f-sans); cursor: pointer; transition: all .15s;
}
.ord-filter:hover { border-color: var(--accent); }
.ord-filter.on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* Column-header row above the orders list. Same flex shape + same
   per-column widths as .adm-ord-head so labels line up with the cells
   below. Compact uppercase styling so it reads as headers, not data. */
.adm-ord-headers {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 14px; margin-bottom: 6px;
    font: 600 9px var(--f-sans, Inter, sans-serif);
    color: var(--fg-3, var(--text3));
    text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 1px solid var(--line, var(--border));
}
.adm-ord-headers > * { flex-shrink: 0; box-sizing: border-box; }
.adm-ord-headers .h-select { width: 24px; }
/* Center-align headers under the columns whose body cells render
   centered controls (selects/buttons/inputs) — without text-align:center
   the labels sat at the left edge of each column slot while the controls
   below sat in the middle, giving the impression of a misaligned grid.
   Sum/profit kept their original alignment (right/center). */
.adm-ord-headers .h-label     { width: 70px;  text-align: center; }
.adm-ord-headers .h-status    { width: 140px; text-align: center; }
.adm-ord-headers .h-paymethod { width: 130px; text-align: center; }
.adm-ord-headers .h-paystatus { width: 110px; text-align: center; }
.adm-ord-headers .h-hold      { width: 56px;  text-align: center; }
.adm-ord-headers .h-ttn       { width: 158px; text-align: center; }
.adm-ord-headers .h-profit    { width: 105px; text-align: center; }
.adm-ord-headers .h-del       { width: 30px; }
.adm-ord-headers .adm-ord-sum { line-height: 1; height: auto; margin-left: auto; }
/* Body row's delete button — fixed width so it lines up with the .h-del
   header placeholder (30px). Was inline margin-left:4px which stacked
   on top of the parent flex `gap:10px` and pushed the button 4px right
   of the header column. Now the gap alone provides the spacing. */
.adm-ord .adm-ord-del { width: 30px; padding: 0 !important; }
/* Наклейка-індикатор у тілі рядка — 70px під заголовок .h-label,
   емодзі по центру на тій самій 24px-базовій лінії, що й решта комірок. */
.adm-ord-label-ind { width: 70px; text-align: center; font-size: 15px; line-height: 24px; height: 24px; }
.adm-ord-label-ind.adm-ord-label-na { color: var(--text3); }
@media (max-width: 1100px) { .adm-ord-headers { display: none; } }

.adm-ord {
    position: relative;  /* anchor for the .has-np-error ::before stripe */
    isolation: isolate;  /* hard stacking-context so the ::before stripe's
                            z-index is evaluated against children of this
                            row only — without isolation a child with its
                            own stacking context (or browser quirk) could
                            end up painted above the stripe */
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 10px; overflow: hidden; background: var(--surface);
}
/* Repair-flags chip — appears next to the order number when DELETE-delivered
   left side-effects unrolled (inventory / balance / shop-balance failures).
   Border-left highlights the whole row so it's visible while scanning. */
.adm-ord.has-repair { border-left: 3px solid #f59e0b; }
/* NP-label fetch failure: red side-stripe via an absolute-positioned
   ::before instead of border-left or inset box-shadow. Border-left
   shifted the head row 2px sideways; inset box-shadow worked in the
   resting state but got covered by .adm-ord-head:hover's solid
   background (child paints over parent's inset shadow). A pseudo-
   element on the parent sits ABOVE the child's hover background
   layer, so the stripe stays visible regardless of hover state.
   pointer-events:none keeps the row click-through unaffected.
   Distinct from has-repair (orange) — has-np-error is admin-fixable
   by retyping the TTN, has-repair needs money-flow reconciliation;
   when both apply has-repair wins precedence on the stripe colour. */
.adm-ord.has-np-error { background: rgba(239, 68, 68, 0.04); }
.adm-ord.has-np-error::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--red);
    /* Kept high (5 not 2) plus parent isolation:isolate — belt-and-
       suspenders against any future child rule that bumps its own
       z-index. Stripe must always paint above the head's hover bg. */
    z-index: 5;
    pointer-events: none;
}
.adm-ord.has-repair.has-np-error::before { background: #f59e0b; }

/* Hover override: .adm-ord-head:hover paints a solid var(--bg) on the
   head, which would otherwise wash out the parent's red tint and the
   row would look "gone" red on hover. Bump the head's hover bg to a
   stronger red wash on .has-np-error rows so the failure visual stays
   under the cursor instead of disappearing. */
.adm-ord.has-np-error .adm-ord-head:hover { background: rgba(239, 68, 68, 0.12); }
.adm-ord.has-repair.has-np-error .adm-ord-head:hover { background: rgba(245, 158, 11, 0.12); }

/* Batch-edit toolbar — sits between filters and the column header row.
   Always visible (count=0 just shows zero) so admin can pick statuses
   in any order; .has-sel emphasises the bar when selection is non-empty. */
.ord-batch-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
    padding: 8px 14px; margin: 8px 0;
    border: 1px solid var(--line, var(--border));
    border-radius: 8px;
    background: var(--bg-2, var(--bg-1, var(--surface)));
    font: 500 12px var(--f-sans, Inter, sans-serif);
}
.ord-batch-toolbar.has-sel {
    border-color: var(--acc, var(--accent));
    background: var(--acc-tint, var(--accent-bg));
}
.ord-batch-counter b { color: var(--acc, var(--accent)); font-weight: 700; }
.ord-batch-quick-grp,
.ord-batch-apply-grp { display: inline-flex; align-items: center; gap: 6px; }
.ord-batch-apply-grp { margin-left: auto; }
.ord-batch-quick-btn {
    padding: 4px 10px; height: 26px;
    border: 1px solid var(--line, var(--border));
    border-radius: 5px;
    background: var(--bg-1, var(--surface));
    color: var(--fg-2, var(--text));
    cursor: pointer; font: 600 11px var(--f-sans);
    transition: border-color .12s, background .12s;
}
.ord-batch-quick-btn:hover { border-color: var(--acc, var(--accent)); }
.ord-batch-quick-btn.on {
    background: var(--acc, var(--accent));
    color: var(--invert, #fff);
    border-color: var(--acc, var(--accent));
}
.ord-batch-quick-n {
    display: inline-block; min-width: 16px; padding: 0 4px;
    margin-left: 4px;
    border-radius: 8px; background: rgba(0, 0, 0, .12);
    font-size: 10px; font-weight: 700; line-height: 14px;
}
.ord-batch-quick-btn.on .ord-batch-quick-n { background: rgba(255, 255, 255, .25); }
.ord-batch-sel {
    height: 26px; padding: 0 8px;
    border: 1px solid var(--line, var(--border));
    border-radius: 5px;
    background: var(--bg-1, var(--surface));
    color: var(--fg, var(--text));
    font: 500 11px var(--f-sans); cursor: pointer;
}
.ord-batch-apply-btn,
.ord-batch-clear-btn {
    padding: 4px 12px; height: 26px;
    border: 1px solid var(--line, var(--border));
    border-radius: 5px;
    cursor: pointer; font: 600 11px var(--f-sans);
}
.ord-batch-apply-btn {
    background: var(--acc, var(--accent));
    color: var(--invert, #fff);
    border-color: var(--acc, var(--accent));
}
.ord-batch-apply-btn:hover:not(:disabled) { filter: brightness(1.08); }
.ord-batch-apply-btn:disabled,
.ord-batch-clear-btn:disabled { cursor: not-allowed; opacity: .45; }
.ord-batch-clear-btn {
    background: var(--bg-1, var(--surface));
    color: var(--fg-2, var(--text));
}
.ord-batch-clear-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }

/* "+ Додати замовлення" button on the toolbar — green so it visually
   reads as a creation action (vs the blue accent of the apply button
   which is a state-change action). Same height as the quick-pick
   buttons next to it. */
.ord-batch-create-btn {
    padding: 4px 12px; height: 26px;
    border: 1px solid var(--ok, var(--green));
    border-radius: 5px;
    background: var(--ok, var(--green));
    color: var(--invert, #fff);
    cursor: pointer; font: 600 11px var(--f-sans);
    transition: filter .12s;
}
.ord-batch-create-btn:hover { filter: brightness(1.08); }

/* Create-order modal layout. Reuses .eo-modal sizing/positioning from
   the edit modal so we get free centering + max-height + scroll. The
   internal grids are the create-only flavour. */
.co-modal { max-width: 760px; overflow-x: hidden; }
.co-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.co-grid-2 { display: grid; grid-template-columns: 1fr 1fr;         gap: 8px; margin-bottom: 12px; }
/* Delivery rows — split per visibility group so columns don't shrink
   when one part is hidden (city was stretching to fill the whole row
   when warehouse hid on type=address). Each row has its own template. */
.co-row { display: grid; gap: 8px; margin-bottom: 8px; }
.co-row-type-city { grid-template-columns: 200px 1fr; }
.co-row-wh        { grid-template-columns: 1fr; }
.co-row-addr      { grid-template-columns: 2fr 1fr 1fr; }
@media (max-width: 720px) {
    .co-grid-4, .co-grid-2 { grid-template-columns: 1fr 1fr; }
    .co-row-type-city { grid-template-columns: 1fr; }
    .co-row-addr      { grid-template-columns: 1fr 1fr; }
    .co-row-addr > :last-child { grid-column: 1 / -1; }
}
/* Entity radio row — mirrors the public checkout entity toggle. */
.co-entity-row { display: flex; gap: 16px; margin-bottom: 12px; font-size: 12px; }
.co-entity-radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.co-entity-radio input { margin: 0; }
/* NP-autocomplete pickers inside the create modal need positioning so
   the dropdown anchors below the input. Reuses the eo-np-dd class for
   styling — we just give it a container the dropdown can absolute-pos
   against. */
.co-np-pick { position: relative; }
.co-np-dd {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
    max-height: 220px; overflow-y: auto;
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line, var(--border));
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    display: none;
}
.co-np-dd.open { display: block; }
.co-items-list {
    display: flex; flex-direction: column; gap: 4px;
    margin-bottom: 8px;
    max-height: 220px; overflow-y: auto;
    padding-right: 4px;
}
.co-item-row {
    display: grid; grid-template-columns: 36px 1fr 60px 100px 110px 28px;
    align-items: center; gap: 8px;
    padding: 6px 8px;
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line, var(--border));
    border-radius: 6px;
    font-size: 12px;
}
.co-item-thumb {
    width: 36px; height: 36px; object-fit: cover; border-radius: 4px;
    background: var(--bg-2, var(--bg-1));
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.co-item-thumb-empty { color: var(--text3); }
.co-item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-item-qty { color: var(--text2); font-size: 11px; }
.co-item-price { color: var(--accent); font-weight: 600; text-align: right; }
.co-item-total { font-weight: 700; text-align: right; }
/* Product picker dropdown row — thumb + name + stock chip + price.
   Same baseline as .co-item-row so picking a product reads as the
   same visual unit it'll become inside the items list. */
.eo-add-item.co-prod-row {
    display: grid; grid-template-columns: 32px 1fr auto auto;
    align-items: center; gap: 10px;
    padding: 6px 10px;
}
.co-prod-thumb {
    width: 32px; height: 32px; object-fit: cover; border-radius: 4px;
    background: var(--bg-2, var(--bg-1));
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.co-prod-thumb-empty { color: var(--text3); }
.co-prod-name {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0;
}
.co-prod-stock {
    font-size: 10px; padding: 1px 6px;
    border-radius: 3px; background: var(--bg-2, var(--bg-1));
    color: var(--text2);
}
.co-prod-stock.warn { background: var(--warn-bg, var(--orange-bg)); color: var(--warn, var(--orange)); }
.co-prod-stock.crit { background: var(--bad-tint, var(--red-bg));   color: var(--bad, var(--red));   }
/* Сума замовлення row — compact, value sits flush against the label
   (was justify-content: space-between which pushed the value to the
   far right of the modal — looked disconnected). */
.co-summary {
    display: flex; align-items: baseline; gap: 10px;
    margin-top: 14px; padding: 10px 14px;
    background: var(--bg-2, var(--bg-1));
    border: 1px solid var(--line, var(--border));
    border-radius: 8px;
}
.co-summary-lbl { font-size: 12px; color: var(--text2); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.co-summary-val { font-size: 18px; font-weight: 700; color: var(--acc, var(--accent)); margin-left: auto; }

/* Add-row controls. Wider qty + sell so admin sees the value they're
   typing (was 70px / 120px which truncated 4-digit ammounts). */
.co-add-row {
    display: flex; gap: 8px; align-items: center;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--line, var(--border));
}
.co-add-row .eo-add-search { flex: 1; min-width: 0; position: relative; }
.co-qty  { width: 100px; flex-shrink: 0; text-align: center; }
.co-sell { width: 140px; flex-shrink: 0; text-align: right;  }
.co-add-btn { width: auto; padding: 8px 16px; margin: 0; flex-shrink: 0; }

/* Big primary CTA at the bottom of the modal. Override the default
   .adm-modal-submit margin:6px 16px 16px so width:100% doesn't sit
   on top of 32px horizontal margin (which is what was pushing the
   button past the modal box and triggering the scrollbar). */
.co-create-btn { margin: 16px 0 0; width: 100%; padding: 12px; font-size: 14px; font-weight: 700; }

/* Payment row: method select + initial pay-status select side by side. */
.co-pay-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
@media (max-width: 720px) { .co-pay-row { grid-template-columns: 1fr; } }

/* Compact "details" block — collapses three former sections (payment +
   packaging + note) into one tinted card with mini-labels above each
   sub-control. Eats much less vertical real-estate than three separate
   eo-section-title rows did. */
.co-details {
    display: flex; flex-direction: column; gap: 8px;
    padding: 10px;
    background: var(--bg-2, var(--bg-1));
    border: 1px solid var(--line, var(--border));
    border-radius: 8px;
    margin-bottom: 4px;
}
/* 2-col layout: left half = payment selects stacked; right half =
   packaging block (label + chips + custom). Note textarea sits below
   the grid full-width. */
.co-details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-width: 0; }
.co-details-pay  { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.co-details-pkg  { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.co-details-pkg .co-pkg-chip {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
    padding: 5px 8px;
    overflow: hidden;
}
.co-details-pkg .co-pkg-dim,
.co-details-pkg .co-pkg-lbl {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 100%;
}
/* Border-box for EVERYTHING inside the create-modal — was the only
   way to kill the horizontal scrollbar that showed up past the
   "Створити замовлення" button. Multiple offenders contributed:
     • .adm-modal-input (width:100% + 22px padding/border on top)
     • .adm-modal-submit (width:calc(100%-32px) + margin:0 16px +
       padding:10px = 20px overflow without box-sizing)
     • .co-create-btn override (width:100% + padding:12px)
   Scoping by *.co-modal subtree avoids side-effects on the rest of
   the admin UI where some legacy widths assume content-box behavior. */
.co-modal,
.co-modal *,
.co-modal *::before,
.co-modal *::after { box-sizing: border-box; }
@media (max-width: 720px) {
    .co-details-grid { grid-template-columns: 1fr; }
    .co-details-pkg .co-pkg-chip { flex: 0 0 auto; }
}
.co-mini {
    display: flex; flex-direction: column; gap: 3px;
    font: 600 9px var(--f-sans, Inter, sans-serif);
    text-transform: uppercase; letter-spacing: .4px;
    color: var(--text2);
}
.co-mini-lbl {
    font: 600 9px var(--f-sans, Inter, sans-serif);
    text-transform: uppercase; letter-spacing: .4px;
    color: var(--text2);
    margin-top: 2px;
}
/* Note textarea inside the compact block — smaller font, no heavy
   border-radius mismatch with the surrounding inputs. */
.co-note { resize: vertical; min-height: 48px; }

/* Packaging picker chips — used both in the create modal and the
   inline edit picker. Compact card with dimension + label, click to
   toggle. .on uses accent color for the active state. */
.co-pkg-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.co-pkg-chip {
    display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
    padding: 6px 12px; min-width: 110px;
    border: 1px solid var(--line, var(--border));
    border-radius: 6px;
    background: var(--bg-1, var(--surface));
    color: var(--fg, var(--text));
    cursor: pointer; font: 600 11px var(--f-sans);
    transition: border-color .12s, background .12s;
}
.co-pkg-chip:hover { border-color: var(--acc, var(--accent)); }
.co-pkg-chip.on {
    background: var(--acc, var(--accent));
    color: var(--invert, #fff);
    border-color: var(--acc, var(--accent));
}
.co-pkg-dim { font-family: var(--f-mono, ui-monospace, monospace); font-size: 12px; }
.co-pkg-lbl { font-size: 10px; opacity: .85; font-weight: 500; }
.co-pkg-custom { width: 100%; }

/* Standalone packaging picker modal (admin clicks "✎ Змінити" on an
   existing order). Reuses .confirm-backdrop / .confirm-modal so the
   layering / dismiss-on-backdrop-click free-rides the existing system. */
.pkg-picker-modal { min-width: 480px; max-width: 90vw; }
.pkg-picker-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; }

/* Order-card packaging row */
.adm-ord-pkg {
    display: inline-block; padding: 1px 8px;
    border-radius: 4px; background: var(--accent-bg);
    color: var(--accent); font: 600 11px var(--f-mono);
}
.adm-ord-pkg-custom { font-family: var(--f-sans); }
.adm-ord-pkg-empty { color: var(--text3); font-size: 12px; font-style: italic; }

/* Order-card customer note row — multiline-friendly chip with a soft
   accent tint so it stands out from the surrounding kv-rows. Long
   notes wrap; the title attr provides full text on hover. */
.adm-ord-note-row b {
    display: inline-flex; align-items: flex-start; gap: 8px;
    flex-wrap: wrap; max-width: 100%;
}
.adm-ord-note {
    display: inline-block; padding: 4px 8px;
    border-radius: 4px; background: var(--orange-bg);
    color: var(--fg, var(--text));
    font: 500 12px var(--f-sans, Inter, sans-serif);
    white-space: pre-wrap; word-break: break-word;
    max-width: 100%;
    border-left: 2px solid var(--orange);
}

/* Per-row checkbox in the head. Width matches .h-select header so the
   columns line up. The native checkbox is small enough; we don't try
   to restyle it, just position it. */
.adm-ord-select {
    width: 16px; height: 16px;
    margin: 0 4px 0 0;
    cursor: pointer;
}
.adm-ord-select:disabled { cursor: not-allowed; opacity: .35; }
/* Selected-row visual cue — subtle accent-tint on top of any other
   row state (so .has-np-error red stripe still shows). */
.adm-ord.is-selected { background: var(--acc-tint, var(--accent-bg)); }
.adm-ord-repair {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 4px;
    background: #f59e0b;
    color: #1a1a1a;
    font: 600 9px var(--f-sans, Inter, sans-serif);
    text-transform: uppercase;
    letter-spacing: .3px;
    vertical-align: middle;
    cursor: help;
}
.adm-ord-head {
    padding: 10px 14px; display: flex; align-items: center; gap: 10px;
    cursor: pointer; transition: background .1s; flex-wrap: nowrap;
    min-height: 44px;
}
.adm-ord-head:hover { background: var(--bg); }
/* Every direct child of the head sits on a single 24px baseline. */
.adm-ord-head > * { box-sizing: border-box; vertical-align: middle; flex-shrink: 0; }
.adm-ord-num,
.adm-ord-date,
.adm-ord-client,
.adm-ord-sum { line-height: 24px; height: 24px; }
/* Fixed-width left columns so every row's controls line up vertically.
   Client gets a fixed 180px (ellipsis on overflow) — shorter names don't collapse
   the row, longer names don't push other columns. */
.adm-ord-num    { width: 170px; font-size: 13px; font-weight: 700; font-family: var(--f-mono, inherit); }
.adm-ord-date   { width: 130px; font-size: 11px; color: var(--text2); font-family: var(--f-mono, inherit); }
.adm-ord-client {
    width: 180px;
    display: flex; flex-direction: column; justify-content: center;
    height: auto; line-height: 1.25;
    font-size: 12px; color: var(--text);
}
.adm-ord-client-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
/* Drop-account owner subline under the recipient name (drop orders only). */
.adm-ord-client-drop {
    font-size: 10px; font-weight: 600; color: var(--accent);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
/* Sum begins the right-side "totals" group. margin-left:auto eats the remaining
   slack so totals always hug the right edge regardless of optional placeholders. */
.adm-ord-sum { width: 90px; text-align: right; margin-left: auto; }
@media (max-width: 1100px) {
    .adm-ord-head { flex-wrap: wrap; }
    .adm-ord-num { width: auto; }
    .adm-ord-date { width: auto; }
    .adm-ord-client { width: auto; flex: 1 1 140px; }
}
.adm-ord-status {
    font-size: 10px; font-weight: 600; padding: 3px 8px;
    border-radius: 6px; text-transform: uppercase; letter-spacing: .3px;
}
.adm-ord-status.s-new { background: var(--accent-bg); color: var(--accent); }
.adm-ord-status.s-packing { background: var(--orange-bg); color: var(--orange); }
.adm-ord-status.s-packed { background: var(--yellow-bg); color: var(--yellow); }
/* legacy: historical rows may still surface with confirmed/processing — keep
   a visual so they don't fall through to default styling. */
.adm-ord-status.s-confirmed,
.adm-ord-status.s-processing { background: var(--yellow-bg); color: var(--yellow); }
.adm-ord-status.s-shipped { background: var(--green-bg); color: var(--green); }
.adm-ord-status.s-delivered { background: var(--bg); color: var(--text2); }
.adm-ord-status.s-cancelled { background: var(--red-bg); color: var(--red); }
.adm-ord-status.s-returned  { background: rgba(217, 119, 6, .15); color: #d97706; }
.adm-ord-status.s-deleted   { background: var(--bg); color: var(--text3); text-decoration: line-through; }

/* Head-row quick status select: looks like the status badge but clickable.
   Fixed width so every row's column is at the same horizontal position. */
.adm-ord-status-sel {
    box-sizing: border-box;
    width: 140px;  /* fits "ПІДТВЕРДЖЕНИЙ" (longest label) */
    height: 24px; line-height: 22px;  /* 24 − 2×1px border */
    padding: 0 8px; border-radius: 6px;
    font: 700 10px var(--f-sans); text-transform: uppercase; letter-spacing: .3px;
    border: 1px solid transparent; cursor: pointer; outline: none;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    vertical-align: middle;
    margin: 0;
    transition: box-shadow .15s;
}
.adm-ord-status-sel:focus { box-shadow: 0 0 0 2px var(--acc-tint); }
.adm-ord-status-sel.locked,
.adm-ord-status-sel:disabled,
.adm-ord-select:disabled { cursor: not-allowed; opacity: .55; }
.adm-ord-status-sel option { color: var(--fg); background: var(--bg-1); }
.adm-ord-status-sel.s-new        { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.adm-ord-status-sel.s-packing    { background: var(--orange-bg); color: var(--orange); border-color: var(--orange); }
.adm-ord-status-sel.s-packed     { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow); }
.adm-ord-status-sel.s-confirmed,
.adm-ord-status-sel.s-processing { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow); }
.adm-ord-status-sel.s-shipped    { background: var(--green-bg);  color: var(--green);   border-color: var(--green); }
.adm-ord-status-sel.s-delivered  { background: var(--bg);        color: var(--text2);   border-color: var(--text2); }
.adm-ord-status-sel.s-cancelled  { background: var(--red-bg);    color: var(--red);     border-color: var(--red); }
.adm-ord-status-sel.s-returned   { background: rgba(217,119,6,.15); color: #d97706;     border-color: #d97706; }
.adm-ord-status-sel.s-deleted    { background: var(--bg);        color: var(--text3);   border-color: var(--text3); }

/* Head-row quick TTN input + save button. */
.adm-ord-ttn-quick {
    display: inline-flex; align-items: center; gap: 0;
    margin-left: 4px;
}
.adm-ord-ttn-q-inp {
    height: 24px; width: 130px;
    padding: 0 8px; border: 1px solid var(--line, var(--border));
    border-radius: 6px 0 0 6px; outline: none;
    background: var(--bg-2, var(--surface)); color: var(--fg);
    font: 500 11px var(--f-mono);
    transition: border-color .15s;
}
.adm-ord-ttn-q-inp:focus { border-color: var(--acc); }
.adm-ord-ttn-q-inp::placeholder { color: var(--fg-4, var(--text3)); font-weight: 400; }
/* Visual hint that the TTN is the drop's own (not yet claimed by admin). */
.adm-ord-ttn-q-inp.is-drop-ttn {
    border-color: var(--warn, var(--orange));
    color: var(--warn, var(--orange));
    background: rgba(245,158,11,.06);
}
.adm-ord-ttn-q-btn {
    height: 24px; padding: 0 8px;
    border: 1px solid var(--line, var(--border)); border-left: none;
    border-radius: 0 6px 6px 0;
    background: var(--bg-2, var(--surface)); color: var(--fg-2, var(--text));
    font-size: 12px; cursor: pointer;
    transition: all .15s;
}
.adm-ord-ttn-q-btn:hover { background: var(--acc); color: var(--invert, #fff); border-color: var(--acc); }
.adm-ord-ttn-q-btn:disabled { cursor: wait; opacity: .6; }

/* `.adm-ord-sum` baseline/width rules live above at the head-row declarations
   (lines ~594, 607). The duplicate ruleset used to sit here — merged in. */

/* Head-row profit badge: shows shop profit next to order total.
   Consolidated from two adjacent `.adm-ord-profit` blocks into one. */
.adm-ord-profit {
    display: inline-flex; align-items: center; justify-content: center;
    height: 24px; padding: 0 8px; border-radius: 6px;
    font: 700 11px var(--f-mono, var(--f-mono));
    border: 1px solid transparent; white-space: nowrap;
    width: 105px;  /* fixed column width so every row aligns */
    box-sizing: border-box;
}
.adm-ord-profit.pos  { background: rgba(16,185,129,.14); color: var(--ok);  border-color: var(--ok);  }
.adm-ord-profit.neg  { background: rgba(239,68,68,.14);  color: var(--bad); border-color: var(--bad); }
.adm-ord-profit.zero { color: var(--fg-3); border-color: var(--line); }
.adm-ord-profit-placeholder { display: inline-block; width: 105px; height: 24px; visibility: hidden; }

/* Order body: grid layout + card sections for cleaner structure. */
.adm-ord-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px;
}
@media (max-width: 800px) { .adm-ord-grid { grid-template-columns: 1fr; } }
.adm-ord-card {
    background: var(--bg-2, var(--bg)); border: 1px solid var(--line, var(--border));
    border-radius: 8px; padding: 10px 12px; margin-bottom: 10px;
}
.adm-ord-card .adm-ord-section-title {
    font: 600 11px var(--f-sans); color: var(--fg-2, var(--text2));
    text-transform: uppercase; letter-spacing: .06em;
    margin: 0 0 8px; padding: 0;
    display: flex; align-items: center; gap: 6px;
}
.adm-ord-item-count { margin-left: auto; font-weight: 500; color: var(--fg-3, var(--text3)); text-transform: none; letter-spacing: 0; font-family: var(--f-mono); }
.adm-ord-kv {
    display: grid; grid-template-columns: 110px 1fr; gap: 10px;
    padding: 3px 0; font-size: 12px;
}
.adm-ord-kv > span { color: var(--fg-3, var(--text3)); }
.adm-ord-kv > b { color: var(--fg, var(--text)); font-weight: 500; }
.adm-ord-kv.adm-ord-drop-ttn > b { color: var(--warn, var(--orange)); font-weight: 700; font-family: var(--f-mono); }
.adm-ord-kv.adm-ord-drop-owner { margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--line, var(--border)); }
.adm-ord-link { color: var(--acc, var(--accent)); text-decoration: none; font-size: 12px; }
.adm-ord-link:hover { text-decoration: underline; }
/* NP-label fetch failure chip — appears in the "Наклейка" slot of the
   order details when a status→packing tried to pull a marking from
   Nova Poshta and got a non-PDF / 4xx / etc. Compact inline pill so
   it doesn't shove the row layout, scoped tooltip carries the verbose
   reason. Distinct from the order-wide REPAIR badge: this is local to
   one slot, not "this order's money flow is desynced". */
.adm-ord-np-err {
    display: inline-block;
    padding: 1px 6px; border-radius: 4px;
    background: var(--red-bg); color: var(--red);
    font: 600 10px var(--f-sans, Inter, sans-serif);
    text-transform: none; letter-spacing: 0;
    cursor: help; vertical-align: middle;
    border: 1px solid var(--red);
}

/* Economics block: tile grid for shop/drop figures. */
.adm-ord-econ-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px;
}
.adm-ord-econ-item {
    background: var(--bg-1, var(--surface)); border: 1px solid var(--line, var(--border));
    border-radius: 6px; padding: 8px 10px;
}
.adm-ord-econ-item.accent-pos  { border-color: var(--ok);  background: rgba(16,185,129,.08); }
.adm-ord-econ-item.accent-neg  { border-color: var(--bad); background: rgba(239,68,68,.08); }
.adm-ord-econ-lbl {
    font: 600 10px var(--f-sans); color: var(--fg-3);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px;
}
.adm-ord-econ-val {
    font: 700 14px var(--f-mono); color: var(--fg);
}
.adm-ord-econ-item.accent-pos .adm-ord-econ-val { color: var(--ok); }
.adm-ord-econ-item.accent-neg .adm-ord-econ-val { color: var(--bad); }
.adm-ord-econ-pct { font-size: 11px; color: var(--fg-3); font-weight: 500; }

/* Item row: [img] [qty-pill] [name + sub-info] [line-total] */
.adm-ord-items { display: flex; flex-direction: column; gap: 6px; }
.adm-ord-item {
    display: grid; grid-template-columns: 40px 44px 1fr auto;
    gap: 10px; align-items: center;
    padding: 6px 8px;
    background: var(--bg-1, var(--surface)); border: 1px solid var(--line, var(--border));
    border-radius: 6px;
}
.adm-ord-item-img {
    width: 40px; height: 40px; border-radius: 5px; overflow: hidden;
    background: var(--bg-3, var(--bg));
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--fg-4, var(--text3));
    flex-shrink: 0;
}
.adm-ord-item-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adm-ord-item-img.no-img { font-size: 18px; }
.adm-ord-item-qty {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--acc-tint, var(--accent-bg));
    color: var(--acc, var(--accent));
    border: 1px solid var(--acc, var(--accent));
    border-radius: 6px;
    min-width: 44px; height: 26px;
    font: 700 13px var(--f-mono);
}
.adm-ord-item-info { min-width: 0; overflow: hidden; }
.adm-ord-item-name {
    font-size: 13px; font-weight: 600; color: var(--fg, var(--text));
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.adm-ord-item-sub {
    font: 500 11px var(--f-mono); color: var(--fg-3, var(--text3));
    display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px;
}
.adm-ord-item-cost { color: var(--fg-4, var(--text3)); }
.adm-ord-item-line {
    font: 700 14px var(--f-mono); color: var(--fg, var(--text));
    white-space: nowrap;
}
.adm-ord-body { display: none; padding: 14px 16px; border-top: 1px solid var(--border); }
.adm-ord-body.show { display: block; }
.adm-ord-section { margin-bottom: 12px; }
.adm-ord-section-title {
    font-size: 10px; font-weight: 600; color: var(--text2);
    text-transform: uppercase; letter-spacing: .3px; margin-bottom: 4px;
}
.adm-ord-row { font-size: 12px; line-height: 1.6; }
/* .adm-ord-items / .adm-ord-item — style moved above to the card-based grid layout. */
.adm-ord-actions {
    display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap;
}
.adm-ord-select {
    height: 32px; padding: 0 8px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg); color: var(--text);
    font: 12px var(--f-sans); cursor: pointer;
}
.adm-ord-ttn-input {
    height: 32px; padding: 0 10px; border: 1px solid var(--border);
    border-radius: 8px; background: var(--bg); color: var(--text);
    font: 12px var(--f-sans); width: 180px;
}
.adm-ord-btn {
    height: 32px; padding: 0 14px; border: none; border-radius: 8px;
    font: 600 12px var(--f-sans); cursor: pointer; transition: opacity .15s;
}
.adm-ord-btn:hover { opacity: .85; }
.adm-ord-btn.primary { background: var(--accent); color: #fff; }
.adm-ord-btn.green { background: var(--green); color: #fff; }

/* ===== ADMIN USERS TABLE ===== */
.users-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px; margin-bottom: 4px;
}
.users-table thead th {
    position: sticky; top: 52px; z-index: 10;
    background: var(--surface); text-align: left;
    padding: 10px 12px; font-size: 11px; font-weight: 600;
    color: var(--text2); text-transform: uppercase;
    letter-spacing: .3px; border-bottom: 2px solid var(--border);
}
.users-table tbody tr { border-bottom: 1px solid var(--border); }
.users-table tbody tr:hover { background: var(--accent-bg); }
.users-table td { padding: 10px 12px; vertical-align: middle; }
.adm-user-type {
    font-size: 11px; font-weight: 600; padding: 3px 8px;
    border-radius: 6px; text-transform: uppercase; display: inline-block;
}
.adm-user-type.t-regular { background: var(--accent-bg); color: var(--accent); }
.adm-user-type.t-drop { background: var(--orange-bg); color: var(--orange); }
.adm-user-btn {
    height: 30px; padding: 0 10px; border: 1px solid var(--border);
    border-radius: 6px; font: 500 11px var(--f-sans);
    cursor: pointer; background: var(--surface); color: var(--text);
    transition: all .15s;
    min-width: 110px;                       /* unified width so rows don't stretch */
    display: inline-flex; align-items: center; justify-content: center;
    white-space: nowrap; flex-shrink: 0;
}
.adm-user-btn:hover { border-color: var(--accent); color: var(--accent); }
.adm-user-btn.danger { border-color: var(--red); color: var(--red); }
.adm-user-btn.danger:hover { background: var(--red-bg); }
.adm-user-btn.muted { opacity: .38; cursor: not-allowed; color: var(--fg-4, var(--text3)); border-color: var(--line, var(--border)); background: transparent; }
.adm-user-btn.muted:hover { border-color: var(--line, var(--border)); color: var(--fg-4, var(--text3)); }
.adm-user-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* User balance pills (users tab) */
.u-bal-wrap { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.u-bal {
    display: inline-flex; align-items: center;
    padding: 3px 8px; border-radius: 6px;
    border: 1px solid var(--acc);
    background: var(--acc-tint);
    color: var(--acc);
    font: 700 12px var(--f-mono);
    line-height: 1.4;
    white-space: nowrap;
}
.u-bal.u-bal-neg { border-color: var(--bad); background: var(--bad-tint); color: var(--bad); }
.u-bal.u-bal-hold-neg {
    border-color: var(--warn); background: rgba(245,158,11,.10); color: var(--warn);
    font-weight: 600; font-size: 11px;
    cursor: pointer; transition: all .15s;
}
.u-bal.u-bal-hold-neg:hover { background: var(--warn); color: var(--invert); }
.u-bal.u-bal-hold-pos {
    border-color: var(--ok); background: rgba(16,185,129,.10); color: var(--ok);
    font-weight: 600; font-size: 11px;
}
/* Non-clickable negative hold (for pending going below zero) */
.u-bal.u-bal-hold-neg-static {
    border-color: var(--warn); background: rgba(245,158,11,.10); color: var(--warn);
    font-weight: 600; font-size: 11px;
}
.u-bal-recon-icn { opacity: .6; font-size: 12px; margin-left: 2px; }
.adm-create-drop {
    padding: 10px 20px; border: none; border-radius: 10px;
    background: var(--orange); color: #fff;
    font: 600 13px var(--f-sans); cursor: pointer;
    margin-bottom: 16px; transition: opacity .15s;
}
.adm-create-drop:hover { opacity: .85; }

/* ==================== MOBILE ==================== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .mobile-overlay.open { display: block; }
    .burger { display: flex; }
    .main { margin-left: 0; }
    .content { padding: 14px 12px 40px; }
    .topbar { padding: 0 12px 0 52px; }
    .price-table thead th, .del-table thead th, .users-table thead th {
        top: 52px;
    }
    .adm-ord-head { gap: 8px; }
    .alert-row { flex-wrap: wrap; gap: 8px; }
    .alert-prices { flex-basis: 100%; justify-content: flex-end; }
    .rate-header { gap: 10px; }
    .save-btn { padding: 6px 12px; font-size: 11px; }
}

/* ============================================================
   Order admin — payment method badges + hold flag
   ============================================================ */
.adm-ord-pay-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 130px;  /* fits "ПО РЕКВІЗИТАХ" (longest after compaction) */
    height: 24px; padding: 0 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .3px; white-space: nowrap;
    box-sizing: border-box;
    /* fallback for unknown methods — at least a visible chip outline */
    background: var(--bg); color: var(--text2); border: 1px solid var(--border);
}
.adm-ord-pay-badge.pm-cod      { background: var(--orange-bg); color: var(--orange); border-color: transparent; }
.adm-ord-pay-badge.pm-fop      { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.adm-ord-pay-badge.pm-balance,
.adm-ord-pay-badge.pm-drop_balance { background: var(--green-bg); color: var(--green); border-color: transparent; }
.adm-ord-pay-badge.pm-online   { background: var(--bg); color: var(--text2); }
.adm-ord-pay-badge.pm-bank_transfer,
.adm-ord-pay-badge.pm-tier_balance { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.adm-ord-hold {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px;  /* reserved column — "HOLD" */
    height: 24px; padding: 0 8px; border-radius: 6px;
    font-size: 10px; font-weight: 700;
    background: var(--red-bg); color: var(--red); white-space: nowrap;
    box-sizing: border-box;
}
/* Placeholder used when the order isn't held — preserves the column so rows stay aligned. */
.adm-ord-hold-placeholder { display: inline-block; width: 56px; height: 24px; visibility: hidden; }

/* payment.status badge — separate from order.status. (M2)
   Fixed width + center alignment so the TTN input column right after stays
   on the same x-coordinate across rows regardless of the badge's text. */
.adm-ord-paystatus {
    display: inline-flex; align-items: center; justify-content: center;
    width: 110px; padding: 0 8px; height: 24px;
    border-radius: 6px; font-size: 10px; font-weight: 600; white-space: nowrap;
    background: var(--bg); color: var(--text2); border: 1px solid var(--border);
    box-sizing: border-box;
}
/* Placeholder for orders without a payment.status (legacy docs) — preserves
   the column slot so the TTN input stays aligned. Height matches the other
   24px badges in the row (HOLD, payBadge, status select). */
.adm-ord-paystatus-placeholder { display: inline-block; width: 110px; height: 24px; visibility: hidden; }
.adm-ord-paystatus.ps-pending   { background: var(--orange-bg); color: var(--orange); border-color: transparent; }
.adm-ord-paystatus.ps-paid      { background: var(--green-bg);  color: var(--green);  border-color: transparent; }
.adm-ord-paystatus.ps-refunded  { background: var(--accent-bg); color: var(--accent); border-color: transparent; }
.adm-ord-paystatus.ps-cancelled { background: var(--red-bg);    color: var(--red);    border-color: transparent; }

/* Inline pay-status SELECT in the head row. Mirrors .adm-ord-status-sel
   styling so it reads as the same kind of control: colored chip-like
   pill. Coloring driven by the same ps-* classes the
   static badge used. */
.adm-ord-paystatus-sel {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    cursor: pointer; outline: none;
    padding: 0 8px; margin: 0;
    border-radius: 6px;
    text-transform: uppercase; letter-spacing: .3px;
    font: 700 10px var(--f-sans);
    transition: box-shadow .15s;
}
.adm-ord-paystatus-sel:focus { box-shadow: 0 0 0 2px var(--acc-tint); }
.adm-ord-paystatus-sel option { color: var(--fg); background: var(--bg-1); text-transform: none; }

/* Color the create-modal pay-status select live as admin picks an
   option (same palette as the head-row chip). The select element
   gets a class added via JS on change, but we can also key on the
   option's `data-ps` attribute through :has() in modern browsers —
   simpler: drive everything from JS-set class. See orders.js
   _coUpdatePayStatusColor. */
#coNewPayStatus.ps-pending   { background: var(--orange-bg); color: var(--orange); border-color: var(--orange); }
#coNewPayStatus.ps-paid      { background: var(--green-bg);  color: var(--green);  border-color: var(--green);  }
#coNewPayStatus.ps-refunded  { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
#coNewPayStatus.ps-cancelled { background: var(--red-bg);    color: var(--red);    border-color: var(--red);    }
#coNewPayStatus.ps-pending option,
#coNewPayStatus.ps-paid    option,
#coNewPayStatus.ps-refunded option,
#coNewPayStatus.ps-cancelled option { color: var(--fg); background: var(--bg-1); }

/* Inline payment-edit selects in the order economics card. Subtle styling
   so they don't scream out — admin uses them rarely. */
.adm-ord-pay-select {
    height: 24px; padding: 0 6px;
    border: 1px solid var(--line, var(--border));
    border-radius: 5px;
    background: var(--bg-2, var(--surface));
    color: var(--fg, var(--text));
    font: 500 11px var(--f-sans, Inter, sans-serif);
    cursor: pointer;
}
.adm-ord-pay-select:hover  { border-color: var(--acc, var(--accent)); }
.adm-ord-pay-select:focus  { outline: none; border-color: var(--acc, var(--accent)); }

/* ── Desktop (≥1101px): спільні доріжки колонок для заголовка + рядків ──
   .adm-orders-list задає доріжки; заголовок і кожен рядок наслідують їх
   через subgrid → 4 цільові колонки (статус/метод/оплата/hold) ростуть
   за вмістом і вирівняні між рядками. Нижче 1101px — legacy flex (вище),
   без змін. Блок іде ПІСЛЯ всіх базових .adm-ord* правил, щоб перебити
   display:flex та фіксовані width за source-order. */
@media (min-width: 1101px) {
    .adm-orders-list {
        display: grid;
        grid-template-columns:
            auto      /* select (чекбокс) */
            170px     /* № (numcell) */
            130px     /* Дата */
            180px     /* Клієнт */
            auto      /* Наклейка ← за вмістом */
            auto      /* Статус   ← за вмістом */
            auto      /* Метод    ← за вмістом */
            auto      /* Оплата   ← за вмістом */
            auto      /* Hold     ← за вмістом */
            1fr       /* ТТН (зʼїдає слабину → Сума/Прибуток/✕ праворуч) */
            auto      /* Сума */
            105px     /* Прибуток */
            auto;     /* delete (✕) */
        column-gap: 10px;
    }
    /* Заголовок, картка та рядок наслідують доріжки батька. */
    .adm-ord-headers,
    .adm-ord,
    .adm-ord-head {
        display: grid;
        grid-template-columns: subgrid;
        grid-column: 1 / -1;
    }
    .adm-ord-head { align-items: center; }
    /* Заголовок поза карткою; у .adm-ord є рамка 1px, що зсуває вміст
       рядка на 1px. Прозора рамка 1px у заголовка вирівнює доріжки
       піксель-у-піксель. Нижня лінія лишається видимою. */
    .adm-ord-headers {
        align-items: center;
        border: 1px solid transparent;
        border-bottom-color: var(--line, var(--border));
    }
    /* Тіло розкриття — на всю ширину, не одна доріжка. */
    .adm-ord-body { grid-column: 1 / -1; }
    /* Цільові колонки: зняти фіксований width, щоб доріжку задавав вміст.
       <select> беруть ширину за найдовшою опцією → «ОЧІКУЄ ОПЛАТИ» більше
       не обрізається. Заголовкові лейбли — теж auto, інакше їхній width
       форсує доріжку. */
    .adm-ord-status-sel,
    .adm-ord-pay-badge,
    .adm-ord-paystatus,
    .adm-ord-paystatus-sel,
    .adm-ord-hold,
    .adm-ord-hold-placeholder,
    .adm-ord-headers .h-status,
    .adm-ord-headers .h-paymethod,
    .adm-ord-headers .h-paystatus,
    .adm-ord-headers .h-hold {
        width: auto;
        justify-self: start;
    }
    /* Наклейка — доріжка за вмістом; індикатор і заголовок по центру. */
    .adm-ord-label-ind,
    .adm-ord-headers .h-label {
        width: auto;
        justify-self: center;
    }
    /* Комірка № тепер тримає номер + опційний repair-чип. */
    .adm-ord-numcell {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        min-width: 0;
    }
    .adm-ord-numcell .adm-ord-num {
        width: auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ============================================================
   Transactions tab
   ============================================================ */
.tx-inp {
    height: 34px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 7px;
    background: var(--surface); color: var(--text);
    font: 500 12px var(--f-sans); outline: none;
}
.tx-inp:focus { border-color: var(--accent); }
.adm-table {
    border-collapse: collapse; width: 100%;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.adm-table th, .adm-table td {
    padding: 8px 10px; border-bottom: 1px solid var(--border);
    text-align: left; font-size: 12px;
}
.adm-table thead th {
    background: var(--bg); color: var(--text2);
    font: 700 10px var(--f-sans); text-transform: uppercase; letter-spacing: .3px;
}
.adm-table tbody tr:hover { background: var(--bg); }
.adm-table tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   B2B technical primitives (from design port)
   KPI strip, data tables, switches, advanced modals, rates
   ============================================================ */

/* KPI strip — dashboard summary cards */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.kpi {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px;
    display: flex; flex-direction: column; gap: 4px;
    position: relative;
}
.kpi .k { font-size: 10px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.kpi .v { font-family: var(--f-mono); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.kpi .d { font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); display: flex; align-items: center; gap: 4px; }
.kpi .d.up { color: var(--ok); }
.kpi .d.down { color: var(--bad); }
@media (max-width: 880px) {
    .kpi-strip { grid-template-columns: 1fr 1fr; }
}

/* Data table shell */
.tbl-shell {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r);
    overflow: hidden;
}
.tbl-toolbar {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}
.tbl-toolbar .search-inline {
    height: 28px;
    display: flex; align-items: center; gap: 6px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--r);
    background: var(--bg-2);
    min-width: 240px;
}
.tbl-toolbar .search-inline input { flex: 1; background: none; border: none; outline: none; font-size: 12px; color: var(--fg); }
.tbl-toolbar .search-inline input::placeholder { color: var(--fg-4); }
.tbl-toolbar .spacer { flex: 1; }

.tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.tbl thead th {
    text-align: left;
    padding: 8px 14px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-3);
    font-weight: 600;
    background: var(--bg-3);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    position: sticky; top: 0;
}
.tbl thead th.sortable { cursor: pointer; user-select: none; }
.tbl thead th.sortable:hover { color: var(--fg); }
.tbl thead th.num { text-align: right; }
.tbl tbody td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.tbl tbody tr { transition: background var(--t); }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tbody tr.flagged { background: rgba(245,158,11,.06); }
.tbl tbody td.num { text-align: right; font-family: var(--f-mono); }
.tbl tbody td .muted { color: var(--fg-4); }
.tbl tbody td.nw { white-space: nowrap; }

.tbl-footer {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    font-size: 11px; color: var(--fg-3);
    font-family: var(--f-mono);
}
.tbl-footer .spacer { flex: 1; }

/* Small numeric input (edit-in-place inside tables) */
.inp-sm {
    height: 26px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 0 8px;
    color: var(--fg);
    font-family: var(--f-mono);
    font-size: 12px;
    width: 96px;
    text-align: right;
    transition: border-color var(--t);
}
.inp-sm:focus { outline: none; border-color: var(--acc); background: var(--bg-3); }
.inp-sm.changed { border-color: var(--warn); background: rgba(245,158,11,.06); }

/* Toggle switch */
.switch {
    width: 32px; height: 18px;
    border-radius: 10px;
    background: var(--line-2);
    position: relative;
    cursor: pointer;
    transition: background var(--t);
    flex-shrink: 0;
    border: none;
}
.switch::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--invert);
    transition: transform var(--t), background var(--t);
}
.switch.on { background: var(--acc); }
.switch.on::after { transform: translateX(14px); background: #fff; }

/* Icon button (for table row actions) */
.icon-btn {
    width: 26px; height: 26px;
    display: inline-grid; place-items: center;
    border-radius: 4px;
    color: var(--fg-3);
    transition: all var(--t);
    background: none; border: none;
    cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.icon-btn.danger:hover { color: var(--bad); }

/* Rate card (currency rates monitor) */
.rate-card {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r);
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
}
.rate-card .cur { font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); text-transform: uppercase; }
.rate-card .val { font-family: var(--f-mono); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.rate-card .delta { font-family: var(--f-mono); font-size: 11px; }
.rate-card .delta.up { color: var(--ok); }
.rate-card .delta.down { color: var(--bad); }

/* ==================== DASHBOARD ==================== */
.dash-loading, .dash-err {
    text-align: center; padding: 40px; color: var(--fg-3); font-size: 13px;
}
.dash-err { color: var(--bad); }

.dash-kpis {
    display: grid; gap: 12px; margin-bottom: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.dash-kpi {
    background: var(--bg-1); border: 1px solid var(--line);
    border-radius: 10px; padding: 14px 16px;
    display: flex; flex-direction: column; gap: 4px;
}
.dash-kpi.acc { border-color: var(--acc); background: var(--acc-tint); }
.dash-kpi.warn { border-color: var(--warn); background: rgba(245,158,11,.08); }
.dash-kpi-lbl { font: 600 10px var(--f-sans); color: var(--fg-3); text-transform: uppercase; letter-spacing: .06em; }
.dash-kpi-val { font-family: var(--f-mono); font-size: 22px; font-weight: 700; color: var(--fg); letter-spacing: -0.01em; }
.dash-kpi.acc .dash-kpi-val { color: var(--acc); }
.dash-kpi.warn .dash-kpi-val { color: var(--warn); }
.dash-kpi-sub { font-size: 11px; color: var(--fg-3); }

.dash-block {
    background: var(--bg-1); border: 1px solid var(--line);
    border-radius: 10px; padding: 14px;
    /* No margin-bottom — vertical spacing handled by parent col's flex gap. */
}
.dash-block-title {
    font: 600 13px var(--f-sans); color: var(--fg);
    margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.dash-block-sub { font: 500 11px var(--f-sans); color: var(--fg-3); }
.dash-empty { color: var(--fg-4); text-align: center; padding: 20px; font-size: 12px; }

.dash-chart-wrap { position: relative; }
.dash-chart { width: 100%; height: 180px; display: block; }
.dash-chart-lbl { font: 500 10px var(--f-mono); fill: var(--fg-3); }
.dash-chart-xlabels {
    display: flex; justify-content: space-between;
    padding: 4px 20px 0; font: 500 10px var(--f-mono); color: var(--fg-4);
}

.dash-two-col {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 900px) { .dash-two-col { grid-template-columns: 1fr; } }

.dash-status-list { display: flex; flex-direction: column; gap: 8px; }
.dash-status-row {
    display: grid; grid-template-columns: 130px 1fr 48px;
    gap: 10px; align-items: center;
}
.dash-status-lbl { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-2); }
.dash-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dash-status-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.dash-status-bar-fill { height: 100%; border-radius: 3px; transition: width .25s ease; }
.dash-status-count { text-align: right; font-size: 13px; color: var(--fg); font-weight: 600; }

.dash-top-list { display: flex; flex-direction: column; gap: 2px; }
.dash-top-row {
    display: grid; grid-template-columns: 40px 1fr auto auto;
    gap: 10px; align-items: center;
    padding: 8px 0; border-bottom: 1px solid var(--line);
}
.dash-top-row:last-child { border-bottom: none; }
.dash-top-rank { color: var(--fg-4); font-size: 11px; }
.dash-top-name > div:first-child { font-size: 13px; font-weight: 600; color: var(--fg); }
.dash-top-sub { font: 500 11px var(--f-mono); color: var(--fg-4); }
.dash-top-count { font-size: 12px; color: var(--fg-3); }
.dash-top-rev { font-size: 13px; color: var(--acc); font-weight: 700; }

/* ==================== SHOP BALANCE BLOCK (dashboard) ==================== */
.shop-bal-block {
    background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
    border: 1px solid var(--acc); border-radius: 14px;
    padding: 18px; margin-bottom: 16px;
    position: relative;   /* no overflow:hidden — it would clip the [data-exact] tooltip */
}
.shop-bal-block::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 0% 0%, var(--acc-tint), transparent 50%);
    pointer-events: none;
    border-radius: inherit;   /* was clipped by parent overflow:hidden before */
}
.shop-bal-main {
    display: grid; grid-template-columns: 1fr 2fr; gap: 14px;
    position: relative;
}
@media (max-width: 900px) { .shop-bal-main { grid-template-columns: 1fr; } }
.shop-bal-side {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
@media (max-width: 700px) { .shop-bal-side { grid-template-columns: 1fr 1fr; } }
.shop-bal-card {
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 12px 14px;
    display: flex; flex-direction: column; gap: 3px;
}
.shop-bal-card.shop-bal-primary {
    background: var(--acc-tint); border-color: var(--acc);
    padding: 16px 18px;
}
.shop-bal-card.shop-bal-negative { background: var(--bad-tint); border-color: var(--bad); }
.shop-bal-card.shop-bal-negative .shop-bal-lbl { color: var(--bad); }
.shop-bal-card.shop-bal-negative .shop-bal-val { color: var(--bad) !important; }

/* Turnover (revenue) section — runs in parallel to profit. Same layout
   as the profit block but tinted with the warn color so admin reads
   "different bucket" at a glance. */
.shop-bal-divider {
    margin: 18px 0 8px;
    font: 700 11px var(--f-sans); color: var(--fg-3);
    text-transform: uppercase; letter-spacing: .12em;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
}
.shop-bal-card.shop-bal-turnover {
    background: var(--warn-bg, rgba(245,158,11,0.08));
    border-color: var(--warn, var(--orange));
}
.shop-bal-card.shop-bal-turnover .shop-bal-lbl { color: var(--warn, var(--orange)); }
.shop-bal-card.shop-bal-turnover .shop-bal-val { color: var(--warn, var(--orange)); }
[data-theme="light"] .shop-bal-card.shop-bal-turnover .shop-bal-lbl,
[data-theme="light"] .shop-bal-card.shop-bal-turnover .shop-bal-val { color: var(--warn, var(--orange)); }
.shop-bal-lbl {
    font: 600 10px var(--f-sans); color: var(--fg-3);
    text-transform: uppercase; letter-spacing: .08em;
}
.shop-bal-primary .shop-bal-lbl { color: var(--acc); }
[data-theme="light"] .shop-bal-primary .shop-bal-lbl { color: var(--acc-lo); }
.shop-bal-val {
    font: 700 26px var(--f-mono);
    letter-spacing: -0.02em; color: var(--fg);
    position: relative;   /* anchor for the [data-exact] tooltip */
}
.shop-bal-primary .shop-bal-val { color: var(--acc); font-size: 32px; }
[data-theme="light"] .shop-bal-primary .shop-bal-val { color: var(--acc-lo); }
.shop-bal-sub { font-size: 11px; color: var(--fg-3); }
.shop-bal-payout {
    margin-top: 10px; width: fit-content;
    background: var(--acc); color: var(--invert);
}
.shop-bal-payouts {
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
    position: relative;
}
.shop-bal-payouts-title {
    font: 600 11px var(--f-sans); color: var(--fg-3);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px;
}
.shop-payout-row {
    display: grid; grid-template-columns: 130px 100px 1fr; gap: 10px;
    padding: 6px 0; border-bottom: 1px dashed var(--line);
    font-size: 12px; color: var(--fg-2);
}
.shop-payout-row:last-child { border-bottom: none; }

/* ==================== DASH RANGE BAR (inline, no modal) ==================== */
.dash-range-bar {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    padding: 10px 14px; margin-bottom: 14px;
    background: var(--bg-1); border: 1px solid var(--line); border-radius: 10px;
}
.dash-range-chips {
    display: flex; gap: 6px; flex-wrap: wrap;
}
.dash-range-chip {
    padding: 6px 12px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg-2); color: var(--fg-2);
    font: 500 12px var(--f-sans); cursor: pointer;
    transition: all .15s;
}
.dash-range-chip:hover { border-color: var(--acc); color: var(--acc); }
.dash-range-chip.on { background: var(--acc); border-color: var(--acc); color: var(--invert); }
.dash-range-custom-inline {
    display: flex; align-items: center; gap: 6px;
    margin-left: auto;
}
.dash-range-custom-lbl-i {
    font: 600 10px var(--f-sans); color: var(--fg-3);
    text-transform: uppercase; letter-spacing: .06em;
}
.dash-range-custom-inline input[type="date"] {
    height: 30px; padding: 0 8px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg-2); color: var(--fg);
    font: 12px var(--f-mono); outline: none;
    color-scheme: dark;
}
[data-theme="light"] .dash-range-custom-inline input[type="date"] { color-scheme: light; }
.dash-range-custom-inline input[type="date"]:focus { border-color: var(--acc); }
.dash-export-btn {
    padding: 6px 14px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg-2); color: var(--fg-2);
    font: 500 12px var(--f-sans); cursor: pointer;
    transition: all .15s;
}
.dash-export-btn:hover { border-color: var(--acc); color: var(--acc); }

/* ==================== 2-COL LAYOUT + CHART ==================== */
.dash-layout { display: flex; flex-direction: column; gap: 10px; }
.dash-2col {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    align-items: stretch;   /* cells get the same height (tallest content wins) */
}
@media (max-width: 1100px) { .dash-2col { grid-template-columns: 1fr; } }
/* Both columns are flex-col + `align-items: stretch` on the grid parent →
   both cells end up with identical heights (row height = tallest content).
   Left column: both stats blocks split the cell evenly (`flex: 1 1 0`) so
   shop/drops stats cards are the same size inside and out.
   Right column: chart grows to fill remaining space; drops block stays natural. */
.dash-stats-col, .dash-chart-col {
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.dash-stats-col > .dash-block { flex: 1 1 0; min-height: 0; }
.dash-chart-col > .dash-chart-block { flex: 1 1 auto; }
.dash-chart-block { min-height: 340px; }
.dash-chart-host { width: 100%; min-height: 300px; display: flex; align-items: stretch; justify-content: center; }
.dash-chart-wrap2 { width: 100%; position: relative; }
.dash-chart2 { width: 100%; height: 300px; display: block; overflow: visible; cursor: crosshair; }
.dc-ylbl { font: 500 10px var(--f-mono); fill: var(--fg-4); }
.dc-xlbl { font: 500 10px var(--f-mono); fill: var(--fg-4); }
.dc-crosshair { pointer-events: none; transition: opacity .12s; }
.dc-dot { pointer-events: none; transition: opacity .12s; }
.dc-tooltip {
    position: absolute; pointer-events: none;
    background: var(--bg-1); border: 1px solid var(--line);
    border-radius: 6px; padding: 6px 10px;
    font: 500 12px var(--f-sans);
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
    opacity: 0; transition: opacity .12s;
    min-width: 90px; z-index: 10;
}
.dc-tip-date { font-family: var(--f-mono); font-size: 10px; color: var(--fg-3); }
.dc-tip-val  { font-family: var(--f-mono); font-weight: 700; color: var(--fg); margin-top: 2px; }

/* ==================== DROPS BLOCK (dashboard, left column) ==================== */
.dash-drops-block { /* sits inside .dash-stats-col — inherits width */ }
.dash-drops-summary {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 6px; margin-bottom: 10px;
}
.dash-drops-sum-item {
    display: flex; flex-direction: column; gap: 2px;
    padding: 6px 8px;
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: 6px;
}
.dash-drops-sum-lbl {
    font: 600 9px var(--f-sans); color: var(--fg-3);
    text-transform: uppercase; letter-spacing: .04em;
}
.dash-drops-sum-val {
    font: 700 13px var(--f-mono); color: var(--fg);
    white-space: nowrap;
}
@media (max-width: 640px) { .dash-drops-summary { grid-template-columns: repeat(2, 1fr); } }
.dash-drop-selected {
    display: flex; align-items: center; gap: 10px;
    background: var(--acc-tint); border: 1px solid var(--acc);
    border-radius: 8px; padding: 6px 10px;
    margin-bottom: 10px; font-size: 12px; color: var(--fg);
}
.dash-drop-selected b { color: var(--acc); font-weight: 700; }
.dash-drop-clear { margin-left: auto; height: 24px; padding: 0 10px; font-size: 11px; }

.dash-drop-picker {
    border-top: 1px dashed var(--line);
    padding-top: 10px;
}
.dash-drop-search {
    width: 100%; height: 32px; padding: 0 10px;
    border: 1px solid var(--line); border-radius: 6px;
    background: var(--bg-2); color: var(--fg);
    font: 13px var(--f-sans); outline: none;
    margin-bottom: 8px;
}
.dash-drop-search:focus { border-color: var(--acc); }
.dash-drop-list {
    display: flex; flex-direction: column; gap: 2px;
    max-height: 260px; overflow-y: auto;
    border: 1px solid var(--line); border-radius: 6px;
    padding: 4px; background: var(--bg-2);
}
.dash-drop-row {
    display: grid; grid-template-columns: 1fr auto auto;
    gap: 10px; align-items: center;
    padding: 6px 10px; border-radius: 6px;
    cursor: pointer; transition: all .12s;
    background: var(--bg-1);
}
.dash-drop-row:hover { background: var(--bg-hover); }
.dash-drop-row.on { background: var(--acc-tint); border: 1px solid var(--acc); padding: 5px 9px; }
.dash-drop-name > div:first-child {
    font-size: 13px; font-weight: 600; color: var(--fg);
}
.dash-drop-phone { font: 500 11px var(--f-mono); color: var(--fg-3); }
.dash-drop-bal { font-size: 13px; font-weight: 700; white-space: nowrap; }
.dash-drop-sub { display: flex; gap: 4px; }
.dash-drop-chip {
    display: inline-flex; align-items: center;
    padding: 2px 6px; border-radius: 4px;
    font: 700 10px var(--f-mono);
    border: 1px solid transparent;
}
.dash-drop-chip.hold { background: rgba(245,158,11,.12); color: var(--warn); border-color: var(--warn); }
.dash-drop-chip.pend { background: rgba(16,185,129,.10); color: var(--ok); border-color: var(--ok); }
.dash-drop-more { font-size: 11px; color: var(--fg-3); padding: 6px 10px; text-align: center; }

.dash-drop-pager {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 4px 0; font-size: 11px; color: var(--fg-3);
}
.dash-drop-pager .pg-btn {
    height: 26px; min-width: 26px; padding: 0 6px;
    border: 1px solid var(--line); border-radius: 5px;
    background: var(--bg-2); color: var(--fg-2);
    font: 600 13px var(--f-mono); cursor: pointer;
    transition: all .15s;
}
.dash-drop-pager .pg-btn:hover:not(:disabled) { border-color: var(--acc); color: var(--acc); }
.dash-drop-pager .pg-btn:disabled { opacity: .35; cursor: not-allowed; }
.dash-drop-pg-info { font: 600 12px var(--f-mono); color: var(--fg); }
.dash-drop-pg-hint { margin-left: auto; font-size: 10px; color: var(--fg-4); }

/* ==================== STATS BLOCKS ==================== */
.dash-stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}
.dash-stat-card {
    background: var(--bg-2); border: 1px solid var(--line);
    border-radius: 10px; padding: 10px 12px;
    display: flex; flex-direction: column; gap: 3px;
    justify-content: flex-start;
    /* Fixed height so cards in different blocks stay identical regardless of
       how long the label is (some wrap to 2 lines, others don't). */
    height: 74px;
    box-sizing: border-box;
    position: relative;   /* anchor for the [data-exact] tooltip */
    transition: all .15s;
}
.dash-stat-card.dash-stat-accent { border-color: var(--ok); background: rgba(16,185,129,.06); }
.dash-stat-card.clickable { cursor: pointer; }
.dash-stat-card.clickable:hover { border-color: var(--acc); background: var(--acc-tint); }
.dash-stat-card.on { border-color: var(--acc); background: var(--acc-tint); box-shadow: inset 0 0 0 1px var(--acc); }
.dash-stat-card.on .dash-stat-icn { color: var(--acc); }
.dash-stat-lbl {
    font: 600 10px var(--f-sans); color: var(--fg-3);
    text-transform: uppercase; letter-spacing: .06em;
    display: flex; align-items: flex-start; gap: 4px;
    /* Reserve two lines' worth of space so cards with short labels ("Замовлень")
       are the same height as ones with wrapping labels ("Продаж дропами (оборот)"). */
    min-height: 26px; line-height: 13px;
}
.dash-stat-icn { font-size: 10px; opacity: .5; }
.dash-stat-card.clickable:hover .dash-stat-icn { opacity: 1; color: var(--acc); }
.dash-stat-val {
    font: 700 18px var(--f-mono);
    letter-spacing: -0.01em; color: var(--fg);
    white-space: nowrap;   /* ₴ never wraps out of the fixed-height card */
}
/* Instant exact-sum tooltip on money values (the value itself is compact к/М):
   dashboard stat cards + shop-balance card values. */
.dash-stat-card[data-exact]:hover::after,
.shop-bal-val[data-exact]:hover::after {
    content: attr(data-exact);
    position: absolute; bottom: calc(100% + 6px); left: 50%;
    transform: translateX(-50%);
    background: var(--bg-1); border: 1px solid var(--line);
    border-radius: 6px; padding: 5px 9px;
    font: 600 12px var(--f-mono); color: var(--fg);
    white-space: nowrap; pointer-events: none; z-index: 10;
    box-shadow: 0 4px 14px rgba(0,0,0,.4);
}
.dash-stat-sub { font-size: 11px; color: var(--fg-3); }

/* ==================== EDIT USER MODAL — balance + tx-list ==================== */
/* Inline styles lived in admin.html line 119-170 and users.js:~280.
   Moved here so the markup is readable and themes/variants can evolve. */
.eu-phone-readonly { opacity: .6; cursor: not-allowed; }
.eu-err           { color: var(--red); font-size: 12px; margin-bottom: 8px; }
.eu-balance-row   { display: flex; gap: 14px; align-items: baseline; margin-bottom: 8px; }
.eu-stat-lbl      { font-size: 10px; color: var(--text2, var(--fg-3)); text-transform: uppercase; }
.eu-stat-big      { font-size: 18px; font-weight: 700; color: var(--orange, var(--warn)); }
.eu-stat-pending  { font-size: 16px; font-weight: 700; color: var(--text2, var(--fg-3)); }
.eu-bal-inputs    { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.eu-bal-amt       { flex: 1; }
.eu-bal-note      { flex: 2; }
.eu-bal-actions   { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.eu-bal-btn       { width: auto; padding: 8px 14px; margin: 0; }
.eu-bal-btn.green { background: var(--green, var(--ok)); }
.eu-bal-btn.red   { background: var(--red, var(--bad)); }
.eu-bal-zero      {
    padding: 7px 12px;
    border: 1px solid var(--border, var(--line));
    border-radius: 6px;
    background: none;
    color: var(--text2, var(--fg-3));
    font: 500 11px Inter, sans-serif;
    cursor: pointer;
}
.eu-neg-toggle    { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2, var(--fg-3)); margin-top: 6px; cursor: pointer; }
.eu-tx-head       { margin-top: 10px; display: flex; justify-content: space-between; align-items: center; }
.eu-tx-head-lbl   { font-size: 11px; color: var(--text3, var(--fg-4)); }
.eu-tx-head-link  { font-size: 11px; color: var(--accent, var(--acc)); text-decoration: none; }
.eu-tx-list       { margin-top: 6px; max-height: 180px; overflow-y: auto; font-size: 11px; color: var(--text2, var(--fg-3)); }
.eu-tx-row        { display: flex; gap: 6px; padding: 2px 0; border-bottom: 1px solid var(--border, var(--line)); }
.eu-tx-amt        { font-weight: 600; min-width: 60px; }
.eu-tx-amt.pos    { color: var(--green, var(--ok)); }
.eu-tx-amt.neg    { color: var(--red, var(--bad)); }
.eu-tx-amt.zero   { color: var(--orange, var(--warn)); }
.eu-tx-note       { color: var(--text3, var(--fg-4)); }
.eu-tx-ord        { color: var(--accent, var(--acc)); }
.eu-tx-meta       { margin-left: auto; color: var(--text3, var(--fg-4)); }

/* Create DROP modal shared error */
.dm-err { color: var(--red); font-size: 12px; margin-bottom: 8px; }

/* Prices tab — eye toggle for "hide from public shop". Row stays in admin
   view so prices can still be managed; dimmed visual signals the state. */
.pt-eye {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    margin-left: 6px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    vertical-align: middle;
    line-height: 1;
    transition: background .15s, border-color .15s;
}
.pt-eye:hover { background: var(--bg-2, var(--bg-hover)); border-color: var(--line, var(--border)); }
.pt-eye.off   { opacity: .6; }
.price-table tr.hidden-from-public .pt-name,
.price-table tr.hidden-from-public .pt-desc,
.price-table tr.hidden-from-public .pt-stock,
.price-table tr.hidden-from-public .pt-api { opacity: .45; }
.price-table tr.hidden-from-public .pt-name { text-decoration: line-through; }
.price-table tr.hidden-from-public { background: var(--bg-2, rgba(0,0,0,.04)); }

/* Edit User — password reset row. Shown for every user (drop + regular). */
.eu-pw-section { padding-top: 10px; border-top: 1px dashed var(--border, var(--line)); margin-top: 10px; }
.eu-pw-row     { display: flex; gap: 6px; align-items: center; }
.eu-pw-input   { flex: 1; }
.eu-pw-btn     { width: auto; padding: 8px 14px; margin: 0; background: var(--red, var(--bad)); }
.eu-pw-hint    { font-size: 11px; color: var(--text3, var(--fg-4)); margin-top: 6px; line-height: 1.4; }

/* ==================== ORDER TRACKING TIMELINE ==================== */
.adm-ord-tracking { margin-bottom: 12px; }
.adm-ord-track-head-meta {
    margin-left: auto; font-weight: 400; font-size: 11px;
    color: var(--text3, var(--fg-3)); display: inline-flex; align-items: center; gap: 6px;
}
.adm-ord-track-head-meta a { font-size: 11px; }
.adm-ord-track-empty {
    padding: 14px; text-align: center; color: var(--text3, var(--fg-3));
    font-size: 12px; font-style: italic;
}
.adm-ord-track-refused {
    margin: 8px 0 10px; padding: 8px 10px;
    background: var(--red-bg); color: var(--red);
    border: 1px solid var(--red); border-radius: 6px;
    font-size: 12px; font-weight: 600;
}
.adm-ord-track-list {
    display: flex; flex-direction: column; gap: 0;
    margin-top: 8px;
    /* Cap the timeline height so a long-running shipment with 30+ NP
       events doesn't blow out the order card vertically. Internal
       scroll keeps newest event visible (list is newest-first) and
       admin can scroll down for full history. */
    max-height: 240px;
    overflow-y: auto;
    /* Custom thin scrollbar that matches the dark/light themes —
       webkit only, but it's the dominant admin browser. */
    scrollbar-width: thin;
}
.adm-ord-track-list::-webkit-scrollbar { width: 6px; }
.adm-ord-track-list::-webkit-scrollbar-thumb {
    background: var(--line, var(--border));
    border-radius: 3px;
}
.adm-ord-track-row {
    display: grid; grid-template-columns: 28px 1fr auto; gap: 10px;
    align-items: start; padding: 6px 0; position: relative;
    border-bottom: 1px dashed var(--border);
}
.adm-ord-track-row:last-child { border-bottom: none; }
/* Vertical connector line through the dot column. Drawn from each dot
   to the next so the timeline visually flows. Top dot has a stub from
   the row top; subsequent rows extend up from the dot to the prior row. */
.adm-ord-track-row::before {
    content: '';
    position: absolute;
    left: 13px; top: 0; bottom: 0; width: 2px;
    background: var(--border);
}
.adm-ord-track-row:first-child::before { top: 18px; }
/* (K23) Stop the connector at the dot on the last row instead of
   running it to the bottom of the row. Previous `bottom: calc(100% -
   18px)` pushed the connector's bottom edge ABOVE its top edge —
   inverted/invisible in some renderers and producing a stray line
   across the row in others. height:18px + bottom:auto draws a clean
   stub from the row top down to the dot. */
.adm-ord-track-row:last-child::before  { bottom: auto; height: 18px; }
.adm-ord-track-dot {
    position: relative; z-index: 1;
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 2px solid var(--border);
    font-size: 12px; line-height: 1; margin-top: 4px;
}
.adm-ord-track-row.passed .adm-ord-track-dot {
    background: var(--green-bg); border-color: var(--green); color: var(--green);
}
.adm-ord-track-row.now .adm-ord-track-dot {
    background: var(--accent); border-color: var(--accent); color: #fff;
    box-shadow: 0 0 0 3px var(--accent-bg);
}
.adm-ord-track-row.future .adm-ord-track-dot {
    background: var(--bg); border-color: var(--border); opacity: .55;
}
.adm-ord-track-row.future {
    opacity: .65;
}
.adm-ord-track-name {
    font-size: 12px; font-weight: 500; color: var(--text);
    line-height: 1.4;
}
.adm-ord-track-row.now .adm-ord-track-name { font-weight: 700; }
.adm-ord-track-loc {
    display: block; font-size: 11px; font-weight: 400;
    color: var(--text2, var(--fg-2)); margin-top: 1px;
}
.adm-ord-track-date {
    font-size: 11px; color: var(--text2, var(--fg-2));
    white-space: nowrap; padding-top: 4px;
}

/* ==================== EDIT ORDER MODAL ==================== */
/* Modal sizing — the cramped 760px box made the items grid wrap awkwardly
   and left no room for customer/delivery sections. We give it a generous
   1200px ceiling, occupy 96vw on smaller screens, and let internal scroll
   take over once content overflows. position:fixed + the centered transform
   live in adm-modal base; max-height keeps it inside the viewport. */
.eo-modal {
    position: fixed;
    width: 96vw; max-width: 1200px;
    max-height: 92vh; overflow: auto;
}
/* 2-column layout: items + totals on the left, customer + delivery on
   the right. On narrower viewports collapse to a single column so the
   form fields don't get squeezed below readable width. */
.eo-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 24px;
    margin-bottom: 14px;
}
@media (max-width: 980px) {
    .eo-grid { grid-template-columns: 1fr; gap: 18px; }
}
.eo-col-left, .eo-col-right { min-width: 0; }
.eo-section-title {
    font: 600 11px var(--f-sans, Inter, sans-serif);
    text-transform: uppercase; letter-spacing: .5px;
    color: var(--text2); margin: 4px 0 10px;
    padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.eo-col-right .eo-section-title:not(:first-child) { margin-top: 18px; }

/* Form fields — wide-input flex grid. label wraps span+input vertically;
   .eo-field-half = 50% width, .eo-field-3 = 1/3 width (3 across), full
   spans the whole row. The grid is plain CSS grid so wrapping just works. */
.eo-form-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
}
.eo-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.eo-field > span {
    font: 600 10px var(--f-sans, Inter, sans-serif);
    text-transform: uppercase; letter-spacing: .3px;
    color: var(--text2);
}
.eo-field .adm-modal-input { margin: 0; width: 100%; }
.eo-field-full { grid-column: span 6; }
.eo-field-half { grid-column: span 3; }
.eo-field-3    { grid-column: span 2; }
@media (max-width: 600px) {
    .eo-field-half, .eo-field-3 { grid-column: span 6; }
}
.eo-radio-row {
    display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
    padding: 6px 8px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; min-height: 32px;
}
.eo-radio-row label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; cursor: pointer; user-select: none;
}
/* legal-only / address-only / warehouse-only fields toggle via display:none
   driven by the JS that watches the radio change. Default hidden until
   the form decides what to show. */
.eo-legal-only, .eo-del-warehouse, .eo-del-address { display: none; }
.eo-modal.eo-cus-legal .eo-legal-only { display: flex; }
.eo-modal.eo-del-branch    .eo-del-warehouse { display: flex; }
.eo-modal.eo-del-poshtomad .eo-del-warehouse { display: flex; }
.eo-modal.eo-del-address   .eo-del-address   { display: flex; }
/* Switch warehouse label text via CSS so we don't fight JS for control. */
.eo-modal.eo-del-poshtomad #eoDelWhLbl::before { content: 'Поштомат'; }
.eo-modal:not(.eo-del-poshtomad) #eoDelWhLbl::before { content: 'Відділення'; }
.eo-modal #eoDelWhLbl { font-size: 0; }
.eo-modal #eoDelWhLbl::before {
    font: 600 10px var(--f-sans, Inter, sans-serif);
    text-transform: uppercase; letter-spacing: .3px;
    color: var(--text2);
}

/* Banner shown atop the right column when the order ships under a
   drop's pre-printed NP label. Customer + delivery fields below it are
   disabled because the physical sticker is already on the parcel —
   editing here would silently desync from what NP / the courier sees. */
.eo-recipient-lock {
    padding: 10px 12px;
    margin-bottom: 14px;
    background: var(--orange-bg);
    color: var(--orange);
    border: 1px solid var(--orange);
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
}
/* When .eo-locked-shipping is active on the modal root, EVERYTHING
   inside the right column reads as visually locked. Inputs themselves
   carry `disabled` (set by JS) so the form layer and the visual layer
   stay in lock-step — pointer-events:none alone wouldn't stop a savvy
   admin from focusing via Tab. */
.eo-modal.eo-locked-shipping .eo-col-right .eo-form-grid {
    opacity: .6;
    pointer-events: none;
}
.eo-modal.eo-locked-shipping .eo-col-right .eo-form-grid input,
.eo-modal.eo-locked-shipping .eo-col-right .eo-form-grid label {
    cursor: not-allowed;
}

/* Nova Poshta autocomplete dropdown — same pattern as eo-add-dropdown but
   reused across city/warehouse/street pickers. */
.eo-np-pick { position: relative; }
.eo-np-dd {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    margin-top: 2px; max-height: 220px; overflow-y: auto; z-index: 6;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    box-shadow: var(--shadow-lg, 0 6px 20px rgba(0,0,0,.18));
}
.eo-np-dd.open { display: block; }
.eo-np-item {
    padding: 7px 10px; border-bottom: 1px solid var(--border);
    cursor: pointer; font-size: 12px;
}
.eo-np-item:last-child { border-bottom: none; }
.eo-np-item:hover, .eo-np-item.eo-np-active { background: var(--accent-bg); }
.eo-np-empty { padding: 10px; font-size: 11px; color: var(--text3); text-align: center; }

.eo-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.eo-item {
    display: grid; grid-template-columns: 32px 1fr 70px 110px 110px 32px; gap: 8px;
    align-items: center; padding: 8px; background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px;
}
.eo-item-img { width: 32px; height: 32px; border-radius: 4px; background: var(--surface);
    display: flex; align-items: center; justify-content: center; font-size: 18px; overflow: hidden; }
.eo-item-img img { width: 100%; height: 100%; object-fit: cover; }
.eo-item-name { font-weight: 600; font-size: 12px; }
.eo-item-sub { font-size: 10px; color: var(--text2); margin-top: 2px; }
.eo-item-qty, .eo-item-sell, .eo-item-price {
    width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px;
    font: 12px var(--f-sans); background: var(--bg); color: var(--text); text-align: right; outline: none;
}
.eo-item-qty:focus, .eo-item-sell:focus, .eo-item-price:focus { border-color: var(--accent); }
.eo-item-rm {
    width: 28px; height: 28px; border: none; border-radius: 4px;
    background: var(--red-bg); color: var(--red); cursor: pointer; font-size: 14px; font-weight: 700;
}
.eo-item-rm:hover { background: var(--red); color: #fff; }

.eo-add-row { display: flex; gap: 8px; padding: 8px; background: var(--accent-bg); border-radius: 6px; margin-bottom: 12px; align-items: flex-start; }
.eo-add-row .adm-modal-input { margin: 0; }
.eo-add-btn { background: var(--accent) !important; }
/* Searchable product picker — text input + filtered dropdown panel.
   `position:relative` on the wrapper anchors the absolute dropdown,
   so it sits flush with the input regardless of modal scroll. */
.eo-add-search { position: relative; flex: 1; min-width: 0; }
.eo-add-search > input[type="text"] { width: 100%; }
.eo-add-dropdown {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    margin-top: 2px; max-height: 240px; overflow-y: auto;
    /* High z-index so we paint above sibling .eo-section-title /
       .co-row blocks below the search input (without this the
       dropdown ended up *under* the next section's header in the
       create-order modal). 100 is safely above the modal's own
       internal stacking. */
    z-index: 100;
    background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
    box-shadow: var(--shadow-lg, 0 6px 20px rgba(0,0,0,.18));
}
.eo-add-dropdown.open { display: block; }
.eo-add-item {
    display: flex; gap: 8px; align-items: center; padding: 7px 10px;
    border-bottom: 1px solid var(--border); cursor: pointer; font-size: 12px;
}
.eo-add-item:last-child { border-bottom: none; }
.eo-add-item:hover, .eo-add-item.eo-add-active { background: var(--accent-bg); }
.eo-add-item-name { flex: 1; font-weight: 500; }
.eo-add-item-stock { font-size: 11px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.eo-add-item-stock.low  { color: var(--orange); }
.eo-add-item-stock.crit { color: var(--red); }
.eo-add-empty { padding: 10px; font-size: 11px; color: var(--text3); text-align: center; }
/* In-line stock badge appended to .eo-item-sub. Tiny — bumps to orange/red
   when admin over-allocates; cap is enforced at input clamp time. */
.eo-stock-pill {
    display: inline-block; padding: 0 5px; border-radius: 3px;
    background: var(--surface); color: var(--text2); font-weight: 600;
    margin-left: 4px;
}
.eo-stock-pill.warn { background: var(--orange-bg); color: var(--orange); }
.eo-stock-pill.crit { background: var(--red-bg); color: var(--red); }

.eo-totals { padding: 10px 12px; background: var(--surface); border-radius: 6px; margin-bottom: 12px; font-size: 12px; }
.eo-total-row { display: flex; justify-content: space-between; padding: 3px 0; }
.eo-total-row b { font-weight: 700; }
.eo-shop-profit { border-top: 1px solid var(--border); padding-top: 6px; margin-top: 4px; font-weight: 600; }
.eo-shop-profit b { color: var(--green); }
.eo-shop-profit b.neg { color: var(--red); }

.eo-warn {
    padding: 8px 10px; background: var(--orange-bg); color: var(--orange);
    border: 1px solid var(--orange); border-radius: 6px; font-size: 11px; margin-bottom: 8px;
}

/* ==================== TRANSACTIONS TAB ==================== */
/* Back-banner: surfaced only when tx-list is scoped to a single user (admin
   arrived here via the Users tab "Історія" deep-link). Without this banner
   the userId filter is invisible-but-sticky — admin had to manually clear
   the dropdown to see everyone again. */
.tx-back-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: var(--acc-tint, rgba(59,130,246,.08));
    border: 1px solid var(--acc, var(--accent));
    border-radius: 8px;
    font-size: 13px;
}
.tx-back-btn {
    padding: 6px 12px;
    border: 1px solid var(--acc, var(--accent));
    border-radius: 6px;
    background: var(--bg-1, var(--surface));
    color: var(--acc, var(--accent));
    font: 500 12px var(--f-sans, Inter, sans-serif);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.tx-back-btn:hover { background: var(--acc, var(--accent)); color: var(--invert, #fff); }
.tx-back-lbl { color: var(--fg-3, var(--text2)); font-size: 12px; }
.tx-back-phone { color: var(--fg-3, var(--text3)); font-family: var(--f-mono); font-size: 11px; }

/* Order-grouped view: each card = one order's full tx history, click to expand.
   Adjust rows without an orderId live in a separate section below the cards.
   No tables here — the transactional flow is more readable as a stream of
   cards than as a flat spreadsheet. */
.tx-order-list { display: flex; flex-direction: column; gap: 6px; }

.tx-order-card {
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line, var(--border));
    border-radius: 8px;
    overflow: hidden;
}
.tx-order-card:hover { border-color: var(--line-2, #4b5563); }

.tx-order-head {
    display: grid;
    grid-template-columns: 18px 200px 1fr auto auto auto;
    gap: 14px;
    align-items: center;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    transition: background .15s;
}
.tx-order-head:hover { background: var(--bg-2, var(--bg-hover)); }

.tx-order-caret {
    display: inline-block;
    width: 12px;
    color: var(--fg-3, var(--text2));
    font-size: 9px;
    transition: transform .15s;
}
.tx-order-card[data-expanded] .tx-order-caret { transform: rotate(90deg); }

.tx-order-num {
    font-family: var(--f-mono);
    font-weight: 600;
    color: var(--acc, var(--accent));
}
.tx-order-user { display: flex; flex-direction: column; font-size: 12px; }
.tx-order-phone { font-size: 10px; color: var(--fg-3, var(--text3)); font-family: var(--f-mono); }
.tx-order-state { font-weight: 600; white-space: nowrap; }
.tx-order-count { color: var(--fg-3, var(--text2)); font-size: 11px; white-space: nowrap; }
.tx-order-date { color: var(--fg-4, var(--text3)); font-size: 11px; white-space: nowrap; font-family: var(--f-mono); }

.tx-order-body {
    display: none;
    padding: 0 14px 8px 44px;
    border-top: 1px solid var(--line, var(--border));
    background: var(--bg-2, rgba(0,0,0,.12));
}
.tx-order-card[data-expanded] .tx-order-body { display: block; }

.tx-inner {
    display: grid;
    grid-template-columns: 110px 190px 90px 140px 1fr;
    gap: 12px;
    padding: 7px 0;
    align-items: center;
    font-size: 11.5px;
    border-bottom: 1px dashed var(--line, var(--border));
}
.tx-inner:last-child { border-bottom: none; }
.tx-inner-date { color: var(--fg-3, var(--text3)); font-family: var(--f-mono); font-size: 11px; }
.tx-inner-type { font-weight: 500; }
.tx-inner-amt { text-align: right; font-weight: 700; font-family: var(--f-mono); white-space: nowrap; }
.tx-inner-amt.pos { color: var(--green, var(--ok)); }
.tx-inner-amt.neg { color: var(--red, var(--bad)); }
.tx-inner-after { color: var(--fg-2, var(--text2)); font-family: var(--f-mono); font-size: 11px; white-space: nowrap; }
.tx-inner-note { color: var(--fg-3, var(--text3)); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Orphan adjust-rows (no orderId) rendered separately — no cards, just a
   compact flat list so admin can audit manual corrections at a glance. */
.tx-orphan-section {
    margin-top: 14px;
    border: 1px solid var(--line, var(--border));
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-1, var(--surface));
}
.tx-orphan-title {
    padding: 8px 14px;
    background: var(--bg-2, rgba(0,0,0,.12));
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-3, var(--text2));
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--line, var(--border));
}
.tx-orphan {
    display: grid;
    grid-template-columns: 110px 200px 180px 90px 140px 1fr;
    gap: 12px;
    padding: 8px 14px;
    align-items: center;
    font-size: 11.5px;
    border-bottom: 1px dashed var(--line, var(--border));
}
.tx-orphan:last-child { border-bottom: none; }
.tx-orphan-user { font-size: 11.5px; display: flex; align-items: baseline; gap: 6px; }

@media (max-width: 900px) {
    .tx-order-head {
        grid-template-columns: 18px 1fr auto;
        grid-auto-flow: row;
        gap: 6px;
    }
    .tx-order-user, .tx-order-count, .tx-order-date { grid-column: 2 / -1; }
    .tx-order-state { grid-column: 2 / -1; }
    .tx-inner, .tx-orphan {
        grid-template-columns: 1fr auto;
        grid-auto-flow: row;
        gap: 4px 10px;
    }
    .tx-inner-note, .tx-orphan .tx-inner-note { grid-column: 1 / -1; }
    .tx-order-body { padding-left: 14px; }
}

/* ==================== PAYOUT HISTORY MODAL ==================== */
/* Rendered by dashboard.js:openPayoutsHistory over the common .confirm-*
   backdrop so Escape / backdrop-click / focus trap all Just Work. */
.payout-history-modal { width: 640px; max-width: 96vw; }
.payout-history-body {
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid var(--line, var(--border));
    border-radius: 6px;
    background: var(--bg-2, var(--bg));
    padding: 4px 0;
}
.payout-history-row {
    display: grid;
    grid-template-columns: 140px 110px 1fr 100px;
    gap: 10px;
    padding: 6px 12px;
    font-size: 12px;
    border-bottom: 1px solid var(--line, var(--border));
    align-items: center;
}
.payout-history-row:last-child { border-bottom: none; }
.payout-history-amt  { color: var(--acc, var(--accent)); font-weight: 600; }
.payout-history-note { color: var(--fg-2, var(--text2)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payout-history-by   { color: var(--fg-3, var(--text3)); font-size: 11px; text-align: right; }
.payout-history-pager {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 10px 0 4px;
    font-size: 12px;
    color: var(--fg-3, var(--text3));
}
.shop-payout-all {
    margin-top: 10px;
    width: 100%;
    justify-content: center;
}

/* ==================== INVENTORY TAB ==================== */
.inv-header {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 14px; flex-wrap: wrap;
}
.inv-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.inv-stat { font-size: 12px; color: var(--text2); }
.inv-stat b { color: var(--text); font-weight: 700; }
.inv-search {
    flex: 1; min-width: 200px; max-width: 360px;
    height: 34px; padding: 0 12px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
    font: 500 13px 'Inter', sans-serif; outline: none;
}
.inv-search:focus { border-color: var(--accent); }
.inv-actions { display: flex; gap: 8px; }
.inv-table {
    width: 100%; border-collapse: collapse;
    background: var(--bg-1); border-radius: 8px; overflow: hidden;
    border: 1px solid var(--line);
}
.inv-table th, .inv-table td {
    padding: 8px 10px; text-align: left;
    border-bottom: 1px solid var(--line); font-size: 13px;
    vertical-align: middle;
}
.inv-table th {
    background: var(--bg-2); font-weight: 600;
    color: var(--text2); font-size: 11px; text-transform: uppercase;
}
.inv-table tr:last-child td { border-bottom: none; }
.inv-table .num { text-align: right; white-space: nowrap; }
.inv-table .num input.inv-inp { text-align: right; }
.inv-name { font-weight: 600; color: var(--text); }
.inv-sub  { font-size: 11px; color: var(--text3); margin-top: 2px; }
.inv-tag {
    display: inline-block; margin-top: 4px;
    background: var(--bg-3); color: var(--text3);
    padding: 1px 6px; border-radius: 4px;
    font-size: 10px; font-weight: 500;
}
.inv-thumb {
    width: 44px; height: 44px;
    border-radius: 6px; object-fit: cover;
    background: var(--bg-2); border: 1px solid var(--line);
    display: block;
}
.inv-thumb.ph {
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: var(--text3);
}
.inv-th-photo, .inv-td-photo { width: 56px; padding-right: 4px; }
.inv-cat {
    display: inline-block; margin-right: 4px; margin-bottom: 2px;
    background: var(--bg-3); color: var(--text2);
    padding: 1px 6px; border-radius: 4px;
    font-size: 10px;
}
.inv-th-cats, .inv-td-cats { width: 130px; }
.inv-th-bc, .inv-td-bc { width: 130px; }
.inv-bc {
    font: 500 11px 'JetBrains Mono', monospace;
    color: var(--text2);
    background: var(--bg-2); padding: 2px 6px; border-radius: 4px;
}
.inv-td-sum { font-weight: 600; }
.inv-td-actions { white-space: nowrap; text-align: right; }
.inv-td-actions .adm-btn { margin-left: 4px; }
.inv-inp {
    width: 90px; padding: 4px 8px; border-radius: 6px;
    border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
    font: 600 13px 'Inter', sans-serif;
}
.inv-inp:focus { outline: none; border-color: var(--accent); }
.inv-suffix { color: var(--text3); font-size: 11px; margin-left: 2px; }
.adm-btn.small { padding: 4px 8px; font-size: 12px; height: 26px; min-width: 26px; }
.adm-btn.red { background: var(--red, #dc3545); color: #fff; }

@media (max-width: 1100px) {
    .inv-th-cats, .inv-td-cats { display: none; }
    .inv-th-bc, .inv-td-bc { display: none; }
}
@media (max-width: 700px) {
    .inv-table th:nth-child(7),
    .inv-table td:nth-child(7) { display: none; }   /* sum column off mobile */
    .inv-inp { width: 70px; }
    .inv-thumb { width: 36px; height: 36px; }
}

/* Sortable column headers */
.inv-table th.inv-sort {
    cursor: pointer; user-select: none;
    transition: background .12s, color .12s;
}
.inv-table th.inv-sort:hover { background: var(--bg-3); color: var(--text); }
.inv-table th.inv-sort.on { color: var(--accent); }
.inv-sort-arrow {
    display: inline-block; margin-left: 4px;
    font-size: 9px; color: var(--accent);
    width: 10px; text-align: center;
}

/* Categories checkbox grid (Edit + New modals) */
.inv-cats-grid {
    display: flex; flex-wrap: wrap; gap: 6px 12px;
    padding: 8px 10px; background: var(--bg-2); border-radius: 6px;
    border: 1px solid var(--line);
}
.inv-cat-check {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; cursor: pointer; user-select: none;
    color: var(--text);
}
.inv-cat-check input { margin: 0; cursor: pointer; }

/* History modal table */
.inv-hist-table {
    width: 100%; border-collapse: collapse; margin-top: 8px;
}
.inv-hist-table th, .inv-hist-table td {
    padding: 6px 8px; text-align: left;
    border-bottom: 1px solid var(--line); font-size: 12px;
}
.inv-hist-table th {
    background: var(--bg-2); font-weight: 600;
    color: var(--text2); font-size: 10px; text-transform: uppercase;
    position: sticky; top: 0; z-index: 1;
}
.inv-hist-table .num { text-align: right; white-space: nowrap; }
.inv-hist-dt { font: 500 11px 'JetBrains Mono', monospace; color: var(--text2); white-space: nowrap; }
.inv-hist-qty { font-weight: 700; }
.inv-hist-qty.pos { color: var(--green, #16a34a); }
.inv-hist-qty.neg { color: var(--red, #dc3545); }
.inv-hist-ord {
    background: var(--bg-3); color: var(--accent);
    padding: 1px 6px; border-radius: 4px;
    font: 600 10px 'JetBrains Mono', monospace;
}

/* ===== SCAN VIDEOS — packing-archive player + per-order block =====
   Block lives inside .adm-ord-card (Покупець). Empty when no video. */
.adm-ord-videos { margin-top: 10px; }
.adm-ord-videos:empty { display: none; }
.adm-ord-videos-status {
    font: 11px var(--f-sans); color: var(--text2);
    padding: 4px 0;
}
.adm-ord-videos-status.sv-err { color: var(--red, #dc3545); }

.sv-block-head {
    font: 600 11px var(--f-sans);
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 6px 0 4px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
}
.sv-rows { display: flex; flex-direction: column; gap: 4px; }
.sv-row {
    display: flex; justify-content: space-between; align-items: center;
    gap: 10px; padding: 4px 0; flex-wrap: wrap;
}
.sv-row-meta {
    font: 500 11px 'JetBrains Mono', monospace;
    color: var(--text2);
}
.sv-row-cams { display: flex; gap: 6px; flex-wrap: wrap; }
.sv-cam-pair {
    display: inline-flex; align-items: stretch;
    border: 1px solid var(--line); border-radius: 4px;
    overflow: hidden;
}
.sv-cam-link {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 3px 8px;
    background: var(--bg-2);
    font: 600 11px var(--f-sans);
    color: var(--accent);
    text-decoration: none;
    transition: background .12s;
}
.sv-cam-link:hover { background: var(--bg-3); }
.sv-share-link {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 3px 6px;
    background: var(--bg-2);
    border-left: 1px solid var(--line);
    font-size: 11px;
    color: var(--text2);
    text-decoration: none;
    transition: background .12s, color .12s;
}
.sv-share-link:hover { background: var(--bg-3); color: var(--accent); }
.sv-partial { color: var(--orange, #d97706); font-weight: 600; }

/* ----- Modal overlay ----- */
.sv-overlay {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, .82);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.sv-modal {
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
    min-width: 480px;
}
.sv-head {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
}
.sv-title { font: 600 13px var(--f-sans); color: var(--text); }
.sv-close {
    background: transparent; border: 1px solid var(--line);
    color: var(--text2); cursor: pointer;
    width: 28px; height: 28px; border-radius: 4px;
    font-size: 14px;
}
.sv-close:hover { border-color: var(--red); color: var(--red); }
.sv-body { padding: 0; background: #000; display: flex; }
.sv-video {
    width: min(80vw, 1280px);
    max-height: 75vh;
    display: block;
    background: #000;
}
