:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f6;
  --border: #ebebeb;
  --border-strong: #d5d5d5;
  --text: #000000;
  --text-muted: #404040;
  --text-subtle: #727272;
  --primary: #d84d2b;
  --primary-hover: #c03e20;
  --primary-weak: #fdeee9;
  --primary-text: #ffffff;
  --ink: #000000;
  --success: #004f32;
  --success-weak: #d9fff1;
  --warning: #c13206;
  --warning-weak: #ffdcc5;
  --danger: #c13206;
  --danger-weak: #ffdcc5;
  --info: #05047e;
  --info-weak: #dce6ff;
  --p-ogv: #037ef3;
  --p-ogt: #f48924;
  --p-igv: #0cb9c1;
  --p-igt: #7552cc;
  --radius: 0;
  --radius-lg: 0;
  --shadow-sm: none;
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.08);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --nav-width: 240px;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Yanone Kaffeesatz", "Oswald", sans-serif;
  --font-ui: "Oswald", system-ui, sans-serif;
  --font-ar: "IBM Plex Sans Arabic", "Poppins", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--text);
  background: var(--bg);
}
[lang="ar"] {
  --font-display: var(--font-ar);
  --font-ui: var(--font-ar);
}
[lang="ar"] body, :lang(ar) { font-family: var(--font-ar); }
[x-cloak] { display: none !important; }

h1, h2, h3, .page-header h1, .auth-card h1, .metric-value, .nav-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 0.95;
  text-wrap: pretty;
}
h1, h2 { text-transform: uppercase; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app { display: flex; min-height: 100vh; }
.nav {
  width: var(--nav-width);
  background: var(--ink);
  color: #ffffff;
  border-right: 0;
  display: flex;
  flex-direction: column;
  padding: var(--space-5) var(--space-4);
  position: sticky;
  top: 0;
  height: 100vh;
}
.nav.is-collapsed { width: 64px; }
.nav.is-collapsed .nav-title,
.nav.is-collapsed .nav-link span:last-child { display: none; }
.nav-brand { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-6); }
.nav-mark {
  width: 32px; height: 32px; border-radius: 0;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1;
}
.nav-title {
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
}
.nav-list { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px 10px; border-radius: 0; color: rgba(255, 255, 255, 0.62);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-link:hover, .nav-link.is-active {
  background: transparent; color: #fff; text-decoration: none;
}
.nav-link.is-active {
  color: var(--primary);
}
.nav-icon {
  width: 8px; height: 8px; border-radius: 0; background: currentColor; opacity: 0.7;
}
.nav-collapse {
  border: 0; background: transparent; color: rgba(255, 255, 255, 0.45);
  cursor: pointer; text-align: left; padding: var(--space-2);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-4); padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border); background: var(--surface);
  position: sticky; top: 0; z-index: 10;
}
.switchers { display: flex; gap: var(--space-3); }
.switcher { display: flex; flex-direction: column; gap: 2px; }
.switcher-label, .switcher > span:first-child {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
}
.switcher select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--text); border-radius: 0; padding: 6px 8px;
}
.topbar-end { display: flex; align-items: center; gap: var(--space-3); }
.avatar-name {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.page { padding: var(--space-6) var(--space-5); max-width: 1440px; width: 100%; margin: 0 auto; }
.page-header { margin-bottom: var(--space-6); }
.page-header h1 {
  font-size: clamp(2.4rem, 4vw, 4.5rem);
  line-height: 0.9;
  font-weight: 700;
  margin: 0 0 12px;
  text-transform: uppercase;
}
.eyebrow {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 500;
  margin: 0 0 10px;
}
.lede { color: var(--text-muted); margin: 0; max-width: 42rem; }
.row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.row-between { display: flex; justify-content: space-between; gap: var(--space-4); align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack h2 {
  font-size: 2rem;
  margin: var(--space-4) 0 var(--space-2);
  text-transform: uppercase;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); border: 1px solid transparent;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-md { height: 44px; padding: 0 24px; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 11px; }
.btn-lg { height: 52px; padding: 0 32px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: transparent; color: var(--text); border-color: var(--text);
}
.btn-secondary:hover { background: var(--text); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }

.badge {
  display: inline-flex; align-items: center; border-radius: 0;
  padding: 3px 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--surface-2); color: var(--text-muted);
}
.badge-success, .badge-active { background: var(--success-weak); color: var(--success); }
.badge-warning, .badge-pending { background: var(--warning-weak); color: var(--warning); }
.badge-danger, .badge-inactive { background: var(--danger-weak); color: var(--danger); }
.badge-info, .badge-alumni { background: var(--info-weak); color: var(--info); }
.badge-ogv { background: var(--primary-weak); color: var(--p-ogv); }
.badge-igv { background: var(--info-weak); color: var(--p-igv); }
.badge-neutral { background: var(--surface-2); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); box-shadow: var(--shadow-sm);
}
.metric-tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-5); min-width: 180px;
}
.metric-label {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin: 0;
  font-weight: 500;
}
.metric-value {
  font-size: 48px;
  line-height: 1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 8px 0 4px;
}
.metric-hint, .metric-delta { color: var(--text-muted); margin: 0; }

