@media (max-width: 767px) {
    :root { --mobile-nav: 57px; --mobile-text-muted: #8b949e; }
    body { min-height: 100dvh; }
    #appScreen { padding-bottom: calc(var(--mobile-nav) + env(safe-area-inset-bottom, 0px)); }
    .topbar {
        height: 48px;
        padding-inline: max(14px, env(safe-area-inset-left, 0px)) max(14px, env(safe-area-inset-right, 0px));
    }
    .topbar-right { min-width: 0; gap: 7px; }
    .topbar-date { font-size: 11px; white-space: nowrap; }
    .logout-btn { display: flex; align-items: center; min-height: 42px; padding-inline: 7px; }
    #greeting { display: none; }
    .app-container { display: block; min-height: calc(100dvh - 48px - var(--mobile-nav)); }
    .sidebar {
        position: fixed;
        z-index: 105;
        inset: auto 0 0;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        width: auto;
        min-width: 0;
        padding: 4px max(4px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(4px, env(safe-area-inset-left, 0px));
        gap: 3px;
        background: var(--bg-card);
        border: 0;
        border-top: 1px solid var(--border-light);
    }
    .sidebar .nav-item {
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        min-width: 0;
        min-height: 48px;
        padding: 3px 1px;
        font-size: 11px;
        line-height: 1.25;
        text-align: center;
        white-space: nowrap;
    }
    .sidebar .nav-icon { font-size: 16px; line-height: 1.3; }
    .sidebar .nav-item.active { background: var(--accent-dim); color: var(--accent); }
    .sidebar .nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
    .main-content, #dashboard.main-content { width: 100%; min-width: 0; padding: 14px 12px 20px; overflow: visible; }

    #dashboard .dashboard-heading { flex-direction: row; align-items: center; margin-bottom: 12px; }
    #dashboard .dashboard-heading h1 { font-size: 22px; }
    #dashboard .dashboard-kicker, #dashboard .dashboard-subtitle { display: none; }
    #dashboard .dashboard-heading-actions { width: auto; }
    #dashboard .dashboard-heading-actions button { flex: initial; min-height: 42px; padding-inline: 11px; }
    #dashboard .dashboard-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    #dashboard .dashboard-summary { margin-bottom: 12px; }
    #dashboard .dashboard-summary-item { flex-direction: column; gap: 3px; padding: 9px; }
    #dashboard .dashboard-summary-item span { font-size: 11px; white-space: nowrap; }
    #dashboard .dashboard-summary-item strong { font-size: 21px; }
    #dashboard .dashboard-quick-add { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    #dashboard .dashboard-quick-add input[type=text] { grid-column: 1 / -1; }
    #dashboard .dashboard-quick-add input,
    #dashboard .dashboard-quick-add input[type=text],
    #dashboard .search-input { width: 100%; min-width: 0; height: 42px; font-size: 16px; }
    #dashboard .dashboard-quick-add input[type=date] { width: 100%; }
    #dashboard .dashboard-quick-add button { height: 42px; padding-inline: 18px; }
    #dashboard .filter-btn { height: 36px; }
    #dashboard .task-title { overflow-wrap: anywhere; }
    #dashboard .cal-nav, #dashboard .calendar-today-btn { min-width: 38px; height: 38px; }
    #dashboard .calendar-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }

    .modal-overlay { padding: 12px; }
    .modal-box { width: 100%; max-width: 460px; max-height: 85dvh; padding: 16px; }
    .modal-box .form-row { flex-wrap: wrap; }
    .modal-box .form-row .form-group { min-width: min(210px, 100%); }
    .modal-box .date-time-row input { min-width: 0; }
    .modal-box input:not([type=checkbox]), .modal-box textarea, .modal-box select,
    .input-group input, .ds-input-row input, #finance input, #finance select {
        font-size: 16px;
    }
    .modal-close { width: 42px; min-height: 42px; }
    .ds-card, .api-card { min-width: 0; }
    .api-card-header { gap: 6px; flex-wrap: wrap; }
    .api-field-value { min-width: 0; overflow-wrap: anywhere; }

    #finance .finance-calendar-view { padding: 10px; }
    #finance .finance-calendar-weekdays, #finance .finance-calendar-grid { min-width: 0; }
    #finance .finance-calendar-weekdays span { padding: 6px 0; }
    #finance .finance-calendar-toolbar { gap: 8px; }
    #finance .finance-calendar-day, #finance .finance-calendar-blank { min-width: 0; min-height: 43px; }
    #finance .finance-calendar-day { padding: 2px; align-items: center; justify-content: center; }
    #finance .finance-calendar-date { margin: 0; font-size: 13px; }
    #finance .finance-calendar-spend, #finance .finance-calendar-income,
    #finance .finance-calendar-balance, #finance .finance-calendar-today { display: none; }

    #delta .delta-live { margin-bottom: 18px; }
    #delta .delta-live .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    #delta .delta-live .metrics > div { min-width: 0; padding: 9px; }
    #delta .delta-live .metrics dd { overflow-wrap: anywhere; }
    #delta .delta-live .metrics dt, #delta .delta-live .muted, #delta .asset-chart-note { color: var(--mobile-text-muted); }
    #delta .delta-live .controls .btn-sm { min-height: 42px; }
    #delta .delta-live .controls label { flex: 1 1 122px; min-width: 0; }
    #delta .delta-live .controls select, #delta .delta-live .controls input { width: 100%; min-height: 42px; font-size: 16px; }
    #delta .asset-chart-frame { height: 180px !important; }
    #delta .workbench-stacked-table, #delta .workbench-stacked-table tbody { display: block; }
    #delta .workbench-stacked-table thead { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
    #delta .workbench-stacked-table tr {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px 6px;
        margin-bottom: 7px;
        padding: 10px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        background: var(--bg-card);
    }
    #delta .workbench-stacked-table td { min-width: 0; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
    #delta .workbench-stacked-table td::before { content: attr(data-label); display: block; color: var(--mobile-text-muted); font-size: 11px; }
    #delta .workbench-stacked-table td:nth-child(1) { grid-column: span 1; color: var(--text-secondary); font-size: 11px; text-align: right; }
    #delta .workbench-stacked-table td:nth-child(2) { grid-column: span 2; order: -1; font-weight: 650; }
    #delta .workbench-stacked-table td:nth-child(-n+2)::before { display: none; }
}
