/* public/css/style.css */
body {
    /* diagonal carbon-fiber texture */
    background: #151515;
    background-image:
        linear-gradient(135deg, rgba(255,255,255,0.04) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.04) 75%, rgba(255,255,255,0.04) 100%),
        linear-gradient(45deg, rgba(255,255,255,0.04) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.04) 75%, rgba(255,255,255,0.04) 100%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: #e0e0e0;
    font-family: Calibri, Segoe UI, Roboto, Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

/* Reduce default UL left padding (specificity: element selector) */
ul {
    padding-inline-start: 20px;
}

.header {
    flex-direction: column;
    align-items: center;
}

.currency-rates {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    font-size: 18px;
    color: #cfd8dc;
}

.currency-item {
    padding: 6px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 15px;
}
.currency-item.currency-up {
    color: #a5d6a7;
    border-color: rgba(165,214,167,0.4);
}
.currency-item.currency-down {
    color: #ef9a9a;
    border-color: rgba(239,154,154,0.4);
}
.currency-arrow {
    font-size: 0.85em;
    line-height: 1;
}

/* utility helpers */
.cap { margin-bottom: 12px; max-width: 1200px;}
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mb-16 { margin-bottom: 16px; }
.mb-12 { margin-bottom: 12px; }
.mb-8 { margin-bottom: 8px; }
.mt-10 { margin-top: 10px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 40px; }
.ml-8 { margin-left: 8px !important; }
.btn.small.ml-10 { margin-left: 10px !important; width: 80px; }
.ml-12 { margin-left: 12px; }
.btn.small.mr-12 { margin-right: 12px; width: 80px;}
.text-right { text-align: right; }
.full-width { width: 100%; }
.min-width-60 { min-width: 60px; }
.gap-8 { gap: 8px; }
.overflow-x-auto { overflow-x: auto; }
.flex-nowrap { flex-wrap: nowrap; }
.btn-dark { background: #444; }
.btn-clear { background: none; border: none; color: #f66; cursor: pointer; font-size: 14px; }
.notif-icon { position: relative; cursor: pointer; margin: 10px; margin-left: 80px; color: #ff8e3d; /* ensure bell emoji and chat share hue */ }

/* absolute logout button in header */
.header .btn[href*="logout"] {
    position: absolute;
    top: 8px;
    right: 8px;
}
/* when logout link lives inside user-menu modal, don't float it */
#userMenuModal .btn[href*="logout"] {
    position: static;
    top: auto;
    right: auto;
    margin-top: 8px; /* give a little space from previous menu item */
}

/* menu buttons should be transparent like header links */
#userMenuModal .btn {
    background: transparent;
    border: none;
    color: #fff; /* white text */
    padding: 0px 0; /* eliminate vertical padding */
    margin: 0; /* no margin between buttons */
    text-align: left;
    width: 100%;
    font-size: 20px; /* larger text */
}

/* spacing between username and toggle button */
#userMenuBtn { margin-left: 8px; position: relative; top: -3px; }
#username { font-size: 18px; } /* slightly larger username */
#userMenuModal .btn:hover {
    background: rgba(144,202,249,0.1);
}
.chat-icon { position: relative; cursor: pointer; margin: 10px; color: #ff8e3d; /* same golden hue as bell emoji */ }
.chat-icon svg, .notif-icon svg { vertical-align: middle; }
.chat-icon svg { position: relative; top: -2px; }
.notif-badge { position: absolute; top: -6px; right: -6px; background: red; color: white; border-radius: 50%; font-size: 10px; padding: 2px 5px; }
.font-bold { font-weight: bold; }
.mb-10 { margin-bottom: 10px; }
.text-error { color: #f44336; }
.max-w-300 { max-width: 300px; }
.inline-block { display: inline-block; }
.w-80 { width: 80px; }
#saleTypeOptions { display: none; }
#saleTypeOptions label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px; /* small space between text and radio */
    white-space: nowrap; /* keep the option text on one line */
}
a {
    color: #90caf9;
    text-decoration: none;
    margin-right: 8px;
}
a:hover {
    color: #64b5f6;
}
table {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
    background: #1e1e1e;
    color: #e0e0e0;
}
td,
th {
    border: 1px solid #333;
    padding: 6px 8px;
    text-align: left;
    word-wrap: break-word;
}
th {
    background: #2c2c2c;
}
h1 {
    margin-bottom: 20px;
}

/* center main page title */
h1.no-margin {
    text-align: center;
}

/* Center the specific H2 located at /html/body/div[4]/h2 */
body > div:nth-child(4) > h2,
body > div:nth-of-type(4) > h2 {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 40px;
}
.btn {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #90caf9;
    border-radius: 4px;
    background: #336e85;
    color: #fff;
    text-decoration: none;
    font-size: 14px;
}
.btn:hover {
    background: #336e85;
}

/* icon-only buttons */
.btn.icon {
    padding: 4px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* dropdown menu for user */
/* dropdown removed; modal used instead */
/* modal base style reused for confirmation; customize if needed */
.modal {
    display: none;
    /* for contextual menus we use absolute positioning, otherwise fixed for fullscreen */
    position: absolute;
    background: transparent; /* no page overlay for user menu */
    z-index: 1002;
}
#userMenuModal {
    position: fixed;
}
/* keep generic modal-content styling, but reduce padding for menu */
.modal-content {
    background: rgba(30,30,30,0.4);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px 16px;
    border-radius: 12px;
    /* flexible width so long links don’t overflow */
    width: auto;
    max-width: 280px;
    min-width: 300px;
    color: #e0e0e0;
    text-align: center !important; /* center menu items text */
}
.modal-content h2 {
    margin-top: 0;
    margin-bottom: 12px;
}
.modal-content a {
    display: block;
    margin: 1px 0 !important; /* even tighter gap */
    text-align: center !important;
    line-height: 1.1 !important;
}
.modal-content .btn { width: auto; }
.btn.icon svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}
/* preserve background hover color for icon buttons */
.btn.icon:hover {
    background: #1e88e5;
}

