/* ========================================================
   سامانه هوشمند حضور و غیاب مدارس (Hozour Smart School)
   طراحی مدرن کلیمورفیسم (Claymorphism Design System)
   تایپوگرافی ویژه فارسی با فونت استاندارد وزیرمتن
   ======================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
  --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Shabnam', 'Sahel', Tahoma, sans-serif;
  
  /* ================= Clay Color Palette ================= */
  --clay-bg: #edf2f9;
  --clay-surface: #f4f7fc;
  --clay-card: #ffffff;
  
  /* Primary & Slate Palette */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  
  --secondary: #0284c7;
  --secondary-light: #e0f2fe;

  /* Attendance Status Clay Colors */
  --present: #10b981;
  --present-hover: #059669;
  --present-bg: #ecfdf5;
  --present-border: #a7f3d0;
  --present-text: #065f46;

  --absent: #f43f5e;
  --absent-hover: #e11d48;
  --absent-bg: #fff1f2;
  --absent-border: #fecdd3;
  --absent-text: #9f1239;

  --late: #f59e0b;
  --late-hover: #d97706;
  --late-bg: #fffbeb;
  --late-border: #fde68a;
  --late-text: #92400e;

  /* Neutrals */
  --bg-body: #edf2f9;
  --bg-card: #ffffff;
  --border-color: rgba(203, 213, 225, 0.6);
  --border-light: rgba(241, 245, 249, 0.8);
  
  --text-main: #0f172a;
  --text-muted: #556987;
  --text-light: #8899ac;

  /* Radii for soft puffy Clay look */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
  --radius-full: 9999px;

  /* Clay Shadows (Multi-layered outer + inner highlight & depth) */
  --clay-shadow-sm: 4px 6px 14px -2px rgba(140, 155, 185, 0.22),
                    inset 2px 2px 4px rgba(255, 255, 255, 0.9),
                    inset -3px -3px 6px rgba(175, 188, 215, 0.25);

  --clay-shadow-card: 12px 18px 36px -6px rgba(125, 142, 175, 0.24),
                      4px 6px 12px -2px rgba(125, 142, 175, 0.12),
                      inset 3px 3px 6px rgba(255, 255, 255, 0.95),
                      inset -5px -6px 14px rgba(170, 185, 215, 0.22);

  --clay-shadow-button: 6px 10px 20px -3px rgba(120, 138, 175, 0.3),
                        inset 2px 2px 5px rgba(255, 255, 255, 0.75),
                        inset -3px -4px 7px rgba(0, 0, 0, 0.14);

  --clay-shadow-pressed: inset 3px 4px 8px rgba(0, 0, 0, 0.2),
                         inset -2px -2px 5px rgba(255, 255, 255, 0.85);

  --clay-shadow-sunken: inset 3px 4px 8px rgba(145, 162, 192, 0.32),
                        inset -3px -3px 6px rgba(255, 255, 255, 0.95);

  --clay-shadow-glow: 0 0 25px rgba(79, 70, 229, 0.32);

  --transition: all 0.24s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: all 0.15s ease-out;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  direction: rtl;
  text-align: right;
  background-color: var(--bg-body);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(224, 231, 255, 0.45) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(254, 243, 199, 0.35) 0%, transparent 35%),
    radial-gradient(circle at 50% 50%, rgba(236, 253, 245, 0.3) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01" on, "ss02" on;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

/* ================= Top Navigation Bar (Clay Style) ================= */
.top-navbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 8px 24px -6px rgba(120, 135, 165, 0.15);
}

.nav-container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

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

.brand-logo {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.4rem;
  box-shadow: 6px 8px 18px -3px rgba(79, 70, 229, 0.4),
              inset 2px 2px 4px rgba(255, 255, 255, 0.5),
              inset -2px -3px 5px rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.brand-logo:hover {
  transform: translateY(-2px) scale(1.03);
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.brand-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ================= Persian Date Controller Header (Clay Style) ================= */
.date-controller {
  display: flex;
  align-items: center;
  background: #e9eef7;
  border-radius: var(--radius-full);
  padding: 5px 6px;
  gap: 6px;
  box-shadow: var(--clay-shadow-sunken);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.date-btn {
  background: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  text-decoration: none;
  box-shadow: 2px 4px 8px rgba(120, 135, 165, 0.2),
              inset 1px 1px 3px rgba(255, 255, 255, 0.9),
              inset -2px -2px 4px rgba(160, 175, 205, 0.25);
  transition: var(--transition);
}

.date-btn:hover {
  background: #ffffff;
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 3px 6px 12px rgba(79, 70, 229, 0.25),
              inset 1px 1px 3px rgba(255, 255, 255, 0.9);
}

.date-btn:active {
  transform: translateY(1px) scale(0.95);
  box-shadow: var(--clay-shadow-pressed);
}

.date-current {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--primary);
  cursor: pointer;
  border-radius: var(--radius-full);
  background: #ffffff;
  box-shadow: 2px 4px 10px rgba(120, 135, 165, 0.18),
              inset 2px 2px 4px rgba(255, 255, 255, 0.9),
              inset -2px -2px 4px rgba(160, 175, 205, 0.2);
  transition: var(--transition);
  user-select: none;
}

.date-current:hover {
  transform: translateY(-1px);
  color: var(--primary-hover);
}

.date-today-tag {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  box-shadow: 1px 2px 4px rgba(79, 70, 229, 0.4),
              inset 1px 1px 2px rgba(255, 255, 255, 0.4);
}

/* Nav User & Actions */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* ================= Animated Segmented Navigation Tab Bar ================= */
.nav-tab-group {
  display: inline-flex;
  align-items: center;
  background: #e9eef7;
  padding: 4px;
  border-radius: var(--radius-full);
  box-shadow: var(--clay-shadow-sunken);
  border: 1px solid rgba(255, 255, 255, 0.7);
  gap: 4px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-tab-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.46rem 0.95rem;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: var(--radius-full);
  text-decoration: none !important;
  position: relative;
  user-select: none;
  transition: all 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: transparent;
}

.nav-tab-item svg {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), stroke 0.25s ease;
}

.nav-tab-item:hover {
  color: var(--primary);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.6);
}

