/* App shell: dense, desktop-app-like chrome in the browser; native-app feel on phones. */

/* --- Desktop-app density ---------------------------------------------- */
/* Shorter app bar, like native window titlebars. */
.fi-body { --topbar-height: 3.5rem; }

/* Chrome (topbar, sidebar, breadcrumbs) behaves like a window frame, not text. */
.fi-topbar, .fi-sidebar, .fi-breadcrumbs, .fi-sidebar-item-btn, .fi-topbar-item-btn {
    user-select: none;
    -webkit-user-select: none;
}

/* Numbers stay aligned like desktop cash-register software. */
.fi-ta-cell, .fi-ta-header-cell, .fi-badge, .fi-input, .fi-select-input,
.fi-widget, .fi-header-heading, .fi-stat {
    font-variant-numeric: tabular-nums;
}

/* Dense tables: hairline rows, compact type. */
.fi-ta-table td, .fi-ta-table th { padding-block: 0.3rem; }
.fi-ta-cell { font-size: 0.8125rem; }
.fi-ta-header-cell { font-size: 0.75rem; }

/* On desktop, rows stay on one line and scroll horizontally instead of wrapping
    (like spreadsheet/POS software). Mobile keeps Filament's stacked layout. */
@media (min-width: 768px) {
    .fi-ta-table td { white-space: nowrap; }
}

/* Compact page padding so more table fits above the fold. */
.fi-main { padding-block: 1rem; }

/* Thin, subtle scrollbars everywhere (desktop app convention). */
* { scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, 0.4) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4); border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.6); }
::-webkit-scrollbar-track { background: transparent; }

/* No pull-to-refresh / rubber band: it breaks the app illusion. */
html { overscroll-behavior-y: none; }
body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

/* --- Mobile: native-app navigation ------------------------------------ */
.app-bottom-nav { display: none; }

@media (max-width: 767px) {
    body { padding-bottom: calc(4.25rem + env(safe-area-inset-bottom)); }

    .app-bottom-nav {
        position: fixed; inset: auto 0 0 0; z-index: 40;
        display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid #e2e8f0;
        box-shadow: 0 -1px 3px rgba(15, 23, 42, 0.06);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .app-bottom-nav a {
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 0.625rem 0 0.5rem; font-size: 0.6875rem; line-height: 1.2;
        color: #64748b; text-decoration: none;
        -webkit-user-select: none; user-select: none;
        -webkit-touch-callout: none;
        touch-action: manipulation;
    }
    .app-bottom-nav a svg { transition: transform 0.15s ease; }
    .app-bottom-nav a.is-active { color: #0f172a; font-weight: 600; }
    .app-bottom-nav a.is-active svg { transform: translateY(-1px) scale(1.1); }

    /* Raised circular FAB for the primary action (like tab-bar center buttons). */
    .app-bottom-nav a.is-fab { color: #0f172a; }
    .app-bottom-nav a.is-fab svg {
        box-sizing: border-box; width: 3rem; height: 3rem; margin-top: -1.5rem;
        padding: 0.7rem; border-radius: 9999px;
        background: #0f172a; color: #fff;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
    }
    .app-bottom-nav a.is-fab svg:active { transform: scale(0.92); }
    .app-bottom-nav a.is-active.is-fab svg { transform: none; }

    /* App header: safe area under the notch, leaner chrome. */
    .fi-topbar-ctn { padding-top: env(safe-area-inset-top); }
    .fi-topbar { padding-inline: 0.75rem; }
    .fi-breadcrumbs { display: none; }

    /* Compact app-title page headers. */
    .fi-header-heading { font-size: 1.125rem; font-weight: 700; }

    /* Modals become bottom sheets that slide up, with a grabber handle. */
    .fi-modal:not(.fi-modal-slide-over) .fi-modal-window-ctn {
        display: flex; align-items: flex-end; padding: 0;
    }
    .fi-modal:not(.fi-modal-slide-over) .fi-modal-window {
        width: 100%; max-width: 100%; margin: 0;
        border-radius: 1.25rem 1.25rem 0 0;
        max-height: calc(100dvh - 3.5rem);
        padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
    }
    .fi-modal:not(.fi-modal-slide-over) .fi-modal-window::before {
        content: ''; display: block; flex-shrink: 0;
        width: 2.5rem; height: 0.25rem; margin: 0.5rem auto 0;
        border-radius: 9999px; background: #cbd5e1;
    }

    /* No visible scrollbars: content scrolls like a native app. */
    ::-webkit-scrollbar { width: 0; height: 0; }
    * { scrollbar-width: none; }

    /* Modals and notifications stay above the bottom nav. */
    .fi-modal-window-ctn, .fi-modal-close-overlay { z-index: 50; }

    /* iOS zooms into form controls smaller than 16px; keep inputs native-feel. */
    .fi-body input, .fi-body select, .fi-body textarea { font-size: 16px; }
}

.dark .app-bottom-nav a.is-fab svg {
    background: #f8fafc; color: #0f172a;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}
.dark .fi-modal:not(.fi-modal-slide-over) .fi-modal-window::before { background: #334155; }

.dark .app-bottom-nav {
    background: rgba(15, 23, 42, 0.92);
    border-color: #1e293b;
}
.dark .app-bottom-nav a { color: #94a3b8; }
.dark .app-bottom-nav a.is-active { color: #f8fafc; }
