/* ESPOOO University — design system (V1 tokens, Universities accent)
   Fonts: IBM Plex Sans Arabic (Arabic + UI), Inter (Latin data / numerals). Self-hosted.
   Rules: borders not shadows, one accent, logical properties (RTL default), no inline styles (CSP). */

/* ---------- Fonts ---------- */
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2") format("woff2"); unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0898-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Arabic"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-sans-arabic-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --navy: #0F172A;
  --accent: #3B82F6;
  --accent-ink: #1D4ED8;
  --accent-soft: #EFF6FF;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --border: #E5E7EB;
  --border-strong: #CBD5E1;
  --ink: #0F172A;
  --ink-2: #475569;
  --ink-3: #94A3B8;
  --success: #047857; --success-bg: #ECFDF5;
  --warning: #B45309; --warning-bg: #FFFBEB;
  --danger: #B91C1C;  --danger-bg: #FEF2F2;
  --info: #1D4ED8;    --info-bg: #EFF6FF;
  --muted: #64748B;   --muted-bg: #F1F5F9;
  --side-w: 256px;
  --top-h: 60px;
  --r-sm: 6px; --r: 8px; --r-lg: 12px;
  --font-ar: "IBM Plex Sans Arabic", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-num: "Inter", "IBM Plex Sans Arabic", system-ui, sans-serif;
  --focus: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-ar); line-height: 1.65; color: var(--ink); background: var(--bg); min-height: 100vh; text-rendering: optimizeLegibility; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code, pre, .num, .dt, .cell-ltr { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.dt { direction: ltr; unicode-bidi: isolate; }
td.dt, dd.dt { text-align: start; white-space: nowrap; }
code { font-size: 0.92em; background: var(--muted-bg); padding: 1px 6px; border-radius: 4px; }
code.small { font-size: 0.8em; }
pre { margin: 6px 0 0; padding: 10px 12px; background: var(--muted-bg); border-radius: var(--r-sm); font-size: 0.85em; overflow: auto; text-align: left; }
.muted { color: var(--ink-3); }
.nowrap { white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.skip-link { position: absolute; inset-inline-start: 8px; top: -48px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: var(--r-sm); z-index: 100; }
.skip-link:focus { top: 8px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: #1A2540; border-color: #1A2540; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--muted-bg); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 0.9rem; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; color: var(--ink-2); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 500; color: var(--ink); }
.field .req { color: var(--danger); }
.field input, .field select, .search input { width: 100%; min-height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field select:focus, .search input:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.field input[dir="ltr"], .field input[type="email"], .field input[type="password"], .field input[type="url"] { text-align: left; font-family: var(--font-num); }
.field input::placeholder { color: var(--ink-3); }
.has-error input, .has-error select { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 0.92rem; }
.field-hint { color: var(--ink-3); font-size: 0.92rem; }
.check { display: flex; align-items: center; gap: 8px; margin: 4px 0 20px; color: var(--ink-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--navy); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid { display: grid; gap: 20px; max-width: 880px; }
.search { display: flex; gap: 8px; }
.search input { min-width: 260px; }

/* ---------- Flash / callouts / badges ---------- */
.flash { padding: 12px 14px; border: 1px solid; border-radius: var(--r); margin-bottom: 18px; }
.flash-success { background: var(--success-bg); border-color: #A7F3D0; color: var(--success); }
.flash-danger { background: var(--danger-bg); border-color: #FECACA; color: var(--danger); }
.callout { padding: 16px 18px; border: 1px solid var(--border); border-inline-start: 3px solid var(--accent); border-radius: var(--r); background: var(--surface); margin-bottom: 18px; }
.callout-title { font-weight: 600; margin-bottom: 8px; }
.callout-hint { color: var(--ink-2); font-size: 0.92rem; margin-top: 8px; }
.cred { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; align-items: center; }
.cred dt { color: var(--ink-2); }
.cred dd { margin: 0; display: flex; align-items: center; gap: 8px; }
.cred code { font-size: 1rem; padding: 4px 10px; }
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 0.86rem; white-space: nowrap; }
.chip-scope { color: var(--ink-3); font-size: 0.8rem; }

/* ---------- App shell (RTL: sidebar is the first flex child → inline-start) ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--side-w); flex: 0 0 var(--side-w); background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-brand { display: flex; align-items: baseline; gap: 8px; padding: 22px 22px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.sidebar-brand img { width: 108px; height: auto; }
.sidebar-brand-sub { font-family: var(--font-num); font-size: 0.78rem; letter-spacing: 0.02em; color: rgba(255, 255, 255, 0.55); font-weight: 500; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-group { padding: 16px 12px 6px; font-size: 0.8rem; color: rgba(255, 255, 255, 0.45); }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.nav-item { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; margin-bottom: 2px; border-radius: var(--r); color: rgba(255, 255, 255, 0.78); background: transparent; border: 0; font: inherit; text-align: start; cursor: pointer; text-decoration: none; transition: background-color .15s, color .15s; }
.nav-item svg { flex: 0 0 20px; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.06); color: #fff; text-decoration: none; }
.nav-item.is-active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav-item.is-active::before { content: ""; position: absolute; inset-inline-start: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
[dir="rtl"] .nav-item.is-active::before { border-radius: 3px 0 0 3px; }
.nav-item.is-disabled { color: rgba(255, 255, 255, 0.35); cursor: default; }
.nav-item.is-disabled:hover { background: transparent; }
.nav-item.is-disabled svg { opacity: 0.4; }
.nav-soon { margin-inline-start: auto; font-size: 0.72rem; color: rgba(255, 255, 255, 0.35); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 999px; padding: 0 7px; }
.nav-label { flex: 1; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar { height: var(--top-h); display: flex; align-items: center; gap: 16px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-menu { display: none; background: none; border: 0; color: var(--ink); padding: 6px; border-radius: var(--r-sm); cursor: pointer; }
.topbar-tenant { display: flex; align-items: baseline; gap: 10px; flex: 1; min-width: 0; }
.topbar-tenant-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-tenant-type { color: var(--ink-3); font-size: 0.9rem; }
.topbar-switch { font-size: 0.9rem; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; border-radius: 999px; cursor: pointer; border: 1px solid transparent; }
.user-chip:hover, .user-menu[open] .user-chip { border-color: var(--border); background: var(--bg); }
.user-chip-name { font-weight: 500; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 0.85rem; }
.user-menu-panel { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 8px; z-index: 30; }
.user-menu-email { padding: 8px 10px 10px; color: var(--ink-3); font-size: 0.85rem; border-bottom: 1px solid var(--border); margin-bottom: 6px; text-align: left; font-family: var(--font-num); }
.user-menu-panel a, .user-menu-panel button { display: block; width: 100%; text-align: start; padding: 8px 10px; border-radius: var(--r-sm); color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--bg); text-decoration: none; }

/* ---------- Page ---------- */
.page { padding: 28px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-sub { color: var(--ink-2); margin-top: 4px; }
.crumbs { color: var(--ink-3); font-size: 0.9rem; margin-bottom: 6px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 22px; }
.panel-narrow { max-width: 520px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head-2 { margin-top: 24px; }
.panel-head a { font-size: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; margin-top: 20px; }

/* Stats: one bordered strip with dividers (not identical cards) */
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.stat { padding: 18px 22px; display: flex; flex-direction: column; gap: 2px; color: inherit; text-decoration: none; border-inline-start: 1px solid var(--border); }
.stat:first-child { border-inline-start: 0; }
a.stat:hover { background: var(--bg); text-decoration: none; }
.stat-value { font-size: 1.9rem; font-weight: 600; line-height: 1.1; color: var(--navy); }
.stat-label { color: var(--ink-2); }

/* Timeline / steps */
.timeline li { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline-time { color: var(--ink-3); font-size: 0.85rem; white-space: nowrap; direction: ltr; padding-top: 2px; }
.timeline-body { flex: 1; min-width: 0; }
code.action { color: var(--accent-ink); background: var(--accent-soft); }
.steps { list-style: decimal; padding-inline-start: 20px; color: var(--ink-2); display: grid; gap: 6px; }

/* Tables */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--border); }
.table th { font-weight: 500; color: var(--ink-2); background: var(--bg); white-space: nowrap; font-size: 0.9rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FBFCFE; }
.table-dense th, .table-dense td { padding: 9px 14px; font-size: 0.93rem; }
.cell-strong { font-weight: 500; }
.cell-sub { display: block; color: var(--ink-3); font-size: 0.85rem; font-family: var(--font-num); }
td.cell-ltr, td[dir="ltr"] { text-align: left; }
details.json summary { cursor: pointer; color: var(--accent-ink); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
.dl dt { color: var(--ink-2); }
.dl dd { margin: 0; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; color: var(--ink-2); }
.pagination-links { display: flex; align-items: center; gap: 12px; }
.pagination-links a { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); }
.pagination-links .is-disabled { padding: 6px 12px; color: var(--ink-3); }

/* Empty states */
.empty { text-align: center; padding: 36px 20px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); }
.empty-title { font-weight: 600; margin-bottom: 4px; }
.empty-hint { color: var(--ink-2); margin-bottom: 14px; }

/* ---------- Auth ---------- */
.auth { background: var(--surface); }
.auth-split { display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; min-height: 100vh; }
.auth-panel { background: var(--navy); color: #fff; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-logo { width: 232px; }
.auth-panel-copy { max-width: 380px; }
.auth-panel-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 10px; }
.auth-panel-text { color: rgba(255, 255, 255, 0.7); font-size: 1.02rem; }
.auth-panel-foot { color: rgba(255, 255, 255, 0.4); font-family: var(--font-num); font-size: 0.85rem; text-align: left; direction: ltr; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: 48px 28px; background: var(--bg); }
.auth-form { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 36px 34px; }
.auth-form-logo { width: 116px; margin-bottom: 26px; }
.auth-title { font-size: 1.5rem; margin-bottom: 6px; }
.auth-sub { color: var(--ink-2); margin-bottom: 22px; }
.auth-foot { margin-top: 20px; color: var(--ink-3); font-size: 0.9rem; }
.auth-foot-form { margin-top: 18px; text-align: center; }
.org-list { display: grid; gap: 10px; }
.org-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: var(--r); cursor: pointer; }
.org-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.org-option input { accent-color: var(--navy); }
.org-option-body { display: flex; flex-direction: column; }
.org-option-name { font-weight: 500; }
.org-option-type { color: var(--ink-3); font-size: 0.88rem; }

/* ---------- Error pages ---------- */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.error-box { text-align: center; max-width: 440px; padding: 40px; }
.error-box img { margin: 0 auto 28px; }
.error-code { font-size: 3rem; font-weight: 600; color: var(--ink-3); line-height: 1; margin-bottom: 8px; }
.error-box h1 { font-size: 1.4rem; margin-bottom: 8px; }
.error-box p { color: var(--ink-2); margin-bottom: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  .stat { border-inline-start: 0; border-top: 1px solid var(--border); }
  .stat:nth-child(-n + 2) { border-top: 0; }
  .stat:nth-child(even) { border-inline-start: 1px solid var(--border); }
}
@media (max-width: 900px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-panel { padding: 28px 24px; gap: 20px; }
  .auth-panel-copy { display: none; }
  .auth-logo { width: 180px; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; transform: translateX(100%); transition: transform .2s ease; }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  .sidebar.is-open { transform: none; }
  .topbar-menu { display: inline-flex; }
  .page { padding: 18px; }
  .page-head { flex-direction: column; }
  .fields-2 { grid-template-columns: 1fr; }
  .search input { min-width: 0; }
  .user-chip-name { display: none; }
  .stats { grid-template-columns: 1fr; }
  .stat, .stat:nth-child(even) { border-inline-start: 0; }
  .stat:nth-child(-n + 2) { border-top: 1px solid var(--border); }
  .stat:first-child { border-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- v0.2 additions ---------- */
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head-actions form { margin: 0; }
.btn-danger { border-color: #FECACA; color: var(--danger); background: var(--surface); }
.btn-danger:hover { background: var(--danger-bg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }
.panel-mt { margin-top: 20px; }
.list li.list-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); line-height: 1.55; }
.list li.list-row:last-child { border-bottom: 0; }
.list li.list-row form { margin: 0; }
.list li.muted { padding: 8px 0; }
.inline-edit summary { list-style: none; cursor: pointer; }
.inline-edit summary::-webkit-details-marker { display: none; }
.inline-edit[open] { flex-basis: 100%; }
.inline-edit[open] summary { margin-bottom: 8px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.inline-form input, .inline-form select { min-height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); font: inherit; background: var(--surface); flex: 1 1 140px; }
.inline-form input[dir="ltr"] { font-family: var(--font-num); text-align: left; }
.stack-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.stack-form .field { margin-bottom: 12px; }
.stack-form-title { font-weight: 600; margin-bottom: 10px; }
.checks { border: 0; padding: 0; margin: 4px 0 0; display: flex; gap: 18px; flex-wrap: wrap; }
.checks legend { font-weight: 500; margin-bottom: 6px; }
.checks .check { margin: 0; }
.table-flat { border: 0; border-radius: 0; }
.cell-actions { white-space: nowrap; text-align: end; }
.cell-actions form { display: inline-block; margin: 0; }
.cell-actions .btn + form, .cell-actions form + form { margin-inline-start: 4px; }
.search select { min-height: 40px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r); background: var(--surface); font: inherit; }
[hidden] { display: none !important; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr; } }

/* ---------- v0.3 competitions ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 4px 0 20px; overflow-x: auto; }
.tab { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-count { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 999px; background: var(--warning-bg); color: var(--warning); font-size: 12px; line-height: 18px; text-align: center; font-family: var(--font-num); }
.panel-mt-0 + .panel-mt-0 { margin-top: 20px; }
.hint-list { margin: 12px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; line-height: 1.7; }
.prose { line-height: 1.8; white-space: pre-line; }
.rounds { display: flex; flex-wrap: wrap; gap: 16px; padding-bottom: 6px; align-items: flex-start; }
.round { min-width: 260px; max-width: 460px; flex: 1 0 260px; display: grid; gap: 10px; }
.round-title { font-weight: 600; color: var(--muted); font-size: 13px; margin: 0 0 2px; }
.match-card { display: block; border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; background: var(--surface); text-decoration: none; color: var(--ink); }
.match-card:hover { border-color: var(--border-strong); }
.match-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.match-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 4px 0; }
.match-row.is-winner .match-team { font-weight: 700; }
.match-row.is-winner .match-score { color: var(--success); font-weight: 700; }
.match-team small { display: block; font-weight: 400; }
.match-score { min-width: 28px; text-align: center; font-weight: 600; }
.scoreboard { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; text-align: center; margin-bottom: 20px; }
.score-side { min-width: 200px; padding: 10px 16px; border-radius: var(--r); }
.score-side.is-winner { background: var(--success-bg); }
.score-team { font-size: 18px; font-weight: 700; margin: 0 0 2px; }
.score-value { font-size: 40px; font-weight: 700; margin: 6px 0 0; line-height: 1; }
.score-vs { font-family: var(--font-num); font-weight: 700; color: var(--muted); }
.panel-foot { margin-top: 12px; }
.input-xs { width: 84px !important; flex: 0 0 84px !important; }
.inline-form-tight { margin: 0; gap: 4px; }
.standings tr.is-advancing td:first-child { box-shadow: inset 3px 0 0 var(--success); }
.field input[type="file"] { padding: 8px; }

/* ---------- v0.4 activities · talent · reports · dashboard ---------- */
.select-sm { padding: 6px 8px; min-width: 110px; }
.grid-mt { margin-top: 20px; }
.crit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.crit { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 4px; }
.crit-overall { background: var(--accent-soft); border-color: transparent; }
.crit-value { font-size: 22px; font-weight: 700; line-height: 1; }
.crit-label { font-size: 12px; color: var(--muted); }
.crit-meter { width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--muted-bg); overflow: hidden; }
.crit-meter::-webkit-meter-bar { background: var(--muted-bg); border: 0; border-radius: 3px; }
.crit-meter::-webkit-meter-optimum-value, .crit-meter::-webkit-meter-suboptimum-value, .crit-meter::-webkit-meter-even-less-good-value { background: var(--accent); }
.crit-meter::-moz-meter-bar { background: var(--accent); }
.crit-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.crit-inputs .field { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 18px; display: grid; gap: 8px; align-content: start; }
.card h2 { font-size: 16px; margin: 0; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.todo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.todo li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); }
.todo li a { font-weight: 600; }
.todo .muted { font-size: 12px; }
.todo + .stack-form-title, ul.todo + p.stack-form-title { margin-top: 16px; }
.panel > .stack-form-title:first-of-type { margin-top: 0; }

/* ---------- v0.5.3 media uploads ---------- */
.avatar-form { display: flex; gap: 16px; align-items: flex-start; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.avatar-preview { width: 84px; height: 84px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 24px; overflow: hidden; flex: 0 0 84px; border: 1px solid var(--border); }
.avatar-preview.logo { border-radius: 18px; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fields { display: grid; gap: 6px; }
.avatar-fields label { font-weight: 600; font-size: 13px; }
.avatar-fields .btn { justify-self: start; }

/* ---------- v0.6 tryouts ---------- */
.inline-details { display: inline-block; position: relative; }
.inline-details summary { list-style: none; cursor: pointer; }
.inline-details summary::-webkit-details-marker { display: none; }
.decision-form { position: absolute; inset-inline-end: 0; top: 36px; z-index: 5; width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px; display: grid; gap: 8px; box-shadow: 0 12px 30px rgba(15,23,42,.08); }
.decision-form select, .decision-form input { width: 100%; }
.badge-varsity { background: #FEF3C7; color: #92400E; }

/* ---------- ESPOOO official icon library (duotone SVG, never recolored): light tile keeps contrast on navy ---------- */
.nav-item .es-icon, .pnav-item .es-icon, .pbottom-item .es-icon { box-sizing: content-box; padding: 5px; background: #FFFFFF; border-radius: 9px; flex: 0 0 auto; }
.nav-item.is-active .es-icon, .pnav-item.is-active .es-icon { background: #FFFFFF; box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.pbottom-item .es-icon { padding: 3px; background: transparent; }
.pbottom-item.is-active .es-icon { background: var(--es-blue-soft); }
.es-icon { display: inline-block; object-fit: contain; vertical-align: middle; }
.es-icon--16 { width: 16px; height: 16px; } .es-icon--20 { width: 20px; height: 20px; } .es-icon--24 { width: 24px; height: 24px; } .es-icon--32 { width: 32px; height: 32px; } .es-icon--40 { width: 40px; height: 40px; } .es-icon--48 { width: 48px; height: 48px; }

.game-logo-form { display: inline-flex; align-items: center; gap: 4px; } .game-logo-label { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; } .game-logo-input { display: none; } .game-logo-submit { display: none; } .game-logo-form.has-file .game-logo-submit { display: inline-flex; }

/* Lucide inline icons: currentColor. Sidebar (navy) → white; light tiles → navy */
svg.es-icon { display: inline-block; vertical-align: middle; stroke-width: 1.75; flex: 0 0 auto; }
.nav-item svg.es-icon, .pnav-item svg.es-icon { color: #fff; background: transparent; padding: 0; box-shadow: none; }
.nav-item.is-active svg.es-icon { color: #fff; }
.pbottom-item svg.es-icon { color: var(--es-navy); background: transparent; }
.f-tile svg.es-icon, .pkpi svg.es-icon, .pstatus i svg.es-icon, .popp i svg.es-icon, .paction-icon svg.es-icon, .pach div i svg.es-icon, .f-panel svg.es-icon { color: var(--es-blue, #1677FF); }
.pkpi svg.es-icon { background: transparent; padding: 0; color: #fff; }
.pchip svg.es-icon { background: transparent; padding: 0; color: currentColor; }
.f-strip svg.es-icon { color: var(--f-success); }
.reg .badge svg.es-icon { color: var(--r-success); }
