/* Thatrank Pulse: design tokens and shell components (docs/11-design-system.md).
   Filament reads the gray and primary scales below, so its own components follow the tokens. */

:root {
    --gray-50: #F5F6F8;
    --gray-100: #EEF0F3;
    --gray-200: #E6E8EC;
    --gray-300: #D7DAE0;
    --gray-400: #9AA0AA;
    --gray-500: #6A707B;
    --gray-600: #464B55;
    --gray-700: #33373E;
    --gray-800: #24272C;
    --gray-900: #17191D;
    --gray-950: #111214;

    --primary-50: #E8F6F3;
    --primary-100: #C9EDE5;
    --primary-200: #98DCCD;
    --primary-300: #5FC7B1;
    --primary-400: #2FB59C;
    --primary-500: #1E9F87;
    --primary-600: #0F8C76;
    --primary-700: #0C7060;
    --primary-800: #0B594D;
    --primary-900: #0A4940;
    --primary-950: #052A25;

    --p-page: #F5F6F8;
    --p-surface: #FFFFFF;
    --p-surface-2: #F8F9FA;
    --p-raised: #EEF0F3;
    --p-line: #E6E8EC;
    --p-line-2: #D7DAE0;
    --p-ink: #111318;
    --p-ink-2: #464B55;
    --p-muted: #6A707B;
    --p-accent: #0F8C76;
    --p-accent-ink: #FFFFFF;
    --p-accent-soft: rgba(15, 140, 118, .10);
    --p-good: #1A7F45;
    --p-warn: #9A6400;
    --p-crit: #C23A3A;
    --p-radius: 14px;
    --p-radius-ctl: 8px;
}

.dark {
    --p-page: #111214;
    --p-surface: #17191D;
    --p-surface-2: #1C1F23;
    --p-raised: #24272C;
    --p-line: rgba(255, 255, 255, .07);
    --p-line-2: rgba(255, 255, 255, .12);
    --p-ink: #EDEEF0;
    --p-ink-2: #B3B7BE;
    --p-muted: #7F858F;
    --p-accent: #2FB59C;
    --p-accent-ink: #06231D;
    --p-accent-soft: rgba(47, 181, 156, .12);
    --p-good: #3DBE74;
    --p-warn: #E8A93A;
    --p-crit: #E06262;
}

/* Filament surfaces */
.fi-body { background: var(--p-page); font-feature-settings: "tnum" 1, "cv11" 1; }
.fi-header-heading { font-size: 28px; font-weight: 620; letter-spacing: -0.025em; }
.fi-section, .fi-ta-ctn, .fi-wi-stats-overview-stat { border-radius: var(--p-radius); box-shadow: 0 1px 2px rgba(16, 18, 22, .04); }
.fi-sidebar { border-inline-end: 1px solid var(--p-line); }
.fi-sidebar-group-label { font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--p-muted); }
.fi-sidebar-item-btn { border-radius: var(--p-radius-ctl); }
.fi-topbar nav, .fi-topbar > nav { box-shadow: none; border-bottom: 1px solid var(--p-line); }

/* Generic helpers */
.pulse-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pulse-muted { color: var(--p-muted); font-size: 13px; }
.pulse-lede { color: var(--p-ink-2); font-size: 14px; max-width: 70ch; margin: 0; }
.pulse-error { color: var(--p-crit); font-size: 13px; margin: 0; }
.pulse-stack { display: grid; gap: 16px; }
.pulse-form-actions { display: flex; gap: 8px; }
.pulse-ic { width: 16px; height: 16px; flex: none; }
[x-cloak] { display: none !important; }

/* Client switcher (sidebar) */
.pulse-switcher { position: relative; margin: 4px 0 12px; }
.pulse-switcher-btn {
    width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    background: var(--p-surface); border: 1px solid var(--p-line); border-radius: 10px;
    color: var(--p-ink); text-align: left; cursor: pointer;
}
.pulse-switcher-btn:hover { border-color: var(--p-line-2); }
.pulse-switcher-btn:focus-visible, .pulse-switcher-item:focus-visible, .pulse-select:focus-visible, .pulse-btn:focus-visible {
    outline: 2px solid var(--p-accent); outline-offset: 2px;
}
.pulse-switcher-text { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.pulse-switcher-label { font-size: 11px; color: var(--p-muted); }
.pulse-switcher-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-switcher-chev { width: 16px; height: 16px; color: var(--p-muted); }
.pulse-switcher-menu {
    position: absolute; z-index: 40; inset-inline: 0; top: calc(100% + 6px);
    background: var(--p-surface); border: 1px solid var(--p-line-2); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(16, 18, 22, .16); padding: 6px;
}
.pulse-switcher-search {
    width: 100%; padding: 7px 10px; margin-bottom: 4px; font-size: 13px;
    background: var(--p-surface-2); color: var(--p-ink); border: 1px solid var(--p-line); border-radius: var(--p-radius-ctl);
}
.pulse-switcher-items { max-height: 320px; overflow-y: auto; display: grid; gap: 2px; }
.pulse-switcher-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--p-radius-ctl);
    font-size: 13px; color: var(--p-ink); text-decoration: none;
}
.pulse-switcher-item:hover { background: var(--p-raised); }
.pulse-switcher-item.is-active { background: var(--p-accent-soft); font-weight: 600; }
.pulse-avatar {
    width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px;
    background: var(--p-raised); color: var(--p-ink-2); font-size: 11px; font-weight: 600;
}
.pulse-avatar.is-sm { width: 22px; height: 22px; border-radius: 6px; font-size: 10px; }

