/* ==================== HELP TOOLTIPS ==================== */
.help-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1.5px solid var(--text-tertiary);
    background: transparent;
    color: var(--text-tertiary);
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-system);
    cursor: pointer;
    margin-left: 4px;
    opacity: 0.5;
    transition: all var(--duration-normal) var(--ease-out-expo);
    vertical-align: middle;
    padding: 0;
    line-height: 1;
}

.help-tip:hover {
    opacity: 1;
    border-color: var(--system-blue);
    color: var(--system-blue);
    transform: scale(1.15);
}

.help-popover {
    position: fixed;
    z-index: 3000;
    max-width: 280px;
    background: rgba(29, 29, 31, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: white;
    padding: 12px 16px;
    border-radius: 14px;
    corner-shape: squircle;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateY(-4px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
    pointer-events: none;
}

.help-popover.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ==================== GUIDED TOUR ==================== */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 6000;
    display: none;
}

.tour-overlay.active {
    display: block;
}

.tour-backdrop {
    position: fixed;
    inset: 0;
    background: transparent;
    transition: background 0.4s ease;
    animation: tourFadeIn 0.4s ease forwards;
    pointer-events: auto;
}

.tour-overlay.exiting .tour-backdrop {
    animation: tourFadeOut 0.4s ease forwards;
}

.tour-spotlight {
    position: fixed;
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 6001;
    pointer-events: none;
    background: transparent;
}

.tour-tooltip {
    position: fixed;
    z-index: 6002;
    width: 350px;
    max-width: calc(100vw - 40px);
    background: var(--glass-bg-thick);
    backdrop-filter: blur(48px) saturate(180%);
    -webkit-backdrop-filter: blur(48px) saturate(180%);
    border-radius: 20px;
    corner-shape: squircle;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.1);
}

.tour-tooltip.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 400px;
}

.tour-title {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tour-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.tour-tooltip-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--separator);
}

.tour-progress {
    display: flex;
    gap: 6px;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--separator-opaque);
    transition: all var(--duration-slow) var(--ease-out-expo);
}

.tour-dot.active {
    width: 24px;
    border-radius: 4px;
    background: var(--system-blue);
}

.tour-dot.done {
    background: var(--system-green);
}

.tour-actions {
    display: flex;
    gap: 8px;
}

.tour-btn-skip {
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.tour-btn-skip:hover {
    background: rgba(0,0,0,0.05);
    color: var(--text-primary);
}

.tour-btn-next {
    border: none;
    background: var(--system-blue);
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,122,255,0.3);
}

.tour-btn-next:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,122,255,0.4);
}

