/* ============================================================================
   ANSOUND LMS DESIGN SYSTEM — GOLDEN (#F59E0B) + DEEP NAVY (#0B2545) + WHITE
   Covers: Hướng B (Executive Admin/Teacher), Hướng C (Dual-Portal Home), Hướng A (Dubbing Studio)
   Navy + Gold + White Contrast >= 4.5:1 · Tabular Numerals
   ============================================================================ */

:root {
  --navy-950: #0B2545;
  --navy-900: #0F3057;
  --navy-800: #133C7A;
  --navy-700: #1E4E8C;
  --navy-100: #E6EEF8;
  --navy-50:  #F0F5FC;
  --gold-600: #D97706;
  --gold-500: #F59E0B;
  --gold-400: #FBBF24;
  --gold-100: #FEF3C7;
  --gold-50:  #FFFBEB;
  --white:    #FFFFFF;
  --canvas:   #F4F7FB;
  --ink-primary: #0B2545;
  --ink-secondary: #475569;
  --border-subtle: #E2E8F0;
  --success-bg: #DCFCE7;
  --success-fg: #166534;
  --danger-bg: #FEE2E2;
  --danger-fg: #991B1B;
  --shadow-navy-sm: 0 2px 8px rgba(11, 37, 69, 0.06);
  --shadow-navy-md: 0 10px 28px rgba(11, 37, 69, 0.08);

  /* Override legacy variables cleanly */
  --bg-cream: var(--canvas);
  --bg-paper: var(--white);
  --bg-card: var(--white);
  --ink-brown: var(--ink-primary);
  --ink-muted: var(--ink-secondary);
  --border-tan: var(--border-subtle);
  --border-dashed: #CBD5E1;
  --green-deep: var(--navy-950);
  --green-leaf: var(--gold-500);
  --sun-gold: var(--gold-500);
  --sun-soft: var(--gold-50);
  --sun-header: var(--navy-950);
  --shadow-card: var(--shadow-navy-sm);
}

html, body {
  background-color: var(--canvas);
  background-image: none;
  color: var(--ink-primary);
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
}

h1, h2, h3, h4, .font-display {
  font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif;
  color: var(--navy-950);
  letter-spacing: -0.02em;
}

code, .mono, .num-tabular {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--navy-50);
  color: var(--navy-800);
  border: 1px solid var(--navy-100);
}

a {
  color: var(--navy-800);
}

/* ---------- EXECUTIVE SIDEBAR (HƯỚNG B & HƯỚNG A STUDIO) ---------- */
.sidebar {
  background: var(--navy-950);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #E2E8F0;
  box-shadow: 4px 0 24px rgba(11, 37, 69, 0.14);
}

.sidebar .brand {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(19, 60, 122, 0.65) 100%);
  border: 1px solid rgba(251, 191, 36, 0.35);
  box-shadow: none;
  border-radius: 14px;
}

.sidebar .brand-logo {
  color: #FFFFFF;
}

.sidebar .brand .badge {
  background: var(--gold-500);
  color: var(--navy-950);
  border: none;
}

button.nav-title {
  background: rgba(255, 255, 255, 0.06);
  color: var(--gold-400);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

button.nav-title:hover {
  background: rgba(255, 255, 255, 0.12);
}

button.nav-title.has-active {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(251, 191, 36, 0.45);
  color: #FDE68A;
}

.sidebar a.nav-link {
  background: transparent;
  color: #CBD5E1;
  border: 1px solid transparent;
  box-shadow: none;
  font-weight: 600;
  font-size: 13.5px;
  padding: 8px 11px;
}

.sidebar a.nav-link:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
}

.sidebar a.nav-link.active {
  background: var(--gold-500);
  color: var(--navy-950);
  border-color: var(--gold-400);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.32);
  font-weight: 800;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- TOPBAR (CRISP WHITE + NAVY TEXT) ---------- */
.topbar {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-navy-sm);
  color: var(--navy-950);
}

.topbar strong {
  color: var(--navy-950);
  font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif;
}

/* ---------- CARDS & TABLES ---------- */
.card, .washi-card {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: var(--shadow-navy-sm);
  color: var(--navy-950);
}

.card.washi::before, .washi-tape {
  display: none;
}

.notebook-box {
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  border-radius: 12px;
  color: var(--navy-950);
}

.table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-navy-sm);
}

th {
  background: var(--navy-950);
  color: #FFFFFF;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 2px solid var(--gold-500);
}

td {
  border-bottom: 1px solid var(--border-subtle);
  color: var(--navy-950);
}

tr:hover td {
  background: var(--navy-50);
}

/* ---------- BUTTONS (NAVY TEXT ON GOLDEN CTA FOR >8:1 CONTRAST) ---------- */
button, .btn, .btn-pill {
  background: var(--gold-500);
  color: var(--navy-950);
  border: 1px solid #D97706;
  border-radius: 10px;
  box-shadow: 0 2px 0 #B45309;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-weight: 800;
}

button:hover, .btn:hover, .btn-pill:hover {
  background: var(--gold-400);
  filter: none;
}

button:active, .btn:active, .btn-pill:active {
  box-shadow: 0 1px 0 #B45309;
}

button.navy, .btn.navy {
  background: var(--navy-950);
  color: #FFFFFF;
  border-color: var(--navy-800);
  box-shadow: 0 2px 0 #07172C;
}

button.navy:hover, .btn.navy:hover {
  background: var(--navy-800);
}

button.secondary, .btn.secondary, .btn-pill.secondary {
  background: var(--white);
  color: var(--navy-950);
  border: 1px solid #CBD5E1;
  box-shadow: 0 1px 2px rgba(11, 37, 69, 0.06);
}

button.secondary:hover, .btn.secondary:hover, .btn-pill.secondary:hover {
  background: var(--navy-50);
  border-color: var(--navy-800);
}

button.warn, button.gold, .btn.warn, .btn-pill.gold {
  background: var(--gold-400);
  color: var(--navy-950);
  border-color: var(--gold-600);
  box-shadow: 0 2px 0 #B45309;
}

button.danger, .btn.danger, .btn-pill.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
  border-color: #FCA5A5;
  box-shadow: 0 1px 0 #F87171;
}

input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  background: var(--white);
  color: var(--navy-950);
  font-family: 'Be Vietnam Pro', sans-serif;
}

input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  max-width: 22px;
  padding: 0;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #059669;
  cursor: pointer;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--navy-800);
  box-shadow: 0 0 0 3px rgba(19, 60, 122, 0.14);
}

.badge, .sticker-badge {
  background: var(--navy-50);
  color: var(--navy-800);
  border: 1px solid var(--navy-100);
  font-weight: 700;
}

.badge.warn, .badge.gold {
  background: var(--gold-100);
  color: var(--navy-950);
  border: 1px solid var(--gold-400);
}

.badge.success {
  background: var(--success-bg);
  color: var(--success-fg);
  border: 1px solid #86EFAC;
}

.tab-btn {
  background: var(--white);
  color: var(--navy-950);
  border: 1px solid #CBD5E1;
  box-shadow: none;
  border-radius: 10px;
}

.tab-btn.active {
  background: var(--navy-950);
  color: var(--gold-400);
  border-color: var(--navy-950);
  box-shadow: 0 2px 8px rgba(11, 37, 69, 0.18);
}

/* ---------- LOGIN PAGE (ANSOUND BRAND) ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(155deg, #0B2545 0%, #133C7A 55%, #0F3057 100%);
}

.login-card {
  max-width: 520px;
  width: 100%;
  border-radius: 20px;
  border: 2px solid rgba(251, 191, 36, 0.45);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
  padding: 26px 28px;
}

.demo-role-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.demo-role-btn {
  background: var(--navy-50) !important;
  color: var(--navy-950) !important;
  border: 1px solid var(--navy-100) !important;
  box-shadow: none !important;
  padding: 8px 10px !important;
  font-size: 12.5px !important;
  justify-content: flex-start !important;
}

.demo-role-btn:hover {
  background: var(--gold-100) !important;
  border-color: var(--gold-500) !important;
}

/* ---------- HƯỚNG C: DUAL-PORTAL TOP NAV + NAVY HERO + BENTO ---------- */
.portal-shell {
  min-height: 100vh;
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.portal-topnav {
  background: var(--white);
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 12px rgba(11, 37, 69, 0.04);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 21px;
  font-weight: 800;
  color: var(--navy-950);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.portal-brand .badge,
.portal-topnav .row .badge,
.portal-topnav .row button,
.portal-topnav .row .btn {
  white-space: nowrap;
}

.portal-topnav > .row {
  flex-shrink: 0;
  flex-wrap: nowrap;
  gap: 8px;
}

.portal-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--gold-500);
  color: var(--navy-950);
  font-size: 18px;
  font-weight: 900;
  flex-shrink: 0;
}

.portal-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}

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

.portal-nav-link {
  padding: 7px 11px;
  border-radius: 10px;
  color: var(--ink-secondary);
  font-weight: 700;
  font-size: 13.5px;
  border-bottom: 2.5px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.portal-nav-link:hover {
  color: var(--navy-950);
  background: var(--navy-50);
  text-decoration: none;
}

.portal-nav-link.active {
  color: var(--navy-950);
  border-bottom-color: var(--gold-500);
  background: var(--gold-50);
}

.portal-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 56px;
}

.portal-hero-banner {
  background: linear-gradient(125deg, #0B2545 0%, #133C7A 100%);
  color: #FFFFFF;
  border-radius: 20px;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  box-shadow: 0 14px 32px rgba(11, 37, 69, 0.18);
  position: relative;
  overflow: hidden;
}

.portal-hero-banner h1, .portal-hero-banner h2 {
  color: #FFFFFF;
  margin: 6px 0 6px;
  font-size: clamp(22px, 2.6vw, 30px);
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gold-400);
  color: var(--navy-950);
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
}

.portal-quick-strip {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}

.portal-quick-strip.is-single {
  grid-template-columns: minmax(0, 1fr);
}

.portal-next-session-card {
  margin-bottom: 0 !important;
  height: 100%;
}

.portal-books-spotlight {
  margin: 0 !important;
  padding: 16px 18px !important;
  border: 2px solid #F59E0B !important;
  background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 64%, #F0F5FC 100%) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.portal-books-spotlight-body {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 220px;
}

.portal-books-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #0B2545;
  color: #FBBF24;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: 0 6px 14px rgba(11, 37, 69, 0.16);
}

.portal-bento-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.portal-main-col {
  min-width: 0;
}

.portal-side-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.portal-missions-card,
.portal-garden-card,
.portal-parent-card {
  margin: 0 !important;
}

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

.mission-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.mission-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1.5px solid #CBD5E1;
  background: #F8FAFC;
  color: #334155;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mission-filter-pill:hover {
  border-color: var(--navy-800);
  background: #EFF6FF;
  color: var(--navy-950);
}

.mission-filter-pill.active {
  background: var(--navy-950);
  border-color: var(--navy-950);
  color: #FFFFFF;
}

.mission-filter-pill.active b {
  color: var(--gold-400);
}

.mission-list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mission-row-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-subtle);
  border-radius: 14px;
  background: var(--white);
  margin-bottom: 0;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
  cursor: pointer;
}

.mission-row-item.is-done {
  background: #F0FDF4;
  border-color: #86EFAC;
}

.mission-row-item:hover {
  transform: translateY(-1px);
  border-color: var(--gold-500);
  background: var(--gold-50);
  box-shadow: 0 6px 16px rgba(11, 37, 69, 0.06);
}

.mission-row-item.is-done:hover {
  border-color: #22C55E;
  background: #DCFCE7;
}

.mission-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.mission-item-title-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

.mission-item-title {
  font-weight: 800;
  color: #0B2545;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: break-word;
  word-break: normal;
}

.mission-row-item.is-done .mission-item-title {
  color: #166534;
}

.mission-item-sub {
  font-size: 12.5px;
  color: #475569;
  margin-top: 3px;
  line-height: 1.4;
}

.mission-launch-btn {
  flex-shrink: 0;
  white-space: nowrap;
  min-width: 88px;
}

.mission-item-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 52px;
}

.mission-due-pill {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.mission-due-pill.is-late {
  color: #B91C1C;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  padding: 3px 9px;
  border-radius: 8px;
}

.mission-due-pill.is-ontime {
  color: #0F766E;
  background: #F0FDFA;
  border: 1px solid #99F6E4;
  padding: 3px 9px;
  border-radius: 8px;
}

.mission-icon-circle {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--gold-400);
  color: var(--navy-950);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.mission-icon-circle.is-done {
  background: #16A34A;
  color: #FFFFFF;
  border: 2px solid #86EFAC;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.portal-garden-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #F0FDF4 0%, #FFFBEB 100%);
  border: 1px solid #BBF7D0;
}

.portal-tuition-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 6px 9px;
  border-radius: 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}

.portal-tuition-class {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .portal-bento-grid {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
  }
}

@media (max-width: 900px) {
  .portal-quick-strip,
  .portal-bento-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .mission-item-footer {
    padding-left: 0;
  }
}

/* ---------- HƯỚNG A: ANSOUND VIDEO DUBBING STUDIO ---------- */
.studio-topbar-card {
  margin: 0 0 16px 0 !important;
  padding: 12px 16px !important;
  border: 1.5px solid var(--border-subtle) !important;
  background: var(--white) !important;
}

.studio-topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.studio-picker-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 420px;
  min-width: 0;
}

.studio-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.studio-select-caption {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-mission-select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1.5px solid #CBD5E1;
  background: #F8FAFC;
  color: #0B2545;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
}

