/* College Portal styles. --primary and --accent are set from Admin > Settings. */
:root {
  --primary: #1e3a8a;
  --accent: #f59e0b;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 18px; }
.narrow { max-width: 480px; margin: 0 auto; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt-2 { margin-top: 1rem; } .mb-2 { margin-bottom: 1rem; }
.text-right { text-align: right; } .text-center { text-align: center; }

/* Header */
.topbar { background: var(--primary); color: #fff; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand img { height: 42px; width: auto; background: #fff; border-radius: 6px; padding: 3px; }
.brand-mark { width: 42px; height: 42px; border-radius: 8px; background: var(--accent); color: #111; display: grid; place-items: center; font-weight: 800; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nav a { color: #fff; text-decoration: none; padding: 7px 12px; border-radius: 6px; opacity: .92; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.14); opacity: 1; }
.nav .btn-accent { background: var(--accent); color: #111; font-weight: 600; }

/* Layout */
main { padding: 28px 0 48px; min-height: calc(100vh - 140px); }
.footer { border-top: 1px solid var(--border); background: #fff; color: var(--muted); font-size: .85rem; padding: 18px 0; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.grid-detail { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.grid-detail > div > .card + .card, .grid-detail > div > .card { margin-top: 0; margin-bottom: 18px; }
@media (max-width: 1000px) { .grid-detail { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card + .card { margin-top: 18px; }
.grid > .card, .grid > .card + .card { margin-top: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-header h2, .card-header h3 { margin: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-header h1 { margin: 0; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--primary), #0f172a); color: #fff; border-radius: 14px; padding: 46px 36px; margin-bottom: 26px; }
.hero h1 { font-size: 2rem; margin-bottom: .3em; }
.hero p { font-size: 1.08rem; opacity: .9; max-width: 640px; }
.hero .btn { margin-right: 8px; margin-top: 6px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; background: var(--primary); color: #fff; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled, .btn[disabled] { background: #d1d5db !important; color: #6b7280 !important; border-color: #d1d5db !important; cursor: not-allowed; filter: none; }
.uploading { opacity: .6; pointer-events: none; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--border); }
.btn-accent { background: var(--accent); color: #111; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-success { background: #16a34a; color: #fff; }
.btn-sm { padding: 6px 11px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; color: var(--primary); padding: 0; font-weight: 500; cursor: pointer; text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.req::after { content: " *"; color: #dc2626; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=datetime-local], input[type=search], input[type=number], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
input[type=color] { width: 60px; height: 40px; border: 1px solid #d1d5db; border-radius: 8px; padding: 2px; }
textarea { min-height: 96px; resize: vertical; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
@media (max-width: 600px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
.hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.field-error { color: #b91c1c; font-size: .84rem; margin-top: 4px; }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.checkbox input { margin-top: 4px; }
.otp-input { font-size: 1.8rem !important; letter-spacing: 12px; text-align: center; font-weight: 700; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-gray { background: #f3f4f6; color: #374151; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f9fafb; }
tr:hover td { background: #fafbfc; }
.kv { display: grid; grid-template-columns: minmax(100px, 38%) minmax(0, 1fr); gap: 6px 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.grid-detail .grid-2 { grid-template-columns: 1fr; }
@media (min-width: 1300px) { .grid-detail .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv dd { margin-bottom: 8px; } }

/* Stats */
.stat { padding: 18px; }
.stat .num { font-size: 1.9rem; font-weight: 800; color: var(--primary); }
.stat .lbl { color: var(--muted); font-size: .88rem; }

/* Steps */
.steps { display: flex; gap: 6px; margin-bottom: 22px; flex-wrap: wrap; counter-reset: step; list-style: none; padding: 0; }
.steps li { flex: 1 1 120px; }
.steps a, .steps span { display: block; padding: 10px 12px; border-radius: 8px; background: #fff; border: 1px solid var(--border); text-decoration: none; color: var(--muted); font-size: .86rem; font-weight: 600; }
.steps li::before { counter-increment: step; }
.steps .done a { border-color: #bbf7d0; color: #166534; background: #f0fdf4; }
.steps .current a { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, #fff); }

/* Progress tracker */
.tracker { display: flex; gap: 0; margin: 10px 0 4px; flex-wrap: wrap; }
.tracker .t-step { flex: 1 1 100px; text-align: center; position: relative; padding-top: 34px; font-size: .82rem; color: var(--muted); }
.tracker .t-step::before { content: ""; position: absolute; top: 9px; left: 50%; width: 22px; height: 22px; margin-left: -11px; border-radius: 50%; background: #e5e7eb; border: 3px solid #fff; box-shadow: 0 0 0 1px #d1d5db; z-index: 1; }
.tracker .t-step::after { content: ""; position: absolute; top: 19px; left: -50%; width: 100%; height: 3px; background: #e5e7eb; }
.tracker .t-step:first-child::after { display: none; }
.tracker .t-step.done { color: #166534; font-weight: 600; }
.tracker .t-step.done::before { background: #16a34a; box-shadow: 0 0 0 1px #16a34a; }
.tracker .t-step.done::after { background: #16a34a; }
.tracker .t-step.current { color: var(--primary); font-weight: 700; }
.tracker .t-step.current::before { background: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.tracker .t-step.bad::before { background: #dc2626; box-shadow: 0 0 0 1px #dc2626; }

/* Admin layout */
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 64px); }
.sidebar { background: #0f172a; color: #cbd5e1; padding: 18px 12px; }
.sidebar a { display: block; color: #cbd5e1; text-decoration: none; padding: 9px 12px; border-radius: 7px; font-size: .92rem; margin-bottom: 2px; }
.sidebar a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.active { background: var(--primary); color: #fff; }
.sidebar .section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #64748b; margin: 16px 12px 6px; }
.sidebar .soon { opacity: .45; pointer-events: none; }
.admin-main { padding: 26px; min-width: 0; }
@media (max-width: 860px) { .admin-shell { grid-template-columns: 1fr; } .sidebar { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; } .sidebar .section { display: none; } .admin-main { padding: 18px 12px; } }

/* Documents */
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.doc-list li:last-child { border-bottom: 0; }
.doc-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.comment { border-left: 3px solid var(--border); padding: 6px 12px; margin-bottom: 12px; }
.comment.applicant { border-left-color: var(--accent); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: 6px 0 6px 16px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters > div { min-width: 160px; }
.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a { padding: 6px 11px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; background: #fff; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.logo-preview { max-height: 80px; border: 1px solid var(--border); border-radius: 8px; padding: 6px; background: #fff; }
.programme-card h3 { margin-bottom: 4px; }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }

/* Programme cards & detail page */
.prog-link { text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.prog-link:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(17,24,39,.09); }
.prog-card-top { display: flex; gap: 6px; flex-wrap: wrap; }
.prog-card-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.fee-total { display: flex; flex-direction: column; font-size: 1.25rem; font-weight: 800; color: var(--primary); line-height: 1.2; }
.fee-total small, .fee-big small { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.prog-card-foot .more { font-size: .85rem; font-weight: 600; color: var(--primary); }
.prog-hero { background: #fff; border: 1px solid var(--border); border-radius: 14px; padding: 28px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; margin-bottom: 20px; align-items: center; box-shadow: var(--shadow); }
.prog-hero h1 { font-size: 1.8rem; margin: 10px 0 14px; }
.prog-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.prog-facts span { display: flex; flex-direction: column; font-size: .92rem; }
.prog-facts strong { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.prog-hero-side { display: flex; flex-direction: column; gap: 12px; }
.fee-big { display: flex; flex-direction: column; font-size: 2rem; font-weight: 800; color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, #fff); border-radius: 12px; padding: 14px 18px; line-height: 1.15; }
.req-list { margin: 0; padding: 0; list-style: none; }
.req-list li { padding: 9px 0 9px 30px; border-bottom: 1px solid var(--border); position: relative; }
.req-list li:last-child { border-bottom: 0; }
.req-list li::before { content: "✓"; position: absolute; left: 4px; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: #dcfce7; color: #166534; font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
.fee-table { width: 100%; }
.fee-table td { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fee-table tfoot td { border-top: 2px solid var(--text); border-bottom: 0; font-weight: 800; font-size: 1.1rem; color: var(--primary); }
@media (max-width: 760px) { .prog-hero { grid-template-columns: 1fr; padding: 20px; } }

/* ---------- School calendar ---------- */
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.cal-card { padding: 18px; }
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-head h2 { margin: 0 8px; min-width: 150px; text-align: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.cal-legend a { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: .78rem; color: inherit; text-decoration: none; }
.cal-legend a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.cal-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { font-size: .72rem; font-weight: 700; text-transform: uppercase; color: var(--muted, #6b7280); text-align: center; padding: 4px 0; }
.cal-day { min-height: 92px; border: 1px solid var(--border); border-radius: 10px; padding: 5px; display: flex; flex-direction: column; gap: 3px; background: #fff; min-width: 0; }
.cal-day.empty { background: transparent; border-style: dashed; opacity: .4; }
.cal-day.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal-num { font-size: .78rem; font-weight: 700; color: var(--muted, #6b7280); }
.cal-day.today .cal-num { color: var(--primary); }
.cal-ev { display: block; font-size: .72rem; line-height: 1.25; padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c) 15%, #fff); border-left: 3px solid var(--c); color: #111827; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { background: color-mix(in srgb, var(--c) 25%, #fff); }
.cal-more { font-size: .7rem; color: var(--muted, #6b7280); }
.up-ev { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.up-ev:last-child { border-bottom: 0; }
.up-date { width: 46px; flex: none; text-align: center; border-radius: 10px; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); padding: 4px 0; line-height: 1.1; }
.up-date span { display: block; font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.up-date strong { font-size: 1.15rem; }
.ev-row { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 90px; }
.ev-row:target { background: color-mix(in srgb, var(--c) 8%, #fff); border-radius: 10px; }
.ev-bar { width: 4px; border-radius: 4px; background: var(--c); flex: none; }
.cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; }
@media (max-width: 900px) {
  .cal-layout { grid-template-columns: minmax(0, 1fr); }
  .cal-day { min-height: 54px; padding: 3px; }
  .cal-ev { font-size: 0; padding: 0; height: 6px; border-left: 0; background: var(--c); }
}

/* ---------- Announcements ---------- */
.ann-list { display: flex; flex-direction: column; gap: 8px; }
.ann-item { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); color: inherit; text-decoration: none; border-left: 4px solid transparent; }
.ann-item:hover { background: #f8fafc; }
.ann-item.unread { background: color-mix(in srgb, var(--primary) 6%, #fff); border-left-color: var(--primary); }
.ann-item.open { box-shadow: 0 0 0 2px var(--primary); }
.ann-item.prio-urgent { border-left-color: #dc2626; }
.ann-item.prio-important { border-left-color: #d97706; }
.ann-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ann-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); display: inline-block; flex: none; }
.ann-body { line-height: 1.65; word-wrap: break-word; }
.ann-detail { position: sticky; top: 16px; }
.ann-widget { margin-bottom: 18px; }
.ann-mini { display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; margin: 0 -10px; border-radius: 10px; color: inherit; text-decoration: none; }
.ann-mini:hover { background: #f8fafc; }
.ann-mini.unread { background: color-mix(in srgb, var(--primary) 6%, #fff); }
.ann-mini.unread .ann-mini-title { font-weight: 700; }
.ann-mini-title { display: flex; align-items: center; gap: 7px; }
.ann-mini.prio-urgent .ann-mini-title { color: #b91c1c; }
.urgent-banner { display: flex; align-items: center; gap: 10px; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: #fee2e2; color: #991b1b; text-decoration: none; border: 1px solid #fecaca; }
.urgent-banner:hover { background: #fecaca; }
.urgent-go { margin-left: auto; font-weight: 700; white-space: nowrap; }

/* Dashboard right-hand rail */
.dash-rail-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.dash-main { min-width: 0; }
@media (max-width: 1250px) {
  .dash-rail-wrap { grid-template-columns: minmax(0, 1fr); }
  .dash-rail { order: -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
  .dash-rail .ann-widget { margin-bottom: 0; }
}
@media (max-width: 1600px) { .dash-main .dash-bottom { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Demo ---------- */
.demo-ribbon { background: #111827; color: #f9fafb; text-align: center; font-size: .85rem; padding: 8px 14px; }
.demo-ribbon a { color: var(--accent); font-weight: 700; margin-left: 6px; }
.demo-box { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 26px; margin-bottom: 26px; box-shadow: 0 6px 24px rgba(17,24,39,.06); scroll-margin-top: 20px; }
.demo-head h2 { margin: 8px 0 6px; }
.demo-tag { display: inline-block; background: color-mix(in srgb, var(--accent) 22%, #fff); color: #78350f; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 18px; }
.demo-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: 14px; padding: 16px; margin: 0; background: #fff; transition: box-shadow .15s, transform .15s; }
.demo-card:hover { box-shadow: 0 8px 22px rgba(17,24,39,.08); transform: translateY(-2px); }
.demo-card .btn { margin-top: auto; background: var(--c); border-color: var(--c); color: #fff; }
.demo-card .small { min-height: 2.6em; }
.demo-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); }
.demo-box.compact .demo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.demo-box.compact .demo-card { padding: 12px; }
.demo-box.compact .demo-card .btn { font-size: .78rem; padding: 6px 10px; }
.demo-grid-sm { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-top: 12px; }
.demo-grid-sm .demo-card:hover { transform: none; box-shadow: none; }
.demo-grid-sm code { word-break: break-all; }
.demo-banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: #fffbeb; border: 1px solid #fde68a; color: #78350f; border-radius: 14px; padding: 10px 14px; margin-bottom: 16px; font-size: .88rem; }
.demo-banner span:nth-child(2) { flex: 1 1 280px; }
.demo-banner form { margin: 0; }
.text-danger { color: #b91c1c; font-weight: 600; }
.dash-rail-wrap:not(:has(> .dash-rail)) { grid-template-columns: minmax(0, 1fr); }

/* ---------- Theme toggle, footer credit, modules, finance range ---------- */
.theme-toggle { display: inline-grid; place-items: center; cursor: pointer; }
.theme-toggle .ti-sun { display: none; }
[data-theme="dark"] .theme-toggle .ti-sun { display: block; }
[data-theme="dark"] .theme-toggle .ti-moon { display: none; }
.nav-theme { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 8px; }
.nav-theme:hover { background: rgba(255,255,255,.22); }
.footer .container { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.powered-by { color: var(--muted); }
.powered-by a { color: var(--primary); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.ad-foot .powered-by { color: rgba(255,255,255,.6); display: inline-block; margin-top: 6px; }
.ad-foot .powered-by a, [data-theme="dark"] .ad-foot .powered-by a { color: #fff; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.module-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; }
.module-item input { width: auto; margin-top: 3px; }
.module-item span { display: flex; flex-direction: column; gap: 2px; }
.module-item small { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.module-item:has(input:not(:checked)) { opacity: .6; }
.favicon-preview { display: flex; gap: 10px; align-items: flex-end; }
.favicon-preview img { border: 1px solid var(--border); border-radius: 4px; background: #fff; }
.range-bar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: -4px 0 14px; font-size: .86rem; }
.range-bar select, .range-bar input { width: auto; padding: 6px 10px; font-size: .86rem; }
.range-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); margin-right: 4px; }
.range-label strong { color: var(--text); }
.range-custom { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-custom[hidden] { display: none; }

/* ---------- Course materials ---------- */
.mat-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.panel-head + .mat-row { border-top: 0; padding-top: 4px; }
.mat-row.is-hidden { opacity: .6; }
.mat-ico { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); }
.mat-main { flex: 1 1 260px; min-width: 0; }
.mat-audio { width: 100%; max-width: 460px; margin-top: 10px; display: block; }
.mat-img { max-width: 260px; max-height: 180px; border-radius: 10px; margin-top: 10px; border: 1px solid var(--border); display: block; }
.mat-video { position: relative; width: 100%; max-width: 560px; aspect-ratio: 16 / 9; margin-top: 10px; border-radius: 12px; overflow: hidden; background: #000; }
.mat-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.mat-count { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--primary); }
.mat-card { text-decoration: none; color: inherit; }

/* ---------- Safari / iPhone ---------- */
/* date and time boxes: iOS collapses empty ones and centres the text */
input[type=date], input[type=time], input[type=datetime-local] { -webkit-appearance: none; appearance: none; min-height: 43px; display: block; line-height: 1.3; }
input::-webkit-date-and-time-value { text-align: left; min-height: 1.3em; }
input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator { opacity: .7; }
/* iPhones zoom into any form field with text smaller than 16px: avoid that on phones */
@media (max-width: 760px), (pointer: coarse) {
  input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=datetime-local],
  input[type=search], input[type=number], input[type=url], select, textarea, .ad-search input { font-size: 16px; }
}
/* no :has() before Safari 15.4: the dashboards add this class themselves */
.dash-rail-wrap.no-rail { grid-template-columns: minmax(0, 1fr); }

/* ---------- Profile, top-ups, statement ---------- */
.ad-avatar.has-photo, .profile-avatar.has-photo { padding: 0; overflow: hidden; }
.ad-avatar img, .profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 24px; align-items: center; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.profile-avatar { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; font-size: 2.2rem; font-weight: 800; background: color-mix(in srgb, var(--primary) 14%, #fff); color: var(--primary); border: 4px solid #fff; box-shadow: 0 6px 18px rgba(17,24,39,.12); }
.photo-btn { cursor: pointer; }
.profile-name { font-size: 1.5rem !important; margin: 0 0 6px !important; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.profile-stats { display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 10px; }
.profile-stats > * { display: flex; flex-direction: column; padding: 12px 14px; border-radius: 12px; background: #f8f9fc; text-decoration: none; color: inherit; }
.profile-stats span { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.profile-stats strong { font-size: 1.25rem; }
.profile-links { display: flex; flex-direction: column; gap: 4px; }
.profile-links a, .profile-theme { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: left; }
.profile-links a:hover, .profile-theme:hover { background: #f8f9fc; }
@media (max-width: 900px) { .profile-hero { grid-template-columns: 1fr; text-align: center; } .profile-meta { justify-content: center; } }
.fees-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; margin-bottom: 22px; }
@media (max-width: 900px) { .fees-actions { grid-template-columns: 1fr; } }
.topup-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.topup-quick .chip { cursor: pointer; border: 1px solid var(--border); background: #fff; font: inherit; font-weight: 600; padding: 6px 12px; }
.topup-quick .chip:hover { border-color: var(--primary); color: var(--primary); }
.topup-row { display: flex; gap: 8px; flex-wrap: wrap; }
.topup-row input { flex: 1 1 150px; width: auto; }
.wallet-box { border: 2px solid #8b5cf6; }
.wallet-form { display: flex; gap: 8px; flex-wrap: wrap; }
.wallet-form input { flex: 1 1 120px; width: auto; }

/* ---------- Attendance ---------- */
.att-layout { align-items: start; }
.att-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.att-quick .chip { cursor: pointer; border: 1px solid var(--border); background: transparent; font: inherit; }
.att-table td, .att-table th { vertical-align: middle; }
.att-cell { text-align: center; }
.att-radio { display: inline-grid; place-items: center; cursor: pointer; position: relative; }
.att-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.att-radio span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; border: 1.5px solid var(--border); color: var(--muted); }
.att-radio input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.att-P input:checked + span { background: #16a34a; border-color: #16a34a; color: #fff; }
.att-L input:checked + span { background: #d97706; border-color: #d97706; color: #fff; }
.att-A input:checked + span { background: #dc2626; border-color: #dc2626; color: #fff; }
.att-E input:checked + span { background: #64748b; border-color: #64748b; color: #fff; }
.att-note { min-width: 120px; padding: 6px 8px !important; }
.att-grid th, .att-grid td { padding: 6px 8px; }
.att-mark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: .72rem; font-weight: 700; color: #fff; }
.att-mark.att-P { background: #16a34a; } .att-mark.att-L { background: #d97706; } .att-mark.att-A { background: #dc2626; } .att-mark.att-E { background: #64748b; }
.nowrap { white-space: nowrap; }
.att-card summary { list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.att-card summary::-webkit-details-marker { display: none; }
.att-card.is-low { border: 1.5px solid #fecaca; }
.att-pct { font-size: 1.5rem; font-weight: 800; color: #16a34a; }
.att-pct.low { color: #dc2626; }
@media print { .att-layout { display: none; } }

/* ---------- Licence ---------- */
.lic-dash { margin-bottom: 22px; }
.lic-widget { --lc: #16a34a; --lbg: #f0fdf4; display: flex; align-items: center; gap: 20px; background: var(--lbg); border: 2px solid var(--lc); border-radius: 18px; padding: 16px 22px; color: #0f172a; }
.lic-widget.lic-orange { --lc: #ea580c; --lbg: #fff7ed; }
.lic-widget.lic-red { --lc: #dc2626; --lbg: #fef2f2; }
.lic-count { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 124px; min-height: 84px; border-radius: 14px; background: var(--lc); color: #fff; padding: 8px 12px; }
.lic-count strong { font-size: 2.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.lic-count span { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }
.lic-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lic-title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--lc); }
.lic-due { font-size: .95rem; }
.lic-note { font-size: .86rem; color: #475569; }
.lic-bar { height: 6px; border-radius: 999px; background: rgba(15, 23, 42, .08); overflow: hidden; margin-top: 4px; max-width: 420px; }
.lic-bar span { display: block; height: 100%; background: var(--lc); border-radius: 999px; }
.lic-btn { background: var(--lc) !important; border-color: var(--lc) !important; color: #fff !important; flex-shrink: 0; }
.lic-flash .lic-count, .lic-banner.lic-flash { animation: lic-blink 1.1s ease-in-out infinite; }
@keyframes lic-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .lic-flash .lic-count, .lic-banner.lic-flash { animation: none; } }
.lic-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #dc2626; color: #fff; border-radius: 14px; padding: 12px 18px; margin-bottom: 18px; font-weight: 600; font-size: .92rem; }
.lic-banner a { color: #fff; margin-left: auto; text-decoration: underline; }
.lic-banner .lic-ask { margin-left: auto; font-weight: 500; opacity: .9; }
.lic-plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.lic-plan { display: flex; align-items: center; gap: 10px; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; cursor: pointer; font-weight: 400; margin: 0; }
.lic-plan input { width: auto; }
.lic-plan span { display: flex; flex-direction: column; }
.lic-plan em { font-style: normal; color: #64748b; font-size: .86rem; }
.lic-plan:has(input:checked) { border-color: var(--primary); background: #f8f9fc; }
.lic-locked { max-width: 560px; }
.lic-lock-ico { width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; background: #fee2e2; color: #dc2626; }
.lic-people { list-style: none; padding: 0; margin: 0 0 12px; }
.lic-people li { padding: 6px 0; }
@media (max-width: 640px) { .lic-widget { flex-wrap: wrap; } .lic-btn { width: 100%; text-align: center; } }
[data-theme="dark"] .lic-widget { --lbg: rgba(34, 197, 94, .1); color: #e5e7eb; }
[data-theme="dark"] .lic-widget.lic-orange { --lbg: rgba(234, 88, 12, .12); }
[data-theme="dark"] .lic-widget.lic-red { --lbg: rgba(220, 38, 38, .14); }
[data-theme="dark"] .lic-note { color: #9ca3af; }
[data-theme="dark"] .lic-bar { background: rgba(255, 255, 255, .1); }
[data-theme="dark"] .lic-lock-ico { background: rgba(220, 38, 38, .18); }
