/* ============================================================
   FAS Portal — Estilo Florida Aluminum Systems
   Paleta oficial: Navy #0B1E3F · Gold #FFD700 · Blanco #FFFFFF
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* FAS Brand Colors */
    --fas-navy: #0B1E3F;
    --fas-navy-dark: #07152B;
    --fas-gold: #FFD700;
    --fas-gold-hover: #E6C200;
    --fas-gold-dim: rgba(255, 215, 0, 0.12);
    --fas-white: #FFFFFF;
    --fas-offwhite: #F8FAFC;
    --fas-blue: #003366;
    --fas-green: #16A34A;
    
    /* Functional */
    --bg-primary: var(--fas-navy-dark);
    --bg-secondary: var(--fas-navy);
    --bg-card: #0F2445;
    --bg-input: #132A4F;
    --bg-hover: #1A3560;
    --accent: var(--fas-gold);
    --accent-hover: var(--fas-gold-hover);
    --accent-dim: var(--fas-gold-dim);
    --text-primary: #EEF0F4;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border: rgba(255, 255, 255, 0.08);
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #60A5FA;
    --success: var(--fas-green);
    --sidebar-width: 240px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

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

a { color: var(--fas-gold); text-decoration: none; }
a:hover { color: #FFF; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--fas-navy-dark) 0%, var(--fas-navy) 50%, #0D2045 100%);
    padding: 20px;
}

.login-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo img {
    max-width: 200px;
    margin-bottom: 16px;
}

.login-logo h1 {
    color: #FFF;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.login-form input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #FFF;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font-family);
}

.login-form input:focus {
    border-color: var(--fas-gold);
}

.login-form .btn-full {
    margin-top: 8px;
}

.flash-messages {
    margin-bottom: 16px;
}

.flash {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.flash-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
}

.flash-success {
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.3);
    color: #86EFAC;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border);
    gap: 6px;
}

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

.sidebar-brand {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--text-secondary);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-size: 0.85rem;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: #FFF;
}

.nav-item.active {
    background: var(--fas-gold-dim);
    color: var(--fas-gold);
    border-left-color: var(--fas-gold);
}

.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.nav-label { }

.spacer { flex: 1; }

.user-info {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.user-role-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.role-admin { background: var(--fas-gold-dim); color: var(--fas-gold); }
.role-ventas { background: rgba(96, 165, 250, 0.12); color: var(--info); }
.role-cliente { background: rgba(245, 158, 11, 0.12); color: var(--warning); }

.user-name { font-size: 0.8rem; color: var(--text-secondary); }

.logout-btn { margin-top: 5px; }
.logout-btn:hover { color: var(--danger) !important; }

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
    max-width: 1500px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}

.page-header h1, .page-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #FFF;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.last-update { font-size: 0.75rem; color: var(--text-muted); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 { font-size: 0.95rem; font-weight: 600; color: #FFF; }

.card-body { padding: 16px 20px; }

/* ── Stats Row ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255,215,0,0.08);
}

.stat-card-gold { border-top: 3px solid var(--fas-gold); }
.stat-card-blue { border-top: 3px solid var(--info); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--fas-gold);
}

.stat-new { color: var(--info); }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Grid ── */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .grid-2col { grid-template-columns: 1fr; }
}

/* ── Quick Actions ── */
.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

/* ============================================================
   AGENT CARDS
   ============================================================ */
#agentGrid { display: flex; flex-direction: column; gap: 6px; }

.agent-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    border-left: 3px solid #555;
}

.agent-up { border-left-color: var(--fas-green); }
.agent-down { border-left-color: var(--danger); }

.agent-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
}

.agent-up .agent-indicator { background: var(--fas-green); box-shadow: 0 0 6px rgba(22,163,74,0.5); }
.agent-down .agent-indicator { background: var(--danger); }

.agent-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.agent-emoji { font-size: 1.1rem; }

