/* ============================================================
 * SchoolHub dashboards
 *   Per-user-group dashboards (App\Support\DashboardProfile).
 *   One palette of tones is used by every card, bar and icon, so each
 *   dashboard is colourful but reads as one designed system.
 *   Loaded on the app panel after filament-custom.css.
 * ============================================================ */

.shd-tone-blue    { --t: #1a5fa8; --t-soft: #e3edf9; --t-line: #bcd3ee; --t-deep: #12294a; }  /* brand blue (--sh-blue-600) */
.shd-tone-emerald { --t: #0f7a68; --t-soft: #e3f3ef; --t-line: #b3ddd3; --t-deep: #0a4f44; }  /* --sh-rail-4 */
.shd-tone-amber   { --t: #b5721a; --t-soft: #fbf1e3; --t-line: #efd3a8; --t-deep: #7a4b0f; }  /* --sh-rail-2 */
.shd-tone-violet  { --t: #6b4f9e; --t-soft: #efeaf7; --t-line: #d3c7e8; --t-deep: #45306b; }  /* --sh-rail-3 */
.shd-tone-rose    { --t: #b4304b; --t-soft: #f9e6ea; --t-line: #eab8c3; --t-deep: #7a1d31; }
.shd-tone-teal    { --t: #1d7f95; --t-soft: #e2f1f5; --t-line: #b2d8e2; --t-deep: #135566; }
.shd-tone-sky     { --t: #2472c4; --t-soft: #e6f0fa; --t-line: #c0d8f1; --t-deep: #1b3a63; }  /* --sh-blue-500 */
.shd-tone-indigo  { --t: #1b3a63; --t-soft: #e6ebf2; --t-line: #c3cfdf; --t-deep: #0d1f38; }  /* --sh-navy-700 */
.shd-tone-slate   { --t: #94a3b8; --t-soft: #f8fafc; --t-line: #e2e8f0; --t-deep: #475569; }

/* The greeting in the banner replaces the page title. */
.fi-page:has(.shd-banner) .fi-header { display: none; }

/* ── Welcome banner ── */

.shd-banner {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.75rem 2rem;
    border-radius: 18px;
    color: #fff;
    /* Built from the sidebar's own navy (--sh-navy-*) and brand blue, so the two read as one. */
    background:
        radial-gradient(55% 120% at 100% 0%, rgba(36, 114, 196, 0.55), transparent 65%),
        radial-gradient(35% 80% at 88% 110%, rgba(217, 125, 13, 0.22), transparent 70%),
        linear-gradient(120deg, #0d1f38 0%, #12294a 45%, #1b3a63 100%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 18px 40px -24px rgba(13, 31, 56, 0.7);
}

.shd-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 100%);
    pointer-events: none;
}

.shd-banner > * { position: relative; z-index: 1; }

.shd-banner-main { min-width: 0; display: flex; flex-direction: column; justify-content: center; }

.shd-banner-chip {
    align-self: flex-start;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    background: rgba(36, 114, 196, 0.22);
    border: 1px solid rgba(36, 114, 196, 0.4);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #cfdcef;
}

.shd-banner-title {
    margin-top: 0.7rem;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #fff;
}

.shd-banner-meta { margin-top: 0.3rem; font-size: 0.9rem; color: #a9b6cc; }

.shd-banner-actions { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }

.shd-banner-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.35rem;
    padding: 0 0.95rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.shd-banner-btn:hover { background: rgba(255, 255, 255, 0.13); transform: translateY(-1px); }
.shd-banner-btn.is-primary { background: #1a5fa8; color: #fff; border-color: #2472c4; box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.5); }
.shd-banner-btn.is-primary:hover { background: #2472c4; }
.shd-banner-btn-icon { width: 1.05rem; height: 1.05rem; }

.shd-term {
    flex: none;
    align-self: center;
    width: 17.5rem;
    padding: 1rem 1.15rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(6px);
}

.shd-term-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #6b7d99; }
.shd-term-name { margin-top: 0.25rem; font-size: 0.98rem; font-weight: 700; color: #fff; }
.shd-term-bar { margin-top: 0.8rem; height: 0.45rem; border-radius: 999px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.shd-term-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #b5721a, #d97d0d); }
.shd-term-foot { margin-top: 0.5rem; display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.76rem; color: #a9b6cc; }

/* ── KPI cards ── */

.shd-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }

.shd-kpi {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.2rem 1.15rem;
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--sh-border, #e4e8f0);
    box-shadow: 0 1px 2px rgba(13, 31, 56, 0.04);
    color: var(--sh-text, #16233a);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

/* A soft wash of the card colour in the corner, and a coloured top edge. */
.shd-kpi::before {
    content: "";
    position: absolute;
    top: -3rem;
    right: -3rem;
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    background: radial-gradient(circle, var(--t-soft) 0%, transparent 70%);
    pointer-events: none;
}

.shd-kpi::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--t), var(--t-line));
}

a.shd-kpi:hover { transform: translateY(-2px); border-color: var(--t-line); box-shadow: 0 14px 30px -18px rgba(13, 31, 56, 0.35); }
a.shd-kpi:hover .shd-kpi-go { opacity: 1; color: var(--t); }

.shd-kpi-head { position: relative; display: flex; align-items: center; gap: 0.6rem; }

.shd-kpi-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: var(--t-soft);
    color: var(--t);
    box-shadow: inset 0 0 0 1px var(--t-line);
}

.shd-kpi-icon svg { width: 1.2rem; height: 1.2rem; }
.shd-kpi-label { font-size: 0.8rem; font-weight: 600; color: var(--sh-text-muted, #64748b); line-height: 1.3; }
.shd-kpi-go { margin-left: auto; width: 1rem; height: 1rem; color: #cbd5e1; opacity: 0.7; transition: opacity 0.15s ease, color 0.15s ease; }

.shd-kpi-value {
    position: relative;
    margin-top: 0.85rem;
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #16233a;
    font-variant-numeric: tabular-nums;
}

.shd-kpi-bar { position: relative; margin-top: 0.7rem; height: 0.4rem; border-radius: 999px; background: var(--t-soft); box-shadow: inset 0 0 0 1px var(--t-line); overflow: hidden; }
.shd-kpi-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--t-deep), var(--t)); }

.shd-kpi-sub { position: relative; margin-top: 0.55rem; display: flex; align-items: center; gap: 0.3rem; font-size: 0.79rem; color: var(--sh-text-muted, #64748b); line-height: 1.4; }
.shd-kpi-trend { flex: none; width: 0.9rem; height: 0.9rem; color: #0f7a68; }

/* ── Panels (lists inside a card) ── */

.shd-panel { border-radius: 16px; background: #fff; border: 1px solid var(--sh-border, #e4e8f0); box-shadow: 0 1px 2px rgba(13, 31, 56, 0.04); overflow: hidden; }
.shd-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--sh-border, #e4e8f0); }
.shd-panel-title { font-size: 1rem; font-weight: 700; color: #0f172a; }
.shd-panel-sub { margin-top: 0.1rem; font-size: 0.8rem; color: var(--sh-text-muted, #64748b); }

.shd-sheet { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 1.25rem; padding: 0.85rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.shd-sheet:last-child { border-bottom: 0; }
.shd-sheet:hover { background: #fafbfd; }
.shd-sheet-name strong { display: block; font-size: 0.9rem; font-weight: 600; color: #0f172a; }
.shd-sheet-name span { font-size: 0.78rem; color: var(--sh-text-muted, #64748b); }
.shd-sheet-progress { display: flex; align-items: center; gap: 0.75rem; }
.shd-sheet-progress .shd-kpi-bar { flex: 1; margin-top: 0; }
.shd-sheet-count { flex: none; min-width: 4rem; text-align: right; font-size: 0.8rem; font-weight: 600; color: var(--t-deep); font-variant-numeric: tabular-nums; }

.shd-empty { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; padding: 2.5rem 1.5rem; text-align: center; font-size: 0.85rem; color: var(--sh-text-muted, #64748b); }
.shd-empty strong { color: #0f172a; font-size: 0.95rem; }
.shd-empty-icon { width: 2rem; height: 2rem; color: #94a3b8; margin-bottom: 0.25rem; }

/* Chart and table widgets on a dashboard: same card shape as the KPI cards. */
.fi-page:has(.shd-banner) .fi-wi-chart .fi-section,
.fi-page:has(.shd-banner) .fi-wi-table .fi-ta-ctn,
.fi-page:has(.shd-banner) .fi-wi-stats-overview-stat { border-radius: 16px !important; }

/* Chart cards: an icon badge + tidy header, so a chart reads as part of
   the same card system as the KPIs and panels around it, not a plain
   default Filament section. */
.fi-page:has(.shd-banner) .fi-wi-chart .fi-section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.15rem 1.25rem;
}

.fi-page:has(.shd-banner) .fi-wi-chart .fi-section-header > svg.fi-icon {
    flex: none;
    box-sizing: border-box;
    width: 2.35rem !important;
    height: 2.35rem !important;
    padding: 0.55rem;
    border-radius: 10px;
    background: color-mix(in srgb, currentColor 14%, white);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 28%, white);
}

.fi-page:has(.shd-banner) .fi-wi-chart .fi-section-header-heading {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.fi-page:has(.shd-banner) .fi-wi-chart .fi-section-header-description {
    font-size: 0.8rem;
    color: var(--sh-text-muted, #64748b);
}

.fi-page:has(.shd-banner) .fi-wi-chart .fi-section-content-ctn { padding: 0.25rem 1.25rem 1.25rem; }

@media (max-width: 1280px) {
    .shd-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .shd-banner { flex-direction: column; padding: 1.4rem; gap: 1.25rem; }
    .shd-term { width: auto; align-self: stretch; }
    .shd-sheet { grid-template-columns: 1fr; gap: 0.6rem; }
}

@media (max-width: 560px) {
    .shd-kpis { grid-template-columns: 1fr; }
    .shd-banner-title { font-size: 1.35rem; }
    .shd-banner-btn { flex: 1 1 auto; justify-content: center; }
}