@keyframes tourFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes tourFadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes tourPop {
    from { opacity: 0; transform: scale(0.92) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.tour-tooltip.center {
    animation: tourPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ==================== RELEASE NOTES ==================== */
.rn-header-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    color: white;
}

.rn-version-badge {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

.rn-header-title {
    font-size: 22px;
    font-weight: 800;
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

.rn-header-subtitle {
    font-size: 13px;
    opacity: 0.6;
    margin-top: 2px;
}

.rn-timeline {
    position: relative;
    padding-left: 24px;
}

.rn-timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(0,0,0,0.06);
    border-radius: 1px;
}

.rn-release {
    position: relative;
    margin-bottom: 20px;
}

.rn-release-dot {
    position: absolute;
    left: -24px;
    top: 18px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    border: 3px solid rgba(0,0,0,0.12);
    z-index: 1;
}

.rn-release.latest .rn-release-dot {
    border-color: var(--system-blue);
    background: var(--system-blue);
    box-shadow: 0 0 0 4px rgba(0,122,255,0.15);
}

.rn-release-card {
    background: var(--glass-bg);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-radius: 14px;
    padding: 18px 20px;
    border: 1px solid rgba(255,255,255,0.48);
    box-shadow: var(--shadow-glass);
}

.rn-release.latest .rn-release-card {
    border-color: rgba(0,122,255,0.12);
    box-shadow: 0 2px 12px rgba(0,122,255,0.06);
}

.rn-release-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.rn-release-version {
    background: rgba(0,122,255,0.08);
    color: var(--system-blue);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: var(--font-display);
}

.rn-release-date {
    font-size: 12px;
    color: var(--text-quaternary);
}

.rn-release-title {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.rn-release-items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.rn-release-items li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 3px 0 3px 18px;
    position: relative;
    line-height: 1.4;
}

.rn-release-items li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0,122,255,0.3);
}

/* ==================== IDEAS BOARD ==================== */
.ideas-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.ideas-stat {
    background: var(--glass-bg);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    border: 0.5px solid rgba(0,0,0,0.04);
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.ideas-stat-num {
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.ideas-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-quaternary);
    margin-top: 2px;
}

.idea-submit-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.idea-input {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 14px;
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    background: #f5f5f7;
    color: var(--text-primary);
    font-family: var(--font-display);
    transition: border-color 0.15s ease;
}

.idea-input:focus { outline: none; border-color: var(--system-blue); background: rgba(255, 255, 255, 0.6); }

.idea-textarea {
    font-size: 13px;
    padding: 10px 14px;
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    background: #f5f5f7;
    color: var(--text-secondary);
    font-family: inherit;
    resize: vertical;
    min-height: 48px;
    transition: border-color 0.15s ease;
}

.idea-textarea:focus { outline: none; border-color: var(--system-blue); background: rgba(255, 255, 255, 0.6); }

.idea-submit-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.idea-category-select {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    background: #f5f5f7;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.ideas-list {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ideas-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-quaternary);
}

.ideas-empty i { font-size: 32px; margin-bottom: 12px; display: block; opacity: 0.3; }
.ideas-empty p { font-size: 14px; }

.idea-card {
    display: flex;
    gap: 12px;
    background: var(--glass-bg);
    border-radius: 14px;
    padding: 14px 16px;
    border: 0.5px solid rgba(0,0,0,0.04);
    box-shadow: 0 1px 4px rgba(0,0,0,0.03);
    transition: all var(--duration-fast) var(--ease-out-expo);
}

.idea-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }

.idea-card.done { opacity: 0.6; }

.idea-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.idea-vote-btn {
    width: 32px;
    height: 28px;
    border: 1.5px solid rgba(0,0,0,0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all var(--duration-fast) var(--ease-out-expo);
}

.idea-vote-btn:hover {
    border-color: var(--system-blue);
    color: var(--system-blue);
    background: rgba(0,122,255,0.04);
}

.idea-vote-count {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
}

.idea-content { flex: 1; min-width: 0; }

.idea-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.idea-category { font-size: 14px; flex-shrink: 0; }

.idea-title-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.idea-status-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 5px;
    flex-shrink: 0;
}

.idea-status-badge.blue { background: rgba(0,122,255,0.08); color: var(--system-blue); }
.idea-status-badge.orange { background: rgba(255,149,0,0.08); color: var(--system-orange); }
.idea-status-badge.green { background: rgba(52,199,89,0.08); color: var(--system-green); }
.idea-status-badge.red { background: rgba(255,59,48,0.08); color: var(--system-red); }

.idea-description {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 4px;
    line-height: 1.4;
}

.idea-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-quaternary);
}

.idea-author i { font-size: 9px; margin-right: 3px; }

.idea-status-select {
    padding: 2px 6px;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 4px;
    font-size: 11px;
    background: #f5f5f7;
    color: var(--text-tertiary);
    cursor: pointer;
}

.idea-delete-btn {
    border: none;
    background: transparent;
    color: var(--text-quaternary);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 11px;
    transition: all var(--duration-fast) var(--ease-out-expo);
}

.idea-delete-btn:hover { color: var(--system-red); background: rgba(255,59,48,0.06); }

/* ==================== AVATAR EDIT HINT ==================== */
.ido-avatar-edit {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ido-hero-avatar:hover .ido-avatar-edit { opacity: 1; }

/* ==================== ICON PICKER ==================== */
.ipk-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 6000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ipk-overlay.visible { opacity: 1; }

.ipk-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.ipk-panel {
    position: relative;
    background: #F5F5F7;
    border-radius: 20px;
    corner-shape: squircle;
    width: 340px;
    max-width: calc(100vw - 48px);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.16), 0 0 0 0.5px rgba(0,0,0,0.04);
    transform: scale(0.94) translateY(8px);
    opacity: 0;
    transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.18s ease-out;
}

