/* ============================================================
   RoomRudder Platform – Master Stylesheet
   Colors: #FFC801 (gold), #114C5A (teal), #F1F6F4 (off-white)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Space+Mono:wght@400;700&display=swap');

:root {
    --gold:        #FFC801;
    --gold-hover:  #e6b400;
    --teal:        #114C5A;
    --teal-light:  #1a6b7a;
    --teal-dark:   #0c3740;
    --off-white:   #F1F6F4;
    --white:       #ffffff;
    --gray-50:     #f8faf9;
    --gray-100:    #eef2f0;
    --gray-200:    #dde3e0;
    --gray-300:    #bcc5c1;
    --gray-400:    #8e9a95;
    --gray-500:    #6b7a74;
    --gray-600:    #4a5752;
    --gray-700:    #364440;
    --gray-800:    #1e2d29;
    --gray-900:    #111c19;

    --bg:          var(--off-white);
    --bg-card:     var(--white);
    --bg-sidebar:  var(--teal);
    --text:        var(--gray-800);
    --text-muted:  var(--gray-500);
    --border:      var(--gray-200);
    --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg:   0 10px 30px rgba(0,0,0,.08);
    --radius:      10px;
    --radius-sm:   6px;
    --radius-lg:   16px;
    --transition:  .2s ease;

    --font-body:   'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:   'Space Mono', monospace;
}

/* Dark mode */
html.dark-mode, body.dark-mode {
    --bg:          #0f1b19;
    --bg-card:     #162421;
    --bg-sidebar:  #0c1815;
    --text:        #d8e4df;
    --text-muted:  #7a9089;
    --border:      #243833;
    --shadow:      0 1px 3px rgba(0,0,0,.3);
    --shadow-lg:   0 10px 30px rgba(0,0,0,.4);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--teal-light); }

img { max-width: 100%; height: auto; }

/* ---- LANDING PAGE ---- */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, var(--teal-dark) 0%, var(--teal) 40%, var(--teal-light) 100%);
    position: relative;
    overflow: hidden;
}

.landing::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(255,200,1,.12) 0%, transparent 70%);
    pointer-events: none;
}

.landing::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -5%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(255,200,1,.06) 0%, transparent 70%);
    pointer-events: none;
}

.landing-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 3rem;
    position: relative;
    z-index: 10;
}

.landing-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: var(--white);
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -.02em;
}

.landing-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gold);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--teal-dark);
    font-size: 1.1rem;
}

.landing-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.landing-hero h1 {
    font-size: clamp(2.4rem, 5vw, 4rem);
    font-weight: 700;
    color: var(--white);
    letter-spacing: -.03em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.landing-hero h1 span {
    color: var(--gold);
}

.landing-hero p {
    color: rgba(255,255,255,.7);
    font-size: 1.15rem;
    max-width: 520px;
    margin-bottom: 2.5rem;
}

.landing-products {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    justify-content: center;
}

.landing-product-card {
    background: rgba(255,255,255,.08);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 180px;
    text-align: center;
    transition: transform var(--transition), background var(--transition);
}

.landing-product-card:hover {
    transform: translateY(-4px);
    background: rgba(255,255,255,.14);
}

.landing-product-card .card-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: var(--gold);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--teal-dark);
}

.landing-product-card h3 {
    color: var(--white);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: .35rem;
}

.landing-product-card p {
    color: rgba(255,255,255,.55);
    font-size: .82rem;
    margin-bottom: 0;
}

.landing-footer {
    text-align: center;
    padding: 1.5rem;
    color: rgba(255,255,255,.35);
    font-size: .82rem;
    position: relative;
    z-index: 10;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .9rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-gold {
    background: var(--gold);
    color: var(--teal-dark);
}
.btn-gold:hover {
    background: var(--gold-hover);
    color: var(--teal-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,200,1,.35);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: 2px solid rgba(255,255,255,.3);
}
.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-teal {
    background: var(--teal);
    color: var(--white);
}
.btn-teal:hover {
    background: var(--teal-light);
}

.btn-sm { padding: .4rem 1rem; font-size: .82rem; }
.btn-lg { padding: .85rem 2rem; font-size: 1rem; }

.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover {
    color: var(--text);
    border-color: var(--gray-400);
}

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 90%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(.97);
    transition: transform .25s ease;
    position: relative;
}
.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
}
.modal-close:hover { background: var(--gray-100); color: var(--text); }
.dark-mode .modal-close:hover { background: var(--gray-700); }

