/* ===== Admin Dashboard Styles ===== */
:root {
    --bg-primary: #f7f7f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-solid: #ffffff;
    --text-primary: #14161a;
    --text-secondary: #4a4d52;
    --text-muted: #8a8e99;
    --accent-primary: #8B6914;
    --accent-light: #a67c1e;
    --accent-dark: #6e520f;
    --accent-glow: rgba(139, 105, 20, 0.08);
    --border-subtle: rgba(20, 22, 26, 0.08);
    --border-strong: rgba(20, 22, 26, 0.15);
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --info: #2563eb;
    --status-new: #2563eb;
    --status-confirmed: #8B6914;
    --status-shipped: #9333ea;
    --status-delivered: #16a34a;
    --status-cancelled: #dc2626;
    --transition: 0.2s ease;
    --font-arabic: 'Tajawal', sans-serif;
    --font-display: 'Tajawal', sans-serif;
    --bottom-nav-h: 64px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-arabic);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

body::before,
body::after {
    content: '';
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    pointer-events: none;
    z-index: -1;
    opacity: 0.3;
}

body::before {
    width: 400px;
    height: 400px;
    background: var(--accent-dark);
    top: -100px;
    right: -150px;
}

body::after {
    width: 350px;
    height: 350px;
    background: #2a3a5a;
    bottom: -100px;
    left: -100px;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
}

