/* ══════════════════════════════════════════
   ShelfAI - Design System
   Shared CSS across all pages
   ══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600&display=swap');

:root {
    --primary: #1A1A2E;
    --primary-light: #16213E;
    --accent: #E94560;
    --accent-hover: #d63a54;
    --blue: #0F3460;
    --success: #27AE60;
    --warning: #F39C12;
    --danger: #E74C3C;
    --bg: #F8F9FA;
    --white: #FFFFFF;
    --gray-50: #F8F9FA;
    --gray-100: #F1F3F5;
    --gray-200: #E9ECEF;
    --gray-300: #DEE2E6;
    --gray-400: #ADB5BD;
    --gray-500: #6C757D;
    --gray-600: #495057;
    --gray-700: #343A40;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --sidebar-w: 260px;
}

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

/* ── SPLASH ── */
#splash {
    position: fixed; inset: 0; z-index: 999999;
    background: var(--primary, #1A1A2E);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    transition: opacity 0.4s ease;
}
#splash.splash--hide { opacity: 0; pointer-events: none; }
.splash-logo { display: flex; align-items: center; gap: 12px; }
.splash-mark {
    width: 48px; height: 48px; border-radius: 14px;
    background: var(--accent, #E94560); color: white;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 800;
    animation: splashPop 0.5s ease both;
}
.splash-text {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 32px; font-weight: 800;
    color: white; letter-spacing: -0.5px;
    animation: splashFade 0.5s 0.15s ease both;
}
.splash-text span { color: var(--accent, #E94560); }
@keyframes splashPop { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes splashFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

html, body {
    overflow-x: clip; /* clip instead of hidden to preserve position:sticky */
}
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--primary);
    display: flex;
    min-height: 100vh;
    padding-top: 0;
}
body::before {
    content: ''; position: fixed; top: 0; left: 0; right: 0;
    height: env(safe-area-inset-top, 0px);
    background: white; z-index: 90;
    pointer-events: none;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w); background: var(--primary); color: white;
    display: flex; flex-direction: column; position: fixed;
    top: 0; left: 0; bottom: 0; z-index: 150; transition: transform 0.3s ease;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.sidebar-logo {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 24px 16px; border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
}
.sidebar-logo:hover, .sidebar-logo:visited { text-decoration: none; }
.sidebar-logo .logo-mark {
    width: 40px; height: 40px; background: var(--accent); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; color: white;
}
.sidebar-logo .logo-text {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px;
    font-weight: 800; letter-spacing: -0.5px; color: white;
}
.sidebar-logo .logo-text span { color: var(--accent); }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;  overflow-y: auto; }
.nav-section-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35); padding: 16px 12px 8px; font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-radius: var(--radius-sm); cursor: pointer; transition: all 0.15s;
    font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.6);
    text-decoration: none; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.9); }
.nav-item.active { background: rgba(233,69,96,0.15); color: var(--accent); font-weight: 600; }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 16px; flex-shrink: 0; }
.nav-item--danger { margin-top: auto; color: var(--accent); border-top: 1px solid rgba(255,255,255,0.08); padding-top: 16px; margin-top: 16px; }
.nav-item--danger:hover { background: rgba(233,69,96,0.15); }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.impersonate-indicator {
    background: linear-gradient(135deg, #E94560, #c0392b); border-radius: var(--radius-sm);
    padding: 10px 12px; margin-bottom: 10px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.impersonate-info { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: white; min-width: 0; }
.impersonate-info strong { font-weight: 700; }
.impersonate-tenant { font-size: 10px; color: rgba(255,255,255,0.7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.impersonate-exit {
    flex-shrink: 0; background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4);
    color: white; padding: 4px 12px; border-radius: 6px;
    font-size: 11px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.impersonate-exit:hover { background: rgba(255,255,255,0.3); }
.user-card {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border-radius: var(--radius-sm); background: rgba(255,255,255,0.05);
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: white; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-company { font-size: 11px; color: rgba(233,69,96,0.85); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--gray-400); }
.btn-logout {
    background: none; border: none; color: var(--gray-400); cursor: pointer;
    font-size: 18px; padding: 4px; transition: color 0.15s;
}
.btn-logout:hover { color: var(--accent); }

/* Plan Usage Widget (with progress bars) */
.plan-usage-widget {
    margin-top: auto; padding: 12px 16px 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.plan-usage-row {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.plan-usage-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.5px; color: rgba(255,255,255,0.6);
}
.plan-usage-count {
    font-size: 11px; color: rgba(255,255,255,0.5);
}
.plan-usage-bar {
    background: rgba(255,255,255,0.1); border-radius: 4px;
    height: 6px; overflow: hidden; margin-bottom: 10px;
}
.plan-usage-fill {
    height: 100%; border-radius: 4px; background: var(--success);
    width: 0%; transition: width 0.5s ease;
}
.plan-usage-name {
    text-align: center; margin-top: 4px;
    font-size: 10px; color: rgba(255,255,255,0.4);
}

/* Superadmin Stats Widget */
.sa-stats-widget {
    margin-top: auto; padding: 14px 12px 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sa-stats-label {
    font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
    color: rgba(255,255,255,0.3); font-weight: 600; margin-bottom: 10px;
}
.sa-stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 0;
}
.sa-stat-name { font-size: 12px; color: rgba(255,255,255,0.5); }
.sa-stat-value {
    font-size: 13px; font-weight: 700; color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.sa-stat-accent { color: var(--accent); }
.app-version { text-align: center; font-size: 9px; color: rgba(255,255,255,0.15); margin-top: 8px; }

/* ── MAIN CONTENT ── */
.main { flex: 1; margin-left: var(--sidebar-w); padding: 32px; }
.page-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px;
}
.page-title {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 26px;
    font-weight: 800; letter-spacing: -0.5px; color: var(--primary);
}
.page-subtitle { font-size: 14px; color: var(--gray-500); margin-top: 4px; }
.header-actions { display: flex; gap: 12px; align-items: center; }
.header-actions > div { display: flex; gap: 12px; align-items: center; }
.header-actions .btn { background: var(--accent); color: white; }
.header-actions .btn-secondary { background: var(--gray-100); color: var(--primary); }

/* ── CARD ── */
.card {
    background: var(--white); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
}
.card-title {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px;
    font-weight: 700; color: var(--primary); margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}

/* ── TABLE ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px; font-size: 12px;
    text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500);
    font-weight: 600; border-bottom: 2px solid var(--gray-200); background: var(--gray-50);
}
.data-table td {
    padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700); vertical-align: middle;
}
.data-table tr:hover td { background: var(--gray-50); }
.data-table .text-right { text-align: right; }

/* ── BADGES ── */
.badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge.own { background: rgba(15,52,96,0.1); color: var(--blue); }
.badge.competitor { background: rgba(243,156,18,0.1); color: var(--warning); }
.badge.admin { background: rgba(233,69,96,0.1); color: var(--accent); }
.badge.user { background: rgba(15,52,96,0.1); color: var(--blue); }
.badge.active { background: rgba(39,174,96,0.1); color: var(--success); }
.badge.inactive { background: rgba(173,181,189,0.2); color: var(--gray-500); }

/* ── BUTTONS ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px;
    font-weight: 600; font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer; transition: all 0.2s; border: none;
    text-decoration: none;
}
a.btn, a.btn:hover, a.btn:visited { text-decoration: none; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 16px rgba(233,69,96,0.3); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-secondary.active { background: var(--primary); color: white; border-color: var(--primary); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon {
    width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm);
    display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block; font-size: 13px; font-weight: 600; color: var(--gray-600);
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 12px 14px; border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm); font-size: 14px; font-family: 'DM Sans', sans-serif;
    color: var(--primary); background: var(--white); transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233,69,96,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── AUTOCOMPLETE ── */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
    background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1); max-height: 220px; overflow-y: auto;
    margin-top: 2px;
}
.autocomplete-list.show { display: block; }
.autocomplete-item {
    padding: 10px 14px; cursor: pointer; font-size: 13px;
    border-bottom: 1px solid var(--gray-100); transition: background 0.15s;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.active { background: var(--gray-50); }
.autocomplete-item { display: flex; align-items: center; gap: 10px; }
.autocomplete-item .ac-item-text { flex: 1; min-width: 0; }
.autocomplete-item .ac-chain { font-weight: 600; color: var(--gray-700); }
.autocomplete-item .ac-detail { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.ac-source-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.ac-source-history { color: var(--blue); }
.ac-source-global { color: var(--gray-400); }

/* ── TOGGLE SWITCH ── */
.toggle-switch {
    position: relative; display: inline-block; width: 44px; height: 24px;
    flex-shrink: 0; vertical-align: middle;
}
.toggle-switch input {
    opacity: 0; width: 0; height: 0; position: absolute;
}
.toggle-slider {
    position: absolute; cursor: pointer; inset: 0;
    background: var(--gray-300); border-radius: 12px; transition: background 0.2s;
}
.toggle-slider::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 20px; height: 20px; border-radius: 50%; background: white;
    transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
}
.toggle-label {
    display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
    font-size: 14px; color: var(--gray-600);
}
.form-group .toggle-label {
    display: inline-flex; text-transform: none; letter-spacing: normal;
    font-weight: 500; margin-bottom: 0;
}
.form-group .toggle-switch input {
    width: 0; padding: 0; border: none;
}

/* ── MODAL ── */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 500; align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--white); border-radius: var(--radius); padding: 32px;
    width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg); animation: slideUp 0.3s ease;
}
.modal-title {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px;
    font-weight: 800; color: var(--primary); margin-bottom: 24px;
}
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* ── TABS/FILTERS ── */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.table-search { margin-left: auto; padding: 6px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; width: 180px; font-family: inherit; background: white; }
.table-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233,69,96,0.1); }
.filter-tab {
    padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; background: var(--gray-100);
    color: var(--gray-600); border: 1px solid transparent;
}
.filter-tab:hover { background: var(--gray-200); }
.filter-tab.active { background: var(--accent); color: white; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px;
    font-weight: 700; color: var(--gray-600); margin-bottom: 8px;
}
.empty-state p { font-size: 14px; color: var(--gray-400); }

/* ── LOADING ── */
.loading-overlay { display: none; text-align: center; padding: 40px; }
.loading-overlay.show { display: block; }
.spinner-lg {
    width: 44px; height: 44px; border: 4px solid var(--gray-200);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
.loading-overlay p { font-size: 14px; color: var(--gray-500); }

/* ── TOAST ── */
.toast-container {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
    padding: 14px 40px 14px 20px; position: relative; pointer-events: auto;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 500;
    color: white; animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}
.toast-close {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: rgba(255,255,255,0.7);
    font-size: 18px; cursor: pointer; padding: 2px 4px; line-height: 1;
}
.toast-close:hover { color: white; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--blue); }
.toast.warning { background: var(--warning); }

/* ── CONFIRM MODAL ── */
.confirm-modal { max-width: 420px; background: white; border-radius: 16px; padding: 28px; width: 95%; }
.confirm-modal-msg { font-size: 14px; color: var(--gray-600); line-height: 1.6; margin: 4px 0 0; }
.btn-danger-solid { background: var(--danger); color: white; border: none; }
.btn-danger-solid:hover { background: #c0392b; color: white; }

/* ── SUCCESS FLASH ── */
@keyframes successFlash {
    0%, 100% { box-shadow: 0 0 0 0 transparent; }
    50% { box-shadow: 0 0 0 3px rgba(39,174,96,0.3); }
}
input.success-flash { animation: successFlash 0.5s ease; }

/* ── LANDSCAPE BLOCK ── */
#landscape-block {
    display: none; position: fixed; inset: 0; z-index: 99999;
    background: var(--primary); color: white;
    flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    font-family: 'DM Sans', sans-serif; text-align: center; padding: 32px;
}
#landscape-block .rotate-icon { font-size: 48px; animation: rotateHint 2s ease-in-out infinite; }
#landscape-block p { font-size: 15px; color: rgba(255,255,255,0.7); margin: 0; }
@keyframes rotateHint { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-90deg); } }
@media (orientation: landscape) and (max-height: 500px) {
    #landscape-block { display: flex; }
}

/* ── OFFLINE BAR ── */
#offline-bar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10000;
    padding: 6px 16px; padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    text-align: center; background: var(--gray-700); color: white;
    font-size: 12px; font-weight: 500;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    animation: offlineSlideUp 0.35s ease;
}
#offline-bar.offline-bar--hide { animation: offlineSlideDown 0.35s ease forwards; }
.offline-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--warning); display: inline-block;
    animation: offlinePulse 2s ease-in-out infinite;
}
@keyframes offlineSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes offlineSlideDown { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes offlinePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ── ANDROID APP BANNER ── */
.android-app-banner {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    display: flex; align-items: center; gap: 12px;
    animation: offlineSlideUp 0.35s ease;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.2);
}
.android-app-banner--hide {
    animation: offlineSlideDown 0.35s ease forwards;
}
.android-app-banner__icon {
    width: 40px; height: 40px; min-width: 40px;
    border-radius: 10px; background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 18px; font-weight: 800; color: white;
}
.android-app-banner__text {
    flex: 1; font-size: 13px; font-weight: 500; line-height: 1.3;
    font-family: 'DM Sans', sans-serif;
}
.android-app-banner__btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 8px;
    background: var(--accent); color: white;
    font-size: 13px; font-weight: 600;
    text-decoration: none; white-space: nowrap;
    font-family: 'Plus Jakarta Sans', sans-serif;
    border: none; cursor: pointer;
    transition: background 0.2s;
}
.android-app-banner__btn:hover { background: var(--accent-hover); }
.android-app-banner__close {
    background: none; border: none; color: rgba(255,255,255,0.6);
    cursor: pointer; padding: 4px; line-height: 1;
    font-size: 20px; font-weight: 300;
    transition: color 0.2s;
}
.android-app-banner__close:hover { color: white; }
@media (max-width: 480px) {
    .android-app-banner { padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); gap: 10px; }
    .android-app-banner__icon { width: 36px; height: 36px; min-width: 36px; font-size: 16px; }
    .android-app-banner__text { font-size: 12px; }
    .android-app-banner__btn { padding: 7px 12px; font-size: 12px; }
}

/* ── ANIMATIONS ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── MOBILE ── */
/* PWA Safe Area Variables - adjust these values to fix alignment issues */
/* --pwa-header-base: altura base del header sin safe-area */
/* --pwa-title-offset: distancia desde safe-area hasta el título */
/* --pwa-content-gap: espacio entre header y contenido */
:root {
    --pwa-header-base: 120px;
    --pwa-title-offset: 40px;
    --pwa-content-gap: 10px;
}

.mobile-toggle {
    display: none; position: fixed; top: calc(env(safe-area-inset-top, 0px) + 54px); left: 16px; z-index: 200;
    width: 44px; height: 44px; background: var(--primary); border: none;
    border-radius: var(--radius-sm); color: white; font-size: 20px; cursor: pointer;
}
.sidebar-overlay { display: none; }

@keyframes scrollHint { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(4px); opacity: 1; } }
@keyframes scrollHintUp { 0%, 100% { transform: translateY(0); opacity: 0.4; } 50% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 768px) {
    .sidebar { left: auto; right: 0; transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-nav {
        overflow-y: auto; -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
    }
    .sidebar-nav::before {
        content: '⌃'; display: block;
        position: sticky; top: 0; z-index: 1;
        height: 32px; margin-bottom: -32px;
        background: linear-gradient(to top, transparent, var(--primary));
        pointer-events: none;
        text-align: center; line-height: 20px;
        font-size: 20px; color: rgba(255,255,255,0.55);
        opacity: 0; transition: opacity 0.25s;
        animation: scrollHintUp 2s ease-in-out infinite;
    }
    .sidebar-nav.can-scroll-up::before { opacity: 1; }
    .sidebar-nav::after {
        content: '⌄'; display: block;
        position: sticky; bottom: 0; z-index: 1;
        height: 36px; margin-top: -36px;
        background: linear-gradient(to bottom, transparent, var(--primary));
        pointer-events: none;
        text-align: center; line-height: 48px;
        font-size: 20px; color: rgba(255,255,255,0.55);
        transition: opacity 0.25s;
        animation: scrollHint 2s ease-in-out infinite;
    }
    .sidebar-nav.at-bottom::after { opacity: 0; }
    .sidebar-overlay.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 90; }
    .mobile-toggle { display: flex; align-items: center; justify-content: center; left: auto; right: 16px; }
    .sidebar-logo { padding-top: 44px; }
    .main { margin-left: 0; padding: 16px; padding-top: calc(80px + var(--impersonate-h, 0px) + env(safe-area-inset-top, 0px)); overflow-x: hidden; max-width: 100vw; }
    .page-header {
        position: fixed;
        top: 0; left: 0; right: 0;
        height: calc(var(--pwa-header-base, 120px) + env(safe-area-inset-top, 0px));
        z-index: 80;
        margin: 0;
        padding: calc(env(safe-area-inset-top, 0px) + var(--pwa-title-offset, 40px)) 112px 8px 16px;
        box-sizing: border-box;
        flex-direction: row; align-items: center;
        background: white;
    }
    /* Content spacing handled by #pageContainer margin-top */
    .page-title { font-size: 20px; line-height: 1.2; }
    .page-subtitle { font-size: 11px; margin-top: 1px; line-height: 1.2; }
    .header-actions { position: fixed; right: 68px; top: calc(env(safe-area-inset-top, 0px) + 54px); z-index: 200; height: 44px; display: flex; align-items: center; }
    .header-actions .btn {
        all: unset;
        width: 44px; height: 44px; box-sizing: border-box;
        background: var(--accent); border-radius: var(--radius-sm);
        position: relative; overflow: hidden; cursor: pointer;
        font-size: 0; color: transparent;
    }
    .header-actions .btn::after {
        content: '+'; position: absolute;
        top: 50%; left: 50%; transform: translate(-50%, -50%);
        font-size: 24px; font-weight: 700;
        color: white; line-height: 1;
    }
    .header-actions .btn-secondary,
    .header-actions .header-link,
    .header-actions .header-separator { display: none; }
    .form-row { grid-template-columns: 1fr; }

    /* Tables: horizontal scroll inside cards */
    .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 600px; }

    /* Card padding reduction */
    .card { padding: 16px; }

    /* Modal mobile sizing */
    .modal { margin: 12px; max-width: calc(100vw - 24px); padding: 20px; }
    .modal-title { font-size: 18px; margin-bottom: 16px; }

    /* Filter tabs: horizontal scroll */
    .filter-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; margin-top: 110px;}
    .filter-tab { flex-shrink: 0; }
    .table-search { width: 140px; flex-shrink: 0; margin-left: 4px; }
    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .confirm-modal { max-width: calc(100vw - 32px); margin: 16px; }
    .detail-nav { margin-left: 0; }
    .detail-nav-pos { min-width: 40px; }

    /* Billing/settings layout */
    .billing-header { flex-direction: column; }
    .plan-card { min-width: 0; }
    .billing-grid { grid-template-columns: 1fr; }
    .plan-usage { flex-wrap: wrap; gap: 16px; }

    /* Discount row */
    .discount-row { flex-direction: column; }
}