.studio-mission-select:focus {
  outline: none;
  border-color: var(--navy-800);
  background: #FFFFFF;
}

.studio-nav-step-btn {
  width: 36px;
  min-width: 36px;
  height: 38px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
}

#studioToggleDrawerBtn {
  height: 38px;
  align-self: flex-end;
  flex-shrink: 0;
}

.studio-stats-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.studio-mission-drawer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #CBD5E1;
}

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

.studio-drawer-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid #E2E8F0;
  background: #F8FAFC;
  color: #0B2545;
  text-align: left;
  cursor: pointer;
  min-width: 0;
  width: 100%;
  height: auto;
  box-shadow: none;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.studio-drawer-item:hover {
  border-color: var(--gold-500);
  background: #FFFBEB;
  transform: translateY(-1px);
}

.studio-drawer-item.is-done {
  background: #F0FDF4;
  border-color: #86EFAC;
}

.studio-drawer-item.active {
  background: #0B2545;
  border-color: #0B2545;
  color: #FFFFFF;
  box-shadow: 0 6px 14px rgba(11, 37, 69, 0.22);
}

.studio-drawer-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.studio-drawer-idx {
  font-size: 11px;
  font-weight: 800;
  color: #64748B;
  font-family: 'JetBrains Mono', monospace;
}

.studio-drawer-item.active .studio-drawer-idx {
  color: #FBBF24;
}

.studio-drawer-item-title {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  color: inherit;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  width: 100%;
}

.studio-drawer-item-cls {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.studio-drawer-item.active .studio-drawer-item-cls {
  color: #CBD5E1;
}

@media (max-width: 1024px) {
  .studio-drawer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .studio-picker-group {
    flex-wrap: wrap;
    flex-basis: 100%;
  }
  .studio-select-wrap {
    flex-basis: 100%;
    order: -1;
  }
  .studio-drawer-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.studio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.studio-video-frame {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #0B2545;
  border: 2px solid var(--navy-800);
  aspect-ratio: 16 / 9;
}

.studio-muted-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(11, 37, 69, 0.84);
  color: var(--gold-400);
  border: 1px solid rgba(251, 191, 36, 0.45);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  z-index: 4;
}

.studio-subtitle-bar {
  text-align: center;
  padding: 14px 16px 8px;
  font-family: 'Baloo 2', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--navy-950);
  min-height: 62px;
}

.studio-subtitle-vi {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-secondary);
  margin-bottom: 10px;
}

.waveform-box {
  background: var(--canvas);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 10px 0 14px;
}

.mic-record-btn {
  width: 64px;
  height: 64px;
  border-radius: 999px !important;
  background: var(--gold-500) !important;
  color: var(--navy-950) !important;
  border: 3px solid var(--gold-400) !important;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35) !important;
  font-size: 26px !important;
  padding: 0 !important;
}

.mic-record-btn.recording {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  border-color: #FCA5A5 !important;
  animation: pulseMic 1.2s infinite;
}

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

.quiz-chip-btn {
  background: var(--white) !important;
  color: var(--navy-950) !important;
  border: 1.5px solid #CBD5E1 !important;
  box-shadow: none !important;
  border-radius: 999px !important;
  padding: 7px 14px !important;
  font-weight: 700 !important;
}

.quiz-chip-btn.selected {
  background: var(--gold-500) !important;
  color: var(--navy-950) !important;
  border-color: var(--navy-950) !important;
  box-shadow: 0 2px 0 var(--navy-950) !important;
}

/* ---------- HƯỚNG B: EXECUTIVE KPIs & GRADING QUEUE ---------- */
.exec-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.exec-kpi-card {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-navy-sm);
}

.exec-kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--navy-50);
  color: var(--navy-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.exec-kpi-val {
  font-family: 'Baloo 2', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--navy-950);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.exec-split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.inline-wave-bars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 22px;
}

.inline-wave-bars span {
  display: inline-block;
  width: 3px;
  border-radius: 2px;
  background: var(--navy-800);
}

.inline-wave-bars span.gold {
  background: var(--gold-500);
}

.progress-track {
  height: 8px;
  background: var(--navy-100);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold-500);
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1080px) {
  .studio-grid, .exec-split-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .exec-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .portal-topnav {
    padding: 8px 12px;
    min-height: 54px;
    max-height: 60px;
    flex-wrap: nowrap;
    gap: 8px;
  }
  .portal-brand {
    font-size: 18px;
    gap: 7px;
    min-width: 0;
    white-space: nowrap;
  }
  .portal-brand-mark {
    width: 32px;
    height: 32px;
    font-size: 15px;
    flex-shrink: 0;
  }
  .portal-brand .badge {
    display: none;
  }
  .portal-nav-links {
    display: none !important;
  }
  .portal-topnav .row {
    flex-wrap: nowrap;
    gap: 6px !important;
    min-width: 0;
  }
  .portal-topnav .badge {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 8px !important;
    font-size: 11.5px;
  }
  .portal-container {
    padding: 14px 12px 84px;
    max-width: 100%;
    overflow-x: hidden;
  }
}

@media (max-width: 640px) {
  .portal-hero-banner {
    padding: 18px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .portal-hero-banner > div {
    width: 100%;
    min-width: 0;
    max-width: 100% !important;
  }
  .portal-hero-banner p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .portal-hero-banner .row {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
  }
  .portal-hero-banner button,
  .portal-hero-banner .btn {
    max-width: 100%;
    white-space: normal;
    line-height: 1.35;
    text-align: center;
    height: auto;
  }
  .mission-row-item {
    padding: 12px 13px;
    gap: 8px;
  }
  .mission-item-top {
    flex-wrap: wrap;
    gap: 10px;
  }
  .mission-launch-btn {
    width: 100%;
    justify-content: center;
  }
  .mission-item-footer {
    padding-left: 0;
  }
  .mission-row-item > div {
    min-width: 0;
    max-width: 100%;
  }
  .exec-kpi-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- LEGACY BROWN / CONTRAST OVERRIDES ---------- */
.chibi-overview-board {
  background: linear-gradient(180deg, #F8FAFC 0%, #EEF4FB 100%) !important;
  border: 1.5px solid var(--navy-100) !important;
  border-radius: 20px !important;
}

.chibi-student-card {
  border-color: var(--border-subtle) !important;
  box-shadow: var(--shadow-navy-sm) !important;
}

.chibi-student-card:hover {
  border-color: var(--gold-500) !important;
  box-shadow: 0 12px 24px rgba(11, 37, 69, 0.14) !important;
}

.topbar-scale-widget {
  background: var(--navy-50) !important;
  border: 1px solid var(--navy-100) !important;
  box-shadow: none !important;
}

.topbar-scale-btn {
  color: var(--navy-950) !important;
}

.topbar-scale-btn:hover {
  background: var(--gold-100) !important;
}

.topbar-scale-readout {
  background: var(--gold-100) !important;
  color: var(--navy-950) !important;
}

.ui-scale-settings-card {
  border: 2px solid var(--gold-500) !important;
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 100%) !important;
}

.ui-scale-slider-panel {
  background: var(--navy-50) !important;
  border: 1.5px dashed var(--navy-800) !important;
}

.garden3d-claim-item-btn.pulse-reward {
  color: var(--navy-950) !important;
  background: linear-gradient(135deg, var(--gold-400) 0%, var(--gold-500) 100%) !important;
  border: 1px solid var(--gold-600) !important;
  animation: none !important;
}

/* Chống rung lắc Vườn cây 3D & Khóa chiều cao cuộn cho Vinh danh / Nhật ký */
.garden-plot,
.garden3d-island-card,
.garden3d-island-img,
.garden3d-tree-unit,
.garden3d-pest-overlay,
.garden3d-pest-chip,
.garden-tree-img {
  animation: none !important;
  transform: none !important;
}

.garden-bottom-grid {
  display: grid;
  grid-template-columns: minmax(320px, 5fr) minmax(380px, 7fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 1024px) {
  .garden-bottom-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.garden-scroll-box {
  max-height: 310px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--white);
}

.garden-scroll-box .table-wrap {
  border: none;
  box-shadow: none;
  border-radius: 0;
  margin: 0;
}

.garden-scroll-box table th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.garden-log-table td:nth-child(1) {
  white-space: nowrap;
  width: 118px;
  font-size: 12px;
}

.garden-log-table td:nth-child(2) {
  white-space: nowrap;
  width: 82px;
}

.garden-log-table td:nth-child(3) {
  white-space: nowrap;
  width: 130px;
}

.garden-log-table td:nth-child(4) {
  min-width: 240px;
  line-height: 1.45;
  font-size: 13px;
}

.honor-scroll-box {
  max-height: 360px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}

.honor-scroll-box .table-wrap {
  border: none;
  box-shadow: none;
  margin: 0;
}

.honor-scroll-box table th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.quiz-chip-btn.correct {
  background: var(--success-bg) !important;
  color: var(--success-fg) !important;
  border-color: #16A34A !important;
}

.quiz-chip-btn.incorrect {
  background: var(--danger-bg) !important;
  color: var(--danger-fg) !important;
  border-color: #DC2626 !important;
}

/* ---------- ANSOUND FLIPBOOK LIBRARY & 3D BOOK SPREAD ---------- */
.flipbook-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 16px;
}

.flipbook-card {
  background: var(--white);
  border: 1.5px solid var(--border-subtle);
  border-left: 5px solid var(--navy-950);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-navy-sm);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.flipbook-card:hover {
  transform: translateY(-3px);
  border-color: var(--gold-500);
  border-left-color: var(--gold-500);
  box-shadow: 0 14px 28px rgba(11, 37, 69, 0.12);
}

.flipbook-cover-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--navy-50);
  overflow: hidden;
}

.flipbook-cover-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.flipbook-cover-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  pointer-events: none;
}

.flipbook-cover-badges .badge {
  font-size: 11px;
  padding: 3px 8px;
  box-shadow: 0 2px 6px rgba(11, 37, 69, 0.2);
}

.flipbook-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.flipbook-card-title {
  margin: 0 0 6px;
  font-size: 15.5px;
  line-height: 1.25;
  color: var(--navy-950);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.flipbook-reader-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.flipbook-stage-wrap {
  background: radial-gradient(circle at 50% 35%, #F0F5FC 0%, #DFEAFA 100%);
  border: 1.5px solid var(--navy-100);
  border-radius: 22px;
  padding: 26px 24px 20px;
  position: relative;
}

.flipbook-spread {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px minmax(0, 1fr);
  background: var(--white);
  border: 2.5px solid var(--navy-950);
  border-radius: 16px;
  overflow: visible;
  min-height: 420px;
  box-shadow:
    0 4px 0 -1px #E2E8F0,
    0 7px 0 -2px #CBD5E1,
    0 22px 46px rgba(11, 37, 69, 0.22);
  user-select: none;
}

/* Mép giấy xếp chồng 2 bên gáy ngoài tạo chiều sâu sách thật */
.flipbook-spread::before,
.flipbook-spread::after {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  width: 8px;
  pointer-events: none;
  z-index: 1;
}

.flipbook-spread::before {
  left: -8px;
  background: repeating-linear-gradient(90deg, #CBD5E1 0 1px, #FFFFFF 1px 3px);
  border-radius: 6px 0 0 6px;
  border: 1px solid #94A3B8;
  border-right: none;
}

.flipbook-spread::after {
  right: -8px;
  background: repeating-linear-gradient(90deg, #FFFFFF 0 2px, #CBD5E1 2px 3px);
  border-radius: 0 6px 6px 0;
  border: 1px solid #94A3B8;
  border-left: none;
}

/* Lớp phối cảnh 3D chuyên biệt — tách rời Grid để Chromium không làm phẳng preserve-3d */
.flipbook-3d-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  perspective: 2600px;
  perspective-origin: 50% 50%;
  overflow: visible;
}

.flipbook-turning-leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  will-change: transform;
}

.flipbook-turning-leaf.turn-next {
  left: calc(50% + 7px);
  width: calc(50% - 7px);
  transform-origin: -7px center;
}

.flipbook-turning-leaf.turn-prev {
  left: 0;
  width: calc(50% - 7px);
  transform-origin: calc(100% + 7px) center;
}

.flipbook-leaf-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 14px 34px rgba(11, 37, 69, 0.26);
}

.flipbook-turning-leaf.turn-next .flipbook-leaf-face.front {
  border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFDF7 100%);
  padding: 28px 30px;
  border-left: 1px solid #CBD5E1;
}

.flipbook-turning-leaf.turn-next .flipbook-leaf-face.back {
  transform: rotateY(180deg);
  border-radius: 14px 0 0 14px;
  background: #F8FAFC;
  border-right: 1px solid #CBD5E1;
}

.flipbook-turning-leaf.turn-prev .flipbook-leaf-face.front {
  border-radius: 14px 0 0 14px;
  background: #F8FAFC;
  border-right: 1px solid #CBD5E1;
}

.flipbook-turning-leaf.turn-prev .flipbook-leaf-face.back {
  transform: rotateY(180deg);
  border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFDF7 100%);
  padding: 28px 30px;
  border-left: 1px solid #CBD5E1;
}

/* Ánh sáng lướt cong qua mặt giấy tạo hiệu ứng giấy uốn thực tế */
.flipbook-leaf-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(11, 37, 69, 0.22) 0%,
    rgba(255, 255, 255, 0.36) 24%,
    rgba(255, 255, 255, 0.05) 55%,
    rgba(11, 37, 69, 0.14) 100%
  );
  mix-blend-mode: soft-light;
}

