/* ==========================================================================
   SkillPulse Singpass — Responsive Cross-Device PWA Stylesheet (Dark & Light)
   ========================================================================== */

:root {
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Consolas, monospace;

  --singpass: #f4333d;
  --singpass-hover: #dc262f;
  --singpass-soft: rgba(244, 51, 61, 0.14);

  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --indigo: #6366f1;
  --indigo-soft: rgba(99, 102, 241, 0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.15);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.14);

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-w: 252px;
  --topbar-h: 64px;
  --bottom-nav-h: 66px;
}

/* Dark Theme (Default Obsidian) */
[data-theme="dark"] {
  --bg: #090c14;
  --bg-elev: #111624;
  --bg-card: #131929;
  --bg-subtle: #1a2236;
  --bg-hover: #212b44;
  --bg-glass: rgba(15, 20, 34, 0.84);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #8b9bb4;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.42);
  --hero-glow: radial-gradient(circle at 18% 12%, rgba(244, 51, 61, 0.16), transparent 46%),
               radial-gradient(circle at 82% 85%, rgba(99, 102, 241, 0.16), transparent 48%);
}

/* Light Theme (Crisp Porcelain) */
[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #eef2f9;
  --bg-hover: #e4eaf5;
  --bg-glass: rgba(255, 255, 255, 0.86);
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --shadow-sm: 0 2px 10px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 14px 34px rgba(15, 23, 42, 0.10);
  --hero-glow: radial-gradient(circle at 18% 12%, rgba(244, 51, 61, 0.08), transparent 46%),
               radial-gradient(circle at 82% 85%, rgba(99, 102, 241, 0.09), transparent 48%);
}

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

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.22s ease, color 0.22s ease;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.88rem; margin: 2px 0 0; }
.text-singpass { color: var(--singpass); }
.mono { font-family: var(--font-mono); font-size: 0.82rem; }

/* ---- Buttons & Inputs ---- */
button, input, select, textarea {
  font-family: inherit;
  color: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  transition: transform 0.12s ease, background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--indigo);
  color: #ffffff;
}
.btn-primary:hover { background: #4f46e5; }

.btn-singpass {
  background: var(--singpass);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(244, 51, 61, 0.30);
}
.btn-singpass:hover { background: var(--singpass-hover); }

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
}
.btn-emerald:hover { background: #059669; }

.btn-soft {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border);
}
.btn-soft:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-subtle); color: var(--text); }

.btn-sm { padding: 7px 12px; font-size: 0.84rem; min-height: 36px; }
.btn-xs { padding: 5px 10px; font-size: 0.78rem; min-height: 32px; border-radius: 8px; }
.btn-lg { padding: 13px 20px; font-size: 1rem; min-height: 48px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }

input[type="text"],
input[type="search"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  min-height: 40px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px var(--indigo-soft);
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

/* ---- Badges & Chips ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.badge-verified { background: var(--emerald-soft); color: var(--emerald); }
.badge-sandbox { background: var(--singpass-soft); color: var(--singpass); }
.badge-partner { background: var(--indigo-soft); color: var(--indigo); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-cyan { background: var(--cyan-soft); color: var(--cyan); }
.badge-muted { background: var(--bg-subtle); color: var(--muted); }

.chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 34px;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active {
  background: var(--indigo);
  border-color: var(--indigo);
  color: #ffffff;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseRing 2s infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.65); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* ================= AUTH GATE (SINGPASS-ONLY) ================= */
.auth-gate {
  min-height: 100dvh;
  background: var(--bg);
  background-image: var(--hero-glow);
  display: flex;
  flex-direction: column;
}

.auth-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: var(--bg-glass);
  position: sticky;
  top: 0;
  z-index: 20;
}
.auth-topbar-actions { display: flex; align-items: center; gap: 8px; }

.brand-inline { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; }
.brand-logo-sm { width: 28px; height: 28px; border-radius: 7px; }
.brand-name { font-size: 1.12rem; font-weight: 800; letter-spacing: -0.02em; }
.brand-badge-sg {
  display: inline-block;
  margin-left: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--singpass);
  color: #fff;
  vertical-align: middle;
}

.auth-grid {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 52px) clamp(16px, 4vw, 32px);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
}

.pill-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.auth-hero h1 {
  font-size: clamp(1.9rem, 3.8vw, 3rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
}
.auth-lead {
  font-size: 1.02rem;
  color: var(--text-secondary);
  margin: 0 0 26px;
  max-width: 560px;
}

.auth-feature-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.feature-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.feature-chip strong { display: block; font-size: 0.88rem; margin-bottom: 2px; }
.feature-chip span { font-size: 0.8rem; color: var(--muted); }

/* Singpass Card */
.singpass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3vw, 30px);
  box-shadow: var(--shadow-md);
}
.sp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.sp-logo-wordmark {
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}
.sp-word-sing { color: var(--singpass); }
.sp-word-pass { color: var(--text); }
.sp-subtitle { margin: 0 0 18px; color: var(--muted); font-size: 0.9rem; }