@media (max-width: 480px) {
    .card { padding: 12px; }
    .data-table { min-width: 500px; }
}

/* ── SIDEBAR SCROLL + CHEVRON INDICATOR ── */
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.35); }

/* ── UPGRADE PENDING BAR ── */
.upgrade-pending-bar {
    background: rgba(15,52,96,.06); border-bottom: 1px solid rgba(15,52,96,.12);
    padding: 12px 20px; display: flex; align-items: center; gap: 10px;
    font-size: 13px; color: var(--blue); transition: opacity .3s;
}
.upgrade-pending-bar--hide { opacity: 0; pointer-events: none; }
.upgrade-pending-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(15,52,96,.2);
    border-top-color: var(--blue); border-radius: 50%;
    animation: upg-spin .7s linear infinite; flex-shrink: 0;
}
@keyframes upg-spin { to { transform: rotate(360deg); } }

/* ── UPGRADE SUCCESS MODAL ── */
.upgrade-success-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity .3s; pointer-events: none;
}
.upgrade-success-overlay.open { opacity: 1; pointer-events: auto; }
.upgrade-success-modal {
    background: var(--white); border-radius: var(--radius); padding: 36px 32px;
    max-width: 440px; width: 90%; text-align: center;
    transform: translateY(20px) scale(.96); transition: transform .3s;
    box-shadow: var(--shadow-lg);
}
.upgrade-success-overlay.open .upgrade-success-modal { transform: translateY(0) scale(1); }
.usm-icon {
    width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%;
    background: var(--success); display: flex; align-items: center; justify-content: center;
    animation: usm-pop .5s cubic-bezier(.175,.885,.32,1.275);
}
.usm-icon svg { width: 36px; height: 36px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.usm-icon svg .usm-check { stroke-dasharray: 48; stroke-dashoffset: 48; animation: usm-draw .4s .3s ease forwards; }
@keyframes usm-pop { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes usm-draw { to { stroke-dashoffset: 0; } }
.usm-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.usm-plan { font-size: 15px; color: var(--accent); font-weight: 700; margin-bottom: 16px; }
.usm-features { text-align: left; list-style: none; padding: 0; margin: 0 0 20px; font-size: 13px; color: var(--gray-600); }
.usm-features li { padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.usm-features li::before { content: '\2713'; color: var(--success); font-weight: 700; margin-right: 8px; }
.usm-btn { width: 100%; }

.sidebar-footer {
    position: relative;
}

/* ══════════════════════════════════════════
   DASHBOARD PAGE STYLES
   ══════════════════════════════════════════ */

/* ── TRIAL FOMO BANNER ── */
.trial-fomo { display: none; margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; }
.trial-fomo-inner {
    display: flex; align-items: center; gap: 20px; padding: 18px 24px; flex-wrap: wrap;
    background: linear-gradient(135deg, rgba(243,156,18,0.10), rgba(233,69,96,0.08));
    border: 1px solid rgba(243,156,18,0.3); border-radius: var(--radius);
}
.trial-fomo-icon { font-size: 32px; flex-shrink: 0; }
.trial-fomo-body { flex: 1; min-width: 200px; }
.trial-fomo-title { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 15px; color: var(--warning); }
.trial-fomo-desc { font-size: 13px; color: var(--gray-600); margin-top: 4px; line-height: 1.4; }
.trial-fomo-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.trial-fomo-days {
    display: flex; flex-direction: column; align-items: center; background: rgba(243,156,18,0.12);
    border-radius: var(--radius-sm); padding: 8px 16px; min-width: 64px;
}
.trial-fomo-days-num { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 28px; color: var(--warning); line-height: 1; }
.trial-fomo-days-label { font-size: 11px; color: var(--gray-500); text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.trial-fomo .btn-upgrade {
    padding: 10px 22px; background: var(--accent); color: white; border: none; border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 600; cursor: pointer;
    text-decoration: none; white-space: nowrap; transition: opacity 0.15s;
}
.trial-fomo .btn-upgrade:hover { opacity: 0.85; }
.trial-fomo.urgent .trial-fomo-inner { border-color: rgba(233,69,96,0.4); background: linear-gradient(135deg, rgba(233,69,96,0.10), rgba(243,156,18,0.06)); }
.trial-fomo.urgent .trial-fomo-title { color: var(--accent); }
.trial-fomo.urgent .trial-fomo-days-num { color: var(--accent); }
.trial-fomo.urgent .trial-fomo-days { background: rgba(233,69,96,0.10); }

/* ── TEAM SECTION (Supervisor) ── */
.team-section { display: none; margin-bottom: 20px; }
.team-section.visible { display: block; }
.team-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-200);
}
.team-title { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 18px; color: var(--primary); }
.team-title-badge { font-size: 12px; background: var(--blue); color: white; padding: 2px 10px; border-radius: 12px; font-weight: 600; margin-left: 10px; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.team-stat {
    background: white; border-radius: var(--radius-sm); padding: 14px; text-align: center;
    box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100);
}
.team-stat-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800; color: var(--primary); line-height: 1; }
.team-stat-label { font-size: 11px; color: var(--gray-500); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.team-stat.success .team-stat-value { color: var(--success); }
.team-stat.warning .team-stat-value { color: var(--warning); }
.team-stat.accent .team-stat-value { color: var(--accent); }
.team-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.team-list { background: white; border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100); }
.team-list-title { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.team-list-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.team-list-item:last-child { border-bottom: none; }
.team-list-name { font-size: 13px; font-weight: 500; color: var(--primary); }
.team-list-meta { font-size: 12px; color: var(--gray-500); }
.team-list-alert { color: var(--warning); font-weight: 600; }
.team-empty { text-align: center; padding: 20px; color: var(--gray-400); font-size: 13px; }

/* ── SUPERVISOR CARDS (Admin view) ── */
.supervisors-section { margin-bottom: 24px; }
.supervisors-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.supervisor-card {
    background: white; border-radius: var(--radius-sm); padding: 16px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--gray-100);
    cursor: pointer; transition: all 0.15s ease;
}
.supervisor-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.supervisor-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.supervisor-card-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700; color: white; flex-shrink: 0;
}
.supervisor-card-info { flex: 1; min-width: 0; }
.supervisor-card-name { font-weight: 600; font-size: 15px; color: var(--primary); }
.supervisor-card-count { font-size: 12px; color: var(--gray-500); }
.supervisor-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.supervisor-card-stat-value { font-size: 20px; font-weight: 700; color: var(--primary); }
.supervisor-card-stat-label { font-size: 10px; color: var(--gray-500); text-transform: uppercase; }

/* ── DASHBOARD TABS ── */
#dashTabs { display: none; }
#dashTabs.visible { display: flex; }
.dash-panel { display: none; }
.dash-panel.active { display: block; }

