/* ==========================================================================
 * LEGACY LAYER (CentCom 31902, precedence decided 2026-10-18).
 * This sheet is the older site-wide mobile fix-up. On every Build it Better app page and on
 * /station and /nexus-panel, static/css/bb-responsive.css (the shared base) is linked AFTER it
 * in base_content.html and is scoped under `body.bb-app`, so on any tie the base wins by
 * order AND by specificity. Do not add app-layout, scroll-containment or modal rules here:
 * they belong in bb-responsive.css. Load order is pinned by tests/test_bb_css_load_order.py.
 * ========================================================================== */

/**
 * Mobile Responsive CSS - Google Mobile-Friendly Test Fixes
 *
 * This file addresses common mobile accessibility and responsiveness issues
 * to ensure the site passes Google's Mobile-Friendly Test.
 *
 * Issues addressed:
 * - Horizontal scrolling prevention
 * - Touch target sizing (44px minimum per iOS HIG)
 * - Font size for inputs (16px minimum to prevent iOS zoom)
 * - Viewport and container constraints
 */

/* ==========================================================================
   Mobile Header - Hide Non-Essential Buttons on All Pages
   ========================================================================== */

/* Hide chat controls on mobile - applies to ALL pages */
@media screen and (max-width: 768px) {
    /* Chat controls bar - History, New Chat, TTS buttons */
    .chat-controls-bar,
    .chat-control-btn,
    #chat-history-btn,
    #chat-new-btn,
    #chat-tts-btn,
    #wta-new-chat-btn,
    #wta-tts-btn,
    [title="Conversation History"],
    [title="New Conversation"],
    [title="Text-to-Speech"],
    a[href="/chat/history"] {
        display: none !important;
        visibility: hidden !important;
    }

    /* MOBILE: Show login button, hide signup (available in hamburger menu) */
    .login-btn,
    #headerLoginBtn {
        display: flex !important;
        visibility: visible !important;
    }
    /* When logged in: hide login, show user info */
    .chat-header.is-logged-in .login-btn,
    .chat-header.is-logged-in #headerLoginBtn {
        display: none !important;
        visibility: hidden !important;
    }
    .chat-header.is-logged-in #headerUserInfo {
        display: flex !important;
        visibility: visible !important;
    }
    .chat-header.is-logged-in #headerLogoutBtn {
        display: flex !important;
        visibility: visible !important;
    }

    .signup-btn,
    .register-btn,
    #headerSignupBtn {
        display: none !important;
        visibility: hidden !important;
    }

    /* Language selector: compact flag icon on mobile, full dropdown in hamburger menu */
    #language-selector-container {
        display: flex !important;
    }
    #language-selector-container .language-btn {
        min-width: 44px !important;
        min-height: 44px !important;
        width: 44px !important;
        height: 44px !important;
        padding: 10px !important;
        justify-content: center !important;
        gap: 0 !important;
    }
    #language-selector-container .language-btn .lang-code,
    #language-selector-container .language-btn .lang-arrow {
        display: none !important;
    }
    #language-selector-container .language-btn .lang-flag {
        display: inline-flex !important;
        font-size: 18px;
    }
}

/* Extra specificity for iOS Safari - keep login visible */
@media screen and (max-width: 768px) and (-webkit-min-device-pixel-ratio: 1) {
    .chat-controls-bar,
    .chat-control-btn {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        left: -9999px !important;
    }

    /* Ensure login stays visible on iOS */
    .login-btn,
    #headerLoginBtn {
        display: flex !important;
        visibility: visible !important;
        height: auto !important;
        width: auto !important;
        overflow: visible !important;
        position: relative !important;
        left: auto !important;
    }
    /* When logged in on iOS: hide login, show user info */
    .chat-header.is-logged-in .login-btn,
    .chat-header.is-logged-in #headerLoginBtn {
        display: none !important;
        visibility: hidden !important;
    }
    .chat-header.is-logged-in #headerUserInfo {
        display: flex !important;
        visibility: visible !important;
        height: auto !important;
        width: auto !important;
        overflow: visible !important;
        position: relative !important;
        left: auto !important;
    }
    .chat-header.is-logged-in #headerLogoutBtn {
        display: flex !important;
        visibility: visible !important;
    }
}

