/* =====================================================================
   CampusHub - Private Schools Directory & Admissions
   Theme-aware (reacts to html[data-bs-theme] set by the global app menu)
   ===================================================================== */

:root {
    --brand: #6d28d9;
    --brand-2: #8b5cf6;
    --brand-3: #a78bfa;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;

    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-md: 14px;

    --bg: #f6f5fb;
    --surface: #ffffff;
    --surface-2: #f1eefb;
    --border: #e7e3f5;
    --text: #211a3a;
    --text-muted: #6b6590;
    --shadow: 0 18px 45px -22px rgba(88, 60, 160, 0.35);
    --shadow-sm: 0 8px 22px -14px rgba(88, 60, 160, 0.28);
}

html[data-bs-theme="dark"] {
    --bg: #151022;
    --surface: #1e1834;
    --surface-2: #272040;
    --border: #332a52;
    --text: #f1eefc;
    --text-muted: #a49dc9;
    --shadow: 0 18px 45px -22px rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 8px 22px -14px rgba(0, 0, 0, 0.55);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--text-muted);
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.shell {
    flex: 1;
}

.panel {
    padding: 22px max(16px, calc((100vw - 1200px) / 2));
}

/* ------------------------------------------------------------------ */
/* Topbar                                                             */
/* ------------------------------------------------------------------ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1232px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
}

.viewswitch {
    display: flex;
    gap: 6px;
    padding: 5px;
    border-radius: 999px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.viewswitch button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.86rem;
    display: flex;
    gap: 7px;
    align-items: center;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.viewswitch button.is-active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 620px) {
    .topbar-inner {
        flex-direction: column;
    }

    .viewswitch {
        width: 100%;
    }

    .viewswitch button {
        flex: 1;
        justify-content: center;
    }
}

/* ------------------------------------------------------------------ */
/* Hero                                                               */
/* ------------------------------------------------------------------ */
.hero {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    padding: 42px 44px;
    margin-bottom: 26px;
    color: #fff;
    min-height: 340px;
    display: flex;
}

.hero-inner {
    position: relative;
    z-index: 2;
    max-width: 900px;
}

.hero h1 {
    font-size: clamp(1.7rem, 3.4vw, 2.6rem);
    line-height: 1.16;
    margin: 12px 0 14px;
    letter-spacing: -0.02em;
}

.hero h1 em {
    font-style: italic;
    color: #ffe9a8;
}

.hero p {
    max-width: 620px;
    opacity: 0.94;
    margin: 0 0 20px;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.92;
}

.kicker-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.28);
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.84rem;
}

.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    opacity: 0.95;
}

.trust-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: grid;
    place-items: center;
    font-size: 0.7rem;
}

