@media (max-width: 1200px) {
    .content-grid,
    .stats-grid.compact,
    .dashboard-hero,
    .auth-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: min(86vw, 320px);
        transform: translateX(-105%);
        transition: transform 0.24s ease;
        z-index: 20;
        box-shadow: 0 22px 40px rgba(25, 15, 10, 0.3);
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .mobile-nav-toggle {
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 24;
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        width: 46px;
        height: 46px;
        padding: 0;
        border: 0;
        border-radius: 16px;
        background: rgba(255, 250, 243, 0.92);
        box-shadow: var(--shadow-soft);
        color: var(--text);
    }

    .mobile-nav-overlay {
        position: fixed;
        inset: 0;
        z-index: 18;
        display: block;
        opacity: 0;
        pointer-events: none;
        background: rgba(27, 20, 13, 0.45);
        transition: opacity 0.2s ease;
    }

    .mobile-nav-overlay.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        padding: 76px 18px 26px;
    }

    .topbar {
        flex-direction: column;
        padding: 22px 20px;
    }

    .topbar-user {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 820px) {
    .content-grid,
    .stats-grid,
    .form-grid,
    .details-grid,
    .invoice-row,
    .auth-feature-grid,
    .auth-trust-row {
        grid-template-columns: 1fr;
    }

    .card,
    .stat-card,
    .login-card {
        border-radius: 22px;
    }

    .main-content,
    .auth-main {
        padding-inline: 16px;
    }

    .card-header {
        flex-direction: column;
        align-items: stretch;
    }

    .actions,
    .filter-bar,
    .invoice-header,
    .summary-box,
    .confirm-modal-actions,
    .auth-help {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar h1 {
        font-size: 2rem;
    }

    .toast-stack {
        top: 12px;
        right: 12px;
        left: 12px;
        width: auto;
    }
}

@media (max-width: 560px) {
    .main-content {
        padding: 72px 12px 20px;
    }

    .auth-shell {
        padding: 12px;
    }

    .login-card,
    .card,
    .stat-card,
    .dashboard-hero-copy,
    .dashboard-hero-panel,
    .auth-panel-brand {
        padding: 18px;
    }

    th,
    td {
        padding: 12px 8px;
    }

    .btn {
        width: 100%;
    }

    .dashboard-hero-copy h2,
    .auth-panel-brand h1 {
        font-size: 2.2rem;
    }
}