/* Bóng đổ rơi xuống trang bên dưới khi lá sách bay qua giữa */
.flipbook-cast-shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  width: calc(50% - 7px);
  z-index: 25;
  pointer-events: none;
}

.flipbook-cast-shadow.on-right {
  right: 0;
  border-radius: 0 14px 14px 0;
  background: linear-gradient(90deg, rgba(11, 37, 69, 0.34) 0%, rgba(11, 37, 69, 0.06) 55%, rgba(11, 37, 69, 0) 100%);
}

.flipbook-cast-shadow.on-left {
  left: 0;
  border-radius: 14px 0 0 14px;
  background: linear-gradient(270deg, rgba(11, 37, 69, 0.34) 0%, rgba(11, 37, 69, 0.06) 55%, rgba(11, 37, 69, 0) 100%);
}

.flipbook-underlay-cover {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flipbook-underlay-cover.is-left {
  left: 0;
  width: calc(50% - 7px);
  border-radius: 14px 0 0 14px;
  background: #F8FAFC;
}

.flipbook-underlay-cover.is-right {
  right: 0;
  width: calc(50% - 7px);
  border-radius: 0 14px 14px 0;
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFDF7 100%);
  padding: 28px 30px;
}

/* Góc trang uốn cong nhẹ mời người đọc bấm trực tiếp để lật */
.flipbook-corner-btn {
  position: absolute;
  bottom: 0;
  width: 54px;
  height: 54px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  z-index: 15;
  box-shadow: none !important;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.flipbook-corner-btn.next {
  right: 0;
  border-bottom-right-radius: 14px;
  background: linear-gradient(315deg, #FEF3C7 0%, #F59E0B 44%, rgba(11,37,69,0.18) 49%, rgba(255,255,255,0) 53%);
  opacity: 0.85;
}

.flipbook-corner-btn.prev {
  left: 0;
  border-bottom-left-radius: 14px;
  background: linear-gradient(45deg, #FEF3C7 0%, #F59E0B 44%, rgba(11,37,69,0.18) 49%, rgba(255,255,255,0) 53%);
  opacity: 0.78;
}

.flipbook-corner-btn:hover {
  transform: scale(1.24);
  opacity: 1;
}

.flipbook-corner-btn:disabled {
  display: none;
}

.flipbook-page-left {
  background: #F8FAFC;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 360px;
  border-radius: 14px 0 0 14px;
  overflow: hidden;
  box-shadow: inset -18px 0 28px -18px rgba(11, 37, 69, 0.16);
}

.flipbook-img-wrap {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F8FAFC;
}

.flipbook-img-wrap img {
  width: 100%;
  height: 100%;
  max-height: 450px;
  object-fit: contain;
  display: block;
}

.flipbook-photo-credit {
  position: absolute;
  bottom: 8px;
  right: 10px;
  background: rgba(11, 37, 69, 0.78);
  color: #E2E8F0;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
}

.flipbook-title-art {
  width: 100%;
  height: 100%;
  padding: 28px;
  background: linear-gradient(145deg, #0B2545 0%, #133C7A 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.flipbook-spine {
  background: linear-gradient(
    90deg,
    rgba(11, 37, 69, 0.28) 0%,
    rgba(255, 255, 255, 0.6) 35%,
    rgba(11, 37, 69, 0.14) 50%,
    rgba(255, 255, 255, 0.5) 65%,
    rgba(11, 37, 69, 0.24) 100%
  );
  border-left: 1px solid #CBD5E1;
  border-right: 1px solid #CBD5E1;
}

.flipbook-page-right {
  background: linear-gradient(180deg, #FFFFFF 0%, #FFFDF7 100%);
  padding: 28px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: 0 14px 14px 0;
  overflow: hidden;
  box-shadow: inset 18px 0 28px -18px rgba(11, 37, 69, 0.14);
}

.flipbook-right-inner {
  width: 100%;
  text-align: center;
}

.flipbook-page-pill {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--navy-800);
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 14px;
}

.flipbook-story-text {
  font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif;
  font-size: clamp(20px, 2.2vw, 27px);
  font-weight: 700;
  line-height: 1.42;
  color: var(--navy-950);
}

.flipbook-vi-box {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--gold-50);
  border: 1.5px solid var(--gold-400);
  color: var(--navy-950);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.45;
}

.flipbook-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

@media (max-width: 860px) {
  .flipbook-stage-wrap {
    padding: 12px;
  }
  .flipbook-spread {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }
  .flipbook-spread::before,
  .flipbook-spread::after,
  .flipbook-3d-overlay,
  .flipbook-turning-leaf,
  .flipbook-underlay-cover,
  .flipbook-cast-shadow,
  .flipbook-corner-btn {
    display: none !important;
  }
  .flipbook-spine {
    height: 8px;
    border-left: none;
    border-right: none;
    border-top: 1px solid #E2E8F0;
    border-bottom: 1px solid #E2E8F0;
  }
  .flipbook-page-left {
    min-height: 240px;
    border-radius: 14px 14px 0 0;
    box-shadow: none;
  }
  .flipbook-page-right {
    padding: 20px 18px;
    border-radius: 0 0 14px 14px;
    box-shadow: none;
  }
  .flipbook-nav-bar {
    flex-wrap: wrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *:not(.flipbook-corner-btn):not(.flipbook-turning-leaf):not(.flipbook-3d-overlay *),
  *:not(.flipbook-corner-btn):not(.flipbook-turning-leaf):not(.flipbook-3d-overlay *)::before,
  *:not(.flipbook-corner-btn):not(.flipbook-turning-leaf):not(.flipbook-3d-overlay *)::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   GLOBAL LAYOUT & FORM ALIGNMENT POLISH (CÂN ĐỐI TOÀN BỘ GIAO DIỆN)
   ============================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

.layout {
  max-width: 100%;
  overflow-x: clip;
}

.main {
  padding: 20px 24px 56px;
  min-width: 0;
  overflow-x: hidden;
}

.main > .topbar,
.main > #pageContent {
  width: 100%;
  max-width: 1680px;
  margin-left: 0;
  margin-right: auto;
  min-width: 0;
}

.topbar {
  padding: 10px 18px;
  min-height: 58px;
  margin-bottom: 18px;
  gap: 12px;
  border-radius: 14px;
  align-items: center;
}

@media (min-width: 960px) {
  .topbar {
    flex-wrap: nowrap;
  }
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.topbar-left > div {
  flex: 1 1 auto;
  min-width: 0;
}

#topbarTitle,
.topbar strong#topbarTitle {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: calc(18.5px * clamp(0.92, var(--ui-scale, 1), 1.14));
  line-height: 1.25;
  margin: 0;
  color: var(--navy-950);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.topbar-actions select,
.topbar-actions button,
.topbar-actions .btn {
  height: 36px;
  min-height: 36px;
  padding: 0 11px;
  font-size: calc(13px * clamp(0.92, var(--ui-scale, 1), 1.08));
  line-height: 1;
  white-space: nowrap;
}

.topbar-actions .topbar-scale-widget {
  height: 36px;
  padding: 2px 4px;
  flex-shrink: 0;
}

.topbar-actions .topbar-scale-btn,
.topbar-actions .topbar-scale-readout {
  height: 30px !important;
  min-height: 30px !important;
  padding: 0 7px !important;
  font-size: 12.5px !important;
}

.card, .washi-card {
  padding: 20px 24px;
  margin-bottom: 20px;
  min-width: 0;
  max-width: 100%;
}

.card > h3:first-child,
.card > .row:first-child h3 {
  margin-top: 0;
  font-size: 16.5px;
  line-height: 1.35;
}

.notebook-box {
  padding: 16px 18px;
  border-radius: 12px;
  min-width: 0;
  max-width: 100%;
}

/* Form grids: luôn giữ đúng 2 cột cân đối trên desktop, 1 cột trên mobile */
.grid2 {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 16px 20px !important;
  align-items: end !important;
  margin-bottom: 16px;
}

.grid2:last-child {
  margin-bottom: 0;
}

.grid3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
  align-items: end;
}

@media (max-width: 960px) {
  .topbar {
    flex-wrap: nowrap;
    padding: 8px 12px;
    min-height: 52px;
    max-height: 64px;
    margin-bottom: 12px;
    border-radius: 12px;
    gap: 8px;
  }
  #topbarTitle,
  .topbar strong#topbarTitle {
    font-size: 15.5px;
  }
  .topbar-actions {
    gap: 6px;
  }
  .topbar-actions button,
  .topbar-actions .btn,
  .topbar-actions select {
    height: 34px;
    min-height: 34px;
    padding: 0 9px;
    font-size: 12.5px;
  }
}

@media (max-width: 768px) {
  .main {
    padding: 12px 12px 84px;
  }
  .card, .washi-card {
    padding: 14px;
  }
  .grid2, .grid3 {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }
  .grid2 > *,
  .grid3 > *,
  form > *,
  .portal-bento-grid > *,
  .studio-grid > *,
  .exec-split-grid > *,
  .garden-bottom-grid > * {
    grid-column: auto !important;
    min-width: 0;
    max-width: 100%;
  }
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    min-width: 0;
    max-width: 100%;
  }
  .table-wrap,
  .honor-podium {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .rs-toolbar,
  .rs-seg-group,
  .rs-footer-bar {
    max-width: 100%;
    min-width: 0;
  }
  .rs-seg-group {
    flex-wrap: wrap;
  }
}

/* Chuẩn hóa Label & Input/Select thẳng hàng tuyệt đối */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin: 0;
  min-width: 0;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
select {
  height: 40px;
  min-height: 40px;
  padding: 8px 12px;
  line-height: 1.4;
  font-size: 13.5px;
  box-sizing: border-box;
}

label > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),
label > select,
label > textarea {
  width: 100%;
  margin: 0;
}

textarea {
  min-height: 78px;
  padding: 10px 12px;
  line-height: 1.5;
  font-size: 13.5px;
  resize: vertical;
}

.row {
  align-items: center;
  gap: 10px;
}

.row > label {
  flex: 1 1 180px;
}

label.btn, label.btn-pill {
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  display: inline-flex !important;
  color: var(--navy-950);
}

/* Căn giữa chiều dọc trong bảng dữ liệu */
th, td {
  padding: 11px 14px;
  vertical-align: middle;
}

/* Modal cân đối */
.modal-box .grid2 {
  gap: 14px 16px !important;
}

/* ---------- VISUAL QUIZ / FILL-IN-THE-BLANK BUILDER ---------- */
.qb-wrap {
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  padding: 14px;
}

.qb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.qb-toolbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--navy-950);
}

.qb-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.qb-bulk-box {
  background: #fff;
  border: 1.5px dashed #94a3b8;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.qb-bulk-box textarea {
  width: 100%;
  min-height: 76px;
}

.qb-empty {
  text-align: center;
  padding: 22px 16px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  background: #fff;
}

.qb-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qb-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-left: 4px solid var(--navy-950);
  border-radius: 11px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(11, 37, 69, 0.04);
}

.qb-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.qb-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--navy-950);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.qb-kind-sel {
  height: 32px !important;
  min-height: 32px !important;
  padding: 2px 10px !important;
  font-size: 12.5px !important;
  width: auto !important;
  border-radius: 8px !important;
  background: #fff;
}

.qb-card-tools {
  display: flex;
  align-items: center;
  gap: 5px;
}

.qb-icon-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px !important;
}

.qb-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qb-card-body {
  padding: 12px 14px;
}

.qb-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy-950);
}

.qb-sublabel {
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
}

.qb-opts-block {
  margin-top: 10px;
}

.qb-opts-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.qb-opts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 760px) {
  .qb-opts-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.qb-excel-banner {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  border-radius: 9px;
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 10px;
}

.qb-opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.qb-opt-row.is-correct {
  background: #ecfdf5;
  border-color: #10b981;
}

.qb-radio-wrap {
  flex: 0 0 auto !important;
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  margin: 0 !important;
  cursor: pointer;
}

.qb-radio-wrap input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: #059669;
  cursor: pointer;
  margin: 0;
}

.qb-opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #e2e8f0;
  color: var(--navy-950);
  font-size: 12px;
  font-weight: 800;
}

.qb-opt-row.is-correct .qb-opt-letter {
  background: #059669;
  color: #fff;
}

.qb-opt-input {
  flex: 1 1 auto !important;
  height: 36px !important;
  min-height: 36px !important;
  background: #fff;
}

.qb-correct-pill {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 700;
  color: #047857;
  background: #d1fae5;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.qb-rm-opt {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- SUBTITLE BUILDER & MUTED YOUTUBE DUBBING STUDIO ---------- */
.sb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sb-row-card {
  display: grid;
  grid-template-columns: 185px 1fr auto;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  padding: 9px 11px;
}

.sb-time-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-time-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sb-time-inputs input[type="number"] {
  width: 62px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 4px 6px !important;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px !important;
}

.sb-text-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sb-text-col input {
  height: 36px !important;
  min-height: 36px !important;
}

.sb-act-col {
  display: flex;
  gap: 4px;
  align-items: center;
}

@media (max-width: 760px) {
  .sb-row-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

.dub-stage-box {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
}

.dub-subtitle-live {
  background: var(--navy-950);
  color: #fff;
  border-radius: 11px;
  padding: 14px 16px;
  text-align: center;
  border: 2px solid var(--gold-500);
  margin-bottom: 10px;
}

.dub-sub-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-400);
  margin-bottom: 5px;
}

.dub-sub-en {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
}

