/* ==========================================================================
   Rarebit admin theme
   A dark brand frame (top bar + sidebar carrying the white wordmark) around a warm, quiet canvas.
   Flat surfaces with hairline borders, tabular numerals, ink-black actions - no coloured chrome.
   Plain CSS on purpose: it loads after Filament's stylesheet and, being un-layered, wins without !important.
   ========================================================================== */

:root {
    --rb-canvas: #f4f2ed;
    --rb-surface: #ffffff;
    --rb-surface-2: #faf9f6;
    --rb-line: #e6e1d6;
    --rb-line-strong: #d3ccbd;
    --rb-text: #141210;
    --rb-muted: #6b645a;
    --rb-subtle: #9a9184;
    --rb-ink: #141210;

    --rb-chrome: #0d0c0b;
    --rb-chrome-2: #171513;
    --rb-chrome-line: rgba(255, 255, 255, 0.09);
    --rb-chrome-text: #a9a193;
    --rb-chrome-strong: #ffffff;

    --rb-radius: 12px;
    --rb-radius-sm: 8px;
    --rb-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
}

.dark {
    --rb-canvas: #0b0a09;
    --rb-surface: #141311;
    --rb-surface-2: #1a1917;
    --rb-line: #262421;
    --rb-line-strong: #34312c;
    --rb-text: #f3f0e9;
    --rb-muted: #a29a8c;
    --rb-subtle: #766f63;
    --rb-ink: #f3f0e9;
    --rb-chrome: #070706;
    --rb-chrome-2: #121110;
}

/* ---------- Base ---------- */

.fi-body {
    background: var(--rb-canvas);
    color: var(--rb-text);
    font-feature-settings: 'tnum' 1, 'cv11' 1, 'ss01' 1;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.fi-main-ctn {
    background: var(--rb-canvas);
}

/* ---------- Brand frame: logo, top bar ---------- */

.rb-logo {
    display: inline-flex;
    align-items: flex-start;
    gap: 3px;
    color: #fff;
    line-height: 1;
}

.rb-logo__mark {
    height: 100%;
    width: auto;
    display: block;
}

.rb-logo__reg {
    font-size: 0.5rem;
    line-height: 1;
    margin-top: -1px;
    opacity: 0.7;
    font-family: var(--rb-mono);
}

.fi-topbar .fi-logo {
    height: 1.35rem !important; /* Filament sets this inline from brandLogoHeight; keep the lockup tight */
}

.fi-topbar-ctn,
.fi-topbar {
    background: var(--rb-chrome);
    box-shadow: none;
    border: 0;
}

.fi-topbar {
    border-bottom: 1px solid var(--rb-chrome-line);
    --tw-ring-shadow: 0 0 #0000;
}

.fi-topbar .fi-icon-btn,
.fi-topbar .fi-icon-btn .fi-icon {
    color: var(--rb-chrome-text);
}

.fi-topbar .fi-icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.fi-topbar .fi-global-search .fi-input-wrp {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--rb-chrome-line);
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
    border-radius: var(--rb-radius-sm);
}

.fi-topbar .fi-global-search .fi-input-wrp:focus-within {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.09);
}

.fi-topbar .fi-global-search .fi-input {
    color: #fff;
}

.fi-topbar .fi-global-search .fi-input::placeholder {
    color: var(--rb-chrome-text);
}

.fi-topbar .fi-global-search .fi-icon {
    color: var(--rb-chrome-text);
}

.fi-user-avatar {
    border: 1px solid var(--rb-chrome-line);
}

/* ---------- Brand frame: sidebar ---------- */

.fi-sidebar {
    background: var(--rb-chrome);
    box-shadow: none;
    border-right: 1px solid var(--rb-chrome-line);
    --tw-ring-shadow: 0 0 #0000;
}

.fi-sidebar-header-ctn,
.fi-sidebar-header {
    background: var(--rb-chrome);
    box-shadow: none;
    border: 0;
}

.fi-sidebar-nav {
    padding: 0.5rem 0.75rem 1.5rem;
}

.fi-sidebar-group-label,
.fi-sidebar-group-btn .fi-sidebar-group-label {
    font-family: var(--rb-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: #6f685d;
}

.fi-sidebar-group-btn .fi-icon,
.fi-sidebar-group-collapse-btn .fi-icon {
    color: #6f685d;
}

.fi-sidebar-item-btn,
.fi-sidebar-item a {
    border-radius: var(--rb-radius-sm);
    color: var(--rb-chrome-text);
    transition: background-color 0.15s ease, color 0.15s ease;
}

.fi-sidebar-item-label {
    color: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0;
}

.fi-sidebar-item-icon {
    color: #7d766a;
}

.fi-sidebar-item-btn:hover,
.fi-sidebar-item a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-btn,
.fi-sidebar-item.fi-active > a {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: inset 2px 0 0 #fff;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    color: #fff;
}

.fi-sidebar-item-badge-ctn .fi-badge,
.fi-sidebar-item .fi-badge {
    font-family: var(--rb-mono);
    font-size: 0.6875rem;
}

.fi-sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.fi-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
}

