/*
 * Nizam 2026 — "Ink & Saffron" art direction.
 *
 * Layer 1 of 3: type, tokens, canvas, shell, heroes, admissions flow, cards
 * and stat tiles. Part 2 (components.css) refines controls, data surfaces,
 * auth and responsive behaviour; fonts.css carries the self-hosted faces.
 * All three load after app.css on purpose so this language wins by order at
 * equal specificity, while every existing class name, JS hook and layout
 * contract from app.css is preserved.
 *
 * Palette: deep emerald ink for structure, warm paper for content, saffron
 * for emphasis. Deliberately not the blue-violet SaaS default: a school
 * office is a calm, printed place, and the identity should feel dated-in-a-
 * good-way -- ledger paper, ink, a gold seal.
 */

:root {
  --n-canvas: #f8f5ee;
  --n-surface-subtle: #f3efe5;
  --n-surface-muted: #ece6d8;
  --n-ink: #10241d;
  --n-ink-soft: #2f453b;
  --n-muted: #566a61;
  --n-faint: #5c7067;
  --n-border: #e6dfd0;
  --n-border-strong: #d4cab4;

  --n-primary: #0d5c4a;
  --n-primary-hover: #0a493b;
  --n-primary-strong: #073a2f;
  --n-primary-soft: #e2f0ea;
  --n-primary-softer: #f2f8f5;
  --n-accent: #bd8b32;
  --n-accent-strong: #8a5f14;
  --n-accent-soft: #fbf1dc;

  --n-teal: #0f766e;
  --n-teal-soft: #e3f4f1;
  --n-success: #147a52;
  --n-success-soft: #e6f5ee;
  --n-warning: #a35a0a;
  --n-warning-soft: #fdf0dd;
  --n-danger: #b02a3c;
  --n-danger-hover: #8f1f2f;
  --n-danger-soft: #fdecef;
  --n-info: #1d6a8a;
  --n-info-soft: #e9f3f8;

  --n-radius: 10px;
  --n-radius-lg: 14px;
  --n-radius-xl: 20px;

  --n-shadow-xs: 0 1px 2px rgba(16, 36, 29, .05);
  --n-shadow-sm: 0 2px 6px -2px rgba(16, 36, 29, .08), 0 1px 2px rgba(16, 36, 29, .04);
  --n-shadow: 0 16px 34px -20px rgba(16, 36, 29, .28);
  --n-shadow-lg: 0 36px 74px -34px rgba(16, 36, 29, .38);
  --n-ease: cubic-bezier(.22, 1, .36, 1);

  /* Manrope has no Arabic glyphs, so Arabic text falls through to Alexandria
     inside the same stack -- correct shaping without per-locale font rules. */
  --n-font: 'Manrope', 'Alexandria', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --n-font-display: 'Alexandria', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* app.css sets the base font with `html[lang="ar"] body`; match that
   specificity or the old stack wins regardless of load order. */
html[lang] body, body.n-app-body, html body { font-family: var(--n-font); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .n-display {
  font-family: var(--n-font-display);
  letter-spacing: -.018em;
}
[lang="ar"] h1, [lang="ar"] h2, [lang="ar"] h3, [lang="ar"] h4,
[lang="ar"] h5, [lang="ar"] h6, [lang="ar"] .h1, [lang="ar"] .h2, [lang="ar"] .h3 {
  letter-spacing: 0;
  line-height: 1.45;
}
body {
  color: var(--n-ink);
  background-color: var(--n-canvas);
  background-image:
    radial-gradient(1100px 540px at 100% -14%, rgba(13, 92, 74, .07), transparent 62%),
    radial-gradient(860px 480px at -10% 0%, rgba(189, 139, 50, .07), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #d9ebe3; color: var(--n-primary-strong); }
:focus-visible { outline: 3px solid rgba(13, 92, 74, .32); }
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .form-check-input:focus-visible,
.n-user-trigger:focus-visible, .n-command-trigger:focus-visible { outline: 3px solid rgba(13, 92, 74, .32); }

/* ------------------------------------------------------------------ shell */
/* Dark ink rail against warm paper. Every child that app.css colours for a
   light rail is restated here, so nothing lands dark-on-dark. */
body.n-app-body .nizam-sidebar {
  background:
    radial-gradient(520px 300px at 100% 0%, rgba(189, 139, 50, .12), transparent 62%),
    linear-gradient(180deg, #0b2f27 0%, #08251f 58%, #061f1a 100%);
  border-inline-end: 1px solid rgba(255, 255, 255, .06);
  box-shadow: 22px 0 48px -40px rgba(6, 31, 26, .9);
  color: rgba(255, 255, 255, .74);
}
.nizam-topbar {
  background: rgba(252, 250, 244, .88);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid rgba(16, 36, 29, .07);
}
.n-sidebar-brand-box { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.nizam-brand-name { color: #fff; font-weight: 700; }
.school-brand-mark {
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: linear-gradient(145deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18);
}
.nizam-brand-product {
  background: linear-gradient(90deg, #e9c67f, #c99a44);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: .16em;
}
.n-sidebar-collapse-btn, .n-sidebar-user-card .btn-ghost { color: rgba(255, 255, 255, .6); }
.n-sidebar-collapse-btn:hover, .n-sidebar-user-card .btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }

.n-sidebar-session-bar {
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .8);
}
.n-session-badge { color: #f0d9a8; }
.n-session-status { color: #f0d9a8; }
.n-session-label { color: rgba(255, 255, 255, .78); }

.n-sidebar-search { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .1); border-radius: 11px; }
.n-sidebar-search .n-filter-input { color: #fff; }
.n-sidebar-search .n-filter-input::placeholder { color: rgba(255, 255, 255, .5); }
.n-sidebar-search .n-search-icon, .n-sidebar-search .n-filter-kbd, .n-sidebar-search .n-filter-clear { color: rgba(255, 255, 255, .55); }
.n-sidebar-search .n-filter-kbd { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .12); }
.n-sidebar-search:hover { background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .16); }
.n-sidebar-search:focus-within {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(233, 198, 127, .55);
  box-shadow: 0 0 0 3px rgba(189, 139, 50, .28);
}
.n-sidebar-search:focus-within .n-search-icon { color: #f2d79c; }
.n-sidebar-search:focus-within .n-filter-input { caret-color: #f2d79c; }
.n-sidebar-search .n-filter-input { color: #fff; }
.n-sidebar-search .n-filter-input::placeholder { color: rgba(255, 255, 255, .55); }
.n-sidebar-search .n-filter-clear:hover { background: rgba(255, 255, 255, .14); color: #fff; }

.nizam-sidebar .nav-link, .n-mobile-nav .nav-link {
  border-radius: 10px;
  color: rgba(255, 255, 255, .72);
  font-weight: 550;
}
.nizam-sidebar .nav-link .n-nav-icon, .n-mobile-nav .nav-link .n-nav-icon { color: rgba(255, 255, 255, .48); }
.nizam-sidebar .nav-link:hover, .n-mobile-nav .nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nizam-sidebar .nav-link:hover .n-nav-icon { color: rgba(255, 255, 255, .8); }
.nizam-sidebar .nav-link.active, .n-mobile-nav .nav-link.active {
  background: linear-gradient(135deg, rgba(189, 139, 50, .30) 0%, rgba(189, 139, 50, .14) 100%);
  color: #ffeec9;
  box-shadow: inset 0 0 0 1px rgba(233, 198, 127, .34);
}
.nizam-sidebar .nav-link.active .n-nav-icon { color: #f2d79c; }
.n-nav-active-pip { background: #e9c67f; box-shadow: 0 0 0 3px rgba(233, 198, 127, .18); }
.n-nav-group-title { letter-spacing: .09em; color: rgba(255, 255, 255, .38); font-weight: 700; }
.n-nav-group-count { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .6); border: 1px solid rgba(255, 255, 255, .08); }
.n-nav-group-header:hover .n-nav-group-title { color: rgba(255, 255, 255, .62); }
.n-nav-group-chevron { color: rgba(255, 255, 255, .38); }
.n-sidebar-empty-filter { color: rgba(255, 255, 255, .45); }

.n-sidebar-user-card { border-top: 1px solid rgba(255, 255, 255, .08); }
.n-user-card-name { color: #fff; font-weight: 650; }
.n-user-card-role { color: rgba(255, 255, 255, .5); }
.n-user-avatar-badge, .n-avatar {
  background: linear-gradient(145deg, #e9c67f, #b9853a);
  color: #2a1c05;
  font-weight: 750;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .8);
}

/* The drawer is the same rail on phones; without this the white nav text
   would sit on the default light offcanvas. */
.n-mobile-nav {
  background:
    radial-gradient(420px 260px at 100% 0%, rgba(189, 139, 50, .14), transparent 62%),
    linear-gradient(180deg, #0b2f27 0%, #08251f 60%, #061f1a 100%);
  color: rgba(255, 255, 255, .74);
}
.n-mobile-nav .offcanvas-header { border-bottom: 1px solid rgba(255, 255, 255, .08); }
.n-mobile-nav .btn-close { filter: invert(1) grayscale(1) brightness(1.8); }
.n-mobile-nav .nizam-brand-name { color: #fff; }
.nizam-sidebar .n-sidebar-user-card,
.n-mobile-nav .n-sidebar-user-card { background: transparent; }
.n-mobile-nav .n-sidebar-user-card { border-top: 1px solid rgba(255, 255, 255, .08); }
.n-mobile-nav .n-user-card-name { color: #fff; }
.n-mobile-nav .n-user-card-role { color: rgba(255, 255, 255, .5); }
.n-mobile-nav .n-user-card-actions .btn-ghost { color: rgba(255, 255, 255, .6); }
.n-mobile-nav .n-nav-group-title { color: rgba(255, 255, 255, .38); }
.n-mobile-nav .n-nav-group-count { background: rgba(255, 255, 255, .08); color: rgba(255, 255, 255, .6); border-color: rgba(255, 255, 255, .08); }
.n-mobile-nav .n-nav-group-chevron { color: rgba(255, 255, 255, .38); }
.n-mobile-nav .n-sidebar-session-bar { color: rgba(255, 255, 255, .8); }
.n-mobile-nav .n-command-trigger { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .12); color: rgba(255, 255, 255, .7); }
.n-mobile-nav .n-client-badge, .n-mobile-nav .n-user-trigger { color: rgba(255, 255, 255, .8); }

/* -------------------------------------------------- page head & heroes */
.n-page-head {
  position: relative;
  overflow: hidden;
  padding: 18px 22px;
  border-radius: var(--n-radius-xl);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), var(--n-shadow-xs);
  background:
    radial-gradient(420px 160px at 100% 0%, rgba(189, 139, 50, .12), transparent 70%),
    linear-gradient(120deg, rgba(13, 92, 74, .06), rgba(189, 139, 50, .05));
  border: 1px solid rgba(13, 92, 74, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}
.n-page-head h1 { font-size: 1.32rem; font-weight: 700; margin: 0; }
.n-page-head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #ffffff, #f0ece1);
  border: 1px solid rgba(13, 92, 74, .14);
  color: var(--n-primary);
  box-shadow: var(--n-shadow-xs);
}

/* The admissions-style hero: one statement, one action, one number. */
.n-hero {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  border-radius: var(--n-radius-xl);
  border: 1px solid rgba(13, 92, 74, .16);
  background:
    radial-gradient(620px 300px at 100% -20%, rgba(189, 139, 50, .18), transparent 62%),
    radial-gradient(520px 260px at 0% 120%, rgba(13, 92, 74, .16), transparent 62%),
    linear-gradient(120deg, #ffffff 0%, #fbf8f1 58%, #f4f9f6 100%);
  box-shadow: 0 22px 48px -34px rgba(16, 36, 29, .5), inset 0 1px 0 #fff;
}
.n-hero::after {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--n-primary), var(--n-accent) 62%, transparent);
}
.n-hero-body { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
/* Compact variant used by the shared layout head on every ordinary page. */
.n-hero-compact { padding: 20px 24px; border-radius: var(--n-radius-lg); }
.n-hero-compact .n-hero-body { align-items: center; }
.n-hero-compact .n-hero-eyebrow { margin-bottom: 2px; }
.n-hero-compact .n-hero-title { font-size: clamp(1.25rem, 1.9vw, 1.5rem); margin-bottom: 0; }
.n-hero-compact .n-hero-sub { margin-top: 6px; font-size: .85rem; }
.n-hero-compact .n-page-head-icon {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: var(--n-primary-soft);
  color: var(--n-primary);
  box-shadow: inset 0 0 0 1px rgba(13, 92, 74, .12);
}
.n-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--n-accent-strong);
  margin-bottom: 8px;
}
.n-hero-title { font-size: clamp(1.5rem, 2.4vw, 1.9rem); font-weight: 760; margin: 0 0 8px; color: var(--n-ink); }
[lang="ar"] .n-hero-title { line-height: 1.4; }
.n-hero-sub { margin: 0; max-width: 62ch; color: var(--n-muted); font-size: .9rem; }
.n-hero-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.n-hero-stat {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(16, 36, 29, .08);
  box-shadow: var(--n-shadow-xs);
}
.n-hero-stat b { font-size: 1.5rem; font-weight: 760; color: var(--n-primary-strong); line-height: 1; letter-spacing: -.02em; }
[lang="ar"] .n-hero-stat b { letter-spacing: 0; }
.n-hero-stat span { font-size: .76rem; color: var(--n-muted); }

.n-grades-header, .n-dashboard-welcome {
  position: relative;
  overflow: hidden;
  border-radius: var(--n-radius-xl);
  border: 1px solid rgba(13, 92, 74, .14);
  background:
    radial-gradient(560px 220px at 100% 0%, rgba(189, 139, 50, .16), transparent 70%),
    radial-gradient(420px 200px at 0% 100%, rgba(13, 92, 74, .10), transparent 70%),
    linear-gradient(125deg, #ffffff 0%, #fbf8f1 55%, #f5faf7 100%);
  box-shadow: 0 18px 40px -30px rgba(16, 36, 29, .5), inset 0 1px 0 #fff;
}
.n-grades-header::after, .n-dashboard-welcome::after {
  content: "";
  position: absolute;
  inset-block-start: -60px;
  inset-inline-end: -40px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(189, 139, 50, .22), transparent 65%);
  pointer-events: none;
}
.n-dashboard-welcome h1, .n-grades-title { font-weight: 760; }
.n-context-chip {
  background: rgba(255, 255, 255, .8);
  border: 1px solid rgba(16, 36, 29, .08);
  box-shadow: var(--n-shadow-xs);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.n-grades-icon-wrapper {
  background: linear-gradient(145deg, #e2f0ea, #d1e7de);
  color: var(--n-primary);
  box-shadow: inset 0 0 0 1px rgba(13, 92, 74, .14);
}

/* ----------------------------------------------------- admissions stages */
.n-stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(186px, 1fr));
  gap: 12px;
}
.n-stage-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--n-radius-lg);
  border: 1px solid var(--n-border);
  background: #fffdf9;
  color: var(--n-ink);
  text-decoration: none;
  box-shadow: var(--n-shadow-xs);
  transition: transform .18s var(--n-ease), box-shadow .18s var(--n-ease), border-color .18s var(--n-ease);
  min-height: 76px;
}
.n-stage-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(13, 92, 74, .3);
  box-shadow: var(--n-shadow-sm);
  color: var(--n-ink);
}
.n-stage-tile.is-active {
  border-color: rgba(189, 139, 50, .55);
  background: linear-gradient(140deg, #fffaf0, #fdf4e2);
  box-shadow: inset 0 0 0 1px rgba(189, 139, 50, .25), var(--n-shadow-sm);
}
.n-stage-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--n-primary-soft);
  color: var(--n-primary);
}
.n-stage-tile.is-active .n-stage-icon { background: var(--n-accent-soft); color: var(--n-accent-strong); }
.n-stage-tile[data-tone="amber"] .n-stage-icon { background: var(--n-warning-soft); color: var(--n-warning); }
.n-stage-tile[data-tone="danger"] .n-stage-icon { background: var(--n-danger-soft); color: var(--n-danger); }
.n-stage-tile[data-tone="success"] .n-stage-icon { background: var(--n-success-soft); color: var(--n-success); }
.n-stage-tile[data-tone="muted"] .n-stage-icon { background: var(--n-surface-muted); color: var(--n-muted); }
.n-stage-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.n-stage-label { font-size: .78rem; color: var(--n-muted); line-height: 1.35; }
.n-stage-count { font-size: 1.4rem; font-weight: 760; line-height: 1.05; color: var(--n-ink); letter-spacing: -.02em; }
[lang="ar"] .n-stage-count { letter-spacing: 0; }

/* ------------------------------------------------------------------ cards */
.card {
  border: 1px solid var(--n-border);
  border-radius: var(--n-radius-lg);
  background: #fffdf9;
  box-shadow: var(--n-shadow-xs);
  transition: box-shadow .22s var(--n-ease), border-color .22s var(--n-ease);
}
.card:hover { box-shadow: var(--n-shadow-sm); }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--n-border);
  padding: 14px 18px;
  font-size: .78rem;
  font-weight: 650;
  color: var(--n-ink-soft);
}
.card-footer { background: transparent; border-top: 1px solid var(--n-border); }
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--n-primary), #2f8f74 55%, var(--n-accent));
  opacity: .9;
}
.stat-value { font-size: 1.95rem; font-weight: 760; letter-spacing: -.04em; line-height: 1.05; }
[lang="ar"] .stat-value { letter-spacing: 0; font-feature-settings: "tnum"; }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #e2f0ea, #d2e7de);
  color: var(--n-primary-strong);
  box-shadow: inset 0 0 0 1px rgba(13, 92, 74, .12);
}
.stat-icon .n-icon { width: 22px; height: 22px; }
.stat-teal .stat-icon { background: linear-gradient(145deg, #e2f5f1, #d0ebe5); color: #0f5f57; box-shadow: inset 0 0 0 1px rgba(15, 118, 110, .16); }
.stat-violet .stat-icon { background: linear-gradient(145deg, #fbf1dc, #f6e5c4); color: var(--n-accent-strong); box-shadow: inset 0 0 0 1px rgba(189, 139, 50, .2); }
.stat-amber .stat-icon { background: linear-gradient(145deg, #fdf0dd, #fbe3c3); color: var(--n-warning); box-shadow: inset 0 0 0 1px rgba(163, 90, 10, .16); }
.stat-indigo .stat-icon { background: linear-gradient(145deg, #e2f0ea, #d1e7de); color: var(--n-primary-strong); }
.n-stat-mini {
  background: rgba(255, 255, 255, .84);
  border: 1px solid rgba(16, 36, 29, .08);
  border-radius: 13px;
  box-shadow: var(--n-shadow-xs);
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 767.98px) {
  .n-hero { padding: 20px; }
  .n-hero-body { align-items: flex-start; }
  .n-stage-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .n-stage-tile { min-height: 68px; padding: 12px; }
  .n-stage-count { font-size: 1.2rem; }
}