/* ===== Auth screen ===== */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-screen[hidden] {
    display: none;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border: 1px solid rgba(20, 22, 26, 0.1);
    border-radius: 20px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.auth-logo {
    height: 64px;
    width: auto;
    margin-bottom: 16px;
    filter: brightness(0);
}

.auth-title {
    font-family: var(--font-arabic);
    font-size: 1.75rem;
    font-weight: 800;
    color: #14161a;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 28px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: right;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-field span {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.auth-field input {
    background: #f8f9fa;
    border: 1px solid rgba(20, 22, 26, 0.15);
    border-radius: 10px;
    padding: 12px 14px;
    color: #14161a;
    transition: border-color var(--transition), background var(--transition);
}

.auth-field input:focus {
    outline: none;
    border-color: #14161a;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

.auth-error {
    color: var(--danger);
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.auth-info {
    color: var(--success);
    background: rgba(22, 163, 74, 0.08);
    border: 1px solid rgba(22, 163, 74, 0.2);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.9rem;
}

.auth-btn {
    background: #14161a;
    color: #ffffff;
    font-weight: 700;
    padding: 14px;
    border-radius: 10px;
    margin-top: 8px;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
    font-size: 1rem;
}

.auth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #2c2f33;
    box-shadow: 0 10px 24px rgba(20, 22, 26, 0.2);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.auth-link {
    color: #8B6914;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 4px 6px;
    transition: color var(--transition);
}

.auth-link:hover {
    color: #14161a;
}

.auth-sep {
    color: var(--text-muted);
}

/* ===== Admin layout ===== */
.admin-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(20, 22, 26, 0.08);
}

.admin-header-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.admin-logo {
    height: 36px;
    width: auto;
    flex-shrink: 0;
    filter: brightness(0);
}

.admin-brand-title {
    display: block;
    font-weight: 800;
    color: #14161a;
    font-size: 1.05rem;
}

.admin-brand-email {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.admin-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.admin-icon-btn:hover {
    background: rgba(20, 22, 26, 0.06);
    color: #14161a;
}

.admin-main {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 16px calc(var(--bottom-nav-h) + 32px);
}

.admin-section {
    animation: fade-in 0.3s ease;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 16px;
    gap: 10px 12px;
}

.section-head h2 {
    font-family: var(--font-arabic);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-head h2 i {
    color: var(--accent-primary);
}

.btn-refresh {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(20, 22, 26, 0.12);
    color: var(--text-secondary);
    transition: var(--transition);
}

.btn-refresh:hover {
    background: rgba(139, 105, 20, 0.08);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-refresh.spinning i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-primary {
    background: #14161a;
    color: #ffffff;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 10px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #2c2f33;
    box-shadow: 0 6px 18px rgba(20, 22, 26, 0.2);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.btn-secondary {
    background: #f1f2f4;
    border: 1px solid rgba(20, 22, 26, 0.12);
    color: #14161a;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-secondary:hover {
    background: #e4e5e7;
    border-color: rgba(20, 22, 26, 0.2);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: var(--danger);
    padding: 10px 16px;
    border-radius: 10px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-danger:hover {
    background: #dc2626;
    color: #ffffff;
}

/* ===== Filter chips ===== */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 4px;
}

.chip {
    flex-shrink: 0;
    padding: 7px 14px;
    background: #f1f2f4;
    border: 1px solid rgba(20, 22, 26, 0.12);
    border-radius: 999px;
    color: #4a4d52;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chip:hover {
    border-color: #14161a;
    color: #14161a;
    background: #e4e5e7;
}

.chip.active {
    background: #14161a;
    border-color: #14161a;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(20, 22, 26, 0.15);
}

.chip-count {
    background: rgba(20, 22, 26, 0.08);
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
}

.chip.active .chip-count {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.search-box {
    position: relative;
    margin-bottom: 14px;
}

.search-box i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-box input {
    width: 100%;
    padding: 11px 40px 11px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}

.search-box input:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.06);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.toggle-cancelled {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.toggle-cancelled input {
    accent-color: var(--accent-primary);
}

/* ===== List ===== */
.list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#products-list,
#orders-list {
    max-height: calc(100vh - var(--bottom-nav-h) - 260px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-inline-end: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.18) transparent;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
#products-list::-webkit-scrollbar,
#orders-list::-webkit-scrollbar { width: 8px; }
#products-list::-webkit-scrollbar-track,
#orders-list::-webkit-scrollbar-track { background: transparent; }
#products-list::-webkit-scrollbar-thumb,
#orders-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
}
#products-list::-webkit-scrollbar-thumb:hover,
#orders-list::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }

.list-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 0.95rem;
}

.list-error {
    text-align: center;
    color: var(--danger);
    background: rgba(231, 107, 107, 0.08);
    border: 1px solid rgba(231, 107, 107, 0.25);
    border-radius: 12px;
    padding: 16px;
    font-size: 0.9rem;
}

/* ===== Order row ===== */
.order-row {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.order-row:hover {
    border-color: var(--accent-primary);
    background: rgba(201, 164, 94, 0.04);
}

.order-row .o-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.order-row .o-total {
    color: var(--accent-primary);
    font-weight: 700;
    text-align: end;
    white-space: nowrap;
}

.order-row .o-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.order-row .o-status {
    grid-column: 2;
    grid-row: 2;
    text-align: end;
}

/* ===== Status badges ===== */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid currentColor;
}

.status-badge.s-new { color: var(--status-new); background: rgba(93, 159, 220, 0.1); }
.status-badge.s-confirmed { color: var(--status-confirmed); background: rgba(201, 164, 94, 0.1); }
.status-badge.s-shipped { color: var(--status-shipped); background: rgba(176, 125, 220, 0.1); }
.status-badge.s-delivered { color: var(--status-delivered); background: rgba(78, 196, 138, 0.1); }
.status-badge.s-cancelled { color: var(--status-cancelled); background: rgba(231, 107, 107, 0.1); }

.order-row.is-cancelled {
    opacity: 0.6;
}

.order-row.is-cancelled .o-name {
    text-decoration: line-through;
}

/* ===== Code row ===== */
.code-row {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 6px 12px;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.code-row:hover {
    border-color: var(--accent-primary);
}

.code-row .c-code {
    font-family: monospace;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 1px;
}

.code-row .c-value {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.code-row .c-meta {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.code-row.is-inactive {
    opacity: 0.55;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    transition: var(--transition);
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch.on {
    background: var(--accent-primary);
}

.toggle-switch.on::after {
    inset-inline-start: calc(100% - 21px);
}

/* ===== Product row ===== */
.product-row {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 12px;
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 12px;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.product-row:hover {
    border-color: var(--accent-primary);
}

.product-row img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    padding: 4px;
}

.product-row .p-name {
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-row .p-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}

.product-row .p-price {
    color: var(--accent-primary);
    font-weight: 700;
    white-space: nowrap;
}

.product-row.is-unavailable {
    opacity: 0.55;
}

.product-row.is-unavailable .p-name {
    text-decoration: line-through;
}

/* ===== Bottom nav ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(20, 22, 26, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    z-index: 60;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav::-webkit-scrollbar {
    display: none;
}

.bottom-nav .tab {
    flex: 1 0 auto;
    min-width: 54px;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: #8a8e99;
    font-size: 0.74rem;
    font-weight: 500;
    transition: color var(--transition), background var(--transition);
    position: relative;
    padding: 0 6px;
}

.bottom-nav .tab i {
    font-size: 1.15rem;
    transition: transform var(--transition);
}

.bottom-nav .tab:hover {
    color: #14161a;
    background: rgba(20, 22, 26, 0.02);
}

.bottom-nav .tab.active {
    color: #14161a;
    font-weight: 700;
}

.bottom-nav .tab.active i {
    transform: translateY(-1px);
}

.bottom-nav .tab.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: #14161a;
    border-radius: 0 0 4px 4px;
}

.tab-badge {
    position: absolute;
    top: 8px;
    inset-inline-end: calc(50% - 22px);
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

/* ===== Drawer ===== */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 80;
    animation: fade-in 0.2s ease;
}

.drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: 100%;
    max-width: 540px;
    background: var(--bg-card-solid);
    border-inline-end: 1px solid var(--border-subtle);
    z-index: 90;
    display: flex;
    flex-direction: column;
    animation: slide-in 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

.drawer[hidden],
.drawer-overlay[hidden] {
    display: none;
}

/* ===== Modal overlay (shared) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    animation: fade-in 0.18s ease;
}

.modal-overlay[hidden] { display: none; }

/* ===== Price edit modal ===== */
.price-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100vw - 32px));
    background: var(--bg-card-solid);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    z-index: 101;
    display: flex;
    flex-direction: column;
    gap: 0;
    animation: modal-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.price-modal[hidden] { display: none; }

@keyframes modal-pop {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.price-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.price-modal-head h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.price-modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.price-modal-info {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin: 0;
}

.price-mode-tabs {
    display: flex;
    gap: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 4px;
}

.price-tab {
    flex: 1;
    padding: 7px 12px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.price-tab.active {
    background: var(--accent-primary);
    color: #0a0a10;
    font-weight: 600;
}

.percent-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.percent-row select {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 10px 12px;
}

.percent-row input {
    width: 90px;
}

.percent-symbol {
    font-size: 0.9rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.niche-note {
    color: var(--accent-primary) !important;
    font-size: 0.82rem !important;
    margin: 0;
}

.price-modal-foot {
    display: flex;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border-subtle);
}

.price-modal-foot .btn-secondary,
.price-modal-foot .btn-primary {
    flex: 1;
    justify-content: center;
}

@keyframes slide-in {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

[dir="rtl"] .drawer {
    animation-name: slide-in-rtl;
}

@keyframes slide-in-rtl {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.drawer-head {
    flex-shrink: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.drawer-head h3 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--accent-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Drawer content */
.detail-block {
    margin-bottom: 22px;
}

.detail-block h4 {
    color: var(--accent-primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    gap: 12px;
    flex-wrap: wrap;
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row .label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-row .value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: end;
    word-break: break-word;
}

.detail-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 40px 1fr auto;
    gap: 10px;
    align-items: center;
}

.detail-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

.detail-item .di-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.detail-item .di-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.detail-item .di-price {
    color: var(--accent-primary);
    font-weight: 700;
    white-space: nowrap;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.status-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.status-actions button {
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.status-actions button:hover:not(:disabled):not(.is-current) {
    border-color: var(--accent-primary);
    background: rgba(201, 164, 94, 0.08);
}

.status-actions button.is-current {
    background: rgba(201, 164, 94, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-light);
    cursor: default;
}

.status-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.status-actions button.cancel-action {
    color: var(--danger);
    border-color: rgba(231, 107, 107, 0.3);
}

.status-actions button.cancel-action:hover:not(:disabled):not(.is-current) {
    background: rgba(231, 107, 107, 0.1);
    border-color: var(--danger);
}

/* Form (used in code/product editor) */
.form-grid {
    display: grid;
    gap: 14px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-field input,
.form-field select,
.form-field textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--text-primary);
    transition: border-color var(--transition);
    width: 100%;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.form-field .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    cursor: pointer;
}

.form-toggle .ft-label {
    color: var(--text-primary);
    font-weight: 500;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.form-actions > * {
    flex: 1;
}

/* ===== Selection mode & bulk bar ===== */
.head-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-secondary.is-active {
    background: var(--accent-primary);
    color: #08080c;
    border-color: var(--accent-primary);
}

.row-checkbox {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-inline-end: 10px;
    color: #08080c;
    transition: all 0.15s ease;
}

.row-checkbox.is-checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.row-checkbox.is-checked::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
}

body.is-selecting .order-row,
body.is-selecting .product-row {
    cursor: pointer;
    user-select: none;
}

body.is-selecting-orders .order-row {
    grid-template-columns: auto 1fr auto;
}

body.is-selecting-orders .order-row .row-checkbox {
    grid-row: 1 / span 2;
    align-self: center;
    margin-inline-end: 0;
}

body.is-selecting-products .product-row {
    grid-template-columns: auto 56px 1fr auto;
}

body.is-selecting-products .product-row .row-checkbox {
    margin-inline-end: 0;
}

/* Sort/drag mode */
body.is-sorting-products .product-row {
    grid-template-columns: auto 56px 1fr auto;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

body.is-sorting-products .product-row * {
    user-select: none;
    -webkit-user-select: none;
}

body.is-sorting-products .product-row:active {
    cursor: grabbing;
}

.row-handle {
    width: 28px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    font-size: 1.1rem;
    cursor: grab;
    touch-action: none;
}

.row-handle:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.4;
    background: rgba(212, 175, 55, 0.2) !important;
}

.sortable-chosen {
    background: rgba(212, 175, 55, 0.15) !important;
    border-color: var(--accent-primary) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.sort-hint {
    background: rgba(212, 175, 55, 0.08);
    border: 1px solid rgba(212, 175, 55, 0.3);
    color: var(--accent-primary);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-row.is-selected,
.product-row.is-selected {
    background: rgba(212, 175, 55, 0.12);
    border-color: var(--accent-primary);
}

body.has-bulk-bar {
    padding-bottom: 80px;
}

body.has-bulk-bar .bottom-nav {
    display: none;
}

.bulk-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card-solid);
    border-top: 1px solid var(--accent-primary);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
    animation: bulk-bar-in 0.2s ease;
}

.bulk-bar[hidden] {
    display: none;
}

@keyframes bulk-bar-in {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.bulk-info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.bulk-cancel {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bulk-link {
    background: transparent;
    border: none;
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    margin-inline-start: auto;
    padding: 4px 8px;
}

.bulk-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-actions button {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.bulk-actions button:hover:not(:disabled) {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--accent-primary);
}

.bulk-actions button.is-danger {
    color: var(--danger);
    border-color: rgba(220, 53, 69, 0.3);
}

.bulk-actions button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== Design tab ===== */
.design-grid {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* ===== Design sub-tabs ===== */
.design-tabs {
    display: flex;
    gap: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 5px;
    overflow-x: auto;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.design-tabs::-webkit-scrollbar { display: none; }

.design-tab {
    flex: 1;
    min-width: max-content;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}

.design-tab i { font-size: 0.92rem; }

.design-tab:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.design-tab.active {
    background: var(--accent-primary);
    color: #0a0a10;
    font-weight: 700;
}

.design-tab-count {
    background: rgba(0,0,0,0.18);
    color: inherit;
    font-size: 0.72rem;
    padding: 1px 7px;
    border-radius: 999px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.design-tab:not(.active) .design-tab-count {
    background: rgba(255,255,255,0.08);
}

.design-tab-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: fade-in 0.18s ease;
}

/* ===== Collapsible slide / reel cards ===== */
.slide-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    background-color: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.slide-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reel-thumb {
    width: 42px;
    height: 56px;
}

.slide-head-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.slide-head-text .slide-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.slide-summary {
    font-size: 0.78rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slide-expand-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.slide-expand-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.slide-card.is-collapsed .slide-card-head {
    margin-bottom: 0;
    cursor: pointer;
}

.slide-card.is-collapsed .slide-card-body {
    display: none;
}

.slide-card.is-expanded .slide-card-body {
    margin-top: 12px;
    animation: fade-in 0.18s ease;
}

.design-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.design-section-head h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.design-section-head h3 i { color: var(--accent-primary); }

.slides-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.slide-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 14px;
    transition: var(--transition);
}

.slide-card.is-disabled { opacity: 0.55; }

.slide-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.slide-drag {
    color: var(--accent-primary);
    cursor: grab;
    padding: 6px 4px;
    font-size: 1.1rem;
    touch-action: none;
}

.slide-drag:active { cursor: grabbing; }

.slide-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    flex: 1;
}

.slide-card .design-image-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04) center/cover no-repeat;
    border: 1px solid var(--border-subtle);
    margin-bottom: 12px;
    overflow: hidden;
    position: relative;
}

.design-image-preview .overlay-tint {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.5);
    pointer-events: none;
}

.slide-fields {
    display: grid;
    gap: 10px;
}

.slide-fields .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.slide-card .form-field input,
.slide-card .form-field textarea {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 9px 11px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    width: 100%;
}

.slide-card .form-field textarea {
    resize: vertical;
    min-height: 60px;
}

.slide-card .form-field label {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 4px;
    font-weight: 600;
}

.slide-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-subtle);
}

.slide-card-actions > * { flex: 1; min-width: 110px; }

.add-slide-btn {
    width: 100%;
    background: rgba(212,175,55,0.06);
    border: 1px dashed rgba(212,175,55,0.4);
    color: var(--accent-primary);
    padding: 14px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
}

.add-slide-btn:hover {
    background: rgba(212,175,55,0.12);
    border-color: var(--accent-primary);
}

.overlay-slider {
    width: 100%;
    accent-color: var(--accent-primary);
}

.image-tips {
    background: rgba(212, 175, 55, 0.06);
    border: 1px solid rgba(212, 175, 55, 0.18);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 0.82rem;
    color: var(--text-secondary, #c9c9d4);
}

.image-tips-title {
    color: var(--accent-primary);
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.image-tips ul {
    margin: 0;
    padding-inline-start: 18px;
    line-height: 1.7;
}

.image-tips strong {
    color: var(--text-primary);
    font-weight: 600;
}

.ann-preview-wrap {
    margin-top: 14px;
}

.ann-preview-label {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    display: block;
    margin-bottom: 6px;
}

.ann-preview {
    background: linear-gradient(90deg, #d4af37, #f0d676, #d4af37);
    color: #08080c;
    padding: 9px 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.3px;
}

.header-strip-preview {
    background: linear-gradient(135deg, #f8f8f8 0%, #ffffff 50%, #f0f0f0 100%);
    color: #2c2f33;
    padding: 8px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    font-weight: 500;
}

.header-strip-preview i {
    color: #c9a45e;
    margin-inline-end: 4px;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 16px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card-solid);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    padding: 12px 18px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 100;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
    animation: toast-in 0.25s ease;
    max-width: calc(100vw - 32px);
}

.toast.is-success { border-color: var(--success); }
.toast.is-error { border-color: var(--danger); color: var(--danger); }

@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
    .admin-main {
        padding-bottom: 40px;
    }
    .bottom-nav {
        position: sticky;
        bottom: 0;
        max-width: 900px;
        margin: 0 auto;
        border-radius: 16px 16px 0 0;
        overflow: hidden;
    }
}

.image-upload {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
}

.image-upload img {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    align-self: center;
}

.image-upload-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.image-pick-btn {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.musk-variant-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.musk-variant-opt {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}
.musk-variant-opt:hover { border-color: rgba(255,255,255,0.28); background: rgba(255,255,255,0.06); }
.musk-variant-opt input[type="radio"] { display: none; }
.musk-variant-opt .mv-title { font-weight: 700; color: var(--text-primary, #fff); }
.musk-variant-opt .mv-meta { font-size: 0.82rem; color: var(--text-muted, #888); }
.musk-variant-opt.is-selected {
    border-color: var(--accent-primary, #bfc5cc);
    background: rgba(191,197,204,0.12);
    box-shadow: 0 0 0 2px var(--accent-primary, #bfc5cc) inset;
}
.musk-variant-opt.is-selected .mv-meta { color: var(--text-secondary, #cfd2d6); }

.fixed-price-hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(191,197,204,0.08);
    border: 1px solid rgba(191,197,204,0.20);
    border-radius: 10px;
    color: var(--text-secondary, #cfd2d6);
    font-size: 0.9rem;
}
.fixed-price-hint i { color: var(--accent-primary, #bfc5cc); }

.image-specs-panel {
    margin-top: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-secondary, #cfd2d6);
    font-size: 0.88rem;
    line-height: 1.7;
    animation: fade-in 0.2s ease;
}
.image-specs-panel[hidden] { display: none; }
.image-specs-panel .specs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    color: var(--text-primary, #fff);
}
.image-specs-panel .specs-head strong {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}
.image-specs-panel .specs-close {
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
}
.image-specs-panel .specs-close:hover { color: var(--text-primary, #fff); background: rgba(255,255,255,0.06); }
.image-specs-panel .specs-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.image-specs-panel .specs-list li {
    padding: 3px 0;
    border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.image-specs-panel .specs-list li:last-child { border-bottom: none; }
.image-specs-panel .specs-list strong { color: var(--text-primary, #fff); margin-inline-end: 6px; }

/* ===== Analytics ===== */
.analytics-range {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.analytics-range .chip {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.analytics-range .chip.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-light));
    color: #1a1208;
    border-color: transparent;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(12px);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.analytics-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.analytics-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(201, 164, 94, 0.08), transparent 60%);
    pointer-events: none;
}

.analytics-card .ac-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--accent-light);
    background: rgba(201, 164, 94, 0.12);
    flex-shrink: 0;
    z-index: 1;
}

.analytics-card.a-orders .ac-icon { color: var(--info); background: rgba(93, 159, 220, 0.12); }
.analytics-card.a-revenue .ac-icon { color: var(--success); background: rgba(78, 196, 138, 0.12); }
.analytics-card.a-conversion .ac-icon { color: var(--warning); background: rgba(224, 164, 69, 0.12); }
.analytics-card.a-aov .ac-icon { color: #b07ddc; background: rgba(176, 125, 220, 0.12); }
.analytics-card.a-products .ac-icon { color: var(--accent-primary); }

.analytics-card .ac-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    z-index: 1;
}

.analytics-card .ac-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

.analytics-card .ac-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-family: var(--font-arabic);
    letter-spacing: -0.01em;
    direction: ltr;
    unicode-bidi: plaintext;
}

.analytics-card .ac-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.analytics-block {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    backdrop-filter: blur(12px);
}

.analytics-block .block-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 8px;
}

.analytics-block .block-head h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-block .block-head h3 i {
    color: var(--accent-primary);
}

.analytics-block .block-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.analytics-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.analytics-two-col .analytics-block {
    margin-bottom: 0;
}

@media (max-width: 720px) {
    .analytics-two-col {
        grid-template-columns: 1fr;
    }
}

/* Bar chart */
.chart-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
    scrollbar-color: rgba(20, 22, 26, 0.2) transparent;
    -webkit-overflow-scrolling: touch;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    height: 190px;
    min-width: 520px;
    padding-bottom: 26px;
    padding-top: 20px;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
    min-width: 28px;
    cursor: default;
}

.bar-col .bar-val {
    font-size: 0.72rem;
    color: #14161a;
    font-weight: 700;
    height: 14px;
}

.bar-col .bar-track {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f2f4;
}

.bar-col .bar-fill {
    width: 100%;
    background: linear-gradient(180deg, #8B6914, #6e520f);
    border-radius: 6px 6px 0 0;
    transition: height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bar-col.is-today .bar-fill {
    background: linear-gradient(180deg, #22c55e, #15803d);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.35);
}

.bar-col .bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 600;
    transform: none;
    height: 16px;
}

/* Top products */
.top-products {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.top-product-row {
    display: grid;
    grid-template-columns: 26px 44px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid rgba(20, 22, 26, 0.08);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
}

.top-product-row:hover {
    border-color: rgba(20, 22, 26, 0.18);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.tp-rank {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #14161a;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.78rem;
}

.tp-img {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    background: #f4f4f5;
    border: 1px solid rgba(20, 22, 26, 0.06);
}

.tp-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tp-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #14161a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tp-bar {
    width: 100%;
    height: 6px;
    background: #f1f2f4;
    border-radius: 999px;
    overflow: hidden;
}

.tp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B6914, #a67c1e);
    border-radius: 999px;
    transition: width 0.6s ease;
}

.tp-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.tp-qty {
    font-weight: 800;
    color: #14161a;
    font-size: 0.95rem;
}

.tp-rev {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

/* Status bars */
.status-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-bar-row {
    display: grid;
    grid-template-columns: 100px 1fr 80px;
    gap: 10px;
    align-items: center;
    font-size: 0.85rem;
}

.sb-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 600;
}

.sb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.sb-dot.s-new { background: var(--status-new); }
.sb-dot.s-confirmed { background: var(--status-confirmed); }
.sb-dot.s-shipped { background: var(--status-shipped); }
.sb-dot.s-delivered { background: var(--status-delivered); }
.sb-dot.s-cancelled { background: var(--status-cancelled); }

.sb-track {
    height: 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
    overflow: hidden;
}

.sb-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.sb-fill.s-new { background: var(--status-new); }
.sb-fill.s-confirmed { background: var(--status-confirmed); }
.sb-fill.s-shipped { background: var(--status-shipped); }
.sb-fill.s-delivered { background: var(--status-delivered); }
.sb-fill.s-cancelled { background: var(--status-cancelled); }

.sb-val {
    text-align: end;
    font-weight: 700;
    color: var(--text-primary);
}

.sb-val small {
    color: var(--text-muted);
    font-weight: 500;
}

/* Referrer / Governorates list */
.referrer-list,
.govs-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ref-row {
    display: grid;
    grid-template-columns: 100px 1fr 40px;
    gap: 10px;
    align-items: center;
    font-size: 0.85rem;
}

.ref-name {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ref-track {
    height: 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

.ref-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--info), #7cb8e8);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.ref-fill.is-gov {
    background: linear-gradient(90deg, var(--accent-dark), var(--accent-light));
}

.ref-val {
    text-align: end;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-refresh.spinning i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Customers ===== */
.customers-list { display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.customers-loading, .customers-empty {
    padding: 36px 16px; text-align: center; color: var(--text-muted);
    background: var(--bg-card-solid); border-radius: 12px; border: 1px solid var(--border-subtle);
}
.customer-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 14px 16px; background: var(--bg-card-solid);
    border: 1px solid var(--border-subtle); border-radius: 12px;
}
.customer-main { flex: 1; min-width: 0; }
.customer-name { color: var(--text-primary); font-weight: 700; font-size: 1rem; margin-bottom: 3px; }
.customer-email { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 6px; word-break: break-all; }
.customer-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-muted); }
.customer-meta i { margin-inline-end: 4px; }
.customer-stats { display: flex; gap: 10px; flex-shrink: 0; }
.customer-stat {
    display: flex; flex-direction: column; align-items: center;
    min-width: 56px; padding: 8px 4px; background: var(--bg-primary);
    border-radius: 8px; border: 1px solid var(--border-subtle);
}
.customer-stat .cs-value { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.customer-stat .cs-label { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.customer-stat.points .cs-value { color: var(--accent-primary); }
@media (max-width: 600px) {
    .customer-row { flex-direction: column; align-items: stretch; }
    .customer-stats { justify-content: space-between; }
    .customer-stat { flex: 1; }
}
.customer-stat.clickable {
    cursor: pointer;
    font-family: inherit;
}
.customer-stat.clickable:hover {
    border-color: var(--accent-primary);
    background: var(--bg-card);
}

/* ===== Mobile Responsive Button & Header Layout ===== */
@media (max-width: 640px) {
    .section-head {
        margin-bottom: 12px;
        gap: 8px 10px;
    }

    .section-head h2 {
        font-size: 1.25rem;
    }

    .head-actions {
        gap: 6px;
        flex-wrap: wrap;
    }

    .head-actions .btn-sm {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 8px;
        white-space: nowrap;
    }

    .filter-chips {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        width: 100%;
        max-width: 100%;
        padding: 4px 4px 8px;
        margin-bottom: 12px;
        scrollbar-width: thin;
        scrollbar-color: rgba(20, 22, 26, 0.2) transparent;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .filter-chips::-webkit-scrollbar {
        height: 4px;
    }

    .filter-chips::-webkit-scrollbar-thumb {
        background: rgba(20, 22, 26, 0.2);
        border-radius: 999px;
    }

    .chip {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 6px 14px;
        font-size: 0.82rem;
        scroll-snap-align: start;
    }
}

/* ===== Bundle Admin Card & Form ===== */
.bundle-admin-card {
    background: #ffffff;
    border: 1px solid rgba(20, 22, 26, 0.1);
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.02);
    width: 100%;
    overflow: hidden;
}

.bundle-admin-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #14161a;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.bundle-admin-card h3 i {
    color: #8B6914;
}

.bundle-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.bch-info h3 {
    margin-bottom: 4px;
}

.bch-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .bundle-admin-card {
        padding: 16px 14px;
    }

    .bundle-card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .bundle-card-header .head-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
    }

    .bundle-card-header .head-actions button {
        flex: 1;
        justify-content: center;
    }
}

.bundle-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-field label {
    font-size: 0.88rem;
    font-weight: 700;
    color: #14161a;
}

.form-field input[type="number"],
.form-field input[type="url"],
.form-field input[type="text"] {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(20, 22, 26, 0.15);
    background: #ffffff;
    color: #14161a;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-field input:focus {
    outline: none;
    border-color: #14161a;
    box-shadow: 0 0 0 3px rgba(20, 22, 26, 0.08);
}

.field-hint {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.bundle-preview-box {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 18px;
    background: #f8f9fa;
    border: 1px solid rgba(20, 22, 26, 0.08);
    border-radius: 12px;
}

.bpb-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bpb-label {
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.bpb-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: #14161a;
}

.bpb-highlight {
    color: #8B6914;
    font-size: 1.15rem;
    font-weight: 800;
}

.bpb-badge {
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
    font-weight: 700;
    font-size: 0.82rem;
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.image-upload-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.image-upload-row input[type="url"] {
    flex: 1;
}

.upload-btn {
    flex-shrink: 0;
    height: 42px;
    cursor: pointer;
}

.bundle-img-preview {
    margin-top: 8px;
    max-height: 120px;
    border-radius: 10px;
    overflow: hidden;
    background: #f4f4f5;
    border: 1px solid rgba(20, 22, 26, 0.08);
    display: none;
}

.bundle-img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Bundle Mode & Perfumes Selector ===== */
.bundle-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bundle-mode-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: #f8f9fa;
    border: 1px solid rgba(20, 22, 26, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bundle-mode-option:hover {
    border-color: #14161a;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.bundle-mode-option input[type="radio"] {
    margin-top: 3px;
    accent-color: #14161a;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.bmo-content strong {
    display: block;
    font-size: 0.95rem;
    color: #14161a;
    margin-bottom: 2px;
}

.bmo-content span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.bundle-perfumes-list {
    max-height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    padding-top: 10px;
    padding-inline-end: 4px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 768px) {
    .bundle-perfumes-list {
        grid-template-columns: 1fr;
        width: 100%;
    }
}

.b-perfume-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid rgba(20, 22, 26, 0.1);
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.b-perfume-card.is-active-bundle {
    border-color: rgba(22, 163, 74, 0.4);
    background: rgba(22, 163, 74, 0.03);
}

.b-perfume-card.is-excluded-bundle {
    border-color: rgba(220, 38, 38, 0.25);
    background: rgba(220, 38, 38, 0.02);
    opacity: 0.7;
}

.b-perfume-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.b-perfume-info img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: cover;
    background: #f4f4f5;
    flex-shrink: 0;
}

.b-perfume-details {
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.b-perfume-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: #14161a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.b-perfume-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
