/* Shared narrow-viewport rules for teller pages.
 * Keep page-specific layouts and desktop styling unchanged; this file only
 * changes the shell and dense controls below tablet width.
 */

@media (max-width: 900px) {
    html,
    body {
        max-width: 100%;
        width: 100%;
        min-height: 100%;
        height: auto;
        overflow-x: hidden;
        overflow-y: auto;
    }

    .app-container,
    .dashboard-container {
        width: 100%;
        min-height: 100dvh;
        height: auto;
    }

    .header-bar {
        width: 100%;
        height: auto;
        min-height: 50px;
        padding: 8px 12px;
        gap: 8px;
        flex-wrap: wrap;
        align-content: center;
    }

    .header-left {
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
        flex-wrap: wrap;
    }

    .header-left .logo-link {
        min-height: 44px;
        flex: 0 0 auto;
    }

    .header-left .nav-btn {
        flex: 1 1 120px;
        min-width: 0;
        max-width: 100%;
        white-space: normal;
        text-align: center;
    }

    .header-right {
        flex: 0 0 auto;
        min-width: 0;
    }

    .header-center {
        position: static;
        left: auto;
        transform: none;
        order: 3;
        flex: 1 0 100%;
        min-width: 0;
        padding: 0 4px 2px;
        text-align: center;
    }

    .header-title,
    .header-info {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-title {
        font-size: 16px;
    }

    .header-info {
        font-size: 11px;
    }

    .header-logo {
        max-width: 100%;
    }

    .nav-btn,
    .dashboard-btn,
    .logout-btn {
        min-height: 44px;
        padding: 10px 12px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main-area,
    .content-area {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 12px;
        overflow: visible;
    }

    .scanner-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .scanner-layout .camera-section,
    .scanner-layout .info-section {
        width: 100%;
        max-width: 100%;
        flex: 1 1 auto;
    }

    #photo-video,
    #photo-canvas,
    #photo-preview {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }

    .content-container,
    .teller-card,
    .card {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding: 14px;
    }

    .camera-container {
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }

    .welcome-info,
    .stats-grid,
    .action-buttons {
        grid-template-columns: minmax(0, 1fr);
    }

    .action-btn,
    .teller-button,
    .process-btn,
    .btn,
    button,
    input[type="submit"],
    .back-btn,
    .setup-btn,
    .view-details-btn,
    .tx-view-btn,
    .popup-btn,
    .disconnect-btn,
    .btn-revoke,
    .btn-filter,
    .btn-generate {
        min-height: 44px;
        max-width: 100%;
    }

    a[class*="btn"],
    button[class*="btn"] {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .action-btn,
    .teller-button,
    .process-btn {
        width: 100%;
        min-width: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .view-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .modal {
        min-width: 0;
        width: calc(100% - 24px);
        max-width: calc(100% - 24px);
    }

    .modal__footer {
        flex-wrap: wrap;
    }

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

    input,
    select,
    textarea {
        min-height: 44px;
    }

    .key {
        width: clamp(44px, 18vw, 70px);
        min-width: 44px;
    }

    .key-row {
        flex-wrap: wrap;
        max-width: 276px;
        margin-left: auto;
        margin-right: auto;
    }

    .key-spacer {
        width: clamp(44px, 18vw, 70px);
        min-width: 44px;
    }

    .key-spacer.half {
        width: clamp(22px, 9vw, 35px);
        min-width: 22px;
    }

    button[title="Copy code"] {
        min-width: 44px;
        min-height: 44px;
        padding: 0 8px !important;
    }

    .table-container,
    .table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }

    .table-container table,
    .table-wrap table {
        min-width: 620px;
    }

    th,
    td {
        padding: 9px 8px;
        white-space: normal;
    }

    .info-value,
    .status-badge,
    .confirmation-code,
    .code-cell,
    .pass-cell,
    .transaction-code,
    [data-transaction-code] {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .confirmation-code {
        font-size: clamp(20px, 8vw, 28px);
        letter-spacing: 2px;
    }

    :is(a, button, input, select, textarea):focus-visible {
        outline: 3px solid #f7941d;
        outline-offset: 2px;
    }
}

@media (max-width: 420px) {
    .header-left {
        flex-basis: 100%;
    }

    .header-right {
        margin-left: auto;
    }

    .card h2,
    .card h3,
    .page-title {
        overflow-wrap: anywhere;
    }

    .new-code-banner {
        align-items: flex-start;
        gap: 12px;
        padding: 14px;
    }

    .new-code-banner .code-val {
        font-size: 26px;
        letter-spacing: 2px;
    }
}
