/* ---------- Trainee portal ---------- */
:root {
  --navy: #0a2540;
  --navy-deep: #071b30;
  --navy-soft: #123a5c;
  --gold: #fbbf24;
  --gold-deep: #b27a06;
  --paper: #ffffff;
  --canvas: #f4f7fb;
  --ink: #172033;
  --muted: #64748b;
  --line: #dde5ef;
  --ok: #0f7a4d;
  --warn: #a16207;
  --danger: #b91c1c;
  --shadow: 0 18px 50px -28px rgba(10, 37, 64, 0.35);
  --radius: 16px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body.portal-body,
body.portal-auth-body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Montserrat", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: #1d4ed8; }

h1, h2, h3, p, ul, dl, dd { margin-top: 0; }

.portal-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Top navigation */
.portal-topbar {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-deep) 100%);
  color: #e2e8f0;
  padding: 14px clamp(16px, 4vw, 40px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 10px 30px -18px rgba(0, 0, 0, 0.65);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  min-width: 230px;
}

.portal-brand__mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--navy-deep);
  font-weight: 800;
  letter-spacing: 0.05em;
  flex: 0 0 auto;
}

.portal-brand__mark.has-logo { background: transparent; }

.portal-brand__mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.portal-brand__text,
.portal-auth__brand span:last-child {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.portal-brand__text strong,
.portal-auth__brand strong { font-size: 14px; }

.portal-brand__text small,
.portal-auth__brand small {
  font-size: 10.5px;
  color: #b9c7d8;
  letter-spacing: 0.04em;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 420px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 3px;
}

.portal-nav::-webkit-scrollbar { display: none; }

.portal-nav__link {
  color: #d7e2ef;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.portal-nav__link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.portal-nav__link.is-active {
  background: rgba(251, 191, 36, 0.16);
  color: var(--gold);
}

.portal-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.portal-user__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.portal-user__meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.portal-user__meta strong { color: #fff; font-size: 12.5px; }
.portal-user__meta small { color: #b9c7d8; font-size: 10.5px; }

.portal-signout {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  color: #fff;
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.portal-signout:hover { background: rgba(255, 255, 255, 0.12); }

/* Main */
.portal-main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 32px) clamp(14px, 4vw, 32px) 50px;
  flex: 1;
}

.portal-hero {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy-soft) 62%, #1b4f78 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(20px, 4vw, 34px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.portal-hero::after {
  content: "";
  position: absolute;
  right: -70px;
  top: -80px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.25), transparent 65%);
}

