:root {
    --bg: #f0fdf4;
    --card-bg: #ffffff;
    --text: #0f172a;
    --text-muted: #475569;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --border: #bbf7d0;
    --radius: 12px;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    color: var(--text);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.view-section {
    display: none;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
}

.view-section.active {
    display: block;
}

/* ==================== AUTH / LOGIN SCREEN ==================== */
.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    background:
        radial-gradient(circle at 20% 25%, rgba(20, 184, 166, 0.45) 0%, transparent 55%),
        radial-gradient(circle at 80% 75%, rgba(2, 132, 199, 0.40) 0%, transparent 55%),
        linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

@media (max-height: 900px) and (orientation: portrait) {
    .auth-wrapper {
        align-items: flex-start;
        padding-top: 12vh;
    }
}

@media (max-height: 700px) {
    .auth-wrapper {
        align-items: center;
        padding: 12px;
    }
}

.auth-card {
    background: var(--card-bg);
    padding: 36px 28px 30px;
    border-radius: 16px;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-sizing: border-box;
    box-shadow: 0 24px 60px rgba(0,0,0,0.35), 0 4px 12px rgba(0,0,0,0.12);
}

@media (max-height: 700px) {
    .auth-card { padding: 22px 20px; }
}

@media (max-width: 360px) {
    .auth-card { padding: 24px 18px; }
}

/* Brand */
.brand-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--accent);
    text-align: left;
    letter-spacing: 0.5px;
}

/* Big highlighted "W" in WISE DECISION */
.brand-title .big-w {
    display: inline-block;
    font-size: 32px;
    font-weight: 900;
    line-height: 1;
    vertical-align: -3px;
    margin-right: 1px;
    background: linear-gradient(135deg, #14b8a6 0%, #0284c7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #0d9488;
}

.auth-card .brand-title {
    margin: 0 0 8px 0;
    line-height: 1.1;
    font-size: 24px;
    letter-spacing: 0.8px;
    text-align: center;
}
.auth-card .brand-title .big-w {
    font-size: 34px;
    vertical-align: -4px;
}

@media (max-height: 700px) {
    .auth-card .brand-title { font-size: 19px; }
    .auth-card .brand-title .big-w { font-size: 28px; }
}

@media (max-width: 360px) {
    .auth-card .brand-title { font-size: 20px; }
    .auth-card .brand-title .big-w { font-size: 30px; vertical-align: -3px; }
}

.subtitle {
    font-size: 12px;
    color: var(--text-muted);
    text-align: left;
    margin-bottom: 15px;
}

.auth-card .subtitle {
    text-align: center;
    font-size: 13px;
    margin: 0 0 28px 0;
    color: #64748b;
    font-weight: 500;
}

@media (max-height: 700px) {
    .auth-card .subtitle { margin-bottom: 18px; }
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: var(--text);
    box-sizing: border-box;
    font-size: 13px;
    font-family: inherit;
}

.auth-card .form-group {
    margin-bottom: 14px;
}

.auth-card .form-group label {
    font-weight: 700;
    color: #334155;
    font-size: 13px;
    margin-bottom: 6px;
}

.auth-card .form-group input {
    padding: 13px 14px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-card .form-group input::placeholder {
    color: #94a3b8;
    opacity: 1;
}

.auth-card .form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    background: #ffffff;
}

.form-group textarea {
    resize: vertical;
}

/* ==================== BUTTONS ==================== */
.menu-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 8px;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.menu-btn:hover {
    transform: translateY(-1px);
    filter: brightness(0.97);
}

.auth-card .menu-btn {
    margin-bottom: 12px;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    padding: 13px 14px;
    border-radius: 10px;
}

.auth-card .btn-action-primary {
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.28);
    margin-top: 6px;
}

.auth-card .btn-secondary {
    background: #eef2f7;
    color: #334155;
    border: 1px solid #cbd5e1;
    box-shadow: none;
}
.auth-card .btn-secondary:hover {
    background: #e2e8f0;
    color: #0f172a;
    filter: none;
}

.btn-dash {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
}

.btn-pos {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    border-left: 4px solid #22c55e;
}

.btn-inv {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
}

.btn-acc {
    background: #fdf4ff;
    color: #a21caf;
    border: 1px solid #f5d0fe;
    border-left: 4px solid #d946ef;
}

.btn-rep {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
}

.btn-staff {
    background: #ecfeff;
    color: #0e7490;
    border: 1px solid #a5f3fc;
    border-left: 4px solid #06b6d4;
}