.dub-sub-vi {
  font-size: 13.5px;
  color: #cbd5e1;
  margin-top: 4px;
}

.dub-cue-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 165px;
  overflow-y: auto;
}

.dub-cue-item {
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 7px 10px !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--navy-950) !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: none !important;
  font-size: 13px !important;
}

.dub-cue-item.active {
  background: #fffbeb !important;
  border-color: var(--gold-500) !important;
  border-left: 4px solid var(--gold-500) !important;
}

.dub-cue-time {
  flex: 0 0 auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: #1d4ed8;
  background: #eff6ff;
  padding: 2px 7px;
  border-radius: 6px;
}

.dub-recorder-box {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 12px;
  padding: 12px 14px;
}

.dub-mic-btn {
  width: 52px;
  height: 52px;
  border-radius: 50% !important;
  padding: 0 !important;
  font-size: 22px !important;
  background: #dc2626 !important;
  color: #fff !important;
  border: 3px solid #fecaca !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dub-mic-btn.recording {
  background: #991b1b !important;
  box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.25) !important;
}

/* ---------- ROLE MENU PERMISSIONS MATRIX ---------- */
.rp-role-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.rp-role-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  padding: 8px 13px !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--navy-950) !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: none !important;
  font-size: 13px !important;
}

.rp-role-pill.active {
  background: var(--navy-950) !important;
  color: #fff !important;
  border-color: var(--navy-950) !important;
}

.rp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
}

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

@media (max-width: 820px) {
  .rp-groups-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.rp-group-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  overflow: hidden;
}

.rp-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
}

.rp-check-label {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
  cursor: pointer;
}

.rp-check-label input[type="checkbox"],
.rp-item-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #059669;
  cursor: pointer;
  margin: 0;
  flex: 0 0 auto;
}

.rp-group-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
}

.rp-item-check {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.rp-item-check.is-checked {
  background: #ecfdf5;
  border-color: #10b981;
  color: var(--navy-950);
  font-weight: 600;
}

/* ---------- STUDENT SCHEDULE & ZOOM CARDS ---------- */
.sch-stu-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sch-stu-card {
  display: grid;
  grid-template-columns: 145px 1fr;
  gap: 16px;
  align-items: center;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-left: 5px solid var(--navy-950);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 3px 10px rgba(11, 37, 69, 0.05);
}

.sch-stu-card.is-open {
  border-color: #10b981;
  border-left-color: #059669;
  background: linear-gradient(90deg, #ecfdf5 0%, #ffffff 35%);
}

.sch-stu-card.is-live {
  border-color: #dc2626;
  border-left-color: #dc2626;
  background: linear-gradient(90deg, #fef2f2 0%, #ffffff 35%);
}

.sch-stu-datecol {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-right: 14px;
  border-right: 1px dashed #cbd5e1;
}

.sch-stu-day {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin-top: 6px;
}

.sch-stu-date {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy-950);
  font-family: 'JetBrains Mono', monospace;
}

.sch-locked-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  font-size: 12.5px;
  color: #334155;
}

@media (max-width: 720px) {
  .sch-stu-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .sch-stu-datecol {
    flex-direction: row;
    justify-content: space-between;
    border-right: none;
    border-bottom: 1px dashed #cbd5e1;
    padding-right: 0;
    padding-bottom: 8px;
  }
}

/* ---------- CLASS REVENUE-SHARING PAYROLL MATRIX ---------- */
.rs-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 14px;
}

.rs-seg-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 3px 4px 3px 9px;
}

.rs-seg-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-right: 4px;
}

.rs-seg-btn {
  border: none !important;
  background: transparent !important;
  color: #475569 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 5px 10px !important;
  border-radius: 7px !important;
  box-shadow: none !important;
  cursor: pointer;
}

.rs-seg-btn.active {
  background: var(--navy-950) !important;
  color: #fff !important;
}

.rs-class-strip {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 6px;
  margin-bottom: 12px;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #CBD5E1 transparent;
}

.rs-class-strip::-webkit-scrollbar {
  height: 5px;
}

.rs-class-strip::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 999px;
}

.rs-class-pill {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 14px !important;
  border-radius: 11px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #fff !important;
  color: var(--navy-950) !important;
  box-shadow: none !important;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.rs-class-pill:hover {
  border-color: var(--gold-500) !important;
  background: #fffbeb !important;
}

.rs-class-pill.active {
  background: var(--navy-950) !important;
  border-color: var(--navy-950) !important;
  color: #fff !important;
  box-shadow: 0 6px 14px rgba(11, 37, 69, 0.16) !important;
}

.rs-class-pill-title {
  font-size: 13.5px;
  font-weight: 800;
}

.rs-class-pill-meta {
  font-size: 11.5px;
  opacity: 0.85;
}

.rs-class-panel {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  padding: 16px;
}

.rs-bucket-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
}

@media (max-width: 1150px) {
  .rs-bucket-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }
}

@media (max-width: 640px) {
  .rs-bucket-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.rs-bucket-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rs-bucket-card.is-primary {
  background: #fffbeb;
  border-color: #f59e0b;
}

.rs-bucket-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-950);
  gap: 4px;
}

.rs-bucket-amt {
  font-size: 15px;
  font-weight: 800;
  color: var(--navy-950);
}

.rs-chk-cell {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  margin: 0 !important;
  padding: 6px 8px;
  min-width: 84px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.rs-chk-cell input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: #059669;
  margin: 0;
  cursor: pointer;
}

.rs-chk-cell.is-on {
  background: #ecfdf5;
  border-color: #10b981;
}

.rs-cell-amt {
  font-size: 11.5px;
  font-weight: 700;
  color: #334155;
}

.rs-chk-cell.is-on .rs-cell-amt {
  color: #047857;
}

.rs-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.rs-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  font-size: 13px;
}

.rs-balance-pill.is-center {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* ---------- 1-CLICK STUDENT TUITION CHECKLIST (GREEN / RED) ---------- */
.tc-kpi-green {
  border-left: 4px solid #16A34A !important;
}

.tc-kpi-red {
  border-left: 4px solid #DC2626 !important;
}

.tc-table tbody tr.tc-row-paid td {
  background: #F0FDF4;
}

.tc-table tbody tr.tc-row-paid td:first-child {
  box-shadow: inset 4px 0 0 #16A34A;
}

.tc-table tbody tr.tc-row-unpaid td {
  background: #FEF2F2;
}

.tc-table tbody tr.tc-row-unpaid td:first-child {
  box-shadow: inset 4px 0 0 #DC2626;
}

.tc-table tbody tr.tc-row-partial td {
  background: #FFFBEB;
}

.tc-table tbody tr.tc-row-partial td:first-child {
  box-shadow: inset 4px 0 0 #D97706;
}

.tc-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 196px;
  padding: 8px 14px !important;
  border-radius: 10px !important;
  font-size: 12.5px !important;
  font-weight: 800 !important;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.tc-toggle-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
}

.tc-toggle-btn.is-paid {
  background: #16A34A !important;
  border: 1.5px solid #15803D !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.22) !important;
}

.tc-toggle-btn.is-unpaid {
  background: #DC2626 !important;
  border: 1.5px solid #B91C1C !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.22) !important;
}

.tc-toggle-btn.is-partial {
  background: #D97706 !important;
  border: 1.5px solid #B45309 !important;
  color: #FFFFFF !important;
  box-shadow: 0 4px 10px rgba(217, 119, 6, 0.22) !important;
}

.tc-badge-paid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tc-badge-unpaid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tc-badge-partial {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* ============================================================================
   EXECUTIVE SHELL POLISH: SIDEBAR COLLAPSE, TOPBAR USER MENU & PORTAL MORE SHEET
   ============================================================================ */
.sidebar .brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  min-width: 0;
}

.sidebar-brand .brand-logo {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-collapse-btn {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0 !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #FDE68A !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: none !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--gold-500) !important;
  color: var(--navy-950) !important;
  border-color: var(--gold-400) !important;
}

.sidebar-expand-btn,
.sidebar-reopen-btn {
  display: none !important;
}

@media (min-width: 961px) {
  .layout.pc-sidebar-collapsed .sidebar-expand-btn,
  .layout.pc-sidebar-collapsed .sidebar-reopen-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0 !important;
    border-radius: 9px !important;
    background: var(--navy-50) !important;
    color: var(--navy-950) !important;
    border: 1px solid var(--navy-100) !important;
    box-shadow: none !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    flex-shrink: 0;
  }

  .layout.pc-sidebar-collapsed .sidebar-expand-btn:hover,
  .layout.pc-sidebar-collapsed .sidebar-reopen-btn:hover {
    background: var(--gold-100) !important;
    border-color: var(--gold-500) !important;
  }
}

.topbar-center-select {
  max-width: 300px;
  min-width: 110px;
  text-overflow: ellipsis;
}

.topbar-center-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  color: var(--navy-950);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-user-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.topbar-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 5px;
  border-radius: 999px;
  background: var(--navy-50);
  border: 1px solid var(--navy-100);
  color: var(--navy-950);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.topbar-user-pill:hover {
  background: var(--gold-50);
  border-color: var(--gold-400);
  text-decoration: none;
}

.topbar-user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy-950);
  color: var(--gold-400);
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.12;
  max-width: 136px;
  min-width: 0;
}

.topbar-user-name {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--navy-950);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.topbar-user-role {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.topbar-logout-btn {
  flex-shrink: 0;
}

.topbar-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(11, 37, 69, 0.14);
  padding: 6px;
  z-index: 95;
}

.topbar-user-menu.open .topbar-user-dropdown,
.topbar-user-dropdown.open {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 768px) {
  .topbar-center-badge,
  .topbar-center-select {
    display: none !important;
  }
  .topbar-user-meta {
    display: none;
  }
  .topbar-user-pill {
    padding: 0 4px;
    width: 34px;
    height: 34px;
    justify-content: center;
  }
}

/* ---------- CLEAN MOBILE BOTTOM NAV (NAVY + WHITE) ---------- */
@media (max-width: 960px) {
  .mobile-bottom-nav {
    background: #FFFFFF;
    border-top: 1px solid #E2E8F0;
    box-shadow: 0 -4px 18px rgba(11, 37, 69, 0.08);
  }
  .mob-nav-item {
    color: #475569 !important;
  }
  .mob-nav-item.active {
    background: #0B2545 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 8px rgba(11, 37, 69, 0.22) !important;
  }
  .mob-nav-item.active span,
  .mob-nav-item.active small {
    color: #FFFFFF !important;
  }
}

/* ---------- PORTAL MOBILE "THÊM" DRAWER SHEET ---------- */
.portal-more-backdrop[hidden],
.portal-more-sheet[hidden] {
  display: none !important;
}

.portal-more-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 37, 69, 0.48);
  backdrop-filter: blur(2px);
  z-index: 92;
}

.portal-more-backdrop.open {
  display: block;
}

.portal-more-sheet {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 62px;
  z-index: 96;
  background: var(--white);
  border-top: 1px solid var(--border-subtle);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 32px rgba(11, 37, 69, 0.18);
  padding: 14px 14px 16px;
  max-height: 70vh;
  overflow-y: auto;
}

.portal-more-sheet.open {
  display: block;
  animation: portalMoreSlideUp 0.18s ease-out;
}

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

.portal-more-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 800;
  font-size: 14.5px;
  color: var(--navy-950);
}

.portal-more-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.portal-more-item {
  display: flex !important;
  align-items: center;
  justify-content: flex-start !important;
  gap: 10px;
  width: 100%;
  padding: 11px 14px !important;
  border-radius: 12px !important;
  background: var(--navy-50) !important;
  border: 1px solid var(--navy-100) !important;
  box-shadow: none !important;
  color: var(--navy-950) !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  text-decoration: none;
  cursor: pointer;
}

.portal-more-item:hover {
  background: var(--gold-50) !important;
  border-color: var(--gold-400) !important;
  text-decoration: none;
}

.portal-more-item.active {
  background: var(--navy-950) !important;
  border-color: var(--navy-950) !important;
  color: #FFFFFF !important;
}

.portal-more-item.portal-more-logout {
  background: var(--danger-bg) !important;
  border-color: #FCA5A5 !important;
  color: var(--danger-fg) !important;
}

/* ---------- EYE-CARE MODE HIGH-CONTRAST GUARANTEE (>= 4.5:1) ---------- */
body.ui-bold-eye-care .sidebar a.nav-link {
  color: #F1F5F9 !important;
  font-weight: 700 !important;
}

body.ui-bold-eye-care .sidebar a.nav-link:hover {
  color: #FFFFFF !important;
}

body.ui-bold-eye-care .sidebar a.nav-link.active {
  color: #0B2545 !important;
  font-weight: 800 !important;
}

body.ui-bold-eye-care .sidebar button.nav-title {
  color: #FDE68A !important;
  font-weight: 800 !important;
}

body.ui-bold-eye-care th {
  color: #FFFFFF !important;
  font-weight: 800 !important;
}

body.ui-bold-eye-care .portal-hero-banner,
body.ui-bold-eye-care .portal-hero-banner h1,
body.ui-bold-eye-care .portal-hero-banner h2,
body.ui-bold-eye-care .portal-hero-banner p {
  color: #FFFFFF !important;
}

body.ui-bold-eye-care .portal-hero-banner .muted {
  color: #E2E8F0 !important;
}

