/*
 * FLOWTORK dashboard style kit.
 * Shared, reusable look for the redesigned dashboards (and later sections).
 * Tokens are mapped to the app's brand: Inter, Blue primary (#2563eb = Filament
 * Blue), Slate neutrals. Loaded on every panel page via a render hook.
 */
:root {
    --ft-accent: #2563eb;
    --ft-page: #eef2f7;
    --ft-card: #ffffff;
    --ft-card-border: #e8edf3;
    --ft-card-radius: 14px;
    --ft-card-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    --ft-text: #0f172a;
    --ft-body: #334155;
    --ft-muted: #64748b;
    --ft-faint: #94a3b8;
    --ft-row-border: #f5f7fa;
    --ft-head-bg: #f8fafc;
}

/* Dashboard pages get the design's soft page background (scoped via :has so
   resource pages keep their default white). */
.fi-main:has(.ft-kpis) { background: var(--ft-page); }

/* ---- Section header ---- */
.ft-section {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 800;
    color: var(--ft-text);
    margin: 0 0 20px;
}
.ft-section--top { margin-top: 44px; }
.ft-section__tab {
    width: 4px;
    height: 18px;
    border-radius: 9999px;
    background: #475569;
    margin-right: 11px;
    display: inline-block;
    flex: none;
}
.ft-section__sub {
    font-size: 13px;
    font-weight: 500;
    color: var(--ft-faint);
    margin-left: 10px;
}
.ft-sublabel {
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    margin: 0 0 14px;
}

/* ---- Card shell ---- */
.ft-card {
    background: var(--ft-card);
    border: 1px solid var(--ft-card-border);
    border-radius: var(--ft-card-radius);
    box-shadow: var(--ft-card-shadow);
}

/* ---- KPI grid + stat card ---- */
.ft-kpis { display: grid; gap: 16px; }
.ft-kpis--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ft-kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ft-kpis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ft-kpis--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .ft-kpis--4, .ft-kpis--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .ft-kpis { grid-template-columns: minmax(0, 1fr) !important; } }

.ft-stat {
    background: var(--ft-card);
    border: 1px solid var(--ft-card-border);
    border-radius: var(--ft-card-radius);
    box-shadow: var(--ft-card-shadow);
    padding: 17px 18px;
    display: block;
    text-decoration: none;
    transition: box-shadow .15s, border-color .15s;
}
a.ft-stat:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .07); border-color: #cbd5e1; }
.ft-stat--warning { background: #fffbeb; border-color: #fde68a; }
.ft-stat__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ft-stat__chip {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--ft-accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.ft-stat__chip svg { width: 18px; height: 18px; }
.ft-stat__dot { width: 9px; height: 9px; border-radius: 3px; flex: none; display: inline-block; }
.ft-stat__trend { font-size: 12px; font-weight: 600; }
.ft-stat__trend--up { color: #16a34a; }
.ft-stat__trend--down { color: var(--ft-faint); }
.ft-stat__trend--bad { color: #dc2626; }
.ft-stat__label {
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ft-faint); margin-top: 14px; line-height: 1.3;
}
.ft-stat__label--inline { margin-top: 0; }
.ft-stat__value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin-top: 4px; color: var(--ft-text); }
.ft-stat__value--sm { font-size: 21px; }
.ft-stat__value--lg { font-size: 26px; }
.ft-stat__caption { font-size: 12px; color: var(--ft-faint); margin-top: 6px; }
.ft-stat__caption--bad { color: #dc2626; }

/* dot-style KPI (billing): dot + label on top, value below */
.ft-stat__head { display: flex; align-items: center; gap: 8px; }

/* service-style KPI: icon + big value on top, label below */
.ft-stat__bigvalue { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }

/* ---- Stage card (top-bordered) ---- */
.ft-stages { display: grid; gap: 16px; }
.ft-stages--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ft-stages--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .ft-stages--3, .ft-stages--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .ft-stages { grid-template-columns: minmax(0, 1fr) !important; } }
.ft-stage {
    background: var(--ft-card); border: 1px solid var(--ft-card-border);
    border-top: 3px solid var(--ft-accent); border-radius: 12px;
    box-shadow: var(--ft-card-shadow); padding: 16px 17px;
    display: flex; gap: 12px; align-items: flex-start; text-decoration: none;
}
.ft-stage__label { font-size: 12.5px; font-weight: 600; color: #475569; line-height: 1.25; }
.ft-stage__count { font-size: 28px; font-weight: 800; margin-top: 8px; letter-spacing: -.02em; color: var(--ft-text); }
.ft-stage__caption { font-size: 11.5px; color: var(--ft-faint); margin-top: 2px; }

/* ---- Pills ---- */
.ft-pill { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; border-radius: 9999px; padding: 2px 9px; }
.ft-pill--green { background: #f0fdf4; color: #15803d; }
.ft-pill--blue { background: #eff6ff; color: #1d4ed8; }
.ft-pill--amber { background: #fffbeb; color: #b45309; }
.ft-pill--red { background: #fef2f2; color: #dc2626; }
.ft-pill--slate { background: #f1f5f9; color: #475569; }

/* ---- Avatars + rank chips ---- */
.ft-avatar {
    width: 28px; height: 28px; border-radius: 50%; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 11px; font-weight: 600; object-fit: cover;
}
.ft-rank {
    width: 24px; height: 24px; border-radius: 7px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    background: #f1f5f9; color: var(--ft-faint); font-size: 12px; font-weight: 700;
}
.ft-rank--1 { background: #fef3c7; color: #b45309; }

/* ---- Lightweight table (kit) ---- */
.ft-tbl { width: 100%; }
.ft-tbl__bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap;
}
.ft-tbl__title { font-size: 15px; font-weight: 700; color: var(--ft-text); }
.ft-tbl__title-sub { font-size: 12px; color: var(--ft-faint); margin-top: 2px; }
.ft-tbl__scroll { overflow-x: auto; }
.ft-tbl__head, .ft-tbl__row, .ft-tbl__total {
    display: grid; gap: 14px; padding: 12px 20px; align-items: center;
}
.ft-tbl__head {
    background: var(--ft-head-bg); border-bottom: 1px solid #f1f5f9;
    font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ft-faint);
}
.ft-tbl__row { border-bottom: 1px solid var(--ft-row-border); }
.ft-tbl__row:hover { background: #fafbfc; }
.ft-tbl__total { background: #fafbfc; font-weight: 700; }
.ft-tbl__num { text-align: right; font-size: 13.5px; font-weight: 600; color: var(--ft-body); }
.ft-tbl__num--green { color: #16a34a; }
.ft-tbl__num--blue { color: #2563eb; }
.ft-tbl__num--red { color: #dc2626; }
.ft-tbl__num--muted { color: var(--ft-muted); font-weight: 500; }
.ft-tbl__name { font-size: 14px; font-weight: 600; color: var(--ft-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft-tbl__person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ft-tbl__empty { padding: 2.5rem; text-align: center; color: var(--ft-faint); font-size: 13px; }
