/* ============================================================
   Ibn Sina School — design system
   Palette taken from the logo: deep royal blue + bright sky blue
   Modern, white-forward theme — blue reserved for accents, CTAs,
   and the few surfaces that should feel "branded" (hero, buttons).
   ============================================================ */

:root {
    --navy:       #1726b8;
    --navy-deep:  #0d1789;
    --blue:       #1fa0e8;
    --blue-2:     #4fb8f0;
    --blue-soft:  #eef6fd;
    --blue-tint:  #e3f0fc;

    --ink:        #0d1530;
    --muted:      #667088;
    --bg:         #eef3fa;
    --surface:    #ffffff;
    --surface-2:  #f3f6fb;
    --border:     #e5eaf3;

    --grad:       linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
    --grad-soft:  linear-gradient(135deg, #f4f9fe 0%, #eef5fd 100%);
    --grad-page:  radial-gradient(1200px 760px at 106% -12%, #9bcaf3 0%, transparent 58%),
                  radial-gradient(950px 680px at -10% 6%, #aed3f5 0%, transparent 55%),
                  radial-gradient(1100px 700px at 50% 122%, #bfdcf6 0%, transparent 60%),
                  radial-gradient(900px 620px at 62% 42%, #ffffff 0%, transparent 62%),
                  linear-gradient(180deg, #f2f6fc 0%, #dfebf8 100%);
    --grid-line:  rgba(23,38,184,.10);
    --shadow-sm:  0 1px 2px rgba(13,21,48,.04), 0 3px 10px rgba(13,21,48,.05);
    --shadow-md:  0 14px 32px rgba(13,21,48,.10);
    --shadow-lg:  0 24px 56px rgba(13,21,48,.16);
    --shadow-glow: 0 0 0 4px rgba(31,160,232,.13);

    --radius:     16px;
    --radius-sm:  11px;
    --radius-lg:  22px;
    --maxw:       1140px;

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--ink);
    background-color: var(--bg);
    background-image: var(--grad-page);
    background-repeat: no-repeat;
    background-attachment: fixed;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    position: relative;
}

/* Fading grid-line overlay — sits above the mesh gradient, fades out
   toward the edges so it reads as a design detail, not a texture. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(0deg,  var(--grid-line) 0 1px, transparent 1px 42px),
        repeating-linear-gradient(90deg, var(--grid-line) 0 1px, transparent 1px 42px);
    -webkit-mask-image: radial-gradient(1100px 780px at 50% 28%, #000 0%, transparent 72%);
            mask-image: radial-gradient(1100px 780px at 50% 28%, #000 0%, transparent 72%);
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--blue); }

h1, h2, h3 { line-height: 1.15; letter-spacing: -.025em; margin: 0 0 .4em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: 1.8rem; font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; }
p  { margin: 0 0 1rem; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.eyebrow {
    display: inline-flex; align-items: center; gap: .4em;
    text-transform: uppercase; letter-spacing: .14em; font-size: .76rem;
    font-weight: 700; color: var(--navy);
    background: var(--blue-soft); padding: .35em .9em; border-radius: 999px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: .5em;
    padding: .72em 1.5em; border-radius: 999px; font-weight: 600;
    font-size: .95rem; border: 1px solid transparent; cursor: pointer;
    transition: transform .14s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--shadow-sm), 0 4px 14px rgba(23,38,184,.24); }
.btn-primary:hover { color: #fff; box-shadow: var(--shadow-md), 0 6px 18px rgba(23,38,184,.30); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--navy); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--blue); color: var(--navy); background: var(--blue-soft); transform: translateY(-1px); }
.btn-block { width: 100%; justify-content: center; }
.btn-danger { background: linear-gradient(135deg, #e5484d, #c62d32); color: #fff; box-shadow: 0 4px 14px rgba(229,72,77,.28); }
.btn-sm { padding: .48em 1.1em; font-size: .85rem; }

/* ============================================================
   NAV — shared base for public site header AND portal topbar
   Both use the same light, glassy surface so the two contexts
   feel like one product. The portal keeps a slim brand-gradient
   underline so signed-in users still get a visual cue.
   ============================================================ */
.site-header,
.portal-topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(14px) saturate(1.4);
    border-bottom: 1px solid var(--border);
}
.portal-topbar { box-shadow: 0 1px 0 rgba(13,21,48,.02); }
.portal-topbar::after {
    content: ""; display: block; height: 3px; background: var(--grad);
}

.nav { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.portal-topbar .nav { height: 64px; }

.brand { display: flex; align-items: center; gap: .65rem; color: var(--ink); font-weight: 700; }
.brand img { height: 38px; width: 38px; object-fit: contain; }
.brand-name { font-size: 1.15rem; letter-spacing: -.01em; color: var(--ink); }
.brand-name strong { color: var(--navy); }

.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a { color: var(--ink); font-weight: 500; font-size: .95rem; position: relative; }
.nav-links a:not(.btn)::after {
    content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
    background: var(--grad); border-radius: 2px; transition: right .2s ease;
}
.nav-links a:not(.btn):hover::after { right: 0; }
.nav-links a:hover { color: var(--blue); }

/* Public-site bilingual controls. Persian panels use their own RTL context,
   keeping portal pages and user-entered content unaffected. */
[data-language-copy="fa"] { display: none; }
html[data-public-language="fa"] [data-language-copy="en"] { display: none; }
html[data-public-language="fa"] [data-language-copy="fa"] { display: inline; }
.language-switcher { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.language-button { border: 0; border-radius: 999px; padding: .34rem .65rem; background: transparent; color: var(--muted); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.language-button.active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
.language-panel[hidden] { display: none !important; }
.language-panel[dir="rtl"] { font-family: Tahoma, Arial, sans-serif; text-align: right; }
.language-panel[dir="rtl"] .hero-points li { flex-direction: row-reverse; justify-content: flex-end; }
.language-panel[dir="rtl"] .hero-cta { justify-content: flex-start; }

/* Signed-in user menu — same light chrome as public nav, blue-tinted badge */
.user-menu { display: flex; align-items: center; gap: 1rem; font-size: .92rem; color: var(--ink); min-width: 0; position: relative; }
.user-menu > span:not(.role-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.user-menu .role-badge {
    background: var(--blue-soft); color: var(--navy); padding: .3em .85em; border-radius: 999px;
    font-size: .76rem; text-transform: capitalize; font-weight: 700; border: 1px solid #d9ecfb;
}
.user-menu a { color: var(--ink); opacity: .85; }
.user-menu a:hover { opacity: 1; color: var(--blue); }

/* Compact avatar-style trigger that replaces the inline badge/name/links on
   narrow screens, opening a small dropdown instead of cramming everything
   into the topbar row. Hidden by default; the 900px breakpoint swaps to it. */
.user-menu-toggle {
    display: none; align-items: center; gap: .4rem; background: #fff; border: 1px solid var(--border);
    border-radius: 999px; padding: .3em .5em .3em .9em; cursor: pointer; font: inherit; color: var(--ink);
}
.user-menu-toggle .avatar {
    width: 26px; height: 26px; border-radius: 50%; background: var(--grad); color: #fff;
    display: grid; place-items: center; font-size: .72rem; font-weight: 700; flex: none;
}
.user-menu-toggle .chevron { width: 14px; height: 14px; transition: transform .18s ease; opacity: .6; }
.user-menu-toggle[aria-expanded="true"] .chevron { transform: rotate(180deg); }

.user-menu-dropdown {
    display: none; position: absolute; top: calc(100% + 10px); right: 0; min-width: 200px;
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 8px; z-index: 80;
}
.user-menu-dropdown.open { display: block; }
.user-menu-dropdown .dropdown-id { padding: .5em .7em .7em; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu-dropdown .dropdown-id .name { display: block; font-weight: 600; font-size: .9rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-dropdown a { display: block; padding: .6em .7em; border-radius: var(--radius-sm); font-size: .92rem; opacity: 1; }
.user-menu-dropdown a:hover { background: var(--surface-2); color: var(--navy); }

/* Hamburger button for the off-canvas sidebar drawer — desktop keeps the
   sticky sidebar visible so this stays hidden until the 900px breakpoint. */
.sidebar-toggle {
    display: none; align-items: center; justify-content: center; width: 38px; height: 38px;
    border-radius: var(--radius-sm); border: 1px solid var(--border); background: #fff; cursor: pointer; flex: none;
}
.sidebar-toggle svg { width: 19px; height: 19px; }
.sidebar-overlay {
    display: none; position: fixed; inset: 0; background: rgba(13,21,48,.45); z-index: 65;
    opacity: 0; transition: opacity .2s ease;
}
.sidebar-overlay.open { display: block; opacity: 1; pointer-events: auto; }
.sidebar-head { display: none; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sidebar-close {
    display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 1.1rem; line-height: 1; color: var(--muted);
}
body.no-scroll { overflow: hidden; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 96px 0 80px; }
.hero::before {
    content: ""; position: absolute; inset: 0;
    background-image:
        radial-gradient(1300px 660px at 82% -16%, #a3cff4, transparent 64%),
        radial-gradient(850px 520px at 4% 108%, #e8f2fc, transparent 60%),
        radial-gradient(700px 480px at 55% 40%, #ffffff, transparent 68%);
    z-index: -1;
}
.hero-inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero-text .lead { font-size: 1.2rem; color: var(--muted); max-width: 32em; }
.hero-points {
    display: grid; gap: .5rem; margin: 1.35rem 0 0; padding: 0; list-style: none;
    color: var(--ink); font-weight: 600; font-size: .94rem;
}
.hero-points li { display: flex; align-items: center; gap: .55rem; }
.hero-points li::before {
    content: "✓"; display: grid; place-items: center; width: 1.4rem; height: 1.4rem;
    flex: none; border-radius: 50%; background: var(--blue-soft); color: var(--navy); font-size: .78rem;
}
.hero-cta { display: flex; gap: .8rem; margin-top: 1.6rem; flex-wrap: wrap; }
.hero-art { display: flex; justify-content: center; }
.hero-art img {
    width: min(360px, 80%); filter: drop-shadow(0 24px 46px rgba(23,38,184,.2));
    animation: float 6s ease-in-out infinite;
}
.hero-art .card { min-height: 280px; display: flex !important; flex-direction: column; justify-content: center; }
.hero-card-label { margin: 0 0 .4rem !important; color: var(--navy) !important; font-size: .76rem !important; font-weight: 800; letter-spacing: .14em; }
.hero-card-link { margin-top: 1.15rem; color: var(--navy); font-size: .9rem; font-weight: 700; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }

/* ---------- Sections / cards ---------- */
.section { padding: 68px 0; }
.section-head { text-align: center; max-width: 38em; margin: 0 auto 44px; }
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px; box-shadow: var(--shadow-sm);
    transition: transform .18s ease, box-shadow .22s ease, border-color .2s ease;
    position: relative; overflow: hidden;
}
.card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: var(--grad); opacity: 0; transition: opacity .2s ease;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: #cfe1f8; }
.card:hover::before { opacity: 1; }
.card .icon {
    width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center;
    background: var(--grad); color: #fff; margin-bottom: 16px; font-size: 1.3rem;
    box-shadow: 0 6px 16px rgba(23,38,184,.2);
}
.card h3 { margin-bottom: .35em; }
.card p { color: var(--muted); margin: 0; font-size: .95rem; }

/* ---------- Footer ---------- */
.site-footer {
    background: var(--ink); border-top: 1px solid var(--border);
    padding: 44px 0; margin-top: 64px; color: #aab3cc; font-size: .9rem;
}
.site-footer a { color: #cfd7ec; }
.site-footer a:hover { color: #fff; }
.site-footer .brand-name { color: #fff; }
.site-footer .brand-name strong { color: var(--blue-2); }

/* ---------- Messages ---------- */
.messages { max-width: var(--maxw); margin: 16px auto 0; padding: 0 24px; }
.alert {
    border-radius: var(--radius-sm); padding: .85em 1.15em; margin-bottom: .6rem;
    font-size: .92rem; border: 1px solid transparent; box-shadow: var(--shadow-sm);
}
.alert-success { background: #eefaf2; color: #146c43; border-color: #cdeed9; }
.alert-warning { background: #fff8ea; color: #8a5a00; border-color: #ffe6b3; }
.alert-error, .alert-danger { background: #fdedec; color: #b42318; border-color: #f8d1cf; }
.alert-info { background: var(--blue-soft); color: var(--navy-deep); border-color: #d3ebfb; }

/* ============================================================
   PORTAL (authenticated layout)
   ============================================================ */
.portal-shell { display: grid; grid-template-columns: 240px 1fr; gap: 32px; padding-top: 28px; padding-bottom: 48px; }
.sidebar { position: sticky; top: 92px; align-self: start; transition: transform .25s ease; }
.sidebar h4 {
    text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--muted);
    margin: 18px 0 8px; font-weight: 700;
}
.sidebar a {
    display: block; padding: .6em .85em; border-radius: var(--radius-sm); color: var(--ink);
    font-size: .94rem; font-weight: 500; transition: background .15s ease, color .15s ease;
}
.sidebar a:hover { background: var(--surface-2); color: var(--navy); }
.sidebar a.active { background: var(--blue-soft); color: var(--navy); font-weight: 700; box-shadow: inset 3px 0 0 var(--blue); }

.portal-main { min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 1.9rem; margin: 0; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px; margin-bottom: 28px; }
.stat {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px 24px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat::after {
    content: ""; position: absolute; top: -30px; right: -30px; width: 90px; height: 90px;
    border-radius: 50%; background: var(--blue-soft); z-index: 0;
}
.stat .num, .stat .label { position: relative; z-index: 1; }
.stat .num { font-size: 2.1rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat .label { color: var(--muted); font-size: .88rem; margin-top: 6px; }

/* Panels & lists */
.panel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 24px; overflow: hidden; }
.panel-head {
    padding: 17px 22px; border-bottom: 1px solid var(--border); font-weight: 700; background: var(--grad-soft);
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px;
}
.panel-head-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.panel-body { padding: 8px 22px 18px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.list-row:last-child { border-bottom: 0; }
.list-row .meta { color: var(--muted); font-size: .86rem; }
.empty { color: var(--muted); padding: 26px 0; text-align: center; }
.tag { display: inline-block; font-size: .74rem; font-weight: 600; padding: .22em .75em; border-radius: 999px; background: var(--blue-soft); color: var(--navy); }
.tag.project { background: #f0ecfd; color: #5b32c9; }

/* ============================================================
   FORMS
   ============================================================ */
.auth-wrap { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 40px 24px; }
.auth-wrap::before {
    content: ""; position: fixed; inset: 0; z-index: -1;
    background-color: var(--bg);
    background-image:
        radial-gradient(1000px 580px at 10% 6%, #a9d0f4, transparent 60%),
        radial-gradient(1000px 580px at 94% 94%, #cfe4f9, transparent 60%),
        radial-gradient(700px 460px at 50% 45%, #ffffff, transparent 65%);
}
.auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 38px; }
.auth-card .brand { justify-content: center; margin-bottom: 6px; }
.auth-card h1 { font-size: 1.5rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }

.form-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 30px; max-width: 720px; }
.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.field .errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: #b42318; font-size: .85rem; }

.form-input, .form-select, textarea, input:not([type=checkbox]):not([type=radio]) {
    width: 100%; padding: .7em .9em; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    font: inherit; color: var(--ink); background: var(--surface-2); transition: border .15s ease, box-shadow .15s ease, background .15s ease;
}
.form-input:focus, .form-select:focus, textarea:focus, input:focus {
    outline: none; border-color: var(--blue); background: #fff; box-shadow: var(--shadow-glow);
}
.form-checkbox { width: 18px; height: 18px; accent-color: var(--navy); }
.nonfield-errors { background: #fdedec; color: #b42318; border: 1px solid #f8d1cf; border-radius: var(--radius-sm); padding: .7em 1em; margin-bottom: 16px; font-size: .9rem; }
.form-actions { display: flex; gap: .7rem; margin-top: 8px; }

/* ---------- Required marker, section headers, two-column field grid ----------
   Used by: registration wizard steps AND the admin registration detail page. */
.req { color: #b42318; }
.required-note { color: var(--muted); font-size: .88rem; margin-bottom: 20px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.field-grid .field-full { grid-column: 1 / -1; }

.section-title { display: flex; align-items: center; gap: .7rem; margin-bottom: 4px; }
.section-title .step-num {
    width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff;
    display: grid; place-items: center; font-size: .85rem; font-weight: 700; flex: none;
    box-shadow: 0 4px 12px rgba(23,38,184,.22);
}
.section-sub { color: var(--muted); font-size: .9rem; margin: 0 0 18px 44px; }

/* ---------- Jump-nav sidebar (used on the admin registration detail page) ---------- */
.form-toc { position: sticky; top: 92px; align-self: start; }
.form-toc h4 {
    text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--muted);
    margin: 0 0 8px; font-weight: 700;
}
.form-toc a {
    display: flex; align-items: center; gap: .6rem; padding: .55em .8em; border-radius: var(--radius-sm);
    color: var(--ink); font-size: .92rem; font-weight: 500; margin-bottom: 2px;
}
.form-toc a:hover { background: var(--surface-2); color: var(--navy); }
.form-toc .step-num {
    width: 22px; height: 22px; border-radius: 50%; background: var(--blue-soft); color: var(--navy);
    display: grid; place-items: center; font-size: .74rem; font-weight: 700; flex: none;
}
.form-section { scroll-margin-top: 92px; margin-bottom: 8px; }

/* ---------- Stepper (pagination header on the registration wizard) ---------- */
.stepper { display: flex; justify-content: space-between; margin-bottom: 30px; position: relative; }
.stepper::before {
    content: ""; position: absolute; top: 15px; left: 5%; right: 5%; height: 3px; background: var(--border); z-index: 0; border-radius: 2px;
}
.stepper-step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; cursor: default; }
.stepper-step .circle {
    width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 2px solid var(--border);
    display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: var(--muted);
    transition: all .2s ease;
}
.stepper-step.active .circle { border-color: var(--navy); background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(23,38,184,.26); }
.stepper-step.done { cursor: pointer; }
.stepper-step.done .circle { border-color: var(--blue); background: var(--blue-soft); color: var(--navy); }
.stepper-step .label { font-size: .8rem; color: var(--muted); font-weight: 600; text-align: center; }
.stepper-step.active .label { color: var(--navy); }

/* ---------- Stepper progress fill ---------- */
.stepper-track {
    position: absolute; top: 15px; left: 5%; right: 5%; height: 3px; border-radius: 2px;
    background: var(--border); z-index: 0; overflow: hidden;
}
.stepper-fill {
    position: absolute; top: 0; left: 0; height: 100%; width: 0%;
    background: var(--grad); transition: width .4s ease;
}
.stepper-step .circle { position: relative; }
.stepper-step.active .circle::after {
    content: ""; position: absolute; inset: -6px; border-radius: 50%;
    border: 2px solid var(--blue); opacity: .35; animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
    0%   { transform: scale(.85); opacity: .5; }
    100% { transform: scale(1.4); opacity: 0; }
}

/* ---------- Wizard steps ---------- */
.form-step { display: none; }
.form-step.active { display: block; animation: step-in .25s ease; }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.wizard-nav {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border);
}

/* ---------- Tables ---------- */
.table-wrap { background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); overflow-x:auto; }
table.table { width:100%; border-collapse:collapse; font-size:.94rem; }
.table th, .table td { text-align:left; padding:13px 16px; border-bottom:1px solid var(--border); white-space:nowrap; }
.table th { background:var(--grad-soft); font-size:.76rem; text-transform:uppercase; letter-spacing:.06em; color:var(--navy-deep); font-weight:700; }
.table tr:last-child td { border-bottom:0; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover td { background: var(--blue-soft); }
.table .actions { display:flex; gap:.5rem; justify-content:flex-end; }

/* ---------- Filter bar ---------- */
.filters { display:flex; gap:.6rem; flex-wrap:wrap; align-items:center; margin-bottom:20px; }
.filters input, .filters select { width:auto; min-width:160px; }

/* ---------- Pagination ---------- */
.pagination { display:flex; gap:.9rem; align-items:center; justify-content:center; margin-top:22px; }

/* ---------- Badges ---------- */
.badge { display:inline-block; font-size:.76rem; font-weight:600; padding:.24em .75em; border-radius:999px; background:var(--surface-2); color:var(--muted); border:1px solid var(--border); text-transform:capitalize; }
.badge.green { background:#eefaf2; color:#146c43; border-color:#cdeed9; }
.badge.red   { background:#fdedec; color:#b42318; border-color:#f8d1cf; }
.badge.amber { background:#fff8ea; color:#8a5a00; border-color:#ffe6b3; }
.badge.blue  { background:var(--blue-soft); color:var(--navy); border-color:#d3ebfb; }

/* ---------- Detail ---------- */
.detail-grid .row { display:flex; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--border); }
.detail-grid .row:last-child { border-bottom:0; }
.detail-grid .row > span:first-child { color:var(--muted); }
.prose { max-width:70ch; }
.prose p, .prose { white-space:pre-wrap; }
.confirm { max-width:500px; }
.confirm .warn { color:#b42318; }

/* ---------- Formset rows ---------- */
.formset-row { border:1.5px dashed #c7d6ee; border-radius:var(--radius-sm); padding:16px 18px; margin-bottom:14px; background:var(--surface-2); }
.formset-row .field { margin-bottom:12px; }

/* ---------- Score entry table ---------- */
.scores-table td.name-cell { white-space: normal; min-width: 160px; font-weight: 600; }
.scores-table td.total-cell { text-align: center; font-weight: 700; color: var(--navy); }
.scores-table input[type="number"], .scores-table input[type="text"] { width: 68px; padding: .5em .6em; text-align: center; }

/* ---------- Timetable ---------- */
.timetable { display:grid; gap:14px; }
.tt-day { background:#fff; border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow-sm); padding:14px 20px; border-left: 4px solid var(--blue); }
.tt-day h3 { margin-bottom:8px; }

/* ---------- News ---------- */
.article { max-width:760px; margin:0 auto; }
.article .cover { width:100%; border-radius:var(--radius); margin:18px 0; box-shadow: var(--shadow-md); }
.news-grid .cover { width:100%; height:170px; object-fit:cover; border-radius:var(--radius-sm); margin-bottom:14px; background:var(--surface-2); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; text-align: center; }
    .hero-art { order: -1; }
    .grid-3, .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .portal-shell { grid-template-columns: 1fr; }
    .table .actions { flex-wrap: wrap; }
    .nav-links { gap: .9rem; }
    .nav-links a:not(.btn) { display: none; }
    .language-switcher { margin-left: auto; }
    .form-toc { position: static; display: flex; flex-wrap: wrap; gap: 6px; }
    .form-toc h4 { width: 100%; }
    .field-grid { grid-template-columns: 1fr; }
    .container { padding: 0 16px; }
    .nav { height: auto; min-height: 64px; padding: 10px 0; gap: 10px; }
    .form-card, .auth-card { padding: 22px; }
    .table th, .table td { padding: 10px 12px; font-size: .88rem; }

    /* Sidebar becomes an off-canvas drawer, opened via the hamburger button
       in the topbar, instead of squeezing every link into the page flow. */
    .sidebar-toggle { display: inline-flex; }
    .sidebar-overlay { display: block; pointer-events: none; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 84vw;
        background: #fff; z-index: 70; padding: 18px 16px; margin: 0;
        overflow-y: auto; -webkit-overflow-scrolling: touch;
        box-shadow: var(--shadow-lg); transform: translateX(-105%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-head { display: flex; }

    /* User info collapses into a single avatar button + dropdown so the
       topbar doesn't have to fit badge + name + Profile + Logout in a row. */
    .user-menu > .role-badge, .user-menu > span:not(.role-badge), .user-menu > a { display: none; }
    .user-menu-toggle { display: inline-flex; }
}

@media (max-width: 640px) {
    .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .stepper .label { display: none; }
    .stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
    .stat { padding: 16px 18px; }
    .stat .num { font-size: 1.6rem; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .list-row { flex-direction: column; align-items: flex-start; gap: 6px; }
    .list-row .btn-sm { align-self: flex-end; }
    .wizard-nav { flex-wrap: wrap; gap: 10px; }
    .detail-grid .row { flex-direction: column; gap: 4px; }
    h1 { font-size: clamp(1.7rem, 8vw, 2.4rem); }
    .portal-topbar .nav { height: auto; padding: 10px 16px; gap: 8px; }
    .portal-topbar .brand { min-width: 0; flex: 1; }
    .portal-topbar .brand-name { font-size: .95rem; }
    .portal-topbar .user-menu, .portal-topbar .sidebar-toggle { flex-shrink: 0; }
    .portal-shell { padding-top: 14px; }
    .language-button { padding: .32rem .55rem; }
    .language-panel[dir="rtl"] .hero-points li { justify-content: center; }
    .language-panel[dir="rtl"] .hero-cta { justify-content: center; }
}
