/* ============================================================================
   Athena Endpoint Platform — Responsive overrides (Phases 32-36)
   ----------------------------------------------------------------------------
   Extracted VERBATIM from site.css, where this block already sat AFTER every
   page section it overrides. It is linked LAST in _Host.cshtml so that ordering
   is preserved.

   Safe to move past the three site.css sections that used to follow it (Agent
   Log Viewer, Alert count badges, Monitor condition builder): they share no
   selector with anything in here, so nothing changes hands in the cascade.
   ============================================================================ */

/* ============================================================================
   RESPONSIVE DESIGN - Phase 32: Layout Foundation
   Breakpoints: Phone (<768px), Tablet (768-1023px), Desktop (default), Large (1440px+)
   Desktop-first: max-width queries (matching existing codebase pattern)
   ============================================================================ */

/* --- Large screens (1440px+) ---
   User decision: No changes needed. Desktop layout already works well at large sizes.
   Content area uses flex:1 to expand into available width naturally.
   This satisfies LAYOUT-05: "Large screens use available width without wasted whitespace." */

/* --- Tablet (768px - 1023px) --- */
@media (max-width: 1023.98px) {
    :root {
        --content-padding: 20px;
        --card-padding: 20px;
        --header-margin: 20px;
        --grid-gap: 16px;
        --card-gap: 16px;
    }

    /* Stats grid: force 2 columns on tablet */
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Tables: horizontal scroll instead of clipping */
    .content-card {
        overflow-x: auto;
    }

    .table {
        min-width: 600px;
    }

    /* Agent detail header: tighter internal spacing */
    .header-top {
        margin-bottom: 20px;
    }

    .agent-title-section {
        gap: 16px;
    }

    /* Stat value: slightly smaller on tablet for stat cards */
    .stat-value {
        font-size: 48px;
    }

    .stat-label {
        font-size: large;
    }

    /* Phase 33: Show hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* Below 1024 the sidebar leaves the flex flow. Responsive-UI P2 splits what it becomes:
       768-1023 an icon rail (shell block at the end of this file), below 768 an off-canvas drawer. */
    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        width: var(--sidebar-width, 250px);
        z-index: 1001;
        transition: inset-inline-start 0.3s ease, width 0.2s ease, visibility 0s linear 0.3s;
    }

    /* Phase 33: Dark backdrop when sidebar is open */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }

    /* Phase 33: Scroll lock when sidebar overlay is open */
    .container.sidebar-open {
        overflow: hidden;
        height: 100vh;
        overscroll-behavior: none;
    }

    /* Phase 33: Main content takes the rest of the row (the rail margin is set in the shell block). */
    .main-content {
        min-width: 0;
    }

    /* Phase 33: Update header h1 max-width (no sidebar in flow, but hamburger + user-info present) */
    .header h1 {
        max-width: calc(100vw - 140px);
    }

    /* Phase 33: Accessibility - respect reduced motion preference */
    @media (prefers-reduced-motion: reduce) {
        .sidebar {
            transition: none;
        }
        .hamburger-line {
            transition: none;
        }
    }

    /* Phase 34: Horizontal scroll for table containers missing overflow-x */
    .scheduler-list {
        overflow-x: auto;
    }

    .audit-table .col-ip,
    .audit-table .col-description {
        display: none;
    }

    .scheduler-table th:nth-child(4),
    .scheduler-table td:nth-child(4) {
        display: none;
    }

    .commands-table th:nth-child(5),
    .commands-table td:nth-child(5),
    .commands-table th:nth-child(6),
    .commands-table td:nth-child(6) {
        display: none;
    }

    /* Phase 35: Two-column fixed grids → single column on tablet */
    .push-update-grid {
        grid-template-columns: 1fr;
    }

    .master-detail-container {
        grid-template-columns: 1fr;
    }

    .split-panel {
        grid-template-columns: 1fr;
    }

    /* Phase 35: Four-column info-grid → two columns on tablet */
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* --- Phone (<768px) --- */
@media (max-width: 767.98px) {
    :root {
        --content-padding: 12px;
        --card-padding: 12px;
        --header-margin: 12px;
        --grid-gap: 10px;
        --card-gap: 10px;
    }

    /* Main content may shrink below its content's min width; it no longer hides overflow (shell.css). */
    .main-content {
        min-width: 0;
    }

    /* Header: allow wrapping for very long titles, compact spacing */
    .header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .header h1 {
        max-width: calc(100vw - 120px); /* Phase 33: No sidebar in flow, just hamburger + user-info */
        font-size: clamp(0.875rem, 0.75rem + 0.5vw, 1.25rem);
    }

    /* Stats grid: single column stack on phone */
    .stats {
        grid-template-columns: 1fr;
    }

    /* Stat cards: compact horizontal layout */
    .stat-card {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 10px 12px;
    }

    .stat-value {
        font-size: 28px;
        min-width: 0;
    }

    .stat-content {
        align-items: flex-start;
        min-width: 0;
    }

    .stat-label {
        font-size: small;
        text-align: left;
        margin-bottom: 2px;
    }

    /* Stat-card / KPI labels and their sub-captions WRAP on a phone instead of ellipsising
       ("TOTAL AGE…" at 390px). Written once for every page. !important on the wrap only:
       each page's scoped .tac-<page> .tac-kpi .tac-lbl / .tac-kpi-foot nowrap rule carries an
       extra attribute and outranks this. Wrap at SPACES only - break-word split
       "MAINTENANC/E"; a word too long for the card shrinks instead (the <600px rule below). */
    .stat-label,
    .tac-kpi .tac-lbl,
    .tac-kpi .tac-kpi-foot {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        overflow-wrap: normal !important;
        word-break: normal !important;
        letter-spacing: 0.04em !important;
    }

    .stat-trend {
        font-size: 12px;
        text-align: left;
    }

    /* Card headers: stack title and button vertically */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin-bottom: 12px;
        padding-bottom: 10px;
    }

    .card-title {
        font-size: 1rem;
    }

    /* Tables: horizontal scroll with minimum width */
    .content-card {
        overflow-x: auto;
        padding: 10px;
    }

    .table {
        min-width: 500px;
        font-size: 12px;
    }

    .table th,
    .table td {
        padding: 8px 6px;
    }

    /* Agent detail header: compact layout */
    .header-top {
        margin-bottom: 12px;
    }

    .agent-title-section {
        gap: 8px;
    }

    /* Quick actions grid (Command page): tighter gaps */
    .quick-actions {
        gap: var(--card-gap, 10px);
    }

    /* Stats bar (Command page) */
    .stats-bar {
        gap: var(--grid-gap, 10px);
        flex-wrap: wrap;
    }

    /* Buttons: compact for phone */
    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .btn-fixed {
        min-width: 120px;
    }

    /* Phase 33: Hide username text on phone, show only avatar */
    .user-info > span:first-child {
        display: none;
    }

    /* ============================================
       Phase 34: Phone Card Layout for Data Tables
       Tables transform into stacked cards with labeled fields.
       Uses CSS ::before + attr(data-label) for field labels.
       ============================================ */

    /* The Agents roster's card layout moved to ResponsiveTable (Responsive-UI P2). */

    /* --- Audit table card layout --- */
    .audit-list .audit-table {
        min-width: 0;
    }

    .audit-list .audit-table thead {
        position: absolute;
        left: -9999px;
    }

    .audit-list .audit-table,
    .audit-list .audit-table tbody {
        display: block;
    }

    .audit-list .audit-table tbody tr {
        display: block;
        margin-bottom: 12px;
        background: white;
        border: 1px solid var(--border-color, #e5e7eb);
        border-radius: 8px;
        padding: 12px;
        cursor: pointer;
    }

    .audit-list .audit-table tbody tr.row-failed {
        border-color: #fecaca;
        background: #fef2f2;
    }

    .audit-list .audit-table tbody tr.row-warning {
        border-color: #fde68a;
        background: #fffbeb;
    }

    .audit-list .audit-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 13px;
    }

    .audit-list .audit-table tbody td:last-child {
        border-bottom: none;
    }

    .audit-list .audit-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted, #6b7280);
        font-size: 12px;
        flex-shrink: 0;
        margin-inline-end: 12px;
    }

    /* Expandable detail row: exempt from card label pattern */
    .audit-list .audit-table tbody tr.event-details-row {
        margin-top: -12px;
        border-top: none;
        border-radius: 0 0 8px 8px;
        padding: 0;
        cursor: default;
    }

    .audit-list .audit-table tbody tr.event-details-row td {
        display: block;
        padding: 12px;
    }

    .audit-list .audit-table tbody tr.event-details-row td::before {
        display: none;
    }

    /* --- Scheduler table card layout --- */
    .scheduler-list .scheduler-table {
        min-width: 0;
    }

    .scheduler-list .scheduler-table thead {
        position: absolute;
        left: -9999px;
    }

    .scheduler-list .scheduler-table,
    .scheduler-list .scheduler-table tbody {
        display: block;
    }

    .scheduler-list .scheduler-table tbody tr {
        display: block;
        margin-bottom: 12px;
        background: white;
        border: 1px solid var(--border-color, #e5e7eb);
        border-radius: 8px;
        padding: 12px;
        cursor: pointer;
    }

    .scheduler-list .scheduler-table tbody tr:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    .scheduler-list .scheduler-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px solid #f0f0f0;
        font-size: 13px;
    }

    .scheduler-list .scheduler-table tbody td:last-child {
        border-bottom: none;
    }

    .scheduler-list .scheduler-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted, #6b7280);
        font-size: 12px;
        flex-shrink: 0;
        margin-inline-end: 12px;
    }

    /* Action buttons: wrap in card mode */
    .scheduler-list .action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: flex-end;
    }

    /* ============================================
       Phase 35: Grid Collapse for Phone
       Two-column grids → single column stack.
       ============================================ */

    /* Two-column equal grids → single column */
    .agent-info,
    .form-row,
    .step-form-grid,
    .advanced-grid,
    .form-grid,
    .detail-form-row,
    .task-type-selector {
        grid-template-columns: 1fr;
    }

    /* Four-column info-grid → single column on phone */
    .info-grid {
        grid-template-columns: 1fr;
    }

    /* ============================================
       Phase 35: Tab Navigation Adaptation for Phone
       Tabs scroll horizontally instead of wrapping.
       Side-nav converts to horizontal tab strip.
       ============================================ */

    /* Settings tabs: horizontal scroll instead of wrap */
    .settings-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .settings-tabs::-webkit-scrollbar {
        display: none;
    }

    .settings-tabs .tab-btn {
        padding: 8px 14px;
        font-size: 13px;
        flex-shrink: 0;
    }

    /* Detail tabs (PackageTemplates): horizontal scroll */
    .detail-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .detail-tabs::-webkit-scrollbar {
        display: none;
    }

    .detail-tabs .detail-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Agent Details section nav: a dropdown below 1024 (AgentDetails.razor.css, Responsive-UI P2). */

    /* ============================================
       Phase 36: Touch Targets (WCAG 2.5.5 — 44px)
       Enforce minimum 44px touch target on all
       interactive elements for mobile usability.
       ============================================ */

    /* Generic buttons — min-height 44px with flex centering */
    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Small button variant */
    .btn.btn-sm {
        min-height: 44px;
    }

    /* Action buttons */
    .action-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Scoped action button containers */
    .action-buttons .btn,
    .service-action-buttons .btn,
    .services-quick-actions .btn,
    .filter-actions .btn {
        min-height: 44px;
    }

    /* Select action button */
    .select-action-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Icon buttons — fixed 44x44px */
    .btn-icon {
        width: 44px;
        height: 44px;
    }

    .table-icon-btn {
        width: 44px;
        height: 44px;
    }

    .close-btn {
        width: 44px;
        height: 44px;
    }

    /* Small icon button — enlarge to 44px with flex centering */
    .btn-icon-sm {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Tab buttons — min-height without changing padding */
    .tab-btn {
        min-height: 44px;
    }

    .settings-tabs .tab-btn {
        min-height: 44px;
    }

    .detail-tabs .detail-tab {
        min-height: 44px;
    }

    .side-nav-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Pagination buttons — 44x44px minimum */
    .page-btn {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Tag chips */
    .tag-chip {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Toggle button (scheduler) */
    .toggle-btn {
        min-height: 44px;
    }

    /* Menu items */
    .menu-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Hamburger button */
    .hamburger-btn {
        min-width: 44px;
        min-height: 44px;
    }

    /* Chip remove — 32px visual compromise */
    .chip-remove {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    /* Form controls — min-height for consistency */
    .form-control,
    .form-select {
        min-height: 44px;
    }

    /* Checkbox wrapper — label approach for touch area */
    .checkbox-wrapper {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .checkbox-wrapper label {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding-block: 8px;
    }

    /* Agent checkbox in selection lists */
    .agent-checkbox {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Toggle switch — expand touch area */
    .toggle {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    /* Avatar — enlarge from 40px to 44px on phone */
    .avatar {
        width: 44px;
        height: 44px;
    }

    /* ============================================
       Phase 36: Adjacent Spacing (TOUCH-02 — 8px minimum)
       Ensure adjacent interactive elements have at
       least 8px gap to prevent accidental taps.
       ============================================ */

    /* Settings tabs — increase from 4px to 8px */
    .settings-tabs {
        gap: 8px;
    }

    /* Detail tabs — ensure 8px gap */
    .detail-tabs {
        gap: 8px;
    }

    /* Scheduler card action buttons — override 4px to 8px */
    .scheduler-list .action-buttons {
        gap: 8px;
    }
}

/* ============================================
   Phase 36: Rotate Hint
   Show landscape suggestion on portrait phone
   for complex pages (Command, Scheduler).
   ============================================ */
.rotate-hint {
    display: none;
}

@media (orientation: portrait) and (max-width: 767.98px) {
    .rotate-hint {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 16px;
        margin-bottom: 12px;
        background: var(--bg-secondary, #1e293b);
        border: 1px solid var(--border-color, #334155);
        border-radius: 8px;
        font-size: 13px;
        color: var(--text-secondary, #94a3b8);
    }

    .rotate-hint .rotate-icon {
        font-size: 20px;
        flex-shrink: 0;
    }

    .rotate-hint .rotate-dismiss {
        margin-inline-start: auto;
        background: none;
        border: none;
        color: var(--text-secondary, #94a3b8);
        font-size: 18px;
        cursor: pointer;
        padding: 4px;
        line-height: 1;
    }
}

/* ============================================================================
   RESPONSIVE-UI P2 - shared primitives (.claude/docs/responsive-ui.md)
   Breakpoints (tactical-tokens.css --bp-*): phone < 600, tablet < 768,
   laptop < 1024, desktop >= 1024. The literals below are those values minus
   .02px, so a 600px-wide viewport is NOT a phone.
   ============================================================================ */

:root {
    --rail-width: 64px;
}

/* ---------------------------------------------------------------- shell: rail
   768-1023: the sidebar stays on screen as a 64px icon rail. Labels hide; the
   AthenaIcons glyph carries the item and its label is the tooltip (data-tip,
   shown by responsive.js on hover, focus and long-press). The hamburger expands
   the rail to the full width over the page. */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .sidebar {
        inset-inline-start: 0;
        width: var(--rail-width);
        visibility: visible;
    }

    .sidebar.open {
        width: var(--sidebar-width, 232px);
        box-shadow: 0 0 24px color-mix(in srgb, var(--tac-ink0) 18%, transparent);
    }

    .main-content {
        margin-inline-start: var(--rail-width);
    }

    .sidebar:not(.open) .tac-wordmark,
    .sidebar:not(.open) .nav-label {
        display: none;
    }

    .sidebar:not(.open) .logo {
        padding: 0;
        justify-content: center;
    }

    .sidebar:not(.open) .nav-item {
        position: relative;
        justify-content: center;
        min-height: var(--touch-target, 44px);
        padding: 0;
    }

    .sidebar:not(.open) .nav-item svg,
    .sidebar:not(.open) .nav-icon {
        width: 20px;
        height: 20px;
    }

    /* Policies group on the closed icon rail: no room for the chevron, children are plain centred glyphs. */
    .sidebar:not(.open) .nav-group-toggle {
        display: none;
    }

    .sidebar:not(.open) .nav-item.nav-child {
        height: auto;
        padding: 0;
    }

    .sidebar:not(.open) .nav-badge {
        position: absolute;
        top: 3px;
        inset-inline-end: 6px;
        min-width: 16px;
        height: 16px;
        padding: 0 3px;
    }
}

/* -------------------------------------------------------------- shell: drawer
   Below 768: off-canvas. visibility keeps the closed drawer's links out of the
   Tab order; MainLayout makes the page inert while it is open (the focus trap),
   Esc and the close button shut it, and navigating closes it. */
@media (max-width: 767.98px) {
    .sidebar {
        inset-inline-start: calc(-1 * var(--sidebar-width, 232px));
        visibility: hidden;
    }

    .sidebar.open {
        inset-inline-start: 0;
        visibility: visible;
        transition: inset-inline-start 0.3s ease, visibility 0s;
    }

    .main-content {
        width: 100%;
    }
}

/* The drawer / expanded-rail close button lives in the logo row; only an OPEN overlay shows it. */
.drawer-close {
    display: none !important;
}

@media (max-width: 1023.98px) {
    .sidebar.open .drawer-close {
        display: inline-flex !important;
        margin-inline-start: auto;
    }
}

/* The page's primary action, hoisted into the sticky top bar (SectionOutlet TopBar.ActionSection). */
.topbar-action {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
}

/* --------------------------------------------------------------- modal sheets
   Below 600 every ModalGuard-based modal is a full-screen sheet: sticky header
   (title + close), scrolling body, sticky footer (Save / Cancel). Written ONCE
   here so all modals get it. !important on the geometry only: each page's scoped
   .modal rules load after this sheet and carry an extra attribute. The
   screen-share video modal is desktop-only and keeps its own layout. */
.modal-sheet-close {
    display: none !important;
}

@media (max-width: 599.98px) {
    .modal-overlay:has(> .modal-guard):not(.video-modal-overlay) {
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
    }

    .modal-overlay:has(> .modal-guard):not(.video-modal-overlay) > :is(.modal, .modal-content, .modal-dialog) {
        display: flex !important;
        flex-direction: column;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 100dvh !important;
        max-height: none !important;
        margin: 0 !important;
        border-radius: 0 !important;
        transform: none !important;
        overflow-y: auto !important;
        overscroll-behavior: contain;
    }

    .modal-overlay:has(> .modal-guard):not(.video-modal-overlay) > :is(.modal, .modal-content, .modal-dialog) > form {
        display: flex;
        flex-direction: column;
        flex: 1 0 auto;
    }

    .modal-overlay:has(> .modal-guard):not(.video-modal-overlay) .modal-header {
        position: sticky;
        top: 0;
        z-index: 2;
        flex: none;
        background: var(--tac-s1);
        padding-inline-end: 56px;
    }

    .modal-overlay:has(> .modal-guard):not(.video-modal-overlay) .modal-body {
        flex: 1 0 auto;
        max-height: none !important;
        overflow: visible !important;
    }

    .modal-overlay:has(> .modal-guard):not(.video-modal-overlay) .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 2;
        flex: none;
        background: var(--tac-s1);
        border-top: 1px solid var(--tac-line);
    }

    .modal-overlay:has(> .modal-guard):not(.video-modal-overlay) > .modal-sheet-close {
        display: inline-flex !important;
        position: fixed;
        top: 6px;
        inset-inline-end: 6px;
        /* Above the dialog (pages give .modal z-index up to 10000, and its sticky header then
           swallowed every tap on this button); equal to .modal-guard-confirm, which comes later
           in the DOM and so still covers it. */
        z-index: 10001;
    }

    /* A header that already has its own close button keeps it; no second X. */
    .modal-overlay:has(.modal-header :is(.close-btn, .modal-close, .tac-modal-close)) > .modal-sheet-close {
        display: none !important;
    }
}

/* ------------------------------------------------------------------- tooltips
   The bubble responsive.js shows for a title / data-tip on keyboard focus, on
   long-press (touch has no hover), and on hover for data-tip. One element. */
.athena-tip {
    position: fixed;
    z-index: 11000;
    max-width: min(280px, calc(100vw - 16px));
    padding: 6px 10px;
    background: var(--tac-ink0);
    color: var(--tac-on-acc);
    font-family: var(--tac-body);
    font-size: var(--tac-fs-meta);
    line-height: 1.35;
    pointer-events: none;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--tac-ink0) 25%, transparent);
}

.athena-tip[hidden] {
    display: none;
}

/* A long-press must show the tooltip, not the OS callout. */
.btn,
.nav-item,
.section-head-help-trigger,
.help-tip-trigger {
    -webkit-touch-callout: none;
}

/* ------------------------------------------------------------------ tab strip
   Settings tabs and Agent Details sections scroll sideways when they do not fit.
   responsive.js marks which edge has more ([data-more-start] / [data-more-end])
   and scrolls the active tab into view; the fade says "there is more this way".
   A strip that fits gets neither attribute, so this never fades a wrapped strip. */
.tab-strip[data-more-end] {
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 36px), transparent);
    mask-image: linear-gradient(to right, black calc(100% - 36px), transparent);
}

.tab-strip[data-more-start] {
    -webkit-mask-image: linear-gradient(to left, black calc(100% - 36px), transparent);
    mask-image: linear-gradient(to left, black calc(100% - 36px), transparent);
}

.tab-strip[data-more-start][data-more-end] {
    -webkit-mask-image: linear-gradient(to right, transparent, black 36px, black calc(100% - 36px), transparent);
    mask-image: linear-gradient(to right, transparent, black 36px, black calc(100% - 36px), transparent);
}

.tab-strip {
    overscroll-behavior-x: contain;
}

/* ------------------------------------------------------------- helper classes */
.cq {
    container-type: inline-size;
}

.cq-panel {
    container: panel / inline-size;
}

@container (max-width: 479.98px) {
    .cq-stack {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 599.98px) {
    /* Two KPI cards per row leave ~100px for a title at 360-390px: 16px mono fits
       "MAINTENANCE" in neither, so the title steps down a role instead of splitting the word.
       .tac-kpibar only: the Dashboard's one-per-row tiles have the room and keep 16px. */
    .tac-kpibar .tac-kpi .tac-lbl {
        font-size: var(--tac-fs-meta) !important;
        letter-spacing: 0.02em !important;
    }

    .tac-kpibar .tac-kpi .tac-kpi-foot {
        font-size: var(--tac-fs-micro) !important;
    }

    .hide-phone {
        display: none !important;
    }
}

@media (min-width: 600px) {
    .only-phone {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .hide-below-tablet {
        display: none !important;
    }

    .touch-target {
        min-width: var(--touch-target, 44px);
        min-height: var(--touch-target, 44px);
    }
}

@media (min-width: 768px) {
    .only-below-tablet {
        display: none !important;
    }
}

@media (max-width: 1023.98px) {
    .hide-below-laptop {
        display: none !important;
    }
}

/* iOS Safari zooms the page into any focused field under 16px. Only iOS matches
   -webkit-touch-callout, so desktop and Android keep the house sizes. */
@supports (-webkit-touch-callout: none) {
    @media (max-width: 767.98px) {
        input:not([type="checkbox"]):not([type="radio"]),
        select,
        textarea {
            font-size: max(16px, 1em);
        }
    }
}

/* ----------------------------------------------------- desktop-only stand-in
   DesktopOnlyNote: below 768 it replaces a desktop-only control or panel
   (remote control start buttons, Registry, File browser) and says why. */
.desktop-only-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px dashed var(--tac-line2);
    color: var(--tac-ink2);
    font-size: var(--tac-fs-meta);
    line-height: 1.4;
}

.desktop-only-note-icon {
    display: inline-flex;
    flex: none;
    color: var(--tac-acc);
}

.desktop-only-note-icon svg {
    width: 16px;
    height: 16px;
}

.header-actions .desktop-only-note {
    margin: 0;
    padding: 4px 8px;
    font-size: var(--tac-fs-micro);
}

/* ------------------------------------------------------------- touch targets
   44px on anything a finger is likely to use: on a COARSE pointer (or no hover), whatever
   the width - a phone, a tablet, a 1280px touch laptop. Never by width alone: a mouse or
   trackpad keeps the dense desktop buttons even in a narrow window (a 44px icon row at 1280
   pushed the Agents actions onto a second line and grew every row; 2026-10-10).
   min-* only, so a page's own width/height still sets the look and this can only
   grow a target, never shrink one.
   !important on the min-* because ~40 page stylesheets pin `.tac-panel .btn.btn-icon
   { min-width: 28px/30px }` with a scoped (higher-specificity) selector, which held icon
   buttons at 28-30px wide on phones and tablets. A min-* can only grow a box, so forcing it
   never fights a page's look. */
@media (pointer: coarse), (hover: none) {
    .hamburger-btn,
    .avatar,
    .btn.btn-icon,
    .page-btn {
        min-width: var(--touch-target, 44px) !important;
        min-height: var(--touch-target, 44px) !important;
    }

    .btn {
        min-height: var(--touch-target, 44px);
    }

    input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]),
    select,
    .form-control,
    .form-select,
    .search-bar {
        min-height: var(--touch-target, 44px);
    }

    .avatar {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