.agent-name { font-weight: 600; font-size: 0.85rem; color: #FFF; }
.agent-desc { font-size: 0.7rem; color: var(--text-muted); }

.agent-meta { font-size: 0.7rem; color: var(--text-secondary); }
.agent-activity { color: var(--fas-gold); }

/* ============================================================
   PIPELINE
   ============================================================ */
.pipeline { display: flex; flex-direction: column; gap: 12px; }

.pipeline-stage { }
.stage-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.8rem;
}
.stage-name { color: var(--text-secondary); }
.stage-count { font-weight: 600; color: #FFF; }

.stage-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.stage-fill { height: 100%; border-radius: 4px; transition: width 0.3s; }
.stage-new { background: var(--info); }
.stage-contacted { background: var(--warning); }
.stage-qualified { background: var(--fas-gold); }
.stage-converted { background: var(--fas-green); }
.stage-lost { background: var(--danger); }

.pipeline-horizontal {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pipeline-box {
    flex: 1;
    min-width: 100px;
    text-align: center;
    padding: 14px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: var(--text-primary);
}

.pipeline-box:hover { 
    border-color: var(--fas-gold); 
    transform: translateY(-1px);
}
.pipeline-box.active { 
    border-color: var(--fas-gold); 
    background: var(--fas-gold-dim); 
}

.pipeline-count { font-size: 1.4rem; font-weight: 700; }
.pipeline-label { font-size: 0.75rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.pipeline-box.pipeline-new .pipeline-count { color: var(--info); }
.pipeline-box.pipeline-contacted .pipeline-count { color: var(--warning); }
.pipeline-box.pipeline-qualified .pipeline-count { color: var(--fas-gold); }
.pipeline-box.pipeline-converted .pipeline-count { color: var(--fas-green); }
.pipeline-box.pipeline-lost .pipeline-count { color: var(--danger); }

/* ============================================================
   ACTIVITY FEED
   ============================================================ */
.activity-feed { display: flex; flex-direction: column; gap: 6px; }

.activity-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.activity-time {
    color: var(--text-muted);
    min-width: 40px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.75rem;
}

.activity-content { flex: 1; }
.activity-desc { color: var(--text-secondary); display: block; margin-top: 2px; }
.activity-body { color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }
.activity-empty { color: var(--text-muted); text-align: center; padding: 20px; font-size: 0.85rem; }

.timeline-date {
    font-weight: 600;
    color: var(--fas-gold);
    padding: 8px 0;
    font-size: 0.85rem;
}

.event-icon { margin-right: 6px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alerts-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
}

.alert-danger { background: rgba(239, 68, 68, 0.08); border: 1px solid rgba(239, 68, 68, 0.25); color: #FCA5A5; }
.alert-warning { background: rgba(245, 158, 11, 0.08); border: 1px solid rgba(245, 158, 11, 0.25); color: #FCD34D; }
.alert-info { background: rgba(96, 165, 250, 0.08); border: 1px solid rgba(96, 165, 250, 0.25); color: #93C5FD; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn, .btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--fas-gold);
    color: var(--fas-navy);
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: var(--font-family);
}

.btn:hover, .btn-gold:hover { 
    background: var(--fas-gold-hover); 
    color: var(--fas-navy);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,215,0,0.3);
}

.btn-sm { padding: 7px 14px; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 0.95rem; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); color: #FFF; transform: none; box-shadow: none; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--fas-gold);
    color: var(--fas-gold);
}
.btn-outline:hover {
    background: var(--fas-gold-dim);
    color: var(--fas-gold);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 14px; }

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

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: #FFF;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font-family);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--fas-gold);
}

textarea { resize: vertical; }

.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-input {
    flex: 1;
    min-width: 200px;
}

.filter-select {
    min-width: 160px;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.table tr:hover { background: var(--bg-hover); }
.clickable { cursor: pointer; }

.phone { font-family: 'SF Mono', Monaco, monospace; font-size: 0.8rem; }
.date-cell { color: var(--text-muted); font-size: 0.75rem; }
.source-cell { font-size: 0.75rem; color: var(--text-muted); }
.empty-table { text-align: center; color: var(--text-muted); padding: 30px; font-size: 0.85rem; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-new { background: rgba(96, 165, 250, 0.12); color: var(--info); }
.badge-contacted { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-qualified { background: var(--fas-gold-dim); color: var(--fas-gold); }
.badge-converted { background: rgba(22, 163, 74, 0.12); color: var(--fas-green); }
.badge-lost { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-pending { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-paid { background: rgba(22, 163, 74, 0.12); color: var(--fas-green); }
.badge-cancelled { background: rgba(239, 68, 68, 0.12); color: var(--danger); }
.badge-draft { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); }

/* ============================================================
   TEMPERATURE
   ============================================================ */
.temperature { font-size: 0.8rem; padding: 4px 10px; border-radius: 20px; }
.temperature-hot { background: rgba(239, 68, 68, 0.12); color: #FCA5A5; }
.temperature-cold { background: rgba(96, 165, 250, 0.12); color: var(--info); }
.temperature-frozen { background: rgba(255, 255, 255, 0.04); color: var(--text-muted); }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 1.1rem; font-weight: 600; color: #FFF; }

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
}

.modal-close:hover { color: #FFF; background: var(--bg-hover); }

.modal-body { padding: 20px; }

/* ============================================================
   PROGRESS BARS
   ============================================================ */
.progress-wrapper {
    margin: 8px 0;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.progress-label span:first-child { color: var(--text-secondary); }
.progress-label span:last-child { color: #FFF; font-weight: 600; }

.progress-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

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

.progress-gold { background: var(--fas-gold); }
.progress-green { background: var(--fas-green); }
.progress-blue { background: var(--info); }

/* ============================================================
   RESPONSIVE - MOBILE FIRST
   ============================================================ */

/* Tablets and below */
@media (max-width: 1024px) {
    .main-content {
        padding: 20px;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* ── Top bar navigation (mobile) ── */
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        flex-direction: row;
        align-items: center;
        padding: 0 12px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        background: var(--fas-navy);
    }

    .sidebar-logo {
        padding: 8px 0;
        border-bottom: none;
        flex-direction: row;
        gap: 8px;
        flex-shrink: 0;
    }

    .sidebar-logo img {
        max-width: 100px !important;
        max-height: 32px;
        width: auto;
        height: auto;
    }

    .sidebar-brand {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        flex: 1;
        padding: 0;
        overflow-x: auto;
        gap: 0;
        margin-left: 8px;
        -webkit-overflow-scrolling: touch;
    }

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

    .nav-item {
        padding: 10px 10px;
        border-left: none;
        border-bottom: 2px solid transparent;
        white-space: nowrap;
        font-size: 0.75rem;
        gap: 4px;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: var(--fas-gold);
    }

    .nav-icon {
        font-size: 0.9rem;
        width: auto;
    }

    .spacer {
        display: none;
    }

    .user-info {
        display: none;
    }

    .logout-btn {
        margin: 0;
        padding: 10px 8px;
    }

    /* ── Main content ── */
    .main-content {
        margin-left: 0;
        margin-top: 52px;
        padding: 14px;
    }

    /* ── Cards & stats ── */
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-value {
        font-size: 1.3rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .page-header h1,
    .page-header h2 {
        font-size: 1.1rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    /* ── Pipeline ── */
    .pipeline-horizontal {
        gap: 4px;
    }

    .pipeline-box {
        min-width: 60px;
        padding: 10px 6px;
    }

    .pipeline-count {
        font-size: 1rem;
    }

    .pipeline-label {
        font-size: 0.6rem;
    }

    /* ── Tables ── */
    .table {
        font-size: 0.72rem;
    }

    .table th,
    .table td {
        padding: 6px 8px;
    }

    /* ── Filters ── */
    .filter-bar {
        flex-direction: column;
        gap: 6px;
    }

    .filter-input,
    .filter-select {
        min-width: unset;
        width: 100%;
    }

    /* ── Agent cards ── */
    .agent-card {
        padding: 8px 10px;
        font-size: 0.75rem;
    }

    .agent-emoji {
        font-size: 0.9rem;
    }

    .agent-name {
        font-size: 0.75rem;
    }

    .agent-desc,
    .agent-meta {
        font-size: 0.65rem;
    }

    /* ── Activity feed ── */
    .activity-item {
        font-size: 0.72rem;
        padding: 6px 0;
    }

    /* ── Templates ── */
    .template-grid {
        grid-template-columns: 1fr;
    }

    .template-card {
        padding: 14px;
    }

    .filter-pills {
        gap: 4px;
    }

    .pill {
        font-size: 0.7rem;
        padding: 4px 10px;
    }

    /* ── Finances ── */
    .roi-grid {
        flex-direction: column;
    }

    .roi-inputs {
        width: 100%;
    }

    .goal-row {
        flex-direction: column;
        gap: 4px;
    }

    .goal-progress {
        width: 100%;
    }

    /* ── Login ── */
    .login-container {
        padding: 24px;
    }

    .login-logo img {
        max-width: 150px !important;
    }

    .login-logo h1 {
        font-size: 1.1rem;
    }

    /* ── Template view ── */
    .template-view-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .view-tabs {
        width: 100%;
    }

    .tab-btn {
        flex: 1;
        text-align: center;
        font-size: 0.75rem;
        padding: 6px 10px;
    }

    .btn-copy {
        width: 100%;
        text-align: center;
    }
}

/* Very small phones */
@media (max-width: 400px) {
    .sidebar-logo img {
        max-width: 80px !important;
        max-height: 26px;
    }

    .nav-item {
        padding: 8px 6px;
        font-size: 0.65rem;
    }

    .nav-icon {
        font-size: 0.75rem;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 1.1rem;
    }
}

/* ============================================================
   MISC
   ============================================================ */
.emoji-header { margin-right: 6px; }

.text-muted { color: var(--text-muted); }
.text-gold { color: var(--fas-gold); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