/* Hero variants */
.hero-discover {
    background: linear-gradient(130deg, #4c1d95 0%, #6d28d9 48%, #7c3aed 100%);
}

.hero-owner {
    background: linear-gradient(130deg, #0e7490 0%, #0f766e 55%, #10b981 100%);
}

/* Hero art */
.hero-art {
    position: absolute;
    right: 30px;
    bottom: 0;
    top: 0;
    width: 40%;
    pointer-events: none;
}

.art-sun {
    position: absolute;
    top: 40px;
    right: 70px;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, #ffe9a8, #f59e0b 70%);
    opacity: 0.9;
    box-shadow: 0 0 60px 12px rgba(245, 158, 11, 0.35);
}

.art-building {
    position: absolute;
    right: 60px;
    bottom: 64px;
    width: 120px;
    height: 170px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px 16px 6px 6px;
    display: grid;
    place-items: start center;
    padding-top: 10px;
    box-shadow: 0 30px 50px -18px rgba(0, 0, 0, 0.4);
}

.art-building::before {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    top: 62px;
    bottom: 16px;
    background: repeating-linear-gradient(0deg, rgba(109, 40, 217, 0.16) 0 22px, transparent 22px 44px);
    border-radius: 6px;
}

.art-building-owner::before {
    background: repeating-linear-gradient(0deg, rgba(16, 185, 129, 0.18) 0 22px, transparent 22px 44px);
}

.art-flag {
    font-size: 1.6rem;
    z-index: 1;
}

.art-book {
    position: absolute;
    right: 205px;
    bottom: 84px;
    width: 74px;
    height: 64px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    transform: rotate(-7deg);
    box-shadow: var(--shadow-sm);
}

.art-ground {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 52px;
    background: rgba(0, 0, 0, 0.16);
    border-radius: 999px 999px 0 0;
}

@media (max-width: 860px) {
    .hero {
        padding: 30px 22px;
        min-height: 0;
    }

    .hero-art {
        opacity: 0.35;
        width: 55%;
    }

    .art-sun,
    .art-book {
        display: none;
    }

    .art-building {
        right: -30px;
        bottom: 0;
        transform: scale(0.85);
    }
}

/* ------------------------------------------------------------------ */
/* Panel head + search                                                 */
/* ------------------------------------------------------------------ */
.panel-head {
    margin: 6px 0 14px;
}

.panel-head h2 {
    margin: 0 0 4px;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.panel-head p {
    margin: 0;
    color: var(--text-muted);
}

.search-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.filters .span-2 {
    grid-column: span 2;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.field label em {
    text-transform: none;
    font-weight: 500;
    letter-spacing: 0;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    transition: border-color 0.16s, box-shadow 0.16s;
}

.field textarea {
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand-2);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 0;
}

.check-label input {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                            */
/* ------------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 11px 18px;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s, background 0.18s;
}

.btn:active {
    transform: translateY(1px) scale(0.99);
}

.btn-hero {
    background: #fff;
    color: var(--brand);
    box-shadow: var(--shadow-sm);
}

.btn-hero-ghost {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.btn-alt {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-danger-ghost {
    background: transparent;
    color: var(--danger);
    border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
}

.btn-disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
    border-radius: 9px;
}

.btn-lg {
    padding: 13px 22px;
    font-size: 0.98rem;
}

.btn:hover:not(.btn-disabled) {
    opacity: 0.92;
}

.btn-hero-ghost:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* Quiet, link-like button used by the place banner (E-Tours bridge). */
.btn-plain {
    background: transparent;
    color: var(--brand-2);
    border: 1px solid color-mix(in srgb, var(--brand-2) 35%, transparent);
}

html[data-bs-theme="dark"] .btn-plain {
    color: var(--brand-3);
    border-color: color-mix(in srgb, var(--brand-3) 40%, transparent);
}

/* ------------------------------------------------------------------ */
/* Place banner — the E-Tours (/space) bridge                          */
/* Shown when the directory has been scoped to a place, either by an    */
/* inbound geo deep link or by the visitor's own filters.               */
/* ------------------------------------------------------------------ */
.place-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--brand) 12%, var(--surface)),
            color-mix(in srgb, var(--brand-2) 10%, var(--surface)));
    border: 1px solid color-mix(in srgb, var(--brand-2) 28%, transparent);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.place-banner[hidden] {
    display: none;
}

.place-banner-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    flex: 1 1 320px;
}

.place-banner-icon {
    font-size: 1.1rem;
    line-height: 1.35;
}

.place-banner-copy {
    min-width: 0;
}

.place-banner-text {
    font-size: 0.92rem;
    line-height: 1.45;
}

.place-banner-stats,
.geo-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.geo-stat {
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.geo-stat strong {
    color: var(--text);
}

.geo-chips-label {
    display: block;
    width: 100%;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.chip-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 999px;
    padding: 4px 12px;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.16s, border-color 0.16s;
}

.chip-btn:hover {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--brand-2) 45%, transparent);
}

.place-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.place-banner-actions [hidden] {
    display: none;
}

.field small {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.74rem;
}

/* ------------------------------------------------------------------ */
/* Results strip                                                      */
/* ------------------------------------------------------------------ */
.results-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.pill {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* School cards                                                       */
/* ------------------------------------------------------------------ */
.grid-listings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

.school-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s, box-shadow 0.18s;
}

