@import url('https://fonts.googleapis.com/css2?family=Newsreader:opsz,wght@6..72,400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* Global Variables & Reset */
:root {
    --bg-color: #f8f9fa;
    --bg-secondary: #ffffff;
    --card-bg: #ffffff;
    --text-primary: #151e3a;
    --text-secondary: #475467;
    --accent-color: #12b76a;
    --accent-hover: #0e9f5d;
    --accent-tangerine: #ffa742;
    --border-color: #eaecf0;
    --sidebar-bg: #ffffff;
    --card-shadow: 0 1px 3px rgba(16, 24, 40, 0.1), 0 1px 2px rgba(16, 24, 40, 0.06);
    --input-bg: #fcfcfd;
}

[data-theme="dark"] {
    --bg-color: #0c111d;
    --bg-secondary: #101828;
    --card-bg: #101828;
    --text-primary: #f9fafb;
    --text-secondary: #98a2b3;
    --border-color: #1f242f;
    --sidebar-bg: #101828;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --input-bg: #101828;
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6, .serif-font {
    font-family: 'Newsreader', serif;
    letter-spacing: -0.02em;
}

/* Auth Layout */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.auth-box {
    background: var(--bg-secondary);
    padding: 3rem;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    width: 400px;
    text-align: center;
    border: 1px solid var(--border-color);
}
.auth-box h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.auth-box p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}
.pin-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: none;
}
.pin-error.show { display: block; }

/* Main Layout */
#app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar 1: Slim Icons Navigation */
.sidebar-icons {
    width: 72px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    z-index: 101;
    flex-shrink: 0;
    height: 100vh;
}

.sidebar-logo {
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.icon-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.icon-links li {
    width: 100%;
    display: flex;
    justify-content: center;
}

.icon-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    text-decoration: none;
}

.icon-links a:hover {
    color: var(--accent-color);
    background: var(--bg-color);
}

.icon-links a.active {
    color: var(--accent-color);
    background: rgba(18, 183, 106, 0.1);
}

.sidebar-icons-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
}

.theme-toggle-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
}

.theme-toggle-icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-color);
}

/* Theme Icon display states */
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
}

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

/* Sidebar 2: Nested Submenu Navigation */
.sidebar-menu {
    width: 230px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    z-index: 100;
    flex-shrink: 0;
    height: 100vh;
    transition: width 0.3s ease;
}

.sidebar-brand {
    padding: 0.5rem 0.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.brand-text-span {
    font-family: 'Newsreader', serif;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.logo-img {
    max-height: 30px;
    object-fit: contain;
    align-self: flex-start;
}

.menu-sections-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    flex: 1;
    overflow-y: auto;
}

/* Custom scrollbar for sidebar menu scroll */
.menu-sections-wrapper::-webkit-scrollbar {
    width: 4px;
}
.menu-sections-wrapper::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.05);
    border-radius: 2px;
}

.menu-section {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.75px;
    padding-left: 0.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.menu-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.menu-links a svg {
    opacity: 0.8;
}

.menu-links a:hover {
    color: var(--text-primary);
    background: var(--bg-color);
}

.menu-links a.active {
    color: var(--text-primary);
    background: var(--bg-color);
    font-weight: 600;
}

.menu-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(18, 183, 106, 0.1);
    color: var(--accent-color);
}

.menu-badge.badge-orange {
    background: rgba(255, 167, 66, 0.1);
    color: var(--accent-tangerine);
}

.sidebar-menu-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.menu-user-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
}