body.ui-bold-eye-care .rs-class-pill.active,
body.ui-bold-eye-care .rs-class-pill.active .rs-class-pill-title,
body.ui-bold-eye-care .rs-class-pill.active .rs-class-pill-meta,
body.ui-bold-eye-care .tc-toggle-btn,
body.ui-bold-eye-care .mob-nav-item.active,
body.ui-bold-eye-care .mob-nav-item.active span,
body.ui-bold-eye-care .mob-nav-item.active small,
body.ui-bold-eye-care .portal-more-item.active,
body.ui-bold-eye-care .tab-btn.active,
body.ui-bold-eye-care button.navy,
body.ui-bold-eye-care .btn.navy,
body.ui-bold-eye-care .rs-seg-btn.active,
body.ui-bold-eye-care .rp-role-pill.active,
body.ui-bold-eye-care .dub-subtitle-live {
  color: #FFFFFF !important;
  font-weight: 800 !important;
}

body.ui-bold-eye-care .tab-btn.active {
  color: #FDE68A !important;
}

/* ============================================================================
   LOGIN PAGE POLISH — KHÓA CHIỀU RỘNG GỌN 440PX (TRÁNH .card { max-width:100% })
   ============================================================================ */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background:
    radial-gradient(circle at 82% 16%, rgba(245, 158, 11, 0.20) 0%, transparent 42%),
    radial-gradient(circle at 14% 86%, rgba(56, 189, 248, 0.14) 0%, transparent 45%),
    linear-gradient(155deg, #071A33 0%, #0E2F5E 52%, #0B2545 100%);
}

.login-wrap .card.login-card {
  width: 100%;
  max-width: 440px !important;
  margin: 0 auto !important;
  padding: 32px 30px 26px !important;
  border-radius: 22px;
  background: #FFFFFF;
  border: 1px solid rgba(251, 191, 36, 0.42);
  box-shadow:
    0 24px 60px rgba(4, 15, 34, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  position: relative;
  overflow: hidden;
}

.login-wrap .card.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #F59E0B 0%, #FBBF24 55%, #0B2545 100%);
}

.login-brand-head {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo-badge {
  width: 60px;
  height: 60px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: linear-gradient(145deg, #FEF3C7 0%, #FDE68A 100%);
  border: 1.5px solid #F59E0B;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo-badge img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
}

.login-title {
  margin: 0 0 4px;
  font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.2;
  color: #0B2545;
  letter-spacing: -0.01em;
}

.login-subtitle {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: #475569;
  font-weight: 500;
}

.login-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.login-pills span {
  font-size: 11.5px;
  font-weight: 700;
  color: #1E3A5F;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  padding: 4px 10px;
  line-height: 1.2;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-field label {
  font-size: 13px;
  font-weight: 700;
  color: #0F294A;
  margin: 0;
}

.login-field input {
  width: 100%;
  height: 46px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid #CBD5E1;
  background: #F8FAFC;
  color: #0B2545;
  font-size: 14.5px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.login-field input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: #F59E0B;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}

.login-pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-pass-wrap input {
  padding-right: 46px;
}

.login-pass-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  min-height: 34px !important;
  padding: 0 !important;
  border-radius: 9px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #475569 !important;
  font-size: 16px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.login-pass-toggle:hover {
  background: #E2E8F0 !important;
  color: #0B2545 !important;
}

.login-error-box {
  padding: 10px 12px;
  border-radius: 10px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}

.login-submit-btn {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  border-radius: 12px !important;
  font-size: 15.5px !important;
  font-weight: 800 !important;
  color: #0B2545 !important;
  background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%) !important;
  border: 1px solid #D97706 !important;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.30) !important;
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.login-submit-btn:hover:not(:disabled) {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.38) !important;
}

.login-submit-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.login-footer-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px dashed #CBD5E1;
  text-align: center;
  font-size: 12.5px;
  color: #475569;
  line-height: 1.55;
}

.login-footer-note b {
  color: #0B2545;
}

@media (max-width: 520px) {
  .login-wrap {
    padding: 16px 12px;
  }
  .login-wrap .card.login-card {
    padding: 24px 18px 20px !important;
    border-radius: 18px;
  }
  .login-title {
    font-size: 22px;
  }
  .login-pills span {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* ============================================================================
   GRADING QUEUE BY CLASS, TOOLBAR, GROUPED HEADERS & PAGINATION (v71)
   ============================================================================ */
.badge.danger {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.gq-card {
  max-width: 100%;
  min-width: 0;
}

.gq-head-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 12px;
}

.gq-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gq-pill-warn {
  color: #B45309;
  font-weight: 800;
}

.gq-pill-ok {
  color: #15803D;
  font-weight: 700;
}

.rs-class-pill.active .gq-pill-warn {
  color: #FDE68A !important;
}

.rs-class-pill.active .gq-pill-ok {
  color: #86EFAC !important;
}

.gq-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}

.gq-search {
  flex: 1 1 200px;
  min-width: 0;
  height: 36px;
  padding: 6px 12px !important;
  font-size: 13.5px !important;
  border-radius: 9px !important;
  margin: 0 !important;
}

.gq-select,
.gq-select-sm {
  height: 36px;
  padding: 5px 10px !important;
  font-size: 13px !important;
  border-radius: 9px !important;
  margin: 0 !important;
  max-width: 100%;
}

.gq-select {
  flex: 0 1 210px;
  min-width: 0;
}

.gq-select-sm {
  flex: 0 0 auto;
  width: auto !important;
}

.gq-group-btn {
  height: 36px;
  white-space: nowrap;
  flex-shrink: 0;
}

.gq-group-btn.active {
  background: var(--navy-950) !important;
  border-color: var(--navy-950) !important;
  color: #FFFFFF !important;
}

.gq-group-section {
  margin-bottom: 16px;
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  overflow: hidden;
  background: #FFFFFF;
}

.gq-group-section .table-wrap {
  margin: 0;
  border: none;
  border-radius: 0;
}

.gq-group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(90deg, #F0F5FA 0%, #F8FAFC 100%);
  border-bottom: 1px solid #CBD5E1;
  border-left: 4px solid var(--navy-950);
}

.gq-group-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: var(--navy-950);
}

.gq-group-meta {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
}

.gq-group-warn {
  color: #B45309;
  font-weight: 800;
}

.gq-group-ok {
  color: #15803D;
  font-weight: 700;
}

.gq-group-danger {
  color: #DC2626;
  font-weight: 800;
}

.gq-urgent-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
}

.gq-urgent-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #92400E;
  white-space: nowrap;
}

.gq-urgent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px !important;
  min-height: 30px !important;
  border-radius: 999px !important;
  background: #FFFFFF !important;
  color: #0B2545 !important;
  border: 1.5px solid #F59E0B !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.gq-urgent-chip:hover {
  background: #FEF3C7 !important;
}

.gq-urgent-chip.active {
  background: #0B2545 !important;
  color: #FFFFFF !important;
  border-color: #0B2545 !important;
}

.gq-urgent-chip.active .gq-urgent-cnt {
  color: #FDE68A;
}

.gq-urgent-chip.is-clear {
  border-color: #CBD5E1 !important;
  color: #475569 !important;
}

.gq-urgent-cnt {
  color: #B45309;
  font-weight: 800;
}

.gq-class-select {
  flex: 1.4 1 260px;
  min-width: 220px;
  max-width: 100%;
  font-weight: 700;
}

.gq-late-cell {
  min-width: 260px;
}

.gq-late-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.gq-late-inp {
  flex: 1 1 auto;
  min-width: 170px;
  height: 34px !important;
  padding: 4px 10px !important;
  font-size: 12.5px !important;
  border-radius: 8px !important;
  border: 1.5px solid #CBD5E1 !important;
  background: #FFFFFF;
}

.gq-late-inp.has-val {
  border-color: #F59E0B !important;
  background: #FFFBEB;
}

.gq-late-save-btn {
  flex: 0 0 auto;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 10px !important;
  white-space: nowrap;
}

.gq-late-meta {
  font-size: 11px;
  color: #64748B;
  margin-top: 3px;
}

.gq-late-note-tag {
  margin-top: 3px;
  font-size: 11.5px;
  color: #B45309;
  font-weight: 600;
}

.gq-media-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
  min-width: 0;
}

.gq-media-yt {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.gq-yt-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-950);
  text-decoration: none;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  white-space: nowrap;
}

.gq-yt-link:hover {
  border-color: var(--gold-500);
  background: #FFFBEB;
}

.gq-audio-player {
  height: 32px;
  width: 196px;
  max-width: 100%;
}

.gq-feedback-snip {
  font-size: 11.5px;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gq-grader-sub {
  font-size: 11px;
  margin-top: 3px;
}

.gq-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #E2E8F0;
}

.gq-page-summary {
  font-size: 13px;
  color: #475569;
}

.gq-page-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.gq-page-btn {
  min-width: 34px;
  padding: 5px 10px !important;
}

.gq-page-btn.active {
  background: var(--navy-950) !important;
  border-color: var(--navy-950) !important;
  color: #FFFFFF !important;
}

.gq-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gq-page-ellipsis {
  padding: 0 4px;
  color: #64748B;
  font-weight: 700;
}

.gq-dash-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
}

.gq-dash-chips-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy-950);
  white-space: nowrap;
}

.gq-dash-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  background: #FFFFFF !important;
  border: 1px solid #F59E0B !important;
  color: var(--navy-950) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  cursor: pointer;
}

.gq-dash-chip:hover {
  background: var(--navy-950) !important;
  border-color: var(--navy-950) !important;
  color: #FFFFFF !important;
}

.gq-dash-chip-cnt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #FEF3C7;
  color: #B45309;
  font-size: 11px;
  font-weight: 800;
}

.gq-dash-chip:hover .gq-dash-chip-cnt {
  background: var(--gold-500);
  color: var(--navy-950);
}

body.ui-bold-eye-care .gq-group-btn.active,
body.ui-bold-eye-care .gq-page-btn.active {
  color: #FFFFFF !important;
  font-weight: 800 !important;
}

@media (max-width: 640px) {
  .gq-toolbar {
    padding: 8px;
    gap: 6px;
  }
  .gq-search,
  .gq-select,
  .gq-group-btn {
    flex: 1 1 100%;
    width: 100%;
  }
  .gq-select-sm {
    width: 100% !important;
  }
  .gq-pagination {
    flex-direction: column;
    align-items: stretch;
  }
  .gq-page-controls {
    justify-content: flex-start;
  }
  .gq-group-header {
    padding: 8px 10px;
  }
  .gq-group-filter-btn {
    width: 100%;
  }
}

/* ============================================================================
   FLIPBOOK READING QUEST — DAILY CAP PILL, COMPLETED GREEN CARD & TRACKER
   ============================================================================ */
.fb-daily-quest-pill {
  padding: 7px 14px;
  font-weight: 800;
  line-height: 1.3;
  white-space: normal;
  text-align: left;
  max-width: 100%;
}

.fb-daily-quest-pill.is-gold {
  background: rgba(245, 158, 11, 0.22);
  color: #FEF3C7;
  border: 1px solid rgba(251, 191, 36, 0.65);
}

.fb-daily-quest-pill.is-capped {
  background: rgba(22, 163, 74, 0.3);
  color: #DCFCE7;
  border: 1px solid rgba(134, 239, 172, 0.7);
}

.flipbook-card.is-completed {
  border-color: #86EFAC;
  border-left-color: #16A34A;
  box-shadow: inset 0 3px 0 #22C55E, 0 6px 18px rgba(22, 163, 74, 0.12);
}

.flipbook-card.is-completed:hover {
  border-color: #22C55E;
  border-left-color: #15803D;
  box-shadow: inset 0 3px 0 #16A34A, 0 14px 28px rgba(22, 163, 74, 0.18);
}

button.fb-read-btn.is-completed {
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  color: #FFFFFF;
  border: 1px solid #15803D;
  box-shadow: 0 2px 0 #15803D;
  font-weight: 800;
}

button.fb-read-btn.is-completed:hover {
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  filter: brightness(1.07);
}

button.fb-read-btn.is-completed:active {
  box-shadow: 0 1px 0 #15803D;
}

.fb-quest-bar {
  background: #F8FAFC;
  border: 1.5px solid #CBD5E1;
  border-left: 4px solid var(--gold-500);
  border-radius: 12px;
  padding: 11px 14px;
  margin-bottom: 12px;
}

.fb-quest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.fb-quest-title {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--navy-950);
}

.fb-quest-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.fb-quest-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: #EFF6FF;
  color: #1E3A8A;
  border: 1px solid #BFDBFE;
  line-height: 1.35;
  max-width: 100%;
}

.fb-quest-pill.is-done {
  background: #DCFCE7;
  color: #166534;
  border-color: #86EFAC;
}

.fb-quest-pill.is-paused {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FCD34D;
}

