:root {
  --brand-primary: #173b8f;
  --brand-dark: #10265e;
  --brand-soft: #eef2fb;
  --brand-accent: #b4232d;
  --ink: #18251f;
  --muted: #66756d;
  --line: #dfe7e2;
  --canvas: #f4f7f5;
  --surface: #ffffff;
  --shadow: 0 12px 32px rgba(18, 55, 38, .08);
}

.audit-values {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 34rem;
  overflow: auto;
  padding: 1rem;
  border-radius: .5rem;
  background: #f7f9f8;
  color: #24342d;
  font-size: .82rem;
}

html { font-size: 15px; min-height: 100%; }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); display: flex; flex-direction: column; font-family: Inter, "Segoe UI", system-ui, sans-serif; }
a { color: var(--brand-primary); }
a:hover { color: var(--brand-dark); }

.app-header { color: #fff; background: linear-gradient(115deg, var(--brand-dark), var(--brand-primary)); box-shadow: 0 3px 18px rgba(16, 38, 94, .18); }
.header-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: .75rem 2rem; }
.app-brand { display: inline-flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; }
.app-brand:hover { color: #fff; }
.app-brand img { width: 46px; height: 46px; object-fit: contain; border-radius: 50%; background: #fff; padding: 3px; }
.app-brand span { display: flex; flex-direction: column; line-height: 1.05; }
.app-brand strong { font-size: 1.15rem; letter-spacing: .06em; }
.app-brand small { opacity: .78; margin-top: .25rem; }
.header-actions { display: flex; align-items: center; gap: 1rem; }
.school-switcher .form-select { width: min(270px, 34vw); border: 1px solid rgba(255,255,255,.28); color: #fff; background-color: rgba(255,255,255,.1); }
.school-switcher .form-select option { color: var(--ink); background: #fff; }
.account-button { display: flex; align-items: center; gap: .5rem; border: 0; color: #fff; background: transparent; }
.account-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--brand-dark); background: #fff; font-weight: 800; }
.account-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-nav { padding: 0 1.25rem; background: #fff; border-bottom: 1px solid var(--line); }
.app-nav .nav-link { color: #33473d; font-weight: 600; padding: .9rem .85rem; }
.app-nav .nav-link:hover, .app-nav .nav-link:focus { color: var(--brand-primary); background: var(--brand-soft); }
.dropdown-menu { border: 1px solid var(--line); box-shadow: var(--shadow); }
.dropdown-item { padding: .6rem 1rem; }
.dropdown-item:active { background: var(--brand-primary); }

.app-main { width: 100%; max-width: 1500px; flex: 1; padding: 2rem; }
.app-footer { color: var(--muted); background: #fff; border-top: 1px solid var(--line); }
.app-footer .container-fluid { display: flex; justify-content: space-between; gap: 1rem; padding: 1.1rem 2rem; }

.hero-panel { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; min-height: 210px; padding: 2.25rem 2.5rem; color: #fff; border-radius: 22px; background: radial-gradient(circle at 85% 20%, rgba(180,35,45,.3), transparent 28%), linear-gradient(120deg, var(--brand-dark), #2457b3); box-shadow: var(--shadow); }
.hero-panel::after { content: ""; position: absolute; right: -80px; bottom: -150px; width: 330px; height: 330px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; }
.hero-panel h1 { margin: .25rem 0 .5rem; font-size: clamp(2rem, 4vw, 3rem); }
.hero-panel p { max-width: 650px; margin: 0; color: rgba(255,255,255,.8); font-size: 1.05rem; }
.hero-panel img { position: relative; z-index: 1; width: 120px; height: 120px; object-fit: contain; background: #fff; border-radius: 50%; padding: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.18); }
.eyebrow { color: var(--brand-accent); font-size: .74rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }

.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.metric-card { position: relative; min-height: 150px; padding: 1.25rem; color: var(--ink); text-decoration: none; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 22px rgba(18,55,38,.04); transition: transform .18s ease, box-shadow .18s ease; }
.metric-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card strong { display: block; margin: .65rem 0; color: var(--brand-primary); font-size: 2rem; }
.metric-accent { background: var(--brand-soft); border-color: #d7e0f4; }

.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 7px 24px rgba(18,55,38,.045); }
.surface-heading { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.4rem; border-bottom: 1px solid var(--line); }
.surface-heading h2 { margin: .2rem 0 0; font-size: 1.25rem; }
.form-surface { max-width: 900px; padding: 1.5rem; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-heading h1 { margin: .2rem 0; font-size: 2rem; }
.page-heading p { margin: 0; color: var(--muted); }

.table > :not(caption) > * > * { padding: .9rem 1rem; border-bottom-color: var(--line); }
.table thead th { color: var(--muted); background: #f8faf9; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; }
.code-pill, .status-badge { display: inline-flex; align-items: center; padding: .28rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.code-pill { color: #63511d; background: #fff4cc; }
.status-active { color: #12633f; background: #ddf4e7; }
.status-inactive { color: #8b3d3d; background: #fbe5e5; }

.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand-primary); border-color: var(--brand-primary); }
.btn-outline-primary:hover { background: var(--brand-primary); border-color: var(--brand-primary); }
.form-control:focus, .form-select:focus { border-color: #55a67b; box-shadow: 0 0 0 .2rem rgba(15,90,58,.13); }

.auth-shell { min-height: 65vh; display: grid; place-items: center; padding: 2rem 0; }
.auth-card { width: min(100%, 450px); padding: 2rem; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.65rem; }
.auth-icon { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 1rem; color: #fff; background: var(--brand-primary); border-radius: 16px; font-weight: 800; }
.security-setup { max-width: 760px; padding: 1.5rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.setup-steps li { margin-bottom: 1.3rem; padding-left: .5rem; }
.setup-steps p { margin: .3rem 0; color: var(--muted); }
.secret-key { display: inline-block; padding: .75rem 1rem; background: #eef2ef; border: 1px dashed #9baba2; border-radius: 8px; font-family: ui-monospace, monospace; font-size: 1.05rem; letter-spacing: .08em; }
.setup-code { max-width: 320px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(160px, 240px)); gap: .65rem; }
.recovery-codes code { padding: .7rem; color: var(--ink); background: #eef2ef; border-radius: 7px; font-size: 1rem; text-align: center; }

@media (max-width: 1100px) { .metric-grid { grid-template-columns: repeat(3, 1fr); } }
.fees-metrics { grid-template-columns: repeat(3, minmax(180px, 1fr)); max-width: 900px; }
@media (max-width: 767px) {
  html { font-size: 14px; }
  .header-inner { padding: .7rem 1rem; align-items: flex-start; }
  .header-actions { flex-direction: column-reverse; align-items: flex-end; gap: .5rem; }
  .account-name { display: none; }
  .school-switcher .form-select { width: 180px; }
  .app-main { padding: 1.25rem 1rem; }
  .hero-panel { min-height: 180px; padding: 1.5rem; }
  .hero-panel img { width: 72px; height: 72px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .app-footer .container-fluid { padding: 1rem; flex-direction: column; }
}
@media (max-width: 420px) { .metric-grid { grid-template-columns: 1fr; } .app-brand small { display: none; } .hero-panel img { display: none; } }