/* small size variant for compact controls */
.btn.radio {
    padding: 2px 6px;
    font-size: 12px;
    width: 100%;
}
.btn.quantity {
    padding: 2px 6px;
    font-size: 12px;
    margin-bottom: 5px;
    width: 20px;
}
.btn.file, .btn.send {
    padding: 2px 6px;
    font-size: 12px;
    margin-bottom: 5px;
    width: 43%;
    height: 30px;
}
.btn.small {
    padding: 2px 6px;
    font-size: 12px;
    margin-bottom: 5px;
    width: 45px;
}
.btn.issued,.btn.submitted {
    padding: 2px 6px;
    font-size: 12px;
    margin-bottom: 5px;
    margin-left: 18px;
    width: 80px;
    height: 24px;
}
.btn.icon.small {
    width: 24px;
    height: 24px;
}
.btn.icon.small svg {
    width: 16px;
    height: 16px;
}
label {
    display: block;
    margin-bottom: 8px;
}
/* box-sizing keeps padding/border inside width so elements don’t overflow */
*, *::before, *::after {
    box-sizing: border-box;
}

input {
    width: 100%;
    padding: 8px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #1e1e1e;
    color: #e0e0e0;
}
input::placeholder {
    color: #888; /* grey placeholder text */
}
input[type=number] {
    width: 120px;
}
button {
    padding: 10px 16px;
    border: none;
    border-radius: 4px;
    background: #15650000;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
}
button:hover {
    background: #1e88e5;
}

