﻿/* ============================================================
   Westminster Cambridge — Premium Design System
   ============================================================ */
:root {
    --navy: #0f2240;
    --navy-deep: #0a172e;
    --navy-light: #1a3a5c;
    --crimson: #b92d3e;
    --crimson-deep: #8f1e2d;
    --gold: #c9a227;
    --gold-soft: #f0e6b8;
    --blue: #2563eb;
    --blue-bright: #3b82f6;
    --ink: #0b1220;
    --slate: #475569;
    --muted: #64748b;
    --line: #dfe5ee;
    --bg: #f3f5f9;
    --card: #ffffff;
    --green: #16a34a;
    --amber: #d97706;
    --red: #dc2626;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(11,18,32,.04), 0 1px 1px rgba(11,18,32,.03);
    --shadow: 0 4px 20px rgba(11,18,32,.06);
    --shadow-lg: 0 20px 50px rgba(11,18,32,.10);
    --shadow-glow: 0 0 0 1px rgba(255,255,255,.06) inset, 0 2px 4px rgba(11,18,32,.04);
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--blue); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: none; color: var(--blue-bright); }
h1, h2, h3, h4 { line-height: 1.15; color: var(--ink); margin: 0 0 .55em; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); }
.container { width: min(1200px, 92%); margin: 0 auto; }
img { max-width: 100%; display: block; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.35rem; border-radius: 999px; font-weight: 600;
    font-size: .92rem; border: 1px solid transparent; cursor: pointer;
    transition: transform .12s ease, box-shadow .25s ease, background .25s ease, filter .25s ease;
    text-decoration: none; line-height: 1;
    position: relative; overflow: hidden;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: linear-gradient(135deg, var(--crimson) 0%, var(--crimson-deep) 100%);
    color: #fff; box-shadow: 0 4px 14px rgba(185,45,62,.35);
}
.btn-primary:hover { background: linear-gradient(135deg, #c93a4b 0%, #a02432 100%); color: #fff; filter: brightness(1.06); }
.btn-blue {
    background: linear-gradient(135deg, var(--blue) 0%, #1d4ed8 100%);
    color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.3);
}
.btn-blue:hover { background: linear-gradient(135deg, #3472f7 0%, #1e40af 100%); color: #fff; filter: brightness(1.06); }
.btn-ghost { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.35); color: inherit; backdrop-filter: blur(4px); }
.btn-ghost:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.55); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); background: #f8fbff; }
.btn-sm { padding: .42rem .85rem; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }
.inline { display: inline; }

/* ---- Header ---- */
.site-header {
    background: rgba(15,34,64,.92);
    color: #fff;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, var(--shadow-sm);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: .85rem 0; }
.brand { display: inline-flex; align-items: center; gap: .65rem; color: #fff; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: grid; place-items: center; width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--crimson), var(--crimson-deep)); color: #fff;
    border-radius: 12px; font-weight: 800; font-size: .95rem;
    box-shadow: 0 2px 8px rgba(185,45,62,.35);
}
.main-nav { display: flex; align-items: center; gap: 1.4rem; }
.main-nav a { color: #c8d5e8; font-weight: 500; font-size: .93rem; transition: color .2s ease; }
.main-nav a:hover { color: #fff; text-decoration: none; }
.main-nav .btn { color: #fff; }

/* ---- Hero ---- */
.hero {
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, rgba(201,162,39,.12), transparent),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(185,45,62,.10), transparent),
        linear-gradient(145deg, var(--navy-deep) 0%, var(--navy) 40%, #15304d 100%);
    color: #fff; padding: 5.5rem 0 7rem; position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: .6;
}
.hero::after {
    content: ''; position: absolute; right: -140px; top: -100px; width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(185,45,62,.40), transparent 70%); border-radius: 50%;
    filter: blur(10px);
}
.hero-inner { position: relative; z-index: 1; max-width: 740px; }
.hero .pill {
    display: inline-block; background: rgba(255,255,255,.10); padding: .4rem 1rem;
    border-radius: 999px; font-size: .8rem; margin-bottom: 1.4rem;
    border: 1px solid rgba(255,255,255,.14); color: #e2eaf5;
    backdrop-filter: blur(6px);
}
.hero h1 { font-size: clamp(2.2rem, 5.2vw, 3.6rem); color: #fff; margin-bottom: 1.1rem; font-weight: 800; letter-spacing: -.02em; }
.hero p { font-size: 1.15rem; color: #c8d5e8; margin-bottom: 2rem; max-width: 620px; }
.hero-actions { display: flex; gap: .9rem; flex-wrap: wrap; }

/* ---- Stats ---- */
.stats-bar {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem;
    margin-top: -3.6rem; position: relative; z-index: 2; margin-bottom: 3.2rem;
}
.stat-card {
    background: var(--card); border-radius: var(--radius); padding: 1.8rem 1.4rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.6);
    position: relative; overflow: hidden;
    text-align: center;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, var(--crimson), var(--gold));
    opacity: .6;
}
.stat-num { font-size: 2.2rem; font-weight: 800; color: var(--navy); letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .86rem; font-weight: 500; margin-top: .3rem; }

/* ---- Sections ---- */
.section { padding: 4rem 0; }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 2.8rem; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin-bottom: .6rem; }
.section-head p { color: var(--muted); font-size: 1.02rem; }
.eyebrow { color: var(--crimson); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; margin-bottom: .6rem; display: inline-block; }

/* ---- Cards / grids ---- */
.grid { display: grid; gap: 1.6rem; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card {
    background: var(--card); border: 1px solid rgba(223,229,238,.7); border-radius: var(--radius);
    padding: 1.8rem; box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .3s ease, border-color .2s ease;
    position: relative; overflow: hidden;
}
.card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.9), transparent);
}
.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(15,34,64,.10), 0 2px 8px rgba(15,34,64,.04);
    border-color: rgba(201,162,39,.25);
}
.card h3 { font-size: 1.15rem; font-weight: 700; }
.programme-card .level {
    font-size: .72rem; color: var(--crimson); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    margin-bottom: .4rem;
}
.programme-card .fees { font-weight: 600; color: var(--muted); font-size: .78rem; letter-spacing: .01em; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid rgba(223,229,238,.6); }