/* Top bar date range */
.pulse-range { display: flex; align-items: center; gap: 6px; margin-inline-end: 8px; }
.pulse-select {
    appearance: none; padding: 6px 28px 6px 10px; font-size: 13px; font-weight: 500;
    color: var(--p-ink); background-color: var(--p-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236A707B'%3E%3Cpath d='M5.2 7.2a.75.75 0 0 1 1.06 0L10 10.94l3.74-3.74a.75.75 0 1 1 1.06 1.06l-4.27 4.27a.75.75 0 0 1-1.06 0L5.2 8.26a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 14px;
    border: 1px solid var(--p-line); border-radius: var(--p-radius-ctl); cursor: pointer;
}
.pulse-select.is-quiet { color: var(--p-ink-2); }
@media (max-width: 600px) { .pulse-select.is-quiet { display: none; } }

/* Preview banner */
.pulse-preview-banner {
    display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px 16px;
    background: var(--p-accent); color: var(--p-accent-ink); font-size: 13px; font-weight: 500;
}
.pulse-preview-exit { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* Module pages */
.pulse-module { display: grid; gap: 16px; }
.pulse-range-note { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--p-muted); font-size: 13px; }
.pulse-panel { background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius); box-shadow: 0 1px 2px rgba(16, 18, 22, .04); }
.pulse-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--p-line); }
.pulse-panel-title { margin: 0; font-size: 15px; font-weight: 600; }
.pulse-grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 1180px) { .pulse-grid-2-1 { grid-template-columns: 1fr; } }

.pulse-kpis {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius); overflow: hidden;
}
.pulse-kpi { display: grid; gap: 4px; padding: 16px 18px; border-inline-start: 1px solid var(--p-line); }
.pulse-kpi:first-child { border-inline-start: 0; }
.pulse-kpi-label { font-size: 13px; color: var(--p-ink-2); }
.pulse-kpi-value { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.pulse-kpi-value.is-empty { font-size: 15px; font-weight: 500; color: var(--p-muted); padding-block: 9px; }
.pulse-kpi-sub { font-size: 12px; color: var(--p-muted); }
@media (max-width: 1280px) { .pulse-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .pulse-kpi:nth-child(4) { border-inline-start: 0; } .pulse-kpi:nth-child(n+4) { border-top: 1px solid var(--p-line); } }
@media (max-width: 600px) { .pulse-kpis { grid-template-columns: 1fr 1fr; } .pulse-kpi { border-inline-start: 0; border-top: 1px solid var(--p-line); } .pulse-kpi:first-child { border-top: 0; } }

.pulse-empty { display: grid; justify-items: center; gap: 10px; padding: 36px 20px; text-align: center; color: var(--p-ink-2); font-size: 14px; }
.pulse-empty.is-large { padding: 72px 20px; }
.pulse-empty p { margin: 0; max-width: 46ch; }
.pulse-empty-ic { width: 28px; height: 28px; color: var(--p-muted); }

.pulse-facts { margin: 0; padding: 6px 18px 14px; display: grid; }
.pulse-facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--p-line); font-size: 13px; }
.pulse-facts > div:last-child { border-bottom: 0; }
.pulse-facts dt { color: var(--p-muted); }
.pulse-facts dd { margin: 0; color: var(--p-ink); text-align: right; overflow-wrap: anywhere; }

.pulse-list { list-style: none; margin: 0; padding: 4px 18px 10px; }
.pulse-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--p-line); font-size: 14px; }
.pulse-list li:last-child { border-bottom: 0; }

/* Provider cards */
.pulse-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.pulse-card { display: grid; gap: 14px; align-content: start; padding: 18px; background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius); }
.pulse-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.pulse-card-title { margin: 0; font-size: 15px; font-weight: 600; }
.pulse-card-sub { margin: 4px 0 0; font-size: 13px; color: var(--p-ink-2); }
.pulse-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--p-line); }
.pulse-card-actions { display: inline-flex; gap: 8px; }
.pulse-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.pulse-chip { padding: 3px 9px; font-size: 12px; color: var(--p-ink-2); background: var(--p-surface-2); border: 1px solid var(--p-line); border-radius: 999px; }
.pulse-pill { flex: none; padding: 3px 10px; font-size: 12px; font-weight: 500; color: var(--p-ink-2); background: var(--p-raised); border-radius: 999px; }
.pulse-pill.is-good { color: var(--p-good); background: color-mix(in srgb, var(--p-good) 12%, transparent); }
.pulse-pill.is-crit { color: var(--p-crit); background: color-mix(in srgb, var(--p-crit) 12%, transparent); }

/* Plain pages (invitations) */
.pulse-plain { margin: 0; min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--p-page); color: var(--p-ink); font-family: Geist, system-ui, sans-serif; }
.pulse-plain-card { width: 100%; max-width: 420px; padding: 32px; background: var(--p-surface); border: 1px solid var(--p-line); border-radius: var(--p-radius); }
.pulse-plain-brand { margin: 0 0 20px; font-size: 13px; font-weight: 600; color: var(--p-accent); }
.pulse-plain-title { margin: 0 0 8px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.pulse-plain-form { display: grid; gap: 14px; margin-top: 20px; }
.pulse-plain-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 500; }
.pulse-plain-form input { padding: 9px 11px; font: inherit; font-size: 14px; color: var(--p-ink); background: var(--p-surface); border: 1px solid var(--p-line-2); border-radius: var(--p-radius-ctl); }
.pulse-plain-form input:focus-visible { outline: 2px solid var(--p-accent); outline-offset: 1px; }
.pulse-btn { padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 500; color: var(--p-accent-ink); background: var(--p-accent); border: 0; border-radius: var(--p-radius-ctl); cursor: pointer; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; } }
