/* =========================================================
   CRS Portal – single stylesheet (no framework required)
   ========================================================= */
:root {
  --bg: #f1f3f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --ink: #1d2330;
  --ink-2: #4a5263;
  --muted: #7a8394;
  --line: #e3e6eb;
  --primary: #3b5bdb;
  --primary-2: #2f4ac0;
  --tab: #2271b1;
  --green: #1f9d55; --green-bg: #e6f6ec;
  --amber: #b7791f; --amber-bg: #fdf3dc;
  --red: #d64545;   --red-bg: #fde8e8;
  --grey-bg: #eceff3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  --sidebar: 248px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.1rem; } h4 { font-size: .98rem; }
p { margin: 0 0 .8em; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: .85em; }
.muted { color: var(--muted); } .small { font-size: .85em; } .center { text-align: center; } .right { text-align: right; }
.strong { font-weight: 600; } .nowrap { white-space: nowrap; } .lead { font-size: .95rem; margin-bottom: 14px; }
.pos { color: var(--green); } .neg { color: var(--red); }
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: #151b2b; color: #c9cfdb; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .25s; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; border-bottom: 1px solid #242c40; }
.brand strong { color: #fff; display: block; font-size: 1.05rem; }
.brand small { color: #8f98ab; font-size: .78rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #f7c948, #e89b0c); color: #3b2800; display: grid; place-items: center; }
.sidebar nav { padding: 10px; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; margin: 2px 0; border-radius: 8px; color: #c9cfdb; font-weight: 500; }
.sidebar nav a:hover { background: #1f2740; text-decoration: none; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .pill { margin-left: auto; font-style: normal; background: #f59f00; color: #1d1400; font-size: .72rem; font-weight: 700; border-radius: 10px; padding: 1px 8px; }
.house-strip { display: flex; height: 5px; } .house-strip span { flex: 1; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 24px; }
.page-title { font-size: 1.2rem; margin: 0; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 9px; margin-right: 6px; }
.user-chip strong { display: block; font-size: .88rem; } .user-chip small { color: var(--muted); font-size: .76rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.icon-btn { border: 0; background: transparent; color: var(--ink-2); width: 34px; height: 34px; border-radius: 8px; display: inline-grid; place-items: center; cursor: pointer; font-size: 14px; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.content { padding: 22px 24px 40px; max-width: 1400px; width: 100%; }
.foot { margin-top: auto; padding: 14px 24px; color: var(--muted); font-size: .78rem; border-top: 1px solid var(--line); }
.only-mobile { display: none; }

/* ---------- Cards & grids ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; border: 1px solid #e8ebf0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2.tight { gap: 12px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); }
.form-narrow { max-width: 880px; }
.stack > * + * { margin-top: 10px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: .88rem; color: var(--ink); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #c9ced8; border-radius: 8px; padding: 9px 11px; width: 100%; margin-top: 5px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 91, 219, .15); }
input.invalid, textarea.invalid { border-color: var(--red); box-shadow: 0 0 0 3px rgba(214, 69, 69, .15); }
textarea { resize: vertical; margin-top: 12px; }
label textarea { margin-top: 5px; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; accent-color: var(--primary); }
input[type=color] { padding: 2px; width: 44px; height: 38px; }
label.check { display: inline-flex; align-items: center; gap: 7px; font-weight: 500; cursor: pointer; }
.field-label { font-weight: 600; font-size: .95rem; margin: 14px 0 8px; }
.field-label.small { font-size: .85rem; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 14px 0; }
legend { font-weight: 600; padding: 0 6px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-start; margin-top: 14px; flex-wrap: wrap; }
.row-fields { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; margin-bottom: 12px; }
.row-fields > input { width: auto; }
.inline-field { display: flex; align-items: center; gap: 10px; font-size: .85rem; }
.inline-field span { white-space: nowrap; }
.inline-field select, .inline-field input { margin-top: 0; min-width: 170px; }
.inline-field input[type=number] { min-width: 110px; width: 130px; }
form.inline { display: inline; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 8px; padding: 9px 16px; cursor: pointer; background: var(--surface-2); color: var(--ink); transition: background .15s, transform .05s; text-decoration: none !important; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-2); }
.btn-light { background: #fff; border-color: #d3d8e1; color: var(--ink-2); } .btn-light:hover { background: var(--surface-2); }
.btn-outline { background: #fff; border-color: var(--primary); color: var(--primary); } .btn-outline:hover { background: #eef2ff; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-outline-danger { background: #fff; border-color: #f0b4b4; color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: .85rem; } .btn-xs { padding: 3px 9px; font-size: .78rem; border-radius: 6px; }
.btn-block { width: 100%; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Alerts, badges, toasts ---------- */
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; transition: opacity .5s; }
.alert.fade { opacity: 0; height: 0; padding: 0; margin: 0; border: 0; overflow: hidden; }
.alert-success { background: var(--green-bg); border-color: #b7e4c7; color: #135c32; }
.alert-error { background: var(--red-bg); border-color: #f5c2c2; color: #8a1f1f; }
.alert-info { background: #e8f1fd; border-color: #bcd6f7; color: #1c4a86; }
.alert-warn { background: var(--amber-bg); border-color: #f1d9a0; color: #6e4a07; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; text-transform: capitalize; letter-spacing: .02em; }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-grey { background: var(--grey-bg); color: #5d6677; }
.badge-role-admin { background: #1d2330; color: #fff; } .badge-role-head { background: #e8e3ff; color: #5433c9; }
.badge-role-teacher { background: #e3f0ff; color: #1b5fb0; } .badge-role-viewer { background: var(--grey-bg); color: #5d6677; }
#toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: #1d2330; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); transform: translateY(12px); opacity: 0; transition: .25s; border-left: 4px solid var(--green); }
.toast.show { transform: none; opacity: 1; }
.toast-error { border-left-color: #ff6b6b; } .toast-warn { border-left-color: #f59f00; } .toast-info { border-left-color: #4dabf7; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 20, 35, .5); display: grid; place-items: center; z-index: 90; padding: 16px; animation: fadein .15s; }
.modal { background: #fff; border-radius: 14px; padding: 22px; width: min(440px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: 90vh; overflow: auto; }
.modal-lg { width: min(640px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }
.modal-body h4 { margin-top: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
@keyframes fadein { from { opacity: 0; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); background: var(--surface-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfd; }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table tfoot th { background: #f0f4fb; }
.table td.actions { text-align: right; }
.table td.actions > * { margin-left: 4px; }
tr.status-void td, tr.status-rejected td { color: #9aa1ae; text-decoration: line-through; text-decoration-color: rgba(0,0,0,.2); }
tr.status-void td.actions, tr.status-rejected td.actions, tr.status-void td:nth-child(9), tr.status-rejected td:nth-child(9) { text-decoration: none; }
tr.status-pending { background: #fffcf2; }
tr.flash-row { animation: flash 1.6s; }
@keyframes flash { from { background: #e3f7ea; } }
.hdot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--c); }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; padding-top: 14px; }

/* ---------- Filters / toolbar ---------- */
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.filters label { font-size: .78rem; color: var(--ink-2); }
.filters select, .filters input { padding: 7px 10px; margin-top: 3px; min-width: 130px; }
.filters .grow { flex: 1; min-width: 200px; }
.filters-card { padding: 14px 18px; }
.filters-actions { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 20px; background: #fff; border: 1px solid #d3d8e1; color: var(--ink-2); font-weight: 500; font-size: .85rem; }
.chip em { font-style: normal; margin-left: 6px; font-size: .75rem; color: var(--muted); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); } .chip.active em { color: #c3c9d4; }
.chip:hover { text-decoration: none; }
.live-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- House point entry ---------- */
.ctx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 280px)); gap: 14px 24px; }
.house-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.house-opt { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px 9px 12px; border: 2px solid #e1e5ec; border-radius: 30px; cursor: pointer; font-weight: 600; background: #fff; transition: .15s; user-select: none; }
.house-opt input { position: absolute; opacity: 0; pointer-events: none; }
.house-opt .dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--c); transition: .15s; }
.house-opt:hover { border-color: var(--c); }
.house-opt:has(input:checked) { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 4px 14px -4px var(--c); }
.house-opt:has(input:checked) .dot { background: #fff; border-color: #fff; }
.house-opt:has(input:focus-visible) { outline: 3px solid rgba(59,91,219,.35); outline-offset: 2px; }
.house-picker.shake { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
body.house-picked #entry-context { border-top: 4px solid var(--house); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 16px; }
.tab { border: 0; background: #e2e4e8; color: #2c3340; padding: 8px 16px; border-radius: 4px; font: inherit; font-size: .88rem; cursor: pointer; transition: .15s; }
.tab:hover { background: #d4d8de; }
.tab.active { background: var(--tab); color: #fff; }
.panel { display: none; } .panel.active { display: block; animation: fadein .2s; }
.sub-panel { display: none; } .sub-panel.active { display: block; }
.seg { display: inline-flex; gap: 6px; margin-bottom: 14px; }
.seg-btn { border: 1px solid #9aa1ae; background: #f3f4f6; padding: 6px 14px; border-radius: 3px; cursor: pointer; font: inherit; font-size: .85rem; }
.seg-btn.active { background: var(--tab); border-color: var(--tab); color: #fff; }
.rubric { width: 100%; border-collapse: collapse; margin: 6px 0 16px; font-size: .88rem; }
.rubric th, .rubric td { border: 1px solid var(--line); padding: 8px 12px; text-align: center; }
.rubric thead th { background: var(--surface-2); font-weight: 600; }
.rubric tfoot th { background: #f0f4fb; position: relative; }
.rubric tfoot th.w-marks { background: linear-gradient(90deg, #d7f2e0 calc(var(--pct, 0) * 100%), #f0f4fb 0); }
.rubric tfoot th.full { color: var(--green); }
.rubric .w-marks { width: 150px; }
.rubric input.mark { width: 72px; text-align: center; margin: 0 auto; padding: 8px 4px; display: block; font-weight: 600; }
.rubric .right { text-align: right; }
.students-block { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.sb-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 8px; }
.student-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.student-row { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(90px, .7fr) minmax(140px, 1.3fr) 34px; gap: 8px; align-items: center; padding: 6px; border-radius: 10px; background: var(--surface-2); animation: fadein .2s; }
.student-row input { margin: 0; }
.student-row.linked .st-name { border-color: var(--green); background: #f3fbf6; }
.ac-wrap { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); z-index: 20; display: none; max-height: 280px; overflow: auto; }
.ac-list.open { display: block; }
.ac-item { padding: 8px 12px; cursor: pointer; } .ac-item small { color: var(--muted); }
.ac-item:hover, .ac-item.active { background: #eef2ff; }
.ac-empty { padding: 10px 12px; color: var(--muted); font-size: .85rem; }
.points-preview { font-size: 1rem; } .points-preview strong { font-size: 1.3rem; }

/* ---------- Dashboard ---------- */
.standings { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.house-card { position: relative; background: #fff; border-radius: 16px; padding: 18px 18px 14px; box-shadow: var(--shadow); border: 1px solid #e8ebf0; border-top: 6px solid var(--c); overflow: hidden; }
.house-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: var(--c); opacity: .08; }
.house-card.leader { box-shadow: 0 10px 30px -10px var(--c), var(--shadow); }
.house-card.pulse { animation: pulse 1.2s; }
@keyframes pulse { 30% { transform: scale(1.03); box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 30%, transparent); } }
.hc-top { display: flex; align-items: center; gap: 10px; }
.hc-rank { font-weight: 800; font-size: 1.05rem; color: var(--ink-2); } .hc-rank sup { font-size: .6em; }
.hc-name { font-weight: 700; font-size: 1.15rem; }
.hc-total { margin: 8px 0 10px; display: flex; align-items: baseline; gap: 6px; }
.hc-total .num { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hc-total small { color: var(--muted); font-weight: 600; }
.hc-bar { height: 8px; border-radius: 6px; background: var(--grey-bg); overflow: hidden; }
.hc-bar span { display: block; height: 100%; background: var(--c); border-radius: 6px; transition: width .8s cubic-bezier(.2,.8,.2,1); }
.hc-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: .78rem; color: var(--ink-2); }
.hc-meta .gap { margin-left: auto; color: var(--muted); }
.hc-motto { font-size: .75rem; color: var(--muted); font-style: italic; margin-top: 6px; }
.chart-box { position: relative; height: 300px; }
.matrix td.lead { font-weight: 700; background: #f3fbf6; }
.star-list, .feed { list-style: none; margin: 0; padding: 0; }
.star-list { counter-reset: s; }
.star-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); counter-increment: s; }
.star-list li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: .75rem; font-weight: 700; color: var(--ink-2); }
.star-list li.muted::before { display: none; }
.st-n { flex: 1; } .st-n small { display: block; color: var(--muted); }
.st-c { font-weight: 700; font-size: .85rem; }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.feed-pts { min-width: 54px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.feed-body small { display: block; color: var(--muted); }
body.display-mode .sidebar, body.display-mode .topbar, body.display-mode .foot, body.display-mode .alert, body.display-mode .toolbar .filters, body.display-mode .toolbar .btn-primary { display: none !important; }
body.display-mode .main { margin-left: 0; }
body.display-mode .content { max-width: none; padding: 24px 32px; }
body.display-mode .hc-total .num { font-size: 4rem; }
body.display-mode .chart-box { height: 360px; }

/* ---------- Events ---------- */
.type-picker { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.type-opt input { position: absolute; opacity: 0; }
.type-opt span { display: inline-block; padding: 10px 18px; border: 2px solid #e1e5ec; border-radius: 10px; cursor: pointer; font-weight: 600; background: #fff; }
.type-opt:has(input:checked) span { border-color: var(--primary); background: #eef2ff; color: var(--primary); }
.type-opt:has(input:focus-visible) span { outline: 3px solid rgba(59,91,219,.35); }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.points-action .pa-body { margin-top: 10px; }
.points-action.deduct { border-color: #f0b4b4; background: #fffafa; }
.house-picker.multi .house-opt .dot { border-radius: 5px; }
.dropzone { border: 2px dashed #b9c2d3; border-radius: 12px; padding: 26px; text-align: center; background: var(--surface-2); cursor: pointer; transition: .15s; }
.dropzone.over { border-color: var(--primary); background: #eef2ff; transform: scale(1.01); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dz-icon { font-size: 28px; color: var(--primary); }
.dz-inner small { display: block; color: var(--muted); margin-top: 6px; }
.dz-browse { color: var(--primary); text-decoration: underline; }
.small-dz { padding: 14px; text-align: left; }
.import-card { padding: 12px; }
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 10px 0; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; animation: fadein .2s; }
.file-item img { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .85rem; }
.file-name small { display: block; color: var(--muted); }
.file-ext { width: 42px; height: 42px; border-radius: 6px; background: #e8ecf4; display: grid; place-items: center; font-size: .7rem; font-weight: 700; color: var(--ink-2); flex: none; }
.progress { height: 6px; background: var(--grey-bg); border-radius: 4px; overflow: hidden; margin-top: 12px; }
.progress span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.event-card { display: flex; flex-direction: column; background: #fff; border-radius: 12px; padding: 16px; box-shadow: var(--shadow); color: var(--ink); border-left: 5px solid #94a3b8; transition: transform .15s, box-shadow .15s; }
.event-card:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 10px 24px -8px rgba(20,30,50,.2); }
.event-card.type-event { border-left-color: #3b5bdb; } .event-card.type-incident { border-left-color: #e8590c; } .event-card.type-activity { border-left-color: #0ca678; }
.event-card h3 { margin: 8px 0 4px; font-size: 1rem; } .event-card p { color: var(--ink-2); font-size: .86rem; flex: 1; }
.ec-top, .ec-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.etag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 4px; background: var(--grey-bg); }
.type-event .etag, .etag.type-event { background: #e7ecff; color: #3b5bdb; }
.type-incident .etag, .etag.type-incident { background: #fff0e6; color: #c44c05; }
.type-activity .etag, .etag.type-activity { background: #e3f8f1; color: #08875f; }
.ec-pts { display: flex; gap: 4px; }
.mini-pt { font-size: .75rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: color-mix(in srgb, var(--c) 16%, #fff); border: 1px solid var(--c); }
.mini-pt.dim { opacity: .45; }
.prose { font-size: .95rem; line-height: 1.65; margin-bottom: 14px; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.attach { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); }
.attach img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; }
.attach .file-ext { width: 100%; height: 110px; font-size: 1rem; }
.pt-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pt-line .hdot { background: var(--c); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--c); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }
.detail-head { display: flex; align-items: baseline; gap: 10px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--c) 10%, #fff); border-left: 5px solid var(--c); margin-bottom: 14px; }
.detail-head .big { font-size: 1.8rem; font-weight: 800; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { padding: 4px 0 8px 14px; position: relative; font-size: .86rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
ul.plain { padding-left: 18px; }

/* ---------- Masters ---------- */
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; align-items: start; }
.list-card { margin: 0; }
.sortable { list-style: none; margin: 0 0 10px; padding: 0; }
.sortable li { display: flex; align-items: center; gap: 6px; padding: 4px; border-radius: 8px; transition: background .3s; }
.sortable li input { margin: 0; padding: 6px 8px; }
.sortable li .l-value, .sortable li .c-min, .sortable li .c-max { width: 70px; flex: none; }
.sortable li.inactive input { color: #a0a7b4; text-decoration: line-through; }
.sortable li.saved { background: var(--green-bg); }
.handle { cursor: grab; color: var(--muted); padding: 0 4px; user-select: none; }
.drag-ghost { opacity: .4; background: #eef2ff; }
.add-row { display: flex; gap: 6px; } .add-row input { margin: 0; padding: 6px 8px; } .add-row .l-value, .add-row .c-max { width: 80px; flex: none; }
.house-edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.house-edit { border: 1px solid var(--line); border-top: 5px solid var(--c); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.house-edit .row-fields { margin: 0; flex-wrap: nowrap; } .house-edit input { margin: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.role-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* ---------- Login ---------- */
.login-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% 0%, #2a3a78 0%, #151b2b 60%); padding: 20px; }
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; width: min(900px, 100%); border-radius: 18px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login-art { background: linear-gradient(160deg, #3b5bdb, #1c2a6b); color: #fff; padding: 40px; display: flex; flex-direction: column; justify-content: center; }
.login-art h1 { font-size: 2rem; } .login-art p { opacity: .85; } .login-art small { opacity: .7; margin-top: 24px; }
.login-houses { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.lh { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.1); padding: 10px 12px; border-radius: 10px; font-weight: 600; }
.lh span { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px rgba(255,255,255,.25); }
.login-card { background: #fff; padding: 40px; display: flex; flex-direction: column; gap: 14px; justify-content: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .standings { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .grid-2, .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); }
  .login-wrap { grid-template-columns: 1fr; } .login-art { padding: 28px; }
}
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid; } .hide-mobile { display: none; }
  .content { padding: 16px; } .topbar { padding: 8px 16px; }
  .student-row { grid-template-columns: 1fr 1fr 34px; } .student-row .ac-wrap { grid-column: 1 / -1; }
  .inline-field { flex-wrap: wrap; } .inline-field select, .inline-field input { min-width: 0; width: 100%; }
  .row-fields > * { flex: 1 1 100%; }
  .rubric .w-marks { width: 96px; } .rubric input.mark { width: 64px; }
}
@media (max-width: 520px) { .standings { grid-template-columns: 1fr; } .hc-total .num { font-size: 2.2rem; } }
@media print {
  .sidebar, .topbar, .toolbar, .foot, .filters-card, .actions, #toast-wrap { display: none !important; }
  .main { margin: 0; } .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* =========================================================
   v2 – card system: entry launcher, entry cards, approvals,
   ledger views, user cards, restricted records
   ========================================================= */
.badge-blue { background: #e5efff; color: #2257c4; }
.badge-orange { background: #fff0e0; color: #c05a00; }
.btn-warn { background: #fff4e6; border-color: #f5c58a; color: #a14d00; }
.btn-warn:hover { background: #ffe8cc; }
.pill-orange { background: #ff922b !important; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

/* Category launcher (replaces tabs on House Point Entry) */
.cat-launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.cat-card { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 3px; padding: 14px; border-radius: 14px; background: #fff; border: 1px solid #e3e6eb; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s, border-color .15s; }
.cat-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--cc); }
.cat-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(20,30,50,.25); }
.cat-card:focus-visible { outline: 3px solid rgba(59,91,219,.4); outline-offset: 2px; }
.cat-card.active { border-color: var(--cc); box-shadow: 0 0 0 2px var(--cc), 0 10px 24px -12px var(--cc); background: color-mix(in srgb, var(--cc) 6%, #fff); }
.cc-icon { font-size: 1.6rem; line-height: 1; margin-bottom: 4px; }
.cc-name { font-weight: 700; font-size: .95rem; color: var(--ink); }
.cc-sub { font-size: .76rem; color: var(--muted); }
.cc-meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; min-height: 18px; }
.cc-meta em { font-style: normal; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; background: var(--surface-2); color: var(--ink-2); }
.cc-meta em.cc-draft { background: #fff0e0; color: #c05a00; }

/* My work */
.my-work .work-group + .work-group { margin-top: 16px; }
.work-group h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin-bottom: 8px; }
.work-group h4 em { font-style: normal; background: var(--surface-2); padding: 0 8px; border-radius: 10px; margin-left: 4px; }
.wg-returned h4 { color: #c05a00; }
.edit-banner { display: flex; flex-direction: column; gap: 2px; padding: 12px 16px; border-radius: 12px; margin-bottom: 14px; border: 1px solid; }
.eb-draft { background: #eef4ff; border-color: #bcd0f7; color: #1f3f86; }
.eb-returned { background: #fff4e6; border-color: #f5c58a; color: #7a3d00; }
.entry-form.editing { box-shadow: 0 0 0 2px #f5c58a, var(--shadow); }

/* Entry card */
.entry-card { background: #fff; border: 1px solid #e3e6eb; border-left: 5px solid var(--c); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); transition: opacity .2s, box-shadow .2s; }
.entry-card.busy { opacity: .55; pointer-events: none; }
.entry-card.just-changed { animation: flash 1.6s; }
.entry-card header { display: flex; align-items: center; gap: 8px; }
.ec-house { font-weight: 700; display: inline-flex; align-items: center; }
.ec-house .hdot { background: var(--c); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--c); }
.ec-ref { color: var(--muted); font-size: .8rem; }
.ec-status { margin-left: auto; }
.ec-main { display: flex; gap: 12px; align-items: center; }
.ec-points { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 72px; line-height: 1; }
.ec-points small { font-size: .8rem; color: var(--muted); font-weight: 600; }
.ec-what { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.ec-what span { color: var(--ink-2); font-size: .88rem; }
.ec-reason { font-size: .84rem; padding: 8px 10px; border-radius: 8px; }
.ec-reason-returned { background: #fff4e6; color: #7a3d00; }
.ec-reason-rejected { background: var(--red-bg); color: #8a1f1f; }
.ec-reason-void { background: var(--grey-bg); color: #444; }
.ec-scores { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: .8rem; }
.ec-scores li { display: grid; grid-template-columns: minmax(0, 1.6fr) 1fr auto; gap: 8px; align-items: center; }
.ec-scores li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ec-scores .bar { height: 6px; background: var(--grey-bg); border-radius: 4px; overflow: hidden; }
.ec-scores .bar i { display: block; height: 100%; background: var(--c, var(--primary)); border-radius: 4px; }
.ec-scores b { font-variant-numeric: tabular-nums; font-size: .78rem; }
.ec-students { display: flex; flex-wrap: wrap; gap: 5px; }
.stu-chip { font-size: .75rem; padding: 2px 9px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.stu-chip.more { background: #fff; }
.ec-remarks { font-size: .84rem; color: var(--ink-2); margin: 0; font-style: italic; }
.entry-card footer { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 8px; margin-top: auto; }
.ec-by { font-size: .74rem; color: var(--muted); }
.ec-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.entry-card.st-void, .entry-card.st-rejected { background: #fbfbfc; }
.entry-card.st-void .ec-points, .entry-card.st-rejected .ec-points { text-decoration: line-through; opacity: .5; }
.entry-card.st-draft { border-style: dashed; border-left-style: solid; }

/* Approvals */
.scope-banner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: center; padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.chip-select { border-radius: 20px; padding: 6px 12px; margin: 0; width: auto; font-size: .85rem; }
.empty-state { grid-column: 1 / -1; text-align: center; padding: 40px 20px; background: #fff; border-radius: 14px; border: 1px dashed #cfd5df; }
.big-emoji { font-size: 2.4rem; }
.timeline li.tl-return::before { background: #ff922b; } .timeline li.tl-reject::before, .timeline li.tl-void::before { background: var(--red); }
.timeline li.tl-approve::before, .timeline li.tl-post::before { background: var(--green); } .timeline li.tl-draft::before { background: #a5b4cf; }
.tl-reason { margin-top: 3px; padding: 5px 9px; background: var(--surface-2); border-radius: 6px; font-style: italic; }

/* Ledger view toggle */
.ledger-head { margin: 4px 0 12px; }
.view-toggle { display: inline-flex; border: 1px solid #d3d8e1; border-radius: 8px; overflow: hidden; background: #fff; }
.view-toggle button { border: 0; background: transparent; padding: 6px 12px; cursor: pointer; font: inherit; font-size: .84rem; color: var(--ink-2); }
.view-toggle button.active { background: var(--ink); color: #fff; }
.ledger.view-cards .ledger-table { display: none; }
.ledger.view-table .ledger-cards { display: none; }

/* Users as cards */
.role-legend { margin: -4px 0 14px; }
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.user-card { background: #fff; border: 1px solid #e3e6eb; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); border-top: 4px solid #cfd5df; }
.user-card.role-admin { border-top-color: #1d2330; } .user-card.role-head { border-top-color: #7950f2; } .user-card.role-teacher { border-top-color: #339af0; }
.user-card.inactive { opacity: .6; }
.user-card header { display: flex; align-items: center; gap: 10px; }
.user-card header div { flex: 1; min-width: 0; } .user-card header strong { display: block; } .user-card header small { color: var(--muted); }
.avatar.lg { width: 42px; height: 42px; font-size: 1.1rem; }
.uc-line { display: flex; gap: 6px; align-items: center; font-size: .84rem; }
.uc-scope { display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); padding: 8px 10px; border-radius: 10px; }
.uc-scope > div { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.uc-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); width: 74px; }
.scope-chip { font-size: .74rem; padding: 1px 8px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: inline-flex; align-items: center; }
.scope-chip .hdot { width: 8px; height: 8px; margin-right: 5px; }
.scope-chip.all { color: var(--muted); font-style: italic; }
.uc-stats { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8rem; }
.user-card footer { display: flex; flex-wrap: wrap; gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.scope-field .check .hdot { margin-right: 4px; }

/* Restricted records */
.restrict-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin: 4px 0 12px; font-weight: 500; }
.restrict-toggle input { margin-top: 3px; }
.restrict-toggle small { display: block; }
.restrict-toggle.on { background: #fff5f5; border-color: #f0b4b4; }
.lock-tag { font-size: .7rem; font-weight: 700; color: #a61e1e; background: var(--red-bg); padding: 1px 7px; border-radius: 4px; margin-right: auto; margin-left: 6px; }
.vis-card.restricted { border-color: #f0b4b4; background: #fffafa; }

@media (max-width: 820px) {
  .cat-launcher { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid, .user-grid { grid-template-columns: minmax(0, 1fr); }
}
.cat-card:hover { background: #fff; } .cat-card.active:hover { background: color-mix(in srgb, var(--cc) 6%, #fff); }
.cat-card.active, .cat-card.active:hover { color: var(--ink); }
[hidden] { display: none !important; }
.work-more { margin-top: 14px; }
.work-more > summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--primary); list-style: none; padding: 6px 0; }
.work-more > summary::-webkit-details-marker { display: none; }
.work-more > summary::before { content: "▸ "; } .work-more[open] > summary::before { content: "▾ "; }

/* =========================================================
   v2.1 – category cards open an entry modal; list below
   ========================================================= */
.cat-card .cc-add { margin-top: 8px; font-size: .75rem; font-weight: 700; color: var(--cc); opacity: 0; transform: translateY(4px); transition: .15s; }
.cat-card:hover .cc-add, .cat-card:focus-visible .cc-add, .cat-card.active .cc-add { opacity: 1; transform: none; }
.attention { background: #fff8f0; border: 1px solid #f5c58a; border-radius: 14px; padding: 14px; margin-bottom: 18px; }
.attention h3 { color: #a14d00; font-size: 1rem; }
.attention h3 em { font-style: normal; background: #ffe8cc; border-radius: 10px; padding: 0 8px; font-size: .85rem; }
.cat-list { border-top: 4px solid var(--line); }
.cl-filters { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.cl-filters .chip { cursor: pointer; font: inherit; font-size: .83rem; }
#cl-more-wrap { margin-top: 14px; }

body.modal-open { overflow: hidden; }
.entry-modal-bg { position: fixed; inset: 0; z-index: 80; background: rgba(15, 20, 35, .55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; animation: fadein .15s; }
.entry-modal { --cc: var(--primary); background: var(--bg); width: min(980px, 100%); max-height: 92vh; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.35); display: flex; flex-direction: column; overflow: hidden; animation: pop .18s ease-out; }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }
.em-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: #fff; border-bottom: 1px solid var(--line); border-top: 5px solid var(--cc); }
.em-head h2 { margin: 0; font-size: 1.2rem; flex: 1; }
.em-icon { font-size: 1.6rem; }
.em-body { padding: 18px 20px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.em-body #entry-context { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.em-body #entry-context .field-label { margin-top: 10px; }
.em-body .panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.em-body .panel > h3 { font-size: .95rem; color: var(--ink-2); text-transform: none; }
.em-body .edit-banner { margin: 0; }
.em-body .form-actions { position: sticky; bottom: -22px; background: #fff; padding: 12px 0 4px; margin-top: 12px; border-top: 1px solid var(--line); z-index: 2; }
@media (max-width: 820px) {
  .entry-modal-bg { padding: 0; }
  .entry-modal { max-height: 100vh; height: 100%; border-radius: 0; }
  .em-body { padding: 14px; }
}
@media (max-width: 820px) {
  .rubric .desc { display: none; }
  .rubric td, .rubric th { padding: 6px 8px; }
  .em-body .form-actions { bottom: -14px; margin-left: -16px; margin-right: -16px; padding: 10px 16px; box-shadow: 0 -6px 12px -8px rgba(0,0,0,.15); }
  .em-body .form-actions .small { display: none; }
}

/* =========================================================
   v2.2 – school logo & house badges
   ========================================================= */
.brand-logo { width: 46px; height: 46px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.hbadge { border-radius: 50%; object-fit: cover; flex: none; vertical-align: middle; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--c, #ccc); background: var(--c); }
.hbadge-xs { width: 22px; height: 22px; margin-right: 7px; }
.hbadge-sm { width: 28px; height: 28px; margin-right: 8px; }
.hbadge-md { width: 40px; height: 40px; }
.hbadge-lg { width: 72px; height: 72px; align-self: center; box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); }

/* Login – school colours (navy + gold from the crest) */
.login-body { background: radial-gradient(1100px 600px at 15% 0%, #0d4ea6 0%, #062a5e 55%, #031a3d 100%); }
.login-art { background: linear-gradient(165deg, #0a3f8a 0%, #062c63 100%); align-items: center; text-align: center; border-right: 4px solid #f5a800; }
.login-logo { width: 150px; height: auto; margin-bottom: 14px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.login-art h1 { font-size: 1.55rem; margin-bottom: 2px; }
.login-motto { color: #f5b82e; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; margin: 2px 0 6px; opacity: 1 !important; }
.login-app { font-size: .85rem; }
.login-houses { width: 100%; text-align: left; }
.lh { gap: 10px; padding: 8px 10px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.12); }
.lh .hbadge { box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.lh strong { display: block; font-size: .92rem; } .lh small { display: block; opacity: .75; font-size: .72rem; font-weight: 500; }
.login-card .btn-primary { background: #0a3f8a; } .login-card .btn-primary:hover { background: #062c63; }

/* House picker as badge cards (entry modal) */
.house-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.house-card-opt { position: relative; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 12px 8px 10px; border-radius: 14px; border: 2px solid #e1e5ec; background: #fff; }
.house-card-opt .hc-logo { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: transform .15s, filter .15s; filter: saturate(.85); }
.house-card-opt:hover .hc-logo { transform: scale(1.04); filter: none; }
.hc-text { display: flex; flex-direction: column; line-height: 1.2; }
.hc-text small { font-weight: 500; font-size: .72rem; color: var(--muted); }
.hc-check { position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; font-size: .8rem; display: grid; place-items: center; opacity: 0; transform: scale(.5); transition: .15s; }
.house-card-opt:has(input:checked) { background: color-mix(in srgb, var(--c) 12%, #fff); border-color: var(--c); color: var(--ink); box-shadow: 0 6px 18px -8px var(--c); }
.house-card-opt:has(input:checked) .hc-logo { filter: none; }
.house-card-opt:has(input:checked) .hc-text small { color: var(--ink-2); }
.house-card-opt:has(input:checked) .hc-check { opacity: 1; transform: none; }
.house-picker:not(:has(input:checked)) .house-card-opt .hc-logo { filter: none; }
.house-picker:has(input:checked) .house-card-opt:not(:has(input:checked)) { opacity: .6; }
.house-picker:has(input:checked) .house-card-opt:not(:has(input:checked)):hover { opacity: 1; }

/* Dashboard house cards */
.hc-badge { position: absolute; right: 14px; top: 14px; width: 64px; height: 64px; border-radius: 12px; object-fit: cover; box-shadow: 0 3px 10px rgba(0,0,0,.18); z-index: 1; }
.house-card::after { display: none; }
body.display-mode .hc-badge { width: 92px; height: 92px; }

/* Masters */
.logo-row { display: flex; gap: 14px; align-items: center; }
.logo-preview { width: 72px; height: 72px; object-fit: contain; }
.house-edit label.small { font-weight: 500; }

@media (max-width: 820px) {
  .house-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .house-card-opt .hc-logo { width: 64px; height: 64px; }
  .login-logo { width: 110px; }
}
.lh .lh-text { width: auto; height: auto; background: none; box-shadow: none; border-radius: 0; display: block; min-width: 0; }
.login-art .lh small { margin-top: 1px; }
@media (max-width: 900px) { .login-art { border-right: 0; border-bottom: 4px solid #f5a800; } }

/* =========================================================
   v3 – Roles & Permissions
   ========================================================= */
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.role-card { background: #fff; border: 1px solid #e3e6eb; border-radius: 14px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; border-top: 4px solid #74c0fc; }
.role-card.role-admin { border-top-color: #1d2330; } .role-card.role-head { border-top-color: #7950f2; } .role-card.role-teacher { border-top-color: #339af0; } .role-card.role-viewer { border-top-color: #adb5bd; }
.role-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; } .role-card h3 { margin: 0; }
.rc-meter { height: 6px; background: var(--grey-bg); border-radius: 4px; overflow: hidden; } .rc-meter span { display: block; height: 100%; background: var(--primary); }
.rc-stats { display: flex; justify-content: space-between; font-size: .82rem; color: var(--ink-2); }
.role-card footer { display: flex; gap: 4px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.badge-role { background: #e8f3ff; color: #1b5fb0; }
.perm-head h2 small { font-size: .85rem; font-weight: 500; }
.perm-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.perm-toolbar .perm-search { max-width: 260px; margin: 0; padding: 7px 10px; }
.perm-toolbar > span:first-child { margin-right: auto; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.perm-module { margin: 0; padding: 0; overflow: hidden; }
.perm-module header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.perm-module header h3 { margin: 0; font-size: 1rem; flex: 1; }
.pm-count { font-size: .8rem; color: var(--muted); }
.perm-module ul { list-style: none; margin: 0; padding: 6px 0; }
.perm-module li { padding: 0 16px; }
.perm-module li + li { border-top: 1px solid #f0f2f5; }
.perm-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; cursor: pointer; font-weight: 500; }
.perm-row.disabled { cursor: not-allowed; opacity: .55; }
.pr-text { display: flex; flex-direction: column; min-width: 0; }
.pr-text strong { font-size: .88rem; }
.pr-text small { color: var(--muted); font-size: .76rem; }
.pr-text code { align-self: flex-start; font-size: .68rem; margin-top: 3px; color: #6b7280; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; margin-top: 2px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #cfd5df; border-radius: 20px; transition: .15s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:indeterminate + span { background: #9fd8b4; }
.switch input:focus-visible + span { outline: 3px solid rgba(59,91,219,.35); }
.switch input:disabled + span { cursor: not-allowed; }
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 12px 16px; margin-top: 14px; background: rgba(255,255,255,.96); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 -6px 18px -12px rgba(0,0,0,.25); }
.save-bar #dirty-note { margin-right: auto; } .save-bar #dirty-note.dirty { color: #c05a00; font-weight: 700; }
.ov-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px !important; }
.eff { font-size: .7rem; font-weight: 700; padding: 0 6px; border-radius: 8px; margin-left: 6px; }
.eff.on { background: var(--green-bg); color: var(--green); } .eff.off { background: var(--grey-bg); color: #6b7280; }
.tri { display: inline-flex; border: 1px solid #d3d8e1; border-radius: 8px; overflow: hidden; flex: none; }
.tri label { cursor: pointer; font-weight: 500; }
.tri input { position: absolute; opacity: 0; }
.tri span { display: block; padding: 4px 9px; font-size: .75rem; color: var(--ink-2); border-left: 1px solid #e3e6eb; }
.tri label:first-child span { border-left: 0; }
.tri input:checked + span { background: var(--ink); color: #fff; }
.tri label:nth-child(2) input:checked + span { background: var(--green); }
.tri label:nth-child(3) input:checked + span { background: var(--red); }
.tri input:focus-visible + span { outline: 2px solid var(--primary); }
.tri.disabled { opacity: .5; pointer-events: none; }
@media (max-width: 820px) { .perm-grid { grid-template-columns: minmax(0, 1fr); } .ov-row { flex-direction: column; align-items: flex-start; } }

/* =========================================================
   v3 – Reports
   ========================================================= */
.report-group { margin: 18px 0 10px; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.report-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px; background: #fff; border: 1px solid #e3e6eb; border-radius: 14px; box-shadow: var(--shadow); color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s; position: relative; }
.report-card:hover { transform: translateY(-2px); text-decoration: none; border-color: var(--primary); box-shadow: 0 10px 24px -12px rgba(20,30,50,.3); }
.rp-icon { font-size: 1.7rem; width: 46px; height: 46px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.rp-icon.lg { width: 56px; height: 56px; font-size: 2rem; }
.rp-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.rp-body small { color: var(--muted); font-size: .8rem; }
.rp-formats { display: flex; flex-direction: column; gap: 4px; }
.rp-formats em { font-style: normal; font-size: .62rem; font-weight: 800; padding: 1px 6px; border-radius: 4px; letter-spacing: .04em; }
.fmt-x { background: #e6f4ea; color: #1e7e34; } .fmt-p { background: #fde8e8; color: #b42318; }
.btn-excel { background: #1e7e34; color: #fff; } .btn-excel:hover { background: #17692a; }
.btn-pdf { background: #b42318; color: #fff; } .btn-pdf:hover { background: #912018; }
.report-head .rh-top { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.rh-title { flex: 1; min-width: 220px; } .rh-title h2 { margin: 0; } .rh-title p { margin: 2px 0 0; }
.rh-export { display: flex; gap: 6px; flex-wrap: wrap; }
.report-filters { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.summary-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stile { background: #fff; border: 1px solid #e3e6eb; border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); border-left: 4px solid var(--primary); }
.stile small { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.stile strong { font-size: 1.15rem; }
.report-table-wrap { max-height: 70vh; overflow: auto; }
.report-table thead th { position: sticky; top: 0; z-index: 1; background: #0a3f8a; color: #fff; }
.report-table td.num { font-variant-numeric: tabular-nums; }
.report-table td.wrapcell { min-width: 180px; max-width: 360px; white-space: normal; }
.report-table tfoot th { position: sticky; bottom: 0; background: #eef2fb; }
.report-note { margin-top: 10px; }
.print-only { display: none; }
@media print {
  .no-print, .rh-export, .report-filters { display: none !important; }
  .print-only { display: block; }
  .report-table-wrap { max-height: none; overflow: visible; }
  .report-table thead th { background: #0a3f8a !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .content { padding: 0; }
}

/* v3.1 – students */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.danger-zone { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; border: 1px solid #f0b4b4; background: #fffafa; }
.danger-zone h3 { color: #a61e1e; margin-bottom: 4px; }
.danger-zone .dz-text { flex: 1; min-width: 260px; }
.danger-zone p { margin: 0 0 4px; }
.toolbar > .filters { flex: 1; }
.filters label.check { align-self: center; white-space: nowrap; }
.filters label.check input { width: auto; margin: 0; }

/* ---------- v3.3 Students: academic-year tabs ---------- */
.year-tabs { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 14px; scrollbar-width: thin; }
.year-tab { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; min-width: 130px; padding: 10px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink);
  text-decoration: none; box-shadow: 0 1px 2px rgba(20,30,50,.04); transition: border-color .15s, box-shadow .15s, transform .15s; }
.year-tab strong { font-size: 1.05rem; }
.year-tab small { color: var(--muted); font-size: .78rem; }
.year-tab:hover { border-color: var(--primary); transform: translateY(-1px); }
.year-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(59,91,219,.25); }
.year-tab.active small { color: rgba(255,255,255,.85); }
.year-tab.add { justify-content: center; align-items: center; min-width: 96px; border-style: dashed; color: var(--primary); font-weight: 600; background: transparent; }
.promote-card { border-left: 4px solid var(--primary); }
.promote-card .row-fields { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.import-row { align-items: start; }
@media (max-width: 640px) { .year-tab { min-width: 112px; padding: 8px 12px; } }
.promote-card > strong { display: block; margin-bottom: 10px; }
.promote-card .row-fields > label:not(.check) { flex: 1 1 180px; }
.promote-card small { display: block; margin-top: 8px; }
/* Masters: upload limits */
.limits-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 4px; margin: 4px 0; display: flex; flex-direction: column; gap: 10px; }
.limits-box legend { font-weight: 700; padding: 0 6px; }
.limit-ok { color: var(--green); }
.limit-warn { color: var(--amber); background: var(--amber-bg); padding: 8px 10px; border-radius: 8px; }

/* =====================================================================
   v4.0 – Student 360°, compliance, HPE, health, counselling, staff, school
   ===================================================================== */
.nav-head { display: block; padding: 14px 12px 4px; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #6f7a90; font-weight: 700; }
.t-red { color: var(--red) !important; } .t-amber { color: var(--amber) !important; } .t-green { color: var(--green) !important; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.span-2 { grid-column: span 2; }
.linktabs .tab { text-decoration: none; display: inline-block; }
.linktabs { align-items: center; }
.tabs-year { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.alert.static { opacity: 1 !important; }
.sep { color: var(--muted); font-size: .82rem; margin: 0 4px 0 12px; align-self: center; }
.class-chips { margin-bottom: 14px; }
.row-hl td { background: #f3f6ff; }
.row-warn td { background: #fffaf0; } .row-bad td { background: #fff5f5; }
.plain-list { list-style: none; padding: 0; margin: 0 0 12px; } .plain-list li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.file-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 14px; background: #eef2ff; font-size: .8rem; margin: 2px 2px 2px 0; }
.meter { height: 8px; background: #edf0f5; border-radius: 6px; overflow: hidden; min-width: 80px; }
.meter span { display: block; height: 100%; border-radius: 6px; background: var(--green); }
.meter.mid span { background: #f0ad2c; } .meter.low span { background: var(--red); }

/* profile form */
.fgroup { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 16px; margin: 0 0 14px; }
.fgroup legend { font-weight: 700; padding: 0 6px; color: var(--ink); }
.field-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.field-grid label.check { align-self: center; }
.field-grid label.check { padding-bottom: 10px; }
.fl { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.req-tag { font-size: .62rem; font-weight: 700; padding: 1px 5px; border-radius: 4px; letter-spacing: .03em; }
.req-tag.loc { background: #e7e3ff; color: #5433c9; } .req-tag.udise { background: #e0f4ea; color: #19794a; }
.photo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.photo-prev { width: 90px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 0; display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line); }

/* Student 360 header */
.s360-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.s360-photo { width: 84px; height: 100px; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #dfe6ff, #eef2ff); display: grid; place-items: center; flex: 0 0 auto; }
.s360-photo img { width: 100%; height: 100%; object-fit: cover; } .s360-photo span { font-size: 2.2rem; font-weight: 700; color: var(--primary); }
.s360-main { flex: 1 1 320px; } .s360-main h2 { margin: 0 0 4px; }
.s360-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.alert-chip { padding: 4px 10px; border-radius: 14px; font-size: .8rem; font-weight: 600; }
.alert-chip.health { background: #ffe8e8; color: #a31d1d; } .alert-chip.care { background: #eee7ff; color: #5433c9; }
.alert-chip.cwsn { background: #e3f1ff; color: #1b5fb0; } .alert-chip.lock { background: var(--grey-bg); color: #444; }
.s360-meters { display: grid; gap: 10px; min-width: 190px; }
.s360-meters > div { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.s360-meters small { grid-column: 1 / -1; color: var(--muted); }
.hpe-strands { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hpe-strands > div { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; align-content: start; }
.hpe-strands h4 { margin: 0; }
.fit-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.fit-form label { flex: 1 1 110px; } .fit-form label.span-2 { flex: 2 1 220px; } .fit-form .stu-pick { flex: 2 1 240px; }
.fit-form label.check { flex: 0 0 auto; padding-bottom: 10px; }
.tl-item { border-left: 3px solid var(--line); padding: 6px 0 12px 14px; margin-left: 4px; }
.tl-item.open { border-left-color: #f0ad2c; }
.tl-item p { margin: 6px 0 0; }
.conf { background: #faf7ff; border: 1px dashed #cfc3f5; border-radius: 8px; padding: 8px 10px; }

/* academics */
.subj-wrap { max-height: 70vh; }
.subj-matrix th.vert { height: 150px; vertical-align: bottom; padding: 6px 4px; white-space: nowrap; }
.subj-matrix th.vert span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .78rem; }
.subj-matrix td.center { text-align: center; padding: 6px 4px; }
.subj-matrix thead th { position: sticky; top: 0; z-index: 1; }
.fill-row td { background: #f7f9fc; }
.num-in { width: 88px; margin: 0; padding: 6px 8px; text-align: right; }
.table.compact td select { margin: 0; padding: 6px 8px; }

/* LOC */
a.stile { text-decoration: none; color: inherit; border: 2px solid transparent; }
a.stile.on { border-color: var(--primary); }
.stile.bad strong { color: var(--red); } .stile.warn strong { color: var(--amber); } .stile.good strong { color: var(--green); }
.loc-status { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.loc-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.prob { display: block; margin: 1px 0; } .prob.err { color: #b42323; } .prob.warn { color: #946200; } .prob.ok { color: var(--green); font-weight: 600; }
.loc-table td { vertical-align: top; }

/* printable pages (slips, HPE card, portal copy) */
body.print-page { background: #fff; padding: 20px; color: #111; }
.slip { border: 1px solid #333; padding: 14px 16px; margin: 0 auto 18px; max-width: 800px; page-break-inside: avoid; }
.slip header { display: flex; gap: 12px; align-items: center; border-bottom: 1px solid #333; padding-bottom: 8px; margin-bottom: 8px; }
.slip header img { height: 48px; } .slip header > div:nth-child(2) { flex: 1; }
.slip-photo { width: 80px; height: 96px; border: 1px solid #999; display: grid; place-items: center; font-size: .75rem; color: #888; overflow: hidden; }
.slip-photo img { width: 100%; height: 100%; object-fit: cover; }
.slip-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.slip-table th, .slip-table td { border: 1px solid #bbb; padding: 5px 7px; text-align: left; }
.slip-table th { background: #f3f3f3; width: 18%; font-weight: 600; }
.slip-note { font-size: .78rem; margin: 8px 0; }
.slip-sign { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; margin-top: 14px; flex-wrap: wrap; }
@media print { body.print-page { padding: 0; } .slip { margin-bottom: 10mm; } }

@media (max-width: 900px) {
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hpe-strands, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .field-grid, .hpe-strands, .grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .tabs-year { margin-left: 0; }
}

/* HPE */
.strand-h { margin: 22px 0 8px; color: #0d3b7a; } .strand-h span { color: #e8702a; font-weight: 500; font-size: .9rem; margin-left: 6px; }
.hpe-grid thead th { background: #2f958f; color: #fff; }
.hpe-grid td:first-child { min-width: 260px; }
.hpe-grid td input:not([type=checkbox]) { margin: 0; padding: 5px 8px; min-width: 90px; }
label.tick { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.ev { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 9px; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center; }
.ev.ok { background: #e0f4ea; color: #19794a; } .ev.none { background: #fde8e8; color: #b42323; }
.ev-legend { margin-left: 8px; white-space: nowrap; }
.hpe-periods { margin: 14px 0 4px; } .hpe-periods td { vertical-align: middle; }
.cert { margin: 18px 0 6px; color: #c05a00; font-weight: 600; }
.hpe-print { max-width: 900px; margin: 0 auto; } .hpe-print h4 { margin: 14px 0 6px; }
.hpe-card h4 { margin: 12px 0 4px; font-size: .9rem; }
.hpe-stu select { min-width: 70px; max-width: 220px; }
.list-card li select.l-hpe { margin: 0; padding: 4px 6px; font-size: .75rem; max-width: 170px; }
.list-card li.subj input.s-code, .list-card li.hpe input.s-code { max-width: 64px; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 40px; gap: 10px; align-items: center; font-size: .88rem; }
.bar { background: #edf0f5; border-radius: 6px; height: 12px; overflow: hidden; } .bar i { display: block; height: 100%; background: #7b61ff; border-radius: 6px; }
.imp-inline { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); align-items: center; }
.imp-inline input[type=file] { max-width: 260px; }
.counsel-form textarea { font-family: inherit; }
/* documents */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.doc-card { border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 10px; padding: 12px; display: grid; gap: 6px; align-content: start; background: #fff; }
.doc-card.soon { border-left-color: #f0ad2c; background: #fffaf0; } .doc-card.expired { border-left-color: var(--red); background: #fff5f5; }
.doc-card.expired .doc-valid b { color: var(--red); } .doc-card.soon .doc-valid b { color: var(--amber); }
.doc-valid { font-size: .82rem; } .doc-actions { display: flex; gap: 6px; }
.file-btn { cursor: pointer; margin: 0; }
/* Compliance hub */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; align-items: start; }
.hub-card { margin: 0; display: grid; gap: 10px; }
.hub-top { display: flex; gap: 12px; align-items: center; } .hub-top h3 { margin: 0; } .hub-top > div { flex: 1; }
.hub-ico { font-size: 1.7rem; width: 46px; height: 46px; border-radius: 12px; background: #eef2ff; display: grid; place-items: center; }
.hub-pct { font-size: 1.6rem; }
.hub-list { list-style: none; margin: 0; padding: 0; font-size: .88rem; }
.hub-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.hub-list li.sub { border-bottom: 0; padding-top: 0; color: var(--muted); }
.hub-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hub-table td, .hub-table th { padding: 6px 8px; }
.deadlines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.deadlines li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.deadlines li > div { flex: 1; display: grid; } .deadlines small { color: var(--muted); }
.deadlines li.soon { background: #fff4e0; } .deadlines li.soon small { color: #9a5b00; font-weight: 600; } .deadlines li.past { opacity: .55; }
.dl-portal { font-size: .7rem; font-weight: 700; background: var(--ink); color: #fff; border-radius: 6px; padding: 2px 7px; margin-top: 2px; }
.small-chips .chip { font-size: .78rem; padding: 4px 10px; } .small-chips { margin-bottom: 12px; }
.hub-table { font-size: .8rem; } .hub-table td:first-child { white-space: nowrap; }
.add-dl summary { list-style: none; display: inline-block; } .add-dl summary::-webkit-details-marker { display: none; }