/* ---- Feature tiles ---- */
.feature { display: flex; gap: 1.1rem; align-items: flex-start; }
.feature .ico {
    flex: none; width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center;
    background: linear-gradient(135deg, #eaf1fb, #dce7f7); color: var(--blue);
    font-weight: 800; font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(37,99,235,.10);
}
.feature h3 { font-size: 1.05rem; margin-bottom: .3rem; font-weight: 700; }
.feature p { font-size: .92rem; color: var(--muted); margin: 0; line-height: 1.55; }

/* ---- Tags ---- */
.tag {
    display: inline-block; padding: .22rem .65rem; border-radius: 999px;
    font-size: .72rem; font-weight: 700; letter-spacing: .03em;
}
.tag-AI { background: #ede9fe; color: #6d28d9; }
.tag-Auto { background: #dcfce7; color: #15803d; }
.tag-Admin { background: #fef3c7; color: #b45309; }
.tag-Public { background: #e0f2fe; color: #0369a1; }

/* ---- Section band ---- */
.band {
    background:
        radial-gradient(ellipse 70% 50% at 30% 50%, rgba(201,162,39,.08), transparent),
        linear-gradient(145deg, var(--navy-deep) 0%, var(--navy) 60%, #14324d 100%);
    color: #fff; position: relative; overflow: hidden;
}
.band::before {
    content: ''; position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: .5;
}
.band h2, .band h3 { color: #fff; }
.band .muted { color: #b0c0d8; }

.cta {
    background: linear-gradient(135deg, var(--crimson), var(--crimson-deep));
    color: #fff; border-radius: var(--radius); padding: 3.2rem; text-align: center; margin: 3.2rem 0;
    position: relative; overflow: hidden;
    box-shadow: 0 12px 40px rgba(185,45,62,.25);
}
.cta::before {
    content: ''; position: absolute; top: -40%; right: -10%; width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,.08), transparent 70%); border-radius: 50%;
}
.cta h2 { color: #fff; position: relative; z-index: 1; }
.cta p { color: #f3cdd1; position: relative; z-index: 1; }

/* ---- Footer ---- */
.site-footer {
    background: var(--navy-deep);
    color: #a0b3cc; margin-top: 3.5rem; padding-top: 3.5rem;
    position: relative;
    border-top: 1px solid rgba(255,255,255,.06);
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2.5rem; padding-bottom: 2.2rem; }
.footer-grid h4 { color: #fff; margin-bottom: 1rem; font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; }
.footer-grid a { display: block; color: #8da3bf; padding: .25rem 0; font-size: .92rem; transition: color .2s ease; }
.footer-grid a:hover { color: #fff; text-decoration: none; }
.brand-footer { color: #fff; margin-bottom: .8rem; }
.footer-base { border-top: 1px solid rgba(255,255,255,.08); padding: 1.4rem 0; font-size: .84rem; color: #6e85a3; }

/* ---- Flash ---- */
.flash-stack { margin: 1rem auto; display: grid; gap: .6rem; }
.flash { padding: .9rem 1.2rem; border-radius: var(--radius-sm); font-weight: 500; border: 1px solid; font-size: .93rem; }
.flash-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ---- Forms ---- */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .4rem; font-size: .88rem; color: var(--slate); }
.input, .select, .textarea {
    width: 100%; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-family: inherit; font-size: .95rem; background: #fff; color: var(--ink);
    transition: border-color .2s ease, box-shadow .2s ease;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(37,99,235,.08); }
.textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.help { font-size: .82rem; color: var(--muted); margin-top: .35rem; }

/* ---- Auth ---- */
.auth-body {
    background:
        radial-gradient(ellipse 60% 50% at 20% 30%, rgba(201,162,39,.10), transparent),
        linear-gradient(145deg, var(--navy-deep), #1a3a5c);
    min-height: 100vh; display: grid; place-items: center; padding: 2rem;
}
.auth-wrap { width: min(440px, 100%); }
.auth-brand { justify-content: center; margin-bottom: 1.6rem; font-size: 1.3rem; }
.auth-card {
    background: rgba(255,255,255,.98); border-radius: var(--radius); padding: 2.4rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255,255,255,.5);
    backdrop-filter: blur(8px);
}
.auth-card h1 { font-size: 1.55rem; margin-bottom: .3rem; }
.auth-foot { text-align: center; margin-top: 1.3rem; }
.auth-foot a { color: #c8d5e8; transition: color .2s ease; }
.auth-foot a:hover { color: #fff; }
.demo-creds { background: var(--bg); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .9rem; font-size: .82rem; margin-top: 1.2rem; }
.demo-creds code { background: #fff; padding: .05rem .35rem; border-radius: 4px; border: 1px solid var(--line); }

/* ---- Portal layout ---- */
.portal-body { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
    width: 260px; flex: none;
    background: linear-gradient(180deg, rgba(15,34,64,.98) 0%, rgba(10,23,46,.98) 100%);
    color: #fff; padding: 1.5rem 1.1rem; position: sticky; top: 0; height: 100vh;
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
    backdrop-filter: blur(12px);
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar-brand { font-size: 1.1rem; margin-bottom: 1.6rem; display: flex; align-items: center; gap: .6rem; }
.sidebar-role { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: #6e85a3; margin-bottom: .9rem; padding-left: .5rem; }
.sidebar-nav { display: flex; flex-direction: column; gap: .18rem; }
.sidebar-nav a { color: #a0b3cc; padding: .7rem .85rem; border-radius: var(--radius-sm); font-weight: 500; font-size: .9rem; transition: all .15s ease; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar-nav a.active { background: linear-gradient(135deg, var(--crimson), var(--crimson-deep)); color: #fff; box-shadow: 0 3px 10px rgba(185,45,62,.25); }
.portal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.portal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 2rem;
    background: rgba(255,255,255,.92);
    border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
    backdrop-filter: blur(10px) saturate(1.1);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
}
.portal-title { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.portal-user { display: flex; align-items: center; gap: .8rem; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--blue-bright)); color: #fff;
    display: grid; place-items: center; font-weight: 700; font-size: .9rem;
    box-shadow: 0 2px 6px rgba(37,99,235,.25);
}
.portal-user-name { font-weight: 600; font-size: .9rem; color: var(--ink); }
.portal-content { padding: 2rem; flex: 1; }
.portal-content .flash-stack { width: 100%; padding: 0; margin: 0 0 1.2rem; }

/* ---- KPI ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; margin-bottom: 1.8rem; }
.kpi {
    background: #fff; border: 1px solid rgba(223,229,238,.7); border-radius: var(--radius); padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
    transition: transform .15s ease, box-shadow .2s ease;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi::before {
    content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--blue), var(--blue-bright));
    border-radius: var(--radius) 0 0 var(--radius);
}
.kpi.accent::before { background: linear-gradient(180deg, var(--crimson), var(--crimson-deep)); }
.kpi .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .value { font-size: 1.9rem; font-weight: 800; color: var(--navy); margin-top: .25rem; letter-spacing: -.02em; }
.kpi.accent .value { color: var(--crimson); }

/* ---- Tables ---- */
.table-wrap { background: #fff; border: 1px solid rgba(223,229,238,.7); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 1rem 1.2rem; border-bottom: 1px solid rgba(223,229,238,.6); font-size: .9rem; }
table.data th { background: #f8fafc; color: var(--slate); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #f4f8ff; }

/* ---- Status badges ---- */
.badge { display: inline-block; padding: .22rem .7rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.badge-paid, .badge-accepted, .badge-graded, .badge-active { background: #dcfce7; color: #15803d; }
.badge-unpaid, .badge-submitted { background: #fef3c7; color: #b45309; }
.badge-rejected, .badge-overdue { background: #fee2e2; color: #b91c1c; }
.badge-under_review, .badge-pending { background: #e0f2fe; color: #0369a1; }

/* ---- Progress ---- */
.progress { background: #e8edf3; border-radius: 999px; height: 8px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--blue-bright)); border-radius: 999px; }

/* ---- Panels / utility ---- */
.panel {
    background: #fff; border: 1px solid rgba(223,229,238,.7); border-radius: var(--radius);
    padding: 1.8rem; box-shadow: var(--shadow-sm); margin-bottom: 1.4rem;
    position: relative; overflow: hidden;
    transition: box-shadow .2s ease, border-color .2s ease;
}
.panel:hover { box-shadow: var(--shadow); border-color: rgba(201,162,39,.2); }
.panel h2, .panel h3 { margin-top: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; flex-wrap: wrap; gap: 1rem; }
.page-head h1 { font-size: 1.7rem; margin: 0; font-weight: 800; }
.stack { display: grid; gap: 1.4rem; }
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 1.4rem; align-items: start; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.list-clean li:last-child { border-bottom: none; }
.text-right { text-align: right; }
.mt { margin-top: 1rem; }
.mb { margin-bottom: 1rem; }
.big-num { font-size: 1.4rem; font-weight: 700; color: var(--navy); letter-spacing: -.01em; }

/* ---- Breadcrumb ---- */
.breadcrumb { font-size: .86rem; color: var(--muted); margin-bottom: 1.1rem; }
.breadcrumb a { color: var(--muted); transition: color .2s ease; }
.breadcrumb a:hover { color: var(--navy); }

/* ---- AI tutor chat ---- */
.chat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; height: 60vh; box-shadow: var(--shadow-sm); }
.chat-log { flex: 1; overflow-y: auto; padding: 1.4rem; display: flex; flex-direction: column; gap: .9rem; }
.bubble { max-width: 75%; padding: .8rem 1.1rem; border-radius: 16px; font-size: .94rem; line-height: 1.55; }
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--blue), #1d4ed8); color: #fff; border-bottom-right-radius: 4px; }
.bubble.tutor { align-self: flex-start; background: #f1f5f9; color: var(--ink); border-bottom-left-radius: 4px; }
.bubble .who { display: block; font-size: .7rem; opacity: .7; margin-bottom: .25rem; }
.chat-input { display: flex; gap: .6rem; padding: 1rem; border-top: 1px solid var(--line); }
.chat-input .input { flex: 1; }
.chat-empty { text-align: center; color: var(--muted); margin: auto; }

/* ---- Hero subpage ---- */
.page-hero {
    background:
        radial-gradient(ellipse 70% 50% at 20% 30%, rgba(201,162,39,.08), transparent),
        linear-gradient(145deg, var(--navy-deep) 0%, var(--navy) 60%, #14324d 100%);
    color: #fff; padding: 3.5rem 0;
    position: relative; overflow: hidden;
}
.page-hero::before {
    content: ''; position: absolute; inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: .5;
}
.page-hero h1 { color: #fff; font-size: 2.3rem; font-weight: 800; position: relative; z-index: 1; }
.page-hero p { color: #b8c8de; max-width: 640px; position: relative; z-index: 1; }

/* ---- Filter chips ---- */
.chips { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 1.8rem; }
.chip {
    padding: .45rem 1rem; border-radius: 999px; border: 1px solid var(--line);
    background: #fff; font-size: .85rem; color: var(--slate); font-weight: 500;
    transition: all .15s ease; cursor: pointer;
}
.chip.active, .chip:hover { background: var(--navy); color: #fff; border-color: var(--navy); text-decoration: none; box-shadow: 0 2px 8px rgba(15,34,64,.18); }

/* ---- Video embeds ---- */
.video-wrap { position: relative; width: 100%; padding-top: 56.25%; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.video-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---- Tutor suggestions ---- */
.tutor-suggestions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tutor-suggestions .suggestion { cursor: pointer; border: 1px solid var(--line); }
.chat-input .select { flex: none; }

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

/* ---- Study notes ---- */
.note-body { line-height: 1.7; color: var(--ink, #1f2937); }
.note-body p { margin: 0 0 .9rem; }
.note-body strong { color: var(--navy, #0f2240); }
.note-body h1 { font-size: 1.55rem; margin: .4rem 0 .9rem; color: var(--navy, #0f2240); font-weight: 800; }
.note-body h2 { font-size: 1.22rem; margin: 1.3rem 0 .6rem; color: var(--navy, #0f2240); font-weight: 700; }
.note-body h3 { font-size: 1.05rem; margin: 1rem 0 .45rem; font-weight: 700; }
.note-rule { border: none; border-top: 1px solid var(--line); margin: 1.3rem 0; }
.note-list { margin: 0 0 1rem 1.3rem; padding: 0; }
.note-list li { margin: .3rem 0; }
.note-body .code-block,
.code-block { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 1rem 1.2rem; overflow-x: auto; margin: 0 0 1rem; font-size: .85rem; }
.code-block code { background: none; color: inherit; padding: 0; white-space: pre; }
.study-note .note-body code { background: #eef2ff; color: #3730a3; padding: .06rem .38rem; border-radius: 4px; font-size: .88em; }
.ai-tutor-cta { background: linear-gradient(160deg, #eff6ff, #f8fafc); border: 1px solid #dbeafe; }

/* ---- Student course materials ---- */
.material-group { margin-bottom: 1.6rem; }
.material-group-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 .6rem; padding-bottom: .45rem; border-bottom: 2px solid var(--line); font-weight: 700; }
.material-item { background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.2rem; }
.material-item .note-body { font-size: .95rem; }

/* ---- Public course preview ---- */
.syllabus-preview { background: linear-gradient(160deg, #fff, #fafbfc); }
.syllabus-list { list-style: none; padding: 0; margin: 0; }
.syllabus-list li { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.syllabus-list li:last-child { border-bottom: none; }
.lock-icon { font-size: .85rem; opacity: .5; }
.material-preview-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.material-tile { display: flex; gap: .85rem; align-items: flex-start; background: #f8fafc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1.1rem; transition: border-color .2s ease, box-shadow .2s ease; }
.material-tile:hover { border-color: #c8d4e6; box-shadow: var(--shadow-sm); }
.mat-ico { font-size: 1.5rem; flex: none; }
.material-tile strong { font-size: .9rem; display: block; margin-bottom: .15rem; }
.material-tile p { font-size: .82rem; margin: 0; }
.lecturer-row { display: flex; align-items: center; gap: .85rem; margin-top: .85rem; }
.cta-enrol { background: linear-gradient(160deg, #fff, #fff8f9); border: 1px solid #fee2e2; }

/* ---- Study book library ---- */
.book-card { display: flex; flex-direction: column; overflow: hidden; }
.book-spine { background: linear-gradient(135deg, var(--navy, #0f2240), #1f3a5f); color: #fff; padding: 1.2rem 1.3rem; margin: -1.6rem -1.6rem 1rem; }
.book-code { font-weight: 700; letter-spacing: .04em; font-size: .9rem; }
.book-body { flex: 1; }

/* ---- Book reader ---- */
.book-reader { display: grid; grid-template-columns: 240px 1fr; gap: 1.6rem; align-items: start; }
.book-toc { position: sticky; top: 1.2rem; }
.book-toc-nav { display: flex; flex-direction: column; gap: .25rem; }
.book-toc-nav a { padding: .5rem .7rem; border-radius: var(--radius-sm); color: var(--ink, #1f2937); font-size: .9rem; text-decoration: none; transition: all .15s ease; }
.book-toc-nav a:hover { background: #eff6ff; color: var(--navy, #0f2240); }
.book-titlecard { background: linear-gradient(160deg, #f8fafc, #eef2ff); border: 1px solid #dbeafe; }
.book-pages { display: flex; flex-direction: column; gap: 1.3rem; }
.book-section { scroll-margin-top: 1.2rem; }
.book-section .note-body h1 { font-size: 1.75rem; margin: .2rem 0 1rem; color: var(--navy, #0f2240); }
.book-section .note-body h2 { font-size: 1.3rem; margin: 1.4rem 0 .7rem; color: var(--navy, #0f2240); }
.book-section .note-body h3 { font-size: 1.08rem; margin: 1.1rem 0 .5rem; }
@media (max-width: 980px) {
    .book-reader { grid-template-columns: 1fr; }
    .book-toc { position: static; }
}

/* ---- Book switcher ---- */
.book-switcher { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
.book-tab { padding: .55rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: .9rem; color: var(--ink, #1f2937); text-decoration: none; background: #fff; transition: all .15s ease; }
.book-tab:hover { background: #eff6ff; }
.book-tab.active { background: var(--navy, #0f2240); color: #fff; border-color: var(--navy, #0f2240); box-shadow: 0 2px 8px rgba(15,34,64,.18); }

/* ---- Research library ---- */
.paper-card h3 a { color: var(--navy, #0f2240); text-decoration: none; }
.paper-card h3 a:hover { text-decoration: underline; }
.paper-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.paper-list { list-style: none; padding: 0; margin: 0; }
.paper-row { padding: .7rem 0; border-bottom: 1px dashed var(--line); }
.paper-row:last-child { border-bottom: none; }
.paper-title { font-weight: 600; color: var(--navy, #0f2240); text-decoration: none; }
.paper-title:hover { text-decoration: underline; }

/* ---- Testimonials ---- */
.testimonial-card { display: flex; flex-direction: column; justify-content: space-between; }
.testimonial-text { font-size: 1.05rem; line-height: 1.65; color: var(--ink); font-style: italic; margin-bottom: 1.3rem; }
.testimonial-author { display: flex; align-items: center; gap: .85rem; margin-top: auto; }

/* ---- Responsive ---- */
@media (max-width: 980px) {
    .grid-3, .grid-4, .footer-grid, .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .main-nav { gap: .8rem; font-size: .9rem; }
    .main-nav a:not(.btn) { display: none; }
    .stats-bar, .grid-2, .grid-3, .grid-4, .kpi-grid, .form-row, .footer-grid { grid-template-columns: 1fr; }
    .stats-bar { margin-top: 1.5rem; }
    .sidebar { position: fixed; left: -270px; transition: left .2s; z-index: 100; }
    .portal-body.nav-open .sidebar { left: 0; }
    .portal-content { padding: 1.2rem; }
}

/* ---- Notifications ---- */
.notif-bell { position: relative; cursor: pointer; padding: .4rem; font-size: 1.2rem; }
.notif-badge { position: absolute; top: -2px; right: -2px; background: var(--crimson); color: #fff; font-size: .65rem; font-weight: 700; width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.notif-dropdown { display: none; position: absolute; top: 100%; right: 0; width: 320px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 200; margin-top: .4rem; overflow: hidden; }
.notif-dropdown.show { display: block; }
.notif-item { display: block; padding: .8rem 1rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .88rem; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg); }
.notif-unread { background: #fff1f2; }

/* ---- Dark mode support ---- */
body.dark-mode { --navy: #1a2e4a; --navy-deep: #0f1d30; --bg: #0f172a; --card: #1e293b; --ink: #f1f5f9; --line: #334155; --muted: #94a3b8; }
body.dark-mode .panel, body.dark-mode .card { background: var(--card); border-color: var(--line); }
body.dark-mode .site-header { background: rgba(15,23,42,.92); }
body.dark-mode .hero { background: linear-gradient(135deg, var(--navy-deep) 0%, var(--navy) 100%); }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea { background: #1e293b; color: #f1f5f9; border-color: #334155; }

/* ---- Cookie banner ---- */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--navy); color: #fff; padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; z-index: 500; font-size: .9rem; }
.cookie-banner a { color: var(--gold-soft); text-decoration: underline; }
.cookie-banner button { background: var(--crimson); color: #fff; border: none; padding: .5rem 1.2rem; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
