/* Responsive layout hardening V24 */
html {
    min-width: 0;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-width: 0;
    overflow-x: hidden;
}

img, svg, video, canvas {
    max-width: 100%;
}

input, select, textarea, button {
    max-width: 100%;
}

.shell,
.panel,
.hero-panel,
.metric-card,
.inner-panel,
.workflow-card,
.store-card,
.overview-stat,
.audit-launch,
.audit-launch-form,
.audit-launch-form form,
.selection-grid > *,
.metric-grid > *,
.grid > * {
    min-width: 0;
}

.table-scroll {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table {
    width: 100%;
}

@media (max-width: 900px) {
    body.nav-open {
        overflow: hidden;
    }

    .app-sidebar {
        max-width: calc(100vw - 44px);
        overscroll-behavior: contain;
    }

    .app-topbar {
        width: 100%;
    }

    .profile-dropdown {
        max-width: calc(100vw - 32px);
    }

    .audit-launch {
        min-height: 0;
    }

    .audit-launch-form,
    .audit-launch-visual {
        padding: clamp(24px, 6vw, 42px);
    }
}

@media (max-width: 680px) {
    h1 {
        font-size: clamp(1.7rem, 8vw, 2.25rem);
        overflow-wrap: anywhere;
    }

    h2 {
        font-size: clamp(1.25rem, 6vw, 1.65rem);
        overflow-wrap: anywhere;
    }

    .app-authenticated .shell {
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(14px, env(safe-area-inset-right));
        width: 100%;
    }

    .app-topbar {
        padding-right: max(11px, env(safe-area-inset-right));
    }

    .mobile-nav-toggle {
        left: max(16px, env(safe-area-inset-left));
    }

    .panel,
    .hero-panel,
    .metric-card,
    .inner-panel {
        border-radius: 10px;
    }

    .dashboard-hero,
    .selection-hero,
    .business-admin-hero,
    .store-select-hero {
        min-height: 0;
        padding: 24px 20px;
    }

    .dashboard-hero h1,
    .store-select-hero h1,
    .selection-hero h1,
    .business-admin-hero h1 {
        font-size: clamp(1.85rem, 9vw, 2.35rem);
    }

    /* On phones, keep the workspace label below the brand artwork. */
    .dashboard-hero.has-brand-artwork {
        background: transparent;
        box-shadow: none;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
        min-height: 0;
        padding: 0;
    }

    .dashboard-hero.has-brand-artwork .dashboard-hero-brand-background {
        border-radius: var(--radius-lg);
        grid-area: 1 / 1;
        height: 80px;
        inset: auto;
        position: relative;
    }

    .dashboard-hero.has-brand-artwork .dashboard-hero-content {
        align-items: baseline;
        backdrop-filter: none;
        background: transparent;
        border: 0;
        box-shadow: none;
        display: flex;
        gap: 10px;
        grid-area: 2 / 1;
        justify-content: center;
        left: auto;
        top: auto;
        min-width: 0;
        max-width: 100%;
        padding: 0 8px;
        position: relative;
    }

    .dashboard-hero.has-brand-artwork .dashboard-hero-content .eyebrow {
        color: var(--ink-500, #526474);
        flex: 0 0 auto;
        font-size: 9px;
        letter-spacing: .08em;
        line-height: 1.3;
        opacity: 1;
    }

    .dashboard-hero.has-brand-artwork h1 {
        color: var(--ink-900, #102a43);
        font-size: clamp(14px, 4vw, 18px);
        line-height: 1.2;
        margin: 0;
        min-width: 0;
        overflow-wrap: anywhere;
        text-shadow: none;
    }

    .dashboard-hero.has-brand-artwork .hero-date {
        align-self: center;
        bottom: auto;
        right: auto;
        grid-area: 1 / 1;
        justify-self: end;
        font-size: 11px;
        line-height: 1.3;
        margin: 0 12px;
        position: relative;
        white-space: nowrap;
    }

    .workflow-card,
    .workflow-card:nth-child(n) {
        min-height: 170px;
        padding: 20px;
    }

    .metric-grid,
    .grid,
    .store-card-grid,
    .admin-action-grid,
    .checkbox-grid,
    .action-assignment-grid,
    .action-detail-grid,
    .filter-bar {
        grid-template-columns: minmax(0, 1fr);
    }

    .hero-actions,
    .selection-toolbar,
    .section-heading {
        width: 100%;
    }

    .hero-actions > *,
    .selection-toolbar > *,
    .sticky-actions .actions > *,
    .login-form button,
    .store-picker-form button {
        width: 100%;
    }

    .launch-facts div {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
    }

    .launch-facts strong {
        text-align: left;
    }

    .audit-launch-visual {
        min-height: 300px;
    }

    .audit-launch-visual h1,
    .audit-launch-form h2 {
        font-size: clamp(1.9rem, 9vw, 2.6rem);
    }

    .login-experience {
        min-height: 100svh;
    }

    .login-visual {
        min-height: 360px;
    }

    .login-visual h1 {
        font-size: clamp(2rem, 10vw, 2.75rem);
    }

    .login-proof {
        align-items: flex-start;
        flex-direction: column;
    }

    .login-form-wrap {
        padding: 34px 20px max(34px, env(safe-area-inset-bottom));
    }

    .login-brand {
        margin-bottom: 34px;
    }

    .page-store-select {
        background-attachment: scroll;
    }

    .page-store-select .shell {
        min-height: 100svh;
        padding: max(13px, env(safe-area-inset-top)) max(13px, env(safe-area-inset-right)) max(13px, env(safe-area-inset-bottom)) max(13px, env(safe-area-inset-left)) !important;
    }

    .store-picker-brand {
        align-items: flex-start;
    }

    .store-picker-brand img {
        height: 52px;
        width: 52px;
    }

    .store-picker-panel {
        padding: 24px 18px;
    }

    .store-picker-user {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .store-picker-user a {
        flex-basis: 100%;
        margin-left: 0;
    }

    table {
        font-size: 12px;
        max-width: 100%;
    }

    th, td {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mobile-card-wrap {
        overflow: visible;
    }

    .table-scroll .mobile-card-table,
    .daily-table-wrap .mobile-card-table,
    .mobile-card-table {
        border: 0;
        display: block;
        min-width: 0;
        width: 100%;
    }

    .mobile-card-table thead {
        border: 0;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        height: 1px;
        overflow: hidden;
        position: absolute;
        white-space: nowrap;
        width: 1px;
    }

    .mobile-card-table tbody {
        display: grid;
        gap: 14px;
        width: 100%;
    }

    .mobile-card-table tbody tr {
        background: #fff;
        border: 1px solid #dce5ea;
        border-radius: 12px;
        box-shadow: 0 5px 18px rgba(7, 31, 51, .06);
        display: block;
        overflow: hidden;
        width: 100%;
    }

    .mobile-card-table tbody td {
        align-items: start;
        border: 0;
        border-bottom: 1px solid #e8eef2;
        display: grid;
        gap: 12px;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
        padding: 12px 14px;
        text-align: left;
        width: 100%;
    }

    .mobile-card-table tbody td:last-child {
        border-bottom: 0;
    }

    .mobile-card-table tbody td::before {
        color: #526474;
        content: attr(data-label);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .08em;
        line-height: 1.35;
        text-transform: uppercase;
    }

    .mobile-cell-value {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .mobile-card-table .actions-cell .mobile-cell-value {
        align-items: flex-start;
        display: flex;
        flex-wrap: wrap;
        gap: 10px 16px;
    }

    .mobile-card-table .inline-form {
        margin: 0;
    }

    .actions,
    .button-row {
        align-items: stretch;
        flex-direction: column;
    }

    .actions > *,
    .button-row > * {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .app-authenticated .shell {
        padding-top: 84px;
    }

    .profile-chevron {
        display: none;
    }

    .avatar {
        height: 36px;
        width: 36px;
    }

    .workflow-card,
    .workflow-card:nth-child(n) {
        min-height: 155px;
    }

    .panel,
    .hero-panel {
        padding: 16px;
    }
}
