/* ==========================================================================
   APP.CSS — single stylesheet for the whole project
   --------------------------------------------------------------------------
   1.  Tokens          6.  Forms             11. Orders
   2.  Base            7.  Tables/DataTables 12. Product form
   3.  App shell       8.  Badges/empty      13. Cropper modal
   4.  Page/panels     9.  Dashboard         14. Auth
   5.  Buttons         10. Shop              15. Utilities/responsive
   ========================================================================== */

/* ---------- 1. TOKENS ---------- */
:root {
    --c-bg: #f4f5f7;
    --c-surface: #ffffff;
    --c-surface-2: #f7f8fa;
    --c-border: #dcdfe4;
    --c-text: #1f2933;
    --c-muted: #6b7380;

    --c-primary: #1d4f91;
    --c-primary-dark: #163d70;
    --c-primary-soft: #e8eef7;

    --c-success: #1e7a3c;
    --c-success-soft: #e6f2ea;
    --c-danger: #b3261e;
    --c-danger-soft: #f8e7e6;
    --c-warning: #8a5a00;
    --c-warning-soft: #fbf0d9;
    --c-info: #1d5f8a;
    --c-info-soft: #e5f0f7;

    --c-sidebar: #1c2733;
    --c-sidebar-hover: #263443;
    --c-sidebar-text: #b7c0cb;

    --radius: 6px;
    --radius-sm: 4px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 2px 8px rgba(15, 23, 42, .08);
    --shadow-lg: 0 8px 24px rgba(15, 23, 42, .16);

    --sidebar-w: 240px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 56px;

    --bs-primary: var(--c-primary);
    --bs-primary-rgb: 29, 79, 145;
    --bs-body-font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --bs-body-color: var(--c-text);
    --bs-border-color: var(--c-border);
    --bs-border-radius: var(--radius-sm);
}

/* ---------- 2. BASE ---------- */
body {
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--bs-body-font-family);
    font-size: .9rem;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-dark); text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
.text-muted { color: var(--c-muted) !important; }

/* ---------- 3. APP SHELL ---------- */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--c-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width .2s ease, transform .2s ease;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--topbar-h);
    padding: 0 20px;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.sidebar-brand .brand-mark { flex: 0 0 24px; text-align: center; font-size: 1.1rem; }

.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0 16px; }
.sidebar-nav::-webkit-scrollbar { width: 0; }

.nav-section {
    color: #7b8794;
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 16px 20px 6px;
    white-space: nowrap;
}
.nav-link-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    color: var(--c-sidebar-text);
    white-space: nowrap;
    border-left: 3px solid transparent;
}
.nav-link-item:hover { background: var(--c-sidebar-hover); color: #fff; text-decoration: none; }
.nav-link-item i { flex: 0 0 18px; text-align: center; font-size: .95rem; }
.nav-link-item.active { background: var(--c-sidebar-hover); color: #fff; border-left-color: #5b9bd5; font-weight: 600; }
.nav-link-item .nav-count {
    margin-left: auto;
    background: #5b9bd5;
    color: #0f1b27;
    font-size: .68rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 1px 7px;
}
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .08); padding: 8px 0; }
.sidebar-footer .nav-link-item { width: 100%; background: none; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; }

.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
.sidebar-collapsed .app-sidebar .nav-text,
.sidebar-collapsed .app-sidebar .nav-section,
.sidebar-collapsed .app-sidebar .nav-count,
.sidebar-collapsed .app-sidebar .brand-text { display: none; }
.sidebar-collapsed .app-sidebar .sidebar-brand { padding: 0 20px; }
.sidebar-collapsed .app-sidebar .nav-link-item { padding: 10px 20px; }
.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s ease; }

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}
.topbar-title { font-size: 1rem; font-weight: 600; margin: 0; }

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
    display: inline-grid;
    place-items: center;
    position: relative;
}
.icon-btn:hover { background: var(--c-surface-2); color: var(--c-text); text-decoration: none; }
.icon-btn .count {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--c-danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 10px 3px 3px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-sm);
    background: var(--c-surface);
    color: var(--c-text);
}
.user-chip:hover { background: var(--c-surface-2); }
.avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: #dfe4ea;
    color: #3b4654;
    font-weight: 600;
    font-size: .8rem;
    display: grid;
    place-items: center;
    text-transform: uppercase;
}
.user-chip .user-meta { line-height: 1.15; text-align: left; }
.user-chip .user-name { font-weight: 600; font-size: .8rem; }
.user-chip .user-role { font-size: .7rem; color: var(--c-muted); text-transform: capitalize; }