.fb-quest-done-banner {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #DCFCE7;
  border: 1px solid #86EFAC;
  color: #166534;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.fb-quest-cap-note {
  margin-top: 8px;
  padding: 7px 11px;
  border-radius: 9px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #92400E;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

button.fb-claim-ready {
  background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
  color: #FFFFFF;
  border: 1px solid #15803D;
  box-shadow: 0 3px 0 #15803D, 0 8px 20px rgba(22, 163, 74, 0.25);
  font-weight: 800;
}

button.fb-claim-ready:hover {
  background: linear-gradient(135deg, #22C55E 0%, #15803D 100%);
  filter: brightness(1.06);
}

button.fb-claim-locked,
button.fb-claim-locked:disabled {
  background: #E2E8F0;
  color: #475569;
  border: 1px solid #CBD5E1;
  box-shadow: none;
  opacity: 1;
  cursor: not-allowed;
  font-weight: 700;
}

body.ui-bold-eye-care button.fb-read-btn.is-completed,
body.ui-bold-eye-care button.fb-claim-ready {
  color: #FFFFFF !important;
  font-weight: 800 !important;
}

body.ui-bold-eye-care .fb-daily-quest-pill.is-gold {
  color: #FEF3C7 !important;
}

body.ui-bold-eye-care .fb-daily-quest-pill.is-capped {
  color: #DCFCE7 !important;
}

@media (max-width: 640px) {
  .fb-quest-bar {
    padding: 10px 11px;
  }
  .fb-quest-pill {
    border-radius: 10px;
    white-space: normal;
    font-size: 12px;
    padding: 6px 10px;
  }
  #fbCompleteBookBtn,
  #fbInlineCompleteBtn {
    max-width: 100%;
    white-space: normal;
    line-height: 1.3;
    text-align: center;
  }
  .fb-daily-quest-pill {
    font-size: 12px;
    padding: 6px 10px;
  }
}

/* ============================================================================
   ACCOUNTING-GRADE TUITION CHECKLIST: CENTER BANNER, CLASS SELECT & DEBT CHIPS
   ============================================================================ */
.tc-center-banner {
  background: linear-gradient(135deg, #0B2545 0%, #133C7A 100%);
  color: #FFFFFF;
  border: 1.5px solid #0B2545;
  border-bottom: 3px solid #F59E0B;
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 10px 26px rgba(11, 37, 69, 0.16);
  max-width: 100%;
  overflow: hidden;
}

.tc-center-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 12px;
}

.tc-center-title {
  font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif;
  font-size: 17.5px;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.01em;
}

.tc-center-sub {
  font-size: 12.5px;
  color: #CBD5E1;
  font-weight: 600;
}

.tc-center-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.tc-center-metric {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.tc-center-metric.is-paid {
  border-left: 3px solid #22C55E;
}

.tc-center-metric.is-debt {
  border-left: 3px solid #F87171;
  background: rgba(220, 38, 38, 0.16);
  border-color: rgba(248, 113, 113, 0.35);
}

.tc-center-metric-lbl {
  font-size: 11.5px;
  color: #E2E8F0;
  font-weight: 600;
}

.tc-center-metric-val {
  font-size: 15.5px;
  font-weight: 800;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-center-metric.is-paid .tc-center-metric-val {
  color: #86EFAC;
}

.tc-center-metric.is-debt .tc-center-metric-val {
  color: #FECACA;
}

.tc-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tc-class-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 340px;
  min-width: 0;
  max-width: 100%;
}

.tc-class-label {
  font-size: 13px;
  font-weight: 800;
  color: var(--navy-950);
  white-space: nowrap;
  margin: 0;
  flex-shrink: 0;
}

.tc-class-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  height: 38px !important;
  padding: 0 12px !important;
  border-radius: 10px !important;
  border: 1.5px solid #0B2545 !important;
  background: #FFFFFF !important;
  color: #0B2545 !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 6px rgba(11, 37, 69, 0.08);
  cursor: pointer;
}

.tc-class-select:focus {
  outline: none;
  border-color: #F59E0B !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22);
}

.tc-unpaid-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px 11px;
  border-radius: 11px;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  max-width: 100%;
}

.tc-unpaid-chips-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #991B1B;
  white-space: nowrap;
}

.tc-unpaid-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  background: #FFFFFF !important;
  border: 1px solid #FCA5A5 !important;
  color: #0B2545 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  cursor: pointer;
  max-width: 100%;
  white-space: nowrap;
}

.tc-unpaid-chip:hover {
  background: #0B2545 !important;
  border-color: #0B2545 !important;
  color: #FFFFFF !important;
}

.tc-unpaid-chip.is-active {
  background: #0B2545 !important;
  border-color: #F59E0B !important;
  color: #FFFFFF !important;
  box-shadow: 0 2px 8px rgba(11, 37, 69, 0.22) !important;
}

.tc-unpaid-chip-cnt {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: #FEE2E2;
  color: #B91C1C;
  font-size: 11px;
  font-weight: 800;
}

.tc-unpaid-chip:hover .tc-unpaid-chip-cnt,
.tc-unpaid-chip.is-active .tc-unpaid-chip-cnt {
  background: #F59E0B;
  color: #0B2545;
}

body.ui-bold-eye-care .tc-center-banner,
body.ui-bold-eye-care .tc-center-title,
body.ui-bold-eye-care .tc-center-metric-val,
body.ui-bold-eye-care .tc-unpaid-chip.is-active {
  color: #FFFFFF !important;
}

body.ui-bold-eye-care .tc-center-metric.is-paid .tc-center-metric-val {
  color: #86EFAC !important;
}

body.ui-bold-eye-care .tc-center-metric.is-debt .tc-center-metric-val {
  color: #FECACA !important;
}

@media (max-width: 900px) {
  .tc-center-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .tc-center-banner {
    padding: 12px 13px;
    border-radius: 13px;
  }
  .tc-center-title {
    font-size: 15.5px;
  }
  .tc-center-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .tc-center-metric {
    padding: 8px 9px;
  }
  .tc-center-metric-val {
    font-size: 13.5px;
  }
  .tc-class-picker {
    flex: 1 1 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .tc-class-select {
    font-size: 13px !important;
  }
  .tc-unpaid-chips {
    padding: 8px 9px;
  }
  .tc-unpaid-chip {
    white-space: normal;
    text-align: left;
  }
}

/* ============================================================================
   PER-STUDENT ATTENDANCE & 3-ROLE ATTENDANCE STATISTICS (v77)
   ============================================================================ */
#modal-root .modal-box:has(.att-modal-wrap),
.modal:has(.att-modal-wrap),
.modal-card:has(.att-modal-wrap) {
  max-width: min(960px, 96vw);
  width: min(960px, 96vw);
}

.att-modal-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
  min-width: 0;
  max-height: 76vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.att-modal-wrap .table-wrap,
.att-table-wrap,
#attInlineListWrap,
#attModalListWrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.att-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  max-width: 100%;
}

.att-toolbar > label {
  max-width: 100%;
  min-width: 0;
}

.att-toolbar + .att-live-strip {
  margin-top: 10px;
  margin-bottom: 10px;
}

.att-modal-wrap .att-toolbar + .att-live-strip {
  margin-top: 0;
  margin-bottom: 0;
}

.att-toolbar select {
  min-width: 0;
  max-width: 100%;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid #0B2545;
  background: #FFFFFF;
  color: #0B2545;
  font-weight: 700;
  padding: 0 10px;
}

.att-live-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  border-radius: 11px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  font-size: 12.5px;
  font-weight: 700;
  color: #0B2545;
  max-width: 100%;
}

.att-status-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

button.att-btn,
.att-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 10px !important;
  min-height: 32px !important;
  border-radius: 8px !important;
  border: 1.5px solid #CBD5E1 !important;
  background: #F8FAFC !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none !important;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, transform 0.1s ease;
}

button.att-btn:hover,
.att-btn:hover {
  transform: translateY(-1px);
}

button.att-btn.is-present:hover,
.att-btn.is-present:hover {
  border-color: #16A34A !important;
  background: #F0FDF4 !important;
  color: #15803D !important;
}

button.att-btn.is-late:hover,
.att-btn.is-late:hover {
  border-color: #D97706 !important;
  background: #FFFBEB !important;
  color: #B45309 !important;
}

button.att-btn.is-absent:hover,
.att-btn.is-absent:hover {
  border-color: #DC2626 !important;
  background: #FEF2F2 !important;
  color: #B91C1C !important;
}

button.att-btn.is-excused:hover,
.att-btn.is-excused:hover {
  border-color: #2563EB !important;
  background: #EFF6FF !important;
  color: #1D4ED8 !important;
}

button.att-btn.is-present.active,
.att-btn.is-present.active {
  background: #16A34A !important;
  border-color: #15803D !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.28) !important;
}

button.att-btn.is-late.active,
.att-btn.is-late.active {
  background: #D97706 !important;
  border-color: #B45309 !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(217, 119, 6, 0.28) !important;
}

button.att-btn.is-absent.active,
.att-btn.is-absent.active {
  background: #DC2626 !important;
  border-color: #B91C1C !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.28) !important;
}

button.att-btn.is-excused.active,
.att-btn.is-excused.active {
  background: #2563EB !important;
  border-color: #1D4ED8 !important;
  color: #FFFFFF !important;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.26) !important;
}

button.att-btn.is-clear,
.att-btn.is-clear {
  background: #F8FAFC !important;
  border-color: #CBD5E1 !important;
  color: #64748B !important;
  padding: 5px 9px !important;
  font-size: 12px !important;
}

button.att-btn.is-clear:hover:not(:disabled),
.att-btn.is-clear:hover:not(:disabled) {
  background: #FEF2F2 !important;
  border-color: #DC2626 !important;
  color: #B91C1C !important;
}

button.att-btn.is-clear:disabled,
.att-btn.is-clear:disabled {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
}

.att-clear-all-btn {
  border-color: #FCA5A5 !important;
  color: #B91C1C !important;
}

.att-clear-all-btn:hover:not(:disabled) {
  background: #FEF2F2 !important;
  border-color: #DC2626 !important;
}

.att-note-inp {
  width: 100%;
  min-width: 130px;
  max-width: 100%;
  height: 34px !important;
  padding: 4px 10px !important;
  border-radius: 8px !important;
  border: 1px solid #CBD5E1 !important;
  background: #FFFFFF !important;
  color: #0B2545 !important;
  font-size: 12.5px !important;
}

.att-note-inp:focus {
  outline: none;
  border-color: #F59E0B !important;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

/* 4-card KPI grid (used in Student Schedule & Admin Class Attendance Stats) */
.att-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.att-kpi-card {
  padding: 12px 14px;
  border-radius: 12px;
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-top: 3px solid #0B2545;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  box-shadow: 0 2px 8px rgba(11, 37, 69, 0.05);
}

.att-kpi-card.is-navy {
  border-top-color: #0B2545;
}

.att-kpi-card.is-present {
  border-top-color: #16A34A;
  background: linear-gradient(180deg, #F0FDF4 0%, #FFFFFF 48%);
}

.att-kpi-card.is-late {
  border-top-color: #D97706;
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 48%);
}

.att-kpi-card.is-absent {
  border-top-color: #DC2626;
  background: linear-gradient(180deg, #FEF2F2 0%, #FFFFFF 48%);
}

.att-kpi-card.is-excused {
  border-top-color: #2563EB;
  background: linear-gradient(180deg, #EFF6FF 0%, #FFFFFF 48%);
}

.att-kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  line-height: 1.3;
}

.att-kpi-val {
  font-size: 20px;
  font-weight: 800;
  color: #0B2545;
  line-height: 1.2;
}

.att-kpi-card.is-present .att-kpi-val {
  color: #15803D;
}

.att-kpi-card.is-late .att-kpi-val {
  color: #B45309;
}

.att-kpi-card.is-absent .att-kpi-val {
  color: #DC2626;
}

.att-kpi-card.is-excused .att-kpi-val {
  color: #1D4ED8;
}

.att-kpi-sub {
  font-size: 11.5px;
  color: #64748B;
  font-weight: 600;
  line-height: 1.35;
}

/* Matrix dots for per-session class attendance overview */
.att-matrix-dots {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  max-width: 100%;
}

.att-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  color: #FFFFFF;
  flex-shrink: 0;
  border: 1px solid rgba(15, 23, 42, 0.12);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.att-dot[data-att-dot-sid]:hover {
  transform: scale(1.28);
  box-shadow: 0 0 0 2px rgba(11, 37, 69, 0.22);
}

.att-dot.p {
  background: #16A34A;
  border-color: #15803D;
}

.att-dot.l {
  background: #D97706;
  border-color: #B45309;
}

.att-dot.a {
  background: #DC2626;
  border-color: #B91C1C;
}

.att-dot.e {
  background: #2563EB;
  border-color: #1D4ED8;
}

.att-dot.u {
  background: #E2E8F0;
  border-color: #CBD5E1;
  color: #64748B;
}

/* Student & Parent compact attendance summary strip & session badges */
.att-stu-stats-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.att-stat-chip {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  color: #0B2545;
  max-width: 100%;
}

.att-stat-chip.is-present {
  background: #F0FDF4;
  border-color: #86EFAC;
  color: #166534;
}

.att-stat-chip.is-absent {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #991B1B;
}

.att-stat-chip.is-late {
  background: #FFFBEB;
  border-color: #FDE68A;
  color: #92400E;
}

.att-stat-chip.is-excused {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1E40AF;
}

.att-stat-chip.is-rate {
  background: #0B2545;
  border-color: #0B2545;
  color: #FBBF24;
}

.att-stat-sub {
  font-weight: 600;
  font-size: 11.5px;
  opacity: 0.9;
}

.att-session-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  max-width: 100%;
}

.att-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid transparent;
  line-height: 1.25;
}

.att-pill.is-present {
  background: #DCFCE7;
  border-color: #86EFAC;
  color: #166534;
}

.att-pill.is-late {
  background: #FEF3C7;
  border-color: #FCD34D;
  color: #92400E;
}

.att-pill.is-absent {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #991B1B;
}

.att-pill.is-excused {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #1E40AF;
}

.att-pill.is-unmarked {
  background: #F1F5F9;
  border-color: #CBD5E1;
  color: #475569;
}

.att-stu-note {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #78350F;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  max-width: 100%;
  word-break: break-word;
}

.att-history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
}

