﻿ï»¿Ã¯Â»Â¿ÃÂ¯ÃÂ»ÃÂ¿/* ============================================
   Endcap Audit System - Styles v2
   Professional White/Blue + Dark Mode
   Native app-like mobile experience
   ============================================ */

/* ---- CSS Variables ---- */
:root,
[data-theme="light"] {
    --bg-body: #f0faf0;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f0faf0;
    --bg-sidebar: #3d3d3d;
    --bg-sidebar-hover: #4d4d4d;
    --bg-input: #ffffff;
    --border: #d4e8d4;
    --border-focus: #1a9e2c;

    --text-primary: #155720;
    --text-secondary: #5a7040;
    --text-muted: #7a9a70;
    --text-sidebar: #c8c8c8;
    --text-sidebar-active: #ffffff;
    --text-on-primary: #1a2a15;

    --primary: #FFBC00;
    --primary-hover: #e6a800;
    --primary-light: #fff3cc;
    --success: #1a9e2c;
    --success-light: #c8f0ca;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --info: #0891b2;
    --info-light: #cffafe;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --sidebar-width: 260px;
    --topbar-height: 56px;
    --bottomnav-height: 64px;
}

[data-theme="dark"] {
    --sidebar-width: 260px;
    --bg-body: #0b0f19;
    --bg-surface: #141926;
    --bg-surface-hover: #1a2035;
    --bg-sidebar: #0d1117;
    --bg-sidebar-hover: #161b22;
    --bg-input: #1a2035;
    --border: #1a6b2a;
    --border-focus: #1a9e2c;

    --text-primary: #d4e8d4;
    --text-secondary: #7a9a70;
    --text-muted: #64748b;
    --text-sidebar: #8b9dc3;
    --text-sidebar-active: #ffffff;

    --primary-light: #1e3a5f;
    --success-light: #14532d;
    --warning-light: #451a03;
    --danger-light: #450a0a;
    --info-light: #164e63;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.35);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ---- Sidebar (Desktop) ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; }
.logo-icon {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: #fff;
}
.logo-text { font-weight: 700; font-size: 1.1rem; color: #fff; }
.sidebar-close { display: none; background: none; border: none; color: var(--text-sidebar); font-size: 1.8rem; }

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-sidebar);
    font-weight: 500; font-size: 0.93rem;
    transition: all 0.15s;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar-active); }
.nav-item.active { background: rgba(37,99,235,0.15); color: var(--text-sidebar-active); }
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.user-info { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: var(--radius-full);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 0.85rem; color: #fff;
}
.user-details { display: flex; flex-direction: column; }
.user-name { color: #fff; font-weight: 600; font-size: 0.85rem; }
.user-role { color: var(--text-muted); font-size: 0.75rem; }

.sidebar-actions { display: flex; align-items: center; gap: 0.5rem; }
.theme-toggle, .btn-logout {
    background: rgba(255,255,255,0.06);
    border: none; border-radius: var(--radius-sm);
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-sidebar);
    transition: all 0.15s;
}
.theme-toggle:hover, .btn-logout:hover { background: rgba(255,255,255,0.12); color: #fff; }
.theme-toggle svg, .btn-logout svg { width: 18px; height: 18px; }

[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top Bar (hidden on desktop) ---- */
.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 0.6rem; }
.topbar-logo {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 0.25rem; }
.topbar-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: 0.15s;
}
.topbar-btn:hover { background: var(--bg-surface-hover); color: var(--text-primary); }
.topbar-btn svg { width: 20px; height: 20px; }

/* ---- Bottom Navigation (hidden on desktop) ---- */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottomnav-height);
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    position: relative;
}
.bottom-nav-item svg { width: 22px; height: 22px; }
.bottom-nav-item.active {
    color: var(--primary);
}
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%; transform: translateX(-50%);
    width: 20px; height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

.page-content { padding: 2rem; flex: 1; max-width: 1280px; width: 100%; }

/* ---- Page Header ---- */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.75rem; flex-wrap: wrap; gap: 1rem;
}
.page-header h2 { font-size: 1.5rem; font-weight: 700; }
.page-header p { color: var(--text-secondary); margin-top: 0.2rem; font-size: 0.9rem; }