.table-wrap { overflow: auto; border: 1px solid var(--text); border-radius: var(--radius-lg); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.table th {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text);
  font-weight: 500;
  background: var(--surface-2);
}
.table tbody tr:hover { background: var(--surface-2); }
.table td { height: 44px; }

.empty {
  text-align: left; padding: var(--space-6); border: 1px solid var(--text);
  border-radius: var(--radius-lg); background: var(--surface);
}
.empty h2 { margin: 0 0 8px; font-size: 2rem; text-transform: uppercase; }
.empty p { color: var(--text-muted); margin: 0 0 16px; }

.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; }
.field span, .field > span:first-child {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}
.field input, .field select, .auth-card input {
  font-family: var(--font);
  font-size: 15px;
  padding: 12px 12px;
  border: 1px solid var(--text);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
}
.filter-bar { margin-bottom: var(--space-4); max-width: 360px; }
.meta { display: grid; gap: 10px 24px; }
.meta > div { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; align-items: baseline; }
.meta dt {
  color: var(--text-subtle);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.meta dd { margin: 0; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); }
.plain-list { margin: 0; padding-left: 18px; }
.pager { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-3); color: var(--text-muted); }
.toasts { list-style: none; padding: 0; }
.toast { padding: 10px 14px; border-radius: 0; background: var(--primary-weak); }
.alert { padding: 10px 12px; border-radius: 0; }
.alert-danger { background: var(--danger-weak); color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--text-muted); }

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: var(--bg);
}
.auth-card {
  width: min(440px, 92vw);
  background: var(--surface);
  border: 1px solid var(--text);
  border-radius: 0;
  padding: var(--space-6);
  box-shadow: none;
}
.auth-card h1 {
  margin: 0 0 12px;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  text-transform: uppercase;
}
.auth-card .eyebrow a { color: var(--primary); }
.auth-card .errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--danger); font-size: 13px; font-weight: 400; }
.auth-card form { margin-top: var(--space-4); }

@media (max-width: 800px) {
  .app { flex-direction: column; }
  .nav {
    width: 100%; height: auto; position: static; flex-direction: row; align-items: center;
    padding: 12px 16px; gap: 12px;
  }
  .nav-brand { margin-bottom: 0; }
  .nav-list { flex-direction: row; overflow: auto; flex: 1; }
  .nav-link { padding: 8px; white-space: nowrap; }
  .nav-collapse { display: none; }
  .topbar { flex-wrap: wrap; padding: 12px 16px; }
  .avatar-name { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .page { padding: var(--space-4); }
  .page-header h1 { font-size: 2.4rem; }
}