.sp-qr-stage {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  margin-bottom: 18px;
}
.sp-qr-box {
  width: 112px;
  height: 112px;
  flex-shrink: 0;
  background: #ffffff;
  padding: 6px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.14);
}
.sp-qr-box svg { width: 100%; height: 100%; display: block; }
.sp-qr-meta strong { display: block; font-size: 0.92rem; margin-bottom: 4px; }
.sp-qr-meta p { margin: 0; font-size: 0.82rem; color: var(--muted); }

.persona-section { margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.persona-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.persona-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all 0.15s ease;
}
.persona-option:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.persona-option.selected {
  border-color: var(--singpass);
  background: var(--singpass-soft);
}
.persona-option strong { display: block; font-size: 0.88rem; color: var(--text); }
.persona-option small { display: block; font-size: 0.76rem; color: var(--muted); }

.sp-consent-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--muted);
}
.sp-consent-note svg { flex-shrink: 0; margin-top: 2px; }

/* ================= AUTHENTICATED APP SHELL ================= */
.app-shell {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.brand-sub { display: block; font-size: 0.72rem; color: var(--muted); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.nav-item:hover { background: var(--bg-subtle); color: var(--text); }
.nav-item.active {
  background: var(--indigo-soft);
  color: var(--indigo);
}
.nav-badge {
  margin-left: auto;
  background: var(--singpass);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.user-card-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.avatar-sp {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--singpass), var(--indigo));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-mini-meta { min-width: 0; }
.user-mini-meta strong {
  display: block;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-mini-meta span { font-size: 0.74rem; color: var(--muted); }
.sidebar-footer-btns { display: flex; gap: 6px; }
.sidebar-footer-btns .btn { flex: 1; }

.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 clamp(14px, 3vw, 28px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-brand { display: none; align-items: center; gap: 8px; }
.page-heading-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading-wrap h2 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sse-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--emerald-soft);
  color: var(--emerald);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.notif-btn { position: relative; }
.unread-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: var(--singpass);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.content-area {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(16px, 2.5vw, 28px);
  flex: 1;
}

.tab-panel { display: none; flex-direction: column; gap: 18px; }
.tab-panel.active { display: flex; }

/* ---- Cards & Grids ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(16px, 2vw, 22px);
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-header h3 { margin: 0; font-size: 1rem; font-weight: 700; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.kpi-label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.kpi-value {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 4px 0 2px;
}
.kpi-sub { font-size: 0.76rem; color: var(--emerald); font-weight: 600; }

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* MyInfo Summary */
.myinfo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.myinfo-cell {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.myinfo-cell span { display: block; font-size: 0.73rem; color: var(--muted); }
.myinfo-cell strong { font-size: 0.9rem; }

.opencerts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.opencert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--emerald-soft);
}

/* Real-Time Event Feed */
.event-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding-right: 4px;
}
.event-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  animation: fadeSlide 0.25s ease;
}
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.event-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--indigo);
}
.event-dot.cat-vendor { background: var(--amber); }
.event-dot.cat-partner { background: var(--cyan); }
.event-dot.cat-auth { background: var(--singpass); }
.event-dot.cat-match { background: var(--emerald); }
.event-row strong { display: block; font-size: 0.86rem; }
.event-row p { margin: 2px 0; font-size: 0.8rem; color: var(--text-secondary); }
.event-row time { font-size: 0.72rem; color: var(--muted); }

/* Matches & Explainable Score Bars */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-box input { padding-left: 36px; }
.mode-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.slider-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
}
.slider-control label { margin: 0; white-space: nowrap; }
.slider-control input[type="range"] { flex: 1; accent-color: var(--indigo); }

.skills-editor {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.resume-upload-box {
  border-top: 1px solid var(--border);
  padding: 14px 0;
  margin-bottom: 4px;
}
.resume-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.resume-upload-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.resume-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.35);
  font-size: 0.84rem;
}
.resume-result strong { color: var(--emerald); }
.resume-preview-text {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  word-break: break-word;
}
.skills-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
.skill-pill.matched { background: var(--emerald-soft); border-color: rgba(16, 185, 129, 0.35); color: var(--emerald); }
.skill-pill.missing { background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.35); color: var(--amber); }
.skill-pill button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0 2px;
  font-size: 0.9rem;
  line-height: 1;
}

.inline-add-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.inline-add-form input { flex: 1; min-width: 180px; }
.inline-add-form select { width: auto; min-width: 170px; }

.matches-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.match-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.job-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.job-top h4 { margin: 0 0 4px; font-size: 1rem; }
.job-meta { font-size: 0.82rem; color: var(--muted); }