.ipk-overlay.visible .ipk-panel { transform: scale(1) translateY(0); opacity: 1; }

.ipk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px 0;
}

.ipk-title {
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-primary);
}

.ipk-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.06);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.ipk-close:hover { background: rgba(0,0,0,0.1); }

.ipk-preview {
    text-align: center;
    padding: 16px 18px 12px;
}

.ipk-preview-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin-bottom: 6px;
    transition: background 0.2s ease;
}

.ipk-preview-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.ipk-section {
    padding: 0 18px 14px;
}

.ipk-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-quaternary);
    margin-bottom: 8px;
}

.ipk-color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ipk-color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2.5px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    transition: all var(--duration-fast) var(--ease-out-expo);
}

.ipk-color-btn:hover { transform: scale(1.15); }
.ipk-color-btn.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px white, 0 0 0 4px rgba(0,0,0,0.15); }

.ipk-icon-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.ipk-icon-btn {
    aspect-ratio: 1;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-secondary);
    transition: all 0.12s ease;
}

.ipk-icon-btn:hover { background: rgba(0,122,255,0.06); color: var(--system-blue); }
.ipk-icon-btn.active { background: var(--system-blue); color: white; }

.ipk-footer {
    padding: 8px 18px 16px;
    display: flex;
    justify-content: flex-end;
}