/* ── SHELFSCORE HERO ── */
.shelfscore-hero {
    background: var(--primary); border-radius: var(--radius); padding: 28px 32px;
    margin-bottom: 20px; position: relative; overflow: hidden;
    box-shadow: 0 8px 32px rgba(26,26,46,0.25);
}
.shelfscore-hero::before {
    content: ''; position: absolute; top: -40%; right: -5%; width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(233,69,96,0.12) 0%, transparent 70%);
    border-radius: 50%; pointer-events: none;
}
.shelfscore-hero-inner { display: flex; align-items: center; gap: 32px; position: relative; z-index: 1; }
.shelfscore-hero-left { flex-shrink: 0; }
.shelfscore-hero-brand {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 800;
    letter-spacing: -0.3px; margin-bottom: 8px;
}
.shelfscore-hero-brand .ss-shelf { color: #FFFFFF; }
.shelfscore-hero-brand .ss-score { color: var(--accent); }
.shelfscore-hero-number {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 72px; font-weight: 800;
    line-height: 1; letter-spacing: -3px; color: #FFFFFF;
}
.shelfscore-hero-number .ss-unit { font-size: 28px; color: rgba(255,255,255,0.35); font-weight: 700; letter-spacing: 0; margin-left: 2px; }
.shelfscore-hero-number .ss-placeholder { font-size: 48px; letter-spacing: -1px; opacity: 0.2; }
.shelfscore-hero-meta { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.shelfscore-tier-pill {
    display: inline-flex; align-items: center; padding: 4px 12px;
    border-radius: 20px; font-size: 12px; font-weight: 700; letter-spacing: 0.3px;
}
.shelfscore-tier-pill.shelfscore-low { background: rgba(233,69,96,0.2); color: #FF6B81; }
.shelfscore-tier-pill.shelfscore-growing { background: rgba(243,156,18,0.2); color: #FFD166; }
.shelfscore-tier-pill.shelfscore-good { background: rgba(15,52,96,0.3); color: #7EC8E3; }
.shelfscore-tier-pill.shelfscore-excellent { background: rgba(39,174,96,0.2); color: #6BCB77; }
.shelfscore-hero-change { font-size: 13px; font-weight: 600; }
.shelfscore-hero-change.up { color: #6BCB77; }
.shelfscore-hero-change.down { color: #FF6B81; }
.shelfscore-hero-right { flex: 1; min-width: 0; }
.shelfscore-hero-breakdown { display: flex; flex-direction: column; gap: 6px; }
.shelfscore-hero-bd-row { display: flex; align-items: center; gap: 10px; }
.shelfscore-hero-bd-label { width: 100px; font-size: 11px; color: rgba(255,255,255,0.5); font-weight: 500; text-align: right; flex-shrink: 0; }
.shelfscore-hero-bd-bar { flex: 1; height: 4px; background: rgba(255,255,255,0.18); border-radius: 2px; overflow: hidden; }
.shelfscore-hero-bd-fill { height: 100%; border-radius: 2px; background: rgba(255,255,255,0.55); transition: width 0.6s ease; }
.shelfscore-hero-bd-val { width: 30px; font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.6); text-align: right; }

/* ── KPI CARDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.kpi-card {
    background: var(--white); border-radius: var(--radius); padding: 20px 24px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
    transition: box-shadow 0.2s, transform 0.2s;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kpi-icon {
    width: 36px; height: 36px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.kpi-icon.blue { background: rgba(15,52,96,0.1); }
.kpi-icon.accent { background: rgba(233,69,96,0.1); }
.kpi-icon.green { background: rgba(39,174,96,0.1); }
.kpi-icon.orange { background: rgba(243,156,18,0.1); }
.kpi-label { font-size: 12px; color: var(--gray-500); font-weight: 500; }
.kpi-value {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px;
    font-weight: 800; letter-spacing: -1px; color: var(--primary); line-height: 1;
}
.kpi-desc { font-size: 11px; color: var(--gray-400); line-height: 1.4; margin-top: 8px; }

/* ── SHELFSCORE BADGE ── */
.shelfscore-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
}
.shelfscore-badge.shelfscore-low { background: rgba(233,69,96,0.12); color: #E94560; }
.shelfscore-badge.shelfscore-growing { background: rgba(243,156,18,0.12); color: #F39C12; }
.shelfscore-badge.shelfscore-good { background: rgba(15,52,96,0.12); color: #0F3460; }
.shelfscore-badge.shelfscore-excellent { background: rgba(39,174,96,0.12); color: #27AE60; }

/* ── CONTENT GRID ── */
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.content-grid.full { grid-template-columns: 1fr; }

/* ── UPLOAD ZONE ── */
.upload-zone {
    border: 2px dashed var(--gray-300); border-radius: var(--radius);
    padding: 48px 24px; text-align: center; cursor: pointer;
    transition: all 0.2s; background: var(--gray-50); margin-bottom: 16px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: rgba(233,69,96,0.03); }
.upload-zone .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.6; }
.upload-zone h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.upload-zone p { font-size: 13px; color: var(--gray-400); }
.upload-zone img { max-width: 100%; max-height: 240px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.upload-blocker-card {
    background: white; border-radius: 12px; padding: 40px; text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.upload-blocker-icon { font-size: 56px; margin-bottom: 16px; color: var(--gray-400); }
.upload-blocker-card h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.upload-blocker-card .blocker-detail { color: var(--gray-500); font-size: 14px; line-height: 1.6; max-width: 450px; margin: 0 auto 8px; }
.upload-blocker-card .blocker-explain { color: var(--gray-400); font-size: 13px; margin-bottom: 24px; }
.upload-actions { margin-top: 24px; display: flex; gap: 12px; }
.upload-progress { padding: 16px; background: var(--gray-50); border-radius: var(--radius-sm); text-align: center; color: var(--gray-600); }
.upload-success { padding: 16px; background: rgba(39,174,96,0.1); border-radius: var(--radius-sm); text-align: center; color: var(--success); font-weight: 600; }
.upload-error { padding: 16px; background: rgba(233,69,96,0.1); border-radius: var(--radius-sm); text-align: center; color: var(--accent); font-weight: 600; }

/* ── FILTERS TOGGLE (mobile only) ── */
.filters-toggle {
    display: none; /* hidden on desktop */
    width: 100%; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; margin-bottom: 0;
    background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 14px; font-family: 'DM Sans', sans-serif; font-weight: 600;
    color: var(--gray-600); cursor: pointer; transition: all 0.2s;
    position: relative;
}
.filters-toggle:hover { border-color: var(--gray-300); }
.filters-toggle.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: var(--gray-100); margin-bottom: 0; }
.filters-toggle.active { color: var(--accent); border-color: var(--accent); background: rgba(233,69,96,0.04); }
.filters-toggle.active.open { border-bottom-color: var(--gray-100); }
.filters-toggle-arrow { font-size: 10px; color: var(--gray-400); transition: transform 0.3s; margin-left: auto; }
.filters-toggle.open .filters-toggle-arrow { transform: rotate(180deg); }
.filters-badge {
    display: none; min-width: 18px; height: 18px; line-height: 18px;
    padding: 0 5px; border-radius: 9px; font-size: 11px; font-weight: 700;
    background: var(--accent); color: white; text-align: center;
}
.filters-badge.show { display: inline-block; }

/* ── RESULTS FILTERS ── */
.results-filters {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 0; margin-bottom: 16px;
    background: none; border: none; border-radius: 0;
}
.results-filters select {
    padding: 7px 10px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 13px; font-family: 'DM Sans', sans-serif; background: var(--white);
    color: var(--gray-700); outline: none; transition: border-color 0.15s;
    max-width: 180px; cursor: pointer;
}
.results-filters select:focus { border-color: var(--accent); }
.results-filters .filter-btn {
    padding: 7px 16px; border: 1px solid var(--accent); border-radius: var(--radius-sm);
    font-size: 13px; font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all 0.15s;
    background: var(--accent); color: white; font-weight: 500;
}
.results-filters .filter-btn:hover { opacity: 0.85; }
.results-filters .filter-btn.secondary { background: var(--white); color: var(--gray-600); border-color: var(--gray-200); }
.results-filters .filter-btn.secondary:hover { border-color: var(--gray-400); }

/* ── DATE WIDGET ── */
.date-widget { position: relative; }
.date-widget-trigger {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 13px; font-family: 'DM Sans', sans-serif; background: var(--white);
    color: var(--gray-700); cursor: pointer; transition: border-color 0.15s; white-space: nowrap;
}
.date-widget-trigger:hover { border-color: var(--gray-400); }
.date-widget-trigger.active { border-color: var(--accent); color: var(--accent); }
.date-widget-arrow { font-size: 10px; color: var(--gray-400); transition: transform 0.15s; }
.date-widget.open .date-widget-arrow { transform: rotate(180deg); }
.date-widget-dropdown {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 100;
    background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); min-width: 220px; padding: 6px 0;
}
.date-widget.open .date-widget-dropdown { display: block; }
.date-widget-option {
    display: block; width: 100%; text-align: left; padding: 9px 16px;
    font-size: 13px; font-family: 'DM Sans', sans-serif; color: var(--gray-700);
    background: none; border: none; cursor: pointer; transition: background 0.1s;
}
.date-widget-option:hover { background: var(--gray-50); }
.date-widget-option.selected { color: var(--accent); font-weight: 600; }
.date-widget-divider { height: 1px; background: var(--gray-100); margin: 4px 0; }
.date-widget-custom {
    display: none; padding: 10px 16px 8px; gap: 8px; flex-direction: column;
}
.date-widget-custom.show { display: flex; }
.date-widget-custom-row { display: flex; align-items: center; gap: 8px; }
.date-widget-custom-row label { font-size: 12px; color: var(--gray-500); min-width: 44px; }
.date-widget-custom-row input[type="date"] {
    flex: 1; padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 13px; font-family: 'DM Sans', sans-serif; background: var(--white);
    color: var(--gray-700); outline: none;
}
.date-widget-custom-row input[type="date"]:focus { border-color: var(--accent); }
.date-widget-apply {
    margin-top: 4px; padding: 7px 0; border: none; border-radius: var(--radius-sm);
    font-size: 13px; font-family: 'DM Sans', sans-serif; font-weight: 500;
    background: var(--accent); color: white; cursor: pointer; transition: opacity 0.15s;
}
.date-widget-apply:hover { opacity: 0.85; }

/* ── PAGINATION ── */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.pagination button {
    padding: 8px 14px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
    background: var(--white); font-size: 13px; cursor: pointer; transition: all 0.15s;
    font-family: 'DM Sans', sans-serif; min-width: 38px;
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ── RESULTS LIST ── */
.result-item {
    display: grid; grid-template-columns: auto 1fr auto auto; gap: 16px;
    padding: 18px 0; border-bottom: 1px solid var(--gray-100); align-items: center;
    transition: background 0.15s; cursor: pointer;
}
.result-item:hover { background: var(--gray-50); margin: 0 -24px; padding: 18px 24px; border-radius: var(--radius-sm); }
.result-item:last-child { border-bottom: none; }
.result-thumb {
    width: 56px; height: 56px; border-radius: var(--radius-sm);
    background: var(--gray-100); display: flex; align-items: center;
    justify-content: center; font-size: 24px; overflow: hidden; flex-shrink: 0;
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-info h4 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700; color: var(--primary); margin: 0; }
.result-info p { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.result-metrics { display: flex; gap: 16px; text-align: right; align-items: center; }
.result-metric-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px; font-weight: 800; color: var(--primary); }
.result-metric-label { font-size: 11px; color: var(--gray-400); text-transform: uppercase; }
.result-item-header { display: contents; }
.result-metric { text-align: right; }
.ss-box {
    background: var(--primary); border-radius: 10px;
    padding: 6px 0; text-align: center; width: 72px; height: 56px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-sizing: border-box;
}
.ss-box-score { display: flex; align-items: baseline; line-height: 1; }
.ss-box-num { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800; color: #FFFFFF; line-height: 1; }
.ss-box-max { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 10px; font-weight: 700; color: var(--accent); line-height: 1; }
.ss-box-tier { font-size: 9px; font-weight: 700; margin-top: 2px; letter-spacing: 0.3px; text-transform: uppercase; }
.ss-box-tier.shelfscore-low { color: #FF6B81; }
.ss-box-tier.shelfscore-growing { color: #FFD166; }
.ss-box-tier.shelfscore-good { color: #7EC8E3; }
.ss-box-tier.shelfscore-excellent { color: #6BCB77; }

@media (max-width: 768px) {
    .result-item {
        display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
        gap: 0; padding: 0; border-bottom: none;
        background: white; border-radius: 10px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08); margin-bottom: 8px;
    }
    .result-item:hover { margin: 0 0 8px; padding: 0; background: white; border-radius: 10px; }
    .result-item:last-child { border-bottom: none; }
    .result-item-header {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 12px 8px; grid-column: 1; grid-row: 1;
    }
    .ss-box {
        grid-column: 2; grid-row: 1; align-self: center;
        margin: 12px 12px 0 0; border-radius: 8px;
        padding: 4px 0; width: 60px; height: 48px;
    }
    .ss-box-num { font-size: 18px; }
    .ss-box-max { font-size: 9px; }
    .ss-box-tier { font-size: 8px; margin-top: 1px; }
    .result-thumb { width: 48px; height: 48px; border-radius: 8px; }
    .result-info h4 { font-size: 14px; }
    .result-info p { font-size: 11px; }
    .result-footer {
        display: flex; justify-content: space-between; align-items: center;
        padding: 8px 12px 10px;
        border-top: 1px solid var(--gray-100);
        grid-column: 1 / -1; grid-row: 2;
    }
    .result-date {
        font-size: 11px; color: var(--gray-500);
    }
    .result-metrics {
        display: flex; gap: 16px;
        align-items: center; justify-content: flex-end;
    }
    .result-metric {
        display: flex; flex-direction: column; align-items: flex-end;
        min-width: 0; text-align: right;
    }
    .result-metric-value { font-size: 15px; line-height: 1.2; white-space: nowrap; }
    .result-metric-label { font-size: 10px; line-height: 1.2; }
}

/* ── TAB CONTENT ── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── DETAIL VIEW ── */
.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-header .btn-back { display: flex; align-items: center; gap: 8px; background: none; border: none; cursor: pointer; font-size: 14px; color: var(--gray-600); font-family: inherit; }
.detail-header .btn-back:hover { color: var(--primary); }
.detail-header h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800; color: var(--primary); flex: 1; }
.detail-date { font-size: 13px; color: var(--gray-500); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.detail-image { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-md); }
.detail-score { text-align: center; margin-bottom: 20px; }
.detail-score-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 56px; font-weight: 800; color: var(--primary); }
.detail-score-label { font-size: 14px; color: var(--gray-500); margin-bottom: 8px; }
.detail-stats { display: flex; flex-direction: column; gap: 12px; }
.detail-stat { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.detail-stat .label { font-size: 14px; color: var(--gray-600); }
.detail-stat .value { font-size: 16px; font-weight: 700; color: var(--primary); }

/* ── STORE/BRAND LISTS ── */
.store-list, .brand-dist-list { display: flex; flex-direction: column; gap: 8px; }
.store-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.store-rank { width: 24px; height: 24px; border-radius: 50%; background: var(--gray-100); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--gray-600); }
.store-name { flex: 1; font-size: 14px; color: var(--primary); }
.store-count { font-size: 14px; font-weight: 600; color: var(--gray-500); }
.brand-dist-item { display: flex; flex-direction: column; gap: 4px; }
.brand-dist-info { display: flex; justify-content: space-between; }
.brand-dist-name { font-size: 13px; color: var(--primary); }
.brand-dist-pct { font-size: 13px; font-weight: 600; color: var(--gray-600); }
.brand-dist-bar { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.brand-dist-fill { height: 100%; border-radius: 3px; transition: width 0.6s; }
.brand-dist-fill.own { background: var(--blue); }
.brand-dist-fill.comp { background: var(--warning); }

/* ── BAR CHART ── */
.bar-chart { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { width: 120px; font-size: 13px; font-weight: 500; color: var(--gray-600); text-align: right; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 28px; background: var(--gray-100); border-radius: 6px; overflow: hidden; position: relative; }
.bar-fill {
    height: 100%; border-radius: 6px; transition: width 0.8s ease;
    display: flex; align-items: center; padding-left: 10px;
    font-size: 12px; font-weight: 700; color: white; min-width: 40px;
}
.bar-fill.own-brand { background: linear-gradient(90deg, var(--blue) 0%, #1a5276 100%); }
.bar-fill.competitor-brand { background: linear-gradient(90deg, var(--warning) 0%, #e67e22 100%); }

/* ── PAGE LOADING ── */
.page-loading { display: flex; align-items: center; justify-content: center; padding: 60px; }
.main-content { flex: 1; margin-left: var(--sidebar-w); padding: 32px; transition: opacity 0.2s; }
#pageContainer { transition: opacity 0.15s; }

/* ── SPA SHELL HEADER ── */
.top-header {
    display: none; /* Using sidebar-based nav for now */
}
.impersonate-banner {
    background: linear-gradient(135deg, #E94560, #c0392b);
    padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; color: white;
}
.impersonate-banner button {
    background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.4);
    color: white; padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.impersonate-banner button:hover { background: rgba(255,255,255,0.3); }
body.impersonating { --impersonate-h: 42px; }

/* ── ERROR STATE ── */
.error-state { text-align: center; padding: 60px 20px; }
.error-state h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; color: var(--gray-700); margin-bottom: 12px; }
.error-state p { color: var(--gray-500); margin-bottom: 20px; }

/* ══════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════ */

@media (max-width: 1024px) {
    .kpi-grid { grid-template-columns: repeat(4, 1fr); }
    .content-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .shelfscore-hero-inner { gap: 24px; }
    .shelfscore-hero-number { font-size: 56px; }
    .detail-grid { grid-template-columns: 1fr; gap: 16px; }
    .team-lists { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .main-content { margin-left: 0; padding: 16px; padding-top: 0; overflow-x: hidden; max-width: 100vw; box-sizing: border-box; }
    #pageContainer { overflow-x: hidden; max-width: 100%; box-sizing: border-box; margin-top: calc(var(--pwa-header-base, 120px) + env(safe-area-inset-top, 0px) + var(--pwa-content-gap, 10px)); }
    #pageContainer:has(#tab-detail.active) { margin-top: 0; }
    .page-header { flex-wrap: wrap; gap: 8px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .shelfscore-hero-inner { flex-direction: column; gap: 20px; text-align: center; }
    .shelfscore-hero-right { width: 100%; }
    .shelfscore-hero-bd-label { text-align: left; }
    .shelfscore-hero-number { font-size: 64px; }
    .filters-toggle { display: flex; }
    .results-filters {
        flex-direction: column; gap: 8px; padding: 0 12px;
        max-height: 0; overflow: hidden; opacity: 0;
        border: none; margin-bottom: 0; padding-top: 0; padding-bottom: 0;
        transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1),
                    opacity 0.25s ease,
                    padding 0.35s cubic-bezier(0.4,0,0.2,1),
                    margin 0.35s cubic-bezier(0.4,0,0.2,1);
    }
    .results-filters.mobile-open {
        max-height: 400px; opacity: 1;
        padding: 12px; margin-bottom: 16px;
        border: 1px solid var(--gray-200);
        border-top: none; border-top-left-radius: 0; border-top-right-radius: 0;
    }
    .filters-toggle:not(.open) { margin-bottom: 16px; }
    .results-filters .filter-btn { display: none; }
    .results-filters .filter-btn.secondary { display: block; width: 100%; }
    .results-filters select { max-width: 100%; width: 100%; }
    .date-widget { width: 100%; }
    .date-widget-trigger { width: 100%; justify-content: space-between; }
    .date-widget-dropdown { width: 100%; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .kpi-card { padding: 16px; }
    .kpi-value { font-size: 24px; }
    .shelfscore-hero { padding: 24px 20px; margin-top: 10px;}
    .shelfscore-hero-number { font-size: 56px; }
}

/* ══════════════════════════════════════════
   BRANDS PAGE STYLES
   ══════════════════════════════════════════ */

.setup-banner {
    background: linear-gradient(135deg, #1A1A2E 0%, #0F3460 100%);
    border-radius: 12px; padding: 28px 32px; margin-bottom: 24px;
    color: white; position: relative; overflow: hidden;
}
.setup-banner::after {
    content: ''; position: absolute; top: -40px; right: -20px;
    width: 180px; height: 180px; border-radius: 50%;
    background: rgba(233,69,96,0.15);
}
.setup-banner h2 {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px;
    font-weight: 800; margin-bottom: 8px; position: relative; z-index: 1;
}
.setup-banner p {
    font-size: 14px; color: rgba(255,255,255,0.7); line-height: 1.6;
    max-width: 600px; position: relative; z-index: 1;
}
.setup-steps {
    display: flex; gap: 12px; margin-top: 20px; position: relative; z-index: 1; flex-wrap: wrap;
}
.setup-step {
    display: flex; align-items: center; gap: 8px; padding: 10px 16px;
    background: rgba(255,255,255,0.1); border-radius: 8px; font-size: 13px;
    font-weight: 600; transition: all 0.3s;
}
.setup-step.done { background: rgba(39,174,96,0.3); }
.setup-step.current { background: rgba(233,69,96,0.4); }
.setup-step .step-num {
    width: 24px; height: 24px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; font-size: 12px;
    font-weight: 800; background: rgba(255,255,255,0.2);
}
.setup-step.done .step-num { background: #27AE60; }
.setup-step.current .step-num { background: #E94560; }
.setup-done-banner {
    background: linear-gradient(135deg, #27AE60 0%, #2ECC71 100%);
    border-radius: 12px; padding: 24px 32px; margin-bottom: 24px;
    color: white; display: none; text-align: center;
}
.setup-done-banner h2 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.setup-done-banner p { font-size: 14px; opacity: 0.9; margin-bottom: 16px; }
.setup-done-banner .btn-go { background: white; color: #27AE60; border: none; padding: 12px 28px; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer; font-family: 'Plus Jakarta Sans', sans-serif; }
.setup-done-banner .btn-go:hover { opacity: 0.9; }

.quick-add-section { margin-bottom: 24px; }
.quick-add-section h3 {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px;
    font-weight: 700; margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.quick-add-section h3 .count-badge {
    background: var(--gray-200); color: var(--gray-600); font-size: 11px;
    padding: 2px 8px; border-radius: 10px; font-weight: 600;
}
.quick-add-section h3 .count-badge.has { background: rgba(39,174,96,0.15); color: #27AE60; }
.quick-add-row { display: flex; gap: 8px; align-items: flex-end; }
.quick-add-row .form-group { flex: 1; margin-bottom: 0; }
.quick-add-row .form-group label { font-size: 11px; margin-bottom: 3px; }
.quick-add-row .form-group input { padding: 10px 12px; font-size: 13px; }
.quick-add-row .btn { flex-shrink: 0; height: 42px; padding: 0 20px; font-size: 13px; }
.brand-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.brand-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.brand-chip.own { background: rgba(233,69,96,0.1); color: #E94560; }
.brand-chip.competitor { background: rgba(15,52,96,0.1); color: #0F3460; }
.brand-chip .remove { cursor: pointer; opacity: 0.6; font-size: 14px; line-height: 1; }
.brand-chip .remove:hover { opacity: 1; }

/* Brands header actions */
.brands-header-actions { display: flex; align-items: center; gap: 12px; }
.header-link { color: var(--gray-600); font-size: 13px; text-decoration: none; transition: color 0.2s; }
.header-link:hover { color: var(--primary); text-decoration: underline; }
.header-link-highlight { color: var(--primary); font-weight: 500; }
.header-link-highlight i { margin-right: 5px; display: inline-block; animation: bulb-shake 4s ease-in-out infinite; }
@keyframes bulb-shake {
    0%, 92%, 100% { transform: rotate(0deg); }
    93% { transform: rotate(-14deg); }
    94.5% { transform: rotate(12deg); }
    96% { transform: rotate(-10deg); }
    97.5% { transform: rotate(8deg); }
    99% { transform: rotate(-4deg); }
}
.header-link-highlight:hover i { animation: none; transform: scale(1.15); }
.header-separator { color: var(--gray-300); font-size: 13px; }

/* Mobile brand card list */
.brands-mobile-list { display: none; }
.brand-row {
    padding: 10px 12px; border-bottom: 1px solid var(--gray-100);
    border-left: 4px solid var(--gray-300);
}
.brand-row:last-child { border-bottom: none; }
.brand-row--own { border-left-color: var(--blue); }
.brand-row--comp { border-left-color: var(--warning); }
.brand-row--inactive { opacity: 0.45; }
.brand-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.brand-row-name {
    font-weight: 700; font-size: 14px; color: var(--primary);
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.inactive-tag {
    font-size: 9px; font-weight: 700; color: var(--gray-400);
    background: var(--gray-100); padding: 2px 5px; border-radius: 4px;
    margin-left: 6px; text-transform: uppercase; letter-spacing: 0.3px;
    vertical-align: middle; white-space: nowrap;
}
.brand-row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.brand-row-actions .btn-sm { padding: 4px 8px; font-size: 11px; }
.brand-row-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.5; }
.brand-legend {
    display: flex; gap: 16px; padding: 8px 12px;
    border-bottom: 1px solid var(--gray-100); margin-bottom: 2px;
}
.brand-legend-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600; color: var(--gray-500);
    text-transform: uppercase; letter-spacing: 0.3px;
}
.brand-legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.brand-legend-dot--own { background: var(--blue); }
.brand-legend-dot--comp { background: var(--warning); }

/* Import modal */
.import-dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50);
}
.import-dropzone:hover,
.import-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(233, 69, 96, 0.05);
}
.import-dropzone-icon { font-size: 32px; color: var(--gray-400); margin-bottom: 12px; }
.import-dropzone-text { color: var(--gray-600); font-size: 14px; line-height: 1.6; }
.import-dropzone-hint { color: var(--gray-400); font-size: 12px; margin-top: 8px; }
.import-template-link { display: inline-block; margin-top: 20px; color: var(--primary); font-size: 13px; text-decoration: none; }
.import-template-link:hover { text-decoration: underline; }
.import-preview { max-height: 280px; overflow-y: auto; border: 1px solid var(--gray-200); border-radius: 8px; margin: 16px 0; }
.import-preview table { width: 100%; font-size: 12px; border-collapse: collapse; }
.import-preview th {
    background: var(--gray-100); position: sticky; top: 0;
    padding: 10px 12px; text-align: left; font-weight: 600;
    color: var(--gray-700); border-bottom: 1px solid var(--gray-200);
}
.import-preview td {
    padding: 8px 12px; border-bottom: 1px solid var(--gray-100);
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.import-file-info {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; background: var(--gray-50); border-radius: 8px; margin-bottom: 16px;
}
.import-file-name { font-weight: 600; color: var(--primary); }
.import-file-change { color: var(--gray-500); font-size: 12px; cursor: pointer; }
.import-file-change:hover { color: var(--primary); text-decoration: underline; }
.import-warning {
    background: #FEF3C7; border-left: 4px solid #F59E0B;
    padding: 12px 16px; font-size: 13px; color: #92400E; border-radius: 4px; margin: 12px 0;
}
.import-success { text-align: center; padding: 24px; }
.import-success-icon {
    width: 48px; height: 48px; background: rgba(39, 174, 96, 0.15);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; color: #27AE60; font-size: 24px;
}
.import-success-count { font-size: 20px; font-weight: 700; color: #27AE60; margin-bottom: 4px; }
.import-success-detail { font-size: 13px; color: var(--gray-600); }

/* Guide modal */
.guide-section { margin-bottom: 24px; }
.guide-section:last-child { margin-bottom: 0; }
.guide-section-title { font-weight: 700; font-size: 13px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.guide-section-title.good { color: #27AE60; }
.guide-section-title.bad { color: #E94560; }
.guide-example {
    background: var(--gray-50); border-radius: 8px; padding: 14px 16px;
    font-size: 13px; line-height: 1.6; color: var(--gray-700);
    border-left: 3px solid var(--primary);
}
.guide-list { margin: 10px 0; padding-left: 18px; }
.guide-list li { margin-bottom: 6px; font-size: 13px; color: var(--gray-600); }
.guide-bad-examples { display: flex; flex-direction: column; gap: 6px; }
.guide-bad-example { font-size: 13px; color: var(--gray-600); }
.guide-bad-example code {
    background: rgba(233, 69, 96, 0.1); color: #E94560;
    padding: 2px 6px; border-radius: 4px; font-family: inherit;
}
.guide-intro { font-size: 14px; color: var(--gray-600); line-height: 1.6; margin-bottom: 20px; }

/* Brands mobile responsive */
@media (max-width: 768px) {
    .quick-add-row { flex-direction: column; }
    .quick-add-row .form-group input { width: 100%; box-sizing: border-box; }
    .quick-add-row .btn { width: 100%; }
    .setup-steps { flex-direction: column; }
    .setup-banner { padding: 20px 16px; }
    .setup-banner h2 { font-size: 18px; }
    .setup-banner::after { display: none; }
    .setup-done-banner { padding: 20px 16px; }
    .brand-chips { gap: 6px; }
    .brand-chip { font-size: 12px; padding: 5px 10px; }
    .brands-mobile-list { display: block; }
    #brandsTable { display: none !important; }
    .brands-header-actions { flex-direction: column; align-items: flex-start; gap: 8px; }
    .header-separator { display: none; }
    .header-link { font-size: 12px; }
}

/* ══════════════════════════════════════════
   USERS PAGE STYLES
   ══════════════════════════════════════════ */

.self-badge { font-size: 10px; background: rgba(15,52,96,0.1); color: var(--blue); padding: 2px 8px; border-radius: 10px; margin-left: 8px; font-weight: 600; }
.users-mobile-list { display: none; }

/* User row (mobile) */
.user-row { padding: 10px 12px; border-bottom: 1px solid var(--gray-100);}
.user-row:last-child { border-bottom: none; }
.user-row--inactive { border-left-color: var(--gray-300); opacity: 0.5; }
.user-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.user-row-name { font-weight: 700; font-size: 14px; color: var(--primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-row-actions { display: flex; gap: 4px; flex-shrink: 0; margin-top: 6px; }
.user-row-actions .btn-sm { padding: 4px 8px; font-size: 11px; }
.user-row-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.5; }

/* Tabs */
.usr-panel { display: none; }
.usr-panel.active { display: block; }

/* Panel header */
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Merchandiser filters */
.merch-filters { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.merch-filters select { padding: 8px 12px; border: 1px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 13px; min-width: 160px; }

/* Tag badges */
.tag-badge { display: inline-block; background: var(--gray-100); color: var(--gray-600); padding: 2px 8px; border-radius: 10px; font-size: 11px; margin-right: 4px; margin-bottom: 2px; }
.tag-badge.tag-empty { background: none; color: var(--gray-400); font-style: italic; }

/* Tag selector */
.tag-selector { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 12px; font-size: 12px; cursor: pointer; border: 1px solid var(--gray-200); background: var(--white); transition: all 0.2s; }
.tag-chip:hover { border-color: var(--accent); }
.tag-chip.selected { background: var(--accent); color: white; border-color: var(--accent); }
.tag-chip .remove { font-size: 14px; margin-left: 2px; }

/* Tags modal */
.tags-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; margin-bottom: 16px; }
.tag-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--gray-50); border-radius: var(--radius-sm); }
.tag-item-name { font-size: 14px; font-weight: 500; }
.tag-add-row { display: flex; gap: 8px; }
.tag-add-row input { flex: 1; }

/* Import zone */
.import-zone { border: 2px dashed var(--gray-300); border-radius: var(--radius); padding: 40px; text-align: center; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.import-zone:hover, .import-zone.dragover { border-color: var(--accent); background: rgba(233,69,96,0.03); }
.import-zone-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.import-zone-text { font-size: 14px; color: var(--gray-500); margin-bottom: 8px; }
.import-zone-link { color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 500; }
.import-preview { margin-top: 16px; }
.import-preview-summary { display: flex; gap: 16px; margin-bottom: 12px; }
.import-stat { text-align: center; padding: 12px 20px; background: var(--gray-50); border-radius: var(--radius-sm); }
.import-stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.import-stat-label { font-size: 12px; color: var(--gray-500); }
.import-stat.success .import-stat-value { color: var(--success); }
.import-stat.warning .import-stat-value { color: var(--warning); }
.import-new-tags { margin-top: 12px; padding: 12px; background: #FFF9E6; border-radius: var(--radius-sm); }
.import-new-tags-title { font-size: 12px; font-weight: 600; color: var(--warning); margin-bottom: 6px; }

/* Users mobile responsive */
@media (max-width: 768px) {
    .users-mobile-list { display: block; }
    #usersTable, #merchTable { display: none !important; }
    .panel-actions { width: 100%; }
    .panel-actions .btn { flex: 1; font-size: 12px; padding: 8px 12px; }
    .merch-filters { flex-direction: column; }
    .merch-filters select { width: 100%; }
}

/* ══════════════════════════════════════════
   REPORTS PAGE STYLES
   ══════════════════════════════════════════ */

.reports-mobile-list, .history-mobile-list { display: none; }

/* Report row (mobile) */
.rpt-row { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); border-left: 4px solid var(--gray-300); }
.rpt-row:last-child { border-bottom: none; }
.rpt-row--active { border-left-color: var(--blue); }
.rpt-row--paused { border-left-color: var(--warning); opacity: 0.7; }
.rpt-row--inactive { border-left-color: var(--gray-300); opacity: 0.5; }
.rpt-row--sent { border-left-color: var(--blue); }
.rpt-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rpt-row-name { font-weight: 700; font-size: 14px; color: var(--primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpt-row-actions { display: flex; gap: 4px; flex-shrink: 0; margin-top: 6px; }
.rpt-row-actions .btn-sm { padding: 4px 8px; font-size: 11px; }
.rpt-row-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.5; }

/* Reports mobile responsive */
@media (max-width: 768px) {
    #reportsTable, #historyTable { display: none !important; }
    .reports-mobile-list, .history-mobile-list { display: block; }
}

/* ══════════════════════════════════════════
   HELP PAGE STYLES
   ══════════════════════════════════════════ */

.help-grid { display: grid; grid-template-columns: 260px 1fr; gap: 0; min-height: calc(100vh - 60px); }
.help-nav { background: var(--white); border-right: 1px solid var(--gray-200); padding: 24px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.help-nav-title { padding: 0 20px 16px; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px; font-weight: 800; color: var(--primary); }
.help-nav a { display: block; padding: 10px 20px; color: var(--gray-600); text-decoration: none; font-size: 13px; font-weight: 500; border-left: 3px solid transparent; transition: all .15s; }
.help-nav a:hover { color: var(--primary); background: var(--gray-50); }
.help-nav a.active { color: var(--accent); border-left-color: var(--accent); background: rgba(233,69,96,.04); font-weight: 600; }
.help-nav .nav-group { padding: 16px 20px 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400); font-weight: 700; }
.help-content { padding: 40px 48px; max-width: 820px; }
.help-section { display: none; }
.help-section.active { display: block; }
.help-section h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800; color: var(--primary); margin: 0 0 8px; }
.help-section .subtitle { color: var(--gray-500); font-size: 14px; margin-bottom: 32px; }
.help-section h2 { font-size: 18px; font-weight: 700; color: var(--primary); margin: 32px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--gray-100); }
.help-section h3 { font-size: 15px; font-weight: 600; color: var(--primary); margin: 20px 0 8px; }
.help-section p { color: var(--gray-700); font-size: 14px; line-height: 1.8; margin: 0 0 16px; }
.help-section a:not(.nav-item) { color: var(--primary); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(15,52,96,0.25); transition: border-color 0.2s; }
.help-section a:not(.nav-item):hover { border-bottom-color: var(--primary); }
.help-section ul { color: var(--gray-700); font-size: 14px; line-height: 1.8; margin: 0 0 16px; padding-left: 20px; }
.help-section ul li { margin-bottom: 6px; }

/* Step cards */
.step-card { display: flex; gap: 16px; padding: 20px; background: var(--gray-50); border-radius: 12px; margin: 16px 0; border-left: 4px solid var(--accent); }
.step-num { width: 40px; height: 40px; background: var(--accent); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; flex-shrink: 0; }
.step-content h3 { font-size: 15px; font-weight: 700; color: var(--primary); margin: 0 0 4px; }
.step-content p { margin: 0; font-size: 13px; color: var(--gray-600); }

/* Tip boxes */
.tip-box { padding: 16px 20px; border-radius: 8px; margin: 16px 0; font-size: 13px; line-height: 1.7; }
.tip-box.info { background: #E3F2FD; border-left: 4px solid #667EEA; color: #1A237E; }
.tip-box.warning { background: #FFF3E0; border-left: 4px solid #FF9800; color: #E65100; }
.tip-box.success { background: #E8F5E9; border-left: 4px solid #4CAF50; color: #1B5E20; }

/* FAQ accordion */
.faq-item { border: 1px solid var(--gray-200); border-radius: 8px; margin: 8px 0; overflow: hidden; }
.faq-q { padding: 14px 16px; font-weight: 600; font-size: 14px; color: var(--primary); cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: var(--gray-50); }
.faq-q:hover { background: var(--gray-100); }
.faq-q span:last-child { transition: transform 0.2s; }
.faq-item.open .faq-q span:last-child { transform: rotate(90deg); }
.faq-a { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height .3s ease, padding .3s ease; font-size: 13px; color: var(--gray-600); line-height: 1.7; }
.faq-item.open .faq-a { max-height: 500px; padding: 16px; }

/* WhatsApp flow demo */
.wa-flow { background: var(--gray-50); border-radius: 12px; padding: 20px; margin: 16px 0; }
.wa-msg { display: flex; margin: 8px 0; gap: 8px; align-items: flex-start; }
.wa-msg.bot .wa-bubble { background: #DCF8C6; border-radius: 0 12px 12px 12px; padding: 8px 12px; font-size: 12px; max-width: 70%; color: #1A1A2E; }
.wa-msg.user .wa-bubble { background: var(--white); border-radius: 12px 0 12px 12px; padding: 8px 12px; font-size: 12px; max-width: 70%; color: #1A1A2E; margin-left: auto; }

/* Help photo comparison */
.help-photo-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.help-photo-example { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid var(--gray-200); }
.help-photo-example img { width: 100%; height: 200px; object-fit: cover; display: block; }
.help-photo-label { position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 12px; font-size: 12px; font-weight: 700; text-align: center; }
.help-photo-label--good { background: rgba(39,174,96,.85); color: #fff; }
.help-photo-label--bad { background: rgba(231,76,60,.85); color: #fff; }
.help-photo-good { border-color: #27AE60; }
.help-photo-bad { border-color: #E74C3C; }

/* Changelog timeline */
.changelog-timeline { display: flex; flex-direction: column; gap: 0; }
.changelog-release {
    padding: 20px 0;
    border-bottom: 1px solid var(--gray-200);
    position: relative;
}
.changelog-release:last-child { border-bottom: none; }
.changelog-release--latest {
    background: rgba(233,69,96,.03);
    border-radius: var(--radius);
    padding: 20px;
    border-bottom: none;
    margin-bottom: 8px;
}
.changelog-release-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.changelog-release-version {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
}
.changelog-release--latest .changelog-release-version {
    font-size: 18px;
}
.changelog-release-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
}
.changelog-release-date {
    font-size: 12px;
    color: var(--gray-400);
    margin-left: auto;
}
.changelog-release-notes {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.changelog-release-notes li {
    font-size: 13px;
    color: var(--gray-600);
    line-height: 1.5;
    padding-left: 16px;
    position: relative;
}
.changelog-release-notes li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gray-300);
}
.changelog-release--latest .changelog-release-notes li::before {
    background: var(--accent);
}

/* Metric grid */
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 16px 0; }
.metric-item { background: var(--gray-50); border-radius: 8px; padding: 14px; border-left: 3px solid var(--accent); }
.metric-item h4 { font-size: 13px; font-weight: 700; color: var(--primary); margin: 0 0 4px; }
.metric-item p { font-size: 12px; color: var(--gray-600); margin: 0; line-height: 1.5; }

/* Help mobile nav */
.help-mobile-nav { display: none; }

/* Help mobile responsive */
@media (max-width: 768px) {
    .help-grid { grid-template-columns: 1fr; }
    .help-nav { display: none; }
    .help-content { padding: 20px; padding-top: 10px; }
    .help-page-header .page-title { display: none; }
    .help-mobile-nav { display: block; }
    .help-mobile-nav select {
        width: 100%; height: 44px; padding: 0 12px; border-radius: var(--radius-sm);
        border: 2px solid var(--gray-200); font-size: 14px; font-weight: 600;
        font-family: 'DM Sans', sans-serif; background: white; color: var(--primary);
    }
    .help-section h1 { font-size: 22px; }
    .step-card { flex-direction: column; gap: 12px; }
}

@media (max-width: 480px) {
    .metric-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════
   BILLING PAGE STYLES
   ══════════════════════════════════════════ */

/* Plan card - full width with status badge inside */
.plan-card { position: relative; background: linear-gradient(135deg, var(--primary) 0%, var(--blue) 100%); color: white; padding: 28px; border-radius: var(--radius); margin-bottom: 24px; }
.plan-card-full { width: 100%; }
.plan-card .plan-name { font-size: 14px; opacity: .8; margin-bottom: 4px; }
.plan-card .plan-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.plan-card .plan-price { font-size: 15px; opacity: .9; margin-bottom: 16px; }
.plan-card .plan-usage { display: flex; gap: 32px; flex-wrap: wrap; }
.plan-card .usage-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 700; }
.plan-card .usage-label { font-size: 12px; opacity: .7; }
.plan-card .plan-status { position: absolute; top: 16px; right: 16px; }
.plan-status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; background: rgba(255,255,255,0.95); border-radius: 8px; font-size: 12px; font-weight: 600; }
.plan-status.active { color: var(--success); }
.plan-status.trial { color: var(--blue); }
.plan-status.suspended { color: var(--danger); }
.plan-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.billing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.info-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--gray-200); padding: 24px; }
.info-card .card-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.info-row { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: 13px; color: var(--gray-500); }
.info-value { font-size: 13px; font-weight: 600; color: var(--primary); text-align: right; }

/* Trial banner */
.trial-banner { display: none; margin-bottom: 24px; border-radius: var(--radius); overflow: hidden; }
.trial-banner-inner { display: flex; align-items: center; gap: 20px; padding: 18px 24px; flex-wrap: wrap; background: linear-gradient(135deg, rgba(243,156,18,.10), rgba(233,69,96,.08)); border: 1px solid rgba(243,156,18,.3); border-radius: var(--radius); }
.trial-banner-icon { font-size: 32px; flex-shrink: 0; color: var(--warning); }
.trial-banner-body { flex: 1; min-width: 200px; }
.trial-banner-body h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; font-weight: 700; color: var(--warning); margin-bottom: 4px; }
.trial-banner-body p { font-size: 13px; color: var(--gray-600); line-height: 1.4; margin: 0; }
.trial-banner-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.trial-banner-days { display: flex; flex-direction: column; align-items: center; background: rgba(243,156,18,.12); border-radius: var(--radius-sm); padding: 8px 16px; min-width: 64px; }
.trial-banner-days-num { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 28px; color: var(--warning); line-height: 1; }
.trial-banner-days-label { font-size: 11px; color: var(--gray-500); text-transform: uppercase; font-weight: 600; letter-spacing: .5px; }

/* Pending downgrade banner */
.pending-downgrade-banner { display: none; margin-bottom: 24px; padding: 18px 24px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(243,156,18,.08), rgba(231,76,60,.06)); border: 1px solid rgba(243,156,18,.25); }
.pending-downgrade-banner .pdb-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pending-downgrade-banner .pdb-icon { font-size: 28px; flex-shrink: 0; color: var(--warning); }
.pending-downgrade-banner .pdb-body { flex: 1; min-width: 200px; }
.pending-downgrade-banner .pdb-body h3 { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700; color: var(--warning); margin: 0 0 4px; }
.pending-downgrade-banner .pdb-body p { font-size: 13px; color: var(--gray-600); margin: 0; line-height: 1.4; }
.pending-downgrade-banner .btn-cancel-dg { flex-shrink: 0; }

/* Invoice table */
.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table th { text-align: left; padding: 12px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-500); font-weight: 600; border-bottom: 2px solid var(--gray-200); }
.invoice-table td { padding: 14px 16px; font-size: 13px; border-bottom: 1px solid var(--gray-100); }
.invoice-table tr:hover { background: var(--gray-50); }
.invoice-status { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.invoice-status.paid { background: rgba(39,174,96,.1); color: var(--success); }
.invoice-status.pending { background: rgba(243,156,18,.1); color: var(--warning); }

/* Plan options */
.plan-option { border: 2px solid var(--gray-200); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: all .2s; }
.plan-option:hover { border-color: var(--accent); }
.plan-option.selected { border-color: var(--accent); background: rgba(233,69,96,.02); }
.plan-option.current-plan { border-color: var(--gray-300); opacity: .6; cursor: default; }
.plan-option .name { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.plan-option .price { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.plan-option .price span { font-size: 13px; font-weight: 500; color: var(--gray-500); }
.plan-option ul { list-style: none; font-size: 12px; color: var(--gray-600); padding: 0; margin: 0; }
.plan-option ul li { padding: 4px 0; }
.plan-option ul li::before { content: '\2713'; color: var(--success); margin-right: 6px; }

/* Discount box */
.discount-box { margin-top: 16px; padding: 16px; background: var(--gray-50); border-radius: 8px; border: 1px dashed var(--gray-300); }
.discount-box label { font-size: 12px; font-weight: 600; color: var(--gray-600); display: block; margin-bottom: 6px; }
.discount-row { display: flex; gap: 8px; }
.discount-row input { flex: 1; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 14px; font-family: 'DM Sans', sans-serif; text-transform: uppercase; }
.discount-row button { padding: 8px 16px; border: none; background: var(--primary); color: white; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px; white-space: nowrap; }
.discount-row button:hover { opacity: .9; }
.discount-result { margin-top: 8px; font-size: 13px; padding: 8px 12px; border-radius: 6px; }
.discount-result.valid { background: rgba(39,174,96,.1); color: var(--success); border: 1px solid rgba(39,174,96,.2); }
.discount-result.invalid { background: rgba(231,76,60,.08); color: var(--danger); border: 1px solid rgba(231,76,60,.15); }
.discount-result .original { text-decoration: line-through; color: var(--gray-400); margin-right: 6px; }

/* Proration summary */
.proration-summary { background: var(--gray-50); border-radius: 8px; padding: 16px; margin: 16px 0; font-size: 13px; line-height: 1.8; }
.proration-summary .pro-line { display: flex; justify-content: space-between; color: var(--gray-600); }
.proration-summary .pro-total { display: flex; justify-content: space-between; font-weight: 700; font-size: 15px; color: var(--primary); border-top: 1px solid var(--gray-300); padding-top: 8px; margin-top: 8px; }
.proration-summary .pro-next { font-size: 12px; color: var(--gray-500); margin-top: 8px; text-align: right; }

/* Conflict list */
.conflict-list { margin: 16px 0; }
.conflict-item { padding: 12px 16px; background: rgba(231,76,60,.06); border: 1px solid rgba(231,76,60,.15); border-radius: 8px; margin-bottom: 8px; font-size: 13px; color: var(--danger); display: flex; align-items: center; gap: 8px; }
.conflict-item::before { content: ''; flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }

/* Comparison table */
.comparison-table { width: 100%; font-size: 13px; margin: 12px 0; }
.comparison-table th { text-align: left; padding: 8px 0; font-size: 11px; text-transform: uppercase; color: var(--gray-500); letter-spacing: .5px; border-bottom: 1px solid var(--gray-200); }
.comparison-table td { padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.comparison-table .loss { color: var(--danger); font-weight: 600; }
.comparison-table .same { color: var(--gray-400); }

/* Loss warning */
.loss-warning { background: rgba(243,156,18,.08); border: 1px solid rgba(243,156,18,.2); border-radius: 8px; padding: 14px 16px; margin: 16px 0; font-size: 13px; line-height: 1.5; color: var(--gray-700); }
.loss-warning strong { color: var(--warning); }

/* Downgrade checkbox */
.dg-checkbox { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0; font-size: 13px; color: var(--gray-600); line-height: 1.4; }
.dg-checkbox input { margin-top: 2px; flex-shrink: 0; }

/* Payment success modal */
.payment-success-modal .modal { text-align: center; max-width: 440px; }
.payment-success-modal .psm-icon { width: 72px; height: 72px; margin: 0 auto 20px; border-radius: 50%; background: var(--success); display: flex; align-items: center; justify-content: center; animation: psm-pop .5s cubic-bezier(.175,.885,.32,1.275); }
.payment-success-modal .psm-icon svg { width: 36px; height: 36px; stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.payment-success-modal .psm-icon svg .check-path { stroke-dasharray: 48; stroke-dashoffset: 48; animation: psm-draw .4s .3s ease forwards; }
.payment-success-modal .psm-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.payment-success-modal .psm-plan { font-size: 15px; color: var(--accent); font-weight: 700; margin-bottom: 16px; }
.payment-success-modal .psm-features { text-align: left; list-style: none; padding: 0; margin: 0 0 20px; font-size: 13px; color: var(--gray-600); }
.payment-success-modal .psm-features li { padding: 6px 0; border-bottom: 1px solid var(--gray-100); }
.payment-success-modal .psm-features li::before { content: '\2713'; color: var(--success); font-weight: 700; margin-right: 8px; }
@keyframes psm-pop { 0% { transform: scale(0); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes psm-draw { to { stroke-dashoffset: 0; } }

/* Invoices mobile list */
.invoices-mobile-list { display: none; }
.inv-row { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); border-left: 4px solid var(--gray-300); }
.inv-row:last-child { border-bottom: none; }
.inv-row--paid { border-left-color: var(--success); }
.inv-row--pending { border-left-color: var(--warning); }
.inv-row-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.inv-row-name { font-weight: 700; font-size: 14px; color: var(--primary); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-row-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.5; }

/* Billing mobile responsive */
@media (max-width: 900px) {
    .billing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .plan-card { padding: 20px; }
    .plan-card .plan-title { font-size: 22px; }
    .plan-card .plan-usage { gap: 20px; }
    .plan-card .plan-status { top: 12px; right: 12px; padding: 6px 10px; font-size: 11px; }
    .trial-banner-inner { flex-direction: column; text-align: center; }
    .trial-banner-right { justify-content: center; }
    #plansGrid { grid-template-columns: 1fr !important; }
    #invoicesContainer .invoice-table { display: none !important; }
    .invoices-mobile-list { display: block; }
    .discount-row { flex-direction: column; }
    .pending-downgrade-banner .pdb-inner { flex-direction: column; text-align: center; }
}

/* ══════════════════════════════════════════
   SUPERADMIN PAGE STYLES
   ══════════════════════════════════════════ */

.admin-tabs { display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-tab {
    padding: 10px 20px; background: var(--gray-100); border: none; border-radius: 8px;
    font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-600);
    font-family: 'DM Sans', sans-serif; transition: all .2s;
}
.admin-tab:hover { background: var(--gray-200); }
.admin-tab.active { background: #E94560; color: white; }
.admin-panel { display: none; }
.admin-panel.active { display: block; }

.admin-panel .kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.admin-panel .kpi-card {
    background: var(--white); border-radius: var(--radius); padding: 18px 22px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
    display: flex; align-items: center; gap: 14px;
}
.admin-panel .kpi-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.admin-panel .kpi-icon.blue { background: rgba(15,52,96,.1); color: var(--blue); }
.admin-panel .kpi-icon.accent { background: rgba(233,69,96,.1); color: var(--accent); }
.admin-panel .kpi-icon.green { background: rgba(39,174,96,.1); color: var(--success); }
.admin-panel .kpi-icon.warning { background: rgba(243,156,18,.1); color: var(--warning); }
.admin-panel .kpi-icon.purple { background: rgba(142,68,173,.1); color: #8e44ad; }
.admin-panel .kpi-value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1; }
.admin-panel .kpi-label { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.tenant-row, .user-row { padding: 12px 0; border-bottom: 1px solid var(--gray-100); }
.tenant-row:last-child, .user-row:last-child { border-bottom: none; }
.row-top { display: flex; align-items: flex-start; gap: 12px; }
.row-top .avatar { margin-top: 1px; }
.row-badges { display: flex; gap: 6px; margin-top: 6px; margin-left: 50px; }
.avatar {
    width: 38px; height: 38px; border-radius: 10px; background: var(--blue);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; color: white; flex-shrink: 0;
}
.info { flex: 1; min-width: 0; }
.info-name { font-size: 14px; font-weight: 600; color: var(--primary); }
.info-meta { font-size: 12px; color: var(--gray-500); display: flex; gap: 10px; margin-top: 2px; flex-wrap: wrap; }

.badge.trial { background: rgba(15,52,96,.1); color: var(--blue); }
.badge.active { background: rgba(39,174,96,.1); color: var(--success); }
.badge.suspended { background: rgba(231,76,60,.1); color: var(--danger); }
.badge.cancelled { background: rgba(173,181,189,.2); color: var(--gray-500); }
.badge.grace_period { background: rgba(243,156,18,.1); color: var(--warning); }
.badge.plan { background: rgba(142,68,173,.1); color: #8e44ad; }
.badge.own { background: rgba(15,52,96,.1); color: var(--blue); }
.badge.competitor { background: rgba(243,156,18,.1); color: var(--warning); }
.badge.inactive { background: var(--gray-100); color: var(--gray-500); }

.action-btns { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.trial-warning { background: rgba(231,76,60,.1); color: var(--danger); padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; }

.modal-wide { max-width: 700px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.detail-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-500); font-weight: 600; margin-bottom: 3px; }
.detail-value { font-size: 13px; color: var(--primary); font-weight: 500; }
.detail-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--gray-200); }
.detail-section-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }

.mini-table { width: 100%; font-size: 12px; }
.mini-table th { text-align: left; padding: 5px 6px; color: var(--gray-500); font-weight: 600; font-size: 10px; text-transform: uppercase; border-bottom: 1px solid var(--gray-200); }
.mini-table td { padding: 6px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }

.prompt-editor { width: 100%; min-height: 300px; font-family: monospace; font-size: 13px; padding: 16px; border: 1px solid var(--gray-200); border-radius: var(--radius); resize: vertical; }
.prompt-preview { background: var(--gray-50); padding: 16px; border-radius: var(--radius); font-family: monospace; font-size: 12px; white-space: pre-wrap; max-height: 400px; overflow: auto; }

/* Signup rows */
.signup-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.signup-row:last-child { border-bottom: none; }
.signup-avatar { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: white; }
.signup-info { flex: 1; min-width: 0; }
.signup-name { font-size: 13px; font-weight: 600; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signup-email { font-size: 12px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signup-meta { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.signup-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: .3px; }
.signup-badge.active { background: rgba(46,204,113,.12); color: var(--success); }
.signup-badge.trial { background: rgba(15,52,96,.1); color: var(--blue); }
.signup-badge.suspended { background: rgba(231,76,60,.1); color: var(--danger); }
.signup-badge.inactive { background: var(--gray-100); color: var(--gray-500); }
.signup-plan { font-size: 11px; color: var(--gray-400); }
.signup-date { font-size: 11px; color: var(--gray-400); }

/* Analysis rows */
.analysis-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.analysis-row:last-child { border-bottom: none; }
.analysis-thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--gray-100); cursor: pointer; transition: opacity .15s; }
.analysis-thumb:hover { opacity: .8; }
.analysis-info { flex: 1; min-width: 0; }
.analysis-tenant { font-size: 13px; font-weight: 600; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.analysis-store { font-size: 12px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.analysis-meta { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
.analysis-score { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-weight: 700; }
.analysis-date { font-size: 11px; color: var(--gray-400); }

.pag-btn { padding: 5px 11px; border: 1px solid var(--gray-200); border-radius: 6px; background: white; font-size: 12px; cursor: pointer; font-family: 'DM Sans', sans-serif; }
.pag-btn:hover { background: var(--gray-50); }
.pag-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.pag-btn:disabled { opacity: .4; cursor: default; }

/* Config subtabs */
.config-subtabs { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: 8px; margin-bottom: 20px; }
.config-subtab { padding: 8px 16px; border: none; background: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-500); font-family: 'DM Sans', sans-serif; transition: all .15s; }
.config-subtab:hover { color: var(--primary); }
.config-subtab.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }
.config-subpanel { display: none; }
.config-subpanel.active { display: block; }

/* i18n subtabs */
.i18n-subtabs { display: flex; gap: 4px; background: var(--gray-100); padding: 4px; border-radius: 8px; margin-bottom: 20px; }
.i18n-subtab { padding: 8px 16px; border: none; background: none; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-500); font-family: 'DM Sans', sans-serif; transition: all .15s; }
.i18n-subtab:hover { color: var(--primary); }
.i18n-subtab.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }
.i18n-subpanel { display: none; }
.i18n-subpanel.active { display: block; }

/* Impersonate section */
.imp-section { background: var(--white); border-radius: var(--radius); padding: 20px; border: 1px solid var(--gray-200); margin-bottom: 20px; }
.imp-section-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; font-weight: 700; color: var(--primary); margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.imp-user-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.imp-user-row:hover { background: var(--gray-50); }
.imp-search { width: 100%; padding: 10px 14px; border: 2px solid var(--gray-200); border-radius: 8px; font-size: 13px; font-family: 'DM Sans', sans-serif; margin-bottom: 12px; }
.imp-search:focus { outline: none; border-color: var(--accent); }
.imp-results { max-height: 320px; overflow-y: auto; }
.imp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* i18n stats */
.stat-grid-5 { display: flex; gap: 10px; margin-bottom: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.stat-mini { background: white; border-radius: 8px; padding: 10px 8px; border: 1px solid var(--gray-200); text-align: center; flex: 0 0 auto; min-width: 100px; }
.stat-mini .sm-flag { font-size: 18px; }
.stat-mini .sm-count { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 800; color: var(--primary); }
.stat-mini .sm-label { font-size: 10px; color: var(--gray-500); text-transform: uppercase; }
.stat-mini .sm-miss { color: var(--accent); font-size: 11px; font-weight: 600; }

/* Country cards */
.cc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.cc-card { background: white; border-radius: 12px; padding: 20px; border: 1px solid var(--gray-200); }
.cc-hdr { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cc-flag { font-size: 32px; }
.cc-name { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700; }
.cc-meta { font-size: 12px; color: var(--gray-400); }
.cc-details { font-size: 13px; color: var(--gray-600); }
.cc-row { display: flex; justify-content: space-between; padding: 4px 0; }

/* Translation rows */
.tr-row { display: grid; grid-template-columns: 180px 1fr 1fr 64px; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); align-items: start; }
.tr-row:hover { background: var(--gray-50); margin: 0 -12px; padding: 10px 12px; border-radius: 6px; }
.tr-key { font-size: 11px; font-weight: 600; color: var(--blue); font-family: monospace; word-break: break-all; padding-top: 6px; }
.tr-key .ctx { font-size: 10px; color: var(--gray-400); display: block; font-family: 'DM Sans', sans-serif; font-weight: 400; }
.tr-in { width: 100%; padding: 7px 10px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 13px; font-family: 'DM Sans', sans-serif; resize: vertical; min-height: 34px; }
.tr-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(233,69,96,.1); }
.tr-in.changed { border-color: var(--warning); background: #FFFDE7; }
.tr-in.miss { border-color: var(--accent); background: #FFF5F5; }
.tr-hdr { display: grid; grid-template-columns: 180px 1fr 1fr 64px; gap: 8px; padding: 8px 0; border-bottom: 2px solid var(--gray-200); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-500); font-weight: 600; }

.i18n-fb { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.i18n-fb input, .i18n-fb select { padding: 7px 12px; border: 2px solid var(--gray-200); border-radius: 8px; font-size: 13px; font-family: 'DM Sans', sans-serif; }
.i18n-fb input:focus, .i18n-fb select:focus { outline: none; border-color: var(--accent); }
.i18n-fb input { flex: 1; min-width: 180px; }
.i18n-pag { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.i18n-pag button { padding: 5px 11px; border: 1px solid var(--gray-200); border-radius: 6px; background: white; font-size: 12px; cursor: pointer; }
.i18n-pag button.active { background: var(--accent); color: white; border-color: var(--accent); }

/* Pricing table */
.pr-tbl { width: 100%; font-size: 13px; border-collapse: collapse; }
.pr-tbl th { text-align: left; padding: 8px; font-size: 10px; text-transform: uppercase; color: var(--gray-500); border-bottom: 2px solid var(--gray-200); }
.pr-tbl td { padding: 8px; border-bottom: 1px solid var(--gray-100); }
.pr-tbl input, .pr-tbl select { padding: 6px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 13px; font-family: 'DM Sans', sans-serif; }

/* Superadmin mobile */
@media (max-width: 1024px) {
    .content-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .imp-form-grid { grid-template-columns: 1fr; }
    .tr-row, .tr-hdr { grid-template-columns: 120px 1fr 64px; }
    .tr-row > :nth-child(3), .tr-hdr > :nth-child(3) { display: none; }
    .tenant-row, .user-row { padding: 10px 0; }
    .row-top { gap: 10px; }
    .row-top .avatar { width: 32px; height: 32px; font-size: 13px; border-radius: 8px; }
    .row-badges { margin-left: 42px; margin-top: 4px; }
    .info-name { font-size: 13px; }
    .info-meta { font-size: 11px; gap: 6px; }
    .action-btns .btn-sm { padding: 4px 8px; font-size: 11px; }
    .row-badges .badge { font-size: 10px; padding: 2px 8px; }
    .admin-tabs {
        position: sticky; top: 0; z-index: 10;
        background: var(--bg); margin: 0 -16px 24px; padding: 8px 16px;
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
    .admin-tab { flex-shrink: 0; padding: 8px 14px; font-size: 12px; }
    .config-subtabs, .i18n-subtabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .config-subtab, .i18n-subtab { flex-shrink: 0; padding: 6px 12px; font-size: 12px; }
    .card { padding: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .admin-panel .kpi-grid { display: flex !important; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 10px; padding-bottom: 4px; }
    .admin-panel .kpi-card { flex: 0 0 auto; min-width: 140px; padding: 12px 14px; gap: 10px; }
    .admin-panel .kpi-value { font-size: 20px; }
    .detail-grid { grid-template-columns: 1fr; }
    .modal, .modal-wide { max-width: calc(100vw - 24px); margin: 12px; padding: 20px; }
    .imp-section { padding: 14px; }
    .i18n-fb { flex-direction: column; }
    .i18n-fb input, .i18n-fb select { width: 100%; min-width: 0; }
    .mini-table { min-width: 500px; }
    .pr-tbl { font-size: 12px; min-width: 500px; }
    .pr-tbl input, .pr-tbl select { font-size: 12px; padding: 4px 6px; }
    .cc-grid { grid-template-columns: 1fr; }
    .cc-card { padding: 14px; }
    .prompt-editor { min-height: 200px; }
    .prompt-preview { max-height: 250px; font-size: 11px; }
}

@media (max-width: 480px) {
    .info-meta { flex-direction: column; gap: 2px; }
}

/* ══════════════════════════════════════════════════════════════════
   FINANZAS (Financial Copilot)
   ══════════════════════════════════════════════════════════════════ */

.fin-tabs { display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap; }
.fin-tab { padding: 10px 20px; background: var(--gray-100); border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-600); font-family: 'DM Sans', sans-serif; transition: all .2s; }
.fin-tab:hover { background: var(--gray-200); }
.fin-tab.active { background: #E94560; color: white; }
.fin-panel { display: none; }
.fin-panel.active { display: block; }

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-number { font-size: 28px; font-weight: 800; }
.stat-label { font-size: 12px; color: #888; margin-top: 4px; }

.fin-delta { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-left: 6px; }
.fin-delta.pos { color: #16a34a; background: #f0fdf4; }
.fin-delta.neg { color: #dc2626; background: #fef2f2; }
.fin-cost-bar { height: 14px; border-radius: 4px; min-width: 2px; }
.fin-cost-expandable { cursor: pointer; }
.fin-cost-expandable:hover { background: var(--gray-50); }
.fin-cost-chevron { font-size: 10px; color: var(--gray-400); transition: transform 0.15s; margin-right: 4px; }
.fin-cost-sub td { border-top: none !important; }

.fin-upgrade-card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 12px; border-left: 4px solid var(--primary); }
.fin-upgrade-card h5 { margin: 0 0 8px; font-size: 14px; }
.fin-upgrade-card .fin-detail { font-size: 12px; color: #666; margin: 4px 0; }

.fin-ai-card { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 16px; }
.fin-ai-card h5 { margin: 0 0 10px; font-size: 14px; color: var(--primary); }

.fin-priority { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.fin-priority.high { background: #fef2f2; color: #dc2626; }
.fin-priority.medium { background: #fffbeb; color: #d97706; }
.fin-priority.low { background: #f0fdf4; color: #16a34a; }

.fin-campaign-card { background: white; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border-left: 4px solid #667EEA; }
.fin-sim-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.fin-sim-label { font-size: 13px; color: #666; }
.fin-sim-value { font-size: 14px; font-weight: 700; }

.fin-history-chart { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; }

@media (max-width: 768px) {
    .fin-tabs {
        position: sticky; top: 0; z-index: 79;
        background: var(--bg); margin: 0 -16px 24px; padding: 8px 16px;
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
    .fin-tab { flex-shrink: 0; padding: 8px 14px; font-size: 12px; }
    .stat-grid { display: flex !important; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 10px !important; padding-bottom: 4px; }
    .stat-card { flex: 0 0 auto; min-width: 120px; padding: 14px; }
    .stat-number { font-size: 22px; }
    .stat-label { font-size: 11px; }
    .fin-grid-2col { display: block !important; }
    .fin-grid-2col > div { margin-bottom: 20px; }
    .fin-panel { overflow-x: hidden; max-width: 100%; }
    .fin-campaign-grid { display: block !important; }
    .fin-campaign-grid > div { margin-bottom: 16px; }
    .fin-advisor-header { flex-direction: column !important; gap: 12px; align-items: flex-start !important; }
    .fin-sim-row { gap: 4px; }
    .fin-delta { font-size: 11px; padding: 1px 6px; }
    .fin-ai-card { padding: 14px; }
    .fin-upgrade-card { padding: 14px; }
    .fin-campaign-card { padding: 12px; }
}

@media (max-width: 480px) {
    .stat-card { min-width: 100px; }
    .stat-number { font-size: 20px; }
}

/* ══════════════════════════════════════════════════════════════════
   FACTURAS (Invoice Management)
   ══════════════════════════════════════════════════════════════════ */

.inv-tabs { display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap; }
.inv-tab { padding: 10px 20px; background: var(--gray-100); border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-600); font-family: 'DM Sans', sans-serif; transition: all .2s; }
.inv-tab:hover { background: var(--gray-200); }
.inv-tab.active { background: #E94560; color: white; }
.inv-panel { display: none; }
.inv-panel.active { display: block; }

.btn-reject { padding: 10px 20px; background: #1a1a1a; color: white; border: none; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.btn-reject:hover { background: #000000; }
.btn-unreject { padding: 10px 20px; background: #0891b2; color: white; border: none; border-radius: 8px; font-weight: 600; font-size: 13px; cursor: pointer; }
.btn-unreject:hover { background: #0e7490; }

.observation-badge { display: inline-block; padding: 4px 12px; background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 600; border-radius: 12px; margin-left: 8px; }
.observations-box { background: #fff7ed; border-left: 4px solid #f59e0b; padding: 12px; margin: 12px 0; border-radius: 4px; font-size: 13px; color: #78350f; white-space: pre-wrap; }

.inv-table { width: 100%; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.inv-table table { width: 100%; border-collapse: collapse; }
.inv-table thead { background: var(--gray-100); }
.inv-table th { text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 700; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid var(--gray-200); }
.inv-table td { padding: 12px 16px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--gray-100); }
.inv-table tbody tr:hover { background: var(--gray-50); }
.inv-table tbody tr:last-child td { border-bottom: none; }
.inv-table .company-cell { font-weight: 600; color: var(--primary); }
.inv-table .amount-cell { font-weight: 700; text-align: right; }
.inv-table .date-cell { color: var(--gray-600); font-size: 12px; }
.inv-table .actions-cell { text-align: right; white-space: nowrap; }

.inv-pagination { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.inv-pagination button { padding: 8px 12px; background: white; border: 1px solid var(--gray-300); border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-700); transition: all .2s; }
.inv-pagination button:hover:not(:disabled) { background: var(--gray-100); border-color: var(--gray-400); }
.inv-pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.inv-pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.inv-pagination .page-info { font-size: 13px; color: var(--gray-600); margin: 0 8px; }

@media (max-width: 768px) {
    .inv-tabs {
        position: sticky; top: 0; z-index: 79;
        background: var(--bg); margin: 0 -16px 24px; padding: 8px 16px;
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
    .inv-tab { flex-shrink: 0; padding: 8px 14px; font-size: 12px; }
    .inv-filters { flex-direction: column; align-items: stretch !important; }
    .inv-filters > div { min-width: 0 !important; width: 100% !important; }
    .inv-filters > button { width: 100%; }
    .inv-panel { overflow-x: hidden; max-width: 100%; }
}

/* ══════════════════════════════════════════════════════════════════
   GROWTH & CRM
   ══════════════════════════════════════════════════════════════════ */

.growth-tabs { display: flex; gap: 4px; margin-bottom: 24px; flex-wrap: wrap; }
.growth-tab { padding: 10px 20px; background: var(--gray-100); border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--gray-600); font-family: 'DM Sans', sans-serif; transition: all .2s; }
.growth-tab:hover { background: var(--gray-200); }
.growth-tab.active { background: #E94560; color: white; }
.growth-panel { display: none; }
.growth-panel.active { display: block; }

/* Subtabs (used in some growth panels) */
.subtabs, .grw-subtabs { display: flex; gap: 8px; margin-bottom: 20px; }
.subtab, .grw-subtab { padding: 8px 16px; border-radius: 8px; border: 1px solid #e2e8f0; background: white; cursor: pointer; font-size: 13px; font-weight: 600; color: #666; }
.subtab.active, .grw-subtab.active { background: var(--accent, #e63946); color: white; border-color: var(--accent, #e63946); }
.subpanel, .grw-subpanel { display: none; }
.subpanel.active, .grw-subpanel.active { display: block; }

/* Stat grid (growth panels) */
.stat-grid, .grw-stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-card, .grw-stat-card { background: white; border-radius: 12px; padding: 20px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.stat-number, .grw-stat-number { font-size: 28px; font-weight: 800; }
.stat-label, .grw-stat-label { font-size: 12px; color: #888; margin-top: 4px; }

/* Data tables (growth) */
.grw-data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.grw-data-table th { background: #f8f9fa; padding: 10px 12px; text-align: left; font-size: 12px; color: #666; font-weight: 600; text-transform: uppercase; }
.grw-data-table td { padding: 10px 12px; border-top: 1px solid #f0f0f0; font-size: 13px; }
.grw-data-table tr:hover { background: #fafbfc; }
.grw-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.grw-table-wrap .grw-data-table { min-width: 500px; }

/* Buttons (growth) */
.btn, .grw-btn { padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn-primary, .grw-btn-primary { background: var(--accent, #e63946); color: white; }
.btn-secondary, .grw-btn-secondary { background: #f0f0f0; color: #333; }
.btn-sm, .grw-btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-success, .grw-btn-success { background: #4CAF50; color: white; }
.btn-warning, .grw-btn-warning { background: #FF9800; color: white; }

/* Kanban board */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; min-height: 300px; }
.kanban-col { background: #f4f5f7; border-radius: 12px; padding: 12px; min-height: 200px; }
.kanban-col-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px 12px; border-bottom: 2px solid; margin-bottom: 12px; }
.kanban-col-header h4 { font-size: 13px; font-weight: 700; margin: 0; text-transform: uppercase; letter-spacing: 0.5px; }
.kanban-col-count { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; color: white; }
.kanban-col-cards { display: flex; flex-direction: column; gap: 10px; }
.kanban-empty { text-align: center; color: #bbb; font-size: 12px; padding: 24px 8px; }

.lead-card { background: white; border-radius: 10px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); cursor: pointer; transition: transform .15s, box-shadow .15s; border-left: 3px solid transparent; }
.lead-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.lead-card .lead-company { font-weight: 700; font-size: 14px; color: #1a1a2e; }
.lead-card .lead-email { font-size: 11px; color: #999; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-card .lead-msg { font-size: 11px; color: #777; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead-card .lead-date { font-size: 10px; color: #bbb; margin-top: 8px; }

/* Closed section */
.closed-section { margin-top: 24px; border: 1px solid #e2e8f0; border-radius: 12px; overflow: hidden; }
.closed-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; background: #f8f9fa; cursor: pointer; user-select: none; }
.closed-header h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--primary); }
.closed-header .closed-toggle { font-size: 12px; color: #999; }
.closed-body { display: none; }
.closed-body.open { display: block; }
.closed-body table { width: 100%; border-collapse: collapse; font-size: 13px; }
.closed-body th { text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; border-bottom: 1px solid #e2e8f0; background: #fafbfc; }
.closed-body td { padding: 10px 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; }
.closed-body tr:hover { background: #f8f9fa; }
.closed-status { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; }

/* Detail modal (growth) */
.modal-overlay, .grw-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 9999; display: none; align-items: center; justify-content: center; }
.modal-overlay.open, .grw-modal-overlay.open { display: flex; }
.modal, .grw-modal { background: white; border-radius: 16px; padding: 28px; max-width: 700px; width: 95%; max-height: 90vh; overflow-y: auto; }
.modal-title, .grw-modal-title { font-size: 18px; font-weight: 700; color: #1a1a2e; margin-bottom: 16px; }

/* Timeline (lead history) */
.timeline, .grw-timeline { margin: 16px 0; }
.timeline-item, .grw-timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.timeline-dot, .grw-timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: #667EEA; margin-top: 4px; flex-shrink: 0; }
.timeline-content, .grw-timeline-content { flex: 1; }
.timeline-date, .grw-timeline-date { font-size: 11px; color: #aaa; }
.timeline-text, .grw-timeline-text { font-size: 13px; color: #333; margin-top: 2px; }

/* Form rows (modals) */
.form-row, .grw-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group, .grw-form-group { margin-bottom: 12px; }
.form-group label, .grw-form-group label { display: block; font-size: 12px; font-weight: 600; color: #666; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea,
.grw-form-group input, .grw-form-group select, .grw-form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; box-sizing: border-box; }

/* Calculator */
.calc-result { background: linear-gradient(135deg, #f0f4ff, #f5f0ff); border-radius: 12px; padding: 24px; border: 1px solid var(--gray-200); }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { padding: 6px 16px; border-radius: 20px; border: 1.5px solid var(--gray-300); background: white; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gray-500); transition: all .15s; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); color: white; border-color: var(--accent); }
.chip-custom { width: 80px; padding: 6px 10px; border-radius: 20px; border: 1.5px solid var(--gray-300); font-size: 13px; text-align: center; }
.chip-custom:focus { border-color: var(--accent); outline: none; }
.email-template-card:hover { border-color: var(--accent) !important; }
.calc-price { font-size: 32px; font-weight: 800; color: #667EEA; }

.grw-grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

#feedbackAiRefreshBtn::after { content: none !important; }
#feedbackAiRefreshBtn { display: flex; align-items: center; justify-content: center; font-size: 0; }

@media (max-width: 768px) {
    .growth-tabs {
        position: fixed;
        top: calc(80px + var(--impersonate-h, 0px) + env(safe-area-inset-top, 0px));
        left: 0; right: 0;
        z-index: 79;
        background: var(--bg);
        margin: 0;
        padding: 4px 16px 8px;
        flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }
    .main-content .growth-tabs ~ * { margin-top: 48px; }
    .growth-tab { flex-shrink: 0; padding: 8px 14px; font-size: 12px; }
    .growth-panel { padding: 0; overflow-x: hidden; max-width: 100%; }
    #pageContainer { overflow-x: hidden; max-width: 100%; }
    .stat-grid, .grw-stat-grid { display: flex !important; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 10px !important; padding-bottom: 4px; }
    .stat-card, .grw-stat-card { flex: 0 0 auto; min-width: 120px; padding: 14px; }
    .stat-number, .grw-stat-number { font-size: 22px; }
    .stat-label, .grw-stat-label { font-size: 11px; }
    .kanban-board { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kanban-col { padding: 10px; min-height: 120px; }
    .kanban-col-header h4 { font-size: 11px; }
    .lead-card { padding: 10px; }
    .lead-card .lead-company { font-size: 13px; }
    .form-row, .grw-form-row { grid-template-columns: 1fr; }
    .grw-grid-2col { display: block !important; }
    .grw-grid-2col > div { margin-bottom: 20px; }
    .modal, .grw-modal { padding: 20px; max-width: calc(100vw - 24px) !important; margin: 12px; }
    .modal-title, .grw-modal-title { font-size: 16px; }
    .subtabs, .grw-subtabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .subtab, .grw-subtab { flex-shrink: 0; font-size: 12px; padding: 6px 12px; }
    .chip { padding: 5px 12px; font-size: 12px; }
    .closed-body th, .closed-body td { padding: 8px 10px; font-size: 12px; }
    #feedbackAiInsight { padding: 14px; }
    #feedbackAiInsight > div:first-child { flex-direction: column; gap: 8px; }
    .calc-price { font-size: 24px; }
    .calc-result { padding: 16px; }
}

@media (max-width: 480px) {
    .stat-card, .grw-stat-card { min-width: 100px; }
    .kanban-board { grid-template-columns: 1fr; }
    .stat-number, .grw-stat-number { font-size: 20px; }
}

/* ══════════════════════════════════════════
   DETAIL VIEW (Analysis Detail)
   ══════════════════════════════════════════ */
.detail-back-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-back-arrow { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 12px; border: none; background: none; color: var(--primary); cursor: pointer; flex-shrink: 0; border-radius: 8px; transition: background 0.15s; font-size: 14px; font-weight: 600; font-family: 'Plus Jakarta Sans', sans-serif; }
.detail-back-arrow span { display: inline; }
.detail-back-arrow:hover { background: var(--gray-100); }
.detail-back-title { display: none; flex: 1; min-width: 0; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-back-actions { display: none; }
.detail-nav { display: flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 8px; }
.detail-nav-btn { width: 32px; height: 32px; border: 1px solid var(--gray-300); border-radius: 8px; background: white; color: var(--primary); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 13px; transition: all 0.15s; }
.detail-nav-btn:hover:not(:disabled) { background: var(--gray-100); border-color: var(--gray-400); }
.detail-nav-btn:disabled { opacity: 0.3; cursor: default; }
.detail-nav-pos { font-size: 12px; color: var(--gray-500); font-weight: 600; min-width: 50px; text-align: center; }

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.detail-image-col { border-radius: var(--radius); background: var(--gray-100); position: relative; cursor: pointer; position: sticky; top: 20px; align-self: start; }
.detail-image-wrapper { position: relative; width: 100%; overflow: hidden; border-radius: var(--radius); background: var(--gray-100); }
.detail-image-wrapper .detail-image { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-md); display: block; transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); will-change: transform; }
.detail-image-col .zoom-hint { position: absolute; bottom: 12px; right: 12px; background: rgba(0,0,0,.55); color: white; font-size: 12px; font-weight: 600; padding: 6px 12px; border-radius: 20px; display: flex; align-items: center; gap: 6px; opacity: 0; transition: opacity .25s; pointer-events: none; backdrop-filter: blur(4px); }
.detail-image-col:hover .zoom-hint { opacity: 1; }
.detail-image-col.brand-zoomed .zoom-hint { opacity: 0 !important; }
.detail-image-col.brand-zoomed { cursor: default; }

.detail-info-col { min-width: 0; }
.detail-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.detail-meta { font-size: 14px; color: var(--gray-500); margin-bottom: 2px; }
.detail-address { font-size: 13px; color: var(--blue); margin-bottom: 2px; transition: opacity 0.15s; }
.detail-address[onclick]:hover { opacity: 0.7; }
.detail-address i { margin-right: 5px; font-size: 12px; }

/* Map modal */
.map-modal { background: white; border-radius: 12px; width: 90%; max-width: 640px; overflow: hidden; box-shadow: var(--shadow-lg); }
.map-modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 20px; }
.map-modal-title { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 16px; color: var(--primary); }
.map-modal-address { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.map-modal-close { background: none; border: none; font-size: 18px; color: var(--gray-400); cursor: pointer; padding: 4px 8px; }
.map-modal-close:hover { color: var(--gray-700); }

.detail-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.detail-kpi { text-align: center; padding: 16px; background: var(--gray-50); border-radius: var(--radius-sm); }
.detail-kpi-val { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800; color: var(--primary); }
.detail-kpi-bar { height: 4px; background: var(--gray-200); border-radius: 2px; margin: 8px 0 4px; overflow: hidden; }
.detail-kpi-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.detail-kpi-lbl { font-size: 11px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

.share-bar { display: flex; height: 40px; border-radius: 8px; overflow: hidden; background: var(--gray-100); margin-bottom: 8px; }
.share-segment { display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: white; min-width: 40px; transition: width 0.5s ease; }
.share-segment.own { background: var(--blue); }
.share-segment.comp { background: var(--warning); }
.share-legend { display: flex; gap: 20px; font-size: 13px; color: var(--gray-600); margin-bottom: 20px; }
.share-legend-item { display: flex; align-items: center; gap: 6px; }
.share-legend-dot { width: 12px; height: 12px; border-radius: 3px; }

.quality-warning { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fffbeb; border: 1px solid #f59e0b33; border-radius: 8px; margin: 16px 0 0; font-size: 13px; color: #92400e; line-height: 1.5; }
.quality-warning i { color: #f59e0b; font-size: 15px; flex-shrink: 0; }
.ai-insight { display: flex; gap: 12px; padding: 14px 16px; background: linear-gradient(135deg, #f0f4ff 0%, #f5f0ff 100%); border: 1px solid rgba(99,102,241,.15); border-radius: 10px; margin: 20px 0; }
.ai-insight-icon { width: 32px; height: 32px; min-width: 32px; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); display: flex; align-items: center; justify-content: center; color: white; }
.ai-insight-body { flex: 1; min-width: 0; }
.ai-insight-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: #6366f1; margin-bottom: 4px; }
.ai-insight p { font-size: 13px; line-height: 1.6; color: var(--gray-600); margin: 0; }
.ai-insight p.clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ai-insight-toggle { font-size: 12px; font-weight: 600; color: #6366f1; cursor: pointer; margin-top: 6px; background: none; border: none; padding: 0; font-family: inherit; }
.ai-insight-toggle:hover { text-decoration: underline; }

/* Rating Widget */
.rating-widget { margin-top: 20px; padding: 16px 20px; background: white; border: 1px solid var(--gray-200); border-radius: 12px; }
.rating-widget-title { font-size: 13px; font-weight: 700; color: var(--gray-600); margin-bottom: 10px; }
.rating-stars { display: inline-flex; gap: 4px; cursor: pointer; }
.rating-stars .star { font-size: 28px; color: var(--gray-300); transition: color .15s; cursor: pointer; user-select: none; }
.rating-stars .star.active { color: #F59E0B; }
.rating-stars .star.hover { color: #FBBF24; }
.rating-comment { width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--gray-200); border-radius: 8px; font-size: 13px; font-family: 'DM Sans', sans-serif; resize: vertical; min-height: 60px; box-sizing: border-box; }
.rating-comment:focus { outline: none; border-color: var(--accent); }
.rating-submit { padding: 8px 20px; background: var(--accent); color: white; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; transition: opacity .15s; }
.rating-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.rating-submit:hover:not(:disabled) { opacity: 0.9; }
.rating-saved { font-size: 13px; color: var(--success); opacity: 0; transition: opacity .3s; }
.rating-saved.show { opacity: 1; }

/* Badge Promo */
.badge-promo { display: inline-block; font-size: 10px; background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; padding: 2px 8px; border-radius: 9px; margin-left: 6px; font-weight: 600; vertical-align: middle; letter-spacing: .3px; white-space: nowrap; }
.badge-promo i { font-size: 9px; margin-right: 2px; }

.brand-table-wrap { margin-top: 20px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.brand-table-wrap .data-table { border-collapse: separate; border-spacing: 0; }
.brand-table-legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: 12px; color: var(--gray-500); font-weight: 500; }
.brand-table-legend-item { display: flex; align-items: center; gap: 5px; }
.brand-table-legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.brand-table-legend-dot.own { background: var(--blue); }
.brand-table-legend-dot.comp { background: var(--warning); }
.brand-row[data-brand-type="own"] td:first-child { border-left: 3px solid var(--blue); }
.brand-row[data-brand-type="comp"] td:first-child { border-left: 3px solid var(--warning); }
.brand-row td[data-bbox] { cursor: pointer; }
.brand-row td[data-bbox]:hover { background: rgba(15,52,96,0.05); }
.brand-zoom-hint { font-size: 12px; color: var(--gray-400); margin-top: 12px; display: flex; align-items: center; gap: 6px; }
.badge-promo { background: var(--success); color: white; font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }

/* Image Modal */
.image-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.image-modal-backdrop { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.9); }
.image-modal-content { position: relative; max-width: 95vw; max-height: 95vh; }
.image-modal-content img { max-width: 100%; max-height: 95vh; border-radius: 8px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.image-modal-close { position: absolute; top: -40px; right: 0; background: none; border: none; color: white; font-size: 24px; cursor: pointer; padding: 8px; opacity: 0.7; transition: opacity 0.2s; }
.image-modal-close:hover { opacity: 1; }

/* ShelfScore Compact (for detail view) */
.shelfscore-hero--compact { padding: 20px; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary) 0%, #2a3f5f 100%); color: white; margin: 16px 0; }
.shelfscore-hero--compact .shelfscore-hero-inner { display: flex; gap: 24px; align-items: center; }
.shelfscore-hero--compact .shelfscore-hero-left { flex-shrink: 0; }
.shelfscore-hero--compact .shelfscore-hero-right { flex: 1; min-width: 0; }
.shelfscore-hero--compact .shelfscore-hero-brand { font-size: 12px; font-weight: 700; letter-spacing: 1px; margin-bottom: 4px; }
.shelfscore-hero--compact .shelfscore-hero-brand .ss-shelf { color: #FFFFFF; }
.shelfscore-hero--compact .shelfscore-hero-brand .ss-score { color: var(--accent); }
.shelfscore-hero--compact .shelfscore-hero-number { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 48px; font-weight: 800; line-height: 1; }
.shelfscore-hero--compact .shelfscore-hero-number .ss-unit { font-size: 18px; font-weight: 600; opacity: 0.5; }
.shelfscore-hero--compact .shelfscore-hero-meta { margin-top: 8px; }
.shelfscore-hero-breakdown { display: flex; flex-direction: column; gap: 6px; }
.shelfscore-hero-bd-row { display: flex; align-items: center; gap: 8px; }
.shelfscore-hero-bd-label { font-size: 11px; width: 70px; opacity: 0.8; }
.shelfscore-hero-bd-bar { flex: 1; height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; }
.shelfscore-hero-bd-fill { height: 100%; background: rgba(255,255,255,0.7); border-radius: 3px; transition: width 0.5s ease; }
.shelfscore-hero-bd-val { font-size: 11px; font-weight: 600; width: 24px; text-align: right; }

/* Tablet Detail View */
@media (max-width: 1024px) {
    .detail-grid { grid-template-columns: 1fr; gap: 16px; }
    .detail-image-col { position: sticky; top: calc(16px + var(--impersonate-h, 0px)); z-index: 10; }
    .detail-image-wrapper { max-height: 25vh; }
    .detail-image-wrapper .detail-image { object-fit: contain; max-height: 25vh; height: auto; }
}

/* Mobile Detail View */
@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; gap: 16px; }
    .detail-back-arrow { display: flex; padding: 0; width: 36px; }
    .detail-back-arrow span { display: none; }
    .detail-back-title { display: block; }
    .detail-back-actions { display: none; }
    .detail-nav { display: none; }
    .detail-image-col { position: sticky; top: 120px; z-index: 10; border-radius: 0; background: #000; }
    .detail-image-wrapper { max-height: 25vh; border-radius: 0; }
    .detail-image-wrapper .detail-image { max-height: 25vh; object-fit: cover; border-radius: 0; }
    .detail-image-col .zoom-hint { display: none; }
    .detail-info-col { padding: 16px; }
    .detail-title, .detail-info-col > .detail-meta:first-of-type { display: none; }
    .detail-kpis { gap: 8px; }
    .detail-kpi { padding: 12px 8px; }
    .detail-kpi-val { font-size: 22px; }
    .shelfscore-hero--compact { padding: 16px; }
    .shelfscore-hero--compact .shelfscore-hero-number { font-size: 36px; }
    .shelfscore-hero--compact .shelfscore-hero-inner { flex-direction: column; gap: 16px; text-align: center; }
    .shelfscore-hero--compact .shelfscore-hero-right { width: 100%; }
    .shelfscore-hero--compact .shelfscore-hero-breakdown { width: 100%; }
    .shelfscore-hero--compact .shelfscore-hero-bd-label { text-align: left; }
    .map-modal { width: 100%; max-width: 100%; border-radius: 0; }
    .map-modal #mapModalContainer { height: 280px; border-radius: 0; }
}

/* Detail view white background */
#tab-detail { background: white; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
@media (max-width: 768px) {
    #tab-detail { padding: 0; border-radius: 0; box-shadow: none; }
}

/* ══════════════════════════════════════════
   DETAIL VIEW - MOBILE ENHANCEMENTS
   ══════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Remove main-content top padding when in detail view */
    .main-content:has(#tab-detail) { padding-top: 0 !important; }

    /* Fixed back bar at top - matches page-header pattern exactly */
    .detail-back-bar {
        position: fixed;
        top: 0; left: 0; right: 0;
        height: calc(var(--pwa-header-base, 120px) + env(safe-area-inset-top, 0px));
        z-index: 100;
        background: white;
        display: flex;
        align-items: center;
        padding: 0 16px;
        padding-top: env(safe-area-inset-top, 0px);
        padding-right: 76px; /* Space for hamburger */
        box-sizing: border-box;
        box-shadow: 0 1px 3px rgba(0,0,0,0.08);
        margin-bottom: 0;
    }

    .detail-back-arrow {
        position: relative;
        top: calc(var(--pwa-title-offset, 40px) / 2);
    }

    .detail-back-title {
        position: relative;
        top: calc(var(--pwa-title-offset, 40px) / 2);
    }

    /* Spacer to push content below fixed back bar */
    #tab-detail { padding-top: calc(var(--pwa-header-base, 120px) + env(safe-area-inset-top, 0px) + 10px) !important; }

    /* Sticky image below back bar - THIS IS KEY FOR ZOOM */
    .detail-image-col {
        position: sticky;
        top: calc(var(--pwa-header-base, 120px) + env(safe-area-inset-top, 0px));
        z-index: 15;
        border-radius: 0;
        background: #000;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        margin: 0 -16px;
        width: calc(100% + 32px);
    }
    .detail-image-wrapper { 
        max-height: 25vh; 
        border-radius: 0; 
    }
    .detail-image-wrapper .detail-image {
        width: 100%;
        max-height: 25vh;
        object-fit: cover;
        border-radius: 0;
        box-shadow: none;
    }
    
    /* Shadow gradient below image */
    .detail-image-col::after {
        content: '';
        position: absolute;
        bottom: -16px; left: 0; right: 0;
        height: 16px;
        z-index: 1;
        pointer-events: none;
        background: linear-gradient(to bottom, rgba(0,0,0,0.3), transparent);
    }
    
    /* Content area with proper spacing */
    .detail-info-col {
        position: relative;
        padding: 24px 0 16px;
        background: white;
        width: 100%;
        box-sizing: border-box;
        min-width: 0;
    }
    
    /* Hide duplicate title/meta on mobile (shown in back bar) */
    .detail-info-col > .detail-title,
    .detail-info-col > .detail-meta:first-of-type { display: none; }
    
    /* Compact KPIs */
    .detail-kpis { gap: 8px; }
    .detail-kpi { padding: 12px 8px; }
    .detail-kpi-val { font-size: 22px; }
    
    /* Share bar */
    .share-bar { height: 32px; }
    .share-legend { gap: 12px; flex-wrap: wrap; }
    
    /* ShelfScore compact */
    .shelfscore-hero--compact { padding: 16px; border-radius: 12px; }
    .shelfscore-hero--compact .shelfscore-hero-number { font-size: 40px; }
    .shelfscore-hero--compact .shelfscore-hero-inner { gap: 16px; }
    
    /* Brand table scroll */
    .brand-table-wrap { 
        overflow-x: auto; 
        -webkit-overflow-scrolling: touch; 
        max-width: 100%;
        margin: 0 -16px;
        padding: 0 16px;
    }
    .brand-table-wrap .data-table { min-width: 380px; }
    
    /* Touch-friendly brand rows for zoom */
    .brand-row td[data-bbox] {
        cursor: pointer;
        padding: 12px 8px;
    }
    .brand-row td[data-bbox]:active {
        background: rgba(15,52,96,0.1);
    }
    
    /* Zoom hint for touch */
    .brand-zoom-hint {
        text-align: center;
        padding: 12px;
        background: var(--gray-50);
        border-radius: var(--radius-sm);
        margin-top: 16px;
    }
    
    /* Tab detail container adjustments */
    #tab-detail {
        padding: 0;
        padding-top: 48px; /* Space for fixed back bar */
        border-radius: 0;
        box-shadow: none;
        background: var(--bg);
    }
    #tab-detail .detail-grid {
        background: white;
    }
}

@media (max-width: 480px) {
    .detail-kpi-val { font-size: 18px; }
    .detail-kpi-lbl { font-size: 10px; }
    .shelfscore-hero--compact .shelfscore-hero-number { font-size: 36px; }
    .shelfscore-hero--compact .shelfscore-hero-inner {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    .shelfscore-hero--compact .shelfscore-hero-right { width: 100%; }
    .shelfscore-hero--compact .shelfscore-hero-breakdown { width: 100%; }
    .shelfscore-hero--compact .shelfscore-hero-bd-label { text-align: left; width: 60px; }
    .shelfscore-hero--compact .shelfscore-hero-bd-bar { min-width: 80px; }
}

/* Fix sticky positioning for detail view - applies to ALL screen sizes */
#tab-detail { overflow: visible; }
.detail-grid { overflow: visible; }
.main-content:has(#tab-detail.active) { overflow: visible; }
#pageContainer:has(#tab-detail.active) { overflow: visible; }

@media (max-width: 768px) {
    .main-content { overflow-x: clip; }
    #pageContainer { overflow-x: clip; overflow-y: visible; }
}

/* Price reason tooltip */
.price-wrap { display: inline-block; position: relative; }
.price-why { 
    color: var(--accent); 
    font-size: 11px; 
    cursor: pointer; 
    text-decoration: underline; 
    font-weight: 500;
}
.price-reason { 
    display: none; 
    position: absolute; 
    bottom: 100%; 
    left: 50%; 
    transform: translateX(-50%); 
    background: var(--primary); 
    color: white; 
    padding: 8px 12px; 
    border-radius: 6px; 
    font-size: 12px; 
    white-space: nowrap;
    max-width: 250px;
    white-space: normal;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    margin-bottom: 6px;
}
.price-reason::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--primary);
}
.price-reason.show { display: block; }
@media (max-width: 768px) {
    .price-reason { 
        position: fixed; 
        bottom: auto; 
        top: 50%; 
        left: 50%; 
        transform: translate(-50%, -50%);
        max-width: 80vw;
    }
    .price-reason::after { display: none; }
}

/* Zoom-enabled table cells */
.brand-row td[data-bbox] { 
    cursor: zoom-in; 
    transition: background 0.15s ease; 
    -webkit-user-select: none; 
    user-select: none; 
    -webkit-touch-callout: none; 
}
.brand-row td[data-bbox]:hover { background: rgba(233,69,96,0.06); }
.brand-row td.zoom-active-cell {
    background: rgba(233,69,96,0.10) !important;
    border-bottom: 2px solid var(--accent);
}

/* ══════════════════════════════════════════
   AI CONFIG PAGE
   ══════════════════════════════════════════ */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.template-card {
    padding: 20px; border: 2px solid var(--gray-200); border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s; text-align: center;
}
.template-card:hover { border-color: var(--accent); background: rgba(233,69,96,0.03); }
.template-card.selected { border-color: var(--accent); background: rgba(233,69,96,0.06); }
.template-icon { font-size: 32px; margin-bottom: 8px; }
.template-name { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 14px; color: var(--primary); }
.config-section { margin-bottom: 28px; }
.config-section-title {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; font-weight: 700;
    color: var(--primary); margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.usage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.usage-card { text-align: center; padding: 20px; background: var(--gray-50); border-radius: var(--radius); }
.usage-val { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800; color: var(--primary); }
.usage-lbl { font-size: 12px; color: var(--gray-500); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.char-count { font-size: 11px; color: var(--gray-400); text-align: right; margin-top: 4px; }
.char-count.warn { color: var(--warning); }
.char-count.danger { color: var(--danger); }
.template-card.saved { border-color: var(--blue); background: rgba(15,52,96,0.04); }
.template-card.saved:hover { border-color: var(--blue); background: rgba(15,52,96,0.07); }
.template-saved-badge {
    font-size: 9px; font-weight: 700; color: var(--blue); text-transform: uppercase;
    letter-spacing: 0.4px; background: rgba(15,52,96,0.1); padding: 2px 8px;
    border-radius: 10px; display: inline-block; margin-bottom: 6px;
}
.tpl-toggle {
    display: block; width: 100%; padding: 10px; margin-top: 8px;
    background: var(--gray-50); border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    color: var(--gray-600); cursor: pointer; text-align: center;
    font-family: 'DM Sans', sans-serif; transition: all 0.15s;
}
.tpl-toggle:hover { background: var(--gray-100); }
@media (max-width: 768px) {
    .template-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .template-card { padding: 14px 10px; }
    .template-icon { font-size: 26px; margin-bottom: 4px; }
    .template-name { font-size: 12px; }
    .usage-grid { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .usage-val { font-size: 20px; }
    .usage-lbl { font-size: 10px; }
}
@media (max-width: 480px) {
    .usage-grid { grid-template-columns: 1fr; }
}

/* ── CHANGELOG MODAL ── */
.changelog-overlay {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease;
    padding: 24px;
}
.changelog-overlay.open { opacity: 1; }
.changelog-modal {
    background: #fff;
    border-radius: 16px;
    max-width: 420px; width: 100%;
    padding: 32px;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}
.changelog-overlay.open .changelog-modal {
    transform: translateY(0) scale(1);
}
.changelog-title {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 22px; font-weight: 600;
    color: var(--primary, #1A1A2E);
    margin-bottom: 4px;
}
.changelog-version {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px; color: var(--gray-500, #6C757D);
    margin-bottom: 20px;
}
.changelog-body {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px; line-height: 1.6;
    color: var(--gray-700, #343A40);
    margin-bottom: 24px;
}
.changelog-list {
    list-style: none; padding: 0; margin: 0;
}
.changelog-list li {
    position: relative;
    padding: 6px 0 6px 18px;
}
.changelog-list li::before {
    content: '';
    position: absolute; left: 0; top: 14px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent, #E94560);
}
.changelog-btn {
    display: block; width: 100%;
    padding: 12px 24px;
    background: var(--accent, #E94560);
    color: #fff; border: none;
    border-radius: 10px;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.changelog-btn:hover {
    background: var(--accent-hover, #d63a54);
}

/* ── RELEASE MANAGEMENT (superadmin) ── */
.release-row {
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
}
.release-row:last-child { border-bottom: none; }
.release-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.release-version {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-right: 8px;
}
.release-date {
    font-size: 12px;
    color: var(--gray-400);
}
.release-notes {
    margin-bottom: 8px;
}
.release-note-line {
    font-size: 13px;
    color: var(--gray-600);
    padding: 2px 0 2px 14px;
    position: relative;
}
.release-note-line::before {
    content: '';
    position: absolute;
    left: 0; top: 10px;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--gray-300);
}
.release-actions {
    display: flex;
    gap: 6px;
}
.release-trans-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (max-width: 600px) {
    .release-trans-grid { grid-template-columns: 1fr; }
}

/* ==================== WHATSAPP CONTACT WIDGET ==================== */
.wa-widget {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #E8F5E9;
    border: 1px solid #C8E6C9;
    border-radius: 10px;
    padding: 14px 16px;
}
.wa-widget__header {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.wa-widget__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.wa-widget__icon svg { fill: #fff; }
.wa-widget__info { min-width: 0; }
.wa-widget__number {
    font-size: 15px;
    font-weight: 700;
    color: var(--dark);
    white-space: nowrap;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    letter-spacing: 0.3px;
}
.wa-widget__label {
    font-size: 12px;
    color: var(--gray-500);
    line-height: 1.4;
    margin-top: 2px;
}
.wa-widget__actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}
.wa-widget__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    font-family: inherit;
}
.wa-widget__btn:active { transform: scale(0.97); }
.wa-widget__btn--chat { background: #25D366; color: #fff; }
.wa-widget__btn--chat:hover { background: #1DA851; }
.wa-widget__btn--copy { background: rgba(0,0,0,0.06); color: var(--dark); }
.wa-widget__btn--copy:hover { background: rgba(0,0,0,0.1); }
.wa-widget__btn--vcf { background: rgba(0,0,0,0.06); color: var(--dark); }
.wa-widget__btn--vcf:hover { background: rgba(0,0,0,0.1); }

/* -- compact: in dashboard header -- */
.wa-widget--compact { padding: 10px 14px; gap: 10px; border-radius: 8px; margin-bottom: 20px; }
.wa-widget--compact .wa-widget__icon { width: 32px; height: 32px; }
.wa-widget--compact .wa-widget__icon svg { width: 17px; height: 17px; }
.wa-widget--compact .wa-widget__number { font-size: 14px; }
.wa-widget--compact .wa-widget__label { font-size: 11px; }
.wa-widget--compact .wa-widget__btn span { display: none; }
.wa-widget--compact .wa-widget__btn { padding: 6px 8px; }

/* dismiss button — perched on top-right edge */
.wa-widget--compact { position: relative; overflow: visible; }
.wa-widget__dismiss {
    position: absolute;
    top: -8px; right: -8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 1px solid var(--gray-200);
    background: #fff;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-400);
    transition: background 0.15s, color 0.15s, transform 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    z-index: 2;
}
.wa-widget__dismiss:hover { background: var(--gray-100); color: var(--gray-600); transform: scale(1.1); }

/* collapsed pill — floats right */
.wa-widget__pill {
    display: none;
    width: 42px; height: 42px;
    border-radius: 50%;
    border: none;
    background: #25D366;
    cursor: pointer;
    align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(37,211,102,0.3);
    transition: transform 0.15s, box-shadow 0.15s;
    margin-left: auto;
}
.wa-widget__pill:hover { transform: scale(1.08); box-shadow: 0 4px 14px rgba(37,211,102,0.4); }
.wa-widget__pill:active { transform: scale(0.95); }
.wa-widget__pill svg { fill: #fff; width: 22px; height: 22px; }

/* collapsed state */
.wa-collapsed { display: flex; margin-bottom: 12px; }
.wa-collapsed .wa-widget { display: none; }
.wa-collapsed .wa-widget__pill { display: inline-flex; }

/* animations */
.wa-collapsing .wa-widget {
    animation: waCollapseOut 0.25s ease forwards;
}
.wa-expanding .wa-widget {
    animation: waExpandIn 0.3s ease forwards;
}
.wa-collapsed .wa-widget__pill {
    animation: waPillIn 0.25s ease both;
    animation-delay: 0.05s;
}
@keyframes waCollapseOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.96) translateY(-4px); }
}
@keyframes waExpandIn {
    0% { opacity: 0; transform: scale(0.96) translateY(-4px); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes waPillIn {
    0% { opacity: 0; transform: scale(0.5); }
    70% { transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* -- bar: full-width between sections -- */
.wa-widget--bar { border-radius: 8px; margin-bottom: 16px; }

/* -- inline: inside tip-box -- */
.wa-widget--inline {
    background: transparent;
    border: none;
    padding: 8px 0 0;
    gap: 10px;
}
.wa-widget--inline .wa-widget__icon { width: 30px; height: 30px; }
.wa-widget--inline .wa-widget__icon svg { width: 16px; height: 16px; }
.wa-widget--inline .wa-widget__number { font-size: 14px; }
.wa-widget--inline .wa-widget__label { font-size: 11px; }
.wa-widget--inline .wa-widget__btn span { display: none; }
.wa-widget--inline .wa-widget__btn { padding: 5px 7px; font-size: 11px; }

/* -- Mobile -- */
@media (max-width: 768px) {
    .wa-widget {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .wa-widget__header { gap: 10px; }
    .wa-widget__actions {
        width: 100%;
        margin-left: 0;
    }
    .wa-widget__btn { flex: 1; justify-content: center; padding: 8px 6px; }
    .wa-widget__btn span { display: inline; font-size: 11px; }
    .wa-widget__label { display: block; }

    /* compact on mobile: becomes a full bar below header, not inside header-actions */
    .wa-widget--compact {
        padding: 12px 14px;
    }
    .wa-widget--compact .wa-widget__label { display: block; }
    .wa-widget--compact .wa-widget__btn span { display: inline; font-size: 11px; }
    .wa-widget--compact .wa-widget__btn { padding: 8px 6px; }

    .wa-widget__dismiss { width: 26px; height: 26px; top: -10px; right: -6px; }

    .wa-widget--inline .wa-widget__btn span { display: inline; font-size: 11px; }
}


/* ══════════════════════════════════════════════════════════
   MAP PAGE
   ══════════════════════════════════════════════════════════ */

.map-page-layout {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--pwa-header-base, 120px) - env(safe-area-inset-top, 0px) - var(--pwa-content-gap, 10px));
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    min-height: 200px;
    isolation: isolate;
}

.map-container .leaflet-container {
    width: 100%;
    height: 100%;
    background: #0a0a1a;
}

.map-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26,26,46,0.8);
    z-index: 1000;
}

/* ── Floating Legend (over the map) ── */
.map-legend-float {
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 500;
    background: rgba(26, 26, 46, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.map-legend-float .map-legend-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.45);
    font-weight: 700;
    margin-bottom: 2px;
}

.map-legend-float .map-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    line-height: 1;
}

.map-legend-float .map-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.15);
}

.map-legend-dot--gray {
    background: #888 !important;
    opacity: 0.4;
}

/* ── Bottom Bar ── */
.map-bottombar {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 24px;
    background: var(--primary, #1A1A2E);
    padding: 12px 24px;
    border-radius: 0 0 12px 12px;
    min-height: 56px;
}

/* KPIs */
.map-bar-kpis {
    display: flex;
    gap: 20px;
}

.map-bar-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 72px;
}

.map-bar-kpi-value {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
}

.map-bar-kpi-accent {
    color: var(--accent, #E94560) !important;
}

.map-bar-kpi-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    white-space: nowrap;
}

/* Filters */
.map-bar-filters {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.map-bar-select {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 8px 32px 8px 12px;
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 160px;
}

.map-bar-select option {
    background: #1A1A2E;
    color: #fff;
}

/* Toggle */
.map-bar-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.map-bar-toggle-label {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
}

.map-switch {
    position: relative;
    width: 38px;
    height: 22px;
    display: inline-block;
    flex-shrink: 0;
}

.map-switch input { opacity: 0; width: 0; height: 0; }

.map-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 22px;
    transition: 0.3s;
}

.map-switch-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.map-switch input:checked + .map-switch-slider {
    background: var(--accent, #E94560);
}

.map-switch input:checked + .map-switch-slider::before {
    transform: translateX(16px);
}

/* ── Cluster Icons ── */
.map-cluster-wrapper {
    background: transparent !important;
    border: none !important;
}

.map-cluster-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    border: 3px solid rgba(255,255,255,0.3);
}

.map-cluster-icon span { line-height: 1; }

/* ── Custom Popup ── */
.map-popup-container .leaflet-popup-content-wrapper {
    background: var(--primary, #1A1A2E);
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0;
}

.map-popup-container .leaflet-popup-tip {
    background: var(--primary, #1A1A2E);
    border: 1px solid rgba(255,255,255,0.1);
    border-top: none;
    border-left: none;
}

.map-popup-container .leaflet-popup-content { margin: 0; padding: 0; }

.map-popup-container .leaflet-popup-close-btn {
    color: rgba(255,255,255,0.5);
    font-size: 18px;
    top: 6px;
    right: 8px;
}

.map-popup-container .leaflet-popup-close-btn:hover { color: #fff; }

.map-popup {
    padding: 16px;
    min-width: 180px;
}

.map-popup-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.map-popup-tenant {
    font-size: 11px;
    color: var(--accent, #E94560);
    margin-bottom: 4px;
    font-weight: 600;
}

.map-popup-chain {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 12px;
}

.map-popup-score {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 10px;
}

.map-popup-score-value { font-size: 28px; font-weight: 800; line-height: 1; }
.map-popup-score-label { font-size: 11px; color: #fff; text-transform: none; letter-spacing: 0; font-weight: 600; }
.map-popup-score-label .accent { color: var(--accent, #E94560); }

.map-popup-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 8px;
}

.map-popup-no-data {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    font-style: italic;
    margin-top: 6px;
}

/* Leaflet zoom controls */
.map-container .leaflet-control-zoom {
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    margin-top: 16px;
    margin-right: 16px;
}

.map-container .leaflet-control-zoom a {
    background: var(--primary, #1A1A2E);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    width: 36px;
    height: 36px;
    line-height: 36px;
    font-size: 18px;
}

.map-container .leaflet-control-zoom a:hover {
    background: rgba(255,255,255,0.1);
}

/* ── Mobile ── */
@media (max-width: 768px) {
    /* Kill parent padding so map goes true edge-to-edge */
    .main-content:has(.map-page-layout) {
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 0;
    }

    .map-page-layout {
        height: calc(100vh - var(--pwa-header-base, 120px) - env(safe-area-inset-top, 0px) - var(--pwa-content-gap, 10px));
        border-radius: 0;
        width: 100%;
    }

    .map-container {
        border-radius: 0;
    }

    .map-container .leaflet-control-zoom {
        display: none;
    }

    .map-legend-float {
        bottom: 12px;
        left: 10px;
        padding: 10px 12px;
        gap: 4px;
        border-radius: 10px;
    }

    .map-legend-float .map-legend-title { font-size: 9px; }
    .map-legend-float .map-legend-item { font-size: 10px; gap: 6px; }
    .map-legend-float .map-legend-dot { width: 8px; height: 8px; }

    .map-bottombar {
        display: flex;
        align-items: center;
        gap: 0;
        padding: 8px 10px;
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        border-radius: 0;
        min-height: 0;
    }

    .map-bar-kpis {
        display: flex;
        gap: 0;
        flex: 1;
        min-width: 0;
    }

    .map-bar-kpi {
        flex: 1;
        min-width: 0;
        text-align: center;
        border-right: 1px solid rgba(255,255,255,0.08);
    }
    .map-bar-kpi:last-child { border-right: none; }
    .map-bar-kpi-value { font-size: 16px; }
    .map-bar-kpi-label { font-size: 7px; letter-spacing: 0.5px; }

    .map-bar-filters {
        display: flex;
        gap: 0;
        padding: 0;
        margin-left: 10px;
        flex-shrink: 0;
        border-top: none;
    }

    .map-bar-filter { min-width: 0; }

    .map-bar-select {
        min-width: 0;
        width: auto;
        max-width: 120px;
        font-size: 11px;
        padding: 6px 24px 6px 8px;
        border-radius: 6px;
    }

    .map-bar-toggle {
        justify-content: center;
        padding: 6px 12px 8px;
        border-top: 1px solid rgba(255,255,255,0.06);
    }
}

/* ══════════════════════════════════════════
   INBOX
   ══════════════════════════════════════════ */

.inbox-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.inbox-filters { display: flex; gap: 4px; }
.inbox-filter {
    padding: 6px 14px; border-radius: 20px; border: 1px solid var(--gray-200);
    background: var(--white); font-size: 13px; color: var(--gray-600);
    cursor: pointer; transition: all 0.15s;
}
.inbox-filter:hover { border-color: var(--gray-400); }
.inbox-filter.active { background: var(--primary); color: white; border-color: var(--primary); }

.inbox-search {
    position: relative; flex: 0 1 260px;
}
.inbox-search i {
    position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
    color: var(--gray-400); font-size: 13px;
}
.inbox-search input {
    width: 100%; padding: 8px 12px 8px 32px; border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200); font-size: 13px; background: var(--white);
}
.inbox-search input:focus { outline: none; border-color: var(--primary); }

.inbox-container {
    display: grid; grid-template-columns: 380px 1fr;
    gap: 0; border: 1px solid var(--gray-200); border-radius: var(--radius);
    background: var(--white); min-height: 500px; overflow: hidden;
}

.inbox-list {
    border-right: 1px solid var(--gray-200); overflow-y: auto;
    max-height: calc(100vh - 280px);
}

.inbox-item {
    padding: 14px 16px; border-bottom: 1px solid var(--gray-100);
    cursor: pointer; transition: background 0.12s;
}
.inbox-item:hover { background: var(--gray-50); }
.inbox-item--active { background: #EEF2FF; border-left: 3px solid var(--primary); }
.inbox-item--unread { background: #FAFBFF; }
.inbox-item--unread .inbox-item-from { font-weight: 700; }
.inbox-item--unread .inbox-item-subject { font-weight: 600; color: var(--gray-700); }
.inbox-item--sent .inbox-item-from { color: var(--gray-500); font-style: italic; }

.inbox-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.inbox-item-from { font-size: 13px; font-weight: 500; color: var(--gray-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.inbox-item-date { font-size: 11px; color: var(--gray-400); white-space: nowrap; }
.inbox-item-subject { font-size: 13px; color: var(--gray-600); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-item-preview { font-size: 12px; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.inbox-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px; color: var(--gray-400);
}
.inbox-empty i { font-size: 36px; margin-bottom: 12px; }

.inbox-detail {
    padding: 24px; overflow-y: auto; max-height: calc(100vh - 280px);
}
.inbox-detail-placeholder {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: var(--gray-400); text-align: center;
}
.inbox-detail-placeholder i { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }

.inbox-detail-header { margin-bottom: 20px; }
.inbox-detail-subject { font-size: 18px; font-weight: 700; color: var(--gray-700); margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inbox-detail-meta { font-size: 13px; color: var(--gray-500); margin-bottom: 12px; line-height: 1.7; }
.inbox-detail-actions { display: flex; gap: 8px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-200); }

.inbox-dir-badge {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600;
}
.inbox-dir-sent { background: #E8F5E9; color: #2E7D32; }
.inbox-dir-received { background: #E3F2FD; color: #1565C0; }

.inbox-detail-body { font-size: 14px; line-height: 1.7; color: var(--gray-700); white-space: pre-wrap; word-break: break-word; }

/* Thread */
.inbox-thread { display: flex; flex-direction: column; gap: 12px; }
.inbox-thread-msg {
    padding: 14px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--gray-200); background: var(--gray-50);
}
.inbox-thread-sent { border-left: 3px solid var(--success); background: #F8FFF8; }
.inbox-thread-received { border-left: 3px solid var(--blue); }
.inbox-thread-current { box-shadow: 0 0 0 2px rgba(15,52,96,0.15); }
.inbox-thread-header { display: flex; justify-content: space-between; margin-bottom: 8px; }
.inbox-thread-from { font-size: 13px; font-weight: 600; color: var(--gray-700); }
.inbox-thread-date { font-size: 11px; color: var(--gray-400); }
.inbox-thread-body { font-size: 13px; line-height: 1.6; color: var(--gray-600); white-space: pre-wrap; word-break: break-word; }

/* HTML iframe */
.inbox-html-frame {
    width: 100%; border: none; min-height: 200px;
    border-radius: var(--radius-sm); background: var(--white);
}
.inbox-view-toggle {
    display: flex; gap: 4px; margin-bottom: 12px;
}
.inbox-view-btn {
    padding: 4px 12px; border-radius: 14px; font-size: 12px;
    border: 1px solid var(--gray-200); background: var(--white); color: var(--gray-500); cursor: pointer;
}
.inbox-view-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Compose modal */
.inbox-compose-modal { max-width: 600px; width: 95%; }
.inbox-compose-body { min-height: 200px; resize: vertical; font-family: inherit; font-size: 14px; line-height: 1.6; }

/* Pagination */
.inbox-pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; padding: 12px; border-top: 1px solid var(--gray-200);
    font-size: 13px; color: var(--gray-500);
}

/* Sidebar badge */
.inbox-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px; background: var(--accent); color: white;
    font-size: 11px; font-weight: 700; margin-left: auto;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .inbox-container { grid-template-columns: 1fr; }
    .inbox-list { border-right: none; max-height: none; }
    .inbox-detail { border-top: 1px solid var(--gray-200); }
    .inbox-search { flex: 1 1 100%; }
}

/* ==================== Cancellation Flow ==================== */
.cancel-link {
    display: inline-block; margin-top: 18px; font-size: 12px;
    color: var(--gray-400); cursor: pointer; text-decoration: none;
    transition: color .2s;
}
.cancel-link:hover { color: var(--gray-600); text-decoration: underline; }

.cancel-step { display: none; }
.cancel-step.active { display: block; }

.cancel-loss-list {
    list-style: none; padding: 0; margin: 16px 0;
}
.cancel-loss-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; margin-bottom: 6px;
    background: var(--gray-50); border-radius: 8px;
    font-size: 13px; color: var(--gray-700);
}
.cancel-loss-list li i {
    color: var(--accent); font-size: 14px; flex-shrink: 0; width: 18px; text-align: center;
}

.cancel-keep-btn {
    width: 100%; padding: 14px; font-size: 15px; font-weight: 700;
    background: var(--primary); color: white; border: none; border-radius: 10px;
    cursor: pointer; transition: background .2s;
}
.cancel-keep-btn:hover { background: var(--primary-dark, #131329); }

.cancel-continue-link {
    display: block; text-align: center; margin-top: 14px;
    font-size: 12px; color: var(--gray-400); cursor: pointer;
}
.cancel-continue-link:hover { color: var(--gray-600); text-decoration: underline; }

.cancel-verify-input {
    display: block; width: 100%; padding: 14px; font-size: 22px;
    font-weight: 700; text-align: center; letter-spacing: 6px;
    border: 2px solid var(--gray-200); border-radius: 10px;
    font-family: monospace; text-transform: uppercase;
    transition: border-color .2s;
}
.cancel-verify-input:focus { border-color: var(--primary); outline: none; }

.cancel-confirm-input {
    display: block; width: 100%; padding: 12px; font-size: 13px;
    font-family: monospace; border: 2px solid var(--gray-200);
    border-radius: 10px; transition: border-color .2s;
}
.cancel-confirm-input:focus { outline: none; border-color: var(--gray-400); }
.cancel-confirm-input.valid { border-color: #22c55e; }

.cancel-expected-string {
    display: block; margin: 10px 0 16px; padding: 10px 14px;
    background: var(--gray-50); border-radius: 8px;
    font-size: 12px; font-family: monospace; color: var(--gray-600);
    word-break: break-all; user-select: none;
}

.cancel-confirm-btn {
    width: 100%; padding: 14px; font-size: 15px; font-weight: 700;
    background: var(--accent); color: white; border: none; border-radius: 10px;
    cursor: pointer; transition: opacity .2s;
}
.cancel-confirm-btn:disabled { opacity: .4; cursor: not-allowed; }

.cancel-back-link {
    display: block; text-align: center; margin-top: 14px;
    font-size: 13px; color: var(--gray-500); cursor: pointer;
}
.cancel-back-link:hover { text-decoration: underline; }

.cancel-delegate-msg {
    font-size: 14px; color: var(--gray-600); line-height: 1.6; margin: 12px 0;
}
.cancel-delegate-msg strong { color: var(--gray-800); }

.cancel-code-error {
    text-align: center; font-size: 13px; color: var(--accent); margin-top: 10px;
}
.cancel-code-resend {
    text-align: center; margin-top: 8px;
}
.cancel-code-resend a {
    font-size: 12px; color: var(--primary); cursor: pointer; text-decoration: underline;
}

/* Referral Program Card */
.referral-card {
    background: var(--white); border: 1px solid var(--gray-200); border-radius: 16px;
    padding: 28px; margin-top: 16px; margin-bottom: 32px;
}
.referral-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.referral-icon { font-size: 32px; flex-shrink: 0; }
.referral-title {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 18px; font-weight: 700;
    color: var(--primary); margin-bottom: 4px;
}
.referral-desc { font-size: 13px; color: var(--gray-500); }
.referral-link-row { margin-bottom: 24px; }
.referral-link-row label { display: block; font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.referral-input-group { display: flex; gap: 8px; }
.referral-url-input {
    flex: 1; padding: 10px 14px; border: 1px solid var(--gray-200); border-radius: 8px;
    font-size: 13px; color: var(--primary); background: var(--gray-50); font-family: monospace;
}
.referral-wa-btn {
    background: #25D366 !important; border: none; border-radius: 8px; padding: 8px 12px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.referral-wa-btn:hover { background: #1da851 !important; }
.referral-stats-row {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
    text-align: center; padding-top: 20px; border-top: 1px solid var(--gray-100);
}
.referral-stat-val {
    font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800;
    color: var(--primary); margin-bottom: 4px;
}
.referral-stat-label { font-size: 12px; color: var(--gray-500); font-weight: 500; }
@media (max-width: 768px) {
    .referral-input-group { flex-wrap: wrap; }
    .referral-url-input { min-width: 100%; }
}