.gallery-delete-btn {
    background: rgb(186, 143, 43);
    border: 1px solid rgba(220, 50, 50, 0.3);
    color: #fff;
    width: 40%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.gallery-delete-btn:hover {
    background: rgba(220, 50, 50, 0.24);
}

form {
    max-width: 600px;
    width: 100%;
}

@media (min-width: 1024px) {
    body > form {
        margin: 0 auto;
    }
}

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 0;
    text-align: center;
}
.upload-actions .btn {
    flex: 0 0 auto;
}
.upload-inline {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: center;
    padding: 5px;
    box-sizing: border-box;
}
.upload-inline input {
    flex: 1 1 50%;
    min-width: 140px;
    max-width: calc(50% - 5px);
}
.upload-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.upload-item {
    background: rgba(30,30,30,0.32);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 12px;
}
.upload-item-name {
    font-size: 13px;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-item-status {
    margin-top: 6px;
    font-size: 12px;
    color: #b0b0b0;
}
.upload-item-error .upload-item-status {
    color: #ff8a80;
}
.upload-item progress {
    width: 100%;
    height: 10px;
    appearance: none;
    border: none;
    border-radius: 8px;
    overflow: hidden;
}
.upload-item progress::-webkit-progress-bar {
    background: rgba(255,255,255,0.07);
}
.upload-item progress::-webkit-progress-value {
    background: #3f51b5;
}
.upload-item progress::-moz-progress-bar {
    background: #3f51b5;
}

.gallery-upload {
    margin-bottom: 18px;
}

.gallery-upload .glass-block {
    background: linear-gradient(135deg, rgba(60,60,60,0.4), rgba(20,20,20,0.2));
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.14);
}

/* confirmation modal styles */
#confirmModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1010; /* ensure overlay above image viewer and other page elements */
}
#confirmModal > div {
    /* glass effect like other modals */
    background: rgba(30,30,30,0.4) !important;
    backdrop-filter: blur(12px) saturate(150%) !important;
    -webkit-backdrop-filter: blur(12px) saturate(150%) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    padding: 20px !important;
    border-radius: 12px !important;
    max-width: 300px !important;
    color: #e0e0e0 !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}
#confirmModal p { margin: 0; }

/* notification modal styles */
#notifModal, #notifModal2 {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1001; /* above normal content—matches chat.css rule */
}
#notifModal > div, #notifModal2 > div {
    /* glass effect */
    background: rgba(30,30,30,0.4);
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
#notifList, #notifList2 {
    list-style: none;
    margin: 0;
    /* align with header inside the padded container */
    padding: 0 0 0 10px;
    max-height: 300px;
    overflow: auto;
}
#notifModal > div h3,

/* cards on notifications page */
.notice-card {
    /* glass effect similar to other cards */
    background: linear-gradient(135deg, rgba(60,60,60,0.4), rgba(20,20,20,0.2));
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}


/* glassmorphism form (shared with chat.css) */
.glass-form {
    /* gradient grey glass effect */
    background: linear-gradient(135deg, rgba(60,60,60,0.4), rgba(20,20,20,0.2));
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 600px;
    align-items: center;       /* center horizontally */
    text-align: center;        /* center inline content */
}

/* reusable glass block with similar style */
.glass-block {
    background: linear-gradient(135deg, rgba(60,60,60,0.4), rgba(20,20,20,0.2));
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* spacing for form inputs inside glass-form */
.glass-form input {
    margin-bottom: 12px;
}
.glass-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: #e0e0e0;
    padding: 8px;
    font-size: 14px;
}

/* make only the message textarea transparent */
.glass-form textarea {
    background: transparent !important;
    border: none !important;
    padding: 8px;
    resize: vertical;
}

.glass-input::placeholder {
    color: #bbb;
}

/* layout helpers inside glass form */
.glass-form .flex { display: flex; align-items: center; }
.glass-form .gap-8 { gap: 8px; }

#notifModal > div h3Х{
    margin: 0;
    padding-left: 0;
}
#notifList li {
    border-bottom: 1px solid #444;
    padding: 4px 2px;
}
#notifList li small {
    display: block;
    color: #aaa;
    font-size: 12px;
    margin-top: 2px;
}

.news-feed-list {
    list-style: none;
    padding: 0;
    margin: 8px;
}

.news-feed-item {
    border-bottom: 1px solid rgba(255,255,255,0.12);
    padding: 12px 0;
}

.news-feed-item a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}

.news-feed-item a:hover {
    text-decoration: underline;
}

.news-feed-item .text-small {
    color: #aaa;
    margin-top: 6px;
    font-size: 13px;
}

