:root {
  --brand: #820d25;
  --brand-deep: #4b0615;
  --accent: #dba72f;
  --canvas: #f7f4f2;
  --brand-soft: color-mix(in srgb, var(--brand) 8%, white);
  --ui-font: Poppins, "Noto Sans Devanagari", "Nirmala UI", "Segoe UI", Arial, sans-serif;
  --surface: #fff;
  --surface-2: color-mix(in srgb, var(--canvas) 46%, white);
  /* Text is black and grey, the same values the ERP uses, and does not follow
     the school's theme. A page whose every word is tinted with the brand reads
     as decoration; the theme belongs to the furniture — the sidebar, the
     buttons, the figures on the cards — not to the reading matter. */
  --ink: #251c1e;
  --muted: #766b6e;
  --line: #e8e1df;
  --success: #147852;
  --danger: #b32635;
  --warning: #9a6411;
  --shadow: 0 22px 70px color-mix(in srgb, var(--brand-deep) 12%, transparent);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 5%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 27rem),
    var(--canvas);
  font-family: var(--ui-font);
  font-size: 15px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
[hidden] { display: none !important; }

.portal-shell { min-height: 100vh; }
.portal-workspace { width: min(1440px, calc(100% - 32px)); min-height: 100vh; display: flex; flex-direction: column; margin: 0 auto; padding: clamp(16px, 3.4vw, 48px) 0; }
.portal-main-layout { display: grid; grid-template-columns: minmax(280px, 3fr) minmax(0, 7fr); align-items: start; gap: clamp(20px, 3vw, 44px); }
.portal-shell.portal-authenticated .portal-main-layout { grid-template-columns: 1fr; }
.portal-shell.portal-authenticated .portal-school-hero { display: none; }
.portal-school-hero { position: sticky; top: 20px; overflow: hidden; min-height: min(720px, calc(100vh - 40px)); display: flex; flex-direction: column; padding: clamp(22px, 3.3vw, 44px); border-radius: 28px; color: #fff; background: radial-gradient(circle at 100% 0, color-mix(in srgb, var(--accent) 28%, transparent), transparent 30%), linear-gradient(145deg, var(--brand-deep), var(--brand)); box-shadow: var(--shadow); }
.portal-school-hero::after { content: ""; position: absolute; right: -65px; bottom: -100px; width: 260px; height: 260px; border: 30px solid color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 50%; pointer-events: none; }
.portal-school-identity { position: relative; z-index: 1; display: grid; justify-items: start; gap: 12px; }
.portal-school-identity > img, .portal-school-identity > .portal-school-monogram { width: 86px; height: 86px; display: grid; place-items: center; padding: 7px; border-radius: 20px; color: var(--brand-deep); background: #fff; object-fit: contain; font-size: 24px; font-weight: 850; }
.portal-school-identity > div { width: 100%; min-width: 0; display: grid; gap: 4px; }
.portal-school-identity strong { display: block; width: 100%; font-size: clamp(20px, 2vw, 27px); line-height: 1.18; overflow-wrap: anywhere; }
.portal-school-identity div span { color: rgba(255,255,255,.72); line-height: 1.5; overflow-wrap: anywhere; }
.portal-school-identity .portal-secure-pill { margin: 4px 0 0; }
.portal-hero-copy { position: relative; z-index: 1; margin: auto 0; padding: clamp(32px, 5vw, 58px) 0 20px; }
.portal-hero-copy small { color: var(--accent); font-size: 13px; font-weight: 850; letter-spacing: .14em; }
.portal-hero-copy h1 { max-width: 800px; margin: 10px 0 12px; font-size: clamp(36px, 4.2vw, 58px); line-height: 1; letter-spacing: -.05em; }
.portal-hero-copy p { max-width: 760px; margin: 0; color: rgba(255,255,255,.8); font-size: clamp(14px, 1.6vw, 18px); line-height: 1.65; }
.portal-school-contact { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px 20px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.16); color: rgba(255,255,255,.7); }
.portal-secure-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border: 1px solid color-mix(in srgb, var(--success) 22%, transparent); border-radius: 999px; color: var(--success); background: color-mix(in srgb, var(--success) 7%, white); font-size: 13px; font-weight: 800; }
.portal-secure-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 12%, transparent); }
.portal-content { width: 100%; min-width: 0; }
.portal-product-mark { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; width: min(1080px, 100%); margin: auto auto 0; padding: 42px 0 8px; color: var(--muted); font-size: 13px; }
.portal-product-mark img { width: 36px; height: 36px; object-fit: contain; object-position: center; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.portal-product-mark strong { color: var(--ink); }
.portal-product-mark a { color: var(--brand); text-decoration: none; }

.portal-heading { margin-bottom: 24px; }
.portal-heading small { color: var(--brand); font-size: 13px; font-weight: 900; letter-spacing: .14em; }
.portal-heading h2 { margin: 7px 0 5px; font-size: clamp(30px, 3.2vw, 46px); line-height: 1.08; letter-spacing: -.04em; }
.portal-heading p { max-width: 690px; margin: 0; color: var(--muted); }
.portal-panel, .portal-success, .portal-result-card, .portal-dashboard {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 18px 54px color-mix(in srgb, var(--brand-deep) 7%, transparent);
}
.portal-panel { padding: clamp(19px, 3vw, 34px); }
.portal-panel + .portal-panel, #result-output, #admission-status-result { margin-top: 20px; }
.portal-switcher { display: inline-flex; gap: 4px; margin-bottom: 18px; padding: 4px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.portal-switcher button { min-height: 38px; padding: 0 15px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 15px; font-weight: 800; }
.portal-switcher button.active { color: #fff; background: var(--brand); box-shadow: 0 8px 18px color-mix(in srgb, var(--brand) 22%, transparent); }

.portal-form { display: grid; gap: 20px; }
.portal-form.compact { max-width: 780px; }
.portal-form fieldset { min-width: 0; margin: 0; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); }
.portal-form legend { display: flex; align-items: center; gap: 9px; padding: 0 8px; color: var(--ink); font-size: 16px; font-weight: 850; }
.portal-form legend span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: #fff; background: var(--brand); font-size: 12px; }
.portal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.portal-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.portal-grid label { min-width: 0; display: grid; align-content: start; gap: 7px; color: var(--ink); font-size: 14px; font-weight: 760; }
.portal-grid label > small { color: var(--muted); font-size: 12px; font-weight: 650; }
.portal-grid .full { grid-column: 1 / -1; }
.portal-grid .span-2 { grid-column: span 2; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #fff;
  outline: 0;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
textarea { resize: vertical; }
input[type="file"] { padding: 8px; font-size: 13px; }
input[readonly] { color: var(--muted); background: var(--surface-2); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 9%, transparent); }
.portal-upload-note { margin-bottom: 14px; padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 8px; color: var(--muted); background: color-mix(in srgb, var(--accent) 10%, white); font-size: 14px; }
.portal-document-row { display: grid; grid-template-columns: 38px minmax(150px, .8fr) minmax(210px, 1.2fr) 38px; gap: 10px; align-items: end; margin-top: 10px; }
.portal-document-row > b { display: grid; place-items: center; height: 48px; border-radius: 11px; color: var(--brand); background: var(--brand-soft); font-size: 13px; }
.portal-document-row label { display: grid; gap: 6px; font-size: 13px; font-weight: 750; }
.portal-document-row > button { height: 48px; border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent); border-radius: 11px; color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, white); font-size: 20px; }
.portal-text-button { width: fit-content; margin-top: 14px; padding: 8px 0; border: 0; color: var(--brand); background: transparent; font-size: 14px; font-weight: 850; }
.portal-consent { display: flex; align-items: flex-start; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.portal-consent input { flex: 0 0 auto; width: 18px; min-height: 18px; margin-top: 2px; accent-color: var(--brand); }
.portal-consent span { display: grid; color: var(--muted); font-size: 13px; }
.portal-consent b { color: var(--ink); font-size: 15px; }

.portal-primary, .portal-secondary {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 850;
  transition: transform .14s ease, box-shadow .14s ease;
}
.portal-primary { width: fit-content; border: 1px solid var(--brand); color: #fff; background: linear-gradient(135deg, var(--brand-deep), var(--brand)); box-shadow: 0 12px 24px color-mix(in srgb, var(--brand) 20%, transparent); }
.portal-primary span { margin-left: 12px; color: var(--accent); }
.portal-secondary { border: 1px solid var(--line); color: var(--brand); background: #fff; }
.portal-primary:hover, .portal-secondary:hover { transform: translateY(-1px); }
.portal-alert { padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; color: var(--brand); background: var(--brand-soft); font-size: 14px; font-weight: 650; }
.portal-alert.error { border-color: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, white); }
.portal-alert.success { border-color: color-mix(in srgb, var(--success) 28%, transparent); color: var(--success); background: color-mix(in srgb, var(--success) 6%, white); }
.portal-account-badge { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.portal-account-badge > b { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--accent); background: var(--brand-deep); font-size: 13px; }
.portal-account-badge span { display: grid; }
.portal-account-badge small, .portal-privacy { color: var(--muted); font-size: 12px; }
.portal-password { display: flex; align-items: stretch; }
.portal-password input { min-width: 0; border-radius: 11px 0 0 11px; }
.portal-password button { min-width: 58px; border: 1px solid var(--line); border-left: 0; border-radius: 0 11px 11px 0; color: var(--brand); background: var(--brand-soft); font-size: 13px; font-weight: 700; }
.portal-captcha-card { display: grid; gap: 14px; padding: 16px; border: 1px solid color-mix(in srgb, var(--brand) 23%, var(--line)); border-radius: 16px; background: linear-gradient(145deg, color-mix(in srgb, var(--brand-soft) 72%, white), white); box-shadow: inset 0 1px 0 rgba(255,255,255,.75); }
.portal-captcha-card[aria-busy="true"] { opacity: .76; }
.portal-captcha-card > header { display: flex; align-items: center; gap: 11px; }
.portal-captcha-card > header > span { flex: 0 0 38px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: linear-gradient(145deg, var(--brand-deep), var(--brand)); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.portal-captcha-card > header > div { display: grid; gap: 2px; }
.portal-captcha-card > header strong { font-size: 15px; font-weight: 750; }
.portal-captcha-card > header small { color: var(--muted); font-size: 12px; font-weight: 500; }
.portal-captcha-grid { display: grid; grid-template-columns: minmax(170px, .82fr) minmax(150px, 1.18fr); gap: 11px; align-items: end; }
.portal-captcha-question { min-height: 54px; display: grid; place-items: center; padding: 10px 15px; border: 1px dashed color-mix(in srgb, var(--brand) 42%, var(--line)); border-radius: 12px; color: var(--brand-deep); background: #fff; font-size: 18px; font-weight: 750; letter-spacing: .04em; text-align: center; }
.portal-captcha-question:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px; }
.portal-captcha-grid label { display: grid; gap: 6px; color: var(--ink); font-size: 13px; font-weight: 650; }
.portal-captcha-grid input { min-height: 54px; font-size: 15px; font-weight: 650; }
.portal-captcha-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.portal-captcha-actions button { min-height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--brand); background: #fff; font-size: 12px; font-weight: 700; }
.portal-captcha-actions button:hover:not(:disabled), .portal-captcha-actions button:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.portal-captcha-actions button:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 13%, transparent); outline-offset: 2px; }
.portal-captcha-actions button span { margin-right: 5px; color: var(--accent); font-size: 14px; }
.portal-captcha-actions p { flex: 1 1 250px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }

.portal-success { padding: clamp(24px, 4vw, 48px); text-align: center; }
.portal-success > span { color: var(--success); font-size: 13px; font-weight: 900; letter-spacing: .14em; }
.portal-success h2 { margin: 10px 0; color: var(--brand); font-size: clamp(27px, 4vw, 44px); }
.portal-success p, .portal-success > small { color: var(--muted); }
.portal-reference { display: grid; max-width: 470px; margin: 24px auto; padding: 18px; border: 1px dashed var(--brand); border-radius: 14px; background: var(--brand-soft); }
.portal-reference small { color: var(--muted); }
.portal-reference b { font-size: 21px; letter-spacing: .04em; }
.portal-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-bottom: 17px; }
.portal-result-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 20px; }
.portal-result-card small { color: var(--muted); font-weight: 900; letter-spacing: .1em; }
.portal-result-card h3 { margin: 4px 0; }
.portal-result-card p { margin: 0; color: var(--muted); }
.portal-result-stack { display: grid; gap: 16px; margin-top: 20px; }
.portal-result-notices{display:grid;gap:12px;margin:0 0 20px}
.portal-result-notice{display:grid;grid-template-columns:auto minmax(0,1fr);gap:14px;padding:18px;border:1px solid color-mix(in srgb,var(--brand) 22%,var(--line));border-radius:16px;background:linear-gradient(135deg,var(--brand-soft),#fff);box-shadow:0 10px 28px color-mix(in srgb,var(--brand-deep) 6%,transparent)}
.portal-result-notice>span{align-self:start;padding:5px 8px;border-radius:8px;color:#fff;background:var(--brand);font-size:10px;font-weight:900;letter-spacing:.09em}
.portal-result-notice h3{margin:0 0 4px;color:var(--ink);font-size:17px}
.portal-result-notice p{margin:0;color:var(--muted);white-space:pre-wrap;overflow-wrap:anywhere}
.portal-result-notice small{display:block;margin-top:8px;color:var(--brand);font-weight:750}
.portal-record { padding: 20px; }
.portal-record > header, .portal-record > footer, .portal-detail-card > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.portal-record h3, .portal-detail-card h3 { margin: 3px 0 0; }
.portal-record > footer { margin-top: 15px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
.portal-status { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: 12px; font-weight: 850; text-transform: capitalize; }
.portal-status.approved, .portal-status.published, .portal-status.active, .portal-status.present, .portal-status.paid { color: var(--success); background: color-mix(in srgb, var(--success) 9%, white); }
.portal-status.rejected, .portal-status.absent, .portal-status.due { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, white); }
.portal-status.withheld, .portal-status.leave, .portal-status.advance { color: var(--warning); background: color-mix(in srgb, var(--warning) 9%, white); }

.portal-dashboard { overflow: hidden; }
.portal-dashboard-topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 19px; border-bottom: 1px solid var(--line); background: #fff; }
.portal-dashboard-topbar > div { display: grid; }
.portal-dashboard-topbar small { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.portal-dashboard-topbar strong { font-size: 18px; }
.portal-dashboard-school { min-width: 0; display: flex !important; align-items: center; gap: 13px; }
.portal-dashboard-school > img, .portal-dashboard-school > .portal-school-monogram { flex: 0 0 auto; width: 58px; height: 58px; display: grid; place-items: center; padding: 5px; border: 1px solid var(--line); border-radius: 14px; color: #fff; background: var(--brand); object-fit: contain; font-size: 17px; font-weight: 800; }
.portal-dashboard-school > span { min-width: 0; display: grid; }
.portal-dashboard-school strong { overflow-wrap: anywhere; }
.portal-dashboard-school em { color: var(--muted); font-size: 11px; font-style: normal; overflow-wrap: anywhere; }
.portal-dashboard-layout { min-height: 620px; display: grid; grid-template-columns: minmax(165px, 25%) minmax(0, 1fr); }
.portal-dashboard-sidebar { min-width: 0; display: flex; flex-direction: column; gap: 18px; padding: 18px 13px; color: #fff; background: linear-gradient(165deg, var(--brand-deep), var(--brand)); }
.portal-user-badge { display: grid; justify-items: start; gap: 9px; padding: 4px 3px 16px; border-bottom: 1px solid rgba(255,255,255,.16); }
.portal-user-badge > b, .portal-user-badge > img { display: grid; place-items: center; width: 52px; height: 52px; border: 2px solid rgba(255,255,255,.72); border-radius: 15px; color: var(--brand-deep); background: #fff; object-fit: cover; }
.portal-user-badge span { min-width: 0; display: grid; }
.portal-user-badge small { color: var(--accent); font-size: 10px; font-weight: 900; letter-spacing: .09em; }
.portal-user-badge strong { overflow-wrap: anywhere; font-size: 15px; line-height: 1.25; }
.portal-user-badge em { color: rgba(255,255,255,.68); font-size: 12px; font-style: normal; overflow-wrap: anywhere; }
.portal-dashboard-sidebar nav { display: grid; gap: 5px; }
.portal-dashboard-sidebar nav button { width: 100%; min-height: 43px; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: 7px; padding: 6px 8px; border: 0; border-radius: 10px; color: rgba(255,255,255,.72); background: transparent; text-align: left; }
.portal-dashboard-sidebar nav button span { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid rgba(255,255,255,.2); border-radius: 8px; font-size: 10px; }
.portal-dashboard-sidebar nav button b { font-size: 12px; overflow-wrap: anywhere; }
.portal-dashboard-sidebar nav button.active { color: var(--brand-deep); background: #fff; }
.portal-dashboard-sidebar nav button.active span { border-color: color-mix(in srgb, var(--brand) 18%, transparent); color: #fff; background: var(--brand); }
.portal-dashboard-signout { margin-top: auto; min-height: 42px; border: 1px solid rgba(255,255,255,.25); border-radius: 10px; color: #fff; background: rgba(255,255,255,.08); font-weight: 750; }
.portal-dashboard-main { min-width: 0; background: var(--surface-2); }
.portal-dashboard-body { padding: 20px; }
.portal-dashboard-body > section { display: grid; gap: 16px; }
.portal-attendance-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.portal-attendance-tools label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 750; }
.portal-attendance-tools input, .portal-attendance-tools select { min-height: 40px; background: #fff; }
.portal-attendance-tools > span { align-self: center; justify-self: end; color: var(--brand); font-size: 12px; font-weight: 800; white-space: nowrap; }
.portal-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.portal-metrics article { min-height: 96px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.portal-metrics small { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.portal-metrics b { color: var(--brand); font-size: 25px; }
.portal-person-card { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 16px; color: #fff; background: linear-gradient(125deg, var(--brand-deep), var(--brand)); }
.portal-person-card > img, .portal-person-card > b { flex: 0 0 auto; width: 74px; height: 74px; border-radius: 18px; object-fit: cover; }
.portal-person-card > b { display: grid; place-items: center; color: var(--brand); background: #fff; }
.portal-person-card div { display: grid; }
.portal-person-card small { color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .1em; }
.portal-person-card h3 { margin: 4px 0 0; font-size: 21px; }
.portal-person-card p { margin: 0; color: rgba(255,255,255,.74); }
.portal-person-card span { color: rgba(255,255,255,.58); font-size: 13px; }
.portal-detail-card { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.portal-detail-card > header { margin-bottom: 14px; }
.portal-detail-card > header small { color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .1em; }
.portal-profile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.portal-profile-grid > div { display: grid; min-width: 0; gap: 4px; padding: 12px; border-radius: 11px; background: var(--surface-2); }
.portal-profile-grid small { color: var(--muted); font-size: 12px; }
.portal-profile-grid b { overflow-wrap: anywhere; font-size: 14px; }
.portal-score-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 14px 0; }
.portal-score-row article { display: grid; padding: 11px; border-radius: 11px; background: var(--surface-2); }
.portal-score-row small { color: var(--muted); font-size: 12px; }
.portal-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.portal-table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; }
.portal-table-wrap th { color: #fff; background: var(--brand-deep); text-align: left; }
.portal-table-wrap th, .portal-table-wrap td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.portal-table-wrap tbody tr:last-child td { border-bottom: 0; }
.portal-list, .portal-notices { display: grid; gap: 9px; }
.portal-list article { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border-radius: 11px; background: var(--surface-2); }
.portal-list article > div { display: grid; }
.portal-list small, .portal-list span { color: var(--muted); font-size: 12px; }
.portal-list strong { color: var(--ink); font-size: 14px; }
.portal-fee-ledger .portal-metrics { margin: 0 0 14px; }
.portal-fee-ledger .portal-metrics article { min-height: 82px; }
.portal-fee-ledger .portal-metrics b { font-size: 17px; }
.portal-salary-months { display: grid; gap: 10px; }
.portal-salary-month { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.portal-salary-month > summary { min-height: 70px; display: grid; grid-template-columns: minmax(160px, 1fr) repeat(2, minmax(90px, .42fr)) auto; align-items: center; gap: 14px; padding: 13px 15px; cursor: pointer; list-style: none; }
.portal-salary-month > summary::-webkit-details-marker { display: none; }
.portal-salary-month > summary::before { content: '+'; display: grid; place-items: center; width: 26px; height: 26px; grid-column: 1; grid-row: 1; justify-self: end; border-radius: 8px; color: #fff; background: var(--brand); font-weight: 800; }
.portal-salary-month[open] > summary::before { content: '−'; }
.portal-salary-month > summary > span { min-width: 0; display: grid; }
.portal-salary-month > summary > span:first-of-type { padding-right: 34px; }
.portal-salary-month > summary small { color: var(--muted); font-size: 11px; }
.portal-salary-month > summary > strong { color: var(--ink); font-size: 13px; text-transform: capitalize; }
.portal-salary-detail { padding: 14px; border-top: 1px solid var(--line); background: #fff; }
.portal-salary-payments { display: grid; gap: 8px; }
.portal-salary-payment { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 11px; border-radius: 10px; background: var(--surface-2); }
.portal-salary-payment span { min-width: 0; display: grid; gap: 2px; }
.portal-salary-payment small { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.portal-salary-payment b { overflow-wrap: anywhere; font-size: 12px; }
.portal-salary-unpaid { margin: 0; color: var(--muted); font-size: 13px; }
.portal-salary-detail > footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.portal-salary-detail > footer > span:first-child { color: var(--muted); font-size: 11px; }
.portal-notices article { display: grid; grid-template-columns: 90px 1fr; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.portal-notices article:last-child { border-bottom: 0; }
.portal-notices time { color: var(--ink); font-size: 13px; font-weight: 800; }
.portal-notices p { margin: 3px 0; color: var(--muted); font-size: 13px; white-space: pre-line; }
.portal-notices small { color: var(--muted); font-size: 12px; }
.portal-empty { padding: 42px 20px; border: 1px dashed var(--line); border-radius: 16px; text-align: center; background: #fff; }
.portal-empty > b { display: grid; place-items: center; width: 40px; height: 40px; margin: auto; border-radius: 50%; color: var(--success); background: color-mix(in srgb, var(--success) 9%, white); }
.portal-empty h3 { margin: 10px 0 2px; }
.portal-empty p { margin: 0; color: var(--muted); }

.portal-modal, .portal-preview { position: fixed; inset: 0; z-index: 1000; background: rgba(13, 16, 24, .76); backdrop-filter: blur(7px); }
.portal-modal { display: grid; place-items: center; padding: 20px; }
.portal-modal > section { width: min(920px, 100%); max-height: calc(100vh - 40px); overflow: hidden; display: flex; flex-direction: column; border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.portal-modal header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.portal-modal header small { color: var(--brand); font-size: 12px; font-weight: 900; }
.portal-modal h3 { margin: 2px 0 0; }
.portal-modal header button { width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; color: var(--brand); background: #fff; font-size: 20px; }
.portal-document-preview { min-height: 0; flex: 1; display: grid; place-items: center; overflow: auto; padding: 18px; background: var(--surface-2); }
.portal-document-preview img { max-width: 100%; max-height: 70vh; object-fit: contain; }
.portal-document-preview iframe { width: 100%; height: 70vh; border: 0; }
.portal-modal footer { padding: 11px 20px; color: var(--muted); font-size: 12px; }
.portal-preview { overflow: auto; background: #e7e9ed; }
.portal-preview-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 76px; padding: 12px max(18px, calc((100vw - 1100px) / 2)); color: #fff; background: var(--brand-deep); box-shadow: 0 7px 20px rgba(0,0,0,.2); }
.portal-preview-toolbar > div { display: flex; align-items: center; gap: 8px; }
.portal-preview-toolbar > div:first-child { display: grid; }
.portal-preview-toolbar small { color: var(--accent); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.portal-preview-toolbar .portal-secondary { color: #fff; border-color: rgba(255,255,255,.25); background: rgba(255,255,255,.1); }
.portal-preview-toolbar .portal-primary { border-color: var(--accent); color: var(--brand-deep); background: var(--accent); box-shadow: none; }
.portal-preview > main { display: grid; justify-content: center; gap: 24px; padding: 28px; }
.portal-paper { position: relative; width: 210mm; min-height: 297mm; overflow: hidden; padding: 8mm; color: #17202d; background: #fff; box-shadow: 0 6px 30px rgba(0,0,0,.18); break-after: page; page-break-after: always; font-family: var(--ui-font); font-size: 9pt; }
.portal-paper:last-child { break-after: auto; page-break-after: auto; }
.paper-letterhead { display: grid; grid-template-columns: 20mm 1fr auto; gap: 5mm; align-items: center; min-height: 25mm; padding-bottom: 4mm; border-bottom: .65mm solid var(--brand); }
.paper-letterhead > img:first-child { width: 18mm; height: 18mm; object-fit: contain; }
.paper-letterhead h1 { margin: 0; color: var(--brand-deep); font-size: 16pt; line-height: 1.12; }
.paper-letterhead p { margin: 1mm 0; color: var(--brand); font-size: 8pt; font-weight: 800; }
.paper-letterhead span { color: #434d59; font-size: 7pt; font-weight: 640; }
.paper-letterhead .school-letterhead-contact,.marksheet-letterhead .school-letterhead-contact{display:flex;flex-wrap:wrap;justify-content:center;gap:1mm 3mm;margin-top:1mm}.paper-letterhead .school-letterhead-contact-item,.marksheet-letterhead .school-letterhead-contact-item{display:inline-flex;align-items:center;max-width:100%;color:#434d59;font-size:7pt;font-weight:680;line-height:1.25}.paper-letterhead .school-letterhead-contact-address,.marksheet-letterhead .school-letterhead-contact-address{flex-basis:100%;justify-content:center}.paper-letterhead .school-letterhead-contact-item svg,.marksheet-letterhead .school-letterhead-contact-item svg{flex:0 0 auto;width:3mm;height:3mm;margin-right:1mm;fill:none;stroke:var(--brand);stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.paper-letterhead .school-letterhead-contact-item b,.marksheet-letterhead .school-letterhead-contact-item b{overflow-wrap:anywhere}
.paper-photo { width: 22mm; height: 27mm; padding: 1mm; border: .3mm solid var(--brand); object-fit: cover; }
.paper-title { padding: 5mm 0 3mm; text-align: center; }
.paper-title > span { color: var(--accent); font-size: 6.5pt; font-weight: 900; letter-spacing: .12em; }
.paper-title h2 { margin: 1mm 0; color: var(--brand-deep); font-size: 14pt; text-transform: uppercase; }
.paper-title p { margin: 0; color: #68717d; font-size: 7.5pt; }
.paper-keyline { display: grid; grid-template-columns: repeat(4, 1fr); border: .25mm solid var(--brand); }
.paper-keyline > div, .paper-identity-grid > div, .paper-field-grid > div { display: grid; min-width: 0; gap: .7mm; padding: 2.2mm; border-right: .2mm solid color-mix(in srgb, var(--brand) 28%, #ddd); border-bottom: .2mm solid color-mix(in srgb, var(--brand) 28%, #ddd); }
.paper-keyline > div:last-child { border-right: 0; }
.portal-paper small { color: #697380; font-size: 6.3pt; text-transform: uppercase; }
.portal-paper b { overflow-wrap: anywhere; font-size: 7.5pt; }
.paper-field-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 3mm; border-top: .2mm solid color-mix(in srgb, var(--brand) 28%, #ddd); border-left: .2mm solid color-mix(in srgb, var(--brand) 28%, #ddd); }
.paper-field-grid .wide { grid-column: span 2; }
.paper-declaration { margin-top: 3mm; padding: 3mm; border: .25mm solid var(--brand); font-size: 7pt; }
.paper-declaration p { margin: 1.5mm 0 0; }
.paper-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 15mm; margin: 13mm 7mm 0; }
.paper-signatures.three { grid-template-columns: repeat(3, 1fr); gap: 7mm; }
.paper-signatures span { padding-top: 2mm; border-top: .25mm solid #1b2430; font-size: 6.5pt; text-align: center; }
.portal-paper > footer { position: absolute; right: 8mm; bottom: 5mm; left: 8mm; color: #697380; font-size: 6pt; text-align: center; }
.paper-document-head { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin: 5mm 0 3mm; }
.paper-document-head > div { display: grid; padding: 3mm; border: .25mm solid var(--line); }
.paper-document-view { height: 223mm; display: grid; place-items: center; overflow: hidden; border: .25mm solid var(--line); background: #f8f9fb; }
.paper-document-view img, .paper-document-view object { width: 100%; height: 100%; object-fit: contain; border: 0; }
.paper-identity-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 2mm 0 4mm; border-top: .2mm solid color-mix(in srgb, var(--brand) 28%, #ddd); border-left: .2mm solid color-mix(in srgb, var(--brand) 28%, #ddd); }
.paper-marks { width: 100%; border-collapse: collapse; font-size: 7pt; }
.paper-marks th { color: #fff; background: var(--brand-deep); }
.paper-marks th, .paper-marks td { padding: 2mm; border: .2mm solid var(--brand); }
.paper-marks tfoot th { color: var(--brand-deep); background: var(--brand-soft); }
.paper-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2mm; margin-top: 4mm; }
.paper-summary > div { display: grid; padding: 2.5mm; border: .25mm solid var(--brand); }
.salary-slip-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-top: 4mm; }
.salary-slip-paper .paper-title { margin-bottom: 2mm; border-bottom: .25mm solid var(--line); }
.salary-slip-total { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3mm; margin-top: 4mm; }
.salary-slip-total > span { display: grid; gap: 1mm; padding: 3mm; border: .25mm solid var(--brand); background: var(--brand-soft); }
.salary-slip-total b { color: var(--brand-deep); font-size: 10pt; }
.paper-disclaimer { margin-top: 5mm; padding: 2.5mm; border-left: .7mm solid var(--accent); color: #596370; background: var(--brand-soft); font-size: 6.5pt; }

.portal-toast { position: fixed; right: 18px; bottom: 18px; z-index: 1300; max-width: min(420px, calc(100vw - 36px)); padding: 14px 17px; border-radius: 12px; color: #fff; background: #18251f; box-shadow: 0 16px 40px rgba(0,0,0,.24); font-size: 14px; font-weight: 700; }
.portal-unavailable { min-height: 100vh; display: grid; place-content: center; justify-items: center; padding: 24px; text-align: center; }
.portal-unavailable img { width: 84px; height: 84px; object-fit: contain; }
.portal-unavailable small { margin-top: 18px; color: var(--brand); font-weight: 900; letter-spacing: .14em; }
.portal-unavailable h1 { margin: 7px 0; font-size: clamp(34px, 6vw, 64px); }
.portal-unavailable p { max-width: 560px; margin: 0; color: var(--muted); }
.portal-unavailable a { margin-top: 20px; color: var(--brand); font-weight: 800; text-decoration: none; }

@media (max-width: 1180px) {
  .portal-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 651px) {
  .portal-shell.portal-authenticated, .portal-shell.portal-authenticated .portal-workspace { height: 100vh; min-height: 0; overflow: hidden; }
  .portal-shell.portal-authenticated .portal-workspace { padding: 14px 0 8px; }
  .portal-shell.portal-authenticated .portal-main-layout, .portal-shell.portal-authenticated .portal-content { min-height: 0; flex: 1; height: 100%; }
  .portal-shell.portal-authenticated .portal-dashboard { height: 100%; min-height: 0; display: flex; flex-direction: column; }
  .portal-shell.portal-authenticated .portal-dashboard-topbar { position: relative; z-index: 2; flex: 0 0 auto; }
  .portal-shell.portal-authenticated .portal-dashboard-layout { min-height: 0; flex: 1; }
  .portal-shell.portal-authenticated .portal-dashboard-sidebar { min-height: 0; overflow-y: auto; }
  .portal-shell.portal-authenticated .portal-dashboard-main { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .portal-shell.portal-authenticated .portal-product-mark { flex: 0 0 auto; padding: 7px 0 0; }
}

@media (max-width: 860px) {
  .portal-workspace { min-height: auto; }
  .portal-main-layout { grid-template-columns: 1fr; }
  .portal-school-hero { position: relative; top: auto; min-height: 420px; }
  .portal-paper { transform-origin: top center; }
}

@media (max-width: 650px) {
  body { font-size: 14px; }
  .portal-workspace { width: min(100% - 18px, 1180px); padding: 9px 0 18px; }
  .portal-school-hero { border-radius: 20px; }
  .portal-school-identity { align-items: flex-start; }
  .portal-grid, .portal-grid.three { grid-template-columns: 1fr; }
  .portal-grid .full, .portal-grid .span-2 { grid-column: auto; }
  .portal-form fieldset { padding: 17px 13px; }
  .portal-document-row { grid-template-columns: 34px minmax(0, 1fr) 36px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 12px; }
  .portal-document-row label:nth-of-type(2) { grid-column: 2 / -1; }
  .portal-result-card { grid-template-columns: 1fr auto; }
  .portal-result-card .portal-secondary { grid-column: 1 / -1; }
  .portal-dashboard-topbar { align-items: flex-start; }
  .portal-dashboard-layout { min-height: 0; display: block; }
  .portal-dashboard-sidebar { display: block; padding: 12px; }
  .portal-user-badge { grid-template-columns: 45px 1fr; align-items: center; padding: 0 0 12px; }
  .portal-user-badge > b, .portal-user-badge > img { width: 44px; height: 44px; }
  .portal-dashboard-sidebar nav { display: flex; gap: 5px; overflow-x: auto; padding: 10px 0; scrollbar-width: thin; }
  .portal-dashboard-sidebar nav button { flex: 0 0 auto; width: auto; grid-template-columns: 1fr; min-height: 36px; padding: 0 12px; }
  .portal-dashboard-sidebar nav button span { display: none; }
  .portal-dashboard-signout { width: 100%; margin-top: 6px; }
  .portal-dashboard-body { padding: 12px; }
  .portal-attendance-tools { grid-template-columns: 1fr; }
  .portal-attendance-tools > span { justify-self: start; }
  .portal-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-record > header, .portal-record > footer { align-items: flex-start; flex-direction: column; }
  .portal-score-row { grid-template-columns: 1fr; }
  .portal-list article { align-items: flex-start; }
  .portal-salary-month > summary { grid-template-columns: minmax(0, 1fr) auto; }
  .portal-salary-month > summary > span:not(:first-of-type) { display: none; }
  .portal-salary-payment { grid-template-columns: 1fr 1fr; }
  .portal-salary-detail > footer { align-items: flex-start; flex-direction: column; }
  .portal-notices article { grid-template-columns: 1fr; gap: 4px; }
  .portal-preview-toolbar { align-items: flex-start; min-height: 82px; }
  .portal-preview-toolbar > div:last-child { flex-direction: column-reverse; }
  .portal-preview-toolbar button { min-height: 34px; }
  .portal-preview > main { justify-content: start; overflow: auto; padding: 14px; }
  .portal-paper { transform: scale(.58); transform-origin: top left; margin-bottom: calc(-297mm * .42); }
}

@page { size: A4 portrait; margin: 8mm; }
@media print {
  html, body { width: auto; min-height: 0; background: #fff !important; }
  body.preview-open > *:not(#portal-preview), body.preview-open #portal-preview > .portal-preview > .portal-preview-toolbar { display: none !important; }
  body.preview-open #portal-preview, body.preview-open .portal-preview { position: static; display: block; overflow: visible; background: #fff; backdrop-filter: none; }
  body.preview-open .portal-preview > main { display: block; padding: 0; }
  body.preview-open .portal-paper { width: auto; min-height: 281mm; margin: 0; padding: 0; box-shadow: none; transform: none; }
  body.preview-open .portal-paper > footer { right: 0; bottom: 0; left: 0; }
  .view-only-portal > * { display: none !important; }
  .view-only-portal::before {
    content: "Protected school portal — printing and exporting are disabled.";
    display: block !important;
    margin: 25mm;
    padding: 12mm;
    border: 1px solid #555;
    color: #111;
    font: 14pt/1.5 var(--ui-font);
    text-align: center;
  }
  .view-only-portal.salary-slip-print-open::before { display: none !important; }
  .view-only-portal.salary-slip-print-open > #portal-preview { display: block !important; }
}

/* Runtime-font typography hierarchy shared by school portals and printed copies. */
body, input, select, textarea, button { font-family: var(--ui-font); }
body { font-weight: 500; }
.portal-hero-copy h1, .portal-heading h2, .portal-success h2, .portal-unavailable h1 { font-weight: 780; }
.portal-hero-copy p, .portal-heading p, .portal-privacy, .portal-alert, .portal-record p, .portal-empty p { font-weight: 500; }
.portal-school-identity strong, .portal-account-badge strong, .portal-user-badge strong { font-weight: 720; }
.portal-hero-copy small, .portal-heading small, .portal-detail-card > header small { font-weight: 760; }
.portal-grid label, .portal-document-row label, .portal-consent b { font-weight: 650; }
.portal-primary, .portal-secondary, .portal-switcher button, .portal-dashboard-sidebar nav button, .portal-text-button { font-weight: 700; }
.portal-result-card h3, .portal-record h3, .portal-detail-card h3, .portal-person-card h3, .portal-empty h3 { font-weight: 720; }
.portal-metrics small, .portal-profile-grid small, .portal-score-row small, .portal-table-wrap th { font-weight: 650; }
.portal-metrics b, .portal-profile-grid b, .portal-list strong { font-weight: 720; }
.portal-paper, .portal-paper * { font-family: var(--ui-font); }
.paper-letterhead h1, .paper-title h2 { font-weight: 760; letter-spacing: -.015em; }
.paper-letterhead p, .paper-marks th, .paper-keyline b, .paper-identity-grid b, .paper-field-grid b { font-weight: 720; }

@media (max-width: 650px) {
  .portal-captcha-grid { grid-template-columns: 1fr; }
  .portal-captcha-card { padding: 13px; }
  .portal-captcha-question { min-height: 50px; }
  .portal-captcha-actions p { flex-basis: 100%; }
}

@media print {
  .portal-paper, .portal-paper * { font-family: var(--ui-font) !important; }
  .paper-letterhead h1, .paper-title h2 { font-weight: 760 !important; }
}

/* Parent and staff sign-in use the website staff-login geometry. Admission
   and results retain their deliberate 30/70 public-form canvas. */
@media (min-width: 901px) {
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated),
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-workspace { width: 100%; height: 100vh; min-height: 0; overflow: hidden; padding: 0; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-main-layout { height: 100vh; min-height: 0; overflow: hidden; grid-template-columns: minmax(0,1.1fr) minmax(420px,.9fr); align-items: stretch; gap: 0; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-school-hero { position: relative; top: auto; height: 100vh; min-height: 0; overflow: hidden; padding: clamp(48px,8vw,120px); border-radius: 0; box-shadow: none; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-school-identity > img,
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-school-identity > .portal-school-monogram { width: 78px; height: 78px; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-hero-copy h1 { font-size: clamp(48px,5.8vw,84px); line-height: .96; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-content { height: 100vh; min-height: 0; display: flex; flex-direction: column; justify-content: center; padding: 40px 40px 72px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; background: linear-gradient(160deg,#fff,var(--surface-2)); }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-heading,
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-panel { width: min(470px,100%); margin-left: auto; margin-right: auto; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-heading { margin-bottom: 14px; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-heading h2 { font-size: 35px; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-panel { padding: 38px; border-radius: 24px; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-form.compact { width: 100%; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-product-mark { position: fixed; right: 0; bottom: 0; z-index: 5; width: min(45%,620px); padding: 8px 16px; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); }
}
@media (max-height: 860px) and (min-width: 901px) {
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-school-hero { padding: 44px clamp(48px,7vw,92px); }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-hero-copy { padding: 24px 0 16px; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-content { justify-content: flex-start; padding: 24px 24px 72px; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-panel { padding: 28px; }
}
@media (max-width: 900px) {
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-school-hero { display: none; }
  body:is([data-portal="parent"],[data-portal="staff"]) .portal-shell:not(.portal-authenticated) .portal-content { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 18px; }
}

/* Parent/staff password eye lives within the input boundary. */
.portal-password{position:relative;display:block}.portal-password input{width:100%;padding-right:54px;border-radius:11px}.portal-password button{position:absolute;top:50%;right:6px;width:38px;min-width:38px;height:38px;min-height:38px;padding:0;border:0;border-radius:9px;color:var(--brand);background:var(--brand-soft);font-size:0!important;line-height:0;cursor:pointer;transform:translateY(-50%)}.portal-password button:hover{color:#fff;background:var(--brand)}
.portal-password button::before{content:"";position:absolute;inset:9px;background:currentColor;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat}.portal-password button.is-password-visible::before{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 3 18 18'/%3E%3Cpath d='M10.6 10.7a2 2 0 0 0 2.8 2.8M9.9 4.2A10.6 10.6 0 0 1 12 4c6.5 0 10 8 10 8a17 17 0 0 1-2.1 3.1M6.6 6.7C3.5 8.8 2 12 2 12s3.5 8 10 8a9.7 9.7 0 0 0 4.1-.9'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 3 18 18'/%3E%3Cpath d='M10.6 10.7a2 2 0 0 0 2.8 2.8M9.9 4.2A10.6 10.6 0 0 1 12 4c6.5 0 10 8 10 8a17 17 0 0 1-2.1 3.1M6.6 6.7C3.5 8.8 2 12 2 12s3.5 8 10 8a9.7 9.7 0 0 0 4.1-.9'/%3E%3C/svg%3E")}

/* Class diary: one day at a time, one card per period. */
.portal-diary-form{display:flex;align-items:end;gap:12px;margin:14px 0 16px;flex-wrap:wrap}
.portal-diary-form label{display:grid;gap:6px;font-size:12px;font-weight:700}
.portal-diary-form input[type="date"]{padding:9px 11px;border:1px solid var(--line,#dcd3d5);border-radius:10px;background:#fff;font:inherit}
.portal-diary-day{margin:0 0 12px;font-weight:800;font-size:13px}
.portal-diary-entry{margin-top:12px}
.portal-diary-text{margin:10px 0 0;padding:12px 14px;border-radius:10px;background:color-mix(in srgb,var(--brand,#820d25) 5%,#fff);line-height:1.55;white-space:normal}

/* ── Portal sign-in, in the school workspace login design ─────────────────
   The parent and staff portals sign in on the same screen the school itself
   signs in on: the school's story on the left, one secure card on the right. */
.portal-login-v3 { min-height: 100vh; display: grid; grid-template-columns: minmax(0,1.1fr) minmax(420px,.9fr); background: #fff; padding: 0; }
.portal-login-v3 .login-story { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 7vw; color: #fff; overflow: hidden; background: radial-gradient(circle at 90% 100%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 32%), linear-gradient(145deg, var(--brand-deep), var(--brand)); }
.portal-login-v3 .login-story::after { content: ""; position: absolute; right: -18%; bottom: -28%; width: 560px; height: 560px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.04), 0 0 0 140px rgba(255,255,255,.025); }
.portal-login-v3 .login-story > .school-mark { flex: none; width: 82px; height: 82px; margin-bottom: 38px; border-radius: 20px; }
.portal-login-v3 .login-story > img.school-mark { object-fit: contain; padding: 6px; background: rgba(255,255,255,.94); }
.portal-login-v3 .login-story > .school-mark-monogram { display: grid; place-items: center; color: var(--brand-deep); background: linear-gradient(150deg, #fff, color-mix(in srgb, var(--accent) 34%, #fff)); font: 900 26px/1 var(--ui-font); letter-spacing: .03em; }
.portal-login-v3 .login-story > span { color: var(--accent); font-size: 14px; font-weight: 900; letter-spacing: .12em; }
.portal-login-v3 .login-story h1 { max-width: 15ch; margin: 15px 0; font-size: clamp(34px, 4.1vw, 60px); line-height: 1.06; letter-spacing: -.035em; text-wrap: balance; overflow-wrap: break-word; font-weight: 780; }
.portal-login-v3 .login-story p { max-width: 620px; margin: 0; color: rgba(255,255,255,.78); font-size: 16px; line-height: 1.6; }
.portal-login-v3 .login-story > div { z-index: 1; display: grid; gap: 4px; margin-top: 42px; padding: 18px 20px; border: 1px solid rgba(255,255,255,.18); border-radius: 16px; background: rgba(255,255,255,.07); }
.portal-login-v3 .login-story > div strong { font-size: 15px; font-weight: 800; }
.portal-login-v3 .login-story .school-contact { color: rgba(255,255,255,.82); font-size: 14px; }
.portal-login-v3 .login-vendor { z-index: 1; display: flex; align-items: center; gap: 14px; margin-top: 26px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.16); }
.portal-login-v3 .login-vendor img { width: 44px; height: 44px; object-fit: contain; border-radius: 12px; background: rgba(255,255,255,.94); padding: 4px; }
.portal-login-v3 .login-vendor strong { display: block; font-size: 13.5px; }
.portal-login-v3 .login-vendor span { color: rgba(255,255,255,.72); font-size: 12px; }
.portal-login-v3 .login-panel { display: grid; place-items: center; padding: 40px; background: linear-gradient(160deg, #fff, var(--canvas)); }
.portal-login-v3 .login-panel #portal-content { width: min(470px, 100%); }
.portal-login-v3 .login-panel form { display: grid; gap: 10px; padding: 26px 30px; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.94); box-shadow: 0 28px 80px color-mix(in srgb, var(--brand) 10%, transparent); }
.portal-login-v3 .login-panel form > .school-mark { width: 54px; height: 54px; border-radius: 15px; }
.portal-login-v3 .login-panel form > img.school-mark { object-fit: contain; padding: 4px; border: 1px solid var(--line); background: #fff; }
.portal-login-v3 .login-panel form > .school-mark-monogram { display: grid; place-items: center; color: #fff; background: linear-gradient(150deg, var(--brand-deep), var(--brand)); font: 900 21px/1 var(--ui-font); letter-spacing: .03em; }
.portal-login-v3 .login-panel small { display: block; color: var(--brand); font-weight: 900; letter-spacing: .12em; line-height: 1.35; overflow-wrap: break-word; }
.portal-login-v3 .login-panel h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; font-weight: 780; }
.portal-login-v3 .login-panel form > p { margin: -6px 0 2px; font-size: 13px; color: var(--muted); }
.portal-login-v3 .login-panel label { display: grid; gap: 5px; font-size: 13.5px; font-weight: 800; }
.portal-login-v3 .login-panel input, .portal-login-v3 .login-panel select { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #fff; font: inherit; color: #111827; }
.portal-login-v3 .login-panel input:focus, .portal-login-v3 .login-panel select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.portal-login-v3 .portal-password { position: relative; display: block; }
.portal-login-v3 .portal-password input { padding-right: 64px; }
.portal-login-v3 .portal-password button { position: absolute; right: 7px; top: 7px; height: 38px; transform: none; padding: 0 12px; border: 0; border-radius: 9px; color: var(--brand); background: var(--brand-soft); font-weight: 800; cursor: pointer; }
.portal-login-v3 .login-captcha-card { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: none; }
.portal-login-v3 .login-captcha-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.portal-login-v3 .login-captcha-card > header > div:first-child { display: grid; gap: 2px; }
.portal-login-v3 .login-captcha-card > header strong { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 750; }
.portal-login-v3 .login-captcha-card > header strong::before { content: "\2713"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; color: #fff; background: var(--brand); font-size: 11px; font-weight: 900; }
.portal-login-v3 .login-captcha-card > header small { color: var(--muted); font-size: 11.5px; font-weight: 500; letter-spacing: 0; }
.portal-login-v3 .login-captcha-tools { display: flex; gap: 6px; }
.portal-login-v3 .login-captcha-tools button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--brand); background: #fff; font-size: 14px; cursor: pointer; }
.portal-login-v3 .login-captcha-tools button:hover:not(:disabled), .portal-login-v3 .login-captcha-tools button:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.portal-login-v3 .login-captcha-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; align-items: end; }
.portal-login-v3 .login-captcha-question { min-height: 46px; display: grid; place-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--brand-deep); background: var(--canvas); font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .05em; text-align: center; }
.portal-login-v3 .login-captcha-answer { gap: 5px; font-size: 13px; font-weight: 650; }
.portal-login-v3 .login-captcha-answer input { min-height: 46px; font-size: 14px; font-weight: 700; }
.portal-login-v3 .login-captcha-help { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.portal-login-v3 .login-captcha-tools button:disabled, .portal-login-v3 [data-portal-login-submit]:disabled { cursor: wait; opacity: .58; }
.portal-login-v3 .login-submit { width: 100%; justify-content: center; min-height: 46px; font-size: 15px; margin-top: 2px; }
.portal-login-v3 .portal-privacy { margin: 0; text-align: left; }
@media (max-width: 900px) {
  .portal-login-v3 { grid-template-columns: 1fr; }
  .portal-login-v3 .login-story { display: none; }
  .portal-login-v3 .login-panel { min-height: 100vh; padding: 18px; }
  .portal-login-v3 .login-panel form { padding: 26px; }
}
@media (max-width: 560px) { .portal-login-v3 .login-captcha-grid { grid-template-columns: 1fr; } }

/* Portal forms are filled in plain black — brand colour stays on the chrome. */
.portal-form input, .portal-form select, .portal-form textarea { color: #111827; }

/* ── Professional marksheet (online result copy) ────────────────────────── */
.marksheet-paper { padding: 0 !important; background: #fff; }
.marksheet-frame { margin: 10px; padding: 26px 30px; border: 2.5px solid var(--brand-deep); outline: 1px solid color-mix(in srgb, var(--brand) 45%, #fff); outline-offset: -7px; }
.marksheet-letterhead { display: flex; align-items: center; gap: 18px; padding-bottom: 14px; border-bottom: 3px double var(--brand-deep); }
.marksheet-letterhead > div { flex: 1; min-width: 0; text-align: center; }
.marksheet-letterhead small { display: block; color: var(--brand); font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.marksheet-letterhead h1 { margin: 3px 0 4px; color: var(--brand-deep); font-size: 26px; letter-spacing: .01em; line-height: 1.1; text-transform: uppercase; }
.marksheet-letterhead span { color: #333; font-size: 10.5px; }
.marksheet-letterhead .school-mark, .marksheet-letterhead img:first-child { width: 64px; height: 64px; object-fit: contain; }
.marksheet-letterhead .school-mark-monogram { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 14px; color: #fff; background: linear-gradient(150deg, var(--brand-deep), var(--brand)); font-weight: 900; font-size: 20px; }
.marksheet-letterhead .paper-photo { width: 74px; height: 92px; object-fit: cover; border: 1px solid #444; }
.marksheet-photo-box { display: grid; place-items: center; width: 74px; height: 92px; border: 1px dashed #999; color: #999; font-size: 9.5px; text-align: center; line-height: 1.5; }
.marksheet-title { margin: 14px 0 12px; text-align: center; }
.marksheet-title span { display: inline-block; padding: 4px 16px; border: 1px solid var(--brand-deep); border-radius: 999px; color: var(--brand-deep); font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.marksheet-title h2 { margin: 9px 0 3px; color: #111; font-size: 20px; letter-spacing: .02em; }
.marksheet-title p { margin: 0; color: #444; font-size: 11px; }
.marksheet-identity { width: 100%; margin: 0 0 14px; border-collapse: collapse; font-size: 11.5px; }
.marksheet-identity th, .marksheet-identity td { padding: 7px 10px; border: 1px solid #b9b9b9; text-align: left; vertical-align: top; }
.marksheet-identity th { width: 17%; color: #333; background: #f4f1ee; font-weight: 750; white-space: nowrap; }
.marksheet-identity td { width: 33%; color: #111; font-weight: 650; }
.marksheet-marks { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.marksheet-marks th, .marksheet-marks td { padding: 8px 10px; border: 1px solid #9c9c9c; text-align: center; color: #111; }
.marksheet-marks thead th { color: #fff; background: var(--brand-deep); font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; line-height: 1.35; }
.marksheet-marks td.num { width: 34px; color: #555; }
.marksheet-marks td.subject { text-align: left; }
.marksheet-marks td.subject b { display: block; font-weight: 750; }
.marksheet-marks td.subject small { color: #777; font-size: 9.5px; letter-spacing: .06em; }
.marksheet-marks td.strong { font-weight: 800; }
.marksheet-marks tbody tr:nth-child(even) td { background: #faf8f6; }
.marksheet-marks tfoot th { color: var(--brand-deep); background: #f1e9e4; font-weight: 850; }
.sheet-flag { display: inline-block; min-width: 44px; padding: 2px 8px; border-radius: 4px; font-size: 9.5px; font-weight: 850; letter-spacing: .06em; }
.sheet-flag.pass { color: #0d5c3e; background: #e2f4ec; border: 1px solid #9ed4bd; }
.sheet-flag.fail { color: #8c1f2c; background: #fbe9ea; border: 1px solid #e5b2b8; }
.marksheet-summary { display: flex; gap: 12px; align-items: stretch; margin-top: 14px; }
.marksheet-summary-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); }
.marksheet-summary-grid > div { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid #b9b9b9; border-right-width: 0; }
.marksheet-summary-grid > div:last-child { border-right-width: 1px; }
.marksheet-summary-grid small { color: #555; font-size: 9.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.marksheet-summary-grid b { color: #111; font-size: 16px; }
.marksheet-verdict { display: grid; place-content: center; gap: 3px; min-width: 168px; padding: 10px 16px; border: 2px solid; text-align: center; }
.marksheet-verdict small { font-size: 9.5px; font-weight: 800; letter-spacing: .12em; }
.marksheet-verdict b { font-size: 15px; letter-spacing: .04em; }
.marksheet-verdict.pass { color: #0d5c3e; border-color: #0d5c3e; background: #e9f6f0; }
.marksheet-verdict.fail { color: #8c1f2c; border-color: #8c1f2c; background: #fdf0f1; }
.marksheet-verdict.withheld { color: #7a5410; border-color: #7a5410; background: #fdf6e7; }
.marksheet-remarks { margin-top: 12px; padding: 9px 12px; border: 1px dashed #b9b9b9; }
.marksheet-remarks small { color: #555; font-size: 9.5px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.marksheet-remarks p { margin: 3px 0 0; color: #222; font-size: 11.5px; }
.marksheet-signatures { display: flex; justify-content: space-between; gap: 20px; margin-top: 48px; }
.marksheet-signatures span { flex: 1; padding-top: 8px; border-top: 1px solid #444; color: #333; font-size: 10.5px; font-weight: 700; text-align: center; }
.marksheet-footer { display: grid; gap: 3px; margin-top: 18px; padding-top: 10px; border-top: 1px solid #ccc; color: #666; font-size: 9.3px; text-align: center; }
@media print { .marksheet-frame { margin: 0; } }

/* A sign-in card taller than the window scrolls inside its own panel. */
.portal-login-v3 .login-panel { overflow-y: auto; }
.portal-login-v3 .login-panel form { max-height: calc(100vh - 72px); overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 900px) { .portal-login-v3 .login-panel form { max-height: none; overflow: visible; } }

/* The sign-in screen owns the whole viewport - no page gutter around it. */
body:has(.portal-login-v3) { padding: 0; background: #fff; }

/* Compact security check on the sign-in card. */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.portal-login-v3 .login-captcha-compact { gap: 8px; padding: 11px 12px; }
.portal-login-v3 .login-captcha-compact > header { align-items: center; }
.portal-login-v3 .login-captcha-compact .login-captcha-question, .portal-login-v3 .login-captcha-compact .login-captcha-answer input { min-height: 44px; }
.portal-login-v3 .login-captcha-compact .login-captcha-tools button { width: 30px; height: 30px; }
.portal-login-v3 .login-captcha-compact .login-captcha-help { font-size: 10px; }

/* Results notice board under the identity card. */
.portal-result-noticeboard { margin-top: 18px; }
.portal-result-noticeboard > header { margin-bottom: 6px; }
.portal-result-noticeboard .portal-result-notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); }
.portal-result-noticeboard .portal-result-notice:first-of-type { border-top: 0; }
.portal-result-noticeboard .portal-result-notice > span { flex: none; padding: 4px 9px; border-radius: 8px; color: var(--accent); background: var(--brand-deep); font-size: 9.5px; font-weight: 850; letter-spacing: .08em; }
.portal-result-noticeboard .portal-result-notice h3 { margin: 0 0 3px; font-size: 14px; }
.portal-result-noticeboard .portal-result-notice p { margin: 0; font-size: 12.5px; line-height: 1.55; }
.portal-result-noticeboard .portal-result-notice small { color: var(--muted); font-size: 10.5px; }

/* Security verification card on the public admission form: same language as
   the sign-in screens - check-badge title, question box, answer, tools. */
.portal-form .login-captcha-card { display: grid; gap: 11px; padding: 15px 16px; border: 1px solid color-mix(in srgb, var(--brand) 23%, var(--line)); border-radius: 14px; background: linear-gradient(145deg, color-mix(in srgb, var(--brand-soft) 72%, #fff), #fff); box-shadow: inset 0 1px 0 rgba(255,255,255,.75); }
.portal-form .login-captcha-card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.portal-form .login-captcha-card > header > div:first-child { display: grid; gap: 2px; }
.portal-form .login-captcha-card > header strong { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 750; color: var(--brand-deep); }
.portal-form .login-captcha-card > header strong::before { content: "\2713"; display: grid; place-items: center; width: 19px; height: 19px; border-radius: 6px; color: #fff; background: var(--brand); font-size: 11px; font-weight: 900; flex: none; }
.portal-form .login-captcha-card > header small { color: var(--muted); font-size: 11px; font-weight: 500; }
.portal-form .login-captcha-tools { display: flex; gap: 6px; }
.portal-form .login-captcha-tools button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--brand); background: #fff; font-size: 14px; cursor: pointer; }
.portal-form .login-captcha-tools button:hover:not(:disabled), .portal-form .login-captcha-tools button:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.portal-form .login-captcha-tools button:disabled { cursor: wait; opacity: .58; }
.portal-form .login-captcha-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 10px; align-items: end; }
.portal-form .login-captcha-question { min-height: 48px; display: grid; place-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--brand-deep); background: #fff; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .05em; text-align: center; }
.portal-form .login-captcha-answer { display: grid; gap: 5px; font-size: 12px; font-weight: 700; }
.portal-form .login-captcha-answer input { min-height: 48px; font-size: 15px; font-weight: 700; background: #fff; }
.portal-form .login-captcha-help { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.45; }
@media (max-width: 560px) { .portal-form .login-captcha-grid { grid-template-columns: 1fr; } }

/* Notice board entries are bordered boxes with breathing room, not a ruled list. */
.portal-result-noticeboard { display: grid; gap: 12px; }
.portal-result-noticeboard > header { margin-bottom: 0; }
.portal-result-noticeboard .portal-result-notice { border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); border-radius: 12px; padding: 13px 15px; background: linear-gradient(145deg, color-mix(in srgb, var(--brand-soft) 55%, #fff), #fff); }
.portal-result-noticeboard .portal-result-notice:first-of-type { border-top: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line)); }

/* The teacher's own diary editor: one card per lesson the timetable gave them,
   in period order, each with the box the update is written into. */
.portal-diary-editor { display: grid; gap: 14px; }
.portal-diary-slot { display: grid; gap: 10px; }
.portal-diary-slot > header p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.portal-diary-field { display: grid; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--ink); }
.portal-diary-field textarea { width: 100%; min-height: 74px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 500; line-height: 1.6; resize: vertical; }
.portal-diary-field textarea:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent); }
.portal-diary-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 4px; }
.portal-diary-actions small { color: var(--muted); font-size: 11px; line-height: 1.5; }

/* The class teacher's own attendance register, marked from the portal. */
.portal-attendance-tools { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.portal-attendance-grid { display: grid; gap: 8px; }
.portal-attendance-head, .portal-attendance-row { display: grid; grid-template-columns: minmax(150px, 1.6fr) minmax(110px, .7fr) minmax(140px, 1.2fr); gap: 10px; align-items: center; }
.portal-attendance-head { padding: 0 12px; color: var(--muted); font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.portal-attendance-row { padding: 9px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.portal-attendance-row b { display: block; font-size: 12.5px; }
.portal-attendance-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 10.5px; }
.portal-attendance-row select, .portal-attendance-row input { min-height: 38px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-size: 12px; }
.portal-attendance-row select:focus, .portal-attendance-row input:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
@media (max-width: 620px) { .portal-attendance-head { display: none; } .portal-attendance-row { grid-template-columns: 1fr; } }

/* ==========================================================================
   The portal, laid out as the ERP workspace is.

   A parent or a member of staff signing in sees the same three parts in the
   same places as the school's own ERP: the sidebar with the views grouped and
   named, a top bar that says where they are and whose record it is, and one
   page at a time in the middle. The point is recognition — a family that has
   seen the ERP over the counter should not have to learn a second thing.
   ========================================================================== */
.portal-app { height: 100%; min-height: 0; display: grid; grid-template-columns: minmax(210px, 260px) minmax(0, 1fr); overflow: hidden; background: var(--surface-2); }

.portal-sidebar { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 16px; padding: 16px 12px; color: #fff; background: linear-gradient(168deg, var(--brand-deep), var(--brand)); }
.portal-sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 14px; border-bottom: 1px solid rgba(255,255,255,.16); }
.portal-sidebar-logo { width: 38px; height: 38px; flex: none; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.94); padding: 4px; }
.portal-sidebar-brand span { min-width: 0; display: grid; gap: 1px; }
.portal-sidebar-brand small { color: var(--accent); font-size: 9.5px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.portal-sidebar-brand strong { font-size: 12.5px; font-weight: 750; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.portal-sidebar-nav { min-height: 0; flex: 1; overflow-y: auto; display: grid; gap: 16px; align-content: start; }
.portal-sidebar-nav section { display: grid; gap: 3px; }
.portal-sidebar-nav h3 { margin: 0 0 3px; padding: 0 8px; color: rgba(255,255,255,.62); font-size: 9.5px; font-weight: 850; letter-spacing: .11em; text-transform: uppercase; }
.portal-sidebar-nav button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: 11px; color: rgba(255,255,255,.86); background: transparent; font: inherit; font-size: 12.5px; font-weight: 650; text-align: left; cursor: pointer; }
.portal-sidebar-nav button:hover { background: rgba(255,255,255,.1); color: #fff; }
.portal-sidebar-nav button.active { color: var(--brand-deep); background: #fff; font-weight: 800; box-shadow: 0 6px 18px rgba(0,0,0,.14); }
.portal-nav-icon { width: 19px; height: 19px; flex: none; display: grid; place-items: center; }
.portal-nav-icon svg { width: 19px; height: 19px; }

.portal-sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; background: rgba(255,255,255,.08); }
.portal-sidebar-user img, .portal-sidebar-user b { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; object-fit: cover; color: var(--brand-deep); background: var(--accent); font-size: 12px; font-weight: 850; }
.portal-sidebar-user span { min-width: 0; display: grid; gap: 1px; }
.portal-sidebar-user strong { font-size: 12px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-sidebar-user em { color: rgba(255,255,255,.7); font-size: 10px; font-style: normal; }
.portal-sidebar-signout { width: 30px; height: 30px; flex: none; margin-left: auto; border: 1px solid rgba(255,255,255,.25); border-radius: 9px; color: #fff; background: rgba(255,255,255,.1); font-size: 13px; cursor: pointer; }
.portal-sidebar-signout:hover { background: rgba(255,255,255,.2); }

.portal-main-shell { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.portal-topbar { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: #fff; }
.portal-breadcrumb { min-width: 0; display: grid; gap: 1px; }
.portal-breadcrumb span { color: var(--muted); font-size: 9.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.portal-breadcrumb strong { color: var(--ink); font-size: 14px; font-weight: 800; }
.portal-topbar-school { min-width: 0; display: flex; align-items: center; gap: 10px; margin-left: auto; padding: 6px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.portal-topbar-logo { width: 28px; height: 28px; flex: none; object-fit: contain; }
.portal-topbar-school div { min-width: 0; display: grid; gap: 1px; }
.portal-topbar-school strong { font-size: 12px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-topbar-school span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-topbar-actions { display: flex; align-items: center; gap: 9px; }
.portal-icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; color: var(--danger); background: color-mix(in srgb, var(--danger) 7%, #fff); font-size: 15px; cursor: pointer; }
.portal-icon-button:hover { color: #fff; background: var(--danger); }
/* The topbar ConnectX icon wears the same mark as the module and the ERP bell,
   and carries the same red count of what is waiting to be read. */
.portal-chat-bell { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; padding: 0; }
.portal-chat-bell:hover, .portal-chat-bell:focus-visible { border-color: var(--brand); background: var(--brand-soft); }
.portal-chat-bell.has-unread { border-color: color-mix(in srgb, var(--brand) 34%, var(--line)); background: var(--brand-soft); }
.portal-chat-bell-mark { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; display: block; }
.portal-chat-bell.has-unread .portal-chat-bell-mark { box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 45%, transparent); }
.portal-chat-bell-count { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; border-radius: 9px; color: #fff; background: var(--danger); font-size: 10px; font-weight: 800; line-height: 1; }
.portal-chat-bell-count[hidden] { display: none; }

.portal-page-wrap { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px; }
.portal-page-heading { display: grid; gap: 3px; margin-bottom: 16px; }
.portal-page-heading span { color: var(--muted); font-size: 9.5px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.portal-page-heading h1 { margin: 0; color: var(--ink); font-size: 25px; font-weight: 850; letter-spacing: -.01em; }
.portal-page-heading p { margin: 0; color: var(--muted); font-size: 12.5px; }

@media (max-width: 860px) {
  .portal-app { grid-template-columns: 1fr; }
  .portal-sidebar { flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; overflow-x: auto; }
  .portal-sidebar-brand { padding: 0 10px 0 0; border-bottom: 0; border-right: 1px solid rgba(255,255,255,.16); }
  .portal-sidebar-nav { flex: 0 0 auto; grid-auto-flow: column; gap: 10px; align-content: center; }
  .portal-sidebar-nav h3 { display: none; }
  .portal-sidebar-nav section { grid-auto-flow: column; gap: 6px; }
  .portal-sidebar-nav button { min-height: 34px; white-space: nowrap; }
  .portal-sidebar-user { flex: 0 0 auto; }
  .portal-topbar-school { display: none; }
}

/* A record a teacher has saved is closed to them: it says so, and reads as a
   record rather than as a form somebody forgot to finish. */
.portal-lock-pill { display: inline-block; padding: 3px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); color: var(--brand-deep); background: var(--brand-soft); font-size: 10px; font-weight: 800; letter-spacing: .02em; }
.portal-lock-note { display: block; margin: 8px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.portal-diary-slot.is-locked { border-color: color-mix(in srgb, var(--brand) 22%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 45%, #fff); }
.portal-diary-slot.is-locked > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.portal-attendance-grid.is-locked .portal-attendance-row { background: color-mix(in srgb, var(--brand-soft) 40%, #fff); }
.portal-attendance-status { font-size: 12px; font-weight: 750; color: var(--ink); }
.portal-attendance-remark { color: var(--muted); font-size: 11.5px; }

/* The signed-in portal fills the window the way the ERP workspace does.
   The centred, gutter-framed container is right for the sign-in page, which is
   a page; a workspace is not a page, and a band of background down each side
   of it only makes the screen smaller. */
.portal-shell.portal-authenticated .portal-workspace {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
.portal-shell.portal-authenticated .portal-app { border-radius: 0; }
.portal-shell.portal-authenticated .portal-product-mark { display: none; }
@media (min-width: 651px) {
  .portal-shell.portal-authenticated .portal-workspace { padding: 0; }
}
@media (max-width: 650px) {
  .portal-shell.portal-authenticated .portal-workspace { width: 100%; padding: 0; }
}

/* One view is a stack of cards, and cards need air between them: the metric
   row, the person card and each register were reading as one long block with
   hairlines through it. Applies to both portals, which share this view shell. */
.portal-page-wrap [data-portal-view] { display: grid; gap: 16px; align-content: start; }
.portal-page-wrap [data-portal-view] > .portal-page-heading { margin-bottom: 0; }
.portal-page-wrap [data-portal-view] > .portal-metrics { margin-bottom: 0; }

/* The conversation with the school office. */
.portal-chat-thread { display: grid; gap: 9px; max-height: 46vh; overflow-y: auto; padding: 4px 2px; }
.portal-chat-bubble { max-width: 78%; padding: 9px 12px; border-radius: 13px; border: 1px solid var(--line); background: #fff; }
.portal-chat-bubble p { margin: 0; font-size: 12.5px; line-height: 1.55; overflow-wrap: anywhere; }
.portal-chat-bubble small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 650; }
.portal-chat-bubble.is-school { justify-self: start; border-bottom-left-radius: 4px; }
.portal-chat-bubble.is-mine { justify-self: end; border-color: color-mix(in srgb, var(--brand) 26%, var(--line)); background: var(--brand-soft); border-bottom-right-radius: 4px; }
.portal-chat-file { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: inherit; text-decoration: none; }
.portal-chat-file.is-image { display: grid; gap: 6px; }
.portal-chat-file img { width: 100%; max-width: 220px; max-height: 165px; border-radius: 8px; object-fit: cover; }
.portal-chat-file b { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 8px; color: #fff; background: var(--brand); font-size: 9.5px; font-weight: 850; }
.portal-chat-file span { display: grid; gap: 1px; min-width: 0; font-size: 11.5px; font-weight: 700; overflow-wrap: anywhere; }
.portal-chat-file small { color: var(--muted); font-size: 10px; font-weight: 650; }
.portal-chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: end; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.portal-chat-text textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font: inherit; font-size: 12.5px; resize: vertical; }
.portal-chat-text textarea:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
.portal-chat-attach { position: relative; display: grid; place-items: center; min-height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; color: var(--brand); background: #fff; font-size: 11.5px; font-weight: 750; white-space: nowrap; cursor: pointer; }
.portal-chat-attach:hover { border-color: var(--brand); background: var(--brand-soft); }
.portal-chat-attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* JPRAXC ConnectX holds more than one conversation: the office, and either the
   class teacher or — for a class teacher — the families of their own section. */
.portal-chat-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.portal-chat-tab { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.portal-chat-tab:hover { border-color: var(--brand); background: var(--brand-soft); }
.portal-chat-tab.is-active { border-color: var(--brand); color: #fff; background: var(--brand); }
.portal-class-chat { display: grid; gap: 12px; }
.portal-class-chat-new { display: flex; flex-wrap: wrap; gap: 12px; }
.portal-class-chat-new label { display: grid; gap: 5px; min-width: 240px; flex: 1 1 240px; max-width: 420px; font-size: 11px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.portal-class-chat-new select { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 12.5px; }
.portal-class-chat-body { display: grid; grid-template-columns: minmax(190px, 250px) minmax(0, 1fr); gap: 14px; align-items: start; }
.portal-thread-column { max-height: calc(60px * 10 + 11px); overflow-y: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.portal-thread-list { margin: 0; padding: 0; list-style: none; }
.portal-thread-list li + li { border-top: 1px solid var(--line); }
.portal-thread { display: grid; gap: 4px; align-content: center; width: 100%; height: 60px; overflow: hidden; padding: 11px 13px; border: 0; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.portal-thread:hover { background: var(--brand-soft); }
.portal-thread.is-active { background: color-mix(in srgb, var(--brand) 12%, #fff); box-shadow: inset 3px 0 0 var(--brand); }
.portal-thread-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 750; color: var(--ink); line-height: 1.35; }
.portal-thread-unread { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; color: #fff; background: var(--brand); font-size: 10px; font-weight: 800; }
.portal-thread-when { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 10px; font-weight: 650; line-height: 1.3; white-space: nowrap; }
.portal-thread-when em { padding: 1px 6px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep); font-style: normal; font-weight: 750; }
.portal-thread-when i { margin-left: auto; font-style: normal; font-weight: 600; }
.portal-thread-conversation { display: grid; gap: 10px; align-content: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.portal-thread-head { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.portal-thread-head strong { display: block; font-size: 13px; color: var(--ink); }
.portal-thread-head small { color: var(--muted); font-size: 11px; font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 620px) { .portal-chat-form { grid-template-columns: 1fr; } .portal-chat-bubble { max-width: 92%; } }
@media (max-width: 780px) { .portal-class-chat-body { grid-template-columns: 1fr; } .portal-thread-column { max-height: 250px; } }

/* The same ConnectX mark the ERP shows, in the portal's own navigation. */
.portal-nav-mark { width: 21px; height: 21px; flex: none; border-radius: 6px; object-fit: cover; display: block; }
.portal-class-chat-new input[type="search"] { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 12.5px; }
.portal-class-chat-new input[type="search"]:focus, .portal-class-chat-new select:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
.portal-thread-side { display: grid; gap: 8px; align-content: start; }
.portal-thread-empty { margin: 0; color: var(--muted); font-size: 11.5px; }

/* The composer is one row: the box, the paperclip and Send, all the same height. */
.portal-chat-form { align-items: center; }
.portal-chat-text textarea { min-height: 44px; height: 44px; resize: none; padding: 12px 13px; line-height: 1.35; }
.portal-chat-attach { min-height: 44px; height: 44px; width: 44px; padding: 0; }
.portal-chat-attach svg { width: 19px; height: 19px; }
.portal-chat-form .portal-primary { min-height: 44px; height: 44px; }
@media (max-width: 620px) { .portal-chat-form { grid-template-columns: minmax(0,1fr) auto auto; } }

/* ── JPRAXC ConnectX, as a messenger ────────────────────────────────────────────
   A framed window: who you are talking to across the top, the conversation in
   the middle on its own ground, and one line to write on at the foot. */
.portal-chat { display: grid; gap: 12px; }
.chat-window { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; border: 1px solid var(--line); border-radius: 16px; background: #fff; overflow: hidden; box-shadow: 0 1px 2px rgba(17,12,13,.04); }
.chat-window-head { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, color-mix(in srgb, var(--brand-soft) 70%, #fff), #fff); }
.chat-window-head strong { display: block; font-size: 13px; font-weight: 750; color: var(--ink); line-height: 1.3; }
.chat-window-head small { display: block; color: var(--muted); font-size: 10.5px; font-weight: 650; }
.chat-avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; color: #fff; background: linear-gradient(145deg, var(--brand-deep), var(--brand)); font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.chat-window-body { min-height: 46vh; max-height: 58vh; overflow-y: auto; padding: 14px; background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--brand) 7%, transparent) 1px, transparent 0) 0 0 / 18px 18px,
  color-mix(in srgb, var(--canvas) 55%, #fff); }
.chat-window-body .portal-empty, .chat-window-body .empty-state { background: transparent; border: 0; }
.portal-chat-thread { display: grid; gap: 7px; max-height: none; overflow: visible; padding: 0; }
.chat-day { justify-self: center; margin: 6px 0; padding: 3px 12px; border-radius: 999px; background: color-mix(in srgb, var(--brand) 10%, #fff); color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .03em; }
.portal-chat-bubble { position: relative; max-width: 76%; padding: 8px 11px 6px; border-radius: 12px; border: 1px solid var(--line); background: #fff; box-shadow: 0 1px 1px rgba(17,12,13,.05); }
.portal-chat-bubble .chat-from { display: block; margin-bottom: 2px; color: var(--brand-deep); font-size: 10.5px; font-weight: 800; }
.portal-chat-bubble small { display: block; margin-top: 2px; text-align: right; color: var(--muted); font-size: 9.5px; font-weight: 650; }
.portal-chat-bubble.is-mine { background: color-mix(in srgb, var(--brand) 13%, #fff); border-color: color-mix(in srgb, var(--brand) 24%, var(--line)); }

/* The composer: a paperclip, a growing box, and Send — all on one line. */
.portal-chat-form { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; align-items: center; margin: 0; padding: 10px 12px; border-top: 1px solid var(--line); background: #fff; }
.portal-chat-attach { display: grid; place-items: center; width: 40px; height: 40px; min-height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--brand-deep); background: #fff; cursor: pointer; }
.portal-chat-attach svg { width: 18px; height: 18px; }
.portal-chat-text textarea { min-height: 40px; height: 40px; padding: 11px 14px; border-radius: 999px; resize: none; }
.portal-chat-form .portal-primary { min-height: 40px; height: 40px; padding: 0 20px; border-radius: 999px; }

/* The class teacher's list, as a messenger lists conversations. */
.portal-thread { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; height: 62px; }
.portal-thread .chat-avatar { width: 34px; height: 34px; font-size: 11px; }
.portal-thread-lines { display: grid; gap: 3px; min-width: 0; }
.portal-thread-name i { margin-left: auto; font-style: normal; font-weight: 600; color: var(--muted); font-size: 9.5px; }
.portal-thread-when { justify-content: space-between; }
.portal-thread-when em { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 0; background: none; color: var(--muted); font-style: normal; font-weight: 600; }
.portal-thread-column { max-height: calc(62px * 8 + 9px); }
.portal-thread-conversation { padding: 0; border: 0; background: none; }
@media (max-width: 620px) { .portal-chat-bubble { max-width: 90%; } .chat-window-body { min-height: 52vh; } }
/* The box is exactly the row's height: a label around a textarea otherwise
   keeps a line-box's descender under it and stands taller than Send. */
.portal-chat-text { display: grid; height: 40px; }
.portal-chat-text textarea { overflow-y: auto; scrollbar-width: none; }
.portal-chat-text textarea::-webkit-scrollbar { width: 0; height: 0; }
/* The paperclip sits next to Send, not out at the far edge: the two things you
   do with a written message are attach to it and send it. */
.portal-chat-form { grid-template-columns: minmax(0, 1fr) auto auto; }

/* A file opens over the conversation rather than in a tab of its own. */
.portal-attachment-dialog { width: min(880px, 94vw); max-height: 92vh; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: #fff; color: var(--ink); }
.portal-attachment-dialog::backdrop { background: rgba(17,12,13,.55); }
.portal-attachment-dialog header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.portal-attachment-dialog header div { flex: 1 1 auto; min-width: 0; }
.portal-attachment-dialog header strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.portal-attachment-dialog header small { color: var(--muted); font-size: 11px; font-weight: 650; }
.portal-attachment-x { width: 32px; height: 32px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--muted); font-size: 17px; line-height: 1; cursor: pointer; }
.portal-attachment-x:hover { border-color: var(--brand); color: var(--brand-deep); }
.portal-attachment-stage { display: grid; place-items: center; padding: 14px; background: color-mix(in srgb, var(--canvas) 60%, #fff); }
.portal-attachment-stage img { max-width: 100%; max-height: 66vh; border-radius: 10px; object-fit: contain; }
.portal-attachment-stage iframe { width: 100%; height: 66vh; border: 0; border-radius: 10px; background: #fff; }
.portal-attachment-dialog footer { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.portal-attachment-dialog footer .portal-primary { display: inline-grid; place-items: center; min-height: 38px; padding: 0 18px; border-radius: 999px; text-decoration: none; }
.portal-attachment-dialog footer .portal-secondary { min-height: 38px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.portal-attachment-dialog footer .portal-secondary:hover { border-color: var(--brand); background: var(--brand-soft); }
/* The line that goes with a file, written while looking at the file. */
.portal-attachment-caption { padding: 12px 16px 0; }
.portal-attachment-caption label { display: grid; gap: 6px; font-size: 11px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.portal-attachment-caption textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font: inherit; font-size: 12.5px; resize: vertical; }
.portal-attachment-caption textarea:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
.portal-attachment-dialog footer .portal-primary { border: 0; cursor: pointer; }

/* The conversation is one fixed card whatever it holds, and its messages sit on
   the floor of it and grow upwards, the way every messenger reads. */
.chat-window { height: 600px; }
.chat-window-body { display: grid; align-content: end; min-height: 0; max-height: none; }
.portal-class-chat .chat-window { height: 540px; }
@media (max-width: 620px) { .chat-window { height: 520px; } .portal-class-chat .chat-window { height: 480px; } }

/* The class teacher's ConnectX, laid out as the office's own is: one column of
   who and one of what was said, the same height, each scrolling inside itself. */
.portal-class-chat-body { display: grid; grid-template-columns: minmax(210px, 280px) minmax(0, 1fr); gap: 16px; align-items: stretch; height: 600px; }
.portal-thread-side { grid-template-rows: auto auto minmax(0, 1fr); gap: 9px; min-height: 0; }
.portal-thread-new, .portal-thread-search { display: grid; gap: 5px; }
.portal-thread-new span { font-size: 10.5px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.portal-thread-new select, .portal-thread-search input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; }
.portal-thread-new select:focus, .portal-thread-search input:focus { border-color: var(--brand); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 13%, transparent); }
.portal-thread-column { max-height: none; height: 100%; min-height: 0; }
.portal-thread-conversation { height: 100%; min-height: 0; }
.portal-class-chat .chat-window { height: 100%; }
@media (max-width: 780px) {
  .portal-class-chat-body { grid-template-columns: 1fr; height: auto; }
  .portal-thread-column { height: auto; max-height: 250px; }
  .portal-class-chat .chat-window { height: 480px; }
}
/* The conversation column is one row that fills it, so the card inside can be
   the column's own height rather than the height of what it happens to hold. */
.portal-class-chat .portal-thread-conversation { grid-template-rows: minmax(0, 1fr); align-content: stretch; gap: 0; }

/* The same: the floor is reached with an auto margin rather than by aligning the
   content to the end, so a long conversation still scrolls to its beginning. */
.chat-window-body { display: flex; flex-direction: column; align-content: normal; overflow-y: auto; }
.chat-window-body::before { content: ""; margin-top: auto; }
.chat-window-body > * { flex: 0 0 auto; }

/* JPRAXC ConnectX, headed by its own mark and its own name — as in the ERP. */
.portal-page-heading.connectx-brand { display: flex; align-items: center; gap: 13px; }
.portal-page-heading.connectx-brand .connectx-brand-mark { width: 44px; height: 44px; flex: none; border-radius: 12px; object-fit: cover; box-shadow: 0 2px 8px rgba(17,12,13,.14); }
.portal-page-heading.connectx-brand h1 { margin: 0; font-size: 23px; font-weight: 800; color: var(--brand-deep); line-height: 1.15; }
.portal-page-heading.connectx-brand h1 b { font-weight: 800; color: #e07b18; }
.portal-page-heading.connectx-brand p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }

/* A PDF states what it is rather than relying on a plugin to draw it. */
.portal-attachment-doc { display: flex; align-items: center; gap: 14px; width: 100%; max-width: 520px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.portal-attachment-doc b { display: grid; place-items: center; width: 52px; height: 64px; flex: none; border-radius: 8px; color: #fff; background: linear-gradient(160deg, #b4322c, #8d211c); font-size: 13px; font-weight: 850; letter-spacing: .06em; }
.portal-attachment-doc div { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.portal-attachment-doc strong { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.portal-attachment-doc small { color: var(--muted); font-size: 11.5px; font-weight: 650; }
.portal-attachment-doc .portal-secondary { min-height: 36px; padding: 0 14px; border-radius: 999px; font-size: 12px; }

/* The story panel names the portal a visitor has reached — Staff or Parent —
   in a bold pill under the board line, so the left side says plainly which
   sign-in this is. */
.portal-login-v3 .login-story .login-portal-kind {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
  padding: 7px 18px 7px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .30);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .02em;
}
.portal-login-v3 .login-story .login-portal-kind .login-portal-kind-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .94);
  object-fit: contain;
  padding: 2px;
  flex: none;
}
.portal-login-v3 .login-story .login-portal-kind .portal-school-monogram.login-portal-kind-mark {
  display: grid;
  place-items: center;
  color: var(--brand-deep);
  font: 900 13px/1 var(--font, inherit);
  padding: 0;
}
.portal-login-v3 .login-story .login-portal-kind > b {
  font-size: 21px;
  font-weight: 900;
  letter-spacing: .01em;
}