.btn-cust {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
    border-left: 4px solid #8b5cf6;
}

.btn-branch {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
    border-left: 4px solid #f97316;
}

.btn-exp {
    background: #fefce8;
    color: #a16207;
    border: 1px solid #fef08a;
    border-left: 4px solid #eab308;
}

.btn-supplier {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    border-left: 4px solid #2563eb;
}

.btn-transfer {
    background: #f0fdfa;
    color: #0f766e;
    border: 1px solid #99f6e4;
    border-left: 4px solid #14b8a6;
}

.btn-sec {
    background: #f8fafc;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #64748b;
}

.btn-action-primary {
    background: linear-gradient(135deg, #14b8a6 0%, #0284c7 100%);
    color: #fff;
    border: none;
    text-align: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(20, 184, 166, 0.25);
}

.btn-action-primary:hover {
    background: linear-gradient(135deg, #0d9488 0%, #0369a1 100%);
    color: #fff;
}

.btn-logout {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-left: 4px solid #dc2626;
    justify-content: center;
}

.btn-logout:hover {
    background: #fecaca;
    color: #b91c1c;
}

.btn-secondary {
    background: #f1f5f9;
    color: #0284c7;
    border: 1px solid #cbd5e1;
    justify-content: center;
    font-weight: 600;
}

.btn-secondary:hover {
    background: #e2e8f0;
    color: #0369a1;
    filter: none;
}

.btn-complete-sale {
    width: 100%;
    background-color: #16a34a;
    color: white;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
}

.btn-complete-sale:hover {
    background-color: #15803d;
    transform: translateY(-1px);
}

.btn-complete-sale:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* ==================== DASHBOARD LAYOUT ==================== */
.dashboard-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    box-sizing: border-box;
}

/* ---------- Sidebar (vertical, original layout on all screen sizes) ---------- */
.sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-right: 2px solid #e2e8f0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    box-shadow: 4px 0 15px rgba(0,0,0,0.03);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.main-content-area {
    padding: 25px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    box-sizing: border-box;
    width: 100%;
}

/* ---------- DESKTOP ---------- */
@media (min-width: 768px) {
    .dashboard-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .sidebar {
        width: 260px;
        flex-shrink: 0;
        position: sticky;
        top: 0;
        max-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .main-content-area {
        flex: 1;
        min-width: 0;
        min-height: 100vh;
    }
}

/* ==================== TABLES ==================== */
table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text);
    margin-top: 10px;
}

th,
td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
}

th {
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 700;
}

/* ==================== POS GRID ==================== */
.pos-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .pos-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ==================== MISC PANELS ==================== */
.alert-card-box {
    background: #fff;
    border-radius: var(--radius);
    padding: 15px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    margin-top: 20px;
}

.alert-badge-red {
    background: #fee2e2;
    color: #991b1b;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 10px;
    display: inline-block;
}

.alert-badge-orange {
    background: #ffedd5;
    color: #9a3412;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 10px;
    display: inline-block;
}

/* ==================== SETTINGS CARDS ==================== */
.security-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 20px;
    margin-top: 0;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

.security-card h3 {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.security-card p {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 15px;
}

@media (max-width: 767px) {
    .security-card {
        padding: 16px;
    }
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
        padding: 11px 12px;
    }
}

.btn-primary {
    background-color: #0f172a;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    width: 100%;
    font-weight: 600;
    cursor: pointer;
    margin-top: 5px;
}

.btn-primary:hover {
    background-color: #1e293b;
}

.form-message {
    margin-top: 10px;
    font-size: 0.85rem;
    text-align: center;
}