/* Eye-Care Mode compatibility for Attendance components */
body.ui-bold-eye-care button.att-btn.active,
body.ui-bold-eye-care .att-btn.active,
body.ui-bold-eye-care .att-dot.p,
body.ui-bold-eye-care .att-dot.l,
body.ui-bold-eye-care .att-dot.a,
body.ui-bold-eye-care .att-dot.e {
  color: #FFFFFF !important;
}

body.ui-bold-eye-care .att-stat-chip.is-rate,
body.ui-bold-eye-care .att-stat-chip.is-rate b {
  color: #FBBF24 !important;
}

body.ui-bold-eye-care button.att-btn:not(.active),
body.ui-bold-eye-care .att-btn:not(.active) {
  color: #0B2545 !important;
  border-color: #94A3B8 !important;
}

/* Responsive layout down to 390px (0 horizontal overflow) */
@media (max-width: 900px) {
  .att-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .att-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .att-kpi-card {
    padding: 10px 11px;
  }
  .att-kpi-val {
    font-size: 17px;
  }
  .att-toolbar {
    padding: 10px 11px;
    gap: 8px;
  }
  .att-toolbar select {
    width: 100%;
  }
  .att-live-strip {
    padding: 8px 10px;
    font-size: 12px;
  }
  button.att-btn,
  .att-btn {
    padding: 5px 8px !important;
    font-size: 11.5px !important;
  }
  .att-note-inp {
    min-width: 0;
  }
  .att-stat-chip {
    font-size: 11.5px;
    padding: 4px 8px;
  }
}

/* ============================================================================
   INSTANT BOOT SKELETON (FCP < 300ms — Navy + Amber Brand, Zero Purple)
   ============================================================================ */
@keyframes ansoundBootBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(15%); }
  100% { transform: translateX(210%); }
}

@keyframes ansoundBootPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

.ansound-boot-skeleton {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--canvas, #F4F7FB);
  overflow-x: hidden;
}

.ansound-boot-card {
  width: 100%;
  max-width: 340px;
  box-sizing: border-box;
  background: var(--white, #FFFFFF);
  border: 1px solid var(--border-subtle, #E2E8F0);
  border-radius: 18px;
  padding: 26px 24px;
  box-shadow: var(--shadow-navy-md, 0 10px 28px rgba(11, 37, 69, 0.08));
  text-align: center;
}

.ansound-boot-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background: var(--gold-50, #FFFBEB);
  border: 1.5px solid var(--gold-100, #FEF3C7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ansound-boot-title {
  font-family: 'Baloo 2', 'Be Vietnam Pro', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy-950, #0B2545);
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.ansound-boot-sub {
  margin-top: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-secondary, #475569);
}

.ansound-boot-track {
  position: relative;
  margin-top: 18px;
  height: 6px;
  width: 100%;
  border-radius: 999px;
  background: var(--navy-100, #E6EEF8);
  overflow: hidden;
}

.ansound-boot-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 48%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--navy-950, #0B2545) 0%, var(--gold-500, #F59E0B) 55%, var(--gold-600, #D97706) 100%);
  animation: ansoundBootBar 1.25s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@media (max-width: 480px) {
  .ansound-boot-skeleton {
    padding: 16px;
  }
  .ansound-boot-card {
    max-width: 100%;
    padding: 22px 18px;
  }
}

/* ============================================================================
   CLASS 3D GARDEN — INDIVIDUAL STUDENT TREES (.sg-*)
   AnSound Navy / Amber / Emerald palette · Zero Purple · 60 FPS Lightweight
   ============================================================================ */
.sg-page-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sg-toolbar-card {
  margin: 0;
  padding: 16px 18px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-top: 3px solid #16A34A;
  border-radius: 16px;
}

.sg-toolbar-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sg-class-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 240px;
  flex: 1 1 260px;
  max-width: 440px;
}

.sg-field-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  letter-spacing: 0.01em;
}

.sg-class-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1.5px solid #CBD5E1;
  background: #F8FAFC;
  color: #0B2545;
  font-weight: 700;
  font-size: 13.5px;
}

.sg-class-select:focus {
  outline: none;
  border-color: #16A34A;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
}

.sg-student-class-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sg-class-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ECFDF5;
  border: 1px solid #BBF7D0;
  color: #15803D;
  font-size: 12px;
  font-weight: 800;
}

.sg-class-title {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  color: #0B2545;
  line-height: 1.25;
}

.sg-toolbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.sg-search-inp {
  width: 200px;
  max-width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #0B2545;
  font-size: 13px;
}

.sg-filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sg-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 11px !important;
  border-radius: 999px !important;
  border: 1px solid #CBD5E1 !important;
  background: #F8FAFC !important;
  color: #334155 !important;
  font-size: 12.5px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  cursor: pointer;
  white-space: nowrap;
}

.sg-filter-pill.active {
  background: #0B2545 !important;
  border-color: #0B2545 !important;
  color: #FFFFFF !important;
}

.sg-filter-pill b {
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.sg-care-all-btn {
  height: 38px;
  padding: 0 14px !important;
  border-radius: 10px !important;
  background: linear-gradient(135deg, #16A34A 0%, #15803D 100%) !important;
  border: 1px solid #15803D !important;
  color: #FFFFFF !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  white-space: nowrap;
  cursor: pointer;
}

.sg-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #E2E8F0;
}

.sg-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  min-width: 0;
}

.sg-summary-item.is-amber {
  background: #FFFBEB;
  border-color: #FDE68A;
}

.sg-summary-item.is-emerald {
  background: #ECFDF5;
  border-color: #BBF7D0;
}

.sg-summary-item.is-alert {
  background: #FEF2F2;
  border-color: #FECACA;
}

.sg-sum-lbl {
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sg-sum-val {
  font-size: 17px;
  font-weight: 800;
  color: #0B2545;
  flex-shrink: 0;
}

.sg-summary-item.is-alert .sg-sum-val {
  color: #DC2626;
}

/* My Tree Hero (Student / Parent spotlight — single animated tree only) */
@keyframes sgHeroFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.sg-my-tree-hero {
  margin: 0;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: linear-gradient(135deg, #F0FDF4 0%, #FFFFFF 55%, #FFFBEB 100%);
  border: 1.5px solid #86EFAC;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(21, 128, 61, 0.08);
}

.sg-my-tree-hero.is-pest {
  background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 60%, #FEF2F2 100%);
  border-color: #F59E0B;
}

.sg-my-tree-hero.is-wilting {
  background: linear-gradient(135deg, #FEF2F2 0%, #FFFFFF 65%, #FFFBEB 100%);
  border-color: #FCA5A5;
}

.sg-my-tree-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #FFFFFF;
  border: 1px solid #DCFCE7;
  border-radius: 14px;
  padding: 10px;
}

.sg-my-tree-img {
  width: 104px;
  height: 104px;
  object-fit: contain;
  display: block;
  animation: sgHeroFloat 3.6s ease-in-out infinite;
  filter: drop-shadow(0 8px 14px rgba(11, 37, 69, 0.14));
}

.sg-my-tree-img.is-wilting {
  animation: none;
  filter: saturate(0.45) sepia(0.25);
  transform: rotate(-6deg);
}

@media (prefers-reduced-motion: reduce) {
  .sg-my-tree-img {
    animation: none;
  }
}

.sg-my-fruit-tag {
  font-size: 11px;
  font-weight: 800;
  color: #15803D;
  background: #DCFCE7;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.sg-my-tree-info {
  min-width: 0;
}

.sg-my-tree-badges {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.sg-my-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #0B2545;
  color: #FDE68A;
  font-size: 12px;
  font-weight: 800;
}

.sg-my-tree-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  color: #0B2545;
  line-height: 1.3;
}

.sg-my-xp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: #475569;
  flex-wrap: wrap;
}

.sg-my-alert {
  margin-top: 9px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}

.sg-my-alert.is-healthy {
  background: #ECFDF5;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.sg-my-alert.is-pest {
  background: #FFFBEB;
  color: #B45309;
  border: 1px solid #FDE68A;
}

.sg-my-alert.is-wilting {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FECACA;
}

.sg-my-tree-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 200px;
}

.sg-water-hero-btn {
  padding: 11px 16px !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #16A34A 0%, #15803D 100%) !important;
  border: 1px solid #15803D !important;
  color: #FFFFFF !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.25) !important;
  cursor: pointer;
}

.sg-water-hero-btn:disabled {
  background: #E2E8F0 !important;
  border-color: #CBD5E1 !important;
  color: #64748B !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

.sg-water-hint,
.sg-parent-readonly-note {
  font-size: 11.5px;
  color: #475569;
  line-height: 1.4;
  text-align: center;
}

.sg-parent-readonly-note {
  padding: 9px 12px;
  border-radius: 10px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  font-weight: 600;
}

/* Class Meadow Container & Grid */
.sg-meadow-wrap {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #F0FDF4 0%, #FAFDF7 42%, #FFFDF5 100%);
  border: 1.5px solid #BBF7D0;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.sg-meadow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sg-meadow-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #0B2545;
}

.sg-meadow-sub {
  font-size: 12.5px;
  color: #475569;
  margin-top: 2px;
}

.sg-meadow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}

/* Individual Student Tree Card (Zero infinite animations for 60 FPS with 30 trees) */
.sg-tree-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 11px 10px;
  border-radius: 14px;
  background: #FFFFFF;
  border: 1px solid #D1FAE5;
  box-shadow: 0 2px 8px rgba(11, 37, 69, 0.04);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  min-width: 0;
  box-sizing: border-box;
}

.sg-tree-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(11, 37, 69, 0.08);
  border-color: #86EFAC;
}

.sg-tree-card.is-me {
  border: 2px solid #F59E0B;
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 36%);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.16);
}

.sg-tree-card.is-pest {
  border-color: #FDE68A;
  background: linear-gradient(180deg, #FFFDF5 0%, #FFFFFF 45%);
}

.sg-tree-card.is-wilting {
  border-color: #FECACA;
  background: linear-gradient(180deg, #FEF2F2 0%, #FFFFFF 45%);
}

.sg-tree-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 22px;
}

.sg-rank-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: #F1F5F9;
  color: #334155;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sg-rank-pill.is-gold {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #F59E0B;
}

.sg-rank-pill.is-silver {
  background: #E2E8F0;
  color: #1E293B;
}

.sg-rank-pill.is-bronze {
  background: #FFEDD5;
  color: #9A3412;
}

.sg-status-pills {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sg-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.sg-status-pill.is-fruit {
  background: #DCFCE7;
  color: #15803D;
}

.sg-status-pill.is-pest {
  background: #FEE2E2;
  color: #B91C1C;
}

.sg-status-pill.is-wilting {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
}

.sg-tree-stage-box {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 78%, rgba(187, 247, 208, 0.45) 0%, rgba(240, 253, 244, 0.25) 60%, transparent 100%);
}

.sg-tree-img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  display: block;
}

.sg-tree-img.is-wilting {
  filter: saturate(0.45) sepia(0.25);
  transform: rotate(-6deg);
}

.sg-tree-student {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sg-tree-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  flex-shrink: 0;
}

.sg-tree-name {
  font-size: 13px;
  font-weight: 800;
  color: #0B2545;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.sg-me-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 1.5px 6px;
  border-radius: 999px;
  background: #F59E0B;
  color: #0B2545;
  flex-shrink: 0;
}

.sg-tree-xp-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sg-tree-xp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 11.5px;
}

.sg-tree-stage-lbl {
  color: #64748B;
  font-weight: 600;
}

.sg-tree-xp-val {
  color: #0B2545;
  font-weight: 800;
}

.sg-tree-xp-track {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: #E2E8F0;
  overflow: hidden;
}

.sg-tree-xp-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #22C55E 0%, #16A34A 100%);
}

.sg-tree-xp-fill.is-pest {
  background: linear-gradient(90deg, #F59E0B 0%, #D97706 100%);
}

.sg-tree-xp-fill.is-wilting {
  background: linear-gradient(90deg, #F87171 0%, #DC2626 100%);
}

.sg-tree-staff-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px dashed #E2E8F0;
}

.sg-mini-btn {
  height: 28px;
  padding: 0 8px !important;
  border-radius: 8px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sg-mini-btn.is-water {
  flex: 1 1 auto;
  background: #ECFDF5 !important;
  border: 1px solid #86EFAC !important;
  color: #15803D !important;
}

.sg-mini-btn.is-water:hover {
  background: #DCFCE7 !important;
}

.sg-mini-btn.is-clean {
  flex: 0 0 auto;
  background: #FFFBEB !important;
  border: 1px solid #FDE68A !important;
  color: #B45309 !important;
}

.sg-mini-btn.is-pest {
  flex: 0 0 auto;
  background: #FEF2F2 !important;
  border: 1px solid #FECACA !important;
  color: #B91C1C !important;
}

.sg-evo-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed #BBF7D0;
  font-size: 12px;
  color: #334155;
}

.sg-evo-title {
  font-weight: 800;
  color: #0B2545;
}

.sg-evo-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #FFFFFF;
  border: 1px solid #DCFCE7;
  font-weight: 600;
}

/* Bold Eye-Care Mode Compatibility */
body.ui-bold-eye-care .sg-tree-name,
body.ui-bold-eye-care .sg-sum-val,
body.ui-bold-eye-care .sg-class-title,
body.ui-bold-eye-care .sg-meadow-title {
  font-weight: 900;
  color: #0B2545;
}

body.ui-bold-eye-care .sg-tree-stage-lbl,
body.ui-bold-eye-care .sg-sum-lbl,
body.ui-bold-eye-care .sg-meadow-sub {
  color: #1E293B;
  font-weight: 700;
}