.portal-hero h1 {
  font-size: clamp(26px, 4.5vw, 38px);
  line-height: 1.12;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.portal-hero__sub { margin: 0; color: #cbd9e8; font-size: 13px; }

.portal-kicker {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.portal-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.portal-page-head h1 {
  font-size: clamp(23px, 3.6vw, 32px);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.portal-page-head p { margin-bottom: 0; color: var(--muted); font-size: 12.5px; }

/* Cards and grids */
.portal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.portal-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2.4vw, 22px);
  box-shadow: 0 6px 22px -18px rgba(10, 37, 64, 0.28);
  margin-top: 16px;
  min-width: 0;
}

.portal-grid-2 .portal-card { margin-top: 0; }

.portal-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.portal-card__head h2 {
  margin: 0;
  font-size: 14.5px;
  letter-spacing: 0.01em;
}

.portal-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.portal-stat-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.portal-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 6px 22px -20px rgba(10, 37, 64, 0.35);
  transition: transform 0.15s ease, border-color 0.15s ease;
  min-width: 0;
}

a.portal-stat:hover { transform: translateY(-2px); border-color: #fcd34d; }

.portal-stat__label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.portal-stat__value {
  font-size: clamp(20px, 3vw, 27px);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--navy);
  line-height: 1.2;
}

.portal-stat__value--text { font-size: 16px; }

.portal-stat__hint { font-size: 11px; color: var(--muted); }

.is-due { color: var(--danger) !important; }
.is-ok { color: var(--ok) !important; }

/* Tables */
.portal-table-wrap { overflow-x: auto; }

.portal-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.portal-table th {
  text-align: left;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.portal-table td {
  padding: 10px;
  border-bottom: 1px solid #eef3f9;
  vertical-align: top;
  font-size: 12.5px;
}

.portal-table tbody tr:last-child td { border-bottom: 0; }

.portal-table--compact td,
.portal-table--compact th { padding: 7px 8px; font-size: 11.5px; }

.portal-table tfoot th {
  border-top: 2px solid var(--line);
  border-bottom: 0;
  color: var(--ink);
  font-size: 12px;
}

.portal-subline {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 500;
}

.portal-meta { display: block; font-size: 11px; color: var(--muted); }

.portal-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #eef2f7;
  color: var(--muted);
  white-space: nowrap;
}

.portal-pill.is-ok { background: #e7f8ef; color: var(--ok); }
.portal-pill.is-warn { background: #fff7e6; color: var(--warn); }
.portal-pill.is-info { background: #e8f0fe; color: #1d4ed8; }
.portal-pill.is-muted { background: #eef2f7; color: var(--muted); }
.portal-pill.is-danger { background: #fdecec; color: var(--danger); }

.portal-link {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
  font-size: 12px;
}

.portal-link:hover { text-decoration: underline; }

.portal-help { color: var(--muted); font-size: 11.5px; margin-bottom: 0; }
.portal-help--center { text-align: center; margin-top: 14px; }
.portal-error { color: var(--danger); font-size: 11.5px; }
.portal-card--notice { border-left: 4px solid var(--gold); }

.portal-note {
  background: #f8fafc;
  border-left: 3px solid var(--gold);
  padding: 9px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 12px;
  margin: 12px 0 0;
}

.portal-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 12px 0;
  list-style: none;
}

.portal-subline + .portal-empty { padding-top: 4px; }

/* Fee summary */
.portal-fee-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.portal-fee-summary > div {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
}

.portal-fee-summary span {
  display: block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.portal-fee-summary strong { font-size: 14px; color: var(--navy); }

.portal-progress {
  height: 8px;
  border-radius: 999px;
  background: #e8eef6;
  overflow: hidden;
  margin-bottom: 8px;
}

.portal-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a34a, #65a30d);
}

/* Lists */
.portal-list,
.portal-schedule,
.portal-message-list { list-style: none; margin: 0; padding: 0; }

.portal-list > li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #eef3f9;
}

.portal-list > li:last-child { border-bottom: 0; }
.portal-list strong { font-size: 12.5px; }

.portal-result { text-align: right; }
.portal-result strong { display: block; font-size: 16px; color: var(--navy); }
.portal-result span { font-size: 10.5px; color: var(--muted); }

.portal-schedule > li {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #eef3f9;
}

.portal-schedule > li:last-child { border-bottom: 0; }

.portal-schedule__time {
  flex: 0 0 88px;
  font-size: 11px;
  font-weight: 800;
  color: var(--navy-soft);
}

.portal-schedule__body { display: flex; flex-direction: column; gap: 1px; }
.portal-schedule__body strong { font-size: 12px; }
.portal-schedule__body > span { font-size: 12px; }

/* Weekly timetable */
.portal-week {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.portal-day {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdff;
  min-width: 0;
}

.portal-day.is-today { border-color: #fcd34d; background: #fffdf5; }

.portal-day header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
}

.portal-day h3 { margin: 0; font-size: 11.5px; }

.portal-day ul { list-style: none; margin: 0; padding: 0; }

.portal-day li {
  padding: 7px 0;
  border-bottom: 1px dashed #e6edf7;
}

.portal-day li:last-child { border-bottom: 0; }
.portal-day__time { display: block; font-size: 9.5px; font-weight: 800; color: var(--gold-deep); }
.portal-day__body { display: flex; flex-direction: column; gap: 1px; }
.portal-day__body strong { font-size: 11px; }
.portal-day__body > span { font-size: 10.5px; }

/* Details */
.portal-detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
}

.portal-detail > div { min-width: 0; }

.portal-detail dt {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.portal-detail dd { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }

.portal-detail--inline {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Competency */
.portal-competency-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.portal-competency {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #fbfdff;
  min-width: 0;
}

.portal-competency header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.portal-competency h3 { font-size: 13px; margin: 0 0 6px; }

/* Messages */
.portal-message-list > li { border-bottom: 1px solid #eef3f9; }
.portal-message-list > li:last-child { border-bottom: 0; }

.portal-message-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
}

.portal-message-list a:hover strong { color: #1d4ed8; }

.portal-message-list__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.portal-message-list__main strong { font-size: 13px; }
.portal-message-list__main span { font-size: 11.5px; color: var(--muted); }

.portal-message-list__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.portal-message-body {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.7;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #eef3f9;
}

/* Forms */
.portal-form { display: flex; flex-direction: column; gap: 12px; }
.portal-form--narrow { max-width: 420px; }

.portal-field { display: flex; flex-direction: column; gap: 5px; }

.portal-field label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.portal-input {
  width: 100%;
  border: 1px solid #cfdae8;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}

.portal-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid #cfdae8;
  background: #fff;
  color: var(--navy);
  border-radius: 999px;
  padding: 9px 16px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.portal-btn--primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.portal-btn--primary:hover { background: var(--navy-soft); }
.portal-btn--wide { width: 100%; padding: 11px 16px; }

/* Flash */
.portal-flash {
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 12.5px;
  font-weight: 600;
  margin: 14px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.portal-flash:first-child { margin-top: 0; }
.portal-flash--success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.portal-flash--error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* Pagination */
.portal-pagination { margin-top: 14px; font-size: 12px; }
.portal-pagination nav { display: flex; gap: 6px; flex-wrap: wrap; }
.portal-pagination a,
.portal-pagination span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 9px;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
}
.portal-pagination .active span { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Footer */
.portal-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  padding: 18px clamp(16px, 4vw, 40px);
  text-align: center;
}
.portal-footer p { margin: 0; }

/* Auth / sign in */
body.portal-auth-body {
  background:
    radial-gradient(circle at 15% 20%, rgba(251, 191, 36, 0.16), transparent 30%),
    linear-gradient(130deg, var(--navy-deep) 0%, var(--navy) 58%, #174a72 100%);
  min-height: 100vh;
}

.portal-auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  gap: clamp(24px, 5vw, 70px);
  align-items: center;
  padding: clamp(24px, 6vw, 70px);
  max-width: 1250px;
  margin: 0 auto;
}

.portal-auth__intro { color: #fff; max-width: 560px; }

.portal-auth__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  margin-bottom: clamp(26px, 5vw, 54px);
}

.portal-auth__intro h1 {
  font-size: clamp(30px, 5vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.portal-auth__intro > p {
  color: #c6d5e5;
  font-size: clamp(13px, 1.6vw, 15px);
  max-width: 46ch;
  margin-bottom: 22px;
}

.portal-auth__points {
  list-style: none;
  padding: 0;
  margin: 0 0 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portal-auth__points li {
  position: relative;
  padding-left: 24px;
  color: #dce7f2;
  font-size: 12.5px;
}

.portal-auth__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 12px;
  height: 7px;
  border-left: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  transform: rotate(-45deg);
}

.portal-auth__back {
  color: #cbd9e8;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.portal-auth__back:hover { color: var(--gold); }

.portal-auth__panel { display: flex; justify-content: flex-end; }

.portal-auth__stack {
  width: 100%;
  max-width: 430px;
  display: grid;
  gap: 14px;
}

.portal-auth__card {
  width: 100%;
  max-width: none;
  background: #fff;
  border-radius: 20px;
  padding: clamp(22px, 4vw, 34px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.55);
}

.portal-auth__kicker {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.portal-auth__card h2 {
  font-size: 24px;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.portal-auth__card > .portal-help { margin-bottom: 18px; }

/* Demo trainee accounts on the sign-in screen */
.portal-auth__demo {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  padding: 15px 16px;
  color: #eef4fb;
  backdrop-filter: blur(6px);
}

.portal-auth__demo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.portal-auth__demo-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #fff;
}

.portal-auth__demo-head p {
  margin: 3px 0 0;
  font-size: 11px;
  color: #b9cbdd;
}

.portal-auth__demo-badge {
  flex: none;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.16);
  color: var(--gold);
  padding: 3px 8px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.portal-auth__demo-list {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.portal-auth__demo-card {
  display: grid;
  gap: 1px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 11px;
  color: #fff;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.portal-auth__demo-card:hover,
.portal-auth__demo-card:focus-visible {
  border-color: rgba(251, 191, 36, 0.65);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.portal-auth__demo-card.is-selected {
  border-color: var(--gold);
  background: rgba(251, 191, 36, 0.16);
}

.portal-auth__demo-name {
  font-size: 12px;
  font-weight: 700;
}

.portal-auth__demo-role {
  font-size: 10.5px;
  color: #b9cbdd;
}

.portal-auth__demo-admission {
  margin-top: 2px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--gold);
}

.portal-auth__demo-note {
  margin: 11px 0 0;
  font-size: 10px;
  line-height: 1.45;
  color: #9fb4c9;
}

.portal-auth__demo-note code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9.5px;
  color: #d7e3ee;
}

/* Responsive */
@media (max-width: 1000px) {
  .portal-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .portal-competency-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .portal-topbar {
    position: static;
    padding: 14px 16px;
    gap: 10px;
  }

  .portal-brand { min-width: 0; flex: 1 1 auto; }
  .portal-brand__text small { display: none; }

  .portal-user { order: 2; margin-left: 0; }
  .portal-user__meta { display: none; }

  .portal-nav {
    order: 3;
    flex: 1 1 100%;
    padding-bottom: 2px;
  }

  .portal-grid-2 { grid-template-columns: 1fr; }
  .portal-detail--inline { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .portal-auth {
    grid-template-columns: 1fr;
    padding: 20px 16px 34px;
  }

  .portal-auth__intro { max-width: none; }
  .portal-auth__intro h1 { font-size: clamp(28px, 8vw, 38px); }
  .portal-auth__brand { margin-bottom: 22px; }
  .portal-auth__points { display: none; }
  .portal-auth__panel { justify-content: stretch; }
  .portal-auth__stack { max-width: none; }
  .portal-auth__card { max-width: none; }
}

@media (max-width: 620px) {
  .portal-main { padding: 14px 12px 36px; }
  .portal-hero { flex-direction: column; padding: 18px; }
  .portal-stat-grid,
  .portal-stat-grid--three { grid-template-columns: 1fr 1fr; gap: 8px; }
  .portal-stat { padding: 11px 12px; }
  .portal-stat__value { font-size: 20px; }
  .portal-fee-summary { grid-template-columns: 1fr; }
  .portal-week { grid-template-columns: 1fr; }
  .portal-detail { grid-template-columns: 1fr; }
  .portal-page-head { flex-direction: column; }
  .portal-card__head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .portal-message-list a { flex-direction: column; align-items: flex-start; gap: 6px; }
  .portal-message-list__meta { align-items: flex-start; flex-direction: row; align-items: center; }
}

/* ---------- Notice ticker ---------- */
.notice-ticker {
  display: flex;
  align-items: stretch;
  background: var(--navy);
  color: #e8eef6;
  font-size: 12.5px;
  line-height: 1.4;
  overflow: hidden;
}
.notice-ticker__label {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--gold);
  color: var(--navy-deep);
  font-weight: 800;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.notice-ticker__label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--navy-deep);
  animation: portal-notice-pulse 1.8s ease-in-out infinite;
}
.notice-ticker__viewport {
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.notice-ticker__track {
  display: flex;
  width: max-content;
  animation: portal-notice-scroll 44s linear infinite;
}
.notice-ticker__viewport:hover .notice-ticker__track,
.notice-ticker:focus-within .notice-ticker__track { animation-play-state: paused; }
.notice-ticker__list {
  display: flex;
  align-items: center;
  gap: 34px;
  margin: 0;
  padding: 8px 17px 8px 0;
  list-style: none;
  white-space: nowrap;
}
.notice-ticker__item { color: #cfdcea; }
.notice-ticker__item a { color: #fff; text-decoration: none; font-weight: 700; }
.notice-ticker__item a:hover { text-decoration: underline; }
.notice-ticker__type {
  display: inline-block;
  margin-right: 5px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.notice-ticker__body { color: #9fb2c6; }
@keyframes portal-notice-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@keyframes portal-notice-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .notice-ticker__track { animation: none; overflow-x: auto; }
  .notice-ticker__label::before { animation: none; }
}
@media (max-width: 620px) {
  .notice-ticker__label { padding: 7px 9px; font-size: 9px; }
  .notice-ticker__list { gap: 24px; padding: 7px 12px 7px 0; }
}

/* ---------- Login notices popup ---------- */
.login-notice[hidden] { display: none; }
body.has-login-notice { overflow: hidden; }
.login-notice {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.login-notice__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 15, 28, 0.66);
}
.login-notice__dialog {
  position: relative;
  width: min(500px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 26px 24px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(4, 15, 28, 0.35);
}
.login-notice__close {
  position: absolute;
  top: 9px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 25px;
  line-height: 1;
  cursor: pointer;
}
.login-notice__kicker {
  margin: 0 0 4px;
  color: var(--gold-deep);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.login-notice__dialog h2 { margin: 0 0 14px; font-size: 20px; color: var(--navy); }
.login-notice__list { margin: 0 0 18px; padding: 0; list-style: none; display: grid; gap: 13px; }
.login-notice__list li { display: grid; grid-template-columns: auto 1fr; gap: 9px; }
.login-notice__list strong { display: block; color: var(--navy); }
.login-notice__list p { margin: 2px 0 4px; color: var(--muted); font-size: 12.5px; }
.login-notice__list a { font-weight: 700; font-size: 12.5px; }
.login-notice__type {
  align-self: start;
  padding: 2px 6px;
  border-radius: 4px;
  background: #eef3f9;
  color: #34506d;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.login-notice__dismiss {
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Survey options ---------- */
.portal-survey-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.portal-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-size: 12.5px;
}
.portal-check input { accent-color: var(--navy); }
.portal-check:has(input:checked) {
  border-color: var(--navy);
  background: #eef4fb;
  font-weight: 700;
}

/* Print housekeeping */
.print-brand { display: none; }
@media print {
  body.portal-body { background: #fff; }
  .print-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #1f2937;
  }
  .print-brand img { max-width: 160px; max-height: 60px; object-fit: contain; }
  .print-brand__text strong { display: block; font-size: 16px; color: #111827; }
  .print-brand__text span { display: block; font-size: 10px; color: #4b5563; }
  .portal-topbar, .portal-nav, .portal-user, .portal-footer, .portal-flash { display: none !important; }
  .portal-main { padding: 0 !important; }
  .portal-shell { display: block !important; }
}

/* ---------- Portal downloads ---------- */
.portal-download-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.portal-download-filters .portal-input {
  width: auto;
  min-width: 150px;
  padding: 8px 11px;
  font-size: 12px;
}
.portal-download-filters .portal-btn {
  padding: 8px 14px;
}
.portal-download-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.portal-download {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.portal-download__type {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #eef4fc;
  color: var(--navy);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
}
.portal-download__main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 3px;
}
.portal-download__main strong {
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--navy-deep);
}
.portal-download__desc {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.portal-download__actions {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.portal-download__preview {
  background: #eef4fc;
  border-color: #d8e5f6;
  color: var(--navy);
}
.portal-download__preview:hover {
  background: #dce8f8;
}
.portal-download .portal-btn {
  padding: 7px 12px;
  font-size: 11.5px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .portal-download {
    flex-wrap: wrap;
  }
  .portal-download__main {
    flex-basis: calc(100% - 66px);
  }
  .portal-download__actions {
    width: 100%;
    justify-content: flex-end;
  }
  .portal-download-filters {
    width: 100%;
  }
  .portal-download-filters .portal-input {
    flex: 1 1 100%;
    width: 100%;
  }
}
