/* ==========================================================================
   Premium theme — global polish for Filament tables, sections, forms,
   stats, modals and navigation. Loaded after Filament's CSS; Filament's
   styles live in cascade layers, so these unlayered rules take precedence
   without needing !important.
   ========================================================================== */

:root {
    --pt-bg: #f5f6fa;
    --pt-card: #ffffff;
    --pt-sub: #f8f9fc;
    --pt-border: #e6e8ef;
    --pt-border-strong: #d6d9e3;
    --pt-text: #0f172a;
    --pt-muted: #64748b;
    --pt-accent: #4f46e5;
    --pt-accent-soft: rgba(79, 70, 229, .08);
    --pt-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --pt-radius: 16px;
}

.dark {
    --pt-bg: #0a0e17;
    --pt-card: #111723;
    --pt-sub: #0d121c;
    --pt-border: #1f2836;
    --pt-border-strong: #2b3546;
    --pt-text: #eef2f7;
    --pt-muted: #8b97ab;
    --pt-accent: #818cf8;
    --pt-accent-soft: rgba(129, 140, 248, .09);
    --pt-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .6);
}

/* ── Layout ────────────────────────────────────────────────────────────── */

.fi-body,
.fi-main-ctn,
.fi-main {
    background: var(--pt-bg);
}

.fi-header-heading {
    letter-spacing: -.02em;
    font-weight: 800;
}

.fi-header-subheading {
    color: var(--pt-muted);
}

/* Thin, unobtrusive scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--pt-border-strong) transparent;
}

/* ── Sidebar & topbar ──────────────────────────────────────────────────── */

.fi-topbar > nav,
.fi-topbar {
    background: color-mix(in srgb, var(--pt-card) 85%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--pt-border);
    box-shadow: none;
}

.fi-sidebar,
.fi-sidebar-header {
    background: var(--pt-card);
    border-color: var(--pt-border);
}

.fi-sidebar-item-btn {
    border-radius: 10px;
    transition: background-color .15s ease, color .15s ease;
}

.fi-sidebar-item-btn:hover {
    background: var(--pt-accent-soft);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background: var(--pt-accent-soft);
    box-shadow: inset 3px 0 0 var(--pt-accent);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn .fi-sidebar-item-label,
.fi-sidebar-item.fi-active > .fi-sidebar-item-btn > .fi-icon {
    color: var(--pt-accent) !important; /* beats the !important label colours in custom-filament.css */
    font-weight: 600;
}

.fi-sidebar-group-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* ── Tables ────────────────────────────────────────────────────────────── */

.fi-ta-ctn {
    border-radius: var(--pt-radius);
    background: var(--pt-card);
    box-shadow: var(--pt-shadow);
    --tw-ring-color: var(--pt-border);
    border: 1px solid var(--pt-border);
}

/* Without a header Filament clips the container; keep the rounded corners clean */
.fi-ta-ctn:not(.fi-ta-ctn-with-header) {
    overflow: hidden;
}

.fi-ta-ctn .fi-ta-header,
.fi-ta-ctn .fi-ta-header-toolbar {
    border-color: var(--pt-border);
}

.fi-ta-ctn .fi-ta-header-toolbar {
    background: var(--pt-card);
}

.fi-ta-table {
    border-collapse: separate;
    border-spacing: 0;
}

.fi-ta-table > thead > tr,
.fi-ta-table > thead > tr > th {
    background: var(--pt-sub);
}

.fi-ta-header-cell {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--pt-muted);
    padding-top: .8rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid var(--pt-border);
}

.fi-ta-header-cell .fi-ta-header-cell-sort-btn {
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
}

.fi-ta-header-cell.fi-ta-header-cell-sorted {
    color: var(--pt-accent);
}

.fi-ta-table > thead,
.fi-ta-table > tbody,
.fi-ta-table > thead > tr,
.fi-ta-table {
    --tw-divide-opacity: 1;
}

.fi-ta-table > tbody > tr + tr > td {
    border-top: 1px solid var(--pt-border);
}

.fi-ta-table > tbody,
.fi-ta-table > thead {
    border-color: var(--pt-border);
}

.fi-ta-row {
    transition: background-color .12s ease;
}

.fi-ta-row:hover {
    background: var(--pt-accent-soft);
}

.fi-ta-row.fi-striped {
    background: color-mix(in srgb, var(--pt-sub) 70%, transparent);
}

.fi-ta-row.fi-selected,
.fi-ta-row:has(.fi-ta-record-checkbox:checked) {
    background: var(--pt-accent-soft);
    box-shadow: inset 3px 0 0 var(--pt-accent);
}

.fi-ta-cell {
    font-variant-numeric: tabular-nums;
}

.fi-ta-text-description {
    color: var(--pt-muted);
    font-size: 12px;
}

.fi-ta-table > tfoot,
.fi-ta-summary-row,
.fi-ta-summary-header-row {
    background: var(--pt-sub);
}

/* Search field in the toolbar */
.fi-ta-search-field .fi-input-wrp {
    border-radius: 10px;
    min-width: 240px;
}

/* Empty state */
.fi-ta-empty-state {
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
}

.fi-ta-empty-state-icon-bg {
    background: var(--pt-accent-soft);
    border-radius: 16px;
}

