/* ==========================================================================
   SỔ ĐIỂM CHO BÉ - DESIGN SYSTEM & STYLES (TRANG TRẺ & TRANG ADMIN)
   ========================================================================== */

:root {
  /* Dark Navy Premium SaaS Theme (Default) */
  --bg-primary: #0b1121;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-secondary: #f0f4f8;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --bg-page: #0b1121;
  
  /* Text colors remain dark (for white card context) */
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-on-dark: #e2e8f0;
  --text-heading-on-dark: #ffffff;
  --border-color: #e2e8f0;
  --border-light: #f1f5f9;

  /* Accent Colors */
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --primary-glow: rgba(99, 102, 241, 0.2);

  --success: #10b981;
  --success-hover: #059669;
  --success-light: #ecfdf5;
  --success-glow: rgba(16, 185, 129, 0.15);

  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --danger-glow: rgba(239, 68, 68, 0.15);

  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --warning-glow: rgba(245, 158, 11, 0.15);

  --info: #06b6d4;
  --info-light: #ecfeff;

  /* Kid 1 & Kid 2 Themes */
  --kid1-accent: #3b82f6;
  --kid1-light: #eff6ff;
  --kid1-border: #bfdbfe;

  --kid2-accent: #10b981;
  --kid2-light: #ecfdf5;
  --kid2-border: #a7f3d0;

  /* Elevation & Borders */
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.1), 0 2px 6px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, 0.15), 0 4px 12px -2px rgba(0, 0, 0, 0.08);
  --shadow-card: 0 4px 24px -4px rgba(11, 17, 33, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

[data-theme="dark"] {
  --bg-primary: #060a14;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-secondary: #0d1424;
  --bg-glass: rgba(17, 24, 39, 0.92);
  --bg-page: #060a14;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-on-dark: #cbd5e1;
  --text-heading-on-dark: #f1f5f9;
  --border-color: #1e293b;
  --border-light: #111827;

  --primary-light: rgba(99, 102, 241, 0.2);
  --success-light: rgba(16, 185, 129, 0.2);
  --danger-light: rgba(239, 68, 68, 0.2);
  --warning-light: rgba(245, 158, 11, 0.2);
  --info-light: rgba(6, 182, 212, 0.2);

  --kid1-light: rgba(59, 130, 246, 0.15);
  --kid1-border: rgba(59, 130, 246, 0.4);

  --kid2-light: rgba(16, 185, 129, 0.15);
  --kid2-border: rgba(16, 185, 129, 0.4);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);
  --shadow-card: 0 4px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-page, var(--bg-primary));
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 50% 30% at 0% 100%, rgba(99, 102, 241, 0.06) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ===== App container: light text on dark bg ===== */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  color: #e2e8f0;
}
/* White cards reset text to dark */
.app-container .card,
.app-container .kid-card,
.app-container .modal-card,
.app-container .piggy-highlight-card,
.app-container .admin-login-card {
  color: var(--text-primary);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(15, 23, 42, 0.95) 50%, rgba(16, 185, 129, 0.08) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-icon {
  font-size: 2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fef08a, #f59e0b);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.25);
}

.bounce-anim {
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.app-title {
  font-size: 1.45rem;
  font-weight: 800;
  background: linear-gradient(135deg, #4f46e5 0%, #9333ea 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.admin-header .app-title {
  background: linear-gradient(135deg, #0284c7 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-subtitle {
  font-size: 0.85rem;
  color: rgba(226, 232, 240, 0.7);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

a.btn {
  text-decoration: none;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-main);
  font-size: 0.925rem;
  font-weight: 600;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background: var(--border-color);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.btn-warning {
  background: var(--warning);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}
.btn-warning:hover {
  background: #d97706;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}
.btn-outline:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
}

.btn-danger-outline {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger-outline:hover {
  background: var(--danger-light);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.825rem;
  border-radius: var(--radius-sm);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  background: var(--bg-secondary);
}

/* ==========================================================================
   SILENT MORNING INTEREST BANNER
   ========================================================================== */
.interest-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), rgba(16, 185, 129, 0.12));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  animation: slideDown 0.35s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.interest-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.interest-banner-icon {
  font-size: 1.4rem;
}
.interest-banner-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.banner-close-btn {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

/* ==========================================================================
   ADMIN SUMMARY STRIP (TOP OF ADMIN PAGE)
   ========================================================================== */
.admin-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.summary-kid-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.summary-kid-card.kid-0 {
  border-left: 6px solid var(--kid1-accent);
}
.summary-kid-card.kid-1 {
  border-left: 6px solid var(--kid2-accent);
}

.summary-kid-avatar {
  font-size: 2.2rem;
  line-height: 1;
}

.summary-kid-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.summary-kid-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
}
.summary-kid-name span {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.summary-kid-points {
  font-size: 0.9rem;
  color: var(--text-secondary);
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
.summary-kid-points strong {
  color: var(--primary);
  font-size: 1.1rem;
}

.summary-interest-hint {
  font-size: 0.8rem;
  font-weight: 700;
  color: #b45309;
  background: var(--warning-light);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
}

[data-theme="dark"] .summary-interest-hint {
  color: #fde68a;
}

/* ==========================================================================
   PENDING REDEMPTION REQUESTS (IN ADMIN)
   ========================================================================== */
.pending-requests-card {
  border: 2px solid var(--warning);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(79, 70, 229, 0.04));
}

.pending-header-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  background: var(--warning);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.pending-requests-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pending-request-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  gap: 1rem;
  flex-wrap: wrap;
}

.pending-req-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.pending-req-avatar {
  font-size: 2rem;
}

.pending-reward-highlight {
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
}

.pending-req-meta {
  font-size: 0.825rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.pending-req-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* ==========================================================================
   HEO ĐẤT HIGHLIGHT CARD (TRANG TRẺ)
   ========================================================================== */
.piggy-highlight-card {
  background: var(--bg-surface);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card, var(--shadow-sm));
}

.piggy-highlight-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.piggy-icon-large {
  font-size: 3.5rem;
  line-height: 1;
  flex-shrink: 0;
  animation: floatIcon 3s ease-in-out infinite;
}

.piggy-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.piggy-desc {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
}

.highlight-orange {
  color: #d97706;
  font-size: 1.15rem;
  font-weight: 800;
}

.piggy-sub-note {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   KID PROFILE CARDS (2 TRẺ)
   ========================================================================== */
.section-title-wrap {
  margin-bottom: 1.25rem;
}

.section-heading {
  font-size: 1.45rem;
  font-weight: 800;
  color: #ffffff;
}

.section-sub {
  font-size: 0.9rem;
  color: rgba(226, 232, 240, 0.7);
  margin-top: 0.25rem;
}

.text-center {
  text-align: center;
}

.kids-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.kid-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card, var(--shadow-md));
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.kid-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--kid-theme-color, var(--primary)), rgba(99, 102, 241, 0.3));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.kid-card.kid-0 {
  --kid-theme-color: var(--kid1-accent);
}
.kid-card.kid-1 {
  --kid-theme-color: var(--kid2-accent);
}

.kid-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(99, 102, 241, 0.08);
}

.kid-card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.kid-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.25rem;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

.kid-info-meta {
  flex-grow: 1;
}

.kid-name {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-primary);
}

.kid-nickname {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.kid-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  background: var(--kid-theme-color);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-top: 0.35rem;
  text-transform: uppercase;
}

/* Points Display */
.kid-points-display {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  background: var(--bg-secondary);
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--border-color);
}

.balance-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.balance-val-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.balance-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--kid-theme-color);
  line-height: 1;
}

.balance-unit {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

/* Progress */
.kid-exp-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.exp-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.exp-progress-track {
  height: 8px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.exp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--kid-theme-color), #818cf8);
  border-radius: var(--radius-full);
  transition: width 0.5s ease;
}

.kid-interest-tag {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.825rem;
  padding: 0.5rem 0.75rem;
  background: var(--warning-light);
  border: 1px dashed rgba(245, 158, 11, 0.4);
  border-radius: var(--radius-sm);
  color: #b45309;
  font-weight: 600;
}

[data-theme="dark"] .kid-interest-tag {
  color: #fde68a;
}

/* ==========================================================================
   TABS NAVIGATION
   ========================================================================== */
.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.25rem;
  overflow-x: auto;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   CARDS & COMMON LAYOUTS
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card, var(--shadow-sm));
  margin-bottom: 1.25rem;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

.helper-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.badge-warning {
  background: var(--warning-light);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-success {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

textarea {
  font-family: monospace;
  font-size: 0.85rem;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  width: 100%;
  resize: vertical;
  line-height: 1.4;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ==========================================================================
   KID SELECTOR CHIPS
   ========================================================================== */
.kid-selector-chips {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.kid-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.15rem;
  background: var(--bg-surface);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.kid-chip-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.kid-chip-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.kid-chip-btn.chip-kid-0.active {
  border-color: var(--kid1-accent);
  background: var(--kid1-light);
  color: var(--kid1-accent);
}

.kid-chip-btn.chip-kid-1.active {
  border-color: var(--kid2-accent);
  background: var(--kid2-light);
  color: var(--kid2-accent);
}

.kid-selector-chips.mini .kid-chip-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

/* ==========================================================================
   FORMS & PRESETS
   ========================================================================== */
.custom-point-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.flex-grow {
  flex: 1 1 300px;
}

.form-group.point-input-group {
  flex: 0 1 180px;
}

.form-group.flex-1 {
  flex: 1;
}

label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
input[type="password"],
select {
  font-family: var(--font-main);
  font-size: 0.95rem;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.point-stepper,
.input-with-unit {
  display: flex;
  align-items: center;
  position: relative;
}

.point-stepper input,
.input-with-unit input {
  padding-right: 3.5rem;
  width: 100%;
}

.point-unit,
.unit {
  position: absolute;
  right: 0.85rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  pointer-events: none;
}

.form-actions-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.flex-btn {
  flex: 1;
  padding: 0.85rem 1.25rem;
  font-size: 1rem;
}

/* Preset Categories */
.presets-categories {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.preset-category {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.category-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-primary);
}

.preset-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.preset-chip:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
}

.preset-chip.positive:hover {
  border-color: var(--success);
  color: var(--success);
}

.preset-chip.negative:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.preset-chip-points {
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
}

.preset-chip.positive .preset-chip-points {
  background: var(--success-light);
  color: var(--success);
}

.preset-chip.negative .preset-chip-points {
  background: var(--danger-light);
  color: var(--danger);
}

/* Quick Presets Management */
.presets-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.preset-chip-wrapper {
  position: relative;
  display: inline-flex;
}

.preset-delete-btn {
  display: none;
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger, #ef4444);
  color: #fff;
  border: 2px solid var(--bg-surface, #fff);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  z-index: 2;
  transition: transform 0.15s ease;
}

.preset-delete-btn:hover {
  transform: scale(1.2);
  background: #dc2626;
}

.manage-mode-active .preset-delete-btn {
  display: flex;
  animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.manage-mode-active .preset-chip {
  animation: shakeSubtle 2.5s ease-in-out infinite;
}

@keyframes shakeSubtle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-0.7deg); }
  75% { transform: rotate(0.7deg); }
}

@keyframes popIn {
  0% { transform: scale(0); }
  80% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   REWARDS GRID
   ========================================================================== */
.reward-for-kid-filter {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.15rem;
}

.reward-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.reward-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.reward-card.affordable {
  border-color: var(--success);
  background: linear-gradient(180deg, var(--bg-surface) 0%, rgba(16, 185, 129, 0.04) 100%);
}

.reward-top {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.reward-icon {
  font-size: 2.2rem;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.reward-details {
  flex-grow: 1;
}

.reward-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.reward-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.reward-cost-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  background: var(--warning-light);
  color: #b45309;
  font-size: 0.8rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  margin-top: 0.4rem;
}

[data-theme="dark"] .reward-cost-tag {
  color: #fde68a;
}

.reward-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.85rem;
}

.locked-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.locked-hint strong {
  color: var(--warning);
}

.delete-reward-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
}
.delete-reward-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* ==========================================================================
   HISTORY TABLE
   ========================================================================== */
.history-controls {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.history-table th {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.history-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.history-table tr:hover td {
  background: var(--bg-secondary);
}

.text-right {
  text-align: right;
}

.point-delta {
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
}

.point-delta.positive {
  background: var(--success-light);
  color: var(--success);
}

.point-delta.negative {
  background: var(--danger-light);
  color: var(--danger);
}

.point-delta.interest {
  background: var(--warning-light);
  color: #b45309;
}

.point-delta.redeem {
  background: var(--primary-light);
  color: var(--primary);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  gap: 0.5rem;
  font-size: 1rem;
}
.empty-state span {
  font-size: 2.5rem;
}

/* ==========================================================================
   ADMIN FIELDSETS & PREVIEWS
   ========================================================================== */
.admin-fieldset {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.admin-fieldset legend {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
  padding: 0 0.5rem;
}

.admin-info-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.custom-checkbox {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.custom-checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.kids-interest-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.kid-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.kid-preview-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.kid-preview-avatar { font-size: 1.6rem; }
.kid-preview-name { font-size: 0.95rem; font-weight: 700; }
.kid-preview-calc { font-size: 0.8rem; color: var(--text-secondary); }
.kid-preview-reward {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--success);
}

.edit-kids-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edit-kid-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 0.75rem;
  border-radius: var(--radius-md);
}

.edit-kid-avatar-select {
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  text-align: center;
  padding: 0;
}

.backup-actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.file-input-label { cursor: pointer; margin: 0; }
.hidden-file-input { display: none; }

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--danger);
  border-radius: var(--radius-md);
  background: var(--danger-light);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================================
   PIN MODAL & WISHLIST MODAL
   ========================================================================== */
.pin-input-wrap input {
  font-size: 1.75rem;
  text-align: center;
  letter-spacing: 0.3em;
  padding: 0.5rem;
  max-width: 220px;
  margin: 0.5rem auto;
}

.pin-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.wish-prompt-note {
  font-size: 0.825rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
}

/* ==========================================================================
   MODALS & TOASTS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-backdrop.hidden { display: none; }

.modal-card {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}

.modal-card.mini { max-width: 420px; }

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-secondary);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-footer.flex-center { justify-content: center; }

.redeem-modal-icon { font-size: 3.5rem; margin-bottom: 0.5rem; }
.redeem-modal-desc { font-size: 0.9rem; color: var(--text-secondary); }
.redeem-points-badge { font-size: 1.5rem; font-weight: 800; color: var(--danger); margin: 0.75rem 0; }

.toast-container {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  animation: slideInRight 0.25s ease-out;
  min-width: 260px;
  max-width: 400px;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-danger { border-left: 4px solid var(--danger); }
.toast.toast-info { border-left: 4px solid var(--info); }

/* Toast Chat Notification Preview (Hiển thị rõ nội dung tin nhắn mới, có thể bấm vào) */
.toast.toast-chat-preview {
  border-left: 4px solid #4f46e5;
  background: var(--bg-surface);
  cursor: pointer;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18), 0 0 0 1px var(--border-color);
  transition: all 0.2s ease;
  min-width: 280px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.toast.toast-chat-preview:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 14px 35px rgba(79, 70, 229, 0.25), 0 0 0 1px var(--primary);
}

.toast-chat-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-chat-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toast-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.toast-chat-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
}

.toast-chat-badge {
  font-size: 0.65rem;
  font-weight: 800;
  background: var(--primary);
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.toast-chat-msg {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toast-chat-cta {
  font-size: 0.725rem;
  color: var(--primary);
  font-weight: 700;
  margin-top: 0.15rem;
}

/* Utilities */
.hidden { display: none !important; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }

/* Responsive */
@media (max-width: 768px) {
  .app-container { padding: 0.75rem; gap: 1rem; }
  .app-header { flex-direction: column; align-items: stretch; gap: 0.85rem; }
  .header-actions { justify-content: flex-end; }
  .piggy-highlight-inner { flex-direction: column; text-align: center; }
  .kids-grid { grid-template-columns: 1fr; }
  .form-row { flex-direction: column; }
  .form-actions-row { flex-direction: column; }
  .card-header-flex { flex-direction: column; align-items: stretch; }
  .history-controls { flex-direction: column; align-items: stretch; }
  .pending-request-item { flex-direction: column; align-items: stretch; }
  .pending-req-actions { justify-content: flex-end; }
}

/* ==========================================================================
   ADMIN LOGIN SCREEN (BẢO MẬT PHỤ HUYNH)
   ========================================================================== */
.admin-login-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.05);
  text-align: center;
  backdrop-filter: blur(20px);
  animation: fadeIn 0.3s ease-out;
}

.login-lock-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.login-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.pin-input-wrap {
  position: relative;
  margin-bottom: 1.25rem;
}

.pin-input {
  width: 100%;
  text-align: center;
  font-size: 1.75rem;
  letter-spacing: 0.35em;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-weight: 800;
  transition: all var(--transition-fast);
}

.pin-input:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.pin-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

.login-alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.4;
}

.login-alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   QUICK POINT UNIT CHIPS & INPUT ACTION GROUP
   ========================================================================== */
.input-action-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.input-action-group input {
  flex: 1;
}

.input-action-group button {
  white-space: nowrap;
}

.quick-unit-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.quick-unit-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.chip-unit-btn {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-color);
  border-radius: 9999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chip-unit-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.chip-unit-btn:active {
  transform: scale(0.96);
}

/* ==========================================================================
   RESPONSIVE DESIGN & ADAPTIVE COMPACT LAYOUT (MOBILE & PC)
   ========================================================================== */

/* Label switches */
.tab-label-short,
.btn-label-mobile {
  display: none !important;
}
.tab-label-full,
.btn-label-desktop {
  display: inline !important;
}

/* 1. PC & DESKTOP ENHANCEMENTS (min-width: 992px) */
@media (min-width: 992px) {
  .app-container {
    max-width: 1240px;
    padding: 1.5rem 2rem;
  }

  /* 2-Column Workflow for Tab 1: Form on Left, Presets on Right */
  .action-panel-layout {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 1.5rem;
    align-items: start;
  }

  .action-panel-form-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: sticky;
    top: 1.25rem;
  }

  .quick-presets-card {
    height: 100%;
    margin-bottom: 0;
  }

  /* Preset categories 2x2 grid on wide screens */
  .presets-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }

  /* Kid summary cards side by side */
  .admin-summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Rewards grid */
  .rewards-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* 2. TABLET & LAPTOP ADJUSTMENTS (769px to 991px) */
@media (min-width: 769px) and (max-width: 991px) {
  .app-container {
    padding: 1.25rem;
  }

  .action-panel-layout {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .action-panel-form-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .presets-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

/* 3. MOBILE & SMALL TABLET OPTIMIZATIONS (max-width: 768px) */
@media (max-width: 768px) {
  /* Prevent iOS zoom on input focus */
  input[type="text"],
  input[type="number"],
  input[type="password"],
  input[type="time"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Compact container & spacing */
  .app-container {
    padding: 0.65rem 0.65rem 3rem 0.65rem;
    gap: 0.85rem;
  }

  /* Compact Header */
  .app-header {
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
  }

  .brand-section {
    gap: 0.65rem;
  }

  .logo-icon {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    border-radius: var(--radius-sm);
  }

  .app-title {
    font-size: 1.15rem;
    line-height: 1.2;
  }

  .app-subtitle {
    font-size: 0.725rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 200px;
  }

  .header-actions {
    gap: 0.4rem;
  }

  .header-actions .btn {
    padding: 0.4rem 0.7rem;
    font-size: 0.825rem;
    gap: 0.35rem;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  /* Responsive label switching */
  .tab-label-full,
  .btn-label-desktop {
    display: none !important;
  }
  .tab-label-short,
  .btn-label-mobile {
    display: inline !important;
  }

  /* Smooth horizontal scrolling Tabs (Pill style) */
  .tabs-nav {
    display: flex;
    gap: 0.45rem;
    border-bottom: none;
    padding: 0.25rem 0.25rem 0.5rem 0.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
  }

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

  .tab-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.825rem;
    border-radius: var(--radius-full);
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    scroll-snap-align: start;
    box-shadow: var(--shadow-sm);
  }

  .tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px var(--primary-glow);
  }

  .tab-btn:hover {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
  }

  .tab-btn.active:hover {
    background: var(--primary-hover);
  }

  /* Compact Cards */
  .card {
    padding: 0.95rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.85rem;
  }

  .card-header-flex {
    margin-bottom: 0.85rem;
    gap: 0.5rem;
  }

  .card-title {
    font-size: 1.05rem;
  }

  .card-desc {
    font-size: 0.8rem;
  }

  /* Admin Summary Strip */
  .admin-summary-strip {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .summary-kid-card {
    padding: 0.65rem 0.9rem;
    gap: 0.75rem;
  }

  .summary-kid-avatar {
    font-size: 1.85rem;
  }

  .summary-kid-name {
    font-size: 0.95rem;
  }

  .summary-kid-points {
    font-size: 0.825rem;
    gap: 0.5rem;
  }

  .summary-kid-points strong {
    font-size: 1rem;
  }

  /* Kid Selector Chips */
  .kid-selector-chips {
    gap: 0.5rem;
  }

  .kid-chip-btn {
    padding: 0.45rem 0.8rem;
    font-size: 0.825rem;
    flex: 1 1 calc(50% - 0.5rem);
    justify-content: center;
  }

  /* Form and Actions */
  .form-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-group.flex-grow,
  .form-group.point-input-group,
  .form-group.flex-1 {
    flex: auto;
    width: 100%;
  }

  .form-actions-row {
    flex-direction: column;
    gap: 0.6rem;
  }

  .flex-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    min-height: 46px;
  }

  /* Preset Categories & Chips */
  .presets-categories {
    gap: 0.85rem;
  }

  .preset-category {
    gap: 0.45rem;
  }

  .category-title {
    font-size: 0.875rem;
  }

  .preset-chips-grid {
    gap: 0.45rem;
  }

  .preset-chip {
    padding: 0.4rem 0.75rem;
    font-size: 0.825rem;
    min-height: 36px;
  }

  .presets-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  /* Kid Cards (index.php) */
  .kids-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .kid-card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .kid-card-header {
    gap: 0.75rem;
    margin-bottom: 0.85rem;
  }

  .kid-avatar {
    width: 52px;
    height: 52px;
    font-size: 1.85rem;
  }

  .kid-name {
    font-size: 1.15rem;
  }

  .kid-points-display {
    padding: 0.65rem 0.95rem;
    margin-bottom: 0.75rem;
  }

  .balance-number {
    font-size: 1.75rem;
  }

  /* Piggy card */
  .piggy-highlight-card {
    padding: 0.95rem;
  }

  .piggy-highlight-inner {
    gap: 0.75rem;
  }

  .piggy-icon-large {
    font-size: 2.25rem;
  }

  .piggy-title {
    font-size: 1rem;
  }

  .piggy-desc {
    font-size: 0.825rem;
  }

  /* Rewards Grid */
  .rewards-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .reward-card {
    padding: 0.85rem;
  }

  .reward-top {
    gap: 0.65rem;
    margin-bottom: 0.65rem;
  }

  .reward-icon {
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
  }

  .reward-title {
    font-size: 0.95rem;
  }

  .reward-desc {
    font-size: 0.775rem;
  }

  .reward-cost-tag {
    font-size: 0.775rem;
    padding: 0.15rem 0.45rem;
  }

  .reward-bottom {
    padding-top: 0.65rem;
  }

  .reward-bottom .btn {
    width: 100%;
    min-height: 42px;
  }

  /* Quick unit chips in Tab 4 */
  .input-action-group {
    flex-direction: column;
    align-items: stretch;
  }

  .chip-unit-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
  }

  /* Modals */
  .modal-backdrop {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .modal-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    padding: 1.25rem !important;
    margin: 0 !important;
    animation: slideUpModal 0.25s ease-out;
  }

  @keyframes slideUpModal {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Toasts */
  .toast-container {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .toast {
    max-width: 100%;
    width: 100%;
  }

  /* Edit kids form in Tab 4 */
  .edit-kid-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .edit-kid-row .form-group {
    flex: 1 1 100%;
  }
}

/* 4. HISTORY TABLE ADAPTIVE CARD VIEW (max-width: 640px) */
@media (max-width: 640px) {
  .table-responsive {
    border: none;
    overflow: visible;
    background: transparent;
  }

  .history-table {
    display: block;
    width: 100%;
  }

  .history-table thead {
    display: none;
  }

  .history-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    width: 100%;
  }

  .history-table tr.history-item-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "time kid"
      "task task"
      "delta action";
    gap: 0.35rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.85rem;
    box-shadow: var(--shadow-sm);
    align-items: center;
  }

  .history-table td {
    padding: 0 !important;
    border: none !important;
  }

  .history-table td.col-time {
    grid-area: time;
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  .history-table td.col-kid {
    grid-area: kid;
    text-align: right;
    font-size: 0.85rem;
  }

  .history-table td.col-task {
    grid-area: task;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0.2rem 0 !important;
    word-break: break-word;
  }

  .history-table td.col-delta {
    grid-area: delta;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .history-table td.col-balance {
    display: none;
  }

  .history-table td.col-action {
    grid-area: action;
    text-align: right;
  }

  .history-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 0.5rem;
  }

  .history-controls select,
  .history-controls button {
    width: 100%;
  }
}

/* ==========================================================================
   KID 2-WAY CHAT WIDGET & FLOATING BUTTON (TELEGRAM INTEGRATED)
   ========================================================================== */
.chat-floating-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 990;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
  transition: all var(--transition-fast);
  user-select: none;
}

.chat-floating-btn:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 12px 30px rgba(79, 70, 229, 0.55);
}

.chat-floating-btn:active {
  transform: scale(0.96);
}

.chat-bubble-icon {
  font-size: 1.35rem;
  line-height: 1;
  animation: pulseBubble 2.5s infinite;
}

@keyframes pulseBubble {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.chat-unread-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Chat Widget Window */
.chat-widget-box {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  width: 380px;
  max-width: calc(100vw - 2rem);
  height: 520px;
  max-height: calc(100vh - 7rem);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl), 0 20px 40px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideInUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-widget-header {
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-surface) 100%);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.chat-header-avatar {
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  border-radius: 50%;
}

.chat-header-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.chat-header-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.chat-close-btn {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.chat-close-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.chat-kid-selector {
  display: flex;
  padding: 0.5rem 0.75rem;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}

.chat-kid-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 700;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-kid-tab.active-kid-0 {
  border-color: var(--kid1-accent);
  background: var(--kid1-light);
  color: var(--kid1-accent);
}

.chat-kid-tab.active-kid-1 {
  border-color: var(--kid2-accent);
  background: var(--kid2-light);
  color: var(--kid2-accent);
}

/* Messages Area */
.chat-messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--bg-primary);
}

.chat-bubble-row {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: fadeIn 0.2s ease-out;
}

.chat-bubble-row.kid {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-bubble-row.parent {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble-sender {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
  padding: 0 0.35rem;
}

.chat-bubble-content {
  padding: 0.65rem 0.95rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.chat-bubble-row.kid .chat-bubble-content {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-bubble-row.kid.kid-0 .chat-bubble-content {
  background: var(--kid1-accent);
}

.chat-bubble-row.kid.kid-1 .chat-bubble-content {
  background: var(--kid2-accent);
}

.chat-bubble-row.kid.kid-0 .chat-bubble-sender {
  color: var(--kid1-accent);
  font-weight: 700;
}

.chat-bubble-row.kid.kid-1 .chat-bubble-sender {
  color: var(--kid2-accent);
  font-weight: 700;
}

.chat-bubble-row.parent .chat-bubble-content {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
}

.chat-bubble-row.parent .chat-bubble-sender {
  color: #f59e0b;
  font-weight: 800;
}

/* Sender Selector Bar (above input) */
.chat-sender-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
}

.chat-sender-label {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.chat-sender-chips {
  display: flex;
  gap: 0.4rem;
  flex: 1;
}

.chat-sender-chip {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chat-sender-chip.active-kid-0 {
  border-color: var(--kid1-accent);
  background: var(--kid1-light);
  color: var(--kid1-accent);
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.chat-sender-chip.active-kid-1 {
  border-color: var(--kid2-accent);
  background: var(--kid2-light);
  color: var(--kid2-accent);
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
}

.chat-bubble-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  padding: 0 0.35rem;
}

.chat-empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-secondary);
  padding: 1.5rem;
  font-size: 0.875rem;
}
.chat-empty-state span {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* Input Bar */
.chat-widget-input-bar {
  padding: 0.75rem 0.85rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.chat-widget-input-bar input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.chat-widget-input-bar input:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50% !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.15rem;
}

/* Media Chat & Lightbox Styles */
.chat-media-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.chat-media-btn:hover {
  background: var(--primary-glow);
  border-color: var(--primary);
  transform: scale(1.08);
}

.chat-media-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg-secondary);
  border-top: 1px dashed var(--border-color);
  font-size: 0.8rem;
}

.chat-media-preview-thumb {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border-color);
  background: #000;
}

.chat-media-preview-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-media-preview-name {
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.775rem;
}

.chat-media-preview-size {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.chat-media-preview-remove {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

.chat-media-preview-remove:hover {
  background: #ef4444;
  color: #fff;
}

/* Chat Media Bubbles */
.chat-media-container {
  margin-bottom: 0.35rem;
}

.chat-media-img {
  max-width: 240px;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: 12px;
  object-fit: cover;
  cursor: pointer;
  display: block;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.chat-media-img:hover {
  transform: scale(1.02);
  filter: brightness(1.05);
}

.chat-media-video {
  max-width: 240px;
  max-height: 220px;
  width: 100%;
  border-radius: 12px;
  display: block;
  background: #000;
}

.chat-media-audio {
  max-width: 250px;
  width: 100%;
  height: 38px;
  border-radius: 20px;
  outline: none;
  display: block;
}

/* File Attachment Card */
.chat-file-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  text-decoration: none !important;
  color: inherit !important;
  max-width: 260px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.chat-bubble-row.parent .chat-file-card {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .chat-bubble-row.parent .chat-file-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.chat-file-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: rgba(255, 255, 255, 0.3);
}

.chat-file-icon {
  font-size: 1.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.chat-file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-file-name {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.chat-file-action {
  font-size: 0.725rem;
  opacity: 0.85;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chat-media-caption {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  line-height: 1.4;
  word-break: break-word;
}

/* Lightbox Modal */
.chat-lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1.5rem;
  animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.chat-lightbox-content {
  position: relative;
  max-width: 92vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chat-lightbox-content img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

.chat-lightbox-close {
  position: absolute;
  top: -2.5rem;
  right: -0.5rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chat-lightbox-close:hover {
  background: #ef4444;
  border-color: #ef4444;
}

/* Responsive Mobile Chat */
@media (max-width: 640px) {
  .chat-floating-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
  }

  .toast-container {
    bottom: 4.8rem;
    right: 1rem;
    left: 1rem;
    align-items: flex-end;
  }

  .chat-widget-box {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 82vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
  }

  .chat-media-img,
  .chat-media-video {
    max-width: 200px;
    max-height: 180px;
  }
}

/* ============================================================================
   BÉ BÁO CÁO VIỆC TỐT & PHỤ HUYNH DUYỆT ĐIỂM (GOOD DEED SUBMISSIONS)
   ============================================================================ */

.good-deed-section {
  position: relative;
  background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(99, 102, 241, 0.04) 100%);
  border: 2px solid rgba(99, 102, 241, 0.18);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
}

.good-deed-badge-top {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Toggle Cộng/Trừ điểm */
.deed-type-toggle {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.deed-type-btn {
  flex: 1;
  min-width: 140px;
  padding: 0.65rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
}
.deed-type-btn.active {
  border-color: #22c55e;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
  box-shadow: 0 3px 12px rgba(34, 197, 94, 0.35);
}
.deed-type-btn.deed-type-deduct.active {
  border-color: #ef4444;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  box-shadow: 0 3px 12px rgba(239, 68, 68, 0.35);
}
.deed-type-btn:hover:not(.active) {
  border-color: var(--text-muted);
  background: var(--bg-tertiary);
}

.good-deed-form-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1rem;
}

.form-label-cute {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.good-deed-kid-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.good-deed-kid-chip:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.good-deed-kid-chip.active-kid-0 {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.good-deed-kid-chip.active-kid-1 {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  border-color: #ec4899;
  color: #fff;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.35);
}

.good-deed-input {
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
}

.good-deed-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.quick-chip-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.quick-chip-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.good-deed-points-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.points-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.points-number-input {
  width: 90px;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
  color: var(--primary);
  padding: 0.5rem;
}

.points-unit-suffix {
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.points-preset-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.btn-pts-preset {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-pts-preset:hover {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
  transform: scale(1.05);
}

.good-deed-submit-row {
  margin-top: 1rem;
}

.pulse-btn {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: none;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
  transition: all 0.25s ease;
}

.pulse-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.55);
}

/* Danh sách tiến độ việc tốt của bé */
.good-deed-submissions-wrap {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 2px dashed var(--border-color);
}

.submissions-list-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.submissions-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.submission-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.submission-item.status-pending {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.03);
}

.submission-item.status-approved {
  border-left: 4px solid #10b981;
  background: rgba(16, 185, 129, 0.03);
}

.submission-item.status-rejected {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.03);
}

.sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sub-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.submission-badge {
  font-size: 0.775rem;
  font-weight: 800;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.submission-badge.badge-pending {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.submission-badge.badge-approved {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.submission-badge.badge-rejected {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.sub-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sub-admin-note {
  color: #4f46e5;
  font-weight: 600;
}

.good-deed-empty-state {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.good-deed-empty-state .empty-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* Admin Pending Submissions */
.pending-submission-item {
  border-left: 4px solid #f59e0b !important;
}

.pending-pts-edit-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.5rem;
}

@media (max-width: 640px) {
  .good-deed-points-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
  
  .pending-submission-item .pending-req-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .pending-pts-edit-wrap {
    justify-content: space-between;
    margin-right: 0;
    margin-bottom: 0.25rem;
  }
}

/* Badge quà đang chờ Bố Mẹ cấp */
.reward-pending-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.75rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 191, 36, 0.1) 100%);
  color: #b45309;
  border: 1px dashed #f59e0b;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  animation: pulseSubtle 2s infinite ease-in-out;
}

[data-theme="dark"] .reward-pending-badge {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border-color: #d97706;
}

@keyframes pulseSubtle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(0.99); }
}

/* ==========================================================================
/* ==========================================================================
   LỊCH SỬ ĐỔI QUÀ VÀ TIẾN ĐỘ TRAO QUÀ CỦA BÉ (GỌN GÀNG & THU GỌN)
   ========================================================================== */
.kid-reward-history-section {
  position: relative;
}

.rh-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.rh-header-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.rh-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.rh-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 700;
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.rh-controls-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Bộ lọc trạng thái: Tất cả / Chờ cấp / Đã nhận */
.rh-status-filter-pills {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.04));
  padding: 3px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  gap: 3px;
}

.rh-filter-pill {
  border: none;
  background: transparent;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.rh-filter-pill:hover {
  color: var(--text-primary);
}

.rh-filter-pill.active {
  background: var(--bg-surface, #fff);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.rh-filter-pill.pill-pending.active {
  background: #fef3c7;
  color: #b45309;
}

.rh-filter-pill.pill-fulfilled.active {
  background: #d1fae5;
  color: #065f46;
}

[data-theme="dark"] .rh-filter-pill.active {
  background: var(--bg-surface-alt);
  color: var(--text-primary);
}

[data-theme="dark"] .rh-filter-pill.pill-pending.active {
  background: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

[data-theme="dark"] .rh-filter-pill.pill-fulfilled.active {
  background: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

/* Danh sách cuộn mượt mà, chiều cao tối đa không làm vỡ trang */
.reward-history-list.compact {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 2px;
}

.reward-history-list.compact::-webkit-scrollbar {
  width: 5px;
}

.reward-history-list.compact::-webkit-scrollbar-track {
  background: transparent;
}

.reward-history-list.compact::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

/* Thẻ quà gọn gàng (Single sleek card) */
.reward-history-item.compact {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all var(--transition-fast);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.reward-history-item.compact:hover {
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.reward-history-item.compact.status-pending {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(to right, rgba(245, 158, 11, 0.04), var(--bg-surface));
}

.reward-history-item.compact.status-fulfilled {
  border-left: 4px solid #10b981;
  background: linear-gradient(to right, rgba(16, 185, 129, 0.04), var(--bg-surface));
}

.reward-history-item.compact.status-rejected {
  border-left: 4px solid #94a3b8;
  background: linear-gradient(to right, rgba(148, 163, 184, 0.04), var(--bg-surface));
  opacity: 0.88;
}

.rh-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rh-compact-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 220px;
}

.rh-icon-circle {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--bg-surface-alt, #f3f4f6);
  border: 1px solid var(--border-color);
}

.reward-history-item.compact.status-pending .rh-icon-circle {
  background: #fef3c7;
  border-color: #fde68a;
}

.reward-history-item.compact.status-fulfilled .rh-icon-circle {
  background: #d1fae5;
  border-color: #a7f3d0;
}

.rh-compact-texts {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.rh-compact-title-line {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.rh-compact-name {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.rh-compact-kid {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.04));
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

.rh-compact-subline {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.rh-compact-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rh-points-badge.mini {
  font-size: 0.775rem;
  font-weight: 800;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
}

.rh-status-badge.mini {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.rh-status-badge.mini.badge-pending {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  animation: pulseSubtle 2.5s infinite ease-in-out;
}

.rh-status-badge.mini.badge-fulfilled {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.rh-status-badge.mini.badge-rejected {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

[data-theme="dark"] .rh-status-badge.mini.badge-pending {
  background: rgba(245, 158, 11, 0.25);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

[data-theme="dark"] .rh-status-badge.mini.badge-fulfilled {
  background: rgba(16, 185, 129, 0.25);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.4);
}

[data-theme="dark"] .rh-status-badge.mini.badge-rejected {
  background: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.35);
}

.rh-compact-hint {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.25rem 0.6rem;
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.02));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.rh-expand-box {
  margin-top: 0.75rem;
  text-align: center;
}

.rh-expand-btn {
  padding: 0.4rem 1.25rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.8rem;
  transition: all var(--transition-fast);
}

.rh-expand-btn:hover {
  transform: translateY(-1px);
}

.reward-history-empty-state.compact {
  text-align: center;
  padding: 1.75rem 1rem;
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.02));
  border: 1.5px dashed var(--border-color);
  border-radius: var(--radius-md);
}

.reward-history-empty-state.compact .empty-icon {
  font-size: 1.75rem;
  display: block;
  margin-bottom: 0.35rem;
}

.reward-history-empty-state.compact p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.4;
}

/* ==========================================================================
   HỆ THỐNG DANH HIỆU 18 CẤP BẬC (CHUẨN VIOEDU) & ROADMAP MODAL
   ========================================================================== */

.kid-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kid-avatar-medal {
  position: absolute;
  bottom: -4px;
  right: -6px;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.kid-avatar-medal:hover {
  transform: scale(1.15) rotate(5deg);
}

.kid-rank-badge-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

/* VioEdu Style Rank Pill */
.vio-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.vio-rank-pill:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.vio-rank-pill.mini {
  padding: 0.12rem 0.45rem;
  font-size: 0.68rem;
  gap: 0.2rem;
}

.vio-rank-pill .vio-rank-text {
  color: #ffffff;
  font-weight: 800;
}

.vio-rank-pill .vio-rank-stars {
  color: #facc15;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.vio-rank-pill .vio-rank-lv {
  background: rgba(0, 0, 0, 0.35);
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  color: #e2e8f0;
  font-weight: 700;
}

/* Tier Colors */
.vio-rank-pill.tier-starter {
  background: linear-gradient(135deg, #065f46, #064e3b);
  border: 1px solid #10b981;
}

.vio-rank-pill.tier-newbie {
  background: linear-gradient(135deg, #4d280e, #2a1406);
  border: 1px solid #784212;
}

.vio-rank-pill.tier-junior {
  background: linear-gradient(135deg, #5c2414, #381208);
  border: 1px solid #9a3412;
}

.vio-rank-pill.tier-senior {
  background: linear-gradient(135deg, #334155, #1e293b);
  border: 1px solid #64748b;
}

.vio-rank-pill.tier-expert {
  background: linear-gradient(135deg, #5c4309, #362604);
  border: 1px solid #b45309;
}

.vio-rank-pill.tier-master {
  background: linear-gradient(135deg, #5c1020, #360711);
  border: 1px solid #e11d48;
}

.vio-rank-pill.tier-legend {
  background: linear-gradient(135deg, #441641, #250a23);
  border: 1px solid #a855f7;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

/* Button to open rank roadmap */
.btn-rank-roadmap-link {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-rank-roadmap-link:hover {
  background: var(--primary-light, #e0e7ff);
  color: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
  transform: translateY(-1px);
}

/* Tier Progress Fills */
.exp-progress-fill.tier-fill-starter {
  background: linear-gradient(90deg, #059669, #10b981);
}
.exp-progress-fill.tier-fill-newbie {
  background: linear-gradient(90deg, #854d0e, #d97706);
}
.exp-progress-fill.tier-fill-junior {
  background: linear-gradient(90deg, #ea580c, #f97316);
}
.exp-progress-fill.tier-fill-senior {
  background: linear-gradient(90deg, #475569, #94a3b8);
}
.exp-progress-fill.tier-fill-expert {
  background: linear-gradient(90deg, #ca8a04, #facc15);
}
.exp-progress-fill.tier-fill-master {
  background: linear-gradient(90deg, #e11d48, #fb7185);
}
.exp-progress-fill.tier-fill-legend {
  background: linear-gradient(90deg, #9333ea, #c084fc);
  box-shadow: 0 0 8px rgba(147, 51, 234, 0.5);
}

/* Modal: Bảng Thang Điểm Danh Hiệu */
.rank-roadmap-card {
  max-width: 840px !important;
  width: 95% !important;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  border-radius: var(--radius-lg) !important;
  overflow: visible;
  overflow-y: auto;
}

.rank-modal-header {
  background: linear-gradient(135deg, #5ea236, #488427);
  color: #ffffff;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: none;
}

.rank-modal-header-text {
  flex: 1;
}

.rank-modal-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.rank-modal-header .modal-title {
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 0.35rem 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.rank-modal-subtitle {
  color: rgba(255, 255, 255, 0.95);
  font-size: 0.85rem;
  line-height: 1.45;
  margin: 0;
  max-width: 700px;
}

.rank-modal-header .modal-close-btn {
  color: #ffffff;
  background: rgba(0, 0, 0, 0.15);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rank-modal-header .modal-close-btn:hover {
  background: rgba(0, 0, 0, 0.3);
  transform: scale(1.05);
}

.rank-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Kid Switcher in Modal */
.rank-modal-kid-switcher {
  background: var(--bg-secondary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.rank-switcher-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.rank-switcher-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.rank-kid-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--bg-primary);
  border: 1.5px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.825rem;
  color: var(--text-primary);
}

.rank-kid-pill:hover {
  border-color: var(--primary);
}

.rank-kid-pill.active {
  background: var(--primary-light, #e0e7ff);
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.rank-kid-pill .rank-kid-avatar {
  font-size: 1.1rem;
}

/* Current Status Banner */
.current-rank-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.current-rank-avatar-col {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.current-rank-avatar {
  font-size: 2.75rem;
  width: 68px;
  height: 68px;
  background: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
}

.current-rank-medal {
  position: absolute;
  bottom: -6px;
  right: -8px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.current-rank-info-col {
  flex: 1;
}

.current-rank-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.6rem;
}

.current-rank-kid-name {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

.current-rank-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}

.rank-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.rank-stat-item.full-width {
  grid-column: 1 / -1;
  margin-top: 0.25rem;
}

.rank-stat-item .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
}

.rank-stat-item .stat-value {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.rank-stat-item .stat-value.text-accent {
  color: #e11d48;
}

.rank-modal-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rank-modal-progress-bar {
  height: 9px;
  background: var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.rank-modal-progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

.rank-modal-progress-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Roadmap Table matching screenshot */
.rank-table-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.rank-roadmap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.rank-roadmap-table thead {
  background: #689f38;
  color: #ffffff;
}

.rank-roadmap-table th {
  padding: 0.75rem 1rem;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.2px;
  border: none;
}

.rank-roadmap-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.rank-roadmap-table tbody tr:last-child td {
  border-bottom: none;
}

.rank-roadmap-table tbody tr:nth-child(even) {
  background: var(--bg-surface-alt, rgba(0, 0, 0, 0.015));
}

.rank-roadmap-table tbody tr:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.035));
}

/* Current row highlight */
.rank-roadmap-table tr.rank-row-current {
  background: rgba(245, 158, 11, 0.12) !important;
  box-shadow: inset 3px 0 0 #f59e0b;
}

.rank-roadmap-table tr.rank-row-next {
  background: rgba(79, 70, 229, 0.04);
}

.rank-roadmap-table tr.rank-row-locked {
  opacity: 0.75;
}

.level-badge-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-secondary);
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.level-badge-num.active {
  background: #f59e0b;
  color: #ffffff;
  box-shadow: 0 2px 5px rgba(245, 158, 11, 0.4);
}

.col-level {
  text-align: center;
  font-weight: 700;
}

.col-name {
  text-align: center;
}

.col-medal {
  text-align: center;
}

.col-points {
  text-align: right;
  white-space: nowrap;
}

.points-req-num {
  font-size: 1rem;
  font-weight: 800;
  color: #dc2626;
}

.points-req-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-left: 0.2rem;
}

.col-status {
  text-align: center;
  white-space: nowrap;
}

.rank-status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.rank-status-badge.current {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-weight: 800;
}

.rank-status-badge.next {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.rank-status-badge.unlocked {
  background: #d1fae5;
  color: #065f46;
}

.rank-status-badge.locked {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

/* Responsive Table in Modal */
@media (max-width: 640px) {
  .rank-modal-header {
    padding: 1rem;
  }
  .rank-modal-body {
    padding: 1rem;
    gap: 1rem;
  }
  .rank-modal-header .modal-title {
    font-size: 1.15rem;
  }
  .rank-modal-subtitle {
    font-size: 0.78rem;
  }
  .current-rank-card {
    flex-direction: column;
    text-align: center;
  }
  .current-rank-name-row {
    justify-content: center;
  }
  .rank-table-wrap {
    overflow-x: auto;
  }
  .rank-roadmap-table {
    min-width: 540px;
  }
}


/* ==========================================================================
   ĐIỂM DANH + VÒNG QUAY MAY MẮN
   ========================================================================== */

.checkin-kid-selector {
  display: flex; gap: 0.5rem; padding: 0.75rem 1.25rem;
  flex-wrap: wrap; justify-content: center;
}

.checkin-body {
  padding: 1rem 1.25rem; display: flex; flex-direction: column;
  align-items: center; gap: 1rem;
}

.checkin-streak-box {
  display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff; border-radius: 1rem; padding: 1rem 2rem;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.streak-number {
  font-size: 3rem; font-weight: 800; line-height: 1;
}

.streak-label {
  font-size: 0.85rem; opacity: 0.85; margin-top: 0.25rem;
}

.checkin-week {
  display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center;
}

.checkin-day {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.5rem 0.6rem; border-radius: 0.75rem; min-width: 50px;
  background: var(--bg-secondary); border: 2px solid transparent;
  transition: all 0.2s;
}

.checkin-day.checked {
  background: rgba(34, 197, 94, 0.1); border-color: #22c55e;
}

.checkin-day.today {
  border-color: #8b5cf6; box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

.day-name {
  font-size: 0.7rem; font-weight: 700; color: var(--text-secondary);
  text-transform: uppercase;
}

.day-icon {
  font-size: 1.3rem; margin: 0.2rem 0;
}

.day-date {
  font-size: 0.65rem; color: var(--text-muted);
}

.checkin-milestone-info {
  text-align: center; font-size: 0.85rem; color: var(--text-secondary);
  padding: 0.5rem 1rem; background: var(--bg-secondary);
  border-radius: 0.75rem; width: 100%;
}

.checkin-actions {
  display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center;
}

.checkin-btn {
  font-size: 1rem; padding: 0.75rem 1.5rem;
}

.btn-spin {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff; border: none; padding: 0.75rem 1.5rem;
  border-radius: 0.75rem; font-weight: 700; font-size: 1rem;
  cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem;
  transition: all 0.3s; box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-spin:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

.btn-disabled {
  opacity: 0.6; cursor: not-allowed; pointer-events: none;
}

/* SPIN MODAL */
.spin-modal-card {
  max-width: 400px;
}

.spin-modal-body {
  display: flex; flex-direction: column; align-items: center;
  gap: 1rem; padding: 1.5rem;
}

.spin-wheel-container {
  position: relative; display: flex; justify-content: center;
  align-items: center;
}

.spin-pointer {
  position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
  font-size: 1.8rem; color: #f59e0b; z-index: 10;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

#spinWheelCanvas {
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.3), 0 0 60px rgba(139, 92, 246, 0.1);
}

.spin-result {
  text-align: center; padding: 1rem; background: linear-gradient(135deg, rgba(34,197,94,0.1), rgba(139,92,246,0.1));
  border-radius: 1rem; width: 100%;
  animation: popIn 0.5s ease;
}

.spin-result-icon {
  font-size: 3rem; margin-bottom: 0.5rem;
}

.spin-result-text {
  font-size: 1rem; color: var(--text-primary); line-height: 1.5;
}

.spin-go-btn {
  font-size: 1.2rem; padding: 0.75rem 2.5rem;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border: none; color: #fff;
}

@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.arrow.rotated { transform: rotate(90deg); }
