/*
 * App theme — soft, rounded, violet. Loaded after Filament's own stylesheet
 * (HEAD_END render hook in AppPanelProvider), so these rules win at equal
 * specificity. Plain CSS on purpose: this project has no Node/Vite build,
 * and Filament's compiled CSS only contains the Tailwind classes Filament
 * itself uses — so the custom dashboard widgets use the `app-*` classes
 * defined at the bottom of this file instead of ad-hoc Tailwind classes.
 */

:root {
    --app-bg: #f5f4fb;
    --app-card: #ffffff;
    --app-ink: #1e1b3a;
    --app-muted: #77748f;
    --app-line: #ecebf5;
    --app-radius: 1rem;
    --app-radius-sm: 0.7rem;
    --app-shadow: 0 1px 2px rgba(30, 27, 58, 0.04), 0 10px 30px -18px rgba(30, 27, 58, 0.18);

    /* Pastel tones for stat cards and avatars */
    --app-violet-bg: #f1ecff;
    --app-violet-fg: #7c5cfc;
    --app-sky-bg: #e8f4ff;
    --app-sky-fg: #3b8ff3;
    --app-peach-bg: #fff1e8;
    --app-peach-fg: #f08a3e;
    --app-mint-bg: #e6f8ef;
    --app-mint-fg: #23a26d;
    --app-rose-bg: #ffecef;
    --app-rose-fg: #e5484d;
}

/* ---------- Page ---------- */

.fi-body,
.fi-main-ctn {
    background-color: var(--app-bg);
    color: var(--app-ink);
}

.fi-header-heading {
    font-weight: 800;
    letter-spacing: -0.01em;
}

.fi-header-subheading {
    color: var(--app-muted);
}

/* ---------- Brand ---------- */

.fi-logo {
    color: var(--primary-600);
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--primary-600);
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.app-brand svg {
    width: 1.9rem;
    height: 1.9rem;
    flex-shrink: 0;
}

/* ---------- Sidebar (phones only: the top bar folds into this drawer) ---------- */

.fi-sidebar {
    background-color: var(--app-card);
    border-inline-end: 1px solid var(--app-line);
}

.fi-sidebar-header {
    background-color: var(--app-card);
    box-shadow: none;
    border-bottom: 0;
}

.fi-sidebar-item-btn {
    border-radius: var(--app-radius-sm);
    padding-block: 0.6rem;
    color: var(--app-muted);
    font-weight: 600;
}

.fi-sidebar-item-btn:hover {
    background-color: var(--app-bg);
    color: var(--app-ink);
}

.fi-sidebar-item.fi-active > .fi-sidebar-item-btn {
    background-color: var(--app-violet-bg);
    color: var(--primary-600);
}

.fi-sidebar-item.fi-active .fi-sidebar-item-label,
.fi-sidebar-item.fi-active .fi-sidebar-item-icon {
    color: var(--primary-600);
}

.fi-sidebar-group-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem;
    color: #a3a1b8;
}

/* ---------- Topbar ---------- */

.fi-topbar,
.fi-topbar > nav {
    background-color: var(--app-card);
    box-shadow: none;
    border-bottom: 1px solid var(--app-line);
}

.fi-topbar {
    min-height: 4rem;
    gap: 0.5rem;
}

.fi-topbar-start {
    margin-inline-end: 1.25rem;
}

/* The navigation links: text-only pills, the active area tinted violet. */
.fi-topbar-nav-groups {
    gap: 0.25rem;
}

.fi-topbar-item-btn {
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    color: var(--app-muted);
    font-weight: 700;
    font-size: 0.875rem;
    white-space: nowrap;
}

.fi-topbar-item-btn:hover {
    background-color: var(--app-bg);
    color: var(--app-ink);
}

.fi-topbar-item-icon {
    display: none;
}

.fi-topbar-item .fi-topbar-item-label,
.fi-topbar-item .fi-topbar-group-toggle-icon {
    color: inherit;
}