.fi-ta-empty-state-icon-bg .fi-icon {
    color: var(--pt-accent);
}

/* Pagination */
.fi-pagination {
    border-color: var(--pt-border);
}

.fi-ta-ctn .fi-pagination {
    background: var(--pt-card);
}

.fi-pagination .fi-pagination-items {
    border-radius: 10px;
    overflow: hidden;
    --tw-ring-color: var(--pt-border);
}

.fi-pagination .fi-pagination-item.fi-active .fi-pagination-item-btn {
    background: var(--pt-accent-soft);
}

.fi-pagination .fi-pagination-item.fi-active .fi-pagination-item-label {
    color: var(--pt-accent);
    font-weight: 700;
}

/* ── Badges ────────────────────────────────────────────────────────────── */

.fi-badge {
    border-radius: 999px;
    font-weight: 600;
    padding-inline: .6rem;
    letter-spacing: .01em;
}

/* ── Sections, infolists, forms ────────────────────────────────────────── */

.fi-section:not(.fi-section-not-contained) {
    border-radius: var(--pt-radius);
    background: var(--pt-card);
    box-shadow: var(--pt-shadow);
    --tw-ring-color: var(--pt-border);
    border: 1px solid var(--pt-border);
}

.fi-section:not(.fi-section-not-contained) > .fi-section-header {
    border-bottom: 1px solid var(--pt-border);
}

.fi-section-header-heading {
    font-weight: 700;
    letter-spacing: -.01em;
}

.fi-section-header-description {
    color: var(--pt-muted);
}

.fi-fo-field-label-content,
.fi-in-entry-label {
    font-weight: 600;
}

.fi-input-wrp {
    border-radius: 10px;
    transition: box-shadow .15s ease, background-color .15s ease;
}

.dark .fi-input-wrp {
    background: var(--pt-sub);
    --tw-ring-color: var(--pt-border-strong);
}

.fi-input-wrp:focus-within {
    box-shadow: 0 0 0 4px var(--pt-accent-soft);
}

.fi-fo-repeater-item,
.fi-fieldset {
    border-radius: 12px;
    border-color: var(--pt-border);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.fi-btn {
    border-radius: 10px;
    font-weight: 600;
    transition: transform .12s ease, box-shadow .15s ease, background-color .15s ease;
}

.fi-btn:not(.fi-disabled):not([disabled]):hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .45);
}

.fi-btn:not(.fi-disabled):not([disabled]):active {
    transform: translateY(0);
}

.fi-icon-btn {
    border-radius: 8px;
}

/* ── Tabs ──────────────────────────────────────────────────────────────── */

.fi-tabs {
    border-radius: 12px;
    background: var(--pt-card);
    --tw-ring-color: var(--pt-border);
    border: 1px solid var(--pt-border);
}

.fi-tabs-item {
    border-radius: 8px;
}

.fi-tabs-item.fi-active {
    background: var(--pt-accent-soft);
}

.fi-tabs-item.fi-active .fi-tabs-item-label,
.fi-tabs-item.fi-active .fi-icon {
    color: var(--pt-accent);
}

/* ── Stats widgets ─────────────────────────────────────────────────────── */

.fi-wi-stats-overview-stat {
    border-radius: var(--pt-radius);
    background: var(--pt-card);
    --tw-ring-color: var(--pt-border);
    border: 1px solid var(--pt-border);
    box-shadow: var(--pt-shadow);
    position: relative;
    overflow: hidden;
}

.fi-wi-stats-overview-stat::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pt-accent), transparent);
    opacity: .7;
}

.fi-wi-stats-overview-stat-label {
    color: var(--pt-muted);
    font-weight: 600;
}

.fi-wi-stats-overview-stat-value {
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.fi-wi-chart .fi-section,
.fi-wi-widget .fi-section {
    border-radius: var(--pt-radius);
}

/* ── Modals, dropdowns, notifications ──────────────────────────────────── */

.fi-modal-close-overlay {
    backdrop-filter: blur(4px);
}

.fi-modal-window {
    border-radius: 20px;
    background: var(--pt-card);
    border: 1px solid var(--pt-border);
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}

.fi-modal-header {
    border-bottom: 1px solid var(--pt-border);
}

.fi-modal-heading {
    font-weight: 800;
    letter-spacing: -.01em;
}

.fi-modal-footer {
    border-top: 1px solid var(--pt-border);
    background: var(--pt-sub);
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.fi-dropdown-panel {
    border-radius: 12px;
    background: var(--pt-card);
    border: 1px solid var(--pt-border);
    box-shadow: 0 20px 48px -16px rgba(0, 0, 0, .5);
}

.fi-dropdown-list-item {
    border-radius: 8px;
}

.fi-no-notification {
    border-radius: 14px;
    border: 1px solid var(--pt-border);
}

/* ── Breadcrumbs ───────────────────────────────────────────────────────── */

.fi-breadcrumbs-item-label {
    font-size: 12px;
    font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
    .fi-btn,
    .fi-ta-row,
    .fi-sidebar-item-btn {
        transition: none;
    }
    .fi-btn:not(.fi-disabled):not([disabled]):hover {
        transform: none;
    }
}