.score-ring {
  min-width: 58px;
  height: 58px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.score-ring.mid {
  background: var(--indigo-soft);
  color: var(--indigo);
  border-color: rgba(99, 102, 241, 0.3);
}
.score-ring.low {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.3);
}
.score-ring small { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; opacity: 0.85; }

.breakdown-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
}
.b-item-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 3px;
}
.progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--indigo), var(--emerald));
}

.unlock-callout {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
  font-size: 0.82rem;
}
.unlock-callout strong { color: var(--amber); }

.job-actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* SkillsFuture Courses */
.subsidy-banner {
  background: linear-gradient(135deg, rgba(244, 51, 61, 0.12), rgba(99, 102, 241, 0.14));
  border-color: var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.wallet-stats { display: flex; gap: 18px; flex-wrap: wrap; }
.wallet-stat span { display: block; font-size: 0.76rem; color: var(--muted); }
.wallet-stat strong { font-size: 1.35rem; font-weight: 800; }

.courses-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.subsidy-breakdown {
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
}
.sub-line { display: flex; justify-content: space-between; }
.sub-line.total {
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 4px;
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--emerald);
}

/* Vendor / Partner / Supplier Portal */
.portal-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.portal-header-top h3 { margin: 8px 0 4px; font-size: 1.2rem; }
.subtab-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--bg-subtle);
  padding: 5px;
  border-radius: 12px;
}
.subtab {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.subtab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.subtab-panel { display: none; flex-direction: column; gap: 18px; }
.subtab-panel.active { display: flex; }

.stacked-form { display: flex; flex-direction: column; gap: 12px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.check-row { display: flex; gap: 16px; flex-wrap: wrap; }
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  cursor: pointer;
}
.checkbox-label input { width: auto; min-height: auto; }

.stack-list { display: flex; flex-direction: column; gap: 10px; }
.list-item-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.list-item-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.cohort-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

/* Audit Log */
.audit-list { display: flex; flex-direction: column; gap: 8px; }
.audit-item {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.82rem;
}
.audit-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.audit-hash {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
}

/* Modals (QR Share & Switch Identity) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-card {
  width: 100%;
  max-width: 470px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-md);
  max-height: 92dvh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-header h3 { margin: 0; font-size: 1.08rem; }

.qr-preset-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.qr-preview-stage {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}
.qr-canvas-frame {
  background: #ffffff;
  padding: 14px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: inline-flex;
}
.qr-canvas-frame svg { width: 220px; height: 220px; display: block; }
.qr-url-row { display: flex; gap: 8px; margin-bottom: 12px; }
.qr-download-row { display: flex; gap: 10px; }
.qr-download-row .btn { flex: 1; }

/* Toasts */
.toast-container {
  position: fixed;
  top: 74px;
  right: 16px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--emerald);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-md);
  animation: fadeSlide 0.22s ease;
}
.toast.toast-vendor { border-left-color: var(--amber); }
.toast.toast-singpass { border-left-color: var(--singpass); }
.toast strong { display: block; font-size: 0.86rem; }
.toast span { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* Mobile Bottom Nav (Hidden on Desktop) */
.bottom-nav { display: none; }
.show-mobile-only { display: none; }

/* ================= RESPONSIVE: iPad / TABLET (<= 1024px) ================= */
@media (max-width: 1024px) {
  .auth-grid { grid-template-columns: 1fr; max-width: 640px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col-grid { grid-template-columns: 1fr; }
  .matches-grid { grid-template-columns: 1fr; }
  .match-mini-grid { grid-template-columns: 1fr; }
  .courses-grid { grid-template-columns: 1fr; }
  .cohort-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================= RESPONSIVE: MOBILE & COMPACT iPad (<= 820px) ================= */
@media (max-width: 820px) {
  .sidebar { display: none; }
  .main-wrap {
    margin-left: 0;
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 12px);
  }
  .mobile-brand { display: flex; }
  .show-mobile-only { display: inline-flex; }
  .page-heading-wrap h2 { display: none; }
  .sse-status-pill { font-size: 0.7rem; padding: 3px 8px; }
  .auth-feature-pills { grid-template-columns: 1fr; }
  .sp-qr-stage { flex-direction: column; text-align: center; }
  .form-row { grid-template-columns: 1fr; }
  .cohort-grid { grid-template-columns: 1fr; }
  .myinfo-grid { grid-template-columns: 1fr; }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: var(--bg-glass);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
  .bnav-item {
    border: none;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    border-radius: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    min-height: 50px;
  }
  .bnav-item.active {
    color: var(--singpass);
    background: var(--singpass-soft);
  }
}

@media (max-width: 480px) {
  .hide-xs { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 1.35rem; }
  .breakdown-bars { grid-template-columns: 1fr; }
}