.menu-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.menu-user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: left;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Main Content Area */
.content-area {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 2rem 3rem;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.view-header h1 {
    font-size: 2rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Tabs */
.tabs-container {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}
.tab-btn:hover {
    color: var(--text-primary);
}
.tab-btn.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    font-weight: 600;
}

/* Buttons */
.primary-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.primary-btn:hover {
    background: var(--accent-hover);
}

.primary-btn.full-width {
    width: 100%;
}

.secondary-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}
.secondary-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* CRM Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-card p {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Table */
.data-table-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    overflow-x: auto;
    box-shadow: var(--card-shadow);
}

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

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-lead { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.status-active { background: rgba(16, 185, 129, 0.1); color: #059669; }
.status-closed { background: rgba(107, 114, 128, 0.1); color: #4b5563; }

[data-theme="dark"] .status-lead { color: #fcd34d; background: rgba(245, 158, 11, 0.2); }
[data-theme="dark"] .status-active { color: #6ee7b7; background: rgba(16, 185, 129, 0.2); }
[data-theme="dark"] .status-closed { color: #d1d5db; background: rgba(107, 114, 128, 0.2); }

.action-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 0.5rem;
    font-weight: 500;
}
.action-btn:hover { text-decoration: underline; }
.action-btn.delete { color: #ef4444; }

/* Side Panels */
.side-panel {
    position: fixed;
    top: 0; right: -500px;
    width: 450px;
    height: 100vh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}
.side-panel.open {
    right: 0;
}
.side-panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
.side-panel-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}
.close-panel-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    z-index: 100;
    position: relative;
}
.close-panel-btn:hover { color: var(--text-primary); }

/* Forms */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}
.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
}
.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}
.form-group textarea {
    resize: vertical;
    min-height: 80px;
}
.row-group {
    display: flex;
    gap: 1rem;
}
.half-width { flex: 1; }

/* CRM Lead Options Section */
.leads-section {
    padding: 1rem;
    background: var(--input-bg);
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}
.leads-section h3 {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Tracker Grid */
.tracker-layout {
    display: flex;
    gap: 1.5rem;
}
.tracker-main {
    flex: 1;
}
.tracker-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
}

.grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}
.grid-7col {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-height: 60vh;
    overflow-y: auto;
}
.day-box {
    position: relative;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--input-bg);
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s;
}
.day-box:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}
.day-box.today {
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}
.day-box.selected {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
}
.red-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
}

/* Detail panel */
.detail-section h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.detail-section { margin-bottom: 2rem; }

.task-input-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.task-input-row input { flex: 1; }
.icon-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 40px;
    border-radius: 8px;
    cursor: pointer;
}
.task-list { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.task-item { display: flex; justify-content: space-between; align-items: center; background: var(--input-bg); padding: 0.75rem; border-radius: 8px;}
.task-item.completed span { text-decoration: line-through; color: var(--text-secondary); }
.task-item-checkbox { margin-right: 0.5rem; cursor: pointer; }
.task-item-del { background: none; border: none; color: #ef4444; cursor: pointer; }

/* Habits */
.habit-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; cursor: pointer; }

/* Hours */
.hours-row { display: flex; align-items: center; gap: 0.5rem; }
.hours-row input { flex: 1; }
.duration-text { margin-top: 0.5rem; font-size: 0.9rem; font-weight: bold; color: var(--accent-color); }

/* Mood */
.mood-selector { display: flex; justify-content: space-between; }
.mood-btn {
    width: 45px; height: 45px;
    border-radius: 50%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}
.mood-btn.selected { background: var(--accent-color); color: white; border-color: var(--accent-color); }

.detail-actions { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--border-color); }

