/* ==========================================================================
   HRMV — "Dialin" theme
   Loaded ONLY when enabled in Organization → Appearance.

   RULES THIS FILE FOLLOWS (learned the hard way):
   1. Filament marks dark mode with a `dark` CLASS on <html>. Never use
      prefers-color-scheme — it would apply dark tokens on a light page and
      make text invisible.
   2. Never override plain text `color`. Filament already sets legible text
      colours for both modes; this theme only styles backgrounds, borders,
      radii, shadows, weight/tracking and the accent. Colour is only set where
      the background is set in the same rule (badges, primary button).
   3. No layout changes, no horizontal scrolling.
   ========================================================================== */

/* ---- 1. Design tokens --------------------------------------------------- */
:root {
    /* accent + data colours (from the reference design) */
    --dl-violet: #7c5cfc;
    --dl-violet-600: #6d4df0;
    --dl-violet-300: #a78bfa;
    --dl-amber: #fbbf24;
    --dl-cyan: #22d3ee;
    --dl-emerald: #34d399;
    --dl-orange: #fb923c;

    /* surfaces only — never text */
    --dl-ground: #f8f9fc;
    --dl-surface: #ffffff;
    --dl-surface-2: #f4f5f9;
    --dl-hairline: #edeff5;

    /* status tints (bg + fg always set together) */
    --dl-pos-bg: #dcfce7;
    --dl-pos-fg: #16a34a;
    --dl-neg-bg: #fee2e2;
    --dl-neg-fg: #dc2626;
    --dl-warn-bg: #fef3c7;
    --dl-warn-fg: #b45309;
    --dl-info-bg: #cffafe;
    --dl-info-fg: #0e7490;
    --dl-pri-bg: #ede9fe;
    --dl-pri-fg: #6d28d9;

    /* shape + depth — the reference cards are FLAT: crisp hairline, barely any
       shadow. Only overlays (dropdowns/modals) actually pop. */
    --dl-r-card: 16px;
    --dl-r-ctrl: 10px;
    --dl-shadow: 0 1px 2px rgba(20, 20, 43, .05);
    --dl-shadow-pop: 0 10px 32px -8px rgba(20, 20, 43, .20);
}

html.dark {
    --dl-ground: #0f1120;
    --dl-surface: #171a2e;
    --dl-surface-2: #1e2239;
    --dl-hairline: #272b45;
    --dl-pos-bg: rgba(52, 211, 153, .18);
    --dl-pos-fg: #6ee7b7;
    --dl-neg-bg: rgba(248, 113, 113, .18);
    --dl-neg-fg: #fca5a5;
    --dl-warn-bg: rgba(251, 191, 36, .18);
    --dl-warn-fg: #fcd34d;
    --dl-info-bg: rgba(34, 211, 238, .18);
    --dl-info-fg: #67e8f9;
    --dl-pri-bg: rgba(124, 92, 252, .22);
    --dl-pri-fg: #c4b5fd;
    --dl-shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --dl-shadow-pop: 0 10px 34px -8px rgba(0, 0, 0, .7);
}