/* ==================== AVATAR UPLOAD ==================== */
.avatar-upload-hint {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    border-radius: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar-user-avatar:hover .avatar-upload-hint { opacity: 1; }

/* Browse page hidden — replaced by mobile drawer */
#page-browse { display: none !important; }

@media (max-width: 768px) {
    /* Layout */
    .sidebar {
        display: none;
    }
    
    .main-wrapper {
        margin-left: 0;
        padding: 0;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .mobile-nav {
        display: none;
    }

    .main-content {
        padding: var(--space-lg) var(--space-md) 32px;
        padding-top: 64px;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    .summary-strip {
        grid-template-columns: 1fr;
    }
    
    /* Cards & grids */
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .stat-value { font-size: 24px; }
    .stat-health-icon { font-size: 28px; }
    
    .home-attention-grid {
        grid-template-columns: 1fr;
    }
    
    .home-docs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Home Hero — Mobile */
    .home-hero {
        padding: 24px 20px 20px;
        border-radius: 20px;
        margin-bottom: 20px;
    }
    .home-hero-hello { font-size: 15px; }
    .home-hero-date { font-size: 12px; }
    .home-hero-photo { width: 38px; height: 38px; }
    .home-hero-actions { display: none; }
    .home-hero-headline { font-size: 24px; }
    .home-hero-sub { font-size: 13px; }
    .home-hero-metric-value { font-size: 28px; }
    .home-hero-metric-label { font-size: 11px; }
    .home-hero-ambient .ambient-orb { display: none; }
    
    /* Stats Row — Mobile */
    .home-stats-row {
        flex-wrap: wrap;
        padding: 16px 18px;
        gap: 0;
        border-radius: 14px;
        margin-bottom: 20px;
    }
    .home-stat-item {
        flex: 1 1 40%;
        padding: 8px 12px;
        min-width: 0;
    }
    .home-stat-item:first-child { padding-left: 0; }
    .home-stat-item:last-child { padding-right: 0; }
    .home-stat-divider { display: none; }
    .home-stat-value { font-size: 18px; }
    
    /* Nav Grid — Mobile */
    .home-nav-grid {
        grid-template-columns: 1fr;
    }
    .home-nav-tile { padding: 14px 16px; }
    
    /* Documents Editorial — Mobile */
    .doc-editorial-inner { padding: 24px 20px 20px; }
    .doc-editorial-title { font-size: 24px; }
    .doc-editorial-sub { font-size: 13px; }
    .doc-editorial-top { flex-direction: column; gap: 8px; }
    .doc-editorial-stats { flex-wrap: wrap; }
    .doc-dropzone-inner { flex-direction: column; text-align: center; gap: 10px; }
    .doc-dropzone-icon { margin: 0 auto; }
    .doc-dropzone-text { text-align: center; }
    .life-buckets-grid { grid-template-columns: 1fr; gap: 12px; }
    .life-bucket-header { padding: 14px 16px; }
    .life-bucket-preview { padding: 0 16px 12px; }
    
    /* Bills & Expenses Editorial — Mobile */
    .be-editorial { margin-top: 48px; }
    .be-editorial-inner { padding: 16px 20px 24px 20px; min-height: auto; }
    .editorial-illust {
        position: relative;
        left: auto; bottom: auto;
        display: flex;
        justify-content: flex-start;
        padding-left: 20px;
        margin-top: -56px;
        margin-bottom: 8px;
    }
    .editorial-3d-icon { width: 96px; height: 96px; }
    .be-editorial-title { font-size: 24px; }
    .be-summary-strip { padding: 16px 16px; gap: 0; }
    .be-summary-value { font-size: 20px; }
    .be-summary-label { font-size: 10px; }
    .be-main-grid { grid-template-columns: 1fr; }
    .be-expense-row { padding-left: 36px; }
    .be-cat-add { padding-left: 36px; }
    .be-expense-edit { opacity: 1; }
    
    /* Goals Editorial — Mobile */
    .goals-editorial-inner { padding: 24px 20px 20px; flex-direction: column; gap: 10px; }
    .goals-editorial-title { font-size: 24px; }
    .gl-pace-hero { padding: 22px 20px 16px; }
    .gl-pace-amount { font-size: 30px; }
    .gl-pace-split { padding: 8px 20px 16px; }
    .gl-goals-grid { grid-template-columns: 1fr; }
    .gl-mile-actions { opacity: 1; }
    .gl-goal-remove { opacity: 1; }
    
    /* Income Editorial — Mobile */
    .inc-editorial { margin-top: 48px; }
    .inc-editorial-inner { padding: 16px 20px 24px 20px; min-height: auto; }
    .inc-editorial-title { font-size: 24px; }
    .inc-house-total { font-size: 34px; }
    .inc-house-people { flex-direction: column; gap: 10px; padding: 14px 20px; }
    .inc-house-divider { width: 100%; height: 0.5px; }
    .inc-sources-grid { grid-template-columns: 1fr; }
    .inc-additional-remove { opacity: 1; }
    
    /* Scenarios Editorial — Mobile */
    .sc-editorial-inner { padding: 24px 20px 20px; flex-direction: column; gap: 10px; }
    .sc-editorial-title { font-size: 24px; }
    .sc-editorial-insight { max-width: 100%; }
    .sc-cards-grid { grid-template-columns: 1fr; }
    .sc-detail { padding: 18px; }
    .sc-settings-input { width: 140px; }
    .sc-settings-row { flex-wrap: wrap; }
    .sc-settings-row .gl-range { width: 100%; margin-top: 4px; }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    /* Tables */
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    
    /* Calculator popover — bottom anchored */
    .calc-popover {
        top: auto;
        bottom: 88px;
        right: 12px;
        left: 12px;
        width: auto;
        flex-direction: column-reverse;
    }
    .calc-tape-wrapper {
        margin: 0 10px -4px;
    }
    .calc-tape {
        border-radius: 12px 12px 0 0;
        border-top: 0.5px solid rgba(0,0,0,0.05);
        border-bottom: none;
    }
    .calc-tape-tear { display: none; }
    .calc-tape-wrapper.has-tape {
        max-height: 140px;
    }
    
    /* Machine mobile */
    .machine-formula { flex-direction: column; gap: 8px; }
    .machine-formula-op { font-size: 18px; }
    .machine-gears { display: none; }
    .mch-columns { grid-template-columns: 1fr; }
    .mch-col-header { flex-wrap: wrap; }
    .mch-col-totals { width: 100%; justify-content: space-between; margin-top: 8px; }
    .mch-card-body { flex-direction: column; gap: 8px; }
    .mch-card-splits { flex-direction: column; }
    .mch-card-top { flex-direction: column; gap: 4px; }
    .hub-top-grid { grid-template-columns: 1fr; }
    .mch-month-nav { gap: 8px; }
    .mch-nav-month { font-size: 18px; }
    .mch-chart-val { font-size: 8px; }
    .mch-savings-chart { padding: 16px; }
    .variable-pay-grid { grid-template-columns: repeat(4, 1fr); }
    .wiz-variable-grid { grid-template-columns: repeat(4, 1fr); }
    .receipt { max-width: 100%; padding: 20px 16px; }
    .ido-variable-grid { grid-template-columns: repeat(4, 1fr); }
    .ido-field-group { flex-direction: column; gap: 8px; }
    .ido-hero-total { font-size: 26px; }
    .inc-row-avatar { width: 22px; height: 22px; font-size: 16px; }
    .ideas-stats { grid-template-columns: repeat(2, 1fr); }
    .idea-meta { flex-wrap: wrap; }
    .fi-grid { grid-template-columns: 1fr; }

    /* ── Browse Page — Mobile Full Navigation ── */
    .browse-grid {
        display: flex;
        flex-direction: column;
        gap: 28px;
        padding-bottom: 20px;
    }
    .browse-section-label {
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--text-quaternary);
        padding: 0 4px;
        margin-bottom: 12px;
    }
    .browse-tiles {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }
    .browse-tile {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 16px 8px;
        background: var(--glass-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 0.5px solid rgba(255,255,255,0.5);
        border-radius: 18px;
        corner-shape: squircle;
        box-shadow: var(--shadow-sm);
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.2s ease;
        font-family: var(--font-system);
    }
    .browse-tile:active {
        transform: scale(0.93);
        transition: transform 80ms ease;
    }
    .browse-tile-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        corner-shape: squircle;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
    .browse-tile-icon .material-symbols-outlined {
        font-size: 24px;
        font-variation-settings: 'FILL' 0, 'wght' 400;
    }
    .browse-tile-label {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-primary);
        text-align: center;
        line-height: 1.2;
        letter-spacing: -0.01em;
    }

    /* ── Touch Target Minimums ── */
    button, a, [role="button"], [onclick] {
        min-height: 44px;
        min-width: 44px;
    }
    .dp-btn, .pet-card-menu, .goals-section-action, .pe-item-edit,
    .be-expense-edit, .inc-additional-remove, .gl-mile-actions button,
    .gl-goal-remove, .fi-item-attach-btn {
        min-height: 36px;
        min-width: 36px;
        padding: 8px 12px;
    }
    .section-bar-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
    .goals-section-action {
        min-height: 40px;
        padding: 8px 16px;
    }
    .pet-card-menu {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    /* ── Typography — Readability ── */
    .queue-meta-tag { font-size: 10px; }
    .dp-btn { font-size: 12px; }

    /* ── Modals → Bottom Sheet on Mobile ── */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: 20px 20px 0 0;
        corner-shape: squircle;
        max-height: 85vh;
        margin: 0;
        transform: translateY(100%);
        opacity: 1;
    }
    .modal-overlay.active .modal {
        transform: translateY(0);
    }
    .modal::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        border-radius: 2px;
        background: rgba(0,0,0,0.12);
        margin: 10px auto 4px;
    }
    .modal-header {
        padding: 14px 20px 12px;
    }
    .modal-body {
        padding: 0 20px 20px;
    }
    .modal-footer {
        padding: 12px 20px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    /* ── Card Spacing ── */
    .card {
        margin-bottom: 14px;
        border-radius: 18px;
    }
    .card-padding,
    .card > .card-body,
    .be-editorial-inner,
    .inc-editorial-inner {
        padding-left: 18px;
        padding-right: 18px;
    }
    .stat-cards {
        gap: 8px;
    }
    .stat-card {
        padding: 16px 16px;
        border-radius: 16px;
    }
    .pe-item {
        padding: 12px 14px;
    }
    .page > *:not(.section-bar):first-of-type,
    .page > .section-bar + * {
        margin-top: 16px;
    }

    /* ── Section Bar — Mobile Polish ── */
    .section-bar {
        min-height: 140px;
    }
    .section-bar-title {
        font-size: 26px;
    }
    .section-bar-sub {
        font-size: 13px;
    }
    .section-bar-insight {
        font-size: 11px;
        padding: 5px 12px;
    }
    .section-bar-actions {
        width: 100%;
    }
    .section-bar-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 16px;
    }

    /* ── Inputs — Mobile Touch (prevents iOS zoom) ── */
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="url"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        font-size: 16px !important;
        min-height: 44px;
        padding: 10px 14px;
    }
}

