/*
 * «Инфопанель» — admin dashboard (design_handoff_dashboard §6 tokens).
 *
 * Everything is scoped under .cx-dash so this asset (registered panel-wide)
 * is inert on every other page. Colours are stated literally — the design is
 * light-only, so Filament's dark theme must not repaint half of it.
 */
.cx-dash {
    --cx-page: #eef1f4;
    --cx-card: #ffffff;
    --cx-border: #e7ebf0;
    --cx-border-strong: #d8dee6;
    --cx-ink: #0f172a;
    --cx-sub: #64748b;
    --cx-faint: #94a3b8;
    --cx-blue: #2489c5;
    --cx-blue-dark: #1f79b0;
    --cx-blue-soft: #e8f2fa;
    --cx-blue-border: #c5e0f2;
    --cx-navy: #0c2748;
    --cx-amber-ink: #b45309;
    --cx-amber-bg: #fef5e1;
    --cx-amber-dot: #f59e0b;
    --cx-green: #16a34a;
    --cx-green-dark: #15803d;
    --cx-green-soft: #e7f7ec;
    --cx-green-border: #bbe9c9;
    --cx-red: #dc2626;
    --cx-red-soft: #fdeaea;
    --cx-red-border: #f6c9c9;
    --cx-row-hover: #f6f8fb;

    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--cx-ink);
}

.cx-dash *,
.cx-dash *::before,
.cx-dash *::after { box-sizing: border-box; }

.cx-dash [x-cloak] { display: none !important; }