.form-message.success { color: #16a34a; }
.form-message.error   { color: #dc2626; }

#dynamic-accept-print-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #94a3b8 !important;
}

#split-modal > div {
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ==================== PRINT ==================== */
@media print {
    html,
    body {
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
    }

    body * {
        visibility: hidden !important;
    }

    #printable-receipt-box,
    #printable-debt-receipt-box,
    #printable-refund-receipt-box,
    #printable-waybill-box,
    #printable-receipt-box *,
    #printable-debt-receipt-box *,
    #printable-refund-receipt-box *,
    #printable-waybill-box * {
        visibility: visible !important;
    }

    .view-section,
    .view-section.active,
    #split-modal,
    #split-modal > div,
    #refund-modal,
    #refund-modal > div,
    #pending-order-details-modal,
    #pending-order-details-modal > div {
        display: block !important;
        visibility: visible !important;
    }

    #printable-receipt-box,
    #printable-debt-receipt-box,
    #printable-refund-receipt-box,
    #printable-waybill-box {
        display: block !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 76mm !important;
        max-width: 76mm !important;
        margin: 0 !important;
        padding: 2mm !important;
        border: none !important;
        background: #fff !important;
        color: #000 !important;
        font-size: 12px !important;
        box-sizing: border-box !important;
    }

    #printable-receipt-box table,
    #printable-debt-receipt-box table,
    #printable-refund-receipt-box table,
    #printable-waybill-box table {
        display: table !important;
        width: 100% !important;
        table-layout: fixed !important;
    }

    #printable-receipt-box tr,
    #printable-debt-receipt-box tr,
    #printable-refund-receipt-box tr,
    #printable-waybill-box tr {
        display: table-row !important;
        width: 100% !important;
    }

    #printable-receipt-box th,
    #printable-receipt-box td,
    #printable-debt-receipt-box th,
    #printable-debt-receipt-box td,
    #printable-refund-receipt-box th,
    #printable-refund-receipt-box td,
    #printable-waybill-box th,
    #printable-waybill-box td {
        display: table-cell !important;
        padding: 2px !important;
        font-size: 11px !important;
        word-break: break-word !important;
        visibility: visible !important;
    }

    #printable-receipt-box div,
    #printable-debt-receipt-box div,
    #printable-refund-receipt-box div,
    #printable-waybill-box div {
        display: block !important;
        width: 100% !important;
        visibility: visible !important;
    }

    @page {
        size: 80mm auto;
        margin: 0;
    }
}

iframe,
div[class*="mimo"],
div[id*="mimo"] {
    pointer-events: none !important;
}

/* ==================== ACCOUNTANT TAB TOGGLE ==================== */
.accountant-tab-btn {
    width: auto;
    margin: 0;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: bold;
    background: #e2e8f0;
    color: #1e293b;
    border: none;
    box-shadow: none;
}

.accountant-tab-btn:hover {
    transform: none;
    filter: brightness(0.96);
}

.accountant-tab-btn.active {
    background: linear-gradient(135deg, #14b8a6 0%, #0284c7 100%);
    color: #fff;
}

/* ==================== PENDING ORDER DETAILS MODAL ==================== */
#pending-order-details-modal table th {
    text-align: left;
}

#pending-order-details-modal #pending-details-total {
    color: var(--accent);
}

/* ==================== REFUND MODAL ==================== */
#refund-modal > div {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#refund-confirm-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #94a3b8 !important;
}

/* ==================== LOGIN CARD REFRESH ==================== */
.auth-card {
    background: #ffffff;
    border: none;
    border-top: 5px solid #14b8a6;
    border-radius: 22px;
    max-width: 400px;
    padding: 40px 32px 30px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}

.auth-card .brand-title {
    font-size: 26px;
    color: #0284c7;
    letter-spacing: 0;
    white-space: nowrap;
}
.auth-card .brand-title .big-w {
    font-size: 44px;
    line-height: 1;
    letter-spacing: 0;
    margin-right: 0;
    vertical-align: -5px;
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    color: inherit;
}

.auth-card .subtitle {
    color: #64748b;
    margin-bottom: 30px;
}

.auth-card .form-group label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #475569;
}

.auth-card .form-group input {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
}
.auth-card .form-group input:focus {
    border-color: #14b8a6;
    box-shadow: 0 0 0 4px rgba(20,184,166,0.15);
}

.auth-card .btn-action-primary {
    margin-top: 10px;
    padding: 15px;
    border-radius: 12px;
    font-size: 15px;
}

.auth-card .btn-secondary {
    background: transparent;
    color: #0d9488;
    border: 2px solid #99f6e4;
    border-radius: 12px;
}
.auth-card .btn-secondary:hover {
    background: #f0fdfa;
    color: #0f766e;
}

/* ==================== SUPER ADMIN DASHBOARD THEME ==================== */
/* Page: soft light background so the dashboard feels clean and readable */
#super-admin-view > div {
    background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%) !important;
    color: #0f172a !important;
}

/* Top header bar: deep navy with a teal accent line */
#super-admin-view > div > div:first-child {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%) !important;
    border: none !important;
    border-bottom: 4px solid #14b8a6 !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}
#super-admin-view > div > div:first-child h2 { color: #ffffff !important; }
#super-admin-view > div > div:first-child p  { color: #99f6e4 !important; }