body.ui-bold-eye-care .sg-tree-card {
  border-width: 1.5px;
  border-color: #86EFAC;
}

/* Responsive Tablet & Mobile (390px: 2 trees/row, zero horizontal overflow) */
@media (max-width: 900px) {
  .sg-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sg-my-tree-hero {
    grid-template-columns: 104px minmax(0, 1fr);
  }
  .sg-my-tree-actions {
    grid-column: 1 / -1;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .sg-toolbar-card {
    padding: 12px;
  }
  .sg-toolbar-top {
    flex-direction: column;
    align-items: stretch;
  }
  .sg-class-picker-wrap {
    min-width: 0;
    max-width: 100%;
    flex: 1 1 auto;
  }
  .sg-toolbar-controls {
    justify-content: flex-start;
    width: 100%;
  }
  .sg-search-inp {
    width: 100%;
  }
  .sg-care-all-btn {
    width: 100%;
  }
  .sg-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .sg-summary-item {
    padding: 8px 10px;
  }
  .sg-sum-lbl {
    font-size: 11.5px;
  }
  .sg-sum-val {
    font-size: 15px;
  }
  .sg-my-tree-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 13px;
    gap: 12px;
  }
  .sg-my-tree-visual {
    flex-direction: row;
    justify-content: center;
    padding: 8px;
  }
  .sg-meadow-wrap {
    padding: 12px 10px;
    border-radius: 14px;
  }
  .sg-meadow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .sg-tree-card {
    padding: 9px 8px;
    gap: 6px;
  }
  .sg-tree-stage-box {
    height: 76px;
  }
  .sg-tree-img {
    width: 70px;
    height: 70px;
  }
  .sg-tree-name {
    font-size: 12px;
  }
  .sg-mini-btn {
    padding: 0 6px !important;
    font-size: 11px !important;
  }
}

/* ============================================================================
   GARDEN 3D RICH UPGRADE (v82): VALLEY BANNER, 5 SPECIES, 3 PESTS, FERTILIZER,
   DECORATIONS, TOP 1-3 CROWNS, 0.8s ACTION FX (ZERO PURPLE, 60 FPS)
   ============================================================================ */
.sg-valley-banner {
  position: relative;
  overflow: hidden;
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(240, 253, 244, 0.88) 55%, rgba(255, 251, 235, 0.90) 100%),
    url('/assets/garden3d/valley-bg-3d.webp');
  background-size: cover;
  background-position: center 62%;
  border: 1.5px solid #BBF7D0;
}

.sg-valley-content {
  position: relative;
  z-index: 1;
}

.sg-my-tree-hero-wrap {
  margin: 0;
  padding: 0;
  background: linear-gradient(135deg, #F0FDF4 0%, #FFFFFF 55%, #FFFBEB 100%);
  border: 1.5px solid #86EFAC;
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(21, 128, 61, 0.08);
  overflow: hidden;
}

.sg-my-tree-hero-wrap.is-pest {
  background: linear-gradient(135deg, #FFFBEB 0%, #FFFFFF 60%, #FEF2F2 100%);
  border-color: #F59E0B;
}

.sg-my-tree-hero-wrap.is-wilting {
  background: linear-gradient(135deg, #FEF2F2 0%, #FFFFFF 65%, #FFFBEB 100%);
  border-color: #FCA5A5;
}

.sg-my-tree-hero-wrap > .sg-my-tree-hero {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  grid-template-columns: 152px minmax(0, 1fr) 256px;
}

.sg-tree-stage-visual {
  position: relative;
  width: 132px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 78%, rgba(187, 247, 208, 0.55) 0%, rgba(240, 253, 244, 0.25) 62%, transparent 100%);
}

.sg-tree-stage-visual .sg-my-tree-img {
  width: 116px;
  height: 116px;
  position: relative;
  z-index: 2;
}

.sg-my-species-tag {
  font-size: 11px;
  font-weight: 800;
  color: #0B2545;
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Crown, Pest & Decor 3D Overlays */
.sg-crown-badge {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  object-fit: contain;
  z-index: 5;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(180, 83, 9, 0.35));
}

.sg-crown-badge.is-card {
  top: -2px;
  right: 4px;
  left: auto;
  transform: none;
  width: 22px;
  height: 22px;
}

.sg-pest-overlay {
  position: absolute;
  width: 32px;
  height: 32px;
  object-fit: contain;
  z-index: 4;
  filter: drop-shadow(0 3px 5px rgba(15, 23, 42, 0.28));
}

.sg-pest-overlay.pos-0 { top: 14px; right: 6px; }
.sg-pest-overlay.pos-1 { top: 26px; left: 4px; }
.sg-pest-overlay.pos-2 { bottom: 26px; right: 4px; }

.sg-pest-overlay.is-mini {
  width: 24px;
  height: 24px;
}

.sg-pest-overlay.is-mini.pos-0 { top: 4px; left: 4px; right: auto; }
.sg-pest-overlay.is-mini.pos-1 { bottom: 10px; right: 4px; top: auto; left: auto; }

.sg-decor-overlay {
  position: absolute;
  width: 30px;
  height: 30px;
  object-fit: contain;
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(11, 37, 69, 0.2));
}

.sg-decor-overlay.decor-butterfly { top: 6px; left: 6px; }
.sg-decor-overlay.decor-bee { top: 8px; right: 6px; }
.sg-decor-overlay.decor-mushroom { bottom: 4px; left: 8px; }

.sg-decor-overlay.is-mini {
  width: 22px;
  height: 22px;
}

.sg-decor-overlay.is-mini.decor-butterfly { top: 2px; left: 2px; }
.sg-decor-overlay.is-mini.decor-bee { top: 2px; right: 24px; }
.sg-decor-overlay.is-mini.decor-mushroom { bottom: 2px; left: 4px; }

/* 0.8s Action Effects (Water Pour & Fertilizer Glow) */
.sg-fx-can {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 44px;
  height: 44px;
  object-fit: contain;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
}

.sg-fx-sparkle {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 9px;
  border-radius: 999px;
  background: #16A34A;
  color: #FEF3C7;
  font-size: 12px;
  font-weight: 800;
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes sgWaterPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.45); }
  45% { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(14, 165, 233, 0.16); }
  100% { transform: scale(1); box-shadow: 0 0 0 18px rgba(14, 165, 233, 0); }
}

@keyframes sgCanPour {
  0% { opacity: 0; transform: translate(12px, -10px) rotate(0deg); }
  25% { opacity: 1; transform: translate(0, 0) rotate(-32deg); }
  75% { opacity: 1; transform: translate(-4px, 4px) rotate(-42deg); }
  100% { opacity: 0; transform: translate(-6px, -4px) rotate(-18deg); }
}

@keyframes sgFertGlow {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
  50% { transform: scale(1.07); box-shadow: 0 0 0 14px rgba(245, 158, 11, 0.25); }
  100% { transform: scale(1); box-shadow: 0 0 0 20px rgba(22, 163, 74, 0); }
}

@keyframes sgSparkleRise {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.85); }
  30% { opacity: 1; transform: translate(-50%, -2px) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -22px) scale(1); }
}

.sg-tree-stage-visual.is-fx-water,
.sg-tree-stage-box.is-fx-water {
  animation: sgWaterPulse 0.8s ease-out 1;
}

.sg-tree-stage-visual.is-fx-water .sg-fx-can {
  animation: sgCanPour 0.8s ease-out 1;
}

.sg-tree-stage-visual.is-fx-fert,
.sg-tree-stage-box.is-fx-fert {
  animation: sgFertGlow 0.8s ease-out 1;
}

.sg-tree-stage-visual.is-fx-fert .sg-fx-sparkle {
  animation: sgSparkleRise 0.8s ease-out 1;
}

/* Hero Action Buttons (Water, Fertilize, Species/Decor toggles) */
.sg-my-tree-hero-wrap .sg-my-tree-actions {
  gap: 7px;
  min-width: 240px;
}

.sg-water-hero-btn,
.sg-fert-hero-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.sg-fert-hero-btn {
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%) !important;
  border: 1px solid #B45309 !important;
  color: #0B2545 !important;
  box-shadow: 0 5px 14px rgba(217, 119, 6, 0.25) !important;
}

.sg-fert-hero-btn:disabled {
  background: #E2E8F0 !important;
  border-color: #CBD5E1 !important;
  color: #64748B !important;
  box-shadow: none !important;
  cursor: not-allowed;
}

.sg-btn-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.sg-btn-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.24);
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
}

.sg-fert-hero-btn .sg-btn-count {
  background: rgba(11, 37, 69, 0.14);
  color: #0B2545;
}

.sg-hero-btn-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.sg-picker-toggle-btn {
  height: 34px;
  padding: 0 8px !important;
  border-radius: 10px !important;
  border: 1px solid #CBD5E1 !important;
  background: #FFFFFF !important;
  color: #0B2545 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sg-picker-toggle-btn.active {
  background: #0B2545 !important;
  border-color: #0B2545 !important;
  color: #FDE68A !important;
}

/* Inline Collapsible Picker Panel (Species & Decorations) */
.sg-picker-panel {
  border-top: 1px dashed #CBD5E1;
  background: #F8FAFC;
  padding: 14px 18px;
}

.sg-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 13px;
  color: #0B2545;
}

.sg-species-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.sg-species-card {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 8px !important;
  border-radius: 12px !important;
  background: #FFFFFF !important;
  border: 1.5px solid #E2E8F0 !important;
  color: #0B2545 !important;
  box-shadow: none !important;
  cursor: pointer;
  text-align: center;
  min-width: 0;
}

.sg-species-card:hover:not(:disabled) {
  border-color: #22C55E !important;
  background: #F0FDF4 !important;
}

.sg-species-card.is-selected {
  border-color: #16A34A !important;
  background: #ECFDF5 !important;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.14) !important;
}

.sg-species-card img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.sg-species-name {
  font-size: 12px;
  font-weight: 800;
  color: #0B2545;
  line-height: 1.25;
}

.sg-species-state {
  font-size: 11px;
  font-weight: 700;
  color: #15803D;
}

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

.sg-decor-card {
  display: flex !important;
  align-items: center;
  gap: 10px;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  background: #FFFFFF !important;
  border: 1.5px solid #E2E8F0 !important;
  color: #0B2545 !important;
  box-shadow: none !important;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.sg-decor-card:hover:not(:disabled) {
  border-color: #F59E0B !important;
  background: #FFFBEB !important;
}

.sg-decor-card.is-equipped {
  border-color: #16A34A !important;
  background: #ECFDF5 !important;
}

.sg-decor-card.is-locked {
  opacity: 0.65;
  background: #F1F5F9 !important;
  cursor: not-allowed;
}

.sg-decor-card img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  flex-shrink: 0;
}

.sg-decor-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sg-decor-name {
  font-size: 12.5px;
  font-weight: 800;
  color: #0B2545;
}

.sg-decor-state {
  font-size: 11.5px;
  font-weight: 700;
  color: #15803D;
}

.sg-decor-card.is-locked .sg-decor-state {
  color: #64748B;
}

/* Top 1-3 Podium Cards in Meadow Grid */
.sg-tree-stage-box {
  position: relative;
}

.sg-tree-card.sg-top-1 {
  border: 2px solid #F59E0B;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.2);
  background: linear-gradient(180deg, #FFFBEB 0%, #FFFFFF 38%);
}

.sg-tree-card.sg-top-2 {
  border: 2px solid #94A3B8;
  box-shadow: 0 5px 14px rgba(100, 116, 139, 0.16);
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 38%);
}

.sg-tree-card.sg-top-3 {
  border: 2px solid #D97706;
  box-shadow: 0 5px 14px rgba(217, 119, 6, 0.16);
  background: linear-gradient(180deg, #FFF7ED 0%, #FFFFFF 38%);
}

/* Staff Controls: Fertilize + Pest Kind Popover */
.sg-mini-btn.is-fert {
  flex: 1 1 auto;
  background: #FFFBEB !important;
  border: 1px solid #F59E0B !important;
  color: #92400E !important;
}

.sg-mini-btn.is-fert:hover {
  background: #FEF3C7 !important;
}

.sg-pest-pop-wrap {
  position: relative;
  flex: 0 0 auto;
}

.sg-pest-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 146px;
  padding: 6px;
  border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  box-shadow: 0 10px 24px rgba(11, 37, 69, 0.18);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 25;
}

.sg-pest-popover[hidden] {
  display: none;
}

.sg-pest-opt-btn {
  width: 100%;
  padding: 6px 8px !important;
  border-radius: 7px !important;
  border: 1px solid transparent !important;
  background: #F8FAFC !important;
  color: #0B2545 !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  text-align: left;
  box-shadow: none !important;
  cursor: pointer;
  white-space: nowrap;
}

.sg-pest-opt-btn:hover {
  background: #FEF2F2 !important;
  border-color: #FECACA !important;
  color: #B91C1C !important;
}

@media (max-width: 960px) {
  .sg-my-tree-hero-wrap > .sg-my-tree-hero {
    grid-template-columns: 144px minmax(0, 1fr);
  }
  .sg-species-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sg-decor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .sg-my-tree-hero-wrap > .sg-my-tree-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .sg-my-tree-hero-wrap .sg-my-tree-actions {
    min-width: 0;
  }
  .sg-picker-panel {
    padding: 12px;
  }
  .sg-species-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .sg-decor-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .sg-tree-staff-actions {
    flex-wrap: wrap;
    gap: 4px;
  }
}