.fi-topbar-item.fi-active > .fi-topbar-item-btn {
    background-color: var(--app-violet-bg);
    color: var(--primary-600);
}

/* Dropdown menus opened from the top bar. */
.fi-dropdown-panel {
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow);
    --tw-ring-color: var(--app-line);
}

.fi-dropdown-list-item {
    border-radius: 0.5rem;
    font-weight: 600;
}

.fi-global-search-field .fi-input-wrp,
.fi-topbar .fi-input-wrp {
    border-radius: 999px;
    background-color: var(--app-bg);
    box-shadow: none;
}

.app-user-chip {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: end;
    margin-inline-end: 0.5rem;
}

.app-user-chip-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--app-ink);
}

.app-user-chip-role {
    font-size: 0.72rem;
    color: var(--app-muted);
}

@media (max-width: 640px) {
    .app-user-chip {
        display: none;
    }
}

/* ---------- Cards, sections, tables, widgets ---------- */

.fi-section,
.fi-ta-ctn,
.fi-wi-chart .fi-section,
.fi-fo-repeater-item {
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
    border: 0;
    --tw-ring-color: transparent;
}

.fi-section-header-heading,
.fi-ta-header-heading {
    font-weight: 800;
    color: var(--app-ink);
}

.fi-ta-header-cell {
    background-color: #faf9fe;
    color: var(--app-muted);
    font-weight: 700;
}

.fi-ta-row:hover > td {
    background-color: #fbfaff;
}

.fi-badge {
    border-radius: 999px;
}

/* ---------- Buttons & inputs ---------- */

.fi-btn {
    border-radius: var(--app-radius-sm);
    font-weight: 700;
}

.fi-btn.fi-color-primary:not(.fi-outlined) {
    --text: #fff;
    --hover-text: #fff;
    color: #fff;
    background-image: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    box-shadow: 0 8px 18px -10px var(--primary-600);
}

.fi-btn.fi-color-primary:not(.fi-outlined) .fi-icon,
.fi-btn.fi-color-primary:not(.fi-outlined) svg {
    color: #fff;
}

.fi-btn.fi-color-primary:not(.fi-outlined):hover {
    filter: brightness(1.06);
}

.fi-input-wrp {
    border-radius: var(--app-radius-sm);
}

/* ---------- Dashboard: stat cards ---------- */

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

@media (min-width: 640px) {
    .app-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .app-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.app-stat {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    border-radius: var(--app-radius);
    background-color: var(--app-tone-bg, var(--app-violet-bg));
    color: var(--app-ink);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.app-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-shadow);
}

.app-stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--app-muted);
}

.app-stat-value {
    margin-top: 0.35rem;
    font-size: clamp(1.25rem, 1.6vw, 1.6rem);
    white-space: nowrap;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.15;
}

.app-stat-note {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--app-tone-fg, var(--app-muted));
}

.app-stat-icon {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    flex-shrink: 0;
    border-radius: 0.9rem;
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--app-tone-fg);
}

.app-stat-icon svg {
    width: 1.6rem;
    height: 1.6rem;
}

.app-tone-violet { --app-tone-bg: var(--app-violet-bg); --app-tone-fg: var(--app-violet-fg); }
.app-tone-sky    { --app-tone-bg: var(--app-sky-bg);    --app-tone-fg: var(--app-sky-fg); }
.app-tone-peach  { --app-tone-bg: var(--app-peach-bg);  --app-tone-fg: var(--app-peach-fg); }
.app-tone-mint   { --app-tone-bg: var(--app-mint-bg);   --app-tone-fg: var(--app-mint-fg); }
.app-tone-rose   { --app-tone-bg: var(--app-rose-bg);   --app-tone-fg: var(--app-rose-fg); }

/* ---------- Avatars & lists ---------- */

.app-avatar {
    display: inline-grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    background-color: var(--app-tone-bg);
    color: var(--app-tone-fg);
}

