/* Poppins font — bundled locally for wp.org compliance (no external CDN) */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/poppins-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/poppins-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/poppins-700.woff2') format('woff2');
}

/* ============================================
   ScholaBook Parent Portal — CSS
   Scoped under .sb-portal
   ============================================ */

/* --- Variables --- */
.sb-portal {
  --sb-primary: #3699ff;
  --sb-success: #1bc5bd;
  --sb-danger: #f64e60;
  --sb-warning: #ffa800;
  --sb-purple: #8950fc;
  --sb-text: #1e1e2d;
  --sb-muted: #7e8299;
  --sb-border: #ebedf3;
  --sb-bg: #f3f6f9;
  --sb-white: #fff;
  --sb-radius: 16px;
  --sb-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* --- Base --- */
.sb-portal *,
.sb-portal *::before,
.sb-portal *::after {
  box-sizing: border-box;
}

.sb-portal {
  font-family: 'Poppins', sans-serif;
  color: var(--sb-text);
  max-width: 520px;
  margin: 0 auto;
  padding: 0;
  background: var(--sb-bg);
  padding-bottom: 70px;
  -webkit-font-smoothing: antialiased;
}

.sb-portal a {
  text-decoration: none;
}

#sb-portal-root .sb-portal {
  width: 100%;
}