.modal h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: .35rem;
    color: var(--teal);
    letter-spacing: -.02em;
}
.dark-mode .modal h2 { color: var(--gold); }

.modal .subtitle {
    color: var(--text-muted);
    font-size: .9rem;
    margin-bottom: 1.8rem;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    font-size: .85rem;
    margin-bottom: .35rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: .7rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .92rem;
    color: var(--text);
    background: var(--bg-card);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(17,76,90,.1);
}
.dark-mode .form-control:focus {
    box-shadow: 0 0 0 3px rgba(255,200,1,.15);
}

.form-control::placeholder { color: var(--gray-400); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%238e9a95'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .8rem center;
    padding-right: 2.5rem;
}

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

.form-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .88rem;
}

.form-text {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: .25rem;
}

.alert {
    padding: .8rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    margin-bottom: 1.2rem;
    line-height: 1.45;
}
.alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.dark-mode .alert-danger { background: #2d1515; color: #fca5a5; border-color: #451a1a; }
.dark-mode .alert-success { background: #132a1a; color: #86efac; border-color: #1a3a22; }
.dark-mode .alert-info { background: #121e33; color: #93c5fd; border-color: #1e2d4a; }

/* ---- DASHBOARD LAYOUT ---- */
.app-wrapper {
    display: flex;
    height: 100%;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: rgba(255,255,255,.9);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--impersonate-offset, 0px);
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform .3s ease;
}

.sidebar-header {
    padding: 1.5rem 1.4rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.sidebar-header .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--gold);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--teal-dark);
    font-size: .95rem;
    flex-shrink: 0;
}

.sidebar-header .logo-text {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -.02em;
}

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

.nav-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.35);
    padding: 1.2rem 1.4rem .5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .65rem 1.4rem;
    color: rgba(255,255,255,.65);
    font-size: .9rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
    text-decoration: none;
}
.nav-item:hover, .nav-item.active {
    color: var(--white);
    background: rgba(255,255,255,.06);
    border-left-color: var(--gold);
}
.nav-item.active { color: var(--gold); }

.nav-item .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-left: auto;
    background: var(--gold);
    color: var(--teal-dark);
    font-size: .7rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 50px;
}

.sidebar-footer {
    padding: 1rem 1.4rem;
    border-top: 1px solid rgba(255,255,255,.1);
}

.version-info {
    font-size: .7rem;
    color: rgba(255,255,255,.35);
    text-align: center;
    padding: .5rem 1.4rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: .7rem;
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: .85rem;
    color: var(--gold);
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-weight: 600;
    font-size: .88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: .75rem;
    color: rgba(255,255,255,.45);
    text-transform: capitalize;
}

/* Main content area */
.main-content {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: var(--impersonate-offset, 0px);
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-left h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .82rem;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--teal); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: .8rem;
}

.topbar-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: all var(--transition);
}
.topbar-btn:hover { color: var(--text); border-color: var(--gray-400); }

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
}

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

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.card-body { padding: 1.5rem; }

/* ---- PRODUCT CARDS ---- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.8rem;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.product-card .product-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--gold);
    margin-bottom: 1.2rem;
    font-weight: 700;
}

.product-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: .4rem;
    letter-spacing: -.02em;
}

.product-card .product-desc {
    color: var(--text-muted);
    font-size: .88rem;
    flex: 1;
    margin-bottom: 1.2rem;
}

.product-card .product-status {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    font-weight: 600;
    padding: .25rem .65rem;
    border-radius: 50px;
    margin-bottom: 1rem;
}

.status-active { background: #dcfce7; color: #166534; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-none { background: var(--gray-100); color: var(--gray-500); }
.dark-mode .status-active { background: #132a1a; color: #86efac; }
.dark-mode .status-pending { background: #2d2510; color: #fcd34d; }
.dark-mode .status-none { background: var(--gray-700); color: var(--gray-400); }

.product-card .product-actions {
    display: flex;
    gap: .6rem;
}

/* ---- STATS CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.3rem 1.5rem;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: .35rem;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--teal);
}
.dark-mode .stat-card .stat-value { color: var(--gold); }

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: .75rem 1rem;
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: .8rem 1rem;
    font-size: .9rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: rgba(17,76,90,.03); }
.dark-mode .data-table tbody tr:hover { background: rgba(255,200,1,.03); }

.data-table .actions { white-space: nowrap; }
.data-table .actions a,
.data-table .actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    font-size: .88rem;
    text-decoration: none;
    margin-right: .3rem;
}
.data-table .actions a:hover,
.data-table .actions button:hover {
    color: var(--teal);
    border-color: var(--teal);
}

/* ---- PROFILE ---- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--teal-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold);
    flex-shrink: 0;
}

.profile-info h2 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.02em; }
.profile-info p { color: var(--text-muted); font-size: .9rem; }

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

/* ---- DARK MODE TOGGLE ---- */
.theme-toggle {
    position: relative;
    width: 44px;
    height: 24px;
}