/* ---------- Page header ---------- */

.fi-page {
    padding-top: 0.5rem;
}

.fi-header-heading {
    font-size: 1.75rem;
    line-height: 1.15;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--rb-text);
}

.fi-header-subheading {
    color: var(--rb-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.fi-breadcrumbs {
    font-family: var(--rb-mono);
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.fi-breadcrumbs-item-label {
    color: var(--rb-subtle);
}

/* ---------- Surfaces: sections, table cards, widgets ---------- */

.fi-section,
.fi-ta-ctn,
.fi-wi-chart,
.fi-wi-table {
    background: var(--rb-surface);
    border: 1px solid var(--rb-line);
    border-radius: var(--rb-radius);
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
}

.fi-section-header-heading {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--rb-text);
}

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

.fi-section-content-ctn,
.fi-section-header {
    border-color: var(--rb-line);
}

/* ---------- Stat tiles ---------- */

.fi-wi-stats-overview-stat {
    background: var(--rb-surface);
    border: 1px solid var(--rb-line);
    border-radius: var(--rb-radius);
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
    padding: 1.25rem 1.375rem;
    transition: border-color 0.15s ease;
}

.fi-wi-stats-overview-stat:hover {
    border-color: var(--rb-line-strong);
}

.fi-wi-stats-overview-stat-label {
    font-family: var(--rb-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rb-muted);
}

.fi-wi-stats-overview-stat-value {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: -0.035em;
    color: var(--rb-text);
    font-variant-numeric: tabular-nums;
}

.fi-wi-stats-overview-stat-description {
    font-size: 0.8125rem;
}

/* ---------- Tables ---------- */

.fi-ta-header-cell {
    background: var(--rb-surface-2);
    font-family: var(--rb-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rb-muted);
    border-bottom: 1px solid var(--rb-line);
}

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

.fi-ta-table {
    --tw-divide-color: var(--rb-line);
}

.fi-ta-row {
    border-color: var(--rb-line);
    transition: background-color 0.12s ease;
}

.fi-ta-row:hover {
    background: var(--rb-surface-2);
}

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

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

.fi-ta-empty-state-heading {
    letter-spacing: -0.01em;
}

/* ---------- Buttons, badges ---------- */

.fi-btn {
    border-radius: var(--rb-radius-sm);
    font-weight: 500;
    letter-spacing: -0.005em;
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}

.fi-btn:active {
    transform: translateY(0.5px);
}

.fi-btn.fi-color-gray:not(.fi-outlined) {
    background: var(--rb-surface);
    border: 1px solid var(--rb-line-strong);
    color: var(--rb-text);
    --tw-ring-shadow: 0 0 #0000;
}

.fi-btn.fi-color-gray:not(.fi-outlined):hover {
    background: var(--rb-surface-2);
    border-color: var(--rb-muted);
}

.dark .fi-btn.fi-color-primary:not(.fi-outlined) {
    background: #f3f0e9;
    color: #0d0c0b;
}

.dark .fi-btn.fi-color-primary:not(.fi-outlined):hover {
    background: #ffffff;
}

.fi-badge {
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding-inline: 0.55rem;
    box-shadow: none;
}

.fi-icon-btn {
    border-radius: var(--rb-radius-sm);
}

/* ---------- Forms ---------- */

.fi-input-wrp {
    border-radius: var(--rb-radius-sm);
    background: var(--rb-surface);
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
    border: 1px solid var(--rb-line-strong);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.fi-input-wrp:focus-within {
    border-color: var(--rb-ink);
    box-shadow: 0 0 0 3px rgba(20, 18, 16, 0.08);
}

.dark .fi-input-wrp:focus-within {
    box-shadow: 0 0 0 3px rgba(243, 240, 233, 0.12);
}

.fi-fo-field-label,
.fi-fo-field-wrp-label,
.fi-input-wrp-label {
    font-weight: 500;
    color: var(--rb-text);
    letter-spacing: -0.005em;
}

.fi-fo-field-wrp-hint,
.fi-fo-field-wrp-helper-text {
    color: var(--rb-muted);
}

.fi-tabs {
    background: var(--rb-surface);
    border: 1px solid var(--rb-line);
    border-radius: var(--rb-radius);
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
}

.fi-tabs-item {
    border-radius: var(--rb-radius-sm);
    font-weight: 500;
}

.fi-tabs-item.fi-active {
    background: var(--rb-ink);
    color: var(--rb-canvas);
}

.fi-tabs-item.fi-active .fi-tabs-item-label,
.fi-tabs-item.fi-active .fi-icon {
    color: inherit;
}

/* ---------- Overlays ---------- */

.fi-modal-window,
.fi-dropdown-panel {
    border-radius: var(--rb-radius);
    box-shadow: 0 24px 60px -20px rgba(20, 18, 16, 0.35);
    --tw-ring-shadow: 0 0 0 1px var(--rb-line);
}

.fi-no .fi-no-notification {
    border-radius: var(--rb-radius);
}

/* ---------- Sign-in ---------- */

.fi-simple-layout {
    background: var(--rb-canvas);
}

.fi-simple-main-ctn {
    background: transparent;
}

.fi-simple-main {
    background: transparent;
    box-shadow: none;
    --tw-ring-shadow: 0 0 #0000;
    border: 0;
    max-width: 26rem;
}

.fi-simple-header-heading {
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--rb-text);
}

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

/* On the light card the wordmark must be dark; the hero half carries the white one. */
.fi-simple-main .rb-logo {
    color: var(--rb-ink);
}

.rb-login-hero {
    display: none;
}

@media (min-width: 1024px) {
    .fi-simple-layout {
        padding-left: 57vw;
    }

    /* The hero half already shows the wordmark. */
    .fi-simple-header .fi-logo {
        display: none;
    }

    .rb-login-hero {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 57vw;
        padding: 3rem 3.5rem;
        color: #fff;
        background:
            linear-gradient(180deg, rgba(8, 7, 6, 0.6) 0%, rgba(8, 7, 6, 0.08) 34%, rgba(8, 7, 6, 0.7) 100%),
            url('../brand/login.jpg') 62% 20% / cover no-repeat;
        z-index: 1;
    }

    .rb-login-hero .rb-logo {
        color: #fff;
        height: 1.9rem;
    }

    .rb-login-hero__eyebrow {
        font-family: var(--rb-mono);
        font-size: 0.6875rem;
        letter-spacing: 0.26em;
        text-transform: uppercase;
        opacity: 0.75;
        margin: 0 0 1rem;
    }

    .rb-login-hero__line {
        font-family: 'Anton', 'Inter Tight', sans-serif;
        text-transform: uppercase;
        font-size: clamp(3.25rem, 5.6vw, 6rem);
        line-height: 0.92;
        letter-spacing: -0.005em;
        margin: 0;
    }

    .rb-login-hero__meta {
        font-family: var(--rb-mono);
        font-size: 0.6875rem;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        opacity: 0.6;
        margin: 1.5rem 0 0;
    }
}

@media (max-width: 1023px) {
    .fi-simple-main .rb-logo {
        height: 1.6rem;
    }
}

/* ---------- Motion: respect the OS setting ---------- */

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

/* ---------- Sidebar refinements ---------- */

/* Filament draws a tree line + dots beside grouped items; on the dark frame it reads as noise. */
[class*='fi-sidebar-item-grouped-border'] {
    display: none;
}

.fi-sidebar-group-items {
    gap: 2px;
}

.fi-sidebar-item-btn:focus-visible,
.fi-sidebar-item a:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: -2px;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-btn {
    outline: 0;
}

.fi-sidebar-group-label {
    color: #8a8377;
}

/* Sign-in header reads as an editorial left-aligned block, not a centred card. */
.fi-simple-header {
    align-items: flex-start;
    text-align: left;
}

.fi-simple-header .fi-simple-header-heading,
.fi-simple-header .fi-simple-header-subheading {
    text-align: left;
}

/* ---------- Second-pass polish ---------- */

/* Grouped items have no icon: indent them so their text lines up with the group label. */
.fi-sidebar-group-items .fi-sidebar-item-btn:not(:has(.fi-sidebar-item-icon)) {
    padding-inline-start: 2.4rem;
}

.fi-sidebar-item:not(.fi-active) .fi-sidebar-item-label {
    color: #b3ab9d;
}

.fi-sidebar-item:not(.fi-active) .fi-sidebar-item-btn:hover .fi-sidebar-item-label {
    color: #fff;
}

/* The active marker is a slim bar on the frame's edge, not an outline around the row. */
.fi-sidebar-item {
    position: relative;
}

.fi-sidebar-item.fi-active .fi-sidebar-item-btn,
.fi-sidebar-item.fi-active > a {
    box-shadow: none;
    outline: 0;
}

.fi-sidebar-item.fi-active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 22%;
    bottom: 22%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #fff;
}

/* Dark mode inverts the primary button (light on dark); its icon must follow. */
.dark .fi-btn.fi-color-primary:not(.fi-outlined) .fi-icon,
.dark .fi-btn.fi-color-primary:not(.fi-outlined) .fi-btn-label {
    color: #0d0c0b;
}

/* Charts read their colours from these classes. Ink line, whisper-light fill. */
.fi-wi-chart-border-color {
    color: #1c1916;
}

.fi-wi-chart-bg-color {
    color: rgba(20, 18, 16, 0.07);
}

.dark .fi-wi-chart-border-color {
    color: #f3f0e9;
}

.dark .fi-wi-chart-bg-color {
    color: rgba(243, 240, 233, 0.07);
}

.fi-wi-chart-grid-color {
    color: var(--rb-line);
}

.fi-wi-chart-text-color {
    color: var(--rb-muted);
}

/* Header cells for actions/selection share the row's tint (they had their own in dark mode). */
.fi-ta-actions-header-cell,
.fi-ta-empty-header-cell,
.fi-ta-selection-cell.fi-ta-header-cell,
.fi-ta-group-selection-cell {
    background: var(--rb-surface-2);
}