/* ==========================================================================
   Base Mobile Fixes - Prevent Horizontal Scrolling
   ========================================================================== */

html {
    overflow-x: clip;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: clip;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
}

/* Ensure all containers respect viewport width */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Prevent any element from exceeding viewport */
img,
video,
iframe,
embed,
object,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

/* Tables must scroll horizontally if needed */
table {
    max-width: 100%;
}

/* Auto-wrap tables in scrollable container on mobile */
@media (max-width: 768px) {
    /* Ensure all tables are scrollable within their containers */
    table {
        display: block;
        overflow-x: auto;
        /* y stays hidden: an auto y axis makes the table a vertical scroller
           that swallows touch scrolling of the page (ET-33595) */
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        margin-bottom: 1rem;
    }

    /* Ensure table cells don't break layout */
    td, th {
        white-space: nowrap;
        padding: 8px 12px;
        min-width: max-content;
    }

    /* Tables inside specific containers */
    .table-responsive,
    .data-table-container,
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
        max-width: 100vw;
    }

    /* Ensure content sections with tables allow horizontal scroll */
    .content-section table,
    .markdown-body table,
    .docs-content table,
    article table,
    .card table {
        display: block;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* Add scroll shadow hint on right edge for scrollable tables */
    .table-responsive::after,
    .table-wrap::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to right, transparent, rgba(0,0,0,0.1));
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s;
    }

    .table-responsive::-webkit-scrollbar,
    .table-wrap::-webkit-scrollbar,
    table::-webkit-scrollbar {
        height: 4px;
    }

    .table-responsive::-webkit-scrollbar-thumb,
    .table-wrap::-webkit-scrollbar-thumb,
    table::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 2px;
    }
}

/* Pre and code blocks should scroll */
pre,
code {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ==========================================================================
   Form Input Fixes - Prevent iOS Zoom on Focus
   ========================================================================== */

/* iOS zooms the page when input font-size is less than 16px */
input,
select,
textarea,
button {
    font-size: 16px;
}

/* Ensure form elements have proper sizing on mobile */
@media (max-width: 768px) {
    input:not([type]),
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="search"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    select,
    textarea {
        /* TASK 31: the ONE phone input rule. Kept with !important on purpose:
           page-level class rules (.nexus-input 14px, .pancake-input, ...) beat a
           bare element selector, and anything under 16px makes iOS zoom on focus. */
        font-size: 16px !important;
        padding: 12px 14px;
        border-radius: 8px;
        -webkit-appearance: none;
        appearance: none;
    }

    /* Make select dropdowns mobile-friendly */
    select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 36px;
    }
}

/* ==========================================================================
   Minimum Font Size - Mobile Readability
   ========================================================================== */

/* ==========================================================================
   Touch Target Sizes - iOS HIG requires 44x44px minimum
   ========================================================================== */