/* ---- 2. Typography (family + weight only — no colour) ------------------ */
body,
.fi-body {
    font-family: "Plus Jakarta Sans", Inter, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
.fi-body,
.fi-main-ctn { background-color: var(--dl-ground); }

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

/* ---- 3. Sidebar --------------------------------------------------------- */
.fi-sidebar,
.fi-sidebar-nav,
.fi-sidebar-header {
    background-color: var(--dl-surface);
    border-color: var(--dl-hairline);
}
/* Real Filament classes: .fi-sidebar-item[.fi-active] > .fi-sidebar-item-btn */
.fi-sidebar-item-btn { border-radius: var(--dl-r-ctrl); }
.fi-sidebar-item:not(.fi-active) .fi-sidebar-item-btn:hover { background-color: var(--dl-surface-2); }

/* the reference's active row: violet → indigo → cyan wash */
.fi-sidebar-item.fi-active .fi-sidebar-item-btn {
    background-image: linear-gradient(90deg,
        rgba(124, 92, 252, .22) 0%,
        rgba(167, 139, 250, .16) 40%,
        rgba(129, 140, 248, .13) 70%,
        rgba(103, 232, 249, .16) 100%);
    font-weight: 600;
}
.fi-sidebar-item.fi-active .fi-sidebar-item-icon { color: var(--dl-violet); }

/* ---- 4. Topbar ---------------------------------------------------------- */
.fi-topbar,
.fi-topbar > nav {
    background-color: var(--dl-surface);
    border-bottom: 1px solid var(--dl-hairline);
    box-shadow: none;
}

/* ---- 5. Cards / sections / panels -------------------------------------- */
/* NOTE: a Section rendered with ->contained(false) gets the
   .fi-section-not-contained class and must stay completely bare — Filament
   uses it as a plain layout wrapper (e.g. the stats-overview row). Styling it
   as a card produces a stray panel behind the real cards. */
.fi-section:not(.fi-section-not-contained),
.fi-ta-ctn,
.fi-wi-stats-overview-stat,
.fi-modal-window,
.fi-dropdown-panel {
    background-color: var(--dl-surface);
    border: 1px solid var(--dl-hairline) !important;
    border-radius: var(--dl-r-card) !important;
    box-shadow: var(--dl-shadow) !important;
}
/* belt and braces: never give a bare wrapper any card chrome */
.fi-section-not-contained {
    background: none !important;
    background-image: none !important;
    border: 0 !important;
    box-shadow: none !important;
}
.fi-dropdown-panel,
.fi-modal-window { box-shadow: var(--dl-shadow-pop) !important; }

/* Corner gradient on EVERY card.
   Painted as a background-image so the card's border-radius clips it — no
   overflow:hidden, which would clip selects/dropdowns opened inside a card. */
.fi-section:not(.fi-section-not-contained),
.fi-ta-ctn,
.fi-wi-stats-overview-stat {
    /* sparkles first (drawn on top), then the violet→indigo→cyan wash */
    background-image:
        radial-gradient(circle 2.5px at 79% 15%, rgba(255, 255, 255, .95), transparent 100%),
        radial-gradient(circle 1.5px at 89% 8%, rgba(255, 255, 255, .9), transparent 100%),
        radial-gradient(circle 2px at 71% 27%, rgba(255, 255, 255, .85), transparent 100%),
        radial-gradient(circle 1.5px at 93% 23%, rgba(255, 255, 255, .8), transparent 100%),
        radial-gradient(circle 1.5px at 84% 33%, rgba(255, 255, 255, .7), transparent 100%),
        radial-gradient(115% 85% at 100% 0%, rgba(167, 139, 250, .24), rgba(167, 139, 250, 0) 58%),
        radial-gradient(85% 70% at 97% 10%, rgba(129, 140, 248, .20), rgba(129, 140, 248, 0) 62%),
        radial-gradient(80% 65% at 90% 24%, rgba(103, 232, 249, .20), rgba(103, 232, 249, 0) 64%);
    background-repeat: no-repeat;
    background-attachment: local;
}
html.dark .fi-section,
html.dark .fi-ta-ctn,
html.dark .fi-wi-stats-overview-stat {
    background-image:
        radial-gradient(circle 2.5px at 79% 15%, rgba(255, 255, 255, .7), transparent 100%),
        radial-gradient(circle 1.5px at 89% 8%, rgba(255, 255, 255, .6), transparent 100%),
        radial-gradient(circle 2px at 71% 27%, rgba(255, 255, 255, .55), transparent 100%),
        radial-gradient(circle 1.5px at 93% 23%, rgba(255, 255, 255, .5), transparent 100%),
        radial-gradient(circle 1.5px at 84% 33%, rgba(255, 255, 255, .45), transparent 100%),
        radial-gradient(115% 85% at 100% 0%, rgba(167, 139, 250, .18), rgba(167, 139, 250, 0) 58%),
        radial-gradient(85% 70% at 97% 10%, rgba(129, 140, 248, .15), rgba(129, 140, 248, 0) 62%),
        radial-gradient(80% 65% at 90% 24%, rgba(103, 232, 249, .15), rgba(103, 232, 249, 0) 64%);
}
/* Overlays stay clean — a gradient behind menu items hurts readability. */
.fi-dropdown-panel,
.fi-modal-window { background-image: none !important; }

/* ---- 6. Stat cards: big tabular figures -------------------------------- */
.fi-wi-stats-overview-stat-value {
    font-weight: 800;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}
.fi-wi-stats-overview-stat-label { font-size: .8rem; font-weight: 500; }
.fi-wi-stats-overview-stat-description { font-size: .75rem; font-weight: 600; }

/* ---- 7. Buttons --------------------------------------------------------- */
.fi-btn { border-radius: var(--dl-r-ctrl); font-weight: 600; }
.fi-btn.fi-color-primary {
    background-color: var(--dl-violet);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 16px -8px rgba(124, 92, 252, .7);
}
.fi-btn.fi-color-primary:hover { background-color: var(--dl-violet-600); }

/* Outlined controls read as the reference's "Weekly ⌄" / "Filter" pills */
.fi-btn.fi-btn-outlined,
.fi-dropdown-trigger > .fi-btn.fi-btn-outlined {
    background-color: var(--dl-surface);
    border: 1px solid var(--dl-hairline);
}

/* ---- 8. Badges as rounded delta pills (bg + fg set together) ----------- */
.fi-badge {
    border-radius: 999px !important;
    font-weight: 700;
    font-size: .7rem;
    letter-spacing: .01em;
    border: 0;
}
.fi-badge.fi-color-success { background-color: var(--dl-pos-bg); color: var(--dl-pos-fg); }
.fi-badge.fi-color-danger  { background-color: var(--dl-neg-bg); color: var(--dl-neg-fg); }
.fi-badge.fi-color-warning { background-color: var(--dl-warn-bg); color: var(--dl-warn-fg); }
.fi-badge.fi-color-info    { background-color: var(--dl-info-bg); color: var(--dl-info-fg); }
.fi-badge.fi-color-primary { background-color: var(--dl-pri-bg);  color: var(--dl-pri-fg); }

/* ---- 9. Tables (no text colour touched) -------------------------------- */
.fi-ta-header-cell {
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.fi-ta-cell-content-item { font-variant-numeric: tabular-nums; }
.fi-ta-row { border-color: var(--dl-hairline); }
.fi-ta-row:hover { background-color: rgba(124, 92, 252, .05); }
.fi-ta-empty-state { background-color: var(--dl-surface); }

/* ---- 10. Tabs (wrap, never scroll) ------------------------------------- */
.fi-tabs {
    background-color: var(--dl-surface);
    border: 1px solid var(--dl-hairline);
    border-radius: var(--dl-r-card);
    flex-wrap: wrap !important;
    overflow-x: visible !important;
}
.fi-tabs-item { border-radius: var(--dl-r-ctrl); }
/* Real Filament class: .fi-tabs-item.fi-active */
.fi-tabs-item.fi-active {
    background-image: linear-gradient(90deg, rgba(124, 92, 252, .20), rgba(103, 232, 249, .14));
    font-weight: 600;
}
.fi-tabs-item.fi-active .fi-icon { color: var(--dl-violet); }

/* ---- 11. Inputs --------------------------------------------------------- */
.fi-input-wrp {
    border-radius: var(--dl-r-ctrl);
    border-color: var(--dl-hairline);
    background-color: var(--dl-surface);
}
.fi-input-wrp:focus-within {
    border-color: var(--dl-violet);
    box-shadow: 0 0 0 3px rgba(124, 92, 252, .16);
}
.fi-fo-field-wrp-label { font-weight: 600; font-size: .8rem; }

/* ---- 11b. Hero card: soft violet→blue→cyan corner gradient -------------
   Matches the reference's "Total overview" card. Deliberately applied ONLY to
   .dl-hero — in the reference the other cards are plain white. --------------- */
/* The hero card now shares the exact same corner treatment as every other
   card (see §5) — no pseudo-elements and no overflow:hidden, so nothing can
   clip a dropdown opened inside a card. Only its legend needs styling. */

/* legend rows inside the hero card */
.dl-hero-legend { display: flex; flex-direction: column; gap: .55rem; }
.dl-hero-legend .row { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.dl-hero-legend .row i { width: .8rem; height: .8rem; border-radius: .25rem; flex: 0 0 auto; }
.dl-hero-legend .row .val { margin-inline-start: auto; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- 12. Our custom widgets share the palette -------------------------- */
.hrmv-att .track,
.hrmv-leave .bar { border-radius: 8px; }
.hrmv-att .work { background: var(--dl-violet-300) !important; }
.hrmv-att .brk {
    background: repeating-linear-gradient(45deg, rgba(34,211,238,.55), rgba(34,211,238,.55) 5px, rgba(34,211,238,.2) 5px, rgba(34,211,238,.2) 10px) !important;
}
.hrmv-leave .seg.used { background: var(--dl-violet) !important; }
.hrmv-leave .seg.pend {
    background: repeating-linear-gradient(45deg, var(--dl-amber), var(--dl-amber) 6px, #fcd34d 6px, #fcd34d 12px) !important;
}
.hrmv-leave .seg.left { background: rgba(52, 211, 153, .45) !important; }

/* ---- 13. Scrollbars ----------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--dl-hairline) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--dl-hairline); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }
