/* Portal Học sinh — giao diện sinh động, thân thiện lứa tuổi HS */
:root {
  --sp-sky: #0ea5e9;
  --sp-teal: #14b8a6;
  --sp-coral: #f97316;
  --sp-mint: #34d399;
  --sp-ink: #0f172a;
  --sp-muted: #64748b;
  --sp-cream: #f0f9ff;
  --sp-card: rgba(255, 255, 255, 0.92);
  --sp-radius: 1.25rem;
  --sp-shadow: 0 12px 40px rgba(14, 165, 233, 0.12);
  /* Nunito hỗ trợ đủ glyph tiếng Việt; Fredoka không có dấu → chữ trong cùng từ bị lệch font */
  --sp-font: "Nunito", "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  --sp-display: "Nunito", "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  /* Nunito mỏng hơn Fredoka cùng số weight → dùng bậc đậm hơn cho tiêu đề / bold */
  --sp-weight-display: 800;
  --sp-weight-title: 700;
  --sp-weight-bold: 800;
  --sp-weight-semibold: 700;
}

.sp-body {
  font-family: var(--sp-font);
  color: var(--sp-ink);
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(56, 189, 248, 0.35), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(45, 212, 191, 0.28), transparent 50%),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(251, 146, 60, 0.12), transparent 55%),
    linear-gradient(180deg, #e0f2fe 0%, #f8fafc 45%, #ecfeff 100%);
  background-attachment: fixed;
}

/* Bù độ đậm khi dùng Nunito (Tailwind font-bold / strong / tiêu đề) */
.sp-body strong,
.sp-body b,
.sp-body .font-bold,
.sp-login-body strong,
.sp-login-body b,
.sp-login-body .font-bold {
  font-weight: var(--sp-weight-bold) !important;
}
.sp-body .font-semibold,
.sp-login-body .font-semibold {
  font-weight: var(--sp-weight-semibold) !important;
}
.sp-body .font-display,
.sp-login-body .font-display {
  font-family: var(--sp-display);
  font-weight: var(--sp-weight-display);
}

.sp-body .page-header {
  background: transparent !important;
  border: 0 !important;
  padding: 0 0 1rem !important;
  margin-bottom: 0.5rem;
}
.sp-body .page-header h1 {
  font-family: var(--sp-display);
  font-weight: var(--sp-weight-display);
  font-size: 1.65rem;
  color: var(--sp-ink);
  letter-spacing: -0.02em;
}
.sp-body .page-header p {
  color: var(--sp-muted);
  margin-top: 0.25rem;
}

/* —— Nav —— */
.sp-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid rgba(14, 165, 233, 0.15);
  box-shadow: 0 4px 24px rgba(14, 165, 233, 0.08);
}
.sp-nav-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1rem 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}
.sp-nav-top {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
}
.sp-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  text-decoration: none !important;
  color: var(--sp-ink) !important;
  font-family: var(--sp-display);
  font-weight: var(--sp-weight-display);
  font-size: 1.2rem;
}
.sp-brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.85rem;
  display: block;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.35);
  flex-shrink: 0;
}
.sp-nav-links {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  width: 100%;
}
@media (min-width: 768px) {
  .sp-nav-links { display: flex; }
  .sp-nav-toggle { display: none !important; }
}
.sp-nav-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--sp-muted);
  text-decoration: none !important;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.sp-nav-links a:hover {
  background: rgba(14, 165, 233, 0.1);
  color: var(--sp-sky);
  transform: translateY(-1px);
}
.sp-nav-links a.is-active {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.18), rgba(20, 184, 166, 0.18));
  color: #0369a1;
}
.sp-nav-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  font-size: 1.1rem;
}
.sp-nav-links.is-open {
  display: flex;
  position: absolute;
  left: 1rem;
  right: 1rem;
  top: calc(100% + 0.25rem);
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  background: #fff;
  padding: 0.75rem;
  border-radius: 1rem;
  box-shadow: var(--sp-shadow);
  border: 1px solid rgba(14, 165, 233, 0.15);
  z-index: 45;
}
.sp-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 233, 0.2);
  background: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--sp-ink);
  cursor: pointer;
}
.sp-user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 11rem;
  background: #fff;
  border-radius: 0.85rem;
  box-shadow: var(--sp-shadow);
  border: 1px solid rgba(14, 165, 233, 0.12);
  padding: 0.35rem;
  z-index: 50;
}
.sp-user-menu.is-open {
  display: block;
}
.sp-user-menu a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.55rem;
  color: var(--sp-ink);
  text-decoration: none !important;
  font-size: 0.875rem;
  font-weight: var(--sp-weight-semibold);
}
.sp-user-menu a:hover { background: rgba(14, 165, 233, 0.08); }