.weather-block {
    width: 100%;
    box-sizing: border-box;
}
.weather-block__content {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #e0e0e0;
    text-align: center;
    font-size: 13px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.weather-block__content--wide {
    flex-direction: column;
    align-items: stretch;
}
.weather-block__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
}
.weather-block__location {
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.weather-block__temp {
    font-size: 1.4em;
}
.weather-block__emoji {
    font-size: 1.3em;
}
.weather-block__desc {
    color: #c8c8c8;
}
.weather-week {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 6px;
    margin-top: 10px;
}
.weather-day {
    padding: 8px 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    font-size: 11px;
    min-width: 100px;
}
.weather-day__name {
    color: #9fb3c8;
}
.weather-day__icon {
    font-size: 1.15em;
}
.weather-day__temps {
    font-weight: 600;
}
.weather-hourly {
    width: 100%;
    display: flex;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
}
.weather-hourly-cell {
    min-width: 59px;
    background: rgba(13 89 186 / 15%);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    display: grid;
    gap: 4px;
    font-size: 11px;
}
.weather-hourly-time {
    color: #9fb3c8;
}
.weather-hourly-icon {
    font-size: 1.1em;
}
/* Remove duplicate chat form layout rules from style.css; chat.css contains the active rules. */
.weather-hourly-pop {
    color: #a8c6ff;
}
.weather-city-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 8px;
}
.weather-block__location--toggle {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.weather-block__location--toggle:hover {
    color: #90caf9;
}
.weather-city-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    margin-top: 8px;
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 6px;
    background: rgba(20,20,20,0.96);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px;
    box-shadow: 0 10px 28px rgba(0,0,0,0.35);
    z-index: 1003;
}
.weather-city-dropdown.open {
    display: flex;
}
.weather-city-option {
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
.weather-city-option:hover,
.weather-city-option.selected {
    background: rgba(144,202,249,0.14);
    color: #90caf9;
}
.weather-city-option:focus {
    outline: 2px solid rgba(144,202,249,0.28);
    outline-offset: 2px;
}
.weather-block__source {
    color: #c8c8c8;
    font-size: 12px;
    width: 100%;
    text-align: right;
}

/* responsive layout */
@media (max-width: 600px) {
    body { padding: 10px; }
    .btn { padding: 4px 8px; font-size: 12px; }
    .weather-block {
        display: block;
        width: 100%;
        max-width: 100%;
        margin: 0 auto 12px;
    }
    .weather-block__content {
        width: 100%;
        box-sizing: border-box;
        padding: 10px 12px;
        border-radius: 10px;
        background: rgba(0 0 0 / 28%);
        border: 1px solid rgba(255,255,255,0.12);
        color: #e0e0e0;
        text-align: center;
        font-size: 17px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 12px;
    }
    .weather-block__content--wide {
        flex-direction: column;
        align-items: stretch;
    }
    .weather-block__summary {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: center;
        gap: 8px;
        font-weight: 600;
    }
    .weather-block__location {
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }
    .weather-block__temp {
        font-size: 1.4em;
    }
    .weather-block__emoji {
        font-size: 2.5em;
    }
    .weather-block__desc {
        color: #c8c8c8;
    }
    .header {
        flex-direction: column;
        align-items: stretch;
    }
    .header h1 {
        text-align: center;
        margin-bottom: 18px !important;
    }
    .header .cap {
        width: 100%;
        max-width: 100%;
        -webkit-tap-highlight-color: transparent;
    }
    .weather-block {
        width: 100%;
        max-width: 100%;
        margin: 0 auto 12px;
    }
    .weather-block__content {
        align-items: stretch;
    }
    .weather-block__summary {
        align-items: center;
    }
    .weather-week {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 3px;
        margin-top: 10px;
        padding-bottom: 4px;
        overflow-x: auto;
    }
    .weather-day {
        min-width: 0;
        padding: 5px 4px;
        background: rgba(20 212 36 / 5%);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 8px;
        display: grid;
        gap: 3px;
        font-size: 10px;
    }
    .weather-hourly {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        padding-bottom: 4px;
    }
    .weather-hourly-cell {
        min-width: 0;
        font-size: 11px;
    }
    .weather-hourly-pop {
        display: none;
    }
    .weather-hourly-icon {
        font-size: 1.4em;
    }
    .weather-hourly-temp {
        font-size: 16px;
        font-weight: 700;
    }
    .weather-city-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        margin-bottom: 8px;
        width: 100%;
    }
    .weather-city-form label {
        display: none;
    }
    .weather-city-form select {
        width: 100%;
        max-width: none;
        padding: 6px 8px;
        font-size: 12px;
    }
    .weather-day__name {
        color: #9fb3c8;
        font-size: 12px;
        line-height: 1.1;
    }
    .weather-day__icon {
        font-size: 2.85em;
    }
    .weather-day__temps {
        font-size: 22px;
        font-weight: 600;
    }
    .weather-block__desc {
        display: none;
    }
    .weather-block__source {
        text-align: left;
        font-size: 11px;
        width: 100%;
    }
    .weather-hourly .weather-hourly-cell:nth-child(n+11),
    .weather-week .weather-day:nth-child(n+8) {
        display: none;
    }
    #pushEnableBtn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
    table { font-size: 12px; }
    .col-id, .col-qty, .col-price, .col-sku, .col-brand, .col-model, .col-name {
        white-space: normal;
    }
    table, thead, tbody, tfoot, th, td, tr { display: block; }
    thead tr { position: absolute; top: -9999px; left: -9999px; }
    tr { border: 1px solid #333; margin-bottom: 5px; }
    td { border: none; border-bottom: 1px solid #333; position: relative; padding-left: 50%; }
    td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        white-space: nowrap;
        font-weight: bold;
    }
    td.col-id:before { content: "ID"; }
    td.col-brand:before { content: "Марка"; }
    td.col-model:before { content: "Модель"; }
    td.col-name:before { content: "Название"; }
    td.col-sku:before { content: "Артикул"; }
    td.col-qty:before { content: "Кол-во"; }
    td.col-price:before { content: "Цена"; }
    td:last-child:before { content: "Действия"; }
    /* statistics page column labels */
    td.col-date:before { content: "Дата"; }
    tfoot td.col-date:before { content: "Итого"; }
    td.col-revenue:before { content: "Выручка"; }
    td.col-commission:before { content: "Комиссия"; }
    td.col-wh:before { content: "Со склада"; }
    td.col-painted:before { content: "Окрашенные"; }
    td.col-expenses:before { content: "Расходы"; }
    td.col-togo:before { content: "К сдаче"; }
    td.col-salary:before { content: "ЗП"; }
    /* allow item-list fields to wrap on small devices */
    .item .field.brand-model { white-space: normal; }
}

/* specific column widths */
.col-id { width: 4ch; }
.col-name { width: auto; }
/* columns for SKU, qty, price */
.col-sku, .col-qty, .col-price { width: 12ch; white-space: nowrap; }
/* brand/model columns */
.col-brand, .col-model { width: 8ch; white-space: nowrap; }

/* statistics block layout */
.stats-list { display: flex; flex-direction: column; gap: 12px; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2px;
}
.gallery-item {
    width: 100%;
    overflow: hidden;
    border-radius: 6px;
    background: rgba(30,30,30,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
}
.gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    cursor: pointer;
}
.gallery-meta {
    padding: 5px 8px;
}
.gallery-meta p {
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
}
.gallery-delete-form {
    padding: 10px 12px 12px;
    display: flex;
    justify-content: flex-end;
}
.gallery-delete-form .gallery-delete-btn {
    background: rgba(220, 50, 50, 0.16);
    border: 1px solid rgba(220, 50, 50, 0.3);
    color: #fff;
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.gallery-delete-form .gallery-delete-btn:hover {
    background: rgba(220, 50, 50, 0.24);
}
@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .gallery-delete-form { padding: 8px 10px 10px; }
    .gallery-delete-form .gallery-delete-btn { font-size: 12px; }
}

.image-viewer-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 51%);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    z-index: 1005;
}
.image-viewer-content {
    position: relative;
    width: min(94vw, 1100px);
    max-width: 100%;
    max-height: 90vh;
}
.image-viewer-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    touch-action: pan-y;
}
.image-viewer-actions {
    margin-top: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.image-viewer-delete-form {
    display: flex;
    justify-content: center;
}
.gallery-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(61, 132, 255, 0.16);
    border: 1px solid rgba(61, 132, 255, 0.35);
}
.gallery-download-btn:hover {
    background: rgba(61, 132, 255, 0.24);
}
.image-viewer-delete-form .btn {
    background: rgba(220, 50, 50, 0.18);
    border-color: rgba(220, 50, 50, 0.4);
}
.image-viewer-delete-form .btn:hover {
    background: rgba(220, 50, 50, 0.28);
}

