/* FST Registration - styles */
:root {
    --primary: #0b5394;
    --primary-dark: #062f57;
    --primary-soft: #eaf2fb;
    --on-primary: #ffffff;
    --accent: #ffb300;
    --success: #1e8e3e;
    --danger: #c62828;
    --info: #0277bd;
    --pink: #c2185b;
    --success-soft: #e8f5e9; --success-text: #1b5e20; --success-line: #a5d6a7;
    --danger-soft: #fdecea;  --danger-text: #8e1c1c;  --danger-line: #f5b5b0;
    --info-soft: #e3f2fd;    --info-text: #0d47a1;    --info-line: #90caf9;
    --pink-soft: #fce4ec;
    --bg: #f1f4f9;
    --card: #ffffff;
    --surface-2: #f6f8fb;
    --hover: #eef2f7;
    --text: #1f2933;
    --muted: #66788a;
    --border: #dde3ea;
    --shadow: 0 1px 3px rgba(16, 42, 67, .05), 0 6px 18px rgba(16, 42, 67, .04);
    --shadow-lg: 0 18px 48px rgba(16, 42, 67, .18);
    --sidebar-from: #062f57;
    --sidebar-to: #0b5394;
    --radius: 14px;
    --sidebar-w: 256px;
    --sidebar-mini: 74px;
    --topbar-h: 64px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --primary: #5aa6ef;
    --primary-dark: #2f7fcb;
    --primary-soft: #16304b;
    --on-primary: #0b1724;
    --success: #4caf6a;
    --danger: #ef5350;
    --info: #4fb3f0;
    --pink: #f06292;
    --success-soft: #133222; --success-text: #a5e0b5; --success-line: #2a6040;
    --danger-soft: #3a1717;  --danger-text: #f5b5b0;  --danger-line: #6b2a2a;
    --info-soft: #11304a;    --info-text: #a8d6ff;    --info-line: #24527a;
    --pink-soft: #3a1a29;
    --bg: #0e1621;
    --card: #16202c;
    --surface-2: #1b2735;
    --hover: #223144;
    --text: #e4ebf3;
    --muted: #92a3b6;
    --border: #2a394b;
    --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .2);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, .5);
    --sidebar-from: #0a1420;
    --sidebar-to: #12263d;
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    transition: background .25s, color .25s;
}

a { color: var(--primary); }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 1.05rem; color: var(--primary); }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.req { color: var(--danger); }
.narrow { max-width: 480px; margin: 0 auto; }
.narrow-md { max-width: 860px; margin: 0 auto; }
.push-right { margin-left: auto; }

.icon {
    width: 1.1em; height: 1.1em; flex-shrink: 0;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
    vertical-align: -.17em;
}

/* =========================================================
   Sidebar
   ========================================================= */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--sidebar-from) 0%, var(--sidebar-to) 100%);
    color: #fff;
    overflow-x: hidden; overflow-y: auto;
    transition: width .22s ease, transform .28s cubic-bezier(.2, .8, .2, 1);
}
.brand {
    display: flex; align-items: center; gap: 12px;
    height: var(--topbar-h); padding: 0 17px; flex-shrink: 0;
    color: #fff; text-decoration: none; white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.brand-logo {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    min-width: 40px; height: 40px; padding: 0 6px; border-radius: 11px; white-space: nowrap;
    background: #fff; color: #0b5394; font-weight: 800; font-size: .85rem; letter-spacing: .5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}
.brand-text small { display: block; opacity: .7; font-size: .75rem; }

.side-nav { flex: 1; padding: 8px 12px 16px; }
.side-title {
    margin: 18px 10px 6px; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px; opacity: .55; white-space: nowrap;
}
.side-nav a {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 3px; border-radius: 10px;
    color: rgba(255, 255, 255, .85); text-decoration: none; white-space: nowrap;
    transition: background .15s, color .15s, transform .15s;
}
.side-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; transform: translateX(3px); }
.side-nav a.active { background: #fff; color: #0b5394; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
:root[data-theme="dark"] .side-nav a.active { background: var(--primary); color: var(--on-primary); }
.side-nav a.logout:hover { background: rgba(198, 40, 40, .6); }
.nav-icon { width: 24px; flex-shrink: 0; display: inline-flex; justify-content: center; font-size: 1.1rem; }
.side-foot { padding: 14px 18px; font-size: .72rem; opacity: .6; border-top: 1px solid rgba(255, 255, 255, .12); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Collapsed sidebar (desktop) */
.sidebar-collapsed .sidebar { width: var(--sidebar-mini); }
.sidebar-collapsed .brand-text,
.sidebar-collapsed .side-nav a span:last-child,
.sidebar-collapsed .side-foot { display: none; }
.sidebar-collapsed .side-title { visibility: hidden; height: 0; margin: 10px 0; }
.sidebar-collapsed .side-nav a { justify-content: center; padding: 11px 0; }
.sidebar-collapsed .side-nav a:hover { transform: none; }

.sidebar-overlay { display: none; }

/* =========================================================
   Main + Topbar
   ========================================================= */
.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left .22s ease;
}
.sidebar-collapsed .main { margin-left: var(--sidebar-mini); }

.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 14px;
    padding: 0 24px;
    background: color-mix(in srgb, var(--card) 88%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}
.icon-btn {
    width: 40px; height: 40px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border); border-radius: 10px; background: var(--card);
    color: var(--primary); font-size: 1.15rem; cursor: pointer;
    transition: background .15s, transform .15s;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(.94); }