.sp-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
  position: relative;
}
.sp-flash {
  max-width: 72rem;
  margin: 0.75rem auto 0;
  padding: 0 1rem;
}
.sp-flash .sp-alert {
  padding: 0.75rem 1rem;
  border-radius: 0.85rem;
  font-size: 0.9rem;
  font-weight: var(--sp-weight-semibold);
  margin-bottom: 0.5rem;
  animation: sp-pop 0.35s ease;
}
.sp-alert-success { background: #d1fae5; color: #065f46; }
.sp-alert-danger { background: #fee2e2; color: #991b1b; }
.sp-alert-warning { background: #ffedd5; color: #9a3412; }
.sp-alert-info { background: #e0f2fe; color: #075985; }

.sp-footer {
  text-align: center;
  padding: 1.5rem 1rem 2rem;
  color: var(--sp-muted);
  font-size: 0.8rem;
}

/* —— Dashboard hero —— */
.sp-hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--sp-radius) + 0.25rem);
  padding: 1.5rem 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
  color: #fff;
  background: linear-gradient(125deg, #0284c7 0%, #0d9488 55%, #f97316 130%);
  box-shadow: 0 16px 40px rgba(2, 132, 199, 0.28);
  animation: sp-rise 0.55s ease both;
}
.sp-hero h1 {
  font-family: var(--sp-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: var(--sp-weight-display);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}
.sp-hero p { margin: 0; opacity: 0.92; font-weight: var(--sp-weight-semibold); }
.sp-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  font-weight: 700;
}
.sp-hero-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.25;
  background: #fff;
  animation: sp-float 6s ease-in-out infinite;
}
.sp-hero-orb.a { width: 7rem; height: 7rem; right: -1rem; top: -2rem; }
.sp-hero-orb.b { width: 4rem; height: 4rem; right: 5rem; bottom: -1rem; animation-delay: -2s; }

.sp-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
@media (min-width: 768px) {
  .sp-stat-grid { grid-template-columns: repeat(4, 1fr); }
}
.sp-stat {
  background: var(--sp-card);
  border-radius: var(--sp-radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--sp-shadow);
  border: 1px solid rgba(255, 255, 255, 0.8);
  animation: sp-rise 0.55s ease both;
  transition: transform 0.2s, box-shadow 0.2s;
}
.sp-stat:nth-child(1) { animation-delay: 0.05s; }
.sp-stat:nth-child(2) { animation-delay: 0.1s; }
.sp-stat:nth-child(3) { animation-delay: 0.15s; }
.sp-stat:nth-child(4) { animation-delay: 0.2s; }
.sp-stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(14, 165, 233, 0.18);
}
.sp-stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.85rem;
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: 0.65rem;
  font-size: 1rem;
}
.sp-stat-icon.sky { background: linear-gradient(135deg, #38bdf8, #0284c7); }
.sp-stat-icon.mint { background: linear-gradient(135deg, #6ee7b7, #059669); }
.sp-stat-icon.coral { background: linear-gradient(135deg, #fb923c, #ea580c); }
.sp-stat-icon.rose { background: linear-gradient(135deg, #fb7185, #e11d48); }
.sp-stat strong {
  display: block;
  font-family: var(--sp-display);
  font-size: 1.65rem;
  font-weight: var(--sp-weight-display);
  line-height: 1.1;
  color: var(--sp-ink);
}
.sp-stat span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--sp-muted);
}

.sp-panel {
  background: var(--sp-card);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
  border: 1px solid rgba(255, 255, 255, 0.85);
  overflow: hidden;
  margin-bottom: 1rem;
  animation: sp-rise 0.55s ease both;
}
.sp-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid rgba(14, 165, 233, 0.1);
  font-family: var(--sp-display);
  font-weight: var(--sp-weight-title);
  font-size: 1.05rem;
}
.sp-panel-body { padding: 1rem 1.1rem; }

/* Nhiệm vụ Canvas — mở rộng xem mô tả */
.sp-canvas-due > summary {
  list-style: none;
}
.sp-canvas-due > summary::-webkit-details-marker {
  display: none;
}
.sp-canvas-due[open] > summary .text-indigo-500 {
  opacity: 0.7;
}
.sp-canvas-due-body {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.sp-canvas-due-body img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 0.5rem 0;
}
.sp-canvas-due-body p {
  margin: 0.4rem 0;
}
.sp-canvas-due-body ul,
.sp-canvas-due-body ol {
  margin: 0.4rem 0;
  padding-left: 1.25rem;
}
.sp-canvas-due-body a {
  color: #4f46e5;
  font-weight: 600;
  text-decoration: underline;
}
.sp-canvas-due-body .sp-canvas-video {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0.75rem 0;
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border-radius: 0.75rem;
  overflow: hidden;
}
.sp-canvas-due-body .sp-canvas-audio {
  display: block;
  width: 100%;
  max-width: 480px;
  margin: 0.65rem 0;
  padding: 0.55rem 0.75rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
}
.sp-canvas-due-body .sp-canvas-embed {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0.75rem 0;
  min-height: 360px;
  height: min(70vh, 640px);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  overflow: hidden;
}
.sp-canvas-due-body .sp-canvas-video iframe,
.sp-canvas-due-body .sp-canvas-embed iframe,
.sp-canvas-due-body .sp-canvas-video video {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  border: 0;
  border-radius: 0.75rem;
}
.sp-canvas-due-body .sp-canvas-video video {
  height: auto;
  aspect-ratio: 16 / 9;
  background: #0f172a;
}
.sp-canvas-due-body .sp-canvas-audio audio,
.sp-canvas-due-body audio {
  display: block;
  width: 100%;
  height: 40px;
  max-width: 100%;
  margin: 0;
  border: 0;
  background: transparent;
}

.sp-quick {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}
.sp-quick a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  text-decoration: none !important;
  font-weight: 700;
  color: var(--sp-ink);
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.08), rgba(20, 184, 166, 0.06));
  border: 1px solid rgba(14, 165, 233, 0.12);
  transition: transform 0.15s, background 0.2s;
}
.sp-quick a:hover {
  transform: translateX(4px);
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.14), rgba(249, 115, 22, 0.08));
}
.sp-quick-ico {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.sp-quick-ico.lms { background: linear-gradient(135deg, #38bdf8, #6366f1); }
.sp-quick-ico.counsel { background: linear-gradient(135deg, #2dd4bf, #0d9488); }
.sp-quick-ico.eval { background: linear-gradient(135deg, #fb923c, #f43f5e); }
.sp-quick-ico.attend { background: linear-gradient(135deg, #14b8a6, #0ea5e9); }

.sp-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
}
.sp-chip-orange { background: #f97316; }
.sp-chip-red { background: #ef4444; }
.sp-chip-cyan { background: #06b6d4; }
.sp-chip-green { background: #10b981; }
.sp-score {
  display: inline-flex;
  min-width: 2.5rem;
  justify-content: center;
  padding: 0.35rem 0.65rem;
  border-radius: 0.65rem;
  background: linear-gradient(135deg, #34d399, #059669);
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

/* Soften legacy hv-card inside student shell */
.sp-body .hv-card {
  border-radius: var(--sp-radius) !important;
  box-shadow: var(--sp-shadow) !important;
  border: 1px solid rgba(14, 165, 233, 0.1) !important;
  overflow: hidden;
}
.sp-body .hv-card-header,
.sp-body .hv-stat-card {
  font-family: var(--sp-display);
}
.sp-body .btn-primary {
  background: linear-gradient(135deg, var(--sp-sky), var(--sp-teal)) !important;
  border: 0 !important;
  font-weight: 800 !important;
  border-radius: 0.85rem !important;
}
.sp-body .hv-table th {
  font-size: 0.7rem !important;
  letter-spacing: 0.04em;
  font-weight: var(--sp-weight-title);
}

/* —— Login —— */
.sp-login-body {
  box-sizing: border-box;
  margin: 0;
  font-family: var(--sp-font);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vh, 1.5rem) clamp(0.75rem, 3vw, 1.5rem);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.45), transparent 40%),
    radial-gradient(circle at 85% 15%, rgba(45, 212, 191, 0.4), transparent 35%),
    radial-gradient(circle at 70% 80%, rgba(251, 146, 60, 0.3), transparent 40%),
    linear-gradient(160deg, #0369a1 0%, #0f766e 55%, #c2410c 120%);
}
.sp-login-body *,
.sp-login-body *::before,
.sp-login-body *::after {
  box-sizing: border-box;
}
.sp-login-wrap {
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
}
.sp-login-card {
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 1.5rem;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  animation: sp-rise 0.5s ease both;
}
.sp-login-top {
  padding: clamp(1.25rem, 4vw, 2rem) clamp(1rem, 4vw, 1.75rem) clamp(1rem, 3vw, 1.5rem);
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #0ea5e9, #14b8a6 70%, #fb923c);
  position: relative;
  overflow: hidden;
}
.sp-login-top h1 {
  font-family: var(--sp-display);
  font-size: clamp(1.2rem, 4.5vw, 1.65rem);
  font-weight: var(--sp-weight-display);
  margin: 0.75rem 0 0.35rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
}
.sp-login-top p {
  margin: 0;
  opacity: 0.92;
  font-weight: var(--sp-weight-semibold);
  font-size: clamp(0.8rem, 2.8vw, 0.9rem);
  line-height: 1.4;
  padding: 0 0.15rem;
}
.sp-login-mascot {
  width: clamp(3.5rem, 12vw, 4.5rem);
  height: clamp(3.5rem, 12vw, 4.5rem);
  margin: 0 auto;
  border-radius: 1.25rem;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.22);
  font-size: clamp(1.5rem, 5vw, 2rem);
  animation: sp-float 4s ease-in-out infinite;
}
.sp-login-logo {
  width: clamp(4.25rem, 16vw, 5.5rem);
  height: clamp(4.25rem, 16vw, 5.5rem);
  margin: 0 auto;
  border-radius: 1.25rem;
  display: block;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(2, 132, 199, 0.35);
  animation: sp-float 4s ease-in-out infinite;
}
.sp-login-body-inner {
  padding: clamp(1rem, 3.5vw, 1.5rem) clamp(1rem, 4vw, 1.75rem) clamp(0.85rem, 3vw, 1.25rem);
}
.sp-ms-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  max-width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 0;
  background: linear-gradient(135deg, #0284c7, #0d9488);
  color: #fff !important;
  font-weight: 800;
  font-size: clamp(0.9rem, 3.2vw, 1rem);
  text-decoration: none !important;
  box-shadow: 0 10px 24px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s, box-shadow 0.2s;
  white-space: nowrap;
}
.sp-ms-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(2, 132, 199, 0.4);
  color: #fff !important;
}
.sp-login-warn {
  margin: 0;
  font-size: 0.875rem;
  color: #b91c1c;
  font-weight: 700;
  text-align: center;
  line-height: 1.4;
}
.sp-login-note {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  text-align: center;
  color: #64748b;
  font-weight: 600;
  line-height: 1.45;
}
.sp-login-foot {
  padding: 0.85rem 1.25rem;
  background: #f8fafc;
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
}
.sp-login-links {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.85rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
}
.sp-login-links a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  margin: 0;
  white-space: nowrap;
}
.sp-login-links a:hover { text-decoration: underline; }

/* Màn hình hẹp / laptop nhỏ */
@media (max-width: 480px) {
  .sp-login-card { border-radius: 1.15rem; }
  .sp-ms-btn { white-space: normal; }
}
/* Chiều cao thấp (laptop 1366×768, cửa sổ ngắn) */
@media (max-height: 700px) {
  .sp-login-body {
    align-items: flex-start;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
  .sp-login-mascot,
  .sp-login-logo {
    width: 3.25rem;
    height: 3.25rem;
    font-size: 1.35rem;
    animation: none;
  }
  .sp-login-top { padding-top: 1.1rem; padding-bottom: 1rem; }
  .sp-login-top h1 { margin-top: 0.5rem; font-size: 1.25rem; }
  .sp-login-body-inner { padding-top: 1rem; padding-bottom: 0.85rem; }
}

@keyframes sp-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sp-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
@keyframes sp-pop {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .sp-hero, .sp-stat, .sp-panel, .sp-login-card,
  .sp-hero-orb, .sp-login-mascot, .sp-login-logo, .sp-flash .sp-alert {
    animation: none !important;
  }
}

/* —— Nhìn lại quá trình (đồng bộ sky–teal với sp-panel / nav) —— */
.sp-body .rv-wrap {
  --rv-ink: #0c4a6e;          /* sky-900 — chữ tiêu đề/nhãn */
  --rv-muted: #0369a1;        /* sky-700 — gợi ý, phụ */
  --rv-border: rgba(14, 165, 233, 0.28);
  --rv-border-soft: rgba(14, 165, 233, 0.14);
  --rv-fill: rgba(240, 249, 255, 0.95);
  max-width: 42rem;
  margin: 0 auto;
  color: var(--rv-ink);
}
.sp-body .rv-form-shell {
  background: var(--sp-card);
  border-radius: var(--sp-radius);
  box-shadow: var(--sp-shadow);
  border: 1px solid var(--rv-border) !important;
  padding: 1.15rem 1.15rem 1.35rem;
  animation: sp-rise 0.45s ease both;
  color: var(--rv-ink);
}
.sp-body .rv-progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.12);
  overflow: hidden;
  margin-bottom: 1rem;
}
.sp-body .rv-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sp-sky), var(--sp-teal));
  transition: width 0.35s ease;
}
.sp-body .rv-step-index {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sp-teal) !important;
}
.sp-body .rv-step-title {
  margin: 0.2rem 0 0.15rem;
  font-family: var(--sp-display);
  font-size: 1.35rem;
  font-weight: var(--sp-weight-display);
  color: var(--rv-ink) !important;
}
.sp-body .rv-step-hint {
  margin: 0 0 0.9rem;
  color: var(--rv-muted) !important;
  font-size: 0.92rem;
  opacity: 0.85;
}
.sp-body .rv-dots {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
}
.sp-body .rv-dots button {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  border: 0;
  padding: 0;
  cursor: pointer;
  background: rgba(14, 165, 233, 0.22);
  transition: transform 0.15s, background 0.15s;
}
.sp-body .rv-dots button.active {
  background: var(--sp-sky);
  transform: scale(1.25);
}
.sp-body .rv-dots button.done {
  background: var(--sp-teal);
}
.sp-body .rv-step { display: none; }
.sp-body .rv-step.active {
  display: grid;
  gap: 0.95rem;
  animation: sp-rise 0.3s ease;
}
.sp-body .rv-field { display: grid; gap: 0.3rem; }
.sp-body .rv-field-label {
  font-weight: 700;
  color: var(--rv-ink) !important;
  font-size: 0.92rem;
}
.sp-body .rv-field-hint {
  font-size: 0.8rem;
  color: var(--rv-muted) !important;
  opacity: 0.8;
}
/* Ô nhập: viền sky (không dùng xám slate / primary theme) */
.sp-body .rv-form-shell input,
.sp-body .rv-form-shell textarea,
.sp-body .rv-form-shell select {
  width: 100%;
  border: 1.5px solid var(--rv-border) !important;
  border-radius: 0.75rem !important;
  background: #fff !important;
  color: var(--sp-ink) !important;
  font: inherit;
  padding: 0.7rem 0.85rem !important;
  outline: none;
  box-shadow: 0 1px 2px rgba(14, 165, 233, 0.06);
  transition: border-color 0.15s, box-shadow 0.15s;
  caret-color: var(--sp-sky);
}
.sp-body .rv-form-shell input:focus,
.sp-body .rv-form-shell textarea:focus,
.sp-body .rv-form-shell select:focus {
  border-color: var(--sp-sky) !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2) !important;
}
.sp-body .rv-form-shell input:disabled {
  background: var(--rv-fill) !important;
  color: var(--rv-muted) !important;
  border-color: var(--rv-border-soft) !important;
  cursor: not-allowed;
  opacity: 1;
}
.sp-body .rv-form-shell input::placeholder,
.sp-body .rv-form-shell textarea::placeholder {
  color: #7dd3fc !important;
  opacity: 1;
}
.sp-body .rv-subject {
  border: 1.5px solid var(--rv-border) !important;
  border-radius: 1rem;
  background: linear-gradient(180deg, var(--rv-fill), #fff) !important;
  padding: 0.9rem 1rem;
}
.sp-body .rv-subject h3 {
  margin: 0 0 0.7rem;
  font-family: var(--sp-display);
  font-weight: var(--sp-weight-title);
  color: #0369a1 !important;
  font-size: 1.05rem;
}
.sp-body .rv-subject-grid { display: grid; gap: 0.75rem; }
@media (min-width: 720px) {
  .sp-body .rv-subject-grid { grid-template-columns: 1fr 1fr; }
}
.sp-body .rv-error {
  margin: 1rem 0 0;
  padding: 0.75rem 0.9rem;
  border-radius: 0.85rem;
  border: 1px solid rgba(249, 115, 22, 0.35);
  background: rgba(255, 247, 237, 0.95);
  color: #c2410c !important;
  font-weight: 700;
  font-size: 0.9rem;
}
.sp-body .rv-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid var(--rv-border-soft);
}
.sp-body .rv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.15rem;
  font-family: var(--sp-font);
  font-weight: 800;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s;
}
.sp-body .rv-btn:hover { transform: translateY(-1px); }
.sp-body .rv-btn-primary {
  background: linear-gradient(135deg, var(--sp-sky), #0284c7) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.28);
}
.sp-body .rv-btn-accent {
  background: linear-gradient(135deg, var(--sp-teal), #0d9488) !important;
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(20, 184, 166, 0.28);
}
.sp-body .rv-btn-ghost {
  background: rgba(14, 165, 233, 0.1) !important;
  color: #0369a1 !important;
  border: 1px solid var(--rv-border) !important;
}
.sp-body .rv-btn-ghost:hover {
  background: rgba(14, 165, 233, 0.18) !important;
}
.sp-body .rv-done {
  border: 1px solid rgba(20, 184, 166, 0.28);
  border-radius: var(--sp-radius);
  background: linear-gradient(180deg, #f0fdfa, #fff);
  box-shadow: var(--sp-shadow);
  padding: 1.25rem;
  text-align: center;
}
.sp-body .rv-done h3 {
  font-family: var(--sp-display);
  font-weight: var(--sp-weight-display);
  color: #0f766e !important;
  margin: 0 0 0.5rem;
}
.sp-body .rv-form-shell .hidden,
.sp-body .rv-actions .hidden,
.sp-body .rv-error.hidden { display: none !important; }

/* Legacy hero/tips */
.sp-body .rv-hero {
  border: 1px solid var(--rv-border);
  border-radius: var(--sp-radius);
  background: var(--sp-card);
  box-shadow: var(--sp-shadow);
  padding: 1.25rem 1.15rem;
  margin-bottom: 1rem;
}
.sp-body .rv-hero h2 {
  font-family: var(--sp-display);
  font-size: 1.35rem;
  font-weight: var(--sp-weight-display);
  color: var(--rv-ink) !important;
  margin: 0.25rem 0 0.35rem;
}
.sp-body .rv-hero p { color: var(--rv-muted); margin: 0; }
.sp-body .rv-brand { display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
.sp-body .rv-brand-badge {
  width: 2.2rem; height: 2.2rem; border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--sp-sky), var(--sp-teal));
  color: #fff; font-family: var(--sp-display); font-weight: 800;
  display: grid; place-items: center; font-size: 0.85rem;
}
.sp-body .rv-brand-text { font-family: var(--sp-display); font-weight: var(--sp-weight-title); color: #0369a1 !important; }

/* Link phụ trên form SSA */
.sp-body .rv-wrap a {
  color: #0284c7 !important;
}
.sp-body .rv-wrap a:hover {
  color: var(--sp-teal) !important;
}

/* Mục tiêu rèn luyện */
.pg-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.pg-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none !important;
  color: #0f766e !important;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(13, 148, 136, 0.22);
}
.pg-tab.is-active {
  color: #fff !important;
  background: linear-gradient(135deg, #0ea5e9, #0d9488);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(14, 165, 233, 0.28);
}
.pg-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}
@media (max-width: 640px) {
  .pg-cat-grid { grid-template-columns: 1fr; }
}
.pg-cat {
  cursor: pointer;
}
.pg-cat input { position: absolute; opacity: 0; pointer-events: none; }
.pg-cat span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 4.4rem;
  padding: 0.7rem 0.5rem;
  border-radius: 1rem;
  border: 2px solid rgba(14, 165, 233, 0.18);
  background: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  color: #0f172a;
  text-align: center;
}
.pg-cat span i { color: #0ea5e9; font-size: 1.1rem; }
.pg-cat input:checked + span {
  border-color: #0d9488;
  background: #ecfeff;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}
.pg-goal {
  border: 1px solid rgba(14, 165, 233, 0.14);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  background: #fff;
}
.pg-goal.is-done { opacity: 0.82; background: #f8fafc; }
.pg-badge {
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}
.pg-badge-active { background: #ecfeff; color: #0f766e; }
.pg-badge-done { background: #d1fae5; color: #065f46; }
.pg-dl { display: grid; gap: 0.55rem; margin: 0; }
.pg-dl dt {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
}
.pg-dl dd { margin: 0.15rem 0 0; font-weight: 600; color: #0f172a; white-space: pre-wrap; }
.pg-bar {
  height: 0.45rem;
  border-radius: 999px;
  background: #e2e8f0;
  margin: 0 0 0.75rem;
  overflow: hidden;
}
.pg-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #0d9488);
  border-radius: inherit;
}
.pg-progress-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-top: 0.85rem;
}
.pg-progress-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.pg-step input { position: absolute; opacity: 0; pointer-events: none; }
.pg-step span {
  display: inline-block;
  min-width: 4.4rem;
  padding: 0.35rem 0.45rem;
  border-radius: 0.7rem;
  border: 1px solid #bae6fd;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.2;
}
.pg-step span small { font-weight: 600; color: #64748b; }
.pg-step input:checked + span {
  background: #ecfeff;
  border-color: #0d9488;
  color: #0f766e;
}
.pg-step-btn {
  border: 1px solid #bae6fd;
  background: #fff;
  color: #0f766e;
  font-weight: 800;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  cursor: pointer;
}
.pg-step-btn.is-on {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}
.pg-notes-form { margin: 0; }
.pg-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.45rem 0.75rem;
  background: #f0fdfa;
  border-bottom: 1px solid #ccfbf1;
}
.pg-table-toolbar--bottom {
  border-bottom: 0;
  border-top: 1px solid #ccfbf1;
}
.pg-table-hint {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}
.pg-batch-save { white-space: nowrap; }
.pg-goals-table { min-width: 680px; }
.pg-goals-table th,
.pg-goals-table td {
  vertical-align: top;
  padding: 0.4rem 0.5rem;
}
.pg-goals-table thead th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
}
.pg-goals-table tr.is-done { background: #f8fafc; opacity: 0.92; }
.pg-goals-table tr.is-tried { background: #fffbeb; }
.pg-col-stt { width: 2.4rem; text-align: center; font-weight: 800; color: #64748b; }
.pg-col-title { min-width: 11rem; max-width: 16rem; }
.pg-col-date { width: 6.5rem; }
.pg-col-status { width: 10.5rem; }
.pg-col-note { min-width: 10rem; }
.pg-goal-title-row {
  display: inline;
}
.pg-goal-title {
  font-weight: 700;
  color: #0f172a;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.3;
  font-size: 0.9rem;
}
.pg-hist-btn {
  display: inline;
  margin: 0 0 0 0.2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  line-height: inherit;
  font-size: 0.7rem;
  vertical-align: baseline;
}
.pg-hist-btn:hover {
  color: #0d9488;
  background: transparent;
}
.pg-goal-meta {
  margin-top: 0.2rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
}
.pg-goal-meta a { color: #0284c7; font-weight: 700; }
.pg-link-danger {
  font: inherit;
  font-weight: 700;
  color: #e11d48;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.pg-status-select { width: 100%; min-width: 8rem; font-size: 0.8rem; padding: 0.25rem 0.4rem; }
.pg-note-input {
  width: 100%;
  min-height: 2.6rem;
  resize: vertical;
  border: 1px solid #bae6fd;
  border-radius: 0.5rem;
  padding: 0.3rem 0.4rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  background: #fff;
  white-space: pre-wrap;
}
.pg-note-input:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

/* Modal lịch sử nhập */
.pg-hist-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.pg-hist-modal.hidden { display: none; }
.pg-hist-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.pg-hist-dialog {
  position: relative;
  z-index: 1;
  width: min(36rem, 100%);
  max-height: min(80vh, 40rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 0.85rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}
.pg-hist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
}
.pg-hist-body {
  padding: 0.75rem 1rem 1rem;
  overflow-y: auto;
}
.pg-hist-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}
.pg-hist-item {
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  padding: 0.55rem 0.7rem;
  background: #f8fafc;
}
.pg-hist-meta {
  font-size: 0.7rem;
  font-weight: 800;
  color: #0d9488;
  margin-bottom: 0.35rem;
}
.pg-hist-field span {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 0.15rem;
}
.pg-hist-field p {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  white-space: pre-wrap;
  line-height: 1.35;
}
.pg-hist-field:last-child p { margin-bottom: 0; }

/* PWA — icon + bubble nhỏ (không dùng panel nổi) */
.sp-pwa-fab {
  position: fixed;
  z-index: 50;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}
.sp-pwa-fab.hidden { display: none !important; }
.sp-pwa-fab-dismiss {
  width: 1.25rem;
  height: 1.25rem;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.sp-pwa-fab-dismiss:hover { background: rgba(15, 23, 42, 0.7); }
.sp-pwa-fab-main {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}
.sp-pwa-fab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #0ea5e9, #14b8a6);
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
}
.sp-pwa-fab-bubble {
  display: inline-block;
  max-width: 7.5rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #bae6fd;
  color: #0369a1;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.18);
  white-space: nowrap;
}
.sp-pwa-fab-main:hover .sp-pwa-fab-icon {
  transform: scale(1.05);
}
.sp-pwa-fab-main:hover .sp-pwa-fab-bubble {
  border-color: #7dd3fc;
  color: #0284c7;
}
@media (max-width: 480px) {
  .sp-pwa-fab { right: 0.75rem; bottom: 0.75rem; }
}
