/* ═══════════════════════════════════════════════════════════
   Mobile layout (phones) — loaded AFTER theme.css
   Clean single-row header, icon buttons, compact cards.
   Desktop is untouched (everything is inside the media query).
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    .container { padding: 10px 10px calc(18px + env(safe-area-inset-bottom)); }

    /* ── Header: one tidy row ── */
    header {
        padding: 8px 10px !important;
        border-radius: 14px !important;
        flex-wrap: nowrap;
        gap: 8px;
        margin-bottom: 10px !important;
    }
    .header-left { gap: 7px !important; min-width: 0; flex: 1 1 auto; }
    .hamburger-btn {
        width: 38px; height: 38px; padding: 0 !important; border-radius: 10px !important;
        align-items: center; gap: 4px !important;
    }
    .hamburger-btn span { width: 17px !important; }
    .logo-container { width: 38px !important; height: 38px !important; }
    .header-title { min-width: 0; }
    .header-title h1 {
        font-size: 0.86rem !important; line-height: 1.15; margin: 0 !important; letter-spacing: -0.1px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .header-title p {
        font-size: 0.5rem !important; line-height: 1.25; margin: 0;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        letter-spacing: 0 !important;
    }
    .header-right { gap: 6px !important; flex: 0 0 auto; }

    /* round icon buttons: sync badge, bell, theme */
    .notif-bell-btn, #syncBadgeBtn, #themeToggleBtn {
        width: 38px !important; height: 38px !important; border-radius: 10px !important;
        padding: 0 !important; margin: 0 !important;
        display: flex; align-items: center; justify-content: center;
        font-size: 1rem; line-height: 1;
    }
    #themeToggleBtn { gap: 0; }
    .theme-toggle-label { display: none !important; }
    .theme-toggle-icon { font-size: 1.05rem; }
    .notif-badge { top: -5px; right: -5px; }

    /* ── Offline banner: slim ── */
    #offlineBanner {
        font-size: 0.74rem !important; padding: 6px 12px !important; margin: 8px 10px 0 !important;
        border-radius: 999px !important; gap: 6px !important; animation: none !important;
    }

    /* ── Search ── */
    .quick-search-container { margin-bottom: 10px !important; }
    .quick-search-bar { border-radius: 12px !important; padding: 2px 4px 2px 12px !important; }
    .quick-search-bar input { font-size: 0.88rem !important; padding: 10px 4px !important; min-width: 0; }
    .search-icon { font-size: 0.95rem; margin-right: 6px; }

    /* ── Tabs: segmented control (MO / SR / Delayed) ── */
    .nav-tabs-bar {
        display: grid !important; grid-template-columns: repeat(3, 1fr);
        width: 100% !important; gap: 4px !important; padding: 4px !important;
        border-radius: 14px !important; margin-bottom: 12px !important; box-sizing: border-box;
    }
    .nav-tab {
        flex-direction: column; justify-content: center; align-items: center;
        gap: 2px !important; padding: 8px 2px !important; border-radius: 10px !important;
        font-size: 0.68rem !important; line-height: 1.15; text-align: center; white-space: normal !important;
        position: relative; min-width: 0;
    }
    .nav-tab .tab-badge { font-size: 0.62rem; padding: 0 6px; }

    /* ── Section title ── */
    .section-title { font-size: 0.92rem !important; margin-bottom: 10px !important; padding-bottom: 8px !important; }

    /* ── Month cards: compact, one per row ── */
    .month-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
    .month-card { border-radius: 14px !important; }
    .month-card:hover { transform: none; }
    .month-card-header { padding: 12px 12px 10px !important; }
    .month-card-header h3 { font-size: 0.8rem !important; margin: 0 0 6px !important; letter-spacing: 0.8px; text-transform: uppercase; }
    .month-card-total { margin-bottom: 10px !important; }
    .month-card-total-num { font-size: 2.1rem !important; }
    .month-card-total-lbl { font-size: 0.6rem !important; }
    .month-stats-row { gap: 6px !important; }
    .month-stat-pill { padding: 6px 2px !important; border-radius: 8px !important; }
    .msp-num { font-size: 1rem !important; }
    .msp-lbl { font-size: 0.54rem !important; letter-spacing: 0.2px !important; }
    .month-card-footer { padding: 8px 12px !important; font-size: 0.74rem !important; }

    /* ── Month / task list screen (full-screen sheet) ── */
    #monthModal { padding: 0 !important; }
    #monthModal .month-modal-content {
        width: 100% !important; max-width: none !important; height: 100vh !important; height: 100dvh !important;
        border-radius: 0 !important; border: none !important;
    }
    .month-modal-header { padding: 12px 14px !important; flex-wrap: nowrap !important; gap: 10px !important; }
    .month-modal-header h2 { font-size: 0.98rem !important; line-height: 1.2; }
    #monthModalSubtitle, .month-modal-header p { color: #d5eef7 !important; font-size: 0.72rem !important; margin-top: 3px !important; line-height: 1.3; }
    .month-modal-header .modal-close { flex: 0 0 auto; width: 34px; height: 34px; }
    .month-modal-body { padding: 10px 12px calc(16px + env(safe-area-inset-bottom)) !important; }

    /* filters: status + sort side by side, search fields full width */
    .month-view-filters {
        display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important;
        padding: 10px !important; margin-bottom: 12px !important; border-radius: 12px !important;
    }
    .month-view-filters > * { min-width: 0 !important; max-width: none !important; width: 100% !important; box-sizing: border-box; height: 40px; }
    .month-view-filters .filter-select, .month-view-filters .month-search-input { font-size: 0.82rem !important; padding: 0 12px !important; border-radius: 10px !important; }
    #monthFilterType { grid-column: 1 / -1; order: 0; }
    #monthFilterStatus { order: 1; }
    #monthSortSelect { order: 2; }
    #monthSearchInput { grid-column: 1 / -1; order: 3; }
    #monthFilterReport { grid-column: 1 / -1; order: 4; }
    #clearMonthSearchBtn { order: 5; grid-column: 1 / -1; }

    /* task cards */
    .tc-list { gap: 10px !important; padding: 0 !important; }
    .tc { border-radius: 12px !important; }
    .tc:hover { transform: none; }
    .tc__head { padding: 10px 12px 9px !important; }
    .tc__mo { font-size: 0.95rem !important; }
    .tc__pill { font-size: 0.58rem !important; padding: 3px 8px !important; }
    .tc__body { padding: 6px 12px 9px !important; }
    .tc__row { padding: 5px 0 !important; align-items: flex-start !important; }
    .tc__lbl { width: 100px !important; font-size: 0.6rem !important; line-height: 1.5; letter-spacing: 0.04em !important; }
    .tc__colon { margin-right: 6px !important; line-height: 1.4; }
    .tc__val { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; word-break: break-word; font-size: 0.8rem !important; line-height: 1.35; }

    /* completed dropdown inside a month */
    .completed-table-header { gap: 10px; }
    .completed-table-controls { flex-wrap: wrap; gap: 6px; }

    /* ── Notification panel fits the screen ── */
    .notif-panel { width: calc(100vw - 20px) !important; right: -56px !important; max-height: 70vh; }
}

@media (max-width: 360px) {
    .header-title p { display: none; }
    .msp-lbl { font-size: 0.5rem !important; }
}