@media (max-width: 380px) {
    .browse-tiles { grid-template-columns: repeat(3, 1fr); }
}

/* Safe area for notched devices */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .modal-footer {
            padding-bottom: calc(12px + env(safe-area-inset-bottom));
        }
        .dp-detail-panel,
        .pet-editor-panel,
        .acl-editor-panel {
            padding-bottom: env(safe-area-inset-bottom);
        }
        .mobile-topbar {
            padding-top: env(safe-area-inset-top);
        }
    }
}

/* ═══════════════════════════════════════════
   MOBILE TOP BAR + DRAWER (v44)
   Hidden on desktop, shown on mobile via 768px block above
   ═══════════════════════════════════════════ */

/* -- Top Bar -- */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    height: 56px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border-bottom: 0.5px solid rgba(0,0,0,0.06);
}

.mobile-topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.mobile-topbar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1a1a1a, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.mobile-topbar-avatar .material-symbols-outlined {
    font-size: 18px;
    color: rgba(255,255,255,0.7);
}
.mobile-topbar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.mobile-topbar-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.mobile-topbar-page {
    font-family: var(--font-system);
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.mobile-topbar-menu {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    border-radius: 10px;
    color: var(--text-primary);
    padding: 0;
}
.mobile-topbar-menu .material-symbols-outlined {
    font-size: 26px;
}

/* -- Drawer Overlay -- */
.mobile-drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 299;
    background: rgba(0,0,0,0);
    transition: background 0.3s ease;
    pointer-events: none;
}
.mobile-drawer-overlay.open {
    background: rgba(0,0,0,0.3);
    pointer-events: auto;
}