/* ---- Cards ---- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex; align-items: flex-start; gap: 0.85rem;
    transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
    width: 44px; height: 44px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.1rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.88rem;
    border: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--text-on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn-icon {
    width: 36px; height: 36px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    background: transparent; border: 1px solid var(--border);
    color: var(--text-secondary);
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.25rem; }
.form-label {
    display: block;
    font-weight: 600; font-size: 0.85rem;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}
.form-input, .form-select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
}
.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-input::placeholder { color: var(--text-muted); }
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { color: var(--danger); font-size: 0.82rem; margin-top: 0.3rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- Table ---- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
thead th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600; font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
tbody tr:hover { background: var(--bg-surface-hover); }

/* ---- Mobile Table ÃÂÃÂ¢ÃÂÃÂÃÂÃÂ Card View ---- */
.mobile-cards { display: none; }
.mobile-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
}
.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
}
.mobile-card-row:not(:last-child) { border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; margin-bottom: 0.3rem; }
.mobile-card-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; font-weight: 600; letter-spacing: 0.03em; }
.mobile-card-value { font-size: 0.88rem; font-weight: 500; text-align: right; }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center;
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.73rem; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-warning { background: var(--warning-light); color: var(--warning); }

/* ---- Alerts ---- */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-sm);
    margin: 0.75rem 1rem 0;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 0.88rem; font-weight: 500;
    animation: slideDown 0.3s ease;
}
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.alert-info { background: var(--info-light); color: var(--info); }
.alert-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: inherit; opacity: 0.7; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Modal ---- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
    opacity: 0; visibility: hidden;
    transition: all 0.2s;
    padding: 1rem;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 540px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0;
    background: var(--bg-surface);
    z-index: 1;
}
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close {
    background: none; border: none;
    font-size: 1.5rem; color: var(--text-muted);
    line-height: 1;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg-surface-hover); }
.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 0.75rem;
    position: sticky; bottom: 0;
    background: var(--bg-surface);
}

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    width: 100%; flex: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    background: var(--bg-body);
}
.login-card {
    width: 100%; max-width: 420px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
}
.login-logo {
    display: flex; align-items: center; justify-content: center;
    gap: 0.75rem; margin-bottom: 2rem;
}
.login-logo .logo-icon { width: 48px; height: 48px; font-size: 1.4rem; }
.login-logo .logo-text { font-size: 1.35rem; font-weight: 700; }
.login-error {
    background: var(--danger-light); color: var(--danger);
    padding: 0.75rem 1rem; border-radius: var(--radius-sm);
    margin-bottom: 1.25rem; font-size: 0.88rem; font-weight: 500;
    display: none;
}
.login-error.show { display: block; }
.login-btn { width: 100%; padding: 0.75rem; font-size: 0.95rem; margin-top: 0.5rem; justify-content: center; }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: 0.82rem; color: var(--text-muted); }
.password-wrapper { position: relative; }
.password-toggle {
    position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer;
}
.password-toggle svg { width: 18px; height: 18px; }

/* ---- Empty State ---- */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state svg { width: 56px; height: 56px; margin: 0 auto 1rem; opacity: 0.3; }
.empty-state h3 { color: var(--text-secondary); font-size: 1.05rem; margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.88rem; margin-bottom: 1.25rem; }

/* ---- Spinner ---- */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Store Grid ---- */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}
.store-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
    display: flex; flex-direction: column; gap: 0.75rem;
}
.store-card:hover { box-shadow: var(--shadow-md); }
.store-card-header { display: flex; align-items: flex-start; justify-content: space-between; }
.store-card-header h4 { font-size: 0.95rem; font-weight: 600; }
.store-meta { font-size: 0.82rem; color: var(--text-secondary); }
.store-meta span { display: block; margin-top: 0.15rem; }
.store-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---- Transitions ---- */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }


/* ============================================
   RESPONSIVE: TABLET (ÃÂÃÂ¢ÃÂÃÂÃÂÃÂ¤1024px)
   ============================================ */
@media (max-width: 1024px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; }
    .topbar { display: flex; }
    .bottom-nav { display: flex; }
    .page-content {
        padding: 1.25rem;
        padding-bottom: calc(var(--bottomnav-height) + 1.5rem);
    }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ============================================
   RESPONSIVE: MOBILE (ÃÂÃÂ¢ÃÂÃÂÃÂÃÂ¤600px)
   ============================================ */