.app-person {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.app-person-name {
    font-weight: 700;
    color: var(--app-ink);
}

.app-person-sub {
    font-size: 0.75rem;
    color: var(--app-muted);
}

.app-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.25rem;
    border-bottom: 1px solid var(--app-line);
    text-decoration: none;
    color: inherit;
    border-radius: var(--app-radius-sm);
}

.app-list-item:last-child {
    border-bottom: 0;
}

a.app-list-item:hover {
    background-color: #fbfaff;
}

.app-list-amount {
    font-weight: 800;
    color: var(--app-mint-fg);
    white-space: nowrap;
}

.app-list-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.72rem;
    color: var(--app-muted);
    margin-top: 0.1rem;
}

/* Admissions & withdrawals: two lists side by side, stacked on phones. */
.app-movements {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1.5rem 2.5rem;
}

.app-movements-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.app-movements-title {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--app-ink);
}

.app-pill {
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    background-color: var(--app-tone-bg);
    color: var(--app-tone-fg);
}

.app-list-date {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--app-muted);
    white-space: nowrap;
}

.app-card-link {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-600);
    text-decoration: none;
}

.app-empty {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--app-muted);
    font-size: 0.85rem;
}

/* ---------- Report tables (VAT return, aged receivables) ---------- */

.app-table-scroll {
    overflow-x: auto;
}

.app-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.app-table th {
    text-align: start;
    font-weight: 700;
    color: var(--app-muted);
    background-color: #faf9fe;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--app-line);
    white-space: nowrap;
}

.app-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--app-line);
    vertical-align: top;
}

.app-table .num {
    text-align: end;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.app-total-row td {
    font-weight: 800;
    border-top: 2px solid var(--app-line);
}

.app-muted-row td,
.app-muted {
    color: var(--app-muted);
    font-size: 0.8rem;
}

.app-danger {
    color: var(--app-rose-fg);
    font-weight: 700;
}

.app-warning {
    margin-top: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: var(--app-radius-sm);
    background-color: var(--app-peach-bg);
    color: #9a4a12;
    font-size: 0.85rem;
}

.app-filter-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.app-filter-row label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ---------- Dashboard: equal-height chart row ----------
 * The collections chart and the rings card share a grid row. Stretch both
 * cards to the row's height so the shorter one doesn't leave a ragged gap
 * above "Needs follow-up"; the chart is vertically centred in any spare
 * room. */

.fi-wi-widget.fi-wi-chart,
.fi-wi-widget.app-rings-widget {
    align-self: stretch;
}

.fi-wi-chart > .fi-section,
.app-rings-widget > .fi-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.fi-wi-chart > .fi-section > .fi-section-content-ctn,
.app-rings-widget > .fi-section > .fi-section-content-ctn {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ---------- Students-by-course rings ---------- */

.app-rings {
    position: relative;
    width: 100%;
    max-width: 15rem;
    margin: 0.25rem auto 1rem;
    aspect-ratio: 1;
}

.app-rings svg {
    width: 100%;
    height: 100%;
}

.app-ring-value {
    transition: stroke-width 0.15s ease;
}

.app-rings g:hover .app-ring-value {
    stroke-width: 12;
}

.app-rings-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.app-rings-total {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--app-ink);
}

.app-rings-caption {
    margin-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-muted);
}

.app-rings-legend {
    display: grid;
    gap: 0.15rem;
}

.app-rings-legend li {
    display: grid;
    grid-template-columns: auto 1fr auto 3rem;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.25rem;
    font-size: 0.85rem;
    border-top: 1px solid var(--app-line);
}

.app-rings-legend li:first-child {
    border-top: 0;
}

.app-rings-dot {
    width: 0.65rem;
    height: 0.65rem;
    border-radius: 999px;
}

.app-rings-name {
    font-weight: 700;
    color: var(--app-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-rings-count {
    color: var(--app-muted);
    white-space: nowrap;
}

.app-rings-share {
    font-weight: 800;
    text-align: end;
    color: var(--app-ink);
}

.app-date {
    border: 1px solid var(--app-line);
    border-radius: var(--app-radius-sm);
    padding: 0.4rem 0.6rem;
    background-color: #fff;
}