/* -- Drawer Panel -- */
.mobile-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(320px, 85vw);
    z-index: 300;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(60px) saturate(180%);
    -webkit-backdrop-filter: blur(60px) saturate(180%);
    border-left: 0.5px solid rgba(0,0,0,0.06);
    box-shadow: -8px 0 40px rgba(0,0,0,0.10);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.mobile-drawer.open {
    transform: translateX(0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 16px 12px;
    border-bottom: 0.5px solid rgba(0,0,0,0.06);
}

.mobile-drawer-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1a1a1a, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.mobile-drawer-avatar .material-symbols-outlined {
    font-size: 20px;
    color: rgba(255,255,255,0.7);
}
.mobile-drawer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.mobile-drawer-identity {
    flex: 1;
    min-width: 0;
}
.mobile-drawer-name {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.mobile-drawer-sub {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
}

.mobile-drawer-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    flex-shrink: 0;
    min-height: 34px;
    min-width: 34px;
}
.mobile-drawer-close .material-symbols-outlined {
    font-size: 18px;
}

/* -- Drawer Nav -- */
.mobile-drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 10px 24px;
}

.mobile-drawer-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-quaternary);
    padding: 16px 10px 4px;
}

.mobile-drawer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 10px;
    border: none;
    background: transparent;
    border-radius: 10px;
    corner-shape: squircle;
    cursor: pointer;
    font-family: var(--font-system);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    text-align: left;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
    min-height: 44px;
}
.mobile-drawer-item:active {
    background: rgba(0,0,0,0.05);
}
.mobile-drawer-item.active {
    background: rgba(0,122,255,0.08);
    color: var(--system-blue);
    font-weight: 600;
}
.mobile-drawer-item .material-symbols-outlined {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}
.mobile-drawer-item-muted {
    color: var(--text-tertiary);
}

.mobile-drawer-divider {
    height: 0.5px;
    background: rgba(0,0,0,0.06);
    margin: 8px 10px;
}

/* -- Mobile visibility (must come AFTER base display:none above) -- */
@media (max-width: 768px) {
    .mobile-topbar {
        display: flex;
    }
    .mobile-drawer-overlay {
        display: block;
    }
}