.school-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.school-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.school-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.school-card-rating {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.star-text {
    color: var(--accent);
    letter-spacing: 1px;
    white-space: nowrap;
}

.star-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.school-card-name {
    margin: 0;
    font-size: 1.18rem;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.school-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.school-card-motto {
    margin: 0;
    font-style: italic;
    color: var(--brand-2);
    font-weight: 600;
    font-size: 0.9rem;
}

.school-card-desc {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex: 1;
}

.school-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.school-card-stats strong {
    color: var(--text);
    font-size: 0.95rem;
}

.school-card-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.open-spaces {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: var(--success);
    font-size: 0.84rem;
}

.open-spaces .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.no-spaces {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.84rem;
}

/* ------------------------------------------------------------------ */
/* Badges & chips                                                     */
/* ------------------------------------------------------------------ */
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
}

.badge-cat {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
}

.badge-soft {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.badge-muted {
    background: var(--surface-2);
    color: var(--text-muted);
}

.badge-sub.badge-active {
    background: rgba(16, 185, 129, 0.14);
    color: var(--success);
}

.badge-sub.badge-pending {
    background: rgba(245, 158, 11, 0.16);
    color: var(--accent);
}

.badge-sub.badge-expired,
.badge-sub.badge-suspended {
    background: rgba(239, 68, 68, 0.14);
    color: var(--danger);
}

.badge-status.badge-pending {
    background: rgba(245, 158, 11, 0.16);
    color: var(--accent);
}

.badge-status.badge-contacted {
    background: rgba(139, 92, 246, 0.16);
    color: var(--brand-2);
}

.badge-status.badge-admitted {
    background: rgba(16, 185, 129, 0.14);
    color: var(--success);
}

.badge-status.badge-rejected,
.badge-status.badge-withdrawn {
    background: rgba(239, 68, 68, 0.14);
    color: var(--danger);
}

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 0.82rem;
    font-weight: 600;
}

.chip-removable {
    padding-right: 8px;
}

.chip-x {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.7rem;
    line-height: 1;
    display: grid;
    place-items: center;
}

.chip-x:hover {
    background: rgba(239, 68, 68, 0.16);
    color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* Console layout                                                     */
/* ------------------------------------------------------------------ */
.console-wrap {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    align-items: start;
}

.console-rail {
    position: sticky;
    top: 84px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.rail-head {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}

.rail-head strong {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.rail-head select {
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

.console-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.console-tabs button {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    padding: 11px 14px;
    border-radius: 12px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.16s, color 0.16s;
}

.console-tabs button:hover {
    background: var(--surface-2);
    color: var(--text);
}

.console-tabs button.is-active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.ct-icon {
    width: 20px;
    text-align: center;
}

.sub-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.sub-banner #subscriptionTitle {
    font-weight: 700;
    font-size: 0.9rem;
}

.sub-banner .badge {
    align-self: flex-start;
}

.console-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* Boxes */
.box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.box-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.box-head h3 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.box-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.inline-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.inline-controls select {
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.86rem;
}

/* Form grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.form-grid .span-2 {
    grid-column: span 2;
}

@media (max-width: 620px) {

    .form-grid .span-2,
    .filters .span-2 {
        grid-column: span 1;
    }
}

/* Tables */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

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

.table th {
    text-align: left;
    padding: 12px 14px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: color-mix(in srgb, var(--brand-2) 5%, transparent);
}

.table-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.row-actions {
    white-space: nowrap;
    display: flex;
    gap: 6px;
    align-items: center;
}

.admission-msg {
    max-width: 220px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.status-select {
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 0.8rem;
}

/* KPI grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.kpi {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.kpi-value {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--brand-2);
    line-height: 1.1;
}

.kpi-label {
    font-weight: 700;
    font-size: 0.82rem;
}

.kpi-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* Empty state */
.empty-state {
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state p {
    margin: 0;
}

/* ------------------------------------------------------------------ */
/* Modals                                                             */
/* ------------------------------------------------------------------ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.is-open {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 8, 24, 0.6);
    backdrop-filter: blur(4px);
}

.modal-card {
    position: relative;
    width: min(560px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow);
}

.modal-card-wide {
    width: min(820px, 100%);
}

.modal-card h3 {
    margin: 0 0 6px;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    display: grid;
    place-items: center;
    z-index: 2;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.14);
    color: var(--danger);
}

/* School detail */
.school-detail {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sd-head h2 {
    margin: 10px 0 4px;
    font-size: 1.7rem;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.sd-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sd-location {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.sd-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.sd-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
}

.sd-stat {
    display: flex;
    flex-direction: column;
}

.sd-stat strong {
    font-size: 1.4rem;
    letter-spacing: -0.03em;
    color: var(--brand-2);
}

.sd-stat span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sd-motto {
    font-style: italic;
    font-weight: 600;
    color: var(--brand-2);
    margin: 0;
    font-size: 1.02rem;
}

.sd-section h4 {
    margin: 0 0 10px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sd-section h4::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.sd-section p {
    margin: 0 0 6px;
}

.ach-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ach-item {
    display: flex;
    gap: 14px;
}

.ach-year {
    flex: 0 0 52px;
    height: 30px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    border-radius: 9px;
    font-weight: 800;
    font-size: 0.8rem;
}

.ach-item strong {
    font-size: 0.95rem;
}

.ach-item p {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
}

.review-item {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
}

.review-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.review-head .star-text {
    font-size: 0.85rem;
}

.review-item p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.87rem;
}

.sd-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.table-fees td:first-child {
    font-weight: 700;
}

/* ------------------------------------------------------------------ */
/* Small screens                                                      */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
    .console-wrap {
        grid-template-columns: 1fr;
    }

    .console-rail {
        position: static;
    }

    .console-tabs {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .console-tabs button {
        flex: 1 1 auto;
        justify-content: center;
    }

    .panel {
        padding: 16px;
    }
}