@media (max-width: 600px) {
    html { font-size: 14px; }

    .page-content {
        padding: 1rem;
        padding-bottom: calc(var(--bottomnav-height) + 1.5rem);
    }

    .page-header {
        margin-bottom: 1.25rem;
    }
    .page-header h2 { font-size: 1.2rem; }

    /* Stats: 2x2 compact grid */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }
    .stat-card {
        padding: 0.85rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    .stat-icon {
        width: 36px; height: 36px;
    }
    .stat-icon svg { width: 18px; height: 18px; }
    .stat-value { font-size: 1.35rem; }
    .stat-label { font-size: 0.75rem; }

    /* Tables: hide on mobile, show card view */
    .table-wrapper { display: none; }
    .mobile-cards { display: block; }

    /* Cards */
    .card-header { padding: 0.85rem 1rem; }
    .card-body { padding: 1rem; }

    /* Store grid: single column */
    .store-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .store-card { padding: 1rem; }
    .store-card-header h4 { font-size: 0.9rem; }
    .store-actions .btn-sm { padding: 0.35rem 0.7rem; font-size: 0.78rem; }

    /* Forms */
    .form-row { grid-template-columns: 1fr; }
    .form-input, .form-select { padding: 0.75rem; font-size: 1rem; }

    /* Modal: full screen on mobile */
    .modal-overlay { padding: 0; align-items: flex-end; }
    .modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
    .modal-body { padding: 1rem 1.25rem; }

    /* Buttons */
    .btn { padding: 0.65rem 1.1rem; font-size: 0.85rem; }

    /* Login */
    .login-card { padding: 2rem 1.5rem; }

    /* Bottom nav adjustments */
    .bottom-nav { height: 60px; }
    .bottom-nav-item { font-size: 0.65rem; padding: 0.35rem 0.5rem; }
    .bottom-nav-item svg { width: 20px; height: 20px; }
}

/* ============================================
   RESPONSIVE: Small phones (ÃÂÃÂ¢ÃÂÃÂÃÂÃÂ¤380px)
   ============================================ */
@media (max-width: 380px) {
    html { font-size: 13px; }
    .stats-grid { gap: 0.5rem; }
    .stat-card { padding: 0.75rem; }
    .stat-value { font-size: 1.2rem; }
    .page-content { padding: 0.75rem; padding-bottom: calc(var(--bottomnav-height) + 1rem); }
}


/* ============================================
   M2 ADDITIONS ÃÂÃÂ¢ÃÂÃÂÃÂÃÂ Append to style.css
   ============================================ */

/* ---- Checklist Builder ---- */
.section-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.section-chevron {
    transition: transform .2s;
    flex-shrink: 0;
}
.section-chevron.rotated {
    transform: rotate(-90deg);
}
.section-body.collapsed {
    display: none;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.item-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem .75rem;
    background: var(--bg-surface-hover);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: box-shadow .15s, opacity .15s;
}
.item-row:hover {
    box-shadow: var(--shadow-sm);
}
.item-row.dragging {
    opacity: .5;
    box-shadow: var(--shadow-md);
}
.item-drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.2rem;
    user-select: none;
    flex-shrink: 0;
}
.item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .25rem;
}
.item-text {
    font-size: .9rem;
}
.item-actions {
    display: flex;
    gap: .25rem;
    flex-shrink: 0;
}

/* ---- Badge variants ---- */
.badge-success {
    background: var(--success-light);
    color: var(--success);
}
.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}
.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* ---- Form group ---- */
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: .35rem;
    font-size: .9rem;
}
.form-input {
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: .9rem;
    transition: border-color .15s;
}
.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ---- Mobile adjustments ---- */
@media (max-width: 768px) {
    .item-row {
        flex-wrap: wrap;
    }
    .item-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: .25rem;
    }
}


/* ---- Stodels leaf logo override ---- */
.sidebar-logo .logo-icon,
.topbar-logo,
.login-logo .logo-icon {
    background: transparent url('../images/StodelsLeaf.png') center / contain no-repeat;
    color: transparent;
    overflow: hidden;
}

.sidebar-logo .logo-icon img,
.sidebar-logo .logo-icon svg,
.topbar-logo img,
.topbar-logo svg,
.login-logo .logo-icon img,
.login-logo .logo-icon svg {
    display: none !important;
}

.sidebar-logo .logo-icon,
.login-logo .logo-icon {
    width: 54px;
    height: 54px;
}

.topbar-logo {
    width: 38px;
    height: 38px;
}