/* --- Page Header --- */
.sb-page-header {
  min-height: 140px;
  padding: 22px 24px 56px;
  color: #fff;
  display: flex;
  align-items: flex-end;
  position: relative;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

.sb-page-header--dashboard { background: linear-gradient(135deg, #667eea, #764ba2); }
.sb-page-header--attendance { background: linear-gradient(135deg, #3699ff, #0073e6); }
.sb-page-header--fees { background: linear-gradient(135deg, #8950fc, #7337ee); }
.sb-page-header--leave { background: linear-gradient(135deg, #f64e60, #d9214e); }
.sb-page-header--profile { background: linear-gradient(135deg, #1bc5bd, #0bb7af); }
.sb-page-header--holidays { background: linear-gradient(135deg, #ffa800, #e69500); }
.sb-page-header--notices { background: linear-gradient(135deg, #1bc5bd, #0bb7af); }

.sb-page-header__inner {
  width: 100%;
}

.sb-page-header__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 2px;
}

.sb-page-header__subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
}

.sb-page-header__back {
  position: absolute;
  top: 16px;
  left: 12px;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
}

/* --- Page Content --- */
.sb-page-content {
  background: var(--sb-white);
  border-radius: 24px 24px 0 0;
  margin-top: -28px;
  position: relative;
  z-index: 1;
  padding: 20px;
  min-height: 300px;
}

/* --- Cards --- */
.sb-card {
  background: var(--sb-white);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid #f1f3f7;
}

.sb-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--sb-muted);
  margin: 0 0 12px;
}

/* --- Stat Cards --- */
.sb-stat-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--sb-white);
  box-shadow: var(--sb-shadow);
  margin-bottom: 12px;
}

.sb-stat-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-stat-card__value {
  font-size: 20px;
  font-weight: 700;
}

.sb-stat-card__label {
  font-size: 12px;
  color: var(--sb-muted);
}

.sb-stat-card--primary .sb-stat-card__icon { background: rgba(54, 153, 255, 0.12); color: var(--sb-primary); }
.sb-stat-card--primary .sb-stat-card__value { color: var(--sb-primary); }

.sb-stat-card--success .sb-stat-card__icon { background: rgba(27, 197, 189, 0.12); color: var(--sb-success); }
.sb-stat-card--success .sb-stat-card__value { color: var(--sb-success); }

.sb-stat-card--danger .sb-stat-card__icon { background: rgba(246, 78, 96, 0.12); color: var(--sb-danger); }
.sb-stat-card--danger .sb-stat-card__value { color: var(--sb-danger); }

.sb-stat-card--warning .sb-stat-card__icon { background: rgba(255, 168, 0, 0.12); color: var(--sb-warning); }
.sb-stat-card--warning .sb-stat-card__value { color: var(--sb-warning); }

.sb-stat-card--purple .sb-stat-card__icon { background: rgba(137, 80, 252, 0.12); color: var(--sb-purple); }
.sb-stat-card--purple .sb-stat-card__value { color: var(--sb-purple); }

/* --- Stat Row --- */
.sb-stat-row {
  display: flex;
  gap: 8px;
}

.sb-stat-item {
  flex: 1;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.sb-stat-item__value {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.sb-stat-item__label {
  font-size: 11px;
  color: var(--sb-muted);
  line-height: 1.3;
  margin-top: 2px;
}

/* --- Quick Actions --- */
.sb-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.sb-quick-actions__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none !important;
  color: var(--sb-text);
  gap: 6px;
}

.sb-quick-actions__icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-portal .sb-quick-actions__icon--blue { background: rgba(54,153,255,0.12) !important; color: #3699ff !important; }
.sb-portal .sb-quick-actions__icon--purple { background: rgba(137,80,252,0.12) !important; color: #8950fc !important; }
.sb-portal .sb-quick-actions__icon--red { background: rgba(246,78,96,0.12) !important; color: #f64e60 !important; }
.sb-portal .sb-quick-actions__icon--teal { background: rgba(27,197,189,0.12) !important; color: #1bc5bd !important; }
.sb-portal .sb-quick-actions__icon--warning { background: rgba(255,168,0,0.12) !important; color: #ffa800 !important; }
.sb-portal .sb-quick-actions__icon svg { stroke: currentColor !important; color: inherit !important; }

.sb-quick-actions__label {
  font-size: 11px;
  font-weight: 500;
  text-align: center;
}

/* --- Alert Banner (flex for icon+text) --- */
.sb-alert-banner {
  padding: 12px 16px;
  border-radius: 12px;
  color: #fff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
}

.sb-alert-banner--danger {
  background: linear-gradient(135deg, #f64e60, #d9214e);
}

/* --- Bottom Nav --- */
.sb-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sb-white);
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--sb-border);
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

.sb-bottom-nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--sb-muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  padding: 4px;
}

.sb-bottom-nav__item.is-active,
.sb-bottom-nav__item--active {
  color: var(--sb-primary);
}

/* --- Desktop Tabs --- */
.sb-portal-tabs {
  display: none;
}

/* --- Menu Overlay --- */
.sb-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.sb-menu-overlay__content {
  background: var(--sb-white);
  width: 100%;
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 80vh;
  overflow-y: auto;
}

.sb-menu-overlay__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sb-menu-overlay__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.sb-menu-overlay__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 20px;
  color: var(--sb-muted);
}

.sb-menu-overlay__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.sb-menu-overlay__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--sb-text);
}

.sb-menu-overlay__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sb-menu-overlay__label {
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

/* --- Calendar --- */
.sb-calendar__header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}

.sb-calendar__day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--sb-muted);
  padding: 4px 0;
}

.sb-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.sb-calendar__cell {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  background: var(--sb-bg);
}

.sb-calendar__cell--present  { background: #d4edda; color: #155724; }
.sb-calendar__cell--absent   { background: #f8d7da; color: #721c24; }
.sb-calendar__cell--late     { background: #fff3cd; color: #856404; }
.sb-calendar__cell--halfday  { background: #fff3cd; color: #856404; }
.sb-calendar__cell--holiday  { background: #e8daff; color: #8950fc; }
.sb-calendar__cell--weekend  { background: #ebedf3; color: #7e8299; }
.sb-calendar__cell--leave    { background: #cce5ff; color: #004085; }
.sb-calendar__cell--blank    { background: transparent; }
.sb-calendar__cell--unmarked { background: var(--sb-bg); }

/* --- Progress Ring --- */
.sb-progress-ring {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: conic-gradient(
    var(--ring-color, var(--sb-primary)) calc(var(--ring-percent) * 1%),
    var(--sb-border) 0
  );
}

.sb-progress-ring::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--sb-white);
}

.sb-progress-ring__value {
  position: relative;
  z-index: 1;
  font-size: 18px;
  font-weight: 700;
}

.sb-progress-ring__label {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--sb-muted);
  margin-top: 4px;
}

/* --- Badges --- */
.sb-badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
}

.sb-badge--success { background: #d4edda; color: #155724; }
.sb-badge--danger  { background: #f8d7da; color: #721c24; }
.sb-badge--warning { background: #fff3cd; color: #856404; }
.sb-badge--muted   { background: #ebedf3; color: #7e8299; }
.sb-badge--primary { background: #cce5ff; color: #004085; }
.sb-badge--purple  { background: #e8daff; color: #8950fc; }

/* --- Login --- */
.sb-portal-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 32px 16px;
}

.sb-portal-login__card {
  background: var(--sb-white);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  padding: 28px 22px;
  max-width: 380px;
  width: 100%;
}

.sb-portal-login__header {
  text-align: center;
  margin-bottom: 16px;
}

.sb-portal-login__icon {
  width: 56px;
  height: 56px;
  background: rgba(54, 153, 255, 0.12);
  color: var(--sb-primary);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 24px;
}

.sb-portal-login__title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

.sb-portal-login__subtitle {
  font-size: 13px;
  color: var(--sb-muted);
  margin: 0;
}

.sb-portal-login__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sb-portal-login__label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  margin-bottom: -8px;
}

.sb-portal-login__input {
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.sb-portal-login__input:focus {
  border-color: var(--sb-primary);
  box-shadow: 0 0 0 3px rgba(54, 153, 255, 0.12);
}

.sb-portal-login__btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  color: #fff;
  background: var(--sb-primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.sb-portal-login__btn:hover {
  background: #2684e6;
}

.sb-portal-login__btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.sb-portal-login__link {
  background: none;
  border: none;
  color: var(--sb-primary);
  text-decoration: underline;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
}

.sb-portal-login__resend {
  text-align: center;
  font-size: 12px;
  color: var(--sb-muted);
}

/* Login method tabs */
.sb-login-tabs {
  display: flex;
  gap: 0;
  margin: 0 0 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
}

.sb-login-tabs__btn {
  flex: 1;
  padding: 10px 12px;
  border: none !important;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
  line-height: 1.3;
}

.sb-login-tabs__btn--active {
  background: #fff;
  color: #3699ff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 600;
}

.sb-login-tabs__btn:hover:not(.sb-login-tabs__btn--active) {
  color: #475569;
}

/* Password field wrapper with toggle */
.sb-portal-login__pwd-wrap {
  position: relative;
}

.sb-portal-login__pwd-wrap .sb-portal-login__input {
  padding-right: 42px;
}

.sb-portal-login__pwd-toggle {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  border: none !important;
  background: transparent;
  padding: 8px;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.sb-portal-login__pwd-toggle:hover { color: #475569; }

.sb-portal-login__hint {
  text-align: center;
  font-size: 12px;
  color: var(--sb-muted);
  margin-top: 2px;
  line-height: 1.6;
}

/* --- Portal Header (Premium) --- */
.sb-header {
  background: linear-gradient(135deg, #1a1f3c 0%, #2d3561 50%, #1a1f3c 100%);
  position: relative;
  z-index: 100;
}

.sb-header::before {
  content: '';
  position: absolute;
  top: -60%;
  right: -20%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(54,153,255,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.sb-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  position: relative;
  z-index: 1;
  gap: 12px;
}

.sb-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sb-header__avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3699ff, #8950fc);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(54,153,255,0.3);
}

.sb-header__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sb-header__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sb-header__name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.sb-header__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  line-height: 1;
  color: rgba(255,255,255,0.45);
}

.sb-header__class {
  font-weight: 500;
  color: rgba(255,255,255,0.65);
}

.sb-header__class::after {
  content: '\00B7';
  margin-left: 6px;
  color: rgba(255,255,255,0.3);
}

.sb-header__school {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Compact student switcher trigger */
.sb-switcher {
  position: relative;
}

.sb-switcher__trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sb-switcher__trigger:hover,
.sb-switcher__trigger[aria-expanded="true"] {
  color: #fff;
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.2);
}

/* Dropdown panel */
.sb-switcher__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--sb-white);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.08);
  z-index: 500;
  padding: 6px;
  animation: sb-dropdown-in 0.15s ease-out;
}

@keyframes sb-dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sb-switcher__header {
  padding: 10px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sb-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sb-switcher__option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  text-align: left;
  font-family: 'Poppins', sans-serif;
  transition: background 0.15s ease;
}

.sb-switcher__option:hover {
  background: var(--sb-bg);
}

.sb-switcher__option--active {
  background: rgba(54,153,255,0.06);
}

.sb-switcher__option--active:hover {
  background: rgba(54,153,255,0.1);
}

.sb-switcher__avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3699ff, #8950fc);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}

.sb-switcher__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sb-switcher__details {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sb-switcher__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-switcher__class {
  font-size: 11px;
  color: var(--sb-muted);
}

.sb-switcher__check {
  color: var(--sb-primary);
  flex-shrink: 0;
}

.sb-header__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sb-header__logout:hover {
  color: #f64e60;
  background: rgba(246,78,96,0.12);
  border-color: rgba(246,78,96,0.25);
}

/* --- Forms --- */
.sb-form-group {
  margin-bottom: 16px;
}

.sb-form-group__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.sb-form-group__input,
.sb-form-group__select,
.sb-form-group__textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  outline: none;
  transition: border-color 0.2s;
}

.sb-form-group__textarea {
  min-height: 80px;
  resize: vertical;
}

.sb-form-group__input:focus,
.sb-form-group__select:focus,
.sb-form-group__textarea:focus {
  border-color: var(--sb-primary);
}

/* --- Info List --- */
.sb-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sb-info-list__item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--sb-border);
}

.sb-info-list__item:last-child {
  border-bottom: none;
}

.sb-info-list__label {
  font-size: 13px;
  color: var(--sb-muted);
}

.sb-info-list__value {
  font-size: 13px;
  font-weight: 500;
  color: var(--sb-text);
}

/* --- Portal Alerts --- */
.sb-portal-alert {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.sb-portal-alert--error   { background: #fef2f2; color: var(--sb-danger); }
.sb-portal-alert--success { background: #ecfdf5; color: var(--sb-success); }
.sb-portal-alert--info    { background: #f0f9ff; color: var(--sb-primary); }
.sb-portal-alert--warning { background: #fffbeb; color: var(--sb-warning); }

/* --- Spinner --- */
.sb-portal-spinner {
  display: flex;
  justify-content: center;
  padding: 40px;
}

.sb-portal-spinner__circle {
  width: 28px;
  height: 28px;
  border: 3px solid var(--sb-border);
  border-top-color: var(--sb-primary);
  border-radius: 50%;
  animation: sb-spin 0.6s linear infinite;
}

.sb-portal-spinner--small {
  padding: 0;
}

.sb-portal-spinner--small .sb-portal-spinner__circle {
  width: 16px;
  height: 16px;
}

/* --- Empty State --- */
.sb-empty-state {
  text-align: center;
  padding: 48px 20px;
}

.sb-empty-state__icon {
  font-size: 48px;
  color: var(--sb-muted);
  margin: 0 auto 12px;
}

.sb-empty-state__title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 4px;
}

.sb-empty-state__message {
  font-size: 13px;
  color: var(--sb-muted);
  margin: 0;
}

/* --- Branding --- */
.sb-portal-branding {
  text-align: center;
  padding: 16px 0;
  font-size: 11px;
  color: var(--sb-muted);
}

.sb-portal-branding a {
  color: var(--sb-primary);
  text-decoration: none;
}

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

.sb-portal-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sb-portal-table-wrap th {
  background: var(--sb-bg);
  font-weight: 600;
  font-size: 11px;
  color: var(--sb-muted);
  text-transform: uppercase;
  padding: 8px 12px;
  text-align: left;
}

.sb-portal-table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sb-border);
}

/* --- Responsive (Desktop) --- */
@media (min-width: 768px) {
  .sb-portal {
    max-width: 640px;
    padding-bottom: 0;
  }

  .sb-bottom-nav {
    display: none;
  }

  .sb-portal-tabs {
    display: flex;
    background: var(--sb-white);
    padding: 0 16px;
    border-bottom: 1px solid var(--sb-border);
    overflow-x: auto;
    overflow-y: hidden;
    min-height: 46px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
    flex-wrap: nowrap;
  }
  .sb-portal-tabs::-webkit-scrollbar { display: none; }

  .sb-portal-tabs__item {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--sb-muted);
    text-decoration: none !important;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
  }

  .sb-portal-tabs__item.is-active,
  .sb-portal-tabs__item--active {
    color: var(--sb-primary);
    border-bottom-color: var(--sb-primary);
  }

  .sb-page-header {
    min-height: 160px;
  }

  .sb-quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Tablet and down: use mobile-first navigation behavior */
@media (max-width: 767px) {
  .sb-portal-tabs {
    display: none !important;
  }

  .sb-bottom-nav {
    display: flex;
  }

  .sb-portal {
    max-width: 100%;
  }
}

@media (max-width: 560px) {
  .sb-header__inner {
    padding: 12px 14px;
    gap: 10px;
  }

  .sb-header__avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
    border-radius: 10px;
  }

  .sb-header__name {
    font-size: 14px;
  }

  .sb-switcher__trigger {
    width: 34px;
    height: 34px;
  }

  .sb-switcher__dropdown {
    width: 260px;
  }

  .sb-header__logout {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
}

/* --- Missing Utilities --- */
.sb-text-success { color: var(--sb-success); }
.sb-text-danger { color: var(--sb-danger); }
.sb-text-warning { color: var(--sb-warning); }
.sb-text-primary { color: var(--sb-primary); }

.sb-btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--sb-text);
  border-radius: 8px;
}
.sb-btn-icon:hover { background: var(--sb-bg); }

.sb-btn--danger-outline {
  background: none;
  border: 1px solid var(--sb-danger);
  color: var(--sb-danger);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
}
.sb-btn--danger-outline:hover { background: #fef2f2; }

.sb-card--link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none !important;
  color: var(--sb-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.sb-card--link:hover { background: var(--sb-bg); }

.sb-card__header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* --- Portal Header Layout (legacy removed — see .sb-header) --- */

.sb-calendar__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.sb-calendar__dot--present { background: #d4edda; }
.sb-calendar__dot--absent { background: #f8d7da; }
.sb-calendar__dot--late { background: #fff3cd; }
.sb-calendar__dot--holiday { background: #e8daff; }
.sb-calendar__dot--weekend { background: #ebedf3; }

/* --- Hero Avatar (gradient header) --- */
.sb-page-header__hero-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.30);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.55);
}

/* --- (Legacy header center/student/switcher removed — see .sb-header) --- */

/* --- Buttons --- */
.sb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, opacity 0.2s;
}
.sb-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.sb-btn--primary {
  background: var(--sb-primary);
  color: #fff;
}
.sb-btn--primary:hover { background: #2684e6; }

.sb-btn--danger {
  background: var(--sb-danger);
  color: #fff;
}
.sb-btn--danger:hover { background: #d9214e; }

.sb-btn--success {
  background: var(--sb-success);
  color: #fff;
}

.sb-btn--block {
  width: 100%;
}

/* --- Receipt Cards --- */
.sb-receipt-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: var(--sb-white);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid #f1f3f7;
}

.sb-receipt-summary__item {
  flex: 1;
  text-align: center;
}

.sb-receipt-summary__value {
  font-size: 18px;
  font-weight: 700;
  color: var(--sb-text);
  display: block;
}

.sb-receipt-summary__label {
  font-size: 11px;
  color: var(--sb-muted);
  margin-top: 2px;
  display: block;
}

.sb-receipt-summary__divider {
  width: 1px;
  height: 36px;
  background: var(--sb-border);
  flex-shrink: 0;
  margin: 0 4px;
}

.sb-receipt {
  background: var(--sb-white);
  border-radius: var(--sb-radius);
  box-shadow: var(--sb-shadow);
  border: 1px solid #f1f3f7;
  margin-bottom: 12px;
  overflow: hidden;
}

.sb-receipt__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
}

.sb-receipt__header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sb-receipt__number {
  font-size: 15px;
  font-weight: 600;
  color: var(--sb-text);
}

.sb-receipt__amount {
  font-size: 18px;
  font-weight: 700;
  color: var(--sb-success);
  white-space: nowrap;
}

.sb-receipt__details {
  padding: 10px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-receipt__row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--sb-muted);
}

.sb-receipt__row svg {
  flex-shrink: 0;
  color: var(--sb-muted);
  opacity: 0.6;
}

.sb-receipt__download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--sb-primary) !important;
  background: rgba(54,153,255,0.04);
  border-top: 1px solid #f1f3f7;
  text-decoration: none !important;
  transition: background 0.15s ease;
  cursor: pointer;
}

.sb-receipt__download:hover {
  background: rgba(54,153,255,0.08);
}

.sb-receipt__download svg {
  flex-shrink: 0;
}

/* --- Keyframes --- */
@keyframes sb-spin {
  to {
    transform: rotate(360deg);
  }
}