/* leave-type dots */
.cx-dash .cx-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.cx-dash .cx-type-vacation { --cx-t: #2489c5; --cx-t-bg: #e8f2fa; }
.cx-dash .cx-type-sick_leave { --cx-t: #e5484d; --cx-t-bg: #fdeaea; }
.cx-dash .cx-type-day_off { --cx-t: #7c3aed; --cx-t-bg: #efeafe; }
.cx-dash .cx-type-remote { --cx-t: #0d9488; --cx-t-bg: #d7f5f0; }
.cx-dash .cx-type-unpaid_day_off { --cx-t: #64748b; --cx-t-bg: #e6ebf1; }

/* avatars */
.cx-dash .cx-av {
    border-radius: 50%; flex: 0 0 auto; display: inline-flex; align-items: center;
    justify-content: center; font-weight: 700; color: #35507a; background: #dfeaf6;
}
.cx-dash .cx-av-ring { box-shadow: 0 0 0 2px #fff; }

/* ── header row ─────────────────────────────────────────────────────── */
.cx-dash .cx-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.cx-dash .cx-h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.cx-dash .cx-dateline { font-size: 13.5px; color: var(--cx-sub); margin-top: 4px; }
.cx-dash .cx-dateline b { color: var(--cx-amber-ink); font-weight: 600; }
.cx-dash .cx-head-actions { display: flex; align-items: center; gap: 9px; }

/* buttons */
.cx-dash .cx-btn-primary {
    display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 15px;
    border-radius: 10px; border: none; background: var(--cx-blue); color: #fff;
    font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none;
    box-shadow: 0 6px 16px rgba(36, 137, 197, 0.25); font-family: inherit;
}
.cx-dash .cx-btn-primary:hover { background: var(--cx-blue-dark); }
.cx-dash .cx-link { font-size: 12.5px; font-weight: 600; color: var(--cx-blue); background: none; border: none; cursor: pointer; text-decoration: none; font-family: inherit; }

/* bell */
.cx-dash .cx-bell-wrap { position: relative; }
.cx-dash .cx-bell {
    position: relative; width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--cx-border); background: #fff; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: background 0.12s;
}
.cx-dash .cx-bell:hover, .cx-dash .cx-bell[aria-expanded="true"] { background: var(--cx-blue-soft); }
.cx-dash .cx-bell-badge {
    position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
    border-radius: 999px; background: var(--cx-red); color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}
.cx-dash .cx-bell-panel {
    position: absolute; top: calc(100% + 10px); right: 0; width: 396px; max-width: 92vw;
    background: #fff; border: 1px solid var(--cx-border); border-radius: 14px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18); z-index: 200; overflow: hidden;
    animation: cx-pop 0.16s ease;
}
.cx-dash .cx-bell-head { display: flex; align-items: center; gap: 9px; padding: 13px 15px; border-bottom: 1px solid var(--cx-border); }
.cx-dash .cx-bell-title { font-size: 14.5px; font-weight: 700; }
.cx-dash .cx-bell-count { background: var(--cx-amber-dot); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.cx-dash .cx-bell-list { max-height: 400px; overflow-y: auto; }
.cx-dash .cx-bell-empty { padding: 38px 20px; text-align: center; }
.cx-dash .cx-bell-empty-circle { width: 54px; height: 54px; border-radius: 50%; background: var(--cx-green-soft); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.cx-dash .cx-bell-foot { padding: 9px 14px; border-top: 1px solid var(--cx-border); text-align: center; }

.cx-dash .cx-req {
    display: flex; align-items: center; gap: 11px; padding: 11px 14px;
    border-bottom: 1px solid var(--cx-border); border-left: 3px solid transparent;
    overflow: hidden; transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.25s ease;
    max-height: 120px;
}
.cx-dash .cx-req[data-urgent="true"] { border-left-color: var(--cx-red); }
.cx-dash .cx-req[data-leaving="approved"] { max-height: 0; opacity: 0; transform: translateX(20px); }
.cx-dash .cx-req[data-leaving="declined"] { max-height: 0; opacity: 0; transform: translateX(-20px); }
.cx-dash .cx-req-body { min-width: 0; flex: 1; }
.cx-dash .cx-req-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-dash .cx-req-meta { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.cx-dash .cx-req-range { font-size: 11.5px; color: var(--cx-sub); white-space: nowrap; }
.cx-dash .cx-req-urg { font-size: 11px; font-weight: 700; }
.cx-dash .cx-req-urg[data-kind="now"], .cx-dash .cx-req-urg[data-kind="overdue"] { color: var(--cx-red); }
.cx-dash .cx-req-urg[data-kind="soon"] { color: var(--cx-amber-ink); }
.cx-dash .cx-req-urg[data-kind="later"] { color: var(--cx-faint); }
.cx-dash .cx-req-act {
    width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center; border: none; background: transparent;
}
.cx-dash .cx-req-approve { background: var(--cx-green-soft); }
.cx-dash .cx-req-approve:hover { background: var(--cx-green); }
.cx-dash .cx-req-decline { background: #fff; border: 1px solid var(--cx-red-border); }
.cx-dash .cx-req-decline:hover { background: var(--cx-red-soft); }

/* toast — UNSCOPED: teleported to <body>, so it lives outside .cx-dash.
   Literal colours (no var()) for the same reason. */
.cx-toast {
    position: fixed; bottom: 22px; left: 22px; z-index: 999; display: flex; align-items: center; gap: 12px;
    background: #0f172a; color: #fff; border-radius: 12px; padding: 10px 12px 10px 15px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28); animation: cx-toast 0.22s ease;
    font-family: 'Inter', system-ui, sans-serif;
}
.cx-toast-icon { width: 21px; height: 21px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.cx-toast-msg { font-size: 13.5px; font-weight: 600; }
.cx-toast-undo {
    display: inline-flex; align-items: center; gap: 5px; background: rgba(255, 255, 255, 0.13); color: #fff;
    border: none; border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}

/* ── KPI row ────────────────────────────────────────────────────────── */
.cx-dash .cx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cx-dash .cx-kpi { background: var(--cx-card); border: 1px solid var(--cx-border); border-radius: 13px; padding: 14px 15px; }
.cx-dash .cx-kpi[data-empty="true"] { opacity: 0.72; }
.cx-dash .cx-kpi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.cx-dash .cx-kpi-chip { width: 26px; height: 26px; border-radius: 7px; background: var(--cx-t-bg); display: flex; align-items: center; justify-content: center; }
.cx-dash .cx-kpi-chip > span { width: 9px; height: 9px; border-radius: 3px; background: var(--cx-t); }
.cx-dash .cx-kpi-label { font-size: 12.5px; color: var(--cx-sub); font-weight: 600; }
.cx-dash .cx-kpi-body { display: flex; align-items: flex-end; gap: 8px; }
.cx-dash .cx-kpi-n { font-size: 28px; font-weight: 800; line-height: 1; }
.cx-dash .cx-kpi[data-empty="true"] .cx-kpi-n { color: var(--cx-faint); }
.cx-dash .cx-kpi-avs { display: flex; margin-bottom: 3px; }
.cx-dash .cx-kpi-avs .cx-av + .cx-av { margin-left: -8px; }

/* ── two columns ────────────────────────────────────────────────────── */
.cx-dash .cx-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.cx-dash .cx-panel { background: var(--cx-card); border: 1px solid var(--cx-border); border-radius: 14px; overflow: hidden; }
.cx-dash .cx-panel-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid var(--cx-border); }
.cx-dash .cx-panel-title { font-size: 14.5px; font-weight: 700; }
.cx-dash .cx-panel-count { background: #eef2f6; color: var(--cx-sub); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; }

.cx-dash .cx-out { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--cx-border); }
.cx-dash .cx-out:last-child { border-bottom: none; }
.cx-dash .cx-out-body { min-width: 0; flex: 1; }
.cx-dash .cx-out-name { font-size: 13.5px; font-weight: 600; }
.cx-dash .cx-out-dept { font-size: 12px; color: var(--cx-faint); }
.cx-dash .cx-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--cx-t-bg); color: var(--cx-t); border-radius: 7px; padding: 3px 9px; font-size: 12px; font-weight: 600; }
.cx-dash .cx-pill > span { width: 7px; height: 7px; border-radius: 2px; background: var(--cx-t); }
.cx-dash .cx-out-until { font-size: 12px; color: var(--cx-sub); min-width: 92px; text-align: right; }
.cx-dash .cx-empty-row { padding: 22px 16px; text-align: center; color: var(--cx-faint); font-size: 13px; }

.cx-dash .cx-side { display: flex; flex-direction: column; gap: 16px; }
.cx-dash .cx-card-pad { background: var(--cx-card); border: 1px solid var(--cx-border); border-radius: 14px; padding: 16px; }
.cx-dash .cx-quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cx-dash .cx-quick {
    display: flex; flex-direction: column; gap: 9px; padding: 13px; border-radius: 11px;
    border: 1px solid var(--cx-border); background: #fff; cursor: pointer; text-align: left;
    text-decoration: none; transition: border-color 0.12s, background 0.12s; color: var(--cx-ink);
}
.cx-dash .cx-quick:hover { border-color: var(--cx-blue-border); background: var(--cx-blue-soft); }
.cx-dash .cx-quick-label { font-size: 13px; font-weight: 600; }

.cx-dash .cx-load { background: linear-gradient(135deg, #12335c, #0c2748); border-radius: 14px; padding: 18px; color: #fff; }
.cx-dash .cx-load-cap { font-size: 13px; color: #a9c6e2; font-weight: 600; }
.cx-dash .cx-load-bars { display: flex; align-items: flex-end; gap: 4px; height: 56px; margin-top: 14px; }
.cx-dash .cx-load-bar { flex: 1; min-height: 2px; border-radius: 3px; background: rgba(124, 199, 238, 0.55); }
.cx-dash .cx-load-bar[data-peak="true"] { background: #f59e0b; }
.cx-dash .cx-load-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; color: #cfe0f0; }
.cx-dash .cx-load-foot b { font-weight: 700; color: #fff; }

/* «Быстрый переход» heading */
.cx-dash .cx-sub-h { font-size: 14.5px; font-weight: 700; margin-bottom: 12px; }

/* ── Лаунчер «Все модули» bento grid (design ShellLauncher; task #22) ──── */
.cx-dash .cx-modules-section { margin-top: 26px; }
.cx-dash .cx-modules-head {
    font-size: 13px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
    color: var(--cx-faint); margin-bottom: 12px;
}
.cx-dash .cx-modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.cx-dash .cx-module-tile {
    display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 14px;
    border: 1px solid var(--cx-border); background: #fff; text-decoration: none; color: var(--cx-ink);
    transition: transform 0.13s, box-shadow 0.13s, border-color 0.13s;
}
.cx-dash .cx-module-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(15, 23, 42, 0.1); border-color: var(--cx-blue-border); }
.cx-dash .cx-module-ic { width: 42px; height: 42px; border-radius: 11px; background: var(--cx-blue-soft); color: var(--cx-blue); display: flex; align-items: center; justify-content: center; }
.cx-dash .cx-module-label { font-size: 13.5px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .cx-dash .cx-module-tile { transition: none; } }

/* ── command palette ────────────────────────────────────────────────── */
.cx-palette-overlay {
    position: fixed; inset: 0; z-index: 400; background: rgba(15, 23, 42, 0.35);
    display: flex; align-items: flex-start; justify-content: center; padding-top: 13vh;
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    font-family: 'Inter', system-ui, sans-serif;
}
.cx-palette { width: 560px; max-width: 92vw; background: #fff; border-radius: 15px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); overflow: hidden; animation: cx-pop 0.16s ease; }
.cx-palette-search { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid #e7ebf0; }
.cx-palette-search input { flex: 1; border: none; outline: none; font-family: inherit; font-size: 15.5px; color: #0f172a; background: transparent; }
.cx-palette-kbd { font-size: 11px; font-weight: 700; color: #94a3b8; background: #f1f5f9; border-radius: 5px; padding: 2px 6px; }
.cx-palette-list { max-height: 360px; overflow-y: auto; padding: 8px; }
.cx-palette-empty { padding: 26px; text-align: center; color: #94a3b8; font-size: 13.5px; }
.cx-palette-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: none; background: none; border-radius: 9px; cursor: pointer; text-align: left; text-decoration: none; color: #0f172a; }
.cx-palette-item:hover, .cx-palette-item.cx-active { background: #f6f8fb; }
.cx-palette-item-ic { width: 32px; height: 32px; border-radius: 8px; background: #e8f2fa; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; color: #2489c5; }
.cx-palette-item-label { font-size: 14px; font-weight: 500; }

.cx-dash .cx-search-trigger {
    display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; border-radius: 10px;
    border: 1px solid var(--cx-border); background: #fff; cursor: pointer; color: var(--cx-faint); font-family: inherit;
}
.cx-dash .cx-search-trigger .cx-st-label { font-size: 13.5px; }

/* ── topbar controls: bell + view toggle (UNSCOPED — in the topbar) ───── */
.cx-topbar-controls { display: inline-flex; align-items: center; gap: 8px; }

/* ── nav-view toggle (topbar; UNSCOPED — not inside .cx-dash) ─────────── */
.cx-navtoggle {
    display: inline-flex; align-items: center; gap: 2px; padding: 3px;
    background: #eef2f6; border-radius: 10px; margin-right: 4px;
    font-family: 'Inter', system-ui, sans-serif;
}
.cx-navtoggle-opt {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
    border-radius: 8px; font-size: 12.5px; font-weight: 600; color: #64748b;
    text-decoration: none; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.cx-navtoggle-opt:hover { color: #1f79b0; }
.cx-navtoggle-on { background: #fff; color: #1f79b0; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.cx-navtoggle-on svg { color: #2489c5; }
@media (max-width: 640px) { .cx-navtoggle-opt span { display: none; } }
@media (prefers-color-scheme: dark) {
    .cx-navtoggle { background: rgba(255, 255, 255, 0.08); }
    .cx-navtoggle-on { background: rgba(255, 255, 255, 0.16); color: #7cc7ee; }
}

/* ── Рельс: dark-navy main sidebar (design_handoff_dashboard §6; task #21) ──
   Scoped to .fi-main-sidebar so it themes ONLY the main nav rail — never page
   sub-navigation, never the collapsed-group flyout (a separate .fi-dropdown,
   which stays light per the design), and only in sidebar mode (the element
   doesn't exist under top-navigation). !important beats Filament's light/dark
   utilities so the rail is navy in both themes; the content area keeps
   Filament's theme. Idle icon #8fb0cf, active #7cc7ee with a left bar. */
.fi-main-sidebar {
    background: linear-gradient(180deg, #0f2f57, #0a2140) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}
.fi-main-sidebar .fi-sidebar-header,
.fi-main-sidebar .fi-sidebar-footer {
    background: transparent !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #eaf2fb !important;
}
.fi-main-sidebar .fi-sidebar-group-label { color: #6f89a8 !important; }
.fi-main-sidebar .fi-sidebar-item-icon { color: #8fb0cf !important; }
.fi-main-sidebar .fi-sidebar-item-label { color: #cfe0f0 !important; }
.fi-main-sidebar .fi-sidebar-item-btn:hover,
.fi-main-sidebar .fi-sidebar-group-btn:hover,
.fi-main-sidebar .fi-sidebar-group-dropdown-trigger-btn:hover {
    background: rgba(255, 255, 255, 0.06) !important;
}
.fi-main-sidebar .fi-sidebar-item.fi-active .fi-sidebar-item-btn {
    background: rgba(124, 199, 238, 0.14) !important;
    box-shadow: inset 3px 0 0 #7cc7ee !important; /* left indicator bar (design) */
}
.fi-main-sidebar .fi-sidebar-item.fi-active .fi-sidebar-item-icon,
.fi-main-sidebar .fi-sidebar-item.fi-active .fi-sidebar-item-label {
    color: #7cc7ee !important;
}
/* Collapsed-rail group icons — one per §3 group, each opening its flyout.
   (The collapse/expand control itself lives in the TOPBAR in Filament 5,
   outside the navy rail, so it keeps the panel's own styling.) */
.fi-main-sidebar .fi-sidebar-group-dropdown-trigger-btn {
    color: #8fb0cf !important;
}
.fi-main-sidebar .fi-sidebar-group-dropdown-trigger-btn:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #dbe7f4 !important;
}

@keyframes cx-pop { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes cx-toast { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cx-toast, .cx-palette, .cx-bell-panel { animation: none !important; } }
@keyframes cx-fade { from { opacity: 0; } to { opacity: 1; } }
.cx-dash .cx-fade { animation: cx-fade 0.2s ease; }

.cx-dash *:focus-visible, .cx-palette *:focus-visible { outline: 2px solid var(--cx-blue, #2489c5); outline-offset: 2px; }

@media (max-width: 820px) { .cx-dash .cx-cols { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
    .cx-dash .cx-req, .cx-dash .cx-fade, .cx-bell-panel, .cx-palette, .cx-dash .cx-toast { animation: none !important; transition: none !important; }
}