/* ---- Stodels leaf text cleanup ---- */
.sidebar-logo .logo-text {
    display: none !important;
}

.sidebar-logo {
    gap: 0;
}

.login-logo > img {
    content: url('../images/StodelsLeaf.png');
    width: 96px;
    height: auto;
    object-fit: contain;
}


/* ---- Stodels leaf login logo fallback ---- */
.login-logo {
    min-height: 72px;
    background: transparent url('../images/StodelsLeaf.png') center / contain no-repeat;
}

.login-logo > img {
    opacity: 0;
}


/* ---- Stodels header logo with text ---- */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo .logo-text {
    display: inline-block !important;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.1rem;
    line-height: 1;
}


/* ---- Stodels dark green sidebar header block ---- */
.sidebar-header {
    background: #003f1f;
}


/* ---- Force Stodels text beside sidebar logo ---- */
.sidebar-header .sidebar-logo {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.75rem !important;
    width: 100% !important;
}

.sidebar-header .sidebar-logo .logo-text {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    position: static !important;
    width: auto !important;
    height: auto !important;
}

.sidebar-header .sidebar-logo .logo-icon {
    flex: 0 0 auto !important;
}

/* ---- Stodels dashboard branding punch ---- */
:root,
[data-theme="light"] {
    --bg-body: #f4f7ef;
    --bg-surface: #fffdf7;
    --bg-surface-hover: #eef5e7;
    --border: #cddfbe;
    --border-focus: #005b2e;

    --text-primary: #004b24;
    --text-secondary: #48643f;
    --text-muted: #6d8462;
    --text-on-primary: #173513;

    --primary: #ffc20e;
    --primary-hover: #e5ad00;
    --primary-light: #fff1bd;
    --success: #007a3d;
    --success-light: #d8eedb;
    --warning: #b87514;
    --warning-light: #fff0cc;
    --danger: #b73732;
    --danger-light: #f6ddda;
}

.main-content,
body {
    background: #f4f7ef;
}

.page-header {
    position: relative;
    padding: 0.35rem 0 0.85rem 1.1rem;
    border-left: 6px solid #ffc20e;
    margin-bottom: 1.55rem;
}

.page-header h2 {
    color: #004b24;
    font-weight: 800;
    letter-spacing: 0;
}

.page-header p {
    color: #48643f;
    font-weight: 500;
}

.stat-card,
.card,
.mobile-card {
    background: #fffdf7;
    border-color: #cddfbe;
    box-shadow: 0 8px 20px rgba(28, 74, 35, 0.08);
}

.stat-value {
    color: #004b24;
    font-weight: 800;
}

.stat-label {
    color: #48643f;
    font-weight: 500;
}

.stat-icon.blue,
.stat-icon.amber {
    background: #fff1bd;
    color: #e5ad00;
}

.stat-icon.green {
    background: #d8eedb;
    color: #007a3d;
}

.stat-icon.red {
    background: #f6ddda;
    color: #b73732;
}

.store-card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #005b2e 0%, #0b6f38 58%, #1f7f3f 100%);
    border: 1px solid rgba(255, 194, 14, 0.5);
    border-top: 6px solid #ffc20e;
    color: #ffffff;
    box-shadow: 0 12px 26px rgba(0, 75, 36, 0.22);
}

.store-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 194, 14, 0.18), transparent 36%);
    pointer-events: none;
}

.store-card > * {
    position: relative;
    z-index: 1;
}

