/* RestoOne · adaptación móvil global */
@media (max-width: 760px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        -webkit-text-size-adjust: 100%;
    }

    img,
    video,
    canvas,
    svg {
        max-width: 100%;
        height: auto;
    }

    input,
    select,
    textarea,
    button {
        max-width: 100%;
    }

    /* Evita el zoom automático de Safari/iPhone al enfocar formularios. */
    input,
    select,
    textarea {
        font-size: 16px;
    }

    .app-top-shell,
    .app-main,
    .content,
    .topnav-content,
    .section-card,
    .stat-card,
    .checklist-workspace,
    .checklist-browser,
    .record-layout,
    .record-main,
    .record-side {
        min-width: 0;
        max-width: 100%;
    }

    .app-header {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        gap: .55rem;
        padding: max(.65rem, env(safe-area-inset-top)) .75rem .7rem;
    }

    .brand-zone,
    .user-zone,
    .header-center {
        min-width: 0;
    }

    .header-center {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
    }

    .header-control {
        min-height: 46px;
    }

    .brand-button {
        max-width: 100%;
        padding: .35rem .4rem;
    }

    .header-brand-logo,
    .header-brand-mark,
    .user-avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
        border-radius: 10px;
    }

    .brand-button .header-copy strong {
        max-width: min(52vw, 230px);
        font-size: .9rem;
    }

    .brand-button .header-copy span,
    .user-copy,
    .user-button .menu-caret,
    .branch-role-badge {
        display: none;
    }

    .user-button {
        padding: .35rem;
    }

    .branch-menu {
        width: 100%;
        max-width: none;
    }

    .branch-context-button {
        width: 100%;
        min-height: 48px;
        padding: .5rem .7rem;
    }

    .branch-context-copy strong {
        font-size: .9rem;
    }

    .branch-menu .context-menu-links {
        position: absolute;
        top: calc(100% + .35rem);
        left: 0 !important;
        right: 0 !important;
        transform: none;
        width: 100%;
        min-width: 0;
        max-height: min(68vh, 520px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .user-menu .context-menu-links {
        position: absolute;
        top: calc(100% + .35rem);
        left: auto !important;
        right: 0 !important;
        width: min(86vw, 310px);
        min-width: 0;
        max-height: min(72vh, 520px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .context-menu-links a,
    .context-menu-action {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .app-main {
        width: 100%;
        padding: 0 .75rem calc(1.5rem + env(safe-area-inset-bottom));
    }

    .page-header {
        padding: .9rem .15rem .15rem;
    }

    .page-header h1 {
        margin-top: .1rem;
        font-size: clamp(1.28rem, 6vw, 1.55rem);
        line-height: 1.15;
        overflow-wrap: anywhere;
    }

    .topnav-content,
    .content {
        padding: .7rem 0 0;
    }

    .hero-card,
    .dashboard-hero,
    .manager-hero {
        display: grid;
        gap: .85rem;
        padding: 1rem;
        border-radius: 18px;
    }

    .hero-card h2,
    .visual-card h2 {
        font-size: clamp(1.35rem, 7vw, 1.7rem);
        line-height: 1.12;
        overflow-wrap: anywhere;
    }

    .hero-card p {
        margin-bottom: .2rem;
        line-height: 1.5;
    }

    .hero-icon {
        display: none;
    }

    .stats-grid,
    .progress-stats-grid,
    .overview-kpi-grid,
    .validation-kpi-grid,
    .operator-validation-stats,
    .history-kpis,
    .record-meta-grid,
    .overview-area-grid,
    .overview-two-col,
    .review-queue-grid,
    .two-col,
    .membership-fields,
    .record-layout,
    .record-side {
        grid-template-columns: minmax(0, 1fr);
    }

    .overview-main-progress,
    .operator-validation-stats .general-progress-card {
        grid-column: auto;
    }

    .section-card,
    .stat-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .section-heading,
    .checklist-filter-heading,
    .checklist-results-heading,
    .checklist-list-header,
    .membership-head,
    .execution-summary,
    .record-hero,
    .overview-area-head,
    .review-queue-head {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: .65rem;
        align-items: start;
    }

    .section-heading > *,
    .checklist-filter-heading > *,
    .checklist-results-heading > *,
    .membership-head > *,
    .execution-summary > *,
    .record-hero > * {
        min-width: 0;
    }

    .section-heading h3,
    .checklist-list-header h3,
    .checklist-results-heading h3,
    .checklist-filter-heading h3,
    .execution-summary h2,
    .record-hero h2 {
        overflow-wrap: anywhere;
    }

    .count-badge,
    .selected-area-badge {
        justify-self: start;
    }

    .btn {
        min-height: 44px;
        max-width: 100%;
        white-space: normal;
        text-align: center;
    }

    .form-stack,
    .form-grid {
        min-width: 0;
    }

    .form-grid,
    .color-fields,
    .builder-section-title-fields,
    .builder-section-head,
    .builder-add-section,
    .execution-question,
    .record-answer-row,
    .overview-filters,
    .history-filters,
    .review-queue-meta {
        grid-template-columns: minmax(0, 1fr);
    }

    .form-grid .full,
    .setup-note,
    .history-search {
        grid-column: auto;
    }

    .setup-note {
        display: grid;
    }

    .area-options {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .area-option {
        min-height: 44px;
        width: 100%;
    }

    .area-chip-list,
    .area-tabs,
    .period-tabs {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .frequency-block {
        display: grid;
        gap: .6rem;
    }

    .frequency-tabs {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .frequency-tab {
        min-width: 0;
        padding: .55rem .2rem;
        font-size: .77rem;
    }

    .assigned-checklist-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .assigned-checklist-actions,
    .manager-hero-actions,
    .record-hero-actions,
    .history-filter-actions,
    .review-actions,
    .execution-actions,
    .dashboard-inline-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    .assigned-checklist-actions .btn,
    .manager-hero-actions .btn,
    .record-hero-actions .btn,
    .history-filter-actions .btn,
    .review-actions .btn,
    .execution-actions .btn,
    .dashboard-inline-actions .btn {
        width: 100%;
    }

    .execution-question,
    .record-answer-row {
        padding: .9rem;
        gap: .8rem;
    }

    .execution-section-head {
        display: grid;
        gap: .55rem;
        padding: .9rem;
    }

    .choice-grid,
    .choice-grid.multi {
        grid-template-columns: minmax(0, 1fr);
    }

    .choice-card {
        min-height: 50px;
    }

    .execution-actions {
        position: static;
        padding: .75rem;
    }

    .table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }

    .table-wrap table,
    .overview-table,
    .history-table {
        width: max-content;
        min-width: 100%;
        max-width: none;
    }

    th,
    td {
        padding: .72rem .6rem;
        font-size: .82rem;
    }

    td small {
        white-space: normal;
        max-width: 240px;
    }

    .table-actions {
        flex-wrap: nowrap;
    }

    .table-actions .btn {
        min-height: 40px;
        white-space: nowrap;
    }

    .login-page {
        display: block;
        min-height: 100dvh;
    }

    .login-panel {
        min-height: 100dvh;
        width: 100%;
        max-width: none;
        padding: max(1.25rem, env(safe-area-inset-top)) 1rem max(1.25rem, env(safe-area-inset-bottom));
    }

    .login-visual {
        display: none;
    }

    .login-brand h1 {
        font-size: 1.6rem;
    }

    .setup-page {
        min-height: 100dvh;
        padding: max(1rem, env(safe-area-inset-top)) .75rem max(1rem, env(safe-area-inset-bottom));
    }

    .setup-card,
    .setup-card.wide {
        width: 100%;
        padding: 1rem;
        border-radius: 16px;
    }

    .sticky-card {
        position: static;
    }

    .record-answer-value > span,
    .record-timeline p,
    .muted,
    td,
    th {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 390px) {
    .app-header {
        padding-left: .6rem;
        padding-right: .6rem;
    }

    .app-main {
        padding-left: .6rem;
        padding-right: .6rem;
    }

    .brand-button .header-copy strong {
        max-width: 46vw;
    }

    .frequency-tab {
        font-size: .72rem;
    }
}
