/* AFS Kanpur Cantt — School Portal
   Navy & gold, matching the public website. No inline styles anywhere (CSP). */
:root {
  --navy: #0b1f4b;
  --navy-2: #132e6b;
  --navy-3: #1d3f8a;
  --gold: #d4a017;
  --gold-soft: #fbf3dc;
  --bg: #f3f5fa;
  --card: #ffffff;
  --text: #1c2434;
  --muted: #667085;
  --border: #e3e7ef;
  --success: #12804b;
  --success-soft: #e6f6ee;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --warning: #b7791f;
  --warning-soft: #fff6e0;
  --info: #1d5fbf;
  --info-soft: #e8f0fc;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
  --sidebar: 252px;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Playfair Display', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--navy-3); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0 0 .4rem; line-height: 1.25; }

/* ---------- Layout ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--navy); color: #dbe3f5;
  display: flex; flex-direction: column; overflow-y: auto; z-index: 40; transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1rem; color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 50%; padding: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: .98rem; }
.brand-text small { color: var(--gold); font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; }
.nav { padding: .6rem .6rem 1.5rem; }
.nav-section { margin: 1rem .6rem .35rem; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: #8fa0c7; }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--radius-sm); color: #dbe3f5; font-weight: 500; }
.nav-link i { width: 18px; text-align: center; color: #9fb2de; }
.nav-link:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: .65rem 1.4rem;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border);
}
.topbar-session { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: .4rem; }
.topbar-name { font-weight: 600; margin-right: .3rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-2); color: #fff; display: grid; place-items: center; font-weight: 700; }
.content { padding: 1.5rem 1.4rem 3rem; max-width: 1280px; width: 100%; }
.menu-toggle { display: none; }
.backdrop { display: none; }

/* ---------- Guest (login) ---------- */
.guest { background: radial-gradient(circle at 20% 10%, var(--navy-3), var(--navy) 60%); min-height: 100vh; }
.guest-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.guest-card { width: 100%; max-width: 420px; background: var(--card); border-radius: 16px; padding: 2rem 1.75rem; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); border-top: 4px solid var(--gold); }
.guest-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.4rem; color: var(--navy); }
.guest-brand:hover { text-decoration: none; }
.guest-brand img { width: 56px; height: 56px; object-fit: contain; }
.guest-brand span { display: flex; flex-direction: column; }
.guest-brand strong { font-family: var(--font-head); font-size: 1.25rem; }
.guest-brand small { color: var(--muted); }
.guest-title { font-family: var(--font-head); color: var(--navy); font-size: 1.6rem; }
.guest-foot { color: #b8c4e0; font-size: .82rem; margin-top: 1rem; }

/* ---------- Typography helpers ---------- */
.page-title { font-family: var(--font-head); color: var(--navy); font-size: 1.65rem; }
.card-title { font-size: 1.05rem; color: var(--navy); margin-bottom: .8rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; color: #475467; }
.hide-sm { display: inline; }

/* ---------- Cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.2rem; min-width: 0; }
.card.narrow { max-width: 640px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .card { margin-top: 1.2rem; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-header p { margin: .2rem 0 0; max-width: 760px; }
.hero-card { background: linear-gradient(120deg, var(--navy), var(--navy-3)); color: #fff; border-radius: var(--radius); padding: 1.6rem 1.5rem; margin-bottom: 1.4rem; box-shadow: var(--shadow); }
.hero-card .page-title { color: #fff; }
.hero-card .muted { color: #c8d3ee; }
.hero-card .chip { background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .2); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.tile { display: flex; flex-direction: column; gap: .35rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; box-shadow: var(--shadow); color: var(--text); transition: transform .15s ease, border-color .15s ease; }
.tile:hover { transform: translateY(-2px); border-color: var(--gold); text-decoration: none; }
.tile i { font-size: 1.4rem; color: var(--gold); }
.tile-label { font-weight: 700; color: var(--navy); }
.tile-text { color: var(--muted); font-size: .88rem; }

/* ---------- Chips & badges ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.chip { display: inline-flex; align-items: center; padding: .15rem .6rem; border-radius: 999px; background: var(--info-soft); color: var(--navy-2); border: 1px solid #d4e1f7; font-size: .8rem; font-weight: 600; }
.chip-muted { background: #f2f4f7; color: var(--muted); border-color: var(--border); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 6px; font-size: .75rem; font-weight: 700; background: #eef1f6; color: #475467; vertical-align: middle; }
.badge-gold { background: var(--gold-soft); color: #8a6508; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-dark { background: #e4e7ec; color: #344054; }
.badge-muted { background: #f2f4f7; color: var(--muted); }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: flex-start; gap: .6rem; padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; border: 1px solid transparent; transition: opacity .4s ease; }
.alert span { flex: 1; }
.alert.fade { opacity: 0; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #bfe6d1; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f5c6c0; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f4dfab; }
.alert-info { background: var(--info-soft); color: var(--info); border-color: #c9dbf7; }
.alert-close { border: 0; background: none; font-size: 1.2rem; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.notice { background: var(--gold-soft); border: 1px solid #f0dfad; color: #6b4f06; padding: .7rem .9rem; border-radius: var(--radius-sm); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
label { font-weight: 600; font-size: .9rem; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=time], input[type=email], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); padding: .6rem .75rem; border: 1px solid #cdd5e1; border-radius: var(--radius-sm); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(29, 63, 138, .25); border-color: var(--navy-3); }
.hint { margin: 0; color: var(--muted); font-size: .82rem; }
.field-error { margin: 0; color: var(--danger); font-size: .85rem; font-weight: 600; }
.check { display: flex; align-items: flex-start; gap: .5rem; font-weight: 500; cursor: pointer; }
.check input { margin-top: .25rem; width: 16px; height: 16px; accent-color: var(--navy-3); }
.role-option { padding: .55rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.role-option.is-locked { background: #f8f9fb; color: var(--muted); cursor: not-allowed; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filters input, .filters select { width: auto; flex: 1 1 160px; }
.inline-form { display: inline; margin: 0; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; }

/* inline "row" forms used in tables and quick-add bars */
.row-form { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin: 0; }
.row-form input[type=text], .row-form input[type=number], .row-form input[type=date], .row-form select { width: auto; flex: 1 1 140px; padding: .4rem .55rem; }
.row-form .input-sm, .input-sm { flex: 0 1 120px !important; width: 120px; }
.row-form .input-xs, .input-xs { flex: 0 1 80px !important; width: 80px; }
.add-row { margin-top: .9rem; padding-top: .9rem; border-top: 1px dashed var(--border); }
.copy-form select { width: auto; padding: .3rem .4rem; }
.table input, .table select { padding: .35rem .5rem; }
.section-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 1rem; }
.section-card { margin-bottom: 0; }
.section-card-head { display: flex; justify-content: space-between; align-items: center; }
.section-row { display: flex; align-items: center; gap: .5rem; padding: .45rem 0; border-top: 1px solid #eef1f6; }
.section-row .row-form { flex: 1; }
.section-name { display: inline-grid; place-items: center; min-width: 2rem; height: 2rem; border-radius: 8px; background: var(--navy-2); color: #fff; font-weight: 700; }
.notice-card .notice { margin: 0; }

/* multi-part forms */
.form-sections { display: flex; flex-direction: column; gap: 0; }
.form-sections fieldset { border: 1px solid var(--border); }
.form-sections legend { padding: 0 .3rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1rem; margin-bottom: .9rem; }
.role-grid, .check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .5rem; margin-bottom: .9rem; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .8rem 0 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.guardian { padding: .55rem 0; border-top: 1px solid #eef1f6; }
.guardian:first-of-type { border-top: 0; }
.map-row { display: flex; align-items: center; gap: .6rem; padding: .35rem 0; border-top: 1px solid #eef1f6; }
.map-subject { flex: 0 0 42%; }
.map-row select { flex: 1; width: auto; padding: .35rem .5rem; }

/* stats + progress */
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-warn .stat-value { color: var(--warning); }
.progress { height: 12px; background: #e9edf5; border-radius: 999px; overflow: hidden; margin: .6rem 0; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--navy-3), var(--gold)); transition: width .3s ease; }

/* ID cards (CR80: 85.6 × 54 mm) */
.idcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(86mm, 1fr)); gap: 6mm; }
.idcard { width: 86mm; height: 54mm; border-radius: 3mm; overflow: hidden; background: #fff; border: 1px solid #c9d2e3; display: flex; flex-direction: column; break-inside: avoid; }
.idcard-head { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 2mm; padding: 1.5mm 3mm; border-bottom: 1mm solid var(--gold); }
.idcard-head img { width: 9mm; height: 9mm; background: #fff; border-radius: 50%; padding: .4mm; }
.idcard-head div { display: flex; flex-direction: column; line-height: 1.15; font-size: 9pt; }
.idcard-head span { font-size: 6.5pt; color: #f2d98a; }
.idcard-body { display: flex; gap: 3mm; padding: 2.5mm 3mm; font-size: 7.5pt; line-height: 1.45; }
.idcard-photo { width: 21mm; height: 28mm; object-fit: cover; border-radius: 1.5mm; border: .3mm solid #c9d2e3; }
.idcard-name { font-weight: 700; font-size: 9pt; color: var(--navy); margin-bottom: .5mm; }
.photo-row { display: flex; gap: 1rem; align-items: flex-end; margin-bottom: 1rem; flex-wrap: wrap; }
.profile-photo { width: 120px; height: 160px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.list-photo { display: block; width: 36px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #e9edf5; }

/* attendance: segmented P / A / L / H buttons */
.section-title { font-size: 1.05rem; color: var(--navy); margin: 0 0 .7rem; }
.seg { display: inline-flex; border: 1px solid #cdd5e1; border-radius: 8px; overflow: hidden; }
.seg-option { position: relative; cursor: pointer; }
.seg-option input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg-option span { display: block; min-width: 2.4rem; text-align: center; padding: .35rem .5rem; font-weight: 700; color: var(--muted); border-left: 1px solid #e3e7ef; }
.seg-option:first-child span { border-left: 0; }
.seg-option input:checked + span { color: #fff; background: var(--navy-3); }
.seg-a input:checked + span { background: var(--danger); }
.seg-l input:checked + span, .seg-od input:checked + span { background: var(--info); }
.seg-h input:checked + span, .seg-hd input:checked + span { background: var(--warning); }
.seg-p input:checked + span { background: var(--success); }
.seg-option input:focus-visible + span { outline: 2px solid var(--gold); }
.attendance-tools { margin-bottom: .6rem; align-items: center; }
.register td.center, .register th.center { text-align: center; padding: .3rem .25rem; }
.reg-a { color: var(--danger); font-weight: 700; }
.reg-l { color: var(--info); }
.reg-h { color: var(--warning); }

/* one-time credential slips */
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.slip { background: #fff; border: 2px dashed #b9c3d6; border-radius: 10px; padding: 1rem 1.1rem; line-height: 1.7; }
.slip-head { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.slip-kind { font-weight: 700; color: var(--gold); font-size: .82rem; }
.slip-name { font-family: var(--font-head); font-size: 1.15rem; color: var(--navy); }
.slip .password, .slip .username { font-size: 1rem; color: var(--text); font-weight: 700; }
.slip-foot { font-size: .75rem; color: var(--muted); margin-top: .4rem; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600; padding: .55rem 1rem; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.2; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--navy-2); color: #fff; }
.btn-primary:hover { background: var(--navy); }
.btn-secondary { background: #fff; color: var(--navy-2); border-color: #cdd5e1; }
.btn-secondary:hover { border-color: var(--navy-3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-link { background: none; color: var(--navy-3); padding: .4rem .5rem; }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: none; font-size: 1.2rem; cursor: pointer; color: var(--navy); padding: .3rem .5rem; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: .6rem .6rem; border-bottom: 1px solid var(--border); }
.table td { padding: .65rem .6rem; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-compact td { padding: .45rem .5rem; }
.table-scroll { overflow-x: auto; }
.row-muted td { color: var(--muted); }
.empty { color: var(--muted); padding: 1rem 0; text-align: center; }
.plain-list { margin: 0; padding-left: 1.1rem; }
.pagination { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; margin-top: 1rem; align-items: center; }
.pagination a { padding: .3rem .65rem; border: 1px solid var(--border); border-radius: 6px; }
.pagination a.current { background: var(--navy-2); color: #fff; border-color: var(--navy-2); }

/* ---------- Permission matrix ---------- */
.matrix { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.matrix-module { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .9rem; margin: 0; display: flex; flex-direction: column; gap: .45rem; }
.matrix-module legend { padding: 0 .3rem; font-weight: 700; color: var(--navy); }
.matrix-wide { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.matrix-wide legend, .matrix-wide .hint { grid-column: 1 / -1; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, #fff 35%); padding: 1rem 0 .2rem; margin-top: .8rem; }

/* ---------- Misc ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.session-switch select { width: auto; padding: .25rem .5rem; font-size: .82rem; margin-left: .4rem; }
.console, .debug { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; font-size: .82rem; white-space: pre-wrap; margin: 0; }
.error-card { text-align: center; margin: 2rem auto; }
.error-code { font-family: var(--font-head); font-size: 3.2rem; color: var(--gold); font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(9, 18, 40, .45); z-index: 35; }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-block; }
  .content { padding: 1rem .9rem 2.5rem; }
  .topbar { padding: .55rem .9rem; }
  .topbar-name, .hide-sm { display: none; }
  .field-row { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table td, .table th { white-space: nowrap; }
}
/* Timetable */
[hidden] { display: none !important; }
.timetable th, .timetable td { text-align: center; vertical-align: middle; }
.timetable th[scope="row"] { text-align: left; white-space: nowrap; }
.timetable th { padding: .5rem .35rem; }
.timetable td.tt-cell { min-width: 86px; padding: .25rem; }
.tt-link { display: block; min-height: 3.1rem; padding: .3rem; border-radius: var(--radius-sm); color: inherit; text-decoration: none; }
.tt-link:hover, .tt-link:focus-visible { background: var(--info-soft); outline: none; }
.tt-selected, .tt-selected .tt-link { background: var(--gold-soft); }
.tt-subject { display: block; font-size: .85rem; font-weight: 700; color: var(--navy); }
.tt-staff { display: block; font-size: .78rem; color: var(--muted); }
.tt-room { display: inline-block; padding: 0 .35rem; border: 1px solid var(--border); border-radius: 4px; font-size: .72rem; color: var(--muted); }
.tt-empty { color: #c3c9d4; }
.tt-today th[scope="row"] { color: var(--navy); box-shadow: inset 3px 0 0 var(--gold); }
.week-entries { display: flex; flex-wrap: wrap; gap: .4rem; }
.week-entry { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; padding: .25rem .55rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fafbfd; font-size: .85rem; }

/* Notifications */
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--gold); color: var(--navy); font-size: .72rem; font-weight: 700; line-height: 20px; text-align: center; }
.bell { position: relative; color: var(--navy); }
.bell-count { position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li { border-bottom: 1px solid #eef1f6; }
.note-list a { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem .4rem; color: inherit; text-decoration: none; }
.note-list a:hover { background: #f7f9fc; }
.note-list .note-dot { flex: 0 0 9px; height: 9px; margin-top: .45rem; border-radius: 50%; background: transparent; }
.note-list .unread .note-dot { background: var(--info); }
.note-list .unread strong { color: var(--navy); }

/* Announcements */
.check-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border: 1px solid var(--border); border-radius: 999px; background: #fff; font-size: .85rem; cursor: pointer; }
.check-chip:has(input:checked) { border-color: var(--navy-3); background: var(--info-soft); color: var(--navy); }
.card > .field + .field, .card > .chips + .field, .card > .field + .chips { margin-top: .85rem; }
.field > .label { display: block; margin-bottom: .35rem; font-weight: 600; font-size: .88rem; }
.announcement-body { font-size: 1rem; line-height: 1.65; white-space: normal; margin-bottom: 1rem; }

/* Exams */
.admit-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 1rem; }
.admit-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; break-inside: avoid; }
.admit-head { display: flex; gap: .7rem; align-items: center; border-bottom: 2px solid var(--navy); padding-bottom: .5rem; margin-bottom: .6rem; }
.admit-body { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .5rem; }
.admit-card .slip-foot { display: flex; justify-content: space-between; margin-top: 2.2rem; border-top: 0; }
.admit-photo { width: 72px; height: 96px; object-fit: cover; border: 1px solid var(--border); }
.term-weights { margin: .6rem 0 1rem; align-items: center; }
.term-form { margin-bottom: 1rem; }
.scheme-settings { margin-top: .5rem; }
.scheme-settings summary { cursor: pointer; font-weight: 600; color: var(--navy-3); margin-bottom: .6rem; }
@media print { .admit-cards { display: block; } .admit-card { margin-bottom: 8mm; } }

.mark-chip { text-decoration: none; }
.mark-chip small { font-weight: 500; opacity: .8; }
.marks-table .marks-input { width: 5.5rem; text-align: center; font-weight: 600; }

.report-card-page { overflow-x: auto; margin-bottom: 1rem; }
.report-card-page .rc { min-width: 640px; }

/* Dashboards: bars sized by class (no inline styles under the CSP) */
.bar-cell { display: inline-flex; align-items: center; gap: .5rem; min-width: 140px; }
.bar { flex: 1 1 80px; height: 8px; border-radius: 4px; background: #edf0f5; overflow: hidden; display: inline-block; }
.bar-fill { display: block; height: 100%; border-radius: 4px; }
.bar-good { background: var(--success); }
.bar-mid { background: var(--warning); }
.bar-low { background: var(--danger); }
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }

/* Self-service */
.card .stat-row { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .6rem; margin-bottom: .4rem; }
.card .stat { box-shadow: none; padding: .7rem .8rem; }
.person-hero { display: flex; gap: 1.2rem; align-items: center; }
.person-hero .profile-photo { width: 84px; height: 112px; object-fit: cover; border-radius: var(--radius-sm); background: #fff; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 1rem 0 .4rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow { text-align: center; font-size: .72rem; font-weight: 700; color: var(--muted); }
.cal-day { display: inline-flex; align-items: center; justify-content: center; min-height: 2.1rem; border-radius: 6px; background: #f7f9fc; font-size: .82rem; }
.cal-key .cal-day { min-height: 0; width: 1.4rem; margin: 0 .2rem 0 .6rem; }
.cal-p { background: var(--success-soft); color: var(--success); font-weight: 700; }
.cal-a { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.cal-l, .cal-h { background: var(--warning-soft); color: var(--warning); font-weight: 700; }
.cal-off { background: #eceff4; color: #a0a8b6; }
.card-link { display: block; color: inherit; text-decoration: none; }
.card-link:hover { box-shadow: 0 0 0 2px var(--gold-soft), var(--shadow); }

/* Leave */
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.tabs { margin: 0 0 1rem; }
.timeline { list-style: none; margin: 0 0 1rem; padding: 0; }
.timeline li { position: relative; padding: 0 0 .8rem 1.3rem; border-left: 2px solid var(--border); margin-left: .4rem; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: .25rem; width: 12px; height: 12px; border-radius: 50%; background: var(--border); }
.timeline li span { display: block; }
.timeline .timeline-approved::before { background: var(--success); }
.timeline .timeline-rejected::before { background: var(--danger); }
.timeline .timeline-pending::before { background: var(--gold); }
.decide-form { border-top: 1px solid var(--border); padding-top: .9rem; }

/* Arrangements */
.cover-form { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.cover-form select { max-width: 300px; }
.row-open td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.register-sheet .sign-cell { min-width: 130px; }
@media (max-width: 760px) {
  /* each period becomes a card: details first, the cover form below */
  .arrangement-table thead { display: none; }
  .arrangement-table tr { display: block; padding: .6rem 0 .6rem .7rem; border-bottom: 1px solid var(--border); }
  .arrangement-table td { display: block; padding: .15rem 0; border: 0; }
  .arrangement-table .row-open td:first-child { box-shadow: none; }
  .arrangement-table tr.row-open { box-shadow: inset 3px 0 0 var(--gold); }
  .cover-form select { max-width: 100%; flex: 1 1 100%; }
}

@media print {
  .sidebar, .topbar, .alert, .page-header .btn, .backdrop, .sticky-actions { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; }
  body { background: #fff; }
  .slip { break-inside: avoid; }
  .cover-form, .page-header form { display: none !important; }
  .table-scroll { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Portfolio */
.portfolio-list li { padding: .55rem 0; border-bottom: 1px solid #eef1f6; }
.portfolio-list li:last-child { border-bottom: 0; }
.shared-portfolio { max-width: 980px; margin: 0 auto; padding: 1rem; }