/* Main card */
#super-admin-view > div > div:nth-child(2) {
    border: 1px solid #e2e8f0;
    border-radius: 14px !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08) !important;
}
#super-admin-view > div > div:nth-child(2) h3 { color: #0f172a !important; }

/* Table header and rows */
#super-admin-view thead tr {
    background: #e0f2fe !important;
    border-bottom: 2px solid #14b8a6 !important;
    color: #0369a1 !important;
}
#super-admin-view tbody tr:hover { background: #f0fdfa; }
#super-admin-view td { border-bottom: 1px solid #e2e8f0; }

/* ==================== LOGIN SCREEN BACKGROUND PICTURE ==================== */
/* Put your picture in the same folder as index.html and name it login-bg.jpg */
.auth-wrapper {
    background:
        linear-gradient(rgba(15, 23, 42, 0.45), rgba(15, 23, 42, 0.6)),
        url("login-bg.jpg") center / cover no-repeat fixed !important;
}

/* ==================== SUBSCRIPTION SIDEBAR BUTTON (payments-patch v4) ==================== */
/* Stable class for the Subscription sidebar button.
   No transitions, no hover animation — prevents any visual "pop" or flicker
   when the button is re-inserted after the sidebar is rebuilt by other patches. */
.menu-btn.btn-subscription {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #64748b;
    color: #334155;
    font-weight: 700;
    transition: none !important;
    animation: none !important;
}

.menu-btn.btn-subscription:hover {
    transform: none !important;
    filter: none !important;
    background: #f1f5f9;
    color: #0f172a;
}

/* =====================================================================
   PHONE VENDOR DASHBOARD — added by phone-vendor-patch.js
   These styles do not affect any existing classes.
   ===================================================================== */

/* Sidebar button for phone sales */
.btn-phone {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%) !important;
    color: #ffffff !important;
    font-weight: 600;
    border: none;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-phone:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.38);
}

.btn-phone:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(124, 58, 237, 0.28);
}

/* Table cells for phone list — cleaner monospace IMEI display */
#wdv-table-body td {
    vertical-align: middle;
    font-size: 13px;
}

/* IMEI column: clickable to copy */
#wdv-table-body td:first-child {
    transition: color 0.15s ease;
}
#wdv-table-body td:first-child:hover {
    color: #7c3aed;
}

/* Status chip polish (used in the table) */
#wdv-table-body span[style*="border-radius:10px"] {
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* The phone inventory toolbar */
#wdv-search:focus,
#wdv-filter-brand:focus,
#wdv-filter-status:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Summary cards — give them a slight hover lift */
#wdv-summary-cards > div {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
#wdv-summary-cards > div:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

/* The phone modal wrapper — smoother appearance */
#wdv-modal > div {
    animation: wdvModalIn 0.18s ease-out;
}

@keyframes wdvModalIn {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal input focus states */
#wdv-modal input:focus,
#wdv-modal select:focus,
#wdv-modal textarea:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Registration store-type selector — matches the rest of the auth card */
#reg-store-type-selector label {
    letter-spacing: 0.3px;
}
#reg-store-type-selector select:focus,
#reg-store-type-selector input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* Phone table row hover for better readability */
#wdv-table-body tr:hover {
    background: #faf5ff;
}

/* Delete button (Del) in the phone table */
#wdv-table-body .menu-btn[onclick*="wdvDeletePhone"] {
    transition: background 0.15s ease;
}
#wdv-table-body .menu-btn[onclick*="wdvDeletePhone"]:hover {
    background: #fee2e2;
    border-color: #fca5a5;
}

/* Edit button in the phone table */
#wdv-table-body .menu-btn[onclick*="wdvEditPhone"]:hover {
    background: #ede9fe;
    border-color: #c4b5fd;
}

/* ==================== MOBILE LOADING SPINNER ==================== */
#wd-loading-overlay {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

#wd-loading-overlay.wd-active {
    opacity: 1;
    pointer-events: auto;
}

.wd-spinner {
    width: 45px;
    height: 45px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #14b8a6;
    border-radius: 50%;
    animation: wd-spin 0.8s linear infinite;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

@keyframes wd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Inventory table: headings stay put while scrolling ===== */
div:has(> table > #inventory-table-head) {
    overflow: auto !important;          /* scrolls both ways, so the header can stick */
    max-height: 70vh;
    max-height: calc(100dvh - 170px);
    -webkit-overflow-scrolling: touch;
}
div:has(> table > #inventory-table-head) > table { margin-top: 0; }
#inventory-table-head th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #e0f2fe;
    box-shadow: 0 1px 0 #bae6fd;
}