.gallery-pagination {
    margin-top: 16px;
    text-align: center;
}

.gallery-pagination .btn {
    min-width: 180px;
}

/* arrival summary on inventory page */
.arrival-summary { background: rgba(30,30,30,0.4); padding: 8px; border-radius: 6px; border:1px solid #444; }
.arrival-summary p { margin:2px 0; }
.stat-item, .stat-total {
    border: 1px solid rgba(255,255,255,0.1);
    padding: 8px;
    background: rgba(30,30,30,0.5);
    backdrop-filter: blur(6px);
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    color: #e0e0e0;
    font-size: 13px;
    line-height: 1.4;
}
.stat-item:hover { background: rgba(30,30,30,0.7); }
.stat-item p strong { color: #90caf9; }
.stat-total { flex: 1 1 100%; }

.stat-item {
    flex: 1 1 calc(50% - 8px);
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 4px 12px;
}
.stat-item.collapsed .stat-details { display: none; }
.stat-item p { margin: 2px 0; }
.stat-header { font-weight: bold; grid-column: 1 / -1; }
.stat-total p { margin: 2px 0; font-size: 14px; }

/* collapsible items on sold page */
.item.collapsed .field:not(.brand-model) { display: none; }
.item .brand-model { cursor: pointer; }

/* catalog tree for brand/model filters */
.catalog-tree {
    padding: 8px;
    border-radius: 10px;
    background: rgba(0 0 0 / 28%);
    border: 1px solid rgba(2 15 31 / 48%);
    -webkit-tap-highlight-color: transparent;
}
.catalog-tree__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.catalog-tree__title {
    font-weight: 700;
    color: #f0f0f0;
}
.brand-group {
    margin-bottom: 6px;
    background: rgba(1 13 29 / 48%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
}
.brand-group summary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
    list-style: none;
    appearance: none;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
}
.brand-group summary .brand-link {
    width: 100%;
    justify-content: center;
    text-align: center;
}
.brand-group summary::-webkit-details-marker {
    display: none;
}
.brand-group summary::marker {
    display: none;
}
.brand-group[open] summary {
    background: rgba(144,202,249,0.08);
}
.brand-link,
.model-item {
    color: #e0e0e0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.brand-link.active,
.brand-link.active-brand-all,
.model-item.active {
    color: #90caf9;
    font-weight: 700;
}
.brand-group .count {
    color: #aaa;
    font-size: 0.9em;
}
.model-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}
.color-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 6px;
}
.model-item,
.color-item {
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    justify-content: center;
}
.model-item:hover,
.color-item:hover {
    background: rgba(255,255,255,0.06);
}
.model-item .count,
.color-item .count {
    color: #aaa;
    font-size: 0.85em;
}
.model-item.active,
.color-item.active {
    color: #90caf9;
    font-weight: 700;
}
.catalog-tree p {
    margin: 0;
    color: #ccc;
}

/* item-list layout (block view) */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    -webkit-tap-highlight-color: transparent;
}
.item {
    /* even more transparent gradient */
    background: linear-gradient(135deg, rgba(80,80,80,0.4), rgba(40,40,40,0.1));
    background-color: rgba(50,50,50,0.2); /* lighter fallback */
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-wrap: wrap;
    color: #e0e0e0;
}
.item .field {
    display: flex;
    margin-bottom: 6px;
    flex: 1 1 100%;
}
/* make brand-model line bigger and prevent wrapping */
.item .field.brand-model {
    flex: 0 0 auto;
    white-space: nowrap;
}
/* groups that should sit at right end */
.item .field.brand-model .group.right {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
}