.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 60vh;
    overflow-y: auto;
}
.timeline-item {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.hidden { display: none !important; }

/* View vs Edit Modes */
.view-mode .edit-only { display: none !important; }
.edit-mode .view-only { display: none !important; }

/* Premium Dashboard Header & Mockup Controls */
.dashboard-header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    gap: 1.25rem;
    width: 100%;
}
.balance-summary {
    display: flex;
    flex-direction: column;
    text-align: left;
}
.balance-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.75px;
    opacity: 0.8;
}
.balance-amount-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.35rem;
}
.balance-amount {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    letter-spacing: -0.75px;
    margin: 0;
    line-height: 1;
}
.change-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.65rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}
.change-badge.badge-green {
    background: rgba(18, 183, 106, 0.1);
    color: var(--accent-color);
}
.dashboard-header-controls {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.header-tabs {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}
.header-tab-btn {
    background: transparent;
    border: none;
    padding: 0.45rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.header-tab-btn:hover {
    color: var(--text-primary);
}
.header-tab-btn.active {
    background: var(--text-primary);
    color: var(--bg-secondary);
}
[data-theme="dark"] .header-tab-btn.active {
    background: var(--bg-color);
    color: var(--text-primary);
}
.customize-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.customize-btn:hover {
    background: var(--bg-color);
    border-color: var(--border-color);
}
.customize-btn svg {
    opacity: 0.8;
}

.chart-card-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 1px;
    opacity: 0.75;
    margin-bottom: 0.5rem;
    display: block;
}

/* ╔══════════════════════════════════════════════════════════════╗
   ║          GLOBAL MOBILE RESPONSIVE — All Pages               ║
   ╚══════════════════════════════════════════════════════════════╝ */

/* ── Mobile bottom nav component (hidden on desktop) ────────── */
.mob-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    z-index: 500;
    padding: 0.4rem 0 calc(0.4rem + env(safe-area-inset-bottom));
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.mob-nav-item {
    display: flex; flex-direction: column;
    align-items: center; gap: 0.18rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.6rem; font-weight: 600;
    letter-spacing: 0.2px;
    padding: 0.25rem 0.4rem;
    border-radius: 10px;
    transition: color 0.2s;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
}
.mob-nav-item svg { width: 21px; height: 21px; flex-shrink: 0; }
.mob-nav-item.active { color: var(--accent-color); }
.mob-nav-item.active svg { stroke: var(--accent-color); }
.mob-nav-fab {
    background: var(--accent-color);
    color: white; border: none; border-radius: 50%;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(18,183,106,0.45);
    font-size: 1.5rem; font-weight: 300; line-height: 1;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.mob-nav-fab:active { transform: scale(0.94); }

/* FAB Quick-Action Sheet */
.mob-fab-sheet {
    display: none;
    position: fixed;
    bottom: 76px; left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px; padding: 0.4rem;
    z-index: 501; min-width: 210px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    animation: sheetSlideUp 0.2s ease;
}
.mob-fab-sheet.mob-sheet-open { display: block; }
@keyframes sheetSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.mob-sheet-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.8rem 1rem; border-radius: 10px;
    cursor: pointer; font-size: 0.9rem; font-weight: 600;
    color: var(--text-primary); text-decoration: none;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.mob-sheet-item:hover, .mob-sheet-item:active { background: var(--bg-color); }

/* ── @media: ≤ 768px ─────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Show mobile nav */
    .mob-nav { display: flex; }

    /* Body: allow scroll, kill horizontal overflow */
    body {
        overflow: auto;
        overflow-x: hidden;
    }

    /* Kill both desktop sidebars */
    .sidebar-icons,
    .sidebar-menu {
        display: none !important;
    }

    /* App fills screen vertically */
    #app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        width: 100%;
    }

    /* Content area: full width, scrollable, bottom pad for nav */
    .content-area {
        padding: 1.1rem 1rem 6rem 1rem;
        overflow-y: auto;
        overflow-x: hidden;
        width: 100%;
        min-height: 100vh;
        height: auto;
    }

    /* ── Page header ── */
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 1.25rem;
    }
    .view-header h1 { font-size: 1.45rem; }
    .view-header > div,
    .view-header > button { width: 100%; }

    /* Dashboard header */
    .dashboard-header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.75rem;
    }
    .dashboard-header-controls {
        width: 100%;
        flex-wrap: wrap;
    }
    .header-tabs {
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .header-tabs::-webkit-scrollbar { display: none; }
    .balance-amount { font-size: 2rem; }

    /* ── Stats grids ── */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem;
        margin-bottom: 1.25rem;
    }
    .stat-card { padding: 1rem; }
    .stat-card p { font-size: 1.6rem; }

    /* ── Data tables: horizontal scroll ── */
    .data-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.85rem;
        font-size: 0.83rem;
        white-space: nowrap;
    }

    /* ── Tabs ── */
    .tabs-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
    }
    .tabs-container::-webkit-scrollbar { display: none; }
    .tab-btn {
        white-space: nowrap;
        padding: 0.65rem 1rem;
        font-size: 0.83rem;
    }

    /* ── Modals → bottom sheet ── */
    .modal-overlay { align-items: flex-end; }
    .modal-box {
        border-radius: 22px 22px 0 0;
        width: 100%; max-width: 100%;
        padding: 1.5rem 1.1rem 2rem;
        max-height: 90vh;
    }
    .modal-box h2 { font-size: 1.1rem; }

    /* ── Side panel ── */
    .side-panel { width: 100%; right: -100%; }

    /* ── Row groups → stack ── */
    .row-group { flex-direction: column; gap: 0; }
}

/* ── @media: ≤ 480px (small phones) ─────────────────────────── */
@media (max-width: 480px) {
    .content-area { padding: 1rem 0.85rem 6rem 0.85rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
    .stat-card { padding: 0.85rem; }
    .stat-card p { font-size: 1.4rem; }
    .balance-amount { font-size: 1.7rem; }
    .view-header h1 { font-size: 1.25rem; }
    .data-table th,
    .data-table td { font-size: 0.78rem; padding: 0.6rem 0.7rem; }
}