.topbar-title { flex: 1; margin: 0; font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.theme-btn span { display: inline-flex; }
.theme-btn .theme-dark { display: none; }
:root[data-theme="dark"] .theme-btn .theme-dark { display: inline-flex; }
:root[data-theme="dark"] .theme-btn .theme-light { display: none; }
.theme-btn.spin .icon { animation: spin .5s ease; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; font-weight: 700;
}
.avatar.sm { width: 34px; height: 34px; font-size: .85rem; }
.user-name { font-weight: 600; font-size: .9rem; }

/* Thin loading bar under the topbar while navigating */
.page-loader {
    position: fixed; top: 0; left: 0; z-index: 100; height: 3px; width: 0;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    box-shadow: 0 0 8px var(--accent);
    transition: width .4s ease, opacity .3s;
}
.page-loader.run { width: 80%; transition: width 6s cubic-bezier(.1, .7, .2, 1); }

.content { flex: 1; padding: 24px; width: 100%; }
.footer { padding: 14px 24px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--border); background: var(--card); }

/* =========================================================
   Login
   ========================================================= */
body.auth {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px 16px;
    background: linear-gradient(135deg, #062f57, #0b5394 60%, #1976d2);
    overflow-x: hidden;
}
:root[data-theme="dark"] body.auth { background: linear-gradient(135deg, #050c14, #0a1d33 60%, #12345a); }
.auth-bg span {
    position: fixed; border-radius: 50%; filter: blur(2px); opacity: .18;
    background: radial-gradient(circle at 30% 30%, #fff, transparent 70%);
    animation: float 14s ease-in-out infinite;
}
.auth-bg span:nth-child(1) { width: 380px; height: 380px; top: -120px; left: -100px; }
.auth-bg span:nth-child(2) { width: 260px; height: 260px; bottom: -80px; right: 8%; animation-delay: -4s; background: radial-gradient(circle at 30% 30%, var(--accent), transparent 70%); }
.auth-bg span:nth-child(3) { width: 180px; height: 180px; top: 20%; right: -40px; animation-delay: -8s; }
.auth-wrap {
    position: relative;
    width: 100%; max-width: 900px;
    display: grid; grid-template-columns: 1fr 1fr;
    background: var(--card); border-radius: 20px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    animation: popIn .5s cubic-bezier(.2, .8, .2, 1) both;
}
.auth-side {
    padding: 48px 40px; color: #fff;
    background: linear-gradient(160deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, 0)), #062f57;
    display: flex; flex-direction: column; justify-content: center;
}
.auth-side h1 { font-size: 1.6rem; margin: 22px 0 12px; }
.auth-side p { opacity: .85; margin: 0 0 10px; }
.auth-year { display: inline-block; align-self: flex-start; background: var(--accent); color: #1f2933; font-weight: 700; padding: 4px 12px; border-radius: 20px; font-size: .85rem; opacity: 1 !important; }
.brand-logo.big { min-width: 64px; height: 64px; padding: 0 10px; font-size: 1.2rem; border-radius: 16px; align-self: flex-start; }
.summary-card .card-head { align-items: flex-start; margin-bottom: 14px; }
.section-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.section-title h2 { margin: 0; }
.section-title p { margin: 2px 0 0; font-size: .85rem; }
.summary-card .institution-preview, .summary-card .support-preview { margin-bottom: 0; }
.empty-note { margin: 0; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border); font-size: .9rem; }
.institution-preview { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; background: var(--primary-soft); }
.institution-preview .brand-logo { background: #0b5394; color: #fff; box-shadow: none; }
.institution-preview > div { display: flex; flex-direction: column; min-width: 0; }
.institution-preview small { color: var(--muted); }
.auth-form { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { margin: 0 0 4px; font-size: 1.5rem; color: var(--text); }
.auth-form .muted { margin: 0 0 20px; }

/* =========================================================
   Cards, hero, stats, lists
   ========================================================= */
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; margin-bottom: 20px; box-shadow: var(--shadow);
    transition: background .25s, border-color .25s, box-shadow .2s;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.grid-2, .grid-3 { display: grid; gap: 0 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2.gap { gap: 20px; align-items: start; margin-bottom: 20px; }
.grid-2.gap > .card { margin-bottom: 0; }
.grid-auto { display: grid; gap: 0 18px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.span-2 { grid-column: span 2; }

.hero {
    position: relative; overflow: hidden;
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 18px;
    padding: 26px 28px; margin-bottom: 20px; border-radius: var(--radius); color: #fff;
    background: linear-gradient(120deg, #062f57, #0b5394 55%, #1976d2);
    box-shadow: var(--shadow);
}
.hero::after {
    content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 179, 0, .35), transparent 70%);
    animation: float 12s ease-in-out infinite;
}
.hero h2 { color: #fff; font-size: 1.45rem; margin: 0 0 4px; }
.hero p { margin: 0; opacity: .85; }
.hero-clock { font-size: .85rem; margin-top: 8px !important; font-variant-numeric: tabular-nums; }
.hero-actions { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    --tone: var(--primary); --tone-soft: var(--primary-soft);
    display: flex; align-items: center; gap: 14px;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; color: var(--muted); font-size: .85rem; box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat strong { display: block; font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-icon {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem;
    background: var(--tone-soft); color: var(--tone);
}
.stat.success { --tone: var(--success); --tone-soft: var(--success-soft); }
.stat.info { --tone: var(--info); --tone-soft: var(--info-soft); }
.stat.pink { --tone: var(--pink); --tone-soft: var(--pink-soft); }

.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); border-radius: 8px; transition: background .15s; }
.list li:hover { background: var(--hover); }
.list li:last-child { border-bottom: 0; }
.list li > div { display: flex; flex-direction: column; min-width: 0; }
.list a { text-decoration: none; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; }
.link-more:hover .icon { transform: translateX(4px); }
.link-more .icon { transition: transform .2s; }

.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty > .icon { font-size: 2.4rem; opacity: .5; }
.empty p { margin: 8px 0 14px; }

.bar-row { display: grid; grid-template-columns: 80px 1fr 36px; gap: 10px; align-items: center; margin-bottom: 10px; font-size: .85rem; }
.bar { background: var(--hover); border-radius: 6px; height: 12px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #42a5f5); border-radius: 6px; transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.bar-value { text-align: right; font-weight: 700; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: .78rem; font-weight: 600; }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-pink { background: var(--pink-soft); color: var(--pink); }

/* =========================================================
   Forms & buttons
   ========================================================= */
.field { margin-bottom: 16px; display: flex; flex-direction: column; min-width: 0; }
label { font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=password],
input[type=search], select, textarea {
    width: 100%; min-height: 42px; padding: 10px 12px; font: inherit; color: inherit;
    border: 1px solid var(--border); border-radius: 10px; background: var(--card);
    transition: border-color .15s, box-shadow .15s, background .25s;
}
input:hover, select:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent); }
input.upper { text-transform: uppercase; }
input.upper::placeholder { text-transform: none; }
.is-invalid { border-color: var(--danger) !important; }
.field .is-invalid:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
.is-valid { border-color: var(--success); }
.error { color: var(--danger); font-size: .8rem; margin-top: 5px; animation: fadeIn .2s ease; }
.error:empty { display: none; }
.hint { color: var(--muted); font-size: .78rem; margin-top: 5px; }
.hint:empty { display: none; }
.radios { display: flex; gap: 10px; border: 1px solid transparent; border-radius: 10px; }
.radio {
    flex: 1; display: flex; align-items: center; gap: 8px; margin: 0; min-height: 42px; padding: 9px 12px;
    font-weight: normal; border: 1px solid var(--border); border-radius: 10px; background: var(--card); cursor: pointer;
    transition: border-color .15s, background .15s;
}
.radio:hover { border-color: var(--primary); }
.radio:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.radio input { accent-color: var(--primary); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; cursor: pointer;
    transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--primary); background: var(--hover); }
.pw-toggle span { display: inline-flex; }
.pw-toggle .eye-hide { display: none; }
.pw-toggle.on { color: var(--primary); }
.pw-toggle.on .eye-show { display: none; }
.pw-toggle.on .eye-hide { display: inline-flex; animation: popIn .2s ease; }
.caps-warning { color: var(--accent); font-weight: 600; }
:root:not([data-theme="dark"]) .caps-warning { color: #b26a00; }

.strength { height: 5px; border-radius: 4px; background: var(--hover); margin-top: 8px; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .3s, background .3s; }

.btn {
    position: relative; overflow: hidden;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; font: inherit; font-weight: 600; line-height: 1.4;
    border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text);
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, transform .12s, box-shadow .15s, border-color .15s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .7; cursor: wait; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 6px 16px color-mix(in srgb, var(--primary) 35%, transparent); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: color-mix(in srgb, var(--success) 82%, #000); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 82%, #000); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #1f2933; }
.btn-accent:hover { background: #ffc233; box-shadow: 0 6px 16px rgba(255, 179, 0, .4); }
.btn-ghost { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn-ghost:hover { background: rgba(255, 255, 255, .22); }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-block { display: flex; width: 100%; margin-top: 6px; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading > .icon { display: none; }
.btn.is-loading::before {
    content: ""; width: 1em; height: 1em; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite;
}
.ripple {
    position: absolute; border-radius: 50%; pointer-events: none;
    background: currentColor; opacity: .25; transform: scale(0);
    animation: ripple .6s ease-out forwards;
}
.link-btn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; text-decoration: underline; }
form.inline { display: inline; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: var(--success-soft); border-color: var(--success-line); color: var(--success-text); }
.alert-danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.alert-info { background: var(--info-soft); border-color: var(--info-line); color: var(--info-text); }
.shake { animation: shake .36s cubic-bezier(.36, .07, .19, .97) both; }
input.shake, select.shake, .radios.shake, .pw-wrap.shake input, .combo.shake input, .input-prefix.shake input {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent);
}

/* Mouse-follow light on cards */
.card.glow, .stat.glow, .format-card.glow {
    background-image: radial-gradient(420px circle at var(--mx) var(--my), color-mix(in srgb, var(--primary) 8%, transparent), transparent 45%);
}
.stat { transition: transform .15s ease-out, box-shadow .2s; }

/* Table rows slide in */
.row-in { animation: rowIn .4s cubic-bezier(.2, .8, .2, 1) both; }

.confetti { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.particles { position: fixed; inset: 0; width: 100%; height: 100%; }

.to-top {
    position: fixed; right: 20px; bottom: 20px; z-index: 90;
    width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem;
    background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-lg);
    opacity: 0; transform: translateY(16px) scale(.8); pointer-events: none;
    transition: opacity .25s, transform .25s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); }

/* =========================================================
   Registration form (full width)
   ========================================================= */
.reg-form { width: 100%; }
.reg-progress {
    position: sticky; top: calc(var(--topbar-h) + 10px); z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
    padding: 14px 22px;
}
.reg-progress-text { display: flex; flex-direction: column; }
.reg-progress-text .muted { font-size: .85rem; }
.progress-wrap { display: flex; align-items: center; gap: 12px; flex: 0 1 360px; min-width: 200px; }
.progress { flex: 1; height: 10px; border-radius: 10px; background: var(--hover); overflow: hidden; }
.progress span {
    display: block; height: 100%; width: 0; border-radius: 10px;
    background: linear-gradient(90deg, var(--primary), #42a5f5, var(--success));
    background-size: 200% 100%;
    transition: width .45s cubic-bezier(.2, .8, .2, 1);
    animation: shimmer 2.5s linear infinite;
}
.progress-label {
    display: inline-block; font-weight: 800; color: var(--primary); min-width: 52px; text-align: right;
    font-variant-numeric: tabular-nums; transition: color .3s;
}
/* Spinning ring around the % */
.progress-ring { position: relative; width: 62px; height: 62px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.progress-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 4.5; }
.ring-track { stroke: var(--hover); }
.ring-fill { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2, .8, .2, 1), stroke .3s; }
.progress-ring .progress-label { position: relative; min-width: 0; text-align: center; font-size: .82rem; }
.progress-ring.spin svg { animation: ringSpin .8s cubic-bezier(.35, .1, .25, 1); }
.progress-ring.spin-back svg { animation: ringSpinBack .8s cubic-bezier(.35, .1, .25, 1); }
@keyframes ringSpin { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
@keyframes ringSpinBack { from { transform: rotate(-90deg); } to { transform: rotate(-450deg); } }
.reg-progress.is-complete .ring-fill { stroke: var(--success); filter: drop-shadow(0 0 4px color-mix(in srgb, var(--success) 60%, transparent)); }
.reg-progress.is-complete .progress-ring .progress-label::after { content: ""; }
.reg-progress.is-complete .progress-ring::after {
    content: "\2713"; position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800;
    background: var(--success); color: #fff; box-shadow: 0 0 0 3px var(--card); animation: popIn .3s ease;
}

/* The filling bar only: diagonal stripes that keep moving, and a light that sweeps across it */
.progress span { position: relative; overflow: hidden; }
.progress span::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit;
    background-image: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .22) 0 8px, transparent 8px 16px);
    background-size: 22.6px 22.6px;
    animation: barStripes .8s linear infinite;
}
.progress span::after {
    content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 50%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
    transform: skewX(-20deg);
    animation: barShine 2.2s ease-in-out infinite;
}
@keyframes barStripes { from { background-position: 0 0; } to { background-position: 22.6px 0; } }
@keyframes barShine { 0% { left: -60%; } 60%, 100% { left: 130%; } }
.progress-label.bump { animation: pctBump .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pctBump { 0% { transform: scale(1); } 40% { transform: scale(1.35); } 100% { transform: scale(1); } }
/* 100%: green number with a tick and a glowing bar */
.reg-progress.is-complete .progress-label { color: var(--success); }
.reg-progress.is-complete .progress-label::after { content: " \2713"; }
.reg-progress.is-complete .progress span { box-shadow: 0 0 12px color-mix(in srgb, var(--success) 60%, transparent); }

.form-section { padding: 24px 26px 10px; }
.section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.section-head h2 { margin: 0; }
.section-head p { margin: 2px 0 0; font-size: .85rem; }
.step {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: 1.05rem;
    transition: background .3s, color .3s, transform .3s;
}
.step.done { background: var(--success); color: #fff; transform: scale(1.06); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; }

/* =========================================================
   Table & student details
   ========================================================= */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.search-box { position: relative; flex: 1; min-width: 220px; }
.search-box > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box input { padding-left: 38px; }
/* Live search: spinner while results load, highlighted matches */
.search-box.searching > .icon { animation: pulse-icon .8s ease-in-out infinite; color: var(--primary); }
@keyframes pulse-icon { 50% { opacity: .3; } }
mark.hit { background: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.users-search { min-width: 220px; }
.users-search .search-box input { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
.filters select { width: auto; }
.filters-export { display: flex; gap: 8px; margin-left: auto; }
.result-count { margin: 0 0 10px; font-size: .9rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table th { background: var(--surface-2); font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); user-select: none; }
.table th[data-sort] { cursor: pointer; }
.table th[data-sort]:hover { color: var(--primary); }
.table th.sort-asc::after { content: " \25B2"; font-size: .65rem; }
.table th.sort-desc::after { content: " \25BC"; font-size: .65rem; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--hover); }
.cell-action { text-align: right !important; }
.pagination { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 14px; }
.pagination a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; transition: background .15s; }
.pagination a:hover { background: var(--hover); }
.pagination a.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

.slip-head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid var(--primary); padding-bottom: 12px; margin-bottom: 14px; }
.slip-head .brand-logo { background: #0b5394; color: #fff; }
.slip-head h2 { margin: 0 0 2px; }
.slip-head p { margin: 0; color: var(--muted); }
.slip-reg { background: var(--primary-soft); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 1.05rem; }
.details { width: 100%; border-collapse: collapse; font-size: .92rem; }
.details th, .details td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.details th { background: var(--surface-2); width: 35%; font-weight: 600; }

/* =========================================================
   Toasts & modal
   ========================================================= */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast {
    position: relative; overflow: hidden;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 13px 40px 13px 14px; border-radius: 12px;
    background: var(--card); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    animation: toastIn .35s cubic-bezier(.2, .8, .2, 1) both;
}
.toast.out { animation: toastOut .3s ease forwards; }
.toast .icon { font-size: 1.2rem; margin-top: 1px; color: var(--primary); }
.toast-success { border-left-color: var(--success); }
.toast-success .icon { color: var(--success); }
.toast-danger { border-left-color: var(--danger); }
.toast-danger .icon { color: var(--danger); }
.toast-close { position: absolute; top: 8px; right: 8px; border: 0; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; line-height: 1; padding: 4px; }

.modal-backdrop {
    position: fixed; inset: 0; z-index: 150; padding: 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(8, 20, 35, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    animation: fadeIn .2s ease;
}
.modal {
    width: min(420px, 100%); padding: 24px; border-radius: 16px;
    background: var(--card); color: var(--text); box-shadow: var(--shadow-lg);
    animation: popIn .25s cubic-bezier(.2, .8, .2, 1);
}
.modal h3 { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; }
.modal h3 .icon { color: var(--danger); font-size: 1.4rem; }
.modal p { color: var(--muted); margin: 0 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* =========================================================
   User menu
   ========================================================= */
.user-menu { position: relative; }
.user-btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px;
    border: 1px solid var(--border); border-radius: 30px; background: var(--card); color: var(--text);
    font: inherit; cursor: pointer; transition: background .15s, box-shadow .15s;
}
.user-btn:hover, .user-menu.open .user-btn { background: var(--hover); }
.user-btn > .icon { color: var(--muted); transition: transform .2s; }
.user-menu.open .user-btn > .icon { transform: rotate(180deg); }
.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 250px; padding: 6px;
    background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
    animation: dropIn .18s ease;
}
.dropdown-head { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.dropdown-head > div { display: flex; flex-direction: column; min-width: 0; }
.dropdown-head small { color: var(--muted); }
.dropdown a {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px;
    color: var(--text); text-decoration: none; font-weight: 500;
}
.dropdown a:hover, .dropdown a:focus { background: var(--hover); outline: none; }
.dropdown a .icon { color: var(--muted); }
.dropdown a.danger { color: var(--danger); }
.dropdown a.danger .icon { color: var(--danger); }
.dropdown a.danger:hover, .dropdown a.danger:focus { background: var(--danger-soft); }

/* =========================================================
   Programme search (combobox), money input, layout helpers
   ========================================================= */
.grid-reg { display: grid; gap: 0 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reg-form .grid-2.gap { align-items: stretch; }
.grid-users { display: grid; gap: 20px; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); align-items: start; }
.grid-users > .card { margin-bottom: 0; }

.combo { position: relative; }
.combo input { padding-left: 38px; padding-right: 40px; }
.combo-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: inline-flex; pointer-events: none; }
.combo-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    width: 34px; height: 34px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.combo-toggle:hover { background: var(--hover); }
.combo.open .combo-toggle .icon { transform: rotate(180deg); }
.combo-toggle .icon { transition: transform .2s; }
.combo-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50;
    max-height: 300px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
    background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg);
    animation: dropIn .15s ease;
}
.combo-item {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 9px 12px; border-radius: 8px; cursor: pointer; line-height: 1.35;
}
.combo-item small { flex-shrink: 0; color: var(--muted); font-weight: 600; font-size: .78rem; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; }
.combo-item.active, .combo-item:hover { background: var(--primary-soft); }
.combo-item mark { background: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.combo-new { color: var(--success); border-top: 1px dashed var(--border); margin-top: 4px; }
.combo-empty { padding: 12px; color: var(--muted); font-size: .88rem; }
.hint-new { color: var(--success); font-weight: 600; }
.optional { color: var(--muted); font-weight: 400; font-size: .8rem; }

/* Edit mode: fields the admin has corrected */
.field.changed > label::after {
    content: "edited"; margin-left: 8px; padding: 1px 8px; border-radius: 10px;
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    background: color-mix(in srgb, var(--accent) 25%, transparent); color: #8a5a00;
    animation: popIn .2s ease;
}
:root[data-theme="dark"] .field.changed > label::after { color: var(--accent); }
.field.changed input, .field.changed select { border-color: var(--accent); }
.reg-progress-text strong { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-icon { padding: 6px 9px; }

/* Users page */
.badge-gold { background: color-mix(in srgb, var(--accent) 22%, transparent); color: #8a5a00; }
:root[data-theme="dark"] .badge-gold { color: var(--accent); }
.radios-stack { flex-direction: column; gap: 8px; }
.radios-stack .radio { align-items: flex-start; }
.radios-stack .radio input { margin-top: 4px; }
.radios-stack .radio span { display: flex; flex-direction: column; }
.radios-stack .radio small { color: var(--muted); font-weight: 400; font-size: .8rem; }
.role-fixed { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin: 0; }
.form-buttons { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.form-buttons .btn-primary { flex: 1; }
.card-editing { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent), var(--shadow); }
.row-editing { background: color-mix(in srgb, var(--accent) 10%, transparent) !important; }
.cell-action .btn + .btn, .cell-action .btn + form { margin-left: 4px; }
.table td.cell-action { width: 1%; white-space: nowrap; }
.table td.cell-name { white-space: normal; min-width: 140px; }
.account-grid { max-width: 1100px; }

/* First login: choose your own password */
.first-login { max-width: 520px; margin: 10px auto 0; }
.first-login-head { text-align: center; margin-bottom: 18px; }
.first-login-head h2 { font-size: 1.4rem; margin: 10px 0 6px; color: var(--text); }
.first-login-head p { margin: 0; color: var(--muted); }
.first-login-icon {
    display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%;
    font-size: 1.7rem; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 24px color-mix(in srgb, var(--primary) 35%, transparent);
}
.first-login-out { margin: 14px 0 0; text-align: center; font-size: .9rem; }
.first-login-out a { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pw-first-login { display: flex; align-items: center; gap: 6px; color: var(--primary); }

/* Users page with the add / edit modal */
.users-head { flex-wrap: wrap; }
.users-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.modal-md { width: min(600px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-title { display: flex; align-items: center; gap: 12px; }
.modal-title h3 { margin: 0; }
.modal-title p { margin: 2px 0 0; font-size: .85rem; }
.modal .role-fixed { margin: 0; color: inherit; }
.modal .modal-actions { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--border); }
@media (max-width: 700px) {
    .modal-md { padding: 18px; max-height: calc(100vh - 16px); }
    .users-tools { width: 100%; justify-content: space-between; }
}

/* Settings: system lock & suspended accounts */
.settings-grid { display: grid; gap: 20px; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); align-items: start; }
.settings-grid > .card { margin-bottom: 0; }
textarea { width: 100%; padding: 10px 12px; font: inherit; color: inherit; border: 1px solid var(--border); border-radius: 10px; background: var(--card); resize: vertical; }
.lock-status { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-bottom: 16px; border-radius: 12px; }
.lock-status > div { display: flex; flex-direction: column; }
.lock-status small { margin-top: 2px; }
.is-open .lock-status { background: var(--success-soft); color: var(--success-text); }
.is-locked .lock-status { background: var(--danger-soft); color: var(--danger-text); }
.status-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 25%, transparent); animation: pulse 2s ease-in-out infinite; }
.is-locked .status-dot { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 25%, transparent); }
.is-locked { border-color: var(--danger-line); }
.is-locked .lock-icon { background: var(--danger); color: #fff; }
.alert-warning { background: color-mix(in srgb, var(--accent) 16%, var(--card)); border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--text); }
.lock-banner { display: flex; align-items: center; gap: 12px; }
.lock-banner > .icon { font-size: 1.3rem; color: #b26a00; flex-shrink: 0; }
.lock-banner > div { display: flex; flex-direction: column; flex: 1; }
.lock-banner small { color: var(--muted); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-success { background: var(--success-soft); color: var(--success); }
.row-suspended td { opacity: .7; }
.row-suspended td.cell-action { opacity: 1; }
.text-danger { color: var(--danger); font-weight: 600; }
.small-text { font-size: .85rem; margin: 2px 0 0; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px transparent; } }

/* Register / Import tabs */
.page-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; }
.page-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 9px; color: var(--muted); font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s, color .15s; }
.page-tabs a:hover { background: var(--hover); color: var(--text); }
.page-tabs a.active { background: var(--primary); color: var(--on-primary); }

/* Import */
.import-grid { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
.import-grid > .card { margin-bottom: 0; }
.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    padding: 34px 18px; margin: 0 0 18px; text-align: center; cursor: pointer; font-weight: normal;
    border: 2px dashed var(--border); border-radius: 16px; background: var(--surface-2);
    transition: border-color .15s, background .15s;
}
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--success); background: var(--success-soft); }
.dropzone.is-invalid { border-color: var(--danger); background: var(--danger-soft); }
.dropzone-icon { width: 54px; height: 54px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.5rem; background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.dropzone.has-file .dropzone-icon { color: var(--success); }
.dropzone strong { overflow-wrap: anywhere; }
.sample-table td, .sample-table th { font-size: .8rem; }
.import-rules { margin: 14px 0 16px; padding-left: 20px; color: var(--muted); font-size: .9rem; }
.import-rules li { margin-bottom: 6px; }
.import-rules strong { color: var(--text); }
.import-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.summary-chip {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; cursor: pointer;
    border: 1px solid var(--border); background: var(--card); color: var(--muted); font: inherit; font-size: .9rem;
}
.summary-chip strong { font-size: 1.15rem; color: var(--text); }
.summary-chip.active { border-color: var(--primary); background: var(--primary-soft); }
.chip-ok strong { color: var(--success); }
.chip-error strong { color: var(--danger); }
.chip-dup strong { color: #b26a00; }
.import-table-wrap { max-height: 60vh; overflow: auto; }
.import-table th { position: sticky; top: 0; z-index: 1; }
.import-table .cell-status { white-space: normal; min-width: 170px; max-width: 240px; }
.import-table .cell-status small { display: block; color: var(--muted); font-size: .78rem; margin-top: 3px; }
.import-table .cell-wrap { min-width: 180px; }
.import-error .cell-status small { color: var(--danger); }
.import-error td { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.import-duplicate td { opacity: .75; }
.import-actions { justify-content: space-between; padding: 16px 0 0; margin-top: 14px; border-top: 1px solid var(--border); }
.import-actions form { display: contents; }
@media (max-width: 1000px) { .import-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 700px) {
    .page-tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
    .page-tabs a { justify-content: center; text-align: center; white-space: normal; line-height: 1.25; padding: 9px 8px; font-size: .85rem; }
    .import-table .cell-status { max-width: none; }
    .import-table-wrap { max-height: none; }
    .import-actions { flex-direction: column-reverse; }
    .import-actions .btn { width: 100%; }
}

/* Backup & Restore */
.backup-grid { display: grid; gap: 20px; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); align-items: start; }
.backup-grid > .card { margin-bottom: 0; }
.backup-side { display: flex; flex-direction: column; gap: 20px; }
.backup-side > .card { margin-bottom: 0; }
.backup-status { display: flex; gap: 12px; align-items: flex-start; padding: 14px; margin-bottom: 16px; border-radius: 12px; }
.backup-status > div { display: flex; flex-direction: column; }
.backup-status.is-fresh { background: var(--success-soft); color: var(--success-text); }
.backup-status.is-old { background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.backup-status.is-old .status-dot { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.backup-tip { margin: 12px 0 0; }
.backup-note { margin: 12px 0 0; }
.dropzone-sm { padding: 20px 14px; margin-bottom: 14px; }
.dropzone-sm .dropzone-icon { width: 42px; height: 42px; font-size: 1.2rem; }
.row-new td { background: var(--success-soft); }
.auto-status { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 12px; }
.auto-status > div { display: flex; flex-direction: column; gap: 2px; }
.auto-status.is-on { background: var(--success-soft); color: var(--success-text); }
.auto-status.is-off { background: var(--surface-2); color: var(--muted); }
.auto-status.is-off .status-dot { background: var(--muted); box-shadow: none; animation: none; }
.scheduler-note { margin: 12px 0 0; display: flex; gap: 6px; align-items: flex-start; }
.scheduler-note.ok { color: var(--success); }
.scheduler-note.warn { color: #8a5a00; }
:root[data-theme="dark"] .scheduler-note.warn { color: var(--accent); }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: normal; }
.switch-row > span:last-child { display: flex; flex-direction: column; }
.switch-row small { font-size: .8rem; }
.switch-row input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; border-radius: 13px; background: var(--border); transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch-row input:checked + .switch { background: var(--success); }
.switch-row input:checked + .switch::after { transform: translateX(20px); }
.switch-row input:focus-visible + .switch { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); }
.freq-radios { flex-wrap: wrap; }
.freq-radios .radio { flex: 1 1 calc(50% - 10px); }
[data-auto-fields] { transition: opacity .2s; }
[data-auto-fields].is-disabled { opacity: .45; }
.auto-summary { margin: 0 0 4px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); font-weight: 600; font-size: .9rem; }
.backup-grid .table td { white-space: normal; }
.backup-grid .table td.cell-action, .backup-grid .table td.num { white-space: nowrap; }
.backup-grid .table .cell-sub { word-break: break-all; }
@media (max-width: 1000px) { .backup-grid { grid-template-columns: minmax(0, 1fr); } }

/* Support contact */
.settings-col { display: flex; flex-direction: column; gap: 20px; }
.settings-grid .table th, .settings-grid .table td { white-space: normal; }
.settings-grid .table td.cell-action { white-space: nowrap; }
.settings-col > .card { margin-bottom: 0; }
.support-link { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; color: var(--primary); text-decoration: none; white-space: nowrap; }
.support-link:hover { text-decoration: underline; }
.support-preview { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; margin-bottom: 16px; border-radius: 12px; background: var(--primary-soft); }
.login-help { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: .9rem; }
.login-help small { display: block; margin-top: 2px; }
.lock-help { margin-top: 4px; color: var(--text) !important; }
.footer { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
@media (max-width: 1000px) { .settings-grid { grid-template-columns: 1fr; } }

.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span {
    display: inline-flex; align-items: center; padding: 0 12px; font-weight: 700; font-size: .85rem; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--border); border-right: 0; border-radius: 10px 0 0 10px;
}
.input-prefix input { border-radius: 0 10px 10px 0; font-variant-numeric: tabular-nums; font-weight: 600; }

/* =========================================================
   Tables: toolbar, # column, paging
   ========================================================= */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.table-toolbar p { margin: 0; font-size: .9rem; }
.text-success { color: var(--success); }
.per-page { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.per-page label { margin: 0; font-weight: 500; }
.per-page select { width: auto; min-height: 36px; padding: 5px 30px 5px 10px; }
.col-num { width: 52px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-sub { display: block; font-size: .75rem; }
.cell-wrap { white-space: normal !important; min-width: 220px; }
.select-programme { max-width: 320px; }
.cell-by { white-space: nowrap; }
.by-name { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.by-name .icon { color: var(--primary); }
.paging { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.paging p { margin: 0; font-size: .9rem; }
.paging .pagination { margin-top: 0; }
.pagination span { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; }
.pagination span.disabled { color: var(--muted); opacity: .55; cursor: not-allowed; }
.pagination span.gap { border: 0; padding: 6px 4px; color: var(--muted); }
.btn-info { background: var(--info); border-color: var(--info); color: #fff; }
.btn-info:hover { background: color-mix(in srgb, var(--info) 82%, #000); }
.btn-danger-soft { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.btn-danger-soft:hover { background: var(--danger); color: #fff; }

.hero-year { display: flex; align-items: center; gap: 8px; }
.hero-year label { margin: 0; font-weight: 500; opacity: .85; }
.hero-year select { width: auto; min-height: 40px; background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .35); }
.hero-year select option { color: #1f2933; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row { grid-template-columns: 110px 1fr 36px; }

/* =========================================================
   Export dialog
   ========================================================= */
body.modal-open { overflow: hidden; }
.modal-lg { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; transition: width .3s ease; }
.modal-lg.with-preview { width: min(1000px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; }
.modal-head h3 .icon { color: var(--primary); }
.modal .label { font-weight: 700; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 0 0 10px; }
.format-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.format-card {
    position: relative; display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px;
    border: 2px solid var(--border); border-radius: 14px; cursor: pointer; font-weight: normal;
    transition: border-color .15s, background .15s, transform .15s;
}
.format-card:hover { transform: translateY(-2px); }
.format-card input { position: absolute; opacity: 0; pointer-events: none; }
.format-card strong { display: block; color: var(--text); }
.format-card small { color: var(--muted); font-size: .8rem; }
.format-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.format-card:has(input:focus-visible) { box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); }
.format-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; color: #fff; }
.format-icon.excel { background: #1e7e45; }
.format-icon.pdf { background: #d32f2f; }
.preview { margin: 4px 0 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.preview-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.preview-frame { position: relative; height: min(62vh, 560px); background: #525659; }
.preview-pages {
    height: 100%; overflow: auto; padding: 12px; overscroll-behavior: contain;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.preview-pages canvas { display: block; max-width: 100%; height: auto !important; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); flex-shrink: 0; }
.preview-error { margin: auto; max-width: 380px; padding: 20px; border-radius: 12px; text-align: center; background: var(--card); color: var(--text); }
.preview-error > .icon { font-size: 1.8rem; color: var(--danger); }
.preview-error p { margin: 8px 0 14px; }
.preview-loading {
    position: absolute; inset: 0; display: none; align-items: center; justify-content: center; gap: 10px;
    color: #fff; background: rgba(40, 44, 52, .85); font-weight: 600;
}
.preview.loading .preview-loading { display: flex; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
.hidden-frame { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }

/* =========================================================
   Animations
   ========================================================= */
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in { opacity: 1; transform: none; transition: opacity .5s ease, transform .5s cubic-bezier(.2, .8, .2, 1); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: 0 0; } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(18px, 22px); } }
@keyframes shake {
    10%, 90% { transform: translateX(-2px); }
    20%, 80% { transform: translateX(5px); }
    30%, 50%, 70% { transform: translateX(-9px); }
    40%, 60% { transform: translateX(9px); }
}
@keyframes rowIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .reveal { opacity: 1; transform: none; }
}

/* =========================================================
   Tablet & mobile
   ========================================================= */
@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
    .grid-2.gap { grid-template-columns: 1fr; }
    .grid-users { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar { width: var(--sidebar-w) !important; transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; box-shadow: 6px 0 24px rgba(0, 0, 0, .3); }
    .sidebar-collapsed .brand-text,
    .sidebar-collapsed .side-nav a span:last-child,
    .sidebar-collapsed .side-foot { display: block; }
    .sidebar-collapsed .side-nav a { justify-content: flex-start; padding: 10px 12px; }
    .sidebar-collapsed .side-title { visibility: visible; height: auto; margin: 18px 10px 6px; }
    body.sidebar-open .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(10, 25, 45, .45); animation: fadeIn .2s ease; }
    .main, .sidebar-collapsed .main { margin-left: 0; }
    .filters-export { margin-left: 0; }
}

@media (max-width: 700px) {
    body { font-size: 14.5px; }
    .topbar { padding: 0 12px; gap: 10px; }
    .topbar-title { font-size: 1.05rem; }
    .user-name { display: none; }
    .content { padding: 14px; }
    .card { padding: 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .grid-auto { grid-template-columns: 1fr; }
    .span-2 { grid-column: auto; }
    .hero { padding: 20px; }
    .hero h2 { font-size: 1.2rem; }
    .hero-actions, .hero-actions .btn { width: 100%; }
    .hero-actions .btn { flex: 1; }
    .stat { padding: 14px; gap: 10px; }
    .stat strong { font-size: 1.5rem; }
    .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-side { display: none; }     /* phones: only the login form */
    .auth-form { padding: 28px 24px; }
    .reg-progress { position: static; padding: 14px 16px; }
    .progress-wrap { flex: 1 1 100%; }
    .form-section { padding: 18px 16px 6px; }
    .form-actions { flex-direction: column-reverse; padding: 14px 16px; }
    .form-actions .btn { width: 100%; }
    .filters > *, .filters select, .filters .btn { width: 100%; }
    .filters-export { width: 100%; }
    .filters-export .btn { flex: 1; }
    .actions .btn, .actions form { flex: 1 1 calc(50% - 10px); }
    .actions form .btn { width: 100%; }
    .push-right { margin-left: 0; }
    .details th { width: 40%; }
    .toasts { top: auto; bottom: 14px; right: 16px; }
    .grid-reg { grid-template-columns: 1fr; }
    .select-programme { max-width: none; }
    .hero-year { width: 100%; }
    .hero-year select { flex: 1; }
    .user-btn { padding: 3px; }
    .user-btn > .icon { display: none; }
    .dropdown { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 4px); min-width: 0; }
    .paging { flex-direction: column; align-items: stretch; }
    .paging .pagination { justify-content: center; }
    .table-toolbar { flex-direction: column; align-items: flex-start; }
    .modal-backdrop { padding: 8px; align-items: flex-end; }
    .modal-lg { padding: 18px; max-height: calc(100vh - 16px); }
    .format-cards { grid-template-columns: 1fr; }
    .preview-frame { height: 55vh; }
    .modal-actions { flex-wrap: wrap; }
    .modal-actions .btn { flex: 1 1 auto; }
    .combo-list { max-height: 240px; }
    .combo-item { flex-direction: column; align-items: flex-start; gap: 4px; }

    /* Tables stay tables (like on a computer) and scroll sideways inside their box */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
    .table { font-size: .85rem; }
    .table th, .table td { padding: 9px 10px; }
    .cell-wrap { min-width: 180px; }
    .table-wrap.can-scroll:not(.scrolled)::after { display: block; }
}
.table-wrap { position: relative; }
.table-wrap::after {
    display: none; content: "Swipe to see more \2192";
    position: sticky; left: 0; padding: 6px 10px; font-size: .75rem; color: var(--muted);
    background: var(--surface-2); border-top: 1px solid var(--border);
}

/* =========================================================
   Phones & touch screens: keep the page still
   ========================================================= */
html { overscroll-behavior-x: none; }
.main { overflow-x: clip; }                 /* nothing can push the page sideways */
a, button, input, select, textarea, label { touch-action: manipulation; }   /* no double-tap zoom */

@media (max-width: 700px) {
    /* 16px text stops phones from zooming in when a field is tapped */
    input[type=text], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=password],
    input[type=search], select, textarea { font-size: 16px; }
    .topbar { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
    .hero::after, .auth-bg span { animation: none; }
    .toast { animation-name: toastUp; }
    .toast.out { animation-name: toastDown; }
}
@keyframes toastUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes toastDown { to { opacity: 0; transform: translateY(20px); } }

/* Touch screens have no real hover: no lifting / sliding when tapped */
@media (hover: none) {
    .stat:hover, .format-card:hover, .to-top:hover, .side-nav a:hover { transform: none; }
    .link-more:hover .icon { transform: none; }
    .stat:hover { box-shadow: var(--shadow); }
}

@media (max-width: 420px) {
    .stats { grid-template-columns: 1fr; }
    .radios { flex-direction: column; }
}

/* =========================================================
   Print
   ========================================================= */
@media print {
    :root, :root[data-theme="dark"] {
        --bg: #fff; --card: #fff; --surface-2: #f2f4f7; --text: #000; --muted: #444;
        --border: #999; --primary: #0b5394; --primary-soft: #eaf2fb;
    }
    body { background: #fff; font-size: 12px; }
    .no-print, .actions, .footer, .topbar, .sidebar, .toasts, .modal-backdrop { display: none !important; }
    .main, .sidebar-collapsed .main { margin-left: 0; }
    .content { padding: 0; }
    .card { border: 0; box-shadow: none; padding: 0; }
    .reveal { opacity: 1 !important; transform: none !important; }
}