.nav-tab-item:hover svg {
  transform: scale(1.15);
}

.nav-tab-item.active {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.42),
              inset 1px 1px 2px rgba(255, 255, 255, 0.5),
              inset -1px -1px 3px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px) scale(1.02);
  animation: tabPulsePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-tab-item.active svg {
  stroke: #ffffff;
}

@keyframes tabPulsePop {
  0% { transform: scale(0.92); }
  60% { transform: scale(1.06); }
  100% { transform: translateY(-1px) scale(1.02); }
}

.nav-tab-item:active {
  transform: scale(0.95);
}

/* User Profile Badge (Separated distinctively from tabs) */
.user-profile-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  background: #ffffff;
  border-radius: var(--radius-full);
  box-shadow: var(--clay-shadow-sm);
  border: 1px solid rgba(226, 232, 240, 0.9);
  user-select: none;
}

.user-avatar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: liveDotPulse 2s infinite ease-in-out;
}

@keyframes liveDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.badge-role {
  font-size: 0.82rem;
  padding: 0.4rem 0.9rem;
  background: #f0f3fa;
  color: var(--text-muted);
  font-weight: 800;
  border-radius: var(--radius-full);
  box-shadow: var(--clay-shadow-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-nav-logout {
  padding: 0.45rem 0.85rem;
  font-size: 0.84rem;
  border-radius: var(--radius-md);
  border: none;
  background: #ffffff;
  color: var(--absent);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  box-shadow: var(--clay-shadow-sm);
  transition: var(--transition);
  text-decoration: none !important;
}

.btn-nav-logout:hover {
  background: var(--absent-bg);
  color: var(--absent-hover);
  transform: translateY(-2px);
}

.btn-nav-logout:active {
  transform: translateY(1px) scale(0.96);
  box-shadow: var(--clay-shadow-pressed);
}

/* ================= Main Container with Page Switch Animation ================= */
@keyframes pageSwitchFadeSlide {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.988);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.main-content {
  flex: 1;
  max-width: 1220px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3.5rem 1.25rem;
  animation: pageSwitchFadeSlide 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ================= Stat Cards Grid (Claymorphism) ================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.2rem;
  margin-bottom: 1.8rem;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--clay-shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 16px 24px 42px -6px rgba(120, 138, 175, 0.3),
              inset 3px 3px 6px rgba(255, 255, 255, 0.95);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
}

.stat-card.stat-total::before { background: linear-gradient(180deg, #38bdf8, #0284c7); }
.stat-card.stat-present::before { background: linear-gradient(180deg, #34d399, #059669); }
.stat-card.stat-absent::before { background: linear-gradient(180deg, #fb7185, #e11d48); }
.stat-card.stat-late::before { background: linear-gradient(180deg, #fbbf24, #d97706); }
.stat-card.stat-classes::before { background: linear-gradient(180deg, #818cf8, #4f46e5); }

.stat-info .stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.stat-info .stat-value {
  font-size: 1.95rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.15;
  font-feature-settings: "ss01" on;
}

.stat-info .stat-sub {
  font-size: 0.74rem;
  color: var(--text-light);
  margin-top: 0.3rem;
  font-weight: 600;
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 4px 6px 14px -2px rgba(0, 0, 0, 0.08),
              inset 2px 2px 4px rgba(255, 255, 255, 0.7),
              inset -2px -3px 5px rgba(0, 0, 0, 0.1);
  transition: var(--transition);
}

.stat-card:hover .stat-icon {
  transform: scale(1.08) rotate(3deg);
}

.stat-total .stat-icon { background: #e0f2fe; color: var(--secondary); }
.stat-present .stat-icon { background: #d1fae5; color: var(--present-text); }
.stat-absent .stat-icon { background: #ffe4e6; color: var(--absent-text); }
.stat-late .stat-icon { background: #fef3c7; color: var(--late-text); }
.stat-classes .stat-icon { background: #e0e7ff; color: var(--primary); }

/* ================= Cards & Panels (Claymorphism) ================= */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--clay-shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.95);
  margin-bottom: 1.75rem;
  position: relative;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.35rem;
  padding-bottom: 0.9rem;
  border-bottom: 1.5px solid #edf2f9;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.card-title {
  font-size: 1.2rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* ================= Clay Buttons ================= */
.btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  user-select: none;
}

.btn:active {
  transform: translateY(2px) scale(0.97) !important;
}

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  box-shadow: 6px 8px 18px -3px rgba(79, 70, 229, 0.42),
              inset 2px 2px 4px rgba(255, 255, 255, 0.45),
              inset -2px -3px 5px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 8px 12px 24px -3px rgba(79, 70, 229, 0.5),
              inset 2px 2px 4px rgba(255, 255, 255, 0.5);
}

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: var(--clay-shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.btn-outline:hover {
  background: #f8fafc;
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 5px 8px 16px -2px rgba(120, 135, 165, 0.25);
}

.btn-success {
  background: linear-gradient(135deg, #34d399, #059669);
  color: #fff;
  box-shadow: 6px 8px 18px -3px rgba(16, 185, 129, 0.42),
              inset 2px 2px 4px rgba(255, 255, 255, 0.45),
              inset -2px -3px 5px rgba(0, 0, 0, 0.2);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669, #047857);
  transform: translateY(-2px);
  box-shadow: 8px 12px 24px -3px rgba(16, 185, 129, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, #fb7185, #e11d48);
  color: #fff;
  box-shadow: 6px 8px 18px -3px rgba(244, 63, 94, 0.42),
              inset 2px 2px 4px rgba(255, 255, 255, 0.45),
              inset -2px -3px 5px rgba(0, 0, 0, 0.2);
}

.btn-danger:hover {
  background: linear-gradient(135deg, #e11d48, #be123c);
  transform: translateY(-2px);
  box-shadow: 8px 12px 24px -3px rgba(244, 63, 94, 0.5);
}

.btn-warning {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #fff;
  box-shadow: 6px 8px 18px -3px rgba(245, 158, 11, 0.42),
              inset 2px 2px 4px rgba(255, 255, 255, 0.45),
              inset -2px -3px 5px rgba(0, 0, 0, 0.2);
}

.btn-warning:hover {
  background: linear-gradient(135deg, #d97706, #b45309);
  transform: translateY(-2px);
  box-shadow: 8px 12px 24px -3px rgba(245, 158, 11, 0.5);
}

.btn-sm {
  padding: 0.42rem 0.85rem;
  font-size: 0.82rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 0.95rem 1.8rem;
  font-size: 1.05rem;
  border-radius: var(--radius-md);
  font-weight: 800;
}

.btn-block {
  width: 100%;
}

/* ================= Table Styling (Clay Accents) ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-size: 0.9rem;
}

.table th {
  background: #f0f4fa;
  color: var(--text-muted);
  font-weight: 800;
  padding: 0.85rem 1.1rem;
  text-align: right;
  border: none;
  white-space: nowrap;
}

.table th:first-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.table th:last-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.table td {
  padding: 0.95rem 1.1rem;
  background: #ffffff;
  color: var(--text-main);
  vertical-align: middle;
  border: none;
  box-shadow: 0 2px 6px rgba(140, 155, 185, 0.08);
  transition: var(--transition-fast);
}

.table tbody tr td:first-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.table tbody tr td:last-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.table tbody tr:hover td {
  background: #f8fbff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(120, 138, 175, 0.15);
}

/* Badges (Claymorphism) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  box-shadow: 2px 3px 6px rgba(0, 0, 0, 0.05),
              inset 1px 1px 2px rgba(255, 255, 255, 0.8);
}

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

.badge-absent {
  background: #ffe4e6;
  color: #9f1239;
  border: 1px solid #fecdd3;
}

.badge-late {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-neutral {
  background: #eef2f9;
  color: var(--text-muted);
  border: 1px solid #dbe2ef;
}

/* ================= Class Grid (Admin Dashboard) ================= */
.classes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 1.25rem;
}

.class-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  box-shadow: var(--clay-shadow-card);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  user-select: none;
}

.class-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 36px -6px rgba(45, 75, 130, 0.18), inset 0 2px 4px rgba(255, 255, 255, 0.9);
}

.class-card:active {
  transform: translateY(-1px);
}

.class-card-pending {
  border-color: rgba(239, 68, 68, 0.35) !important;
}

.class-card-pending:hover {
  border-color: rgba(239, 68, 68, 0.65) !important;
  box-shadow: 0 16px 36px -6px rgba(239, 68, 68, 0.22), inset 0 2px 4px rgba(255, 255, 255, 0.9);
}

.class-card-recorded {
  border-color: rgba(16, 185, 129, 0.3) !important;
}

.class-card-recorded:hover {
  border-color: rgba(16, 185, 129, 0.6) !important;
  box-shadow: 0 16px 36px -6px rgba(16, 185, 129, 0.2), inset 0 2px 4px rgba(255, 255, 255, 0.9);
}

.class-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.class-card-title {
  font-size: 1.12rem;
  font-weight: 900;
  color: var(--text-main);
}

.class-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  box-shadow: var(--clay-shadow-sm);
}

.class-status-recorded {
  background: #d1fae5;
  color: #065f46;
}

.class-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.class-stats-row {
  display: flex;
  justify-content: space-around;
  background: #edf2f9;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  box-shadow: var(--clay-shadow-sunken);
}

.class-stat-item {
  text-align: center;
}

.class-stat-num {
  font-weight: 900;
  font-size: 1.1rem;
  font-feature-settings: "ss01" on;
}

/* ================= Teacher Attendance Sheet (class.php) ================= */
.attendance-summary-bar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-xl);
  padding: 0.95rem 1.4rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.9rem;
  position: sticky;
  top: 70px;
  z-index: 90;
  box-shadow: 10px 16px 32px -4px rgba(120, 138, 175, 0.22),
              inset 2px 2px 4px rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.attendance-counters {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.counter-chip {
  padding: 0.4rem 0.95rem;
  border-radius: var(--radius-full);
  font-size: 0.86rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  box-shadow: var(--clay-shadow-sm);
}

.student-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.student-attendance-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  padding: 1rem 1.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  gap: 0.9rem;
  flex-wrap: wrap;
  box-shadow: var(--clay-shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.student-attendance-card:hover {
  transform: translateY(-2px);
  box-shadow: 14px 20px 36px -4px rgba(120, 138, 175, 0.26);
}

.student-attendance-card.status-present {
  background: #fafffd;
  border-right: 6px solid var(--present);
}

.student-attendance-card.status-absent {
  background: #fff8f8;
  border-right: 6px solid var(--absent);
}

.student-attendance-card.status-late {
  background: #fffdf5;
  border-right: 6px solid var(--late);
}

.student-info-col {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 190px;
}

.student-avatar {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: #edf2f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: var(--primary);
  font-size: 1rem;
  box-shadow: var(--clay-shadow-sm);
  border: 2px solid #ffffff;
}

.student-details h4 {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-main);
}

.student-details span {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ================= Status Sliding Segmented Control (Claymorphism) ================= */
.status-btn-group {
  position: relative;
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-full);
  box-shadow: inset 0 2px 4px rgba(148, 163, 184, 0.2), 0 2px 6px rgba(100, 116, 139, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.9);
  width: 256px;
  user-select: none;
  overflow: hidden;
}

.status-choice-btn {
  position: relative;
  z-index: 2;
  font-family: inherit;
  border: none;
  background: transparent !important;
  padding: 0.52rem 0.25rem;
  font-size: 0.88rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  color: #475569;
  transition: color 0.25s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: none !important;
  outline: none;
}

.status-choice-btn:hover:not(.active) {
  color: #1e293b;
  transform: translateY(-1px);
}

.status-choice-btn:active {
  transform: scale(0.94);
}

.status-choice-btn.active {
  color: #ffffff !important;
}

.status-choice-btn.active span {
  transform: scale(1.15);
  display: inline-block;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animated Sliding Glider Pill */
.status-glider {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  width: calc((100% - 8px) / 3);
  border-radius: var(--radius-full);
  pointer-events: none;
  z-index: 1;
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.28s ease,
              box-shadow 0.28s ease;
}

/* 
  RTL Grid Layout:
  1st column (Right) = حاضر: translateX(0)
  2nd column (Center) = غایب: translateX(-100%)
  3rd column (Left) = تاخیر: translateX(-200%)
*/
.status-btn-group.status-present .status-glider {
  transform: translateX(0);
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.42),
              inset 0 1px 2px rgba(255, 255, 255, 0.45);
}

.status-btn-group.status-absent .status-glider {
  transform: translateX(-100%);
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.42),
              inset 0 1px 2px rgba(255, 255, 255, 0.45);
}

.status-btn-group.status-late .status-glider {
  transform: translateX(-200%);
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.45),
              inset 0 1px 2px rgba(255, 255, 255, 0.45);
}

/* ================= Absence Type Selector (موجه یا غیر موجه) ================= */
.absence-type-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.absence-type-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
}

.absence-pills-group {
  display: inline-flex;
  align-items: center;
  background: #edf2f9;
  padding: 3px;
  border-radius: var(--radius-full);
  box-shadow: var(--clay-shadow-sunken);
  gap: 3px;
}

.absence-pill-btn {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.32rem 0.72rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  outline: none;
}

.absence-pill-btn:hover {
  color: var(--text-main);
}

.absence-pill-btn.pill-excused.active {
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff !important;
  box-shadow: 2px 4px 10px rgba(2, 132, 199, 0.38),
              inset 1px 1px 2px rgba(255, 255, 255, 0.4);
  transform: scale(1.03);
}

.absence-pill-btn.pill-unexcused.active {
  background: linear-gradient(135deg, #e11d48, #f43f5e);
  color: #ffffff !important;
  box-shadow: 2px 4px 10px rgba(225, 29, 72, 0.38),
              inset 1px 1px 2px rgba(255, 255, 255, 0.4);
  transform: scale(1.03);
}

.extra-status-options {
  width: 100%;
  display: none;
  padding-top: 0.75rem;
  border-top: 1.5px dashed #e2e8f0;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.extra-status-options.show {
  display: flex;
}

/* Forms & Inputs (Sunken Clay Style) */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.45rem;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1.05rem;
  font-family: inherit;
  font-size: 0.92rem;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-md);
  background: #edf2f9;
  color: var(--text-main);
  box-shadow: var(--clay-shadow-sunken);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary-border);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2),
              inset 1px 1px 3px rgba(255, 255, 255, 0.8);
}

/* ================= Excel Import Drag & Drop ================= */
.upload-dropzone {
  border: 2.5px dashed #a5b4fc;
  background: #f4f6fd;
  border-radius: var(--radius-xl);
  padding: 2.8rem 1.8rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  box-shadow: var(--clay-shadow-sunken);
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  background: #eef2ff;
  border-color: var(--primary);
  transform: scale(1.01);
}

.upload-icon {
  font-size: 3.2rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.upload-dropzone h3 {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.upload-dropzone p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ================= Shamsi Date Picker Modal ================= */
.calendar-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.calendar-modal-overlay.active {
  display: flex;
}

.calendar-popup {
  background: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 380px;
  width: 100%;
  box-shadow: 18px 24px 50px -10px rgba(15, 23, 42, 0.35),
              inset 3px 3px 6px rgba(255, 255, 255, 0.9);
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.9);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.calendar-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.calendar-month-year {
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--text-main);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  text-align: center;
}

.cal-weekday {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  padding: 0.4rem 0;
}

.cal-day-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--text-main);
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.04);
}

.cal-day-cell:hover:not(.empty) {
  background: var(--primary-light);
  color: var(--primary);
  transform: translateY(-1px);
}

.cal-day-cell.selected {
  background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
  color: #fff !important;
  font-weight: 900;
  box-shadow: 3px 5px 12px rgba(79, 70, 229, 0.4);
}

.cal-day-cell.today {
  border: 2px solid var(--primary);
}

.cal-day-cell.empty {
  cursor: default;
  box-shadow: none;
}

/* ================= Toast Notification (Clay Style) ================= */
.toast-container {
  position: fixed;
  bottom: 1.8rem;
  left: 1.8rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 270px;
  max-width: 380px;
  padding: 0.95rem 1.25rem;
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 10px 14px 30px -4px rgba(0, 0, 0, 0.25),
              inset 2px 2px 4px rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.toast-success { background: linear-gradient(135deg, #10b981, #059669); }
.toast-error { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.toast-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.toast-info { background: linear-gradient(135deg, #3b82f6, #2563eb); }

/* ================= Clay Special Parent Portal Styles ================= */
.parent-hero-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 2.2rem 2rem;
  box-shadow: var(--clay-shadow-card);
  border: 1px solid rgba(255, 255, 255, 0.95);
  margin-bottom: 2rem;
  text-align: center;
}

.parent-search-box {
  max-width: 520px;
  margin: 1.5rem auto 0;
  display: flex;
  gap: 0.75rem;
  background: #edf2f9;
  padding: 8px;
  border-radius: var(--radius-xl);
  box-shadow: var(--clay-shadow-sunken);
}

.parent-search-input {
  flex: 1;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  padding: 0.5rem 1rem;
  color: var(--text-main);
  outline: none;
  text-align: center;
  letter-spacing: 0.1em;
}

.parent-status-banner {
  padding: 1.8rem;
  border-radius: var(--radius-xl);
  box-shadow: var(--clay-shadow-card);
  margin-bottom: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.parent-status-banner.status-present {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-right: 8px solid #059669;
}

.parent-status-banner.status-absent {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border-right: 8px solid #e11d48;
}

.parent-status-banner.status-late {
  background: linear-gradient(135deg, #fffbeb, #fef3c7);
  border-right: 8px solid #d97706;
}

.parent-status-banner.status-pending {
  background: linear-gradient(135deg, #f8fafc, #edf2f9);
  border-right: 8px solid #94a3b8;
}

.parent-progress-track {
  background: #e2e8f0;
  height: 14px;
  border-radius: var(--radius-full);
  overflow: hidden;
  box-shadow: inset 2px 2px 4px rgba(0, 0, 0, 0.15);
  margin-top: 0.6rem;
}

.parent-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #10b981, #6366f1);
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.2);
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ================= Comprehensive Official Print Engine ================= */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 10mm 15mm 10mm;
  }

  /* Reset layout and backgrounds for crisp ink */
  html, body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 10.5pt !important;
    line-height: 1.4 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  /* Completely hide all interactive, web-only, and navigational UI */
  .top-navbar,
  .nav-tab-group,
  .nav-actions,
  .btn-nav-logout,
  .user-profile-badge,
  .date-controller,
  #btn-jump-today,
  .btn,
  button,
  .card-actions,
  .filter-btn-group,
  .search-container,
  .student-search-box,
  #adminStudentSearchInput,
  #adminStudentSearchResults,
  #searchStudentHistoryContainer,
  #studentSearchInput,
  #studentSearchContainer,
  #sms-service-section,
  .upload-dropzone,
  .parent-search-box,
  .parent-header-bar,
  .parent-box,
  .demo-badges,
  .demo-chips,
  #parentSearchForm,
  footer,
  .calendar-modal-overlay,
  .pwa-install-sheet,
  .toast-container,
  .attendance-summary-bar,
  .btn-hist-toggle,
  .student-history-expand-row,
  .status-btn-group,
  .status-choice-btn,
  .status-glider,
  #btn-save-sticky,
  .non-printable,
  #already-recorded-alert,
  .student-extra-row {
    display: none !important;
  }

  /* Containers & Cards */
  .main-content,
  .parent-main-container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .card, 
  .stat-card, 
  .student-attendance-card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin-bottom: 10pt !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .student-header-badge {
    background: #f8fafc !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    padding: 8pt 12pt !important;
    margin-bottom: 10pt !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .student-avatar-big {
    display: none !important;
  }

  .parent-status-banner {
    border: 1.5px solid #94a3b8 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border-radius: 6px !important;
    padding: 8pt 12pt !important;
    margin-bottom: 10pt !important;
  }

  .history-card-item {
    border: 1px solid #cbd5e1 !important;
    box-shadow: none !important;
    background: #ffffff !important;
    padding: 6pt 10pt !important;
    margin-bottom: 6pt !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .card-header {
    border-bottom: 2px solid #0f172a !important;
    padding-bottom: 5pt !important;
    margin-bottom: 8pt !important;
  }

  .card-title {
    font-size: 13pt !important;
    color: #000000 !important;
    font-weight: 900 !important;
  }

  /* Hide Action Column (7th col) in absent table */
  #absent-table th:nth-child(7),
  #absent-table td:nth-child(7) {
    display: none !important;
  }

  /* Official Clean Table Styling */
  .table-responsive {
    overflow: visible !important;
  }

  table.table,
  .print-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 8pt !important;
    font-size: 10pt !important;
  }

  table.table th,
  table.table td,
  .print-table th,
  .print-table td {
    border: 1px solid #475569 !important;
    padding: 5pt 8pt !important;
    text-align: right !important;
    color: #000000 !important;
    background: transparent !important;
  }

  table.table thead,
  .print-table thead {
    display: table-header-group !important;
  }

  table.table thead th,
  .print-table thead th {
    background-color: #f1f5f9 !important;
    font-weight: 900 !important;
    border-bottom: 2px solid #0f172a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  table.table tbody tr,
  .print-table tbody tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  table.table tbody tr:nth-child(even),
  .print-table tbody tr:nth-child(even) {
    background-color: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Badges in Print */
  .badge {
    border: 1px solid #475569 !important;
    background: transparent !important;
    color: #000000 !important;
    font-weight: 800 !important;
    padding: 2pt 6pt !important;
    border-radius: 4px !important;
    font-size: 8.5pt !important;
    box-shadow: none !important;
  }

  .badge-absent {
    border: 1.5px solid #b91c1c !important;
    color: #b91c1c !important;
    font-weight: 900 !important;
  }

  .badge-late {
    border: 1.5px solid #d97706 !important;
    color: #b45309 !important;
    font-weight: 900 !important;
  }

  .badge-present {
    border: 1.5px solid #059669 !important;
    color: #047857 !important;
  }

  /* Official Print Header */
  .official-report-header {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2.5px solid #0f172a;
    padding-bottom: 10pt;
    margin-bottom: 14pt;
  }

  .report-header-emblem {
    display: flex;
    align-items: center;
    gap: 8pt;
  }

  .report-header-emblem img {
    width: 52px;
    height: 52px;
    object-fit: contain;
  }

  .report-header-title {
    text-align: center;
    flex: 1;
  }

  .report-header-title h3 {
    font-size: 10pt;
    font-weight: 700;
    color: #475569;
    margin: 0 0 2pt 0;
  }

  .report-header-title h2 {
    font-size: 14pt;
    font-weight: 900;
    color: #000000;
    margin: 0 0 3pt 0;
  }

  .report-header-title h4 {
    font-size: 10pt;
    font-weight: 800;
    color: #1e293b;
    margin: 0;
  }

  .report-header-meta {
    text-align: left;
    font-size: 9pt;
    color: #334155;
    line-height: 1.6;
    font-weight: 700;
    min-width: 110px;
  }

  /* Print Summary Box */
  .print-summary-box {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap: 8pt;
    border: 1.5px solid #cbd5e1;
    border-radius: 6px;
    padding: 8pt;
    margin-bottom: 12pt;
    background-color: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-summary-item {
    text-align: center;
    border-left: 1px solid #cbd5e1;
    padding: 2pt;
  }

  .print-summary-item:last-child {
    border-left: none;
  }

  .print-summary-label {
    font-size: 8.5pt;
    color: #475569;
    font-weight: 700;
  }

  .print-summary-val {
    font-size: 13pt;
    font-weight: 900;
    color: #0f172a;
    margin-top: 2pt;
  }

  /* Official Signatures Row */
  .official-signatures-row {
    display: flex !important;
    justify-content: space-around;
    margin-top: 35pt;
    padding-top: 15pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .signature-box {
    text-align: center;
    width: 210px;
  }

  .signature-box .sig-title {
    font-size: 10pt;
    font-weight: 800;
    color: #0f172a;
  }

  .signature-box .sig-space {
    margin-top: 38pt;
    font-size: 8.5pt;
    color: #64748b;
  }
}

/* Hide print elements on screen */
@media screen {
  .print-only {
    display: none !important;
  }
}

/* ================= Mobile Ergonomics & Teacher Optimization ================= */
@media (max-width: 768px) {
  body {
    padding-bottom: 115px; /* Ample clearance so bottom cards never get cut off */
    overflow-x: hidden;
  }

  .nav-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
  }

  .brand-section {
    justify-content: space-between;
  }

  .date-controller {
    width: 100%;
    justify-content: space-between;
    padding: 4px 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 0.9rem;
  }

  .stat-info .stat-value {
    font-size: 1.45rem;
  }

  /* Teacher Mobile Attendance Cards */
  .student-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
  }

  .student-attendance-card {
    flex-direction: column;
    align-items: stretch;
    padding: 0.95rem 1rem;
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 4px 14px -3px rgba(120, 138, 175, 0.18);
    gap: 0.8rem;
    transition: transform 0.15s ease, border-color 0.2s ease;
    touch-action: manipulation;
  }

  .student-attendance-card:active {
    transform: scale(0.99);
  }

  .student-info-col {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
  }

  .student-avatar {
    width: 44px;
    height: 44px;
    font-size: 0.95rem;
    flex-shrink: 0;
  }

  .student-details h4 {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
    margin: 0;
  }

  .student-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
  }

  /* Large thumb targets for teacher buttons */
  .status-btn-group {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-full);
    height: 50px;
  }

  .status-choice-btn {
    min-height: 44px;
    font-size: 0.95rem;
    font-weight: 800;
    padding: 0;
    touch-action: manipulation;
  }

  /* Sticky Bottom Bar on Mobile for Teachers */
  .attendance-summary-bar {
    position: fixed;
    bottom: 0;
    top: auto;
    left: 0;
    right: 0;
    border-radius: 20px 20px 0 0;
    margin-bottom: 0;
    z-index: 999;
    padding: 0.65rem 0.85rem env(safe-area-inset-bottom, 0.75rem) 0.85rem;
    box-shadow: 0 -8px 25px rgba(15, 23, 42, 0.16);
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    flex-direction: column;
    gap: 0.5rem;
  }

  .attendance-counters {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 0.35rem;
  }

  .counter-chip {
    flex: 1;
    justify-content: center;
    padding: 0.4rem 0.25rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
  }

  #btn-save-sticky {
    width: 100% !important;
    justify-content: center;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions {
    width: 100%;
    justify-content: stretch;
  }

  .card-actions .btn {
    flex: 1;
  }

  .parent-search-box {
    flex-direction: column;
    border-radius: var(--radius-lg);
  }

  .parent-search-box .btn {
    width: 100%;
  }
}

/* ================= PWA Install Bottom Sheet (Clay Style) ================= */
.pwa-install-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  z-index: 10000;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transform: translateY(115%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-install-sheet.show {
  transform: translateY(0);
  pointer-events: auto;
}

.pwa-sheet-card {
  max-width: 480px;
  width: 100%;
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.4rem;
  box-shadow: 18px 24px 50px -10px rgba(15, 23, 42, 0.35),
              inset 3px 3px 6px rgba(255, 255, 255, 0.95),
              inset -4px -4px 10px rgba(170, 185, 215, 0.25);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
  0% { box-shadow: 18px 24px 50px -10px rgba(15, 23, 42, 0.35); }
  100% { box-shadow: 18px 24px 50px -10px rgba(79, 70, 229, 0.45); }
}

.pwa-header-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
}

.pwa-icon-box {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: #edf2f9;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--clay-shadow-sm);
  flex-shrink: 0;
}

.pwa-text-box h4 {
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.3;
}

.pwa-text-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.pwa-close-btn {
  position: absolute;
  top: -4px;
  left: -4px;
  background: #edf2f9;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 800;
  font-size: 0.82rem;
  box-shadow: var(--clay-shadow-sm);
  transition: var(--transition-fast);
}

.pwa-close-btn:hover {
  background: #ffe4e6;
  color: var(--absent);
}

.pwa-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.1rem;
}

.pwa-install-btn {
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  box-shadow: 4px 8px 18px rgba(79, 70, 229, 0.45);
}

.pwa-ios-guide {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.8;
  box-shadow: var(--clay-shadow-sunken);
}

.pwa-ios-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

/* ================= Student Visual History Modal & Charts ================= */
.visual-history-popup {
  max-width: 760px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  background: #ffffff;
  box-shadow: var(--clay-shadow-card);
}

.student-search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
}

.search-item-row {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition-fast);
}

.search-item-row:hover {
  background: #f8fafc;
  color: var(--primary);
}

.visual-history-popup-wide {
  background: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 940px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35),
              inset 2px 2px 4px rgba(255, 255, 255, 0.9);
  padding: 1.5rem;
  border: 1.5px solid rgba(226, 232, 240, 0.9);
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}

/* Inline Table Sub-Row Drawer */
.student-history-expand-row {
  background: #f8fafc !important;
  transition: all 0.3s ease;
}

.student-history-expand-row > td {
  padding: 0 !important;
  border-top: none !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

.inline-history-panel {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #cbd5e1;
  border-radius: var(--radius-lg);
  margin: 0.75rem 0.5rem 1rem 0.5rem;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 
              0 8px 10px -6px rgba(15, 23, 42, 0.04);
  animation: expandSlideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.visual-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1.1rem 0;
}

.visual-stat-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
  border: 1px solid #e2e8f0;
  box-shadow: var(--clay-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.visual-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.07);
}

.visual-stat-num {
  font-size: 1.45rem;
  font-weight: 900;
  margin-top: 0.25rem;
  line-height: 1.2;
}

.timeline-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0.75rem 0.9rem;
  background: #f1f5f9;
  border-radius: var(--radius-md);
  box-shadow: var(--clay-shadow-sunken);
  margin: 0.8rem 0;
  min-height: 44px;
}

.timeline-pill {
  width: 25px;
  height: 25px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  user-select: none;
}

.timeline-pill:hover {
  transform: scale(1.22);
  filter: brightness(1.1);
  z-index: 5;
}

.pill-present { background: #10b981; }
.pill-excused { background: #0284c7; }
.pill-unexcused { background: #f43f5e; }
.pill-late { background: #f59e0b; }

/* Pure SVG Visual Charts */
.svg-chart-card {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: var(--clay-shadow-sm);
  display: flex;
  flex-direction: column;
}

.svg-donut-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-wrap: wrap;
  gap: 1rem;
  min-height: 170px;
}

.svg-donut-circle-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.svg-donut-inner-text {
  position: absolute;
  text-align: center;
  pointer-events: none;
}

.svg-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  min-width: 140px;
}

.svg-donut-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.svg-donut-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.svg-bar-wrap {
  position: relative;
  width: 100%;
  height: 170px;
}

/* ================= Filter Segmented Controls ================= */
.filter-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #edf2f9;
  padding: 4px 6px;
  border-radius: var(--radius-full);
  box-shadow: var(--clay-shadow-sunken);
  border: 1px solid rgba(203, 213, 225, 0.6);
  user-select: none;
  flex-wrap: wrap;
}

.filter-btn {
  border: none;
  background: transparent;
  font-family: var(--font-family);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.42rem 0.95rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  outline: none;
}

.filter-btn:hover:not(.active) {
  color: var(--primary);
  background: rgba(255, 255, 255, 0.75);
  transform: translateY(-1px);
}

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

.filter-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.25),
              var(--clay-shadow-sm);
  font-weight: 900;
  transform: translateY(-1px);
}

/* Big Student Avatar & Profile Elements */
.student-avatar-big {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 900;
  box-shadow: 0 6px 16px -2px rgba(79, 70, 229, 0.35);
  flex-shrink: 0;
  border: 2px solid #ffffff;
}

.status-pill-large {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-full);
  font-size: 1.05rem;
  font-weight: 900;
  box-shadow: var(--clay-shadow-button);
}

.student-header-badge {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--clay-shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.student-name-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--text-main);
}

.student-sub-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 600;
}

/* Active State for outline buttons */
.btn-outline.active {
  background: #ffffff;
  color: var(--primary);
  border-color: rgba(79, 70, 229, 0.4);
  box-shadow: 0 4px 14px -2px rgba(79, 70, 229, 0.3),
              var(--clay-shadow-sm);
  font-weight: 900;
}



