/* Shared by every shop: vertical mobile layouts and no accidental double-tap zoom. */
html, body, body * {
    touch-action: manipulation;
}

@media (max-width: 767px) {
    html, body {
        max-width: 100%;
        overflow-x: hidden;
        overflow-x: clip;
    }

    body {
        overflow-wrap: anywhere;
    }

    :where(main, section, article, form, fieldset, dialog) {
        min-width: 0;
        max-width: 100%;
    }

    :where(.flex, .grid) > * {
        min-width: 0;
    }

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

    .mobile-modal {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .mobile-modal > div {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        overflow-x: hidden;
        overscroll-behavior-x: none;
    }

    .mobile-modal fieldset {
        min-inline-size: 0;
        max-inline-size: 100%;
    }

    .mobile-modal legend {
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mobile-modal > div > div:has(> [id$="-title"]) {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 8px;
    }

    .mobile-modal [id$="-title"] {
        grid-column: 1;
        grid-row: 1;
    }

    .mobile-modal > div > div:has(> [id$="-title"]) > button {
        grid-column: 2;
        grid-row: 1;
    }

    .mobile-modal [data-branch-scope-hint] {
        grid-column: 1 / -1;
        min-width: 0;
        padding: 0;
        margin: 0;
        color: inherit;
    }

    @supports (-webkit-touch-callout: none) {
        /* Safari also zooms focused form fields when their text is smaller than 16px. */
        input:not([type="checkbox"]):not([type="radio"]), select, textarea {
            font-size: 16px !important;
        }
    }

    .panel-topbar {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) auto;
        gap: 8px;
    }

    .panel-topbar > div[onclick] {
        min-width: 0;
        gap: 6px;
    }

    .panel-topbar #shop-logo-container {
        flex-shrink: 0;
        width: 32px;
        height: 32px;
    }

    #shop-name-header {
        min-width: 0;
    }

    .panel-topbar #shop-name-header > span:first-child {
        font-size: clamp(14px, 4vw, 18px);
    }

    .panel-topbar #shop-name-header > span:last-child {
        font-size: 10px;
        letter-spacing: .08em;
        line-height: 1.4;
    }

    .store-topbar {
        gap: 8px;
    }

    .store-topbar > div:first-child,
    .store-topbar > div:first-child > div {
        min-width: 0;
        gap: 6px;
    }

    .store-topbar > div:first-child {
        flex: 1;
    }

    .store-topbar #shop-logo-container,
    .store-topbar > div:last-child {
        flex-shrink: 0;
    }

    .store-topbar > div:last-child {
        gap: 4px;
    }

    .store-topbar > div:last-child > :is(button, a) {
        padding: 8px;
        min-width: 44px;
        min-height: 44px;
    }

    .store-topbar #shop-name-header > span:first-child {
        font-size: clamp(14px, 3.6vw, 20px);
    }

    .config-tabs,
    #report-type-tabs {
        display: flex;
        flex-wrap: wrap;
        overflow: visible;
    }

    .config-tabs > button,
    #report-type-tabs > button {
        flex: 1 1 100px;
        min-width: 0;
        min-height: 44px;
        white-space: normal;
        overflow-wrap: anywhere;
    }

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

    .mobile-card-table,
    .mobile-card-table tbody {
        display: block;
        width: 100%;
        min-width: 0;
    }

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

    .mobile-card-table tbody tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        padding: 16px 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .mobile-card-table tbody td {
        display: block;
        min-width: 0;
        padding: 0;
        white-space: normal;
    }

    .mobile-card-table tbody td:first-child,
    .mobile-card-table tbody td[colspan] {
        grid-column: 1 / -1;
    }

    .mobile-card-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        font-size: 12px;
        font-weight: 400;
        color: #6b7280;
    }
}
