/*
 * Owner panel on phones (< 640px). Static file (no build step), loaded from OwnerPanelProvider HEAD_END.
 * 1. Topbar fits one row: glass, currency and language move into the user menu.
 * 2. Dashboard: compact period filter, stats two per row.
 */

.owner-mobile-tools {
    display: none;
}

@media (max-width: 639.98px) {
    /* 1. Topbar */
    .fi-topbar .owner-glass-toggle,
    .fi-topbar .owner-currency-toggle-form,
    .fi-topbar-end > div:has(> .fi-dropdown.fi-user-menu) {
        display: none !important;
    }

    .fi-topbar-end {
        gap: 0.375rem;
    }

    .owner-mobile-tools {
        display: grid;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem 0.75rem;
        border-block-end: 1px solid rgb(3 7 18 / 0.06);
    }

    .dark .owner-mobile-tools {
        border-color: rgb(255 255 255 / 0.08);
    }

    .owner-mobile-tools__row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        margin: 0;
        font-size: 0.8125rem;
        font-weight: 600;
        color: rgb(55 65 81);
    }

    .dark .owner-mobile-tools__row {
        color: rgb(229 231 235);
    }

    .owner-mobile-tools__seg {
        display: inline-flex;
        padding: 0.1875rem;
        border-radius: 9999px;
        background: rgb(3 7 18 / 0.06);
    }

    .dark .owner-mobile-tools__seg {
        background: rgb(255 255 255 / 0.08);
    }

    .owner-mobile-tools__seg button {
        min-height: 2rem;
        padding: 0 0.75rem;
        border-radius: 9999px;
        font-size: 0.75rem;
        font-weight: 700;
        color: rgb(75 85 99);
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .dark .owner-mobile-tools__seg button {
        color: rgb(156 163 175);
    }

    .owner-mobile-tools__seg button[aria-pressed='true'] {
        background: #fff;
        color: rgb(3 7 18);
        box-shadow: 0 1px 3px rgb(3 7 18 / 0.12);
    }

    .dark .owner-mobile-tools__seg button[aria-pressed='true'] {
        background: rgb(255 255 255 / 0.16);
        color: #fff;
    }

    /* 2. Dashboard period filter: description hidden, presets in one swipeable strip */
    .owner-dashboard-period-filters .fi-section-header-description {
        display: none;
    }

    .owner-dashboard-period-filters .fi-fo-toggle-buttons.fi-inline {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-inline: -0.25rem;
        padding: 0.125rem 0.25rem 0.375rem;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .owner-dashboard-period-filters .fi-fo-toggle-buttons.fi-inline::-webkit-scrollbar {
        display: none;
    }

    .owner-dashboard-period-filters .fi-fo-toggle-buttons.fi-inline > * {
        flex: none;
        scroll-snap-align: start;
    }

    /* Stats two per row; a lone last card spans the row */
    .owner-dashboard .fi-wi-stats-overview .fi-section-content {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.625rem;
    }

    .owner-dashboard .fi-wi-stats-overview .fi-section-content > .fi-grid-col:last-child:nth-child(odd) {
        grid-column: span 2;
    }

    .owner-dashboard .fi-wi-stats-overview-stat {
        padding: 0.875rem;
    }

    .owner-dashboard .fi-wi-stats-overview-stat-label {
        font-size: 0.75rem;
    }

    .owner-dashboard .fi-wi-stats-overview-stat-value {
        font-size: 1.375rem;
        line-height: 1.75rem;
    }

    .owner-dashboard .fi-wi-stats-overview-stat-description {
        font-size: 0.6875rem;
    }

    /* 3. Tables: denser cells so more fits before sideways scroll; secondary columns use ->visibleFrom('md') */

    /* theme.css caps the table at ~75vh to keep headers sticky; on phones that is a scroll box inside the page scroll, so let it grow */
    .fi-ta-content-ctn:has(.fi-ta-table) {
        max-height: none;
        scrollbar-width: thin;
    }

    .fi-ta-table {
        font-size: 0.8125rem;
    }

    .fi-ta-table > thead > tr > :is(.fi-ta-header-cell, .fi-ta-selection-cell, th) {
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
    }

    .fi-ta-table > tbody > tr > .fi-ta-selection-cell {
        padding: 0.5rem;
    }

    .fi-ta-table :is(.fi-ta-text, .fi-ta-icon, .fi-ta-image, .fi-ta-color, .fi-ta-toggle, .fi-ta-select, .fi-ta-text-input) {
        padding: 0.625rem 0.5rem;
    }

    .fi-ta-table .fi-ta-text-item {
        font-size: 0.8125rem;
    }

    .fi-ta-header-toolbar {
        gap: 0.5rem;
        padding: 0.5rem 0.625rem;
    }

    .fi-ta-header-toolbar > :last-child {
        flex: 1;
        min-width: 0;
    }

    .fi-pagination {
        gap: 0.5rem;
        padding: 0.5rem 0.625rem;
    }

    /* Row actions icon-only: the label is a bare text node, so font-size 0 hides it visually but screen readers still read it */
    .fi-ta-row .fi-ta-actions {
        gap: 0.125rem;
    }

    .fi-ta-row .fi-ta-actions > .fi-ac-link-action {
        font-size: 0;
        gap: 0;
        padding: 0.5rem;
        border-radius: 0.5rem;
    }
}