@media (min-width: 1024px) {
    .item .field.brand-model {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 16px;
        white-space: normal;
    }
    .item .field.brand-model .group.right:first-of-type {
        margin-left: auto;
    }
    .item .field.brand-model .group.right + .group.right {
        margin-left: 16px;
    }
    .item .field.brand-model .value.brand {
        min-width: 220px;
        max-width: 45%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .catalog-tree {
        max-width: 1200px;
        margin: 0 auto;
    }
    .item-list {
        max-width: 1200px;
        margin: 0 auto;
    }
    .mt-20 {
        margin: 40px auto 0 auto;
        width: 300px;
    }
    .gallery-grid {
        max-width: 1200px;
        margin: 0 auto;
    }
    .gallery-upload .glass-block {
        max-width: 600px;
        margin: 0 auto;
    }
    ul {
        padding-inline-start: 20px;
        max-width: 500px;
        margin: 0 auto;
    }
    .glass-block {
        max-width: 500px;
        margin: 0 auto;
        padding: 10px;
    }
}    

/* small info (sku, price) within brand-model */
.item .field.brand-model .label.small,
.item .field.brand-model .value.small {
    font-size: 0.9em;
    color: #aaa;
}
.item .field.brand-model .value.brand {
    font-weight: bold;
}

.item .field.brand-model,
.item .field.id,
.item .field.sku,
.item .field.price {
    flex: 1 1 50%;
}
/* quantity and price combined on listing */
.item .field.qty-price {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.item .field.qty-price .label,
.item .field.qty-price .value {
    white-space: nowrap;
}
/* container for quantity + buttons */
.item .field.qty-price .qty-group {
    display: flex;
    align-items: center;
}
.item .field.qty-price .qty-group a {
    margin-left: 4px;
}
/* price group can wrap or sit normally */
.item .field.qty-price .price-group {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* price and sold are combined, occupy full width and prevent internal wrapping */
.item .field.price-sold,
.sold-item .field.price-sold {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
}
.item .field.price-sold .label,
.item .field.price-sold .value,
.sold-item .field.price-sold .label,
.sold-item .field.price-sold .value {
    white-space: nowrap;
}

.sold-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sold-item {
    background: linear-gradient(135deg, rgba(80,80,80,0.4), rgba(40,40,40,0.1));
    background-color: rgba(50,50,50,0.2);
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 8px;
    color: #e0e0e0;
}

.sold-item summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    cursor: pointer;
    width: 100%;
    list-style: none;
}

.sold-item .sold-item-body {
    margin-top: 10px;
    display: block;
}

.sold-item .field {
    display: flex;
    margin-bottom: 6px;
    flex: 1 1 100%;
}

.sold-item .field .label {
    font-weight: bold;
    margin-right: 4px;
    width: 80px;
    flex-shrink: 0;
}

.sold-item .field .value {
    flex: 1;
}

/* hide labels on small screens to save space */
@media (max-width: 600px) {
    .item .field .label {
        display: none;
    }
    /* hide id field entirely on mobile, but keep sku visible */
    .item .field.id {
        display: none;
    }
    .item .field.sku {
        display: flex; /* ensure visible when label hidden */
    }
}
/* hide only the brand/model headline label on all screens */
.item .field.brand-model > .label:not(.small) {
    display: none;
}
.item .field .label {
    font-weight: bold;
    margin-right: 4px;
    width: 80px;
    flex-shrink: 0;
}
.item .field .value {
    flex: 1;
}
.item .actions {
    margin-top: 8px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap; /* keep quantity on same line even if buttons wider */
}
.item .actions .qty-group {
    display: flex;
    align-items: center;
}
.item .actions .qty-group a {
    margin-left: 4px;
}

@media (max-width: 600px) {
    /* header should stack and center on mobile */
    .header {
        flex-direction: column;
        align-items: center;
    }
    .header h1 {
        text-align: center;
        margin-bottom: 18px !important;
    }

    /* push quantity to the right of actions row */
    .item .actions {
        justify-content: space-between;
        width: 100%;
    }
    .item .actions .qty-group {
        order: 2;
    }
    .item .actions a { order: 1; }

    /* wider but slightly shorter action icons on mobile */
    .btn.icon.small {
        width: 50px;
        height: 18px;
        margin: 0 2px; /* less space between icons */
    }
    .btn.icon.small svg {
        width: 14px;
        height: 14px;
    }
}