.theme-toggle input { display: none; }

.theme-toggle .slider {
    position: absolute;
    inset: 0;
    background: var(--gray-200);
    border-radius: 50px;
    cursor: pointer;
    transition: background var(--transition);
}
.theme-toggle .slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--white);
    top: 3px;
    left: 3px;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.theme-toggle input:checked + .slider { background: var(--gold); }
.theme-toggle input:checked + .slider::before { transform: translateX(20px); }

/* ---- TABS (used in modal) ---- */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: .6rem 1.2rem;
    font-weight: 600;
    font-size: .9rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    font-family: var(--font-body);
}
.tab-btn.active {
    color: var(--teal);
    border-bottom-color: var(--teal);
}
.dark-mode .tab-btn.active {
    color: var(--gold);
    border-bottom-color: var(--gold);
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- PAGINATION ---- */
.pagination {
    display: flex;
    gap: .3rem;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 .5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-card);
    text-decoration: none;
    transition: all var(--transition);
}
.page-link:hover { border-color: var(--teal); color: var(--teal); }
.page-link.active { background: var(--teal); color: var(--white); border-color: var(--teal); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .hamburger { display: block; }
    .main-content { margin-left: 0; }
    .landing-nav { padding: 1rem 1.5rem; }
    .page-content { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .products-grid { grid-template-columns: 1fr; }
}

/* ---- UTILITY ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold); }
.text-teal { color: var(--teal); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: .5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.row { display: flex; gap: 1rem; align-items: flex-start; }
.row.between { justify-content: space-between; align-items: center; }
.text-sm { font-size: .85rem; }

/* ---- TOGGLE SWITCH ---- */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { display: none; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 999px; transition: background var(--transition); }
.switch .slider::before { content: ''; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: transform var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: #22c55e; }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* ---- NOTIFICATIONS ---- */
.notif-wrapper {
    position: relative;
}

.notif-btn {
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    max-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    display: none;
    overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .88rem;
}

.notif-mark-read {
    font-size: .78rem;
    color: var(--teal);
    text-decoration: none;
}
.notif-mark-read:hover { text-decoration: underline; }

.notif-list {
    max-height: 340px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: .7rem;
    padding: .8rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
    transition: background var(--transition);
    text-decoration: none;
    color: var(--text);
}
.notif-item:hover { background: rgba(17,76,90,.03); }
.dark-mode .notif-item:hover { background: rgba(255,200,1,.03); }
.notif-item.unread { background: rgba(255,200,1,.06); }

.notif-item .notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .9rem;
    flex-shrink: 0;
}
.dark-mode .notif-item .notif-icon { background: var(--gray-700); }

.notif-item .notif-icon.success { background: #dcfce7; color: #166534; }
.notif-item .notif-icon.warning { background: #fef3c7; color: #92400e; }
.notif-item .notif-icon.error { background: #fef2f2; color: #991b1b; }
.dark-mode .notif-item .notif-icon.success { background: #132a1a; color: #86efac; }
.dark-mode .notif-item .notif-icon.warning { background: #2d2510; color: #fcd34d; }
.dark-mode .notif-item .notif-icon.error { background: #2d1515; color: #fca5a5; }

.notif-item .notif-body { flex: 1; min-width: 0; }
.notif-item .notif-title { font-weight: 600; margin-bottom: .15rem; }
.notif-item .notif-msg { color: var(--text-muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item .notif-time { color: var(--text-muted); font-size: .72rem; white-space: nowrap; flex-shrink: 0; align-self: flex-start; }

.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: .88rem;
}

/* ---- BRANDING PREVIEW ---- */
.color-preview {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid var(--border);
    vertical-align: middle;
    margin-right: .3rem;
}

.brand-preview-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.brand-preview-card img {
    height: 48px;
    border-radius: 8px;
}

.brand-preview-card .brand-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
}

/* ---- SIDEBAR LOGO v4 ---- */
.sidebar-header-branded {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.2rem 1rem;
    gap: .5rem;
}

.sidebar-logo {
    width: 100%;
    max-width: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    width: 100%;
    height: auto;
    max-height: 90px;
    object-fit: contain;
}

.logo-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-title);
    text-align: center;
    letter-spacing: .02em;
}
.dark-mode .logo-title { color: var(--gold); }

.logo-title-only {
    font-size: 1.4rem;
    padding: .8rem 0 .3rem;
}

/* ---- PRODUCT REQUEST FORM (stacked under button) ---- */
.product-request-row {
    display: flex;
    align-items: center;
    gap: .6rem;
    width: 100%;
}

.self-setup-badge {
    font-size: .75rem;
    color: var(--gold);
    font-weight: 600;
    white-space: nowrap;
}

.request-form-expand {
    width: 100%;
    margin-top: .8rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.dark-mode .request-form-expand {
    background: var(--gray-800);
}

.request-form-expand.hidden { display: none; }

.request-form-expand .form-group {
    margin-bottom: .75rem;
}

.request-form-expand .form-group:last-of-type {
    margin-bottom: 1rem;
}

.request-form-expand label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: .3rem;
    color: var(--text-muted);
}

.request-form-expand .form-control {
    width: 100%;
    padding: .5rem .75rem;
    font-size: .88rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
}

.request-form-expand textarea.form-control {
    resize: vertical;
    min-height: 60px;
}

/* ---- TOGGLE BUTTONS (product visibility grid) ---- */
.btn-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 700;
    transition: all var(--transition);
}

.btn-toggle.on {
    background: #dcfce7;
    border-color: #16a34a;
    color: #166534;
}
.dark-mode .btn-toggle.on {
    background: #132a1a;
    border-color: #22c55e;
    color: #86efac;
}

.btn-toggle.off {
    background: #fef2f2;
    border-color: #dc2626;
    color: #991b1b;
}
.dark-mode .btn-toggle.off {
    background: #2d1515;
    border-color: #ef4444;
    color: #fca5a5;
}

.btn-toggle:hover { transform: scale(1.1); }

/* ---- UTILITY ---- */
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1.5rem; }
.gap-1 { gap: .5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }

/* ---- IMPERSONATION BAR ---- */
.impersonate-bar {
    background: #dc2626;
    color: #fff;
    padding: .5rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-size: .85rem;
    font-weight: 500;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: 40px;
}
.impersonate-bar strong { font-weight: 700; }
.impersonate-back-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .78rem;
    padding: .25rem .75rem;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    margin-left: .5rem;
    font-weight: 600;
}
.impersonate-back-btn:hover { background: #f3f4f6; }

/* When impersonating, offset the entire app */
body.has-impersonate-bar {
    --impersonate-offset: 40px;
}
body.has-impersonate-bar .sidebar {
    top: 40px;
    height: calc(100vh - 40px);
}

/* ---- NAV FA ICONS ---- */
.nav-fa {
    width: 20px;
    text-align: center;
    margin-right: .5rem;
    font-size: .85rem;
}

/* ---- VIEW AS BUTTON ---- */
.btn-view-as {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .75rem;
    padding: .15rem .5rem;
    border-radius: 3px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-view-as:hover { background: #e0f2fe; border-color: #7dd3fc; }
.dark-mode .btn-view-as { background: #0c2d48; border-color: #0369a1; color: #7dd3fc; }

/* ---- AD BANNER ---- */
.ad-banner-container {
    position: relative;
    width: 100%;
    max-width: 728px;
    height: 90px;
    margin: 0 auto 1.5rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--gray-100);
}
.dark-mode .ad-banner-container { background: var(--gray-800); }

.ad-banner {
    position: absolute;
    inset: 0;
    display: none;
    text-decoration: none;
}
.ad-banner.active { display: block; }

.ad-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ad-banner .ad-label {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: .65rem;
    color: rgba(255,255,255,.8);
    background: rgba(0,0,0,.5);
    padding: .1rem .4rem;
    border-radius: 3px;
}

/* ---- DIVIDER ---- */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-muted);
    font-size: .85rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}
.divider span {
    padding: 0 .75rem;
}

/* ---- PASSKEY ITEMS ---- */
.passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: .5rem;
}
.dark-mode .passkey-item { background: var(--gray-800); }
.passkey-item .passkey-info { flex: 1; }
.passkey-item .passkey-name { font-weight: 600; }
.passkey-item .passkey-meta { font-size: .8rem; color: var(--text-muted); }