.store-card h4,
.store-card .store-card-header h4 {
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.store-card .store-meta,
.store-card .store-meta span {
    color: rgba(255, 255, 255, 0.82);
    font-weight: 500;
}

.store-card .badge {
    background: #ffc20e;
    color: #003f1f;
    font-weight: 800;
}

.store-card .progress-ring,
.store-card [class*="ring"],
.store-card [class*="circle"] {
    color: #ffffff;
}

.region-card,
.province-card,
.dashboard-region,
.summary-card {
    border-color: #c5ddb8 !important;
    background: #fbfff7 !important;
}

.region-card h3,
.province-card h3,
.dashboard-region h3,
.summary-card h3 {
    color: #48643f !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em;
}

@media (max-width: 768px) {
    body {
        background: #f4f7ef;
    }

    .topbar {
        background: #fffdf7;
        border-bottom: 3px solid #ffc20e;
    }

    .topbar-title,
    .page-header h2,
    .stat-value {
        color: #004b24;
    }

    .topbar-btn {
        color: #48643f;
    }

    .topbar-btn:hover,
    .topbar-btn:focus {
        background: #eef5e7;
        color: #004b24;
    }

    .page-header {
        padding-left: 0.85rem;
        border-left-width: 5px;
    }

    .card,
    .stat-card,
    .mobile-card {
        background: #fffdf7;
        border-color: #cddfbe;
        box-shadow: 0 6px 16px rgba(28, 74, 35, 0.1);
    }

    .bottom-nav {
        background: #fffdf7;
        border-top: 3px solid #ffc20e;
        box-shadow: 0 -4px 14px rgba(28, 74, 35, 0.12);
    }

    .bottom-nav-item {
        color: #48643f;
    }

    .bottom-nav-item.active {
        color: #004b24;
        font-weight: 800;
    }

    .bottom-nav-item.active::before {
        background: #ffc20e;
    }

    .store-card {
        box-shadow: 0 10px 22px rgba(0, 75, 36, 0.24);
    }
}

/* ---- Stodels store cards - clean final override ---- */
.store-card,
.store-grid .store-card {
    background: #5f8958 !important;
    border: 1px solid #52794d !important;
    border-left: 6px solid #ffc20e !important;
    border-top: 0 !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 20px rgba(0, 75, 36, 0.18) !important;
    color: #ffc20e !important;
    overflow: hidden !important;
}

.store-card::before,
.store-grid .store-card::before {
    background: #ffc20e !important;
    content: "" !important;
    display: block !important;
    height: 4px !important;
    left: 0 !important;
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
}

.store-card::after,
.store-grid .store-card::after {
    background: linear-gradient(90deg, rgba(255, 194, 14, 0.1), transparent 48%) !important;
}

.store-card-header,
.store-card > div:first-child {
    background: #5f8958 !important;
    border: 0 !important;
    box-shadow: none !important;
}

.store-card h4,
.store-card .store-card-header h4 {
    color: #ffc20e !important;
    font-weight: inherit !important;
    text-shadow: none !important;
}

.store-card,
.store-card h3,
.store-card h4,
.store-card p,
.store-card span,
.store-card small,
.store-card div,
.store-card strong,
.store-card .store-name,
.store-card .store-title,
.store-card .store-card-title,
.store-card .score-label,
.store-card .walked-label,
.store-card [class*="label"] {
    color: #ffc20e !important;
}

.store-card .store-meta,
.store-card .store-meta span {
    color: #ffc20e !important;
}

.store-card .badge {
    background: #ffc20e !important;
    color: #004b24 !important;
    font-weight: inherit !important;
}

.store-card svg,
.store-card [class*="ring"],
.store-card [class*="circle"] {
    color: #004b24 !important;
}

/* Login form keeps the original blue sign-in treatment, not Stodels yellow */
.login-page .form-input,
.login-page .form-select {
    border-color: #dbeafe !important;
}

.login-page .form-input::placeholder,
.login-page .form-select::placeholder {
    color: #e8f0ff !important;
    opacity: 1 !important;
}

.login-page .form-input:focus,
.login-page .form-select:focus {
    border-color: #1e3a8a !important;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.18) !important;
}

.login-page .password-toggle {
    color: #1e3a8a !important;
}

.login-page .login-btn,
.login-page .btn-primary {
    background: #1e3a8a !important;
    border-color: #1e3a8a !important;
    color: #ffffff !important;
}

.login-page .login-btn:hover,
.login-page .btn-primary:hover {
    background: #1e40af !important;
    border-color: #1e40af !important;
    color: #ffffff !important;
}






/* ---- Quote button: stop pulsing once read ---- */
button.quote-pulse-btn.read,
.quote-pulse-btn.read { animation: none !important; }


/* ---- Remove yellow left accent on Store cards and Page header ---- */
.store-card,
.store-grid .store-card { border-left: 0 !important; }
.store-card::before,
.store-grid .store-card::before { display: none !important; }
.page-header { border-left: 0 !important; padding-left: 0 !important; }


/* ---- Login form: readable inputs on dark card ---- */
.login-page .form-input,
.login-page .form-select {
    background: #001c41 !important;
    color: #e8f0ff !important;
    border-color: #1e3a8a !important;
}
.login-page .form-input::placeholder,
.login-page .form-select::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}