@media (max-width: 768px) {
    /* All interactive elements should have minimum touch target */
    a,
    button,
    [role="button"],
    input[type="submit"],
    input[type="button"],
    input[type="reset"],
    input[type="checkbox"],
    input[type="radio"],
    .btn,
    .button,
    .link,
    .nav-link,
    .menu-item {
        min-height: 44px;
        min-width: 44px;
    }

    /* Ensure buttons have enough padding */
    button,
    .btn,
    .button,
    input[type="submit"],
    input[type="button"] {
        padding: 12px 16px;
    }

    /* Navigation links should have enough spacing */
    nav a,
    .nav-link,
    .menu-item a {
        display: flex;
        align-items: center;
        min-height: 44px;
        padding: 10px 12px;
    }

    /* Close buttons should be easily tappable */
    .close,
    .close-btn,
    [aria-label="Close"],
    [aria-label="close"],
    .modal-close,
    .dialog-close {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Checkbox and radio labels */
    label {
        display: flex;
        align-items: center;
        min-height: 44px;
        gap: 10px;
    }

    /* Icon buttons */
    .icon-btn,
    .btn-icon,
    button[aria-label] {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
}

/* ==========================================================================
   Container Constraints
   ========================================================================== */

.container,
.wrapper,
.content,
main,
section,
article,
header,
footer,
aside,
nav {
    max-width: 100%;
    overflow-x: clip;
}

/* Ensure fixed/absolute elements don't cause overflow */
[style*="position: fixed"],
[style*="position: absolute"] {
    max-width: 100vw;
}

/* ==========================================================================
   Mobile-Specific Responsive Breakpoints
   ========================================================================== */

/* Small mobile (iPhone SE, older Android) */
@media (max-width: 375px) {
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2:not(.ec-card-title) {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Reduce padding on very small screens */
    .container,
    .content,
    main {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Route mode toggle — meet 44px touch target minimum */
    .rm-tab {
        min-height: 44px;
        min-width: 44px;
        padding: 4px 10px;
        font-size: 0.75rem;
    }
}

/* All mobile devices - hide desktop-only elements */
@media (max-width: 768px) {
    /* Hide elements marked for desktop only */
    .desktop-only {
        display: none !important;
        visibility: hidden !important;
    }
}

/* Standard mobile (iPhone 12/13/14, most Android) */
@media (max-width: 480px) {
    /* Stack flex items vertically */
    .flex-row-mobile {
        flex-direction: column;
    }

    /* Full width buttons on mobile */
    .btn-mobile-full,
    .button-mobile-full {
        width: 100%;
    }
}

/* Desktop and up */
@media (min-width: 769px) {
    /* Hide elements marked for mobile only */
    .mobile-only {
        display: none !important;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .tablet-only {
        display: block;
    }
}

/* ==========================================================================
   Modal and Dialog Fixes
   ========================================================================== */

@media (max-width: 768px) {
    /* Modals should be full-screen or bottom sheet on mobile */
    .modal,
    .dialog,
    [role="dialog"] {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100vw;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
    }

    /* Bottom sheet style for smaller modals */
    .modal--bottom-sheet,
    .bottom-sheet {
        top: auto;
        border-radius: 16px 16px 0 0;
        max-height: 90vh;
        max-height: 90dvh; /* 100dvh accounts for mobile browser chrome (address bar etc.) */
    }

    /* Modal content scrollable */
    .modal-body,
    .modal-content,
    .dialog-body,
    .dialog-content {
        max-height: calc(100vh - 120px);
        max-height: calc(100dvh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ==========================================================================
   Table Responsiveness
   ========================================================================== */

@media (max-width: 768px) {
    /* Wrap tables in scrollable container */
    .table-responsive,
    .table-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 16px;
    }

    /* Ensure table doesn't shrink too much */
    .table-responsive table,
    .table-scroll table {
        min-width: 600px;
    }

    /* Alternative: Stack table rows vertically */
    .table-stack {
        display: block;
    }

    .table-stack thead {
        display: none;
    }

    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tr {
        margin-bottom: 16px;
        padding: 12px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }

    .table-stack td {
        padding: 8px 0;
        border: none;
    }

    .table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 4px;
        color: #a8b0b8; /* Improved contrast from #888 */
        font-size: 12px;
        text-transform: uppercase;
    }
}

/* ==========================================================================
   Safe Area Padding (for notched phones)
   ========================================================================== */

@supports (padding-top: env(safe-area-inset-top)) {
    /* Header spacing for notch */
    header,
    .header,
    .top-bar,
    .navbar {
        padding-top: env(safe-area-inset-top);
    }

    /* Footer spacing for home indicator */
    footer,
    .footer,
    .bottom-bar,
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Left/right safe areas for landscape */
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ==========================================================================
   Text Readability on Mobile
   ========================================================================== */

@media (max-width: 768px) {
    /* Ensure readable line length */
    p,
    li,
    .text-content {
        max-width: 100%;
        line-height: 1.6;
    }

    /* Larger tap targets for inline links */
    p a,
    li a,
    .text-content a {
        padding: 4px 0;
    }

    /* Prevent text from being too small */
    body {
        font-size: max(16px, 1rem);
    }

    /* Ensure headings scale properly */
    h1 {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }

    h2:not(.ec-card-title) {
        font-size: clamp(1.25rem, 5vw, 2rem);
    }

    h3 {
        font-size: clamp(1.1rem, 4vw, 1.5rem);
    }
}

/* ==========================================================================
   Horizontal Scroll Indicators (for scrollable tables)
   ========================================================================== */

.scroll-indicator {
    position: relative;
}

.scroll-indicator::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

.scroll-indicator.scrolled-end::after {
    display: none;
}

/* ==========================================================================
   Animation Performance on Mobile
   ========================================================================== */

@media (max-width: 768px) {
    /* Reduce animations on mobile for performance */
    .reduce-motion,
    .animated {
        animation-duration: 0.2s !important;
    }

}

/* ==========================================================================
   Additional Touch Target Fixes (Issue #007)
   ========================================================================== */

@media (max-width: 768px) {
    /* Footer links - ensure adequate touch area (scoped to page footer, not footer-bar nav) */
    .footer-nav .footer-link,
    .footer-links a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        padding: 10px 12px;
    }

    /* Social media icons */
    .social-link,
    .social-icon,
    [class*="social"] a,
    a[href*="twitter"],
    a[href*="discord"],
    a[href*="telegram"],
    a[href*="github"] {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }

    /* Dropdown toggles */
    .dropdown-toggle,
    .dropdown-trigger,
    [data-toggle="dropdown"],
    select {
        min-height: 44px;
        padding: 10px 16px;
    }

    /* Tab buttons */
    .tab,
    .tab-btn,
    [role="tab"],
    .tabs button,
    .tab-list button {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
    }

    /* Pagination */
    .pagination a,
    .pagination button,
    .page-link,
    .page-btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Accordion/Collapsible headers */
    .accordion-header,
    .collapsible-header,
    [data-toggle="collapse"],
    .expandable-header {
        min-height: 48px;
        padding: 12px 16px;
        cursor: pointer;
    }

    /* Card action buttons */
    .card-action,
    .card-btn,
    .card a,
    .market-card a {
        min-height: 44px;
        padding: 10px;
    }

    /* Trade buttons - critical UI.
       Scope to actual clickable controls: the bare [class*="buy"]/[class*="sell"]
       attribute selectors were matching every sheet internal whose class merely
       CONTAINS "buy"/"sell" — including the decorative .ec-buy-handle drag bar,
       which got inflated to an 80x48 blank grey box on top of the buy/sell
       modals (it is a plain <div>, not a control). Requiring a button/link/role
       keeps the 48px tap target on real trade buttons without touching sheet
       chrome (handles, headings, boxes, panels). */
    button.buy-btn,
    button.sell-btn,
    button.trade-btn,
    a.buy-btn,
    a.sell-btn,
    button[class*="buy"],
    button[class*="sell"],
    a[class*="buy"],
    a[class*="sell"],
    [role="button"][class*="buy"],
    [role="button"][class*="sell"] {
        min-height: 48px;
        min-width: 80px;
        padding: 12px 20px;
    }

    /* Wallet connect button */
    .wallet-btn,
    .connect-wallet,
    #connectBtn,
    [id*="connect"],
    [class*="connect-wallet"] {
        min-height: 48px;
        padding: 12px 20px;
    }

    /* Search inputs and buttons */
    .search-btn,
    .search-submit,
    input[type="search"] + button {
        min-width: 44px;
        min-height: 44px;
    }

    /* Toggle switches — pill-shaped on mobile (50x28, knob=22)
       Container is 44px tall for touch target; visible track is 28px centered inside */
    .toggle,
    .switch,
    [role="switch"],
    .agent-toggle,
    .bm-toggle,
    .et-toggle,
    .nexus-toggle-switch,
    .toggle-switch,
    .token-toggle-switch,
    .mode-toggle-switch {
        min-width: 50px !important;
        width: 50px !important;
        height: 44px !important;
        min-height: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
    }
    .agent-toggle-slider,
    .bm-toggle-slider,
    .et-toggle-slider,
    .nexus-toggle-slider,
    .toggle-slider,
    .token-toggle-slider {
        top: 8px !important;
        bottom: 8px !important;
        left: 0 !important;
        right: 0 !important;
        height: auto !important;
        border-radius: 9999px !important;
    }
    .agent-toggle-slider::before,
    .bm-toggle-slider::before,
    .et-toggle-slider::before,
    .nexus-toggle-slider::before,
    .toggle-slider::before,
    .token-toggle-slider::before {
        width: 22px !important;
        height: 22px !important;
        left: 3px !important;
        bottom: 3px !important;
        border-radius: 50% !important;
    }
    .agent-toggle input:checked + .agent-toggle-slider::before,
    .bm-toggle input:checked + .bm-toggle-slider::before,
    .et-toggle input:checked + .et-toggle-slider::before,
    .nexus-toggle-checkbox:checked + .nexus-toggle-slider::before,
    .toggle-switch input:checked + .toggle-slider::before,
    .token-toggle-switch input:checked + .token-toggle-slider::before {
        transform: translateX(22px) !important;
    }
    #modeSwitch {
        width: 50px !important;
        height: 28px !important;
        padding: 8px 0 !important;
        box-sizing: content-box !important;
        border-radius: 9999px !important;
    }
    #modeSwitch::after {
        width: 22px !important;
        height: 22px !important;
        top: 3px !important;
        left: 3px !important;
    }
    #modeSwitch.active::after {
        transform: translateX(22px) !important;
    }
    /* launch_token toggle uses ::after with left positioning — offset top by 8px for track inset */
    .toggle-switch::after {
        width: 22px !important;
        height: 22px !important;
        top: 11px !important;
        left: 3px !important;
        border-radius: 50% !important;
    }
    .toggle-switch.active::after {
        left: 25px !important;
    }

    /* Rating/Star buttons */
    .star-btn,
    .rating-star,
    .favorite-btn,
    .bookmark-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }

    /* Notification badges - make parent clickable */
    .notification-badge,
    .badge {
        pointer-events: none;
    }

    .notification-badge-wrapper,
    [class*="notification"] {
        min-width: 44px;
        min-height: 44px;
        position: relative;
    }

    /* Back/Navigation buttons */
    .back-btn,
    .nav-back,
    [aria-label="Back"],
    [aria-label="Go back"] {
        min-width: 44px;
        min-height: 44px;
        padding: 8px;
    }

    /* Menu items in dropdowns */
    .menu-item,
    .dropdown-item,
    [role="menuitem"] {
        min-height: 44px;
        padding: 12px 16px;
        display: flex;
        align-items: center;
    }

    /* Slider/Range inputs thumb */
    input[type="range"] {
        height: 44px;
    }

    input[type="range"]::-webkit-slider-thumb {
        width: 24px;
        height: 24px;
    }

    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }

    /* Chips/Tags */
    .chip,
    .tag,
    .badge-clickable {
        min-height: 44px;
        padding: 6px 12px;
    }

    /* Help/Info icons */
    .help-icon,
    .info-icon,
    .tooltip-trigger,
    [data-tooltip] {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}



/* ============================================ */
/* MOBILE FIXES (Auto-generated)               */
/* ============================================ */


/* Fix: ISSUE-003 - Bottom Navigation Overlaps Home Indicator
 * Improve mobile spacing for better touch interaction
 */
@media (max-width: 768px) {
    .bottom-nav, nav[class*="bottom"] {
        padding: 12px 16px;
        margin-bottom: 8px;
    }
}



/* ============================================ */
/* MOBILE FIXES (Auto-generated)               */
/* ============================================ */


/* Fix: ISSUE-008 - Low Contrast on Secondary Text
 * Improve color contrast for WCAG AA compliance
 */
/* Dark mode is default — Rule #21: never use prefers-color-scheme */
.text-secondary, .muted {
    color: #f3f4f6; /* Light text for dark backgrounds */
}
[data-theme="light"] .text-secondary,
[data-theme="light"] .muted {
    color: #1f2937; /* Dark text for light backgrounds */
}

/* ==========================================================================
   Phone type scale (TASK 31, 2026-09-22) — the ONE place phone text sizes
   are set. Body copy 15px, secondary text 13px, labels and captions 12px.
   Figures keep their desktop size (a page steps them down itself if it
   must); headings are untouched; inputs are 16px (the rule above, kept with
   !important — see the note there). No universal selector and no
   !important here: a page's own rule for an element still wins.
   ========================================================================== */
@media (max-width: 768px) {
    :root {
        --phone-text: 15px;
        --phone-text-secondary: 13px;
        --phone-text-caption: 12px;
    }

    /* Body copy */
    body,
    p,
    li,
    dd,
    dt,
    .text,
    .lede {
        font-size: var(--phone-text);
    }

    /* Secondary text: table cells, labels, meta, footer, timestamps */
    td,
    th,
    label,
    small,
    .small,
    .text-sm,
    .text-small,
    .text-secondary,
    .muted,
    .subtitle,
    .meta,
    .timestamp,
    .helper-text,
    .hint,
    time,
    .time,
    .date,
    figcaption,
    footer p,
    footer span,
    .footer-text,
    .copyright {
        font-size: var(--phone-text-secondary);
    }

    /* Labels and captions: 12px, never smaller */
    .text-xs,
    .caption,
    .label,
    .badge,
    .badge-text,
    .tag,
    .tag-text,
    .chip-text,
    .stat-label,
    .bt-card-stat-label,
    .pro-stat-label,
    .mobile-bottom-nav .nav-label {
        font-size: var(--phone-text-caption);
    }

    /* Layout leftovers from the old block (not type sizes) */
    .badge-text,
    .tag-text,
    .chip-text {
        min-height: auto !important;
    }

    .mobile-bottom-nav .nav-label {
        line-height: 1.2 !important;
        display: block !important;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .arena-yesno-book-row,
    .ob-row {
        min-height: auto;
    }

    .arena-amount-row label,
    .arena-trade-entry label,
    .t-label,
    .trade-panel label {
        min-height: auto;
    }
}

/* Phone-width tables scroll sideways inside this wrapper (TASK 32 item 2). The two
   scroll-attached covers hide the edge fades when the table is scrolled to that end, so
   the cyan fade is only visible where more columns are hiding. */
.et-table-scroll {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background:
        linear-gradient(to right, var(--et-scroll-bg, #0d1520) 30%, rgba(13, 21, 32, 0)) left / 40px 100% no-repeat local,
        linear-gradient(to left, var(--et-scroll-bg, #0d1520) 30%, rgba(13, 21, 32, 0)) right / 40px 100% no-repeat local,
        linear-gradient(to right, rgba(0, 207, 255, 0.28), rgba(0, 207, 255, 0)) left / 24px 100% no-repeat scroll,
        linear-gradient(to left, rgba(0, 207, 255, 0.28), rgba(0, 207, 255, 0)) right / 24px 100% no-repeat scroll;
}
.et-table-scroll > table {
    min-width: max-content;
}