.app-content { flex: 1; padding: 24px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 1035; }

/* ---------- 4. PAGE HEADER / PANELS / ALERTS ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.page-head h1, .page-head h2 { font-size: 1.25rem; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--c-muted); font-size: .85rem; }

.panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); }
.panel-body { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--c-border); background: var(--c-surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.panel-head h5, .panel-head h6 { margin: 0; font-size: .9rem; }
.panel-section-title { font-size: .95rem; font-weight: 600; padding-bottom: 8px; margin: 0 0 16px; border-bottom: 1px solid var(--c-border); }

.alert { border-radius: var(--radius-sm); border: 1px solid transparent; font-size: .88rem; }
.alert-success { background: var(--c-success-soft); color: #14532d; border-color: #c5e0cf; }
.alert-danger { background: var(--c-danger-soft); color: #7a1a15; border-color: #ebc5c3; }
.alert-warning { background: var(--c-warning-soft); color: #6b4700; border-color: #ecd9ae; }

/* ---------- 5. BUTTONS ---------- */
.btn {
    --bs-btn-border-radius: var(--radius-sm);
    --bs-btn-padding-x: .9rem;
    --bs-btn-padding-y: .42rem;
    --bs-btn-font-weight: 500;
    --bs-btn-font-size: .86rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:hover { text-decoration: none; }
.btn-sm { --bs-btn-padding-x: .65rem; --bs-btn-padding-y: .3rem; --bs-btn-font-size: .8rem; }

.btn-primary {
    --bs-btn-bg: var(--c-primary);
    --bs-btn-border-color: var(--c-primary);
    --bs-btn-hover-bg: var(--c-primary-dark);
    --bs-btn-hover-border-color: var(--c-primary-dark);
    --bs-btn-active-bg: var(--c-primary-dark);
    --bs-btn-active-border-color: var(--c-primary-dark);
    --bs-btn-disabled-bg: var(--c-primary);
    --bs-btn-disabled-border-color: var(--c-primary);
}
.btn-danger { --bs-btn-bg: var(--c-danger); --bs-btn-border-color: var(--c-danger); --bs-btn-hover-bg: #8f1d17; --bs-btn-hover-border-color: #8f1d17; }
.btn-light, .btn-secondary {
    --bs-btn-bg: var(--c-surface);
    --bs-btn-color: var(--c-text);
    --bs-btn-border-color: var(--c-border);
    --bs-btn-hover-bg: var(--c-surface-2);
    --bs-btn-hover-color: var(--c-text);
    --bs-btn-hover-border-color: #c3c8cf;
    --bs-btn-active-bg: var(--c-surface-2);
    --bs-btn-active-color: var(--c-text);
}
.btn-outline-primary { --bs-btn-color: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary); --bs-btn-hover-border-color: var(--c-primary); }
.btn-outline-secondary { --bs-btn-color: var(--c-text); --bs-btn-border-color: var(--c-border); --bs-btn-hover-bg: var(--c-surface-2); --bs-btn-hover-color: var(--c-text); --bs-btn-hover-border-color: #c3c8cf; --bs-btn-active-bg: var(--c-primary-soft); --bs-btn-active-color: var(--c-primary); --bs-btn-active-border-color: var(--c-primary); }

/* compact row-action buttons */
.btn-soft { border: 1px solid var(--c-border); background: var(--c-surface); font-size: .78rem; font-weight: 500; padding: .25rem .6rem; border-radius: var(--radius-sm); }
.btn-soft-primary, .btn-soft-info { color: var(--c-primary); }
.btn-soft-primary:hover, .btn-soft-info:hover { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }
.btn-soft-warning { color: var(--c-warning); }
.btn-soft-warning:hover { background: var(--c-warning-soft); border-color: var(--c-warning); color: var(--c-warning); }
.btn-soft-success { color: var(--c-success); }
.btn-soft-success:hover { background: var(--c-success-soft); border-color: var(--c-success); color: var(--c-success); }
.btn-soft-danger { color: var(--c-danger); }
.btn-soft-danger:hover { background: var(--c-danger-soft); border-color: var(--c-danger); color: var(--c-danger); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 6. FORMS ---------- */
.form-label { font-weight: 600; font-size: .82rem; color: #374151; margin-bottom: 4px; }
.form-label .req { color: var(--c-danger); margin-left: 2px; }
.form-control, .form-select {
    border: 1px solid #c8ccd2;
    border-radius: var(--radius-sm);
    padding: .45rem .7rem;
    font-size: .88rem;
    color: var(--c-text);
    background-color: var(--c-surface);
}
.form-control::placeholder { color: #9aa1ab; }
.form-control:focus, .form-select:focus { border-color: var(--c-primary); box-shadow: 0 0 0 2px rgba(29, 79, 145, .15); }
.form-control-sm, .form-select-sm { padding: .3rem .55rem; font-size: .84rem; }
.form-select { padding-right: 2.25rem; background-position: right .65rem center; background-size: 14px 10px; }
.form-select-sm { padding-right: 2rem; }
div.dataTables_wrapper .dataTables_length select { width: auto; min-width: 72px; display: inline-block; }
.form-control-color { padding: .2rem; height: 31px; width: 100%; }
textarea.form-control { resize: vertical; }
.form-text { color: var(--c-muted); font-size: .76rem; }
.form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }

.form-narrow { max-width: 620px; }
.form-medium { max-width: 820px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--c-border); }

.password-field { position: relative; }
.password-field .form-control { padding-right: 2.5rem; }
.password-field .toggle-eye { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--c-muted); background: none; border: 0; padding: 0; }
.password-field .toggle-eye:hover { color: var(--c-text); }

.image-input { border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 12px; background: var(--c-surface-2); }
.image-input .image-preview { width: 72px; height: 72px; border-radius: var(--radius-sm); object-fit: cover; background: #fff; border: 1px solid var(--c-border); }
.image-input .image-preview-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
[data-crop-slot] img[data-crop-preview] { display: none; }
[data-crop-slot].has-image img[data-crop-preview] { display: block; }
[data-crop-slot].has-image img[data-current] { display: none; }

.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--c-border); background: var(--c-surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filter-bar .filter-item { min-width: 140px; flex: 1 1 140px; max-width: 220px; }
.filter-bar .filter-item.grow { flex: 2 1 220px; max-width: 340px; }
.filter-bar label { font-size: .72rem; font-weight: 600; color: var(--c-muted); margin-bottom: 3px; display: block; }
.filter-item-auto { flex: 0 0 auto !important; min-width: 0 !important; }
.filter-bar-flat { border-bottom: 0; border-radius: var(--radius); }

/* ---------- 7. TABLES + DATATABLES ---------- */
.table-modern { margin: 0; --bs-table-bg: transparent; }
.table-modern thead th {
    background: var(--c-surface-2);
    color: #4b5563;
    font-size: .76rem;
    font-weight: 600;
    border-bottom: 1px solid var(--c-border);
    padding: 10px 14px;
    white-space: nowrap;
}
.table-modern tbody td { padding: 10px 14px; vertical-align: middle; border-bottom: 1px solid #ebedf0; }
.table-modern tbody tr:last-child td { border-bottom: 0; }
.table-modern tbody tr:hover td { background: #f9fafb; }

.table-img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--c-border); background: #fff; }
.table-img-empty { display: inline-grid; place-items: center; color: #b4bac3; }

div.dataTables_wrapper .dt-top, div.dataTables_wrapper .dt-bottom { padding: 12px 20px; }
div.dataTables_wrapper .dt-bottom { border-top: 1px solid var(--c-border); }
div.dataTables_wrapper .dataTables_length label, div.dataTables_wrapper .dataTables_filter label { font-size: .82rem; color: var(--c-muted); margin: 0; }
div.dataTables_wrapper .dataTables_filter input { margin-left: .4rem; min-width: 220px; }
div.dataTables_wrapper .dataTables_length select { margin: 0 .4rem; }
div.dataTables_wrapper .dataTables_info { font-size: .82rem; color: var(--c-muted); padding: 0; }
div.dataTables_wrapper .dataTables_processing { background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 500; color: var(--c-text); }
table.dataTable { border-collapse: collapse !important; margin: 0 !important; width: 100% !important; }
table.dataTable thead th, table.dataTable thead td { border-bottom: 1px solid var(--c-border) !important; }
.pagination { margin: 0; gap: 2px; }
.page-link { border-radius: var(--radius-sm) !important; border: 1px solid var(--c-border); color: var(--c-text); font-size: .82rem; padding: .3rem .65rem; }
.page-link:hover { background: var(--c-surface-2); color: var(--c-text); }
.page-item.active .page-link { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.page-item.disabled .page-link { color: #aab0b9; }

/* ---------- 8. BADGES / EMPTY ---------- */
.badge-soft { display: inline-block; padding: .2rem .55rem; border-radius: var(--radius-sm); font-size: .74rem; font-weight: 600; line-height: 1.3; border: 1px solid transparent; }
.badge-soft-success { background: var(--c-success-soft); color: var(--c-success); border-color: #c5e0cf; }
.badge-soft-danger { background: var(--c-danger-soft); color: var(--c-danger); border-color: #ebc5c3; }
.badge-soft-warning { background: var(--c-warning-soft); color: var(--c-warning); border-color: #ecd9ae; }
.badge-soft-info { background: var(--c-info-soft); color: var(--c-info); border-color: #c4dcea; }
.badge-soft-primary { background: var(--c-primary-soft); color: var(--c-primary); border-color: #c5d4e8; }
.badge-soft-secondary { background: #eceef1; color: #4b5563; border-color: #d9dce1; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--c-muted); }
.empty-state i { font-size: 1.8rem; color: #b4bac3; margin-bottom: 10px; display: block; }
.empty-state h4, .empty-state h5 { color: var(--c-text); }
.empty-state .text-success { color: var(--c-success) !important; }
.confirm-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; margin: 0 auto 1rem; }

/* ---------- 9. DASHBOARD ---------- */
.stat-card { display: block; height: 100%; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px 18px; color: var(--c-text); }
a.stat-card:hover { border-color: var(--c-primary); color: var(--c-text); text-decoration: none; }
.stat-card .stat-top { margin-bottom: 6px; }
.stat-card .stat-label { color: var(--c-muted); font-size: .8rem; font-weight: 600; }
.stat-card .stat-icon { display: none; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 600; line-height: 1.1; margin-bottom: 8px; }
.stat-card .stat-sub { font-size: .8rem; color: var(--c-muted); display: flex; gap: 14px; flex-wrap: wrap; }
.stat-card .stat-sub b { color: var(--c-text); font-weight: 600; }
.stat-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--c-surface-2); color: var(--c-muted); border: 1px solid var(--c-border); }
.tone-primary, .tone-success, .tone-warning, .tone-danger, .tone-info { background: var(--c-surface-2); color: var(--c-muted); }
.confirm-icon.tone-danger { background: var(--c-danger-soft); color: var(--c-danger); }

/* ---------- 10. SHOP ---------- */
.product-card { display: flex; flex-direction: column; height: 100%; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); overflow: hidden; }
.product-card:hover { border-color: #b9c0ca; }
.product-card .product-media { display: block; aspect-ratio: 1 / 1; background: var(--c-surface-2); overflow: hidden; border-bottom: 1px solid var(--c-border); }
.product-card .product-media img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #b4bac3; font-size: 2rem; background: var(--c-surface-2); }
.product-card .product-body { padding: 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-card .product-brand { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--c-muted); }
.product-card .product-title { font-weight: 600; font-size: .95rem; color: var(--c-text); line-height: 1.3; margin: 0; }
.product-card .product-desc { color: var(--c-muted); font-size: .8rem; margin: 0; }
.product-card .product-price { font-weight: 600; font-size: 1rem; color: var(--c-text); margin-top: 4px; }
.product-card .product-price small { font-weight: 400; color: var(--c-muted); font-size: .74rem; }
.product-card .product-footer { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }

.gallery-card, .detail-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); }
.gallery-card { padding: 16px; position: sticky; top: calc(var(--topbar-h) + 16px); }
.main-show-image { aspect-ratio: 1 / 1; object-fit: contain; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.show-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: var(--radius-sm); cursor: pointer; border: 2px solid transparent; opacity: .7; }
.show-thumb:hover, .show-thumb.active { opacity: 1; border-color: var(--c-primary); }
.brand-tag { font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--c-muted); }
.product-show-title { font-weight: 600; font-size: 1.4rem; line-height: 1.3; }
.pricing-box { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.selling-price { font-size: 1.6rem; font-weight: 600; }
.mrp-price { font-size: 1rem; color: #9aa1ab; text-decoration: line-through; }
.discount-badge { color: var(--c-success); font-size: .85rem; font-weight: 600; }
.stock-tag { font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.stock-tag.in-stock { background: var(--c-success-soft); color: var(--c-success); border-color: #c5e0cf; }
.stock-tag.out-of-stock { background: var(--c-danger-soft); color: var(--c-danger); border-color: #ebc5c3; }
.meta-label-sm { font-size: .78rem; color: var(--c-muted); font-weight: 600; }
.colour-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #b9c0ca; padding: 0; }
.colour-swatch.active { box-shadow: 0 0 0 2px var(--c-primary); }
.colour-dot, .colour-dot-sm { display: inline-block; border-radius: 50%; border: 1px solid #b9c0ca; vertical-align: middle; }
.colour-dot { width: 14px; height: 14px; }
.colour-dot-sm { width: 11px; height: 11px; margin-right: 4px; }
.size-pill { padding: 5px 14px; border: 1px solid #c8ccd2; border-radius: var(--radius-sm); background: #fff; font-size: .84rem; font-weight: 500; }
.size-pill:hover { border-color: var(--c-primary); color: var(--c-primary); }
.size-pill.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.size-pill.out-of-stock { opacity: .45; text-decoration: line-through; }
.variant-table-row { cursor: pointer; }
.variant-table-row.is-selected td { background: var(--c-primary-soft) !important; }

.qty-box { display: inline-flex; align-items: center; gap: 2px; border: 1px solid #c8ccd2; border-radius: var(--radius-sm); background: #fff; }
.qty-box form { margin: 0; }
.qty-btn { width: 28px; height: 28px; border: 0; background: var(--c-surface-2); font-weight: 600; line-height: 1; color: var(--c-text); }
.qty-btn:hover:not(:disabled) { background: #e3e6ea; }
.qty-btn:disabled { opacity: .4; }
.qty-box .qty-val { min-width: 30px; text-align: center; font-weight: 600; }
.cart-line-name { font-weight: 600; }
.cart-line-meta { font-size: .78rem; color: var(--c-muted); }
.summary-card { position: sticky; top: calc(var(--topbar-h) + 16px); }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; color: var(--c-muted); }
.summary-row.total { color: var(--c-text); font-size: 1.05rem; font-weight: 600; border-top: 1px solid var(--c-border); margin-top: 6px; padding-top: 12px; }

/* ---------- 11. ORDERS ---------- */
.info-item { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius-sm); padding: 10px 12px; }
.info-item .info-label { display: block; font-size: .72rem; font-weight: 600; color: var(--c-muted); margin-bottom: 2px; }
.info-item .info-value { font-weight: 500; word-break: break-word; }

/* ---------- 12. PRODUCT FORM (VARIANTS) ---------- */
.variant-block { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.variant-block .variant-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.image-slots { display: flex; flex-wrap: wrap; gap: 10px; }
.image-slot { position: relative; width: 150px; padding: 8px; background: #fff; border: 1px solid var(--c-border); border-radius: var(--radius-sm); }
.image-slot img.slot-preview { width: 100%; height: 96px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 6px; display: none; }
.image-slot.has-image img.slot-preview { display: block; }
.image-slot input[type=file] { font-size: .72rem; }
.image-slot .slot-remove { position: absolute; top: -8px; right: -8px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--c-danger); color: #fff; font-size: .75rem; line-height: 1; }
.existing-image img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--c-border); display: block; }
.existing-image label { display: flex; align-items: center; gap: 4px; font-size: .72rem; margin-top: 4px; color: var(--c-danger); }
.existing-image.is-removed img { opacity: .35; }

/* ---------- 13. CROPPER MODAL ---------- */
.modal-content { border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--c-border); }
.crop-stage { height: min(60vh, 440px); background: #1b1f24; border-radius: var(--radius-sm); overflow: hidden; }
.crop-stage img { display: block; max-width: 100%; }

/* ---------- 14. AUTH ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--c-bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.auth-brand { text-align: center; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--c-muted); margin-bottom: 18px; }
.auth-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 20px; text-align: center; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--c-muted); font-size: .78rem; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--c-border); }
.btn-google { background: #fff; border: 1px solid #c8ccd2; color: var(--c-text); }
.btn-google:hover { background: var(--c-surface-2); color: var(--c-text); }

/* ---------- 15. UTILITIES / RESPONSIVE ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.app-toast { min-width: 240px; max-width: 340px; padding: 10px 14px; border-radius: var(--radius-sm); background: #26303b; color: #fff; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; font-size: .86rem; }
.app-toast.success i { color: #7ed39a; }
.app-toast.error i { color: #f1948f; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
    .app-main, .sidebar-collapsed .app-main { margin-left: 0; }
    .sidebar-open .app-sidebar { transform: none; }
    .sidebar-open .sidebar-overlay { display: block; }
    .sidebar-collapsed .app-sidebar { width: var(--sidebar-w); }
    .sidebar-collapsed .app-sidebar .nav-text,
    .sidebar-collapsed .app-sidebar .nav-section,
    .sidebar-collapsed .app-sidebar .brand-text { display: initial; }
    .sidebar-collapsed .app-sidebar .nav-count { display: inline; }
    .app-topbar { padding: 0 14px; }
    .app-content { padding: 16px 12px; }
    .user-chip .user-meta { display: none; }
    .gallery-card, .summary-card { position: static; }
}
@media (max-width: 575.98px) {
    .panel-body { padding: 14px; }
    .filter-bar { padding: 12px 14px; }
    .filter-bar .filter-item { max-width: none; flex-basis: 100%; }
    div.dataTables_wrapper .dt-top, div.dataTables_wrapper .dt-bottom { padding: 10px 14px; }
    div.dataTables_wrapper .dataTables_filter input { min-width: 0; width: 100%; margin: 6px 0 0; }
}

/* ---------- 16. MOBILE REFINEMENTS ---------- */
.app-main { min-width: 0; }
.app-content { min-width: 0; max-width: 100%; }
.topbar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.panel, .table-responsive { max-width: 100%; }
.pagination { flex-wrap: wrap; }
body.sidebar-lock { overflow: hidden; }

@media (max-width: 991.98px) {
    .table-modern thead th, .table-modern tbody td { padding: 9px 10px; }
    .page-head .d-flex { width: 100%; }
}

@media (max-width: 767.98px) {
    /* tables scroll sideways instead of squashing text */
    .table-responsive .table-modern td, .table-responsive .table-modern th { white-space: nowrap; }
    .page-head { align-items: flex-start; }
    .page-head > .d-flex { gap: 8px; }
    .page-head > .d-flex > .btn, .page-head > .d-flex > form { flex: 1 1 auto; }
    .page-head > .d-flex > form .btn { width: 100%; }
    .gallery-card { padding: 12px; }
    .product-show-title { font-size: 1.2rem; }
    .selling-price { font-size: 1.35rem; }
    .detail-card { padding: 16px !important; }
    .variant-block { padding: 12px; }
    .image-slot { width: calc(50% - 5px); }
    .form-actions .btn { flex: 1 1 auto; }
    .summary-card { margin-bottom: 8px; }
    div.dataTables_wrapper .dt-top, div.dataTables_wrapper .dt-bottom { justify-content: center !important; text-align: center; }
    div.dataTables_wrapper .dataTables_filter, div.dataTables_wrapper .dataTables_filter label { width: 100%; }
    div.dataTables_wrapper .dataTables_filter input { width: calc(100% - 0px); margin-left: 0; margin-top: 4px; }
    .modal-dialog { margin: .5rem; }
    .crop-stage { height: 50vh; }
}

@media (max-width: 575.98px) {
    /* 16px inputs stop iOS from zooming on focus */
    .form-control, .form-select, .form-control-sm, .form-select-sm { font-size: 16px; }
    .app-topbar { gap: 8px; }
    .app-toast { min-width: 0; max-width: calc(100vw - 32px); }
    .toast-stack { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
    .auth-card { padding: 22px 18px; }
    .stat-card { padding: 14px; }
    .stat-card .stat-value { font-size: 1.5rem; }
    .table-actions .btn-soft { padding: .3rem .5rem; }
    .qty-btn { width: 32px; height: 32px; }
    .info-item { padding: 8px 10px; }
    .order-id { font-size: 1.1rem; }
    .page-head h1, .page-head h2 { font-size: 1.1rem; }
    .user-chip { padding: 3px; }
    .user-chip > i { display: none; }
}

/* status switch in listings */
.status-switch { display: flex; align-items: center; gap: 8px; margin: 0; padding-left: 0; min-height: 0; }
.status-switch .form-check-input { margin: 0; float: none; width: 2.2em; height: 1.15em; cursor: pointer; }
.status-switch-label { font-size: .78rem; font-weight: 600; }
.status-switch-label.is-on { color: var(--c-success); }
.status-switch-label.is-off { color: var(--c-danger); }
