/* ============ Vazirmatn Font Faces (Web) ============ */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Thin.ttf') format('truetype');
  font-weight: 100; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-ExtraLight.ttf') format('truetype');
  font-weight: 200; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Light.ttf') format('truetype');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Regular.ttf') format('truetype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Medium.ttf') format('truetype');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-SemiBold.ttf') format('truetype');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.ttf') format('truetype');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-ExtraBold.ttf') format('truetype');
  font-weight: 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Black.ttf') format('truetype');
  font-weight: 900; font-style: normal; font-display: swap;
}

/* ============ Original PersianMain (local) ============ */
@font-face {
  font-family: 'PersianMain';
  src: local('B Nazanin'), local('BNazanin'), local('Vazirmatn'), local('IRANSans'), local('Tahoma');
}

/* ============ Root Variables ============ */
:root {
  --theme-main: #065f46;
  --theme-dark: #022c22;
  --theme-light: #d1fae5;
  --theme-soft: #ecfdf5;
  --gold: #d97706;
  --gold-light: #fef3c7;
  --gold-glow: rgba(217, 119, 6, 0.35);
  --bg-body: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.92);
  --text-main: #0f172a;
  --text-muted: #475569;
  --border: rgba(203, 213, 225, 0.85);
  --danger: #e11d48;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #0ea5e9;
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 14px 35px -5px rgba(15, 23, 42, 0.1), 0 4px 12px -2px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 22px 45px -8px rgba(6, 95, 70, 0.18), 0 8px 20px -4px rgba(217, 119, 6, 0.12);
  --font-size-base: 18px;
  --font-global: 'Vazirmatn', 'B Nazanin', 'BNazanin', Tahoma, sans-serif;
  --font-header: 'Vazirmatn', 'B Nazanin', 'BNazanin', Tahoma, sans-serif;
  --font-titles: 'Vazirmatn', 'B Titr', 'B Nazanin', Tahoma, sans-serif;
  --font-tables: 'Vazirmatn', 'B Nazanin', 'BNazanin', Tahoma, sans-serif;
  --font-ai: 'Vazirmatn', 'B Nazanin', 'BNazanin', Tahoma, sans-serif;
  --font-chat: 'Vazirmatn', 'B Nazanin', Tahoma, sans-serif;
  --chat-header-bg: #075e54;
  --chat-accent: #128c7e;
  --chat-bg: #efeae2;
  --chat-sent-bg: #dcf8c6;
  --chat-sent-text: #111b21;
  --chat-recv-bg: #ffffff;
  --chat-recv-text: #111b21;
}

/* ============ Reset ============ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-global);
  -webkit-tap-highlight-color: transparent;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(241, 245, 249, 0.8); border-radius: 8px; }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, var(--theme-main), var(--gold)); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--theme-dark); }

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-body);
  background-image:
    radial-gradient(at 12% 15%, var(--theme-soft) 0px, transparent 50%),
    radial-gradient(at 88% 85%, rgba(254, 243, 199, 0.65) 0px, transparent 50%),
    radial-gradient(rgba(6, 95, 70, 0.06) 1.5px, transparent 1.5px);
  background-size: 100% 100%, 100% 100%, 26px 26px;
  background-attachment: fixed;
  color: var(--text-main);
  font-size: var(--font-size-base);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

.multiline-field {
  white-space: pre-wrap !important;
  word-wrap: break-word !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
  line-height: 1.7;
  resize: vertical;
}

.top-header, .sidebar, .nav-item { font-family: var(--font-header) !important; }
.card-title, .card-title span, h1, h2, h3, h4 { font-family: var(--font-titles) !important; }
table, th, td { font-family: var(--font-tables) !important; }
.ai-panel, .ai-panel * { font-family: var(--font-ai) !important; }
.wa-wrapper, .wa-wrapper * { font-family: var(--font-chat) !important; }

/* ============ Watermark / Weather ============ */
#watermarkBg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3.2rem, 9vw, 8rem);
  font-weight: 900;
  color: var(--theme-main);
  opacity: 0.055;
  transform: rotate(-12deg);
  text-align: center;
  user-select: none;
  padding: 20px;
  text-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

#flowerContainer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.flower-petal {
  position: absolute;
  top: -60px;
  animation: fallDown linear forwards;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.25));
  opacity: 1;
}
@keyframes fallDown {
  0% { transform: translateY(-60px) rotate(0deg) scale(0.95); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(108vh) rotate(380deg) scale(1.25); opacity: 0.15; }
}

.rain-drop {
  position: absolute;
  top: -60px;
  width: 2.2px;
  background: linear-gradient(transparent, rgba(14, 165, 233, 0.85), rgba(255, 255, 255, 0.9));
  border-radius: 3px;
  pointer-events: none;
  animation: rainFallAnim linear infinite;
}
@keyframes rainFallAnim {
  0% { transform: translateY(-60px) translateX(0) rotate(12deg); opacity: 0.95; }
  100% { transform: translateY(108vh) translateX(-95px) rotate(12deg); opacity: 0.35; }
}

.snow-flake {
  position: absolute;
  top: -60px;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(2, 132, 199, 0.85), 0 2px 5px rgba(15, 23, 42, 0.35);
  pointer-events: none;
  user-select: none;
  animation: snowFallAnim linear infinite;
}
@keyframes snowFallAnim {
  0% { transform: translateY(-60px) translateX(0) rotate(0deg); opacity: 0.98; }
  50% { transform: translateY(52vh) translateX(28px) rotate(180deg); opacity: 0.92; }
  100% { transform: translateY(108vh) translateX(-22px) rotate(360deg); opacity: 0.25; }
}

.hail-stone {
  position: absolute;
  top: -60px;
  background: radial-gradient(circle at 30% 30%, #ffffff, #bae6fd 65%, #38bdf8);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.9), 0 3px 6px rgba(15, 23, 42, 0.28);
  pointer-events: none;
  animation: hailFallAnim linear infinite;
}
@keyframes hailFallAnim {
  0% { transform: translateY(-60px) translateX(0) scale(0.95); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(106vh) translateX(-65px) scale(1.05); opacity: 0.4; }
}

.meteor-star {
  position: absolute;
  top: -60px;
  width: 3px;
  height: 75px;
  background: linear-gradient(transparent, #fef08a, #ffffff);
  border-radius: 50%;
  filter: drop-shadow(0 0 8px #fde047);
  pointer-events: none;
  animation: meteorFallAnim linear infinite;
}
@keyframes meteorFallAnim {
  0% { transform: translateY(-80px) translateX(0) rotate(32deg); opacity: 1; }
  70% { opacity: 0.95; }
  100% { transform: translateY(110vh) translateX(-450px) rotate(32deg); opacity: 0; }
}

/* ============ Tour ============ */
#tourBackdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 5000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#tourBackdrop.open { display: flex; }
.tour-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 60%, #fffbeb 100%);
  border: 3px solid var(--gold);
  border-radius: 26px;
  width: 100%;
  max-width: 540px;
  padding: 26px 24px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.45);
  animation: cardFloatIn 0.35s ease;
  position: relative;
}
.tour-step-badge {
  background: linear-gradient(135deg, var(--theme-main), var(--theme-dark));
  color: #fff; padding: 4px 14px; border-radius: 20px;
  font-size: 0.85rem; font-weight: bold;
}

/* ============ Banner ============ */
#occasionBanner {
  background: linear-gradient(90deg, var(--theme-dark), var(--theme-main), var(--gold), var(--theme-main));
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
  color: #fff; text-align: center;
  padding: 11px 18px; font-size: 1.15rem; font-weight: bold;
  display: none; position: relative; z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.22);
  border-bottom: 2px solid rgba(255,255,255,0.45);
  letter-spacing: 0.3px;
}
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ============ Login ============ */
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  z-index: 10;
  background:
    radial-gradient(circle at 20% 20%, rgba(217, 119, 6, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(6, 95, 70, 0.22) 0%, transparent 50%),
    linear-gradient(135deg, var(--theme-dark) 0%, #0f172a 55%, var(--theme-main) 100%);
}
.login-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 2px solid rgba(217, 119, 6, 0.55);
  border-radius: 30px;
  width: 100%;
  max-width: 470px;
  padding: 42px 34px;
  box-shadow: 0 28px 65px rgba(0,0,0,0.45), 0 0 0 8px rgba(255,255,255,0.08);
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: cardFloatIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0; left: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--gold), var(--theme-main), var(--gold));
}
@keyframes cardFloatIn {
  0% { opacity: 0; transform: translateY(25px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.login-logo {
  width: 90px; height: 90px;
  background: linear-gradient(135deg, var(--theme-main), var(--theme-dark));
  color: #fff; border-radius: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.7rem; margin: 0 auto 18px;
  border: 3px solid var(--gold);
  box-shadow: 0 12px 28px var(--gold-glow), inset 0 2px 6px rgba(255,255,255,0.35);
  transform: rotate(-3deg);
  transition: transform 0.3s ease;
}
.login-card:hover .login-logo { transform: rotate(0deg) scale(1.06); }
.login-card h1 {
  font-size: 1.85rem; color: var(--theme-main);
  margin-bottom: 8px; text-shadow: 0 2px 4px rgba(0,0,0,0.06);
}

#appContainer {
  display: none;
  min-height: 100vh;
  position: relative;
  z-index: 5;
  flex-direction: column;
}
#appContainer.shown { display: flex; }

/* ============ Header ============ */
.top-header {
  background: linear-gradient(135deg, var(--theme-dark) 0%, var(--theme-main) 65%, #047857 100%);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(2, 44, 34, 0.28);
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}
.header-right { display: flex; align-items: center; gap: 16px; }
.hamburger-btn {
  background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08));
  border: 1.5px solid rgba(255,255,255,0.4);
  color: #fff;
  width: 46px; height: 46px;
  border-radius: 14px;
  font-size: 1.55rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.hamburger-btn:hover { background: var(--gold); border-color: #fff; transform: scale(1.06); }
.user-info-bar { display: flex; flex-direction: column; }
.user-info-bar strong {
  font-size: 1.25rem; color: #fff;
  text-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.user-info-bar span {
  font-size: 0.92rem; color: var(--gold-light);
  background: rgba(0,0,0,0.22);
  padding: 1px 10px; border-radius: 20px;
  display: inline-block; width: fit-content; margin-top: 2px;
  border: 1px solid rgba(254, 243, 199, 0.3);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.notif-bell {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08));
  border: 1.5px solid rgba(255,255,255,0.38);
  color: #fff;
  width: 46px; height: 46px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.notif-bell:hover { background: var(--gold); transform: translateY(-2px) rotate(8deg); }
.notif-badge {
  position: absolute;
  top: -6px; left: -6px;
  background: linear-gradient(135deg, #ff1e56, #dc2626);
  color: #fff;
  font-size: 0.8rem; font-weight: bold;
  min-width: 23px; height: 23px;
  border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.5);
  animation: pulseBadge 1.4s infinite;
}
@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.main-wrapper {
  display: flex;
  flex: 1;
  position: relative;
}

/* ============ Sidebar ============ */
.sidebar {
  width: 285px;
  background: linear-gradient(180deg, var(--theme-dark) 0%, var(--theme-main) 60%, #034433 100%);
  border-left: 3px solid var(--gold);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 28px rgba(2, 44, 34, 0.25);
  z-index: 90;
}
.sidebar.closed {
  width: 0;
  padding: 0;
  overflow: hidden;
  border-left: none;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: linear-gradient(90deg, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.04) 100%);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: bold;
  cursor: pointer;
  text-align: right;
  transition: all 0.25s ease;
  white-space: nowrap;
  width: 100%;
  position: relative;
  overflow: hidden;
}
.nav-item::before {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--gold);
  opacity: 0;
  transition: opacity 0.25s;
}
.nav-item:hover {
  background: linear-gradient(90deg, rgba(217, 119, 6, 0.38) 0%, rgba(255,255,255,0.15) 100%);
  border-color: var(--gold-light);
  transform: translateX(-5px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.22);
}
.nav-item:hover::before { opacity: 1; }
.nav-item.active {
  background: linear-gradient(135deg, var(--gold), #b45309);
  color: #fff;
  border-color: #fff;
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.45);
}

.content-area {
  flex: 1;
  padding: 26px;
  max-width: 1320px;
  margin: 0 auto;
  width: 100%;
}

/* ============ Cards ============ */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid var(--border);
  border-top: 4px solid var(--theme-main);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  position: relative;
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card-title {
  font-size: 1.38rem;
  font-weight: bold;
  color: var(--theme-main);
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 2px dashed rgba(6, 95, 70, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 12px;
  border: none;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(0,0,0,0.16); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--theme-main), var(--theme-dark));
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #047857, var(--theme-main));
  box-shadow: 0 8px 20px rgba(6, 95, 70, 0.35);
}
.btn-gold {
  background: linear-gradient(135deg, #f59e0b, var(--gold), #b45309);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
}
.btn-gold:hover:not(:disabled) { box-shadow: 0 8px 20px rgba(217, 119, 6, 0.4); }
.btn-danger {
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  color: #be123c;
  border: 1.5px solid #fda4af;
}
.btn-danger:hover:not(:disabled) { background: linear-gradient(135deg, #e11d48, #be123c); color: #fff; border-color: #e11d48; }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.btn-info { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; }
.btn-outline {
  background: rgba(255, 255, 255, 0.9);
  color: var(--theme-main);
  border: 1.8px solid var(--theme-main);
}
.btn-outline:hover:not(:disabled) { background: var(--theme-soft); }
.btn-sm { padding: 6px 13px; font-size: 0.9rem; border-radius: 10px; }

/* ============ Forms ============ */
.form-group { margin-bottom: 16px; text-align: right; }
.form-group label { display: block; font-weight: bold; margin-bottom: 7px; color: var(--theme-main); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 1rem;
  background: #ffffff;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}
.form-control:focus {
  outline: none;
  border-color: var(--theme-main);
  box-shadow: 0 0 0 4px rgba(6, 95, 70, 0.12);
}
.date-select-group {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.1fr;
  gap: 8px;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }

/* ============ Tables ============ */
.table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  border: 1.5px solid var(--border);
  background: #fff;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}
table { width: 100%; border-collapse: collapse; min-width: 520px; }
th, td { padding: 13px 14px; border-bottom: 1px solid #f1f5f9; text-align: right; }
th {
  background: linear-gradient(180deg, var(--theme-soft) 0%, #ffffff 100%);
  color: var(--theme-main);
  font-weight: bold;
  border-bottom: 2px solid var(--theme-main);
  font-size: 1.05rem;
}
tr { transition: background 0.18s ease; }
tr:hover { background: rgba(6, 95, 70, 0.04); }

/* ============ Attendance ============ */
.att-btn {
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 0.92rem;
  border: 2px solid transparent;
  cursor: pointer;
  min-width: 120px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}
.att-btn:hover:not(:disabled) { transform: scale(1.04); }
.att-P { background: linear-gradient(135deg, #22c55e, #15803d) !important; color: #ffffff !important; border-color: #15803d !important; }
.att-T { background: linear-gradient(135deg, #fde047, #eab308) !important; color: #1e293b !important; border: 2px solid #ca8a04 !important; }
.att-A { background: linear-gradient(135deg, #ff0033, #dc2626) !important; color: #ffffff !important; border-color: #991b1b !important; box-shadow: 0 4px 14px rgba(255, 0, 51, 0.45) !important; }
.att-E { background: linear-gradient(135deg, #f87171, #b91c1c) !important; color: #ffffff !important; border-color: #b91c1c !important; }
.att-N { background: transparent !important; color: #475569 !important; border: 2px dashed #94a3b8 !important; box-shadow: none !important; }
.disc-G { background: linear-gradient(135deg, #16a34a, #14532d) !important; color: #ffffff !important; }
.disc-B { background: linear-gradient(135deg, #dc2626, #7f1d1d) !important; color: #ffffff !important; }

.att-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: start;
}
.att-sessions-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
  padding-left: 4px;
}

/* ============ Exercise Cards ============ */
.ex-card {
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  padding: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}
.ex-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(0,0,0,0.08); }
.ex-card.score-7, .ex-card.score-6 {
  border-color: #16a34a !important;
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important;
  box-shadow: 0 8px 20px rgba(22, 163, 74, 0.14);
}
.ex-card.score-5 {
  border-color: #eab308 !important;
  background: linear-gradient(135deg, #fefce8 0%, #fef08a 100%) !important;
  box-shadow: 0 8px 20px rgba(234, 179, 8, 0.16);
}
.ex-card.score-rs {
  border-color: #dc2626 !important;
  background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%) !important;
}
.score-btn {
  padding: 9px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.18s ease;
}
.score-btn:hover:not(:disabled) { transform: translateY(-2px); }
.score-btn.s7 { background: linear-gradient(135deg, #22c55e, #15803d) !important; color: #fff !important; border-color: #15803d !important; box-shadow: 0 4px 12px rgba(22, 163, 74, 0.35); }
.score-btn.s6 { background: linear-gradient(135deg, #4ade80, #16a34a) !important; color: #fff !important; border-color: #16a34a !important; box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3); }
.score-btn.s5 { background: linear-gradient(135deg, #fde047, #eab308) !important; color: #1e293b !important; border-color: #ca8a04 !important; box-shadow: 0 4px 12px rgba(234, 179, 8, 0.35); }

/* ============ AI Panel ============ */
.ai-panel {
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 50%, #f0fdf4 100%);
  border: 2px solid var(--gold);
  border-radius: 22px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 14px 32px rgba(217, 119, 6, 0.15);
  position: relative;
}
.ai-sec-box {
  padding: 14px 18px;
  border-radius: 14px;
  margin-bottom: 12px;
  border-right: 6px solid;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.ai-sec-good { background: #ecfdf5; border-right-color: #10b981; color: #065f46; }
.ai-sec-weak { background: #fef2f2; border-right-color: #ef4444; color: #991b1b; }
.ai-sec-note { background: #fffbeb; border-right-color: #f59e0b; color: #92400e; }
.ai-sec-info { background: #eff6ff; border-right-color: #3b82f6; color: #1e40af; }
.ai-processing-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 18px;
  gap: 14px;
}
.ai-pulse-icon {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--theme-main), var(--gold));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7);
  animation: aiPulseAnim 1.2s infinite;
}
@keyframes aiPulseAnim {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 20px rgba(217, 119, 6, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

/* ============ Chat (WhatsApp Style) ============ */
.wa-wrapper {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 620px;
  min-height: 0;
  border: 2px solid rgba(203, 213, 225, 0.9);
  border-radius: 22px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.14);
}
.wa-sidebar {
  background: #ffffff;
  border-left: 1.5px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.wa-sidebar-header {
  background: linear-gradient(135deg, var(--chat-header-bg), var(--chat-accent));
  color: #fff;
  padding: 14px 16px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s ease;
  flex-shrink: 0;
}
.wa-search-bar {
  padding: 10px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}
.wa-contact-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.wa-contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: all 0.2s ease;
}
.wa-contact-item:hover { background: #f1f5f9; transform: translateX(-3px); }
.wa-contact-item.active {
  background: linear-gradient(90deg, rgba(18, 140, 126, 0.12), rgba(255,255,255,0.5));
  border-right: 5px solid var(--chat-accent);
}
.wa-avatar {
  width: 48px; height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--chat-accent), var(--chat-header-bg));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
}
.wa-avatar.ai-av { background: linear-gradient(135deg, #f59e0b, #b45309); }
.wa-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background-color: var(--chat-bg);
  background-image: radial-gradient(rgba(0,0,0,0.05) 1.2px, transparent 0);
  background-size: 20px 20px;
  transition: background-color 0.3s ease;
}
.wa-chat-header {
  background: linear-gradient(135deg, var(--chat-header-bg), var(--chat-accent));
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0,0,0,0.14);
  transition: background 0.3s ease;
  flex-shrink: 0;
}
.wa-messages-area {
  flex: 1;
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-scroll-bottom-btn {
  position: absolute;
  bottom: 78px; left: 20px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--chat-accent);
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  z-index: 20;
  transition: transform 0.2s ease;
}
.chat-scroll-bottom-btn:hover { transform: scale(1.1); }
.wa-bubble {
  max-width: 78%;
  padding: 10px 16px;
  border-radius: 16px;
  position: relative;
  line-height: 1.65;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
  word-wrap: break-word;
  animation: bubblePop 0.25s ease;
}
@keyframes bubblePop {
  0% { opacity: 0; transform: translateY(6px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.wa-bubble.sent {
  background: var(--chat-sent-bg);
  color: var(--chat-sent-text);
  align-self: flex-start;
  border-top-right-radius: 4px;
  border: 1px solid rgba(0,0,0,0.05);
}
.wa-bubble.received {
  background: var(--chat-recv-bg);
  color: var(--chat-recv-text);
  align-self: flex-end;
  border-top-left-radius: 4px;
  border: 1px solid rgba(0,0,0,0.05);
}
.wa-bubble-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 5px;
}
.wa-input-bar {
  background: rgba(248, 250, 252, 0.95);
  backdrop-filter: blur(8px);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1.5px solid #cbd5e1;
}
.wa-input-box {
  flex: 1;
  background: #ffffff;
  border: 2px solid #cbd5e1;
  border-radius: 26px;
  padding: 10px 18px;
  font-size: 1rem;
  resize: none;
  height: 46px;
  line-height: 1.4;
  transition: all 0.2s ease;
}
.wa-input-box:focus {
  outline: none;
  border-color: var(--chat-accent);
  box-shadow: 0 0 0 4px rgba(18, 140, 126, 0.14);
}
.wa-send-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-accent), var(--chat-header-bg));
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  transition: all 0.2s ease;
}
.wa-send-btn:hover { transform: scale(1.08); }

/* ============ Teacher Folder ============ */
.teacher-folder {
  background: linear-gradient(135deg, #ffffff 0%, var(--theme-soft) 100%);
  border: 2px solid rgba(6, 95, 70, 0.3);
  border-right: 6px solid var(--theme-main);
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}
.teacher-folder:hover {
  transform: translateY(-5px) scale(1.01);
  border-color: var(--gold);
  border-right-color: var(--gold);
  box-shadow: 0 16px 32px rgba(6, 95, 70, 0.15);
}

/* ============ Modal ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal-card {
  background: #ffffff;
  border: 3px solid var(--gold);
  border-radius: 24px;
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
  animation: cardFloatIn 0.3s ease;
}

/* ============ Toast ============ */
#toastBox {
  position: fixed;
  bottom: 24px; left: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: linear-gradient(135deg, var(--theme-dark), var(--theme-main));
  color: #fff;
  border-right: 6px solid var(--gold);
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: bold;
  box-shadow: 0 12px 30px rgba(0,0,0,0.28);
  animation: cardFloatIn 0.3s ease;
}

/* ============ Badges ============ */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.86rem;
  font-weight: bold;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.bg-t1 { background: linear-gradient(135deg, #d1fae5, #a7f3d0); color: #065f46; border: 1px solid #6ee7b7; }
.bg-t2 { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; border: 1px solid #fcd34d; }
.bg-lock { background: linear-gradient(135deg, #fee2e2, #fecaca); color: #991b1b; border: 1px solid #fca5a5; }
.bg-ok { background: linear-gradient(135deg, #dcfce7, #bbf7d0); color: #166534; border: 1px solid #86efac; }

.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-bold { font-weight: bold; }

/* ============ Mobile Sidebar ============ */
.mobile-sidebar-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.2);
  color: #fff;
}
#sidebarBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 140;
}
#sidebarBackdrop.active { display: block; }

/* ============ Poll ============ */
.poll-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
  border: 2px solid #bae6fd;
  border-right: 6px solid #0284c7;
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 10px;
  width: 100%;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.08);
}
.poll-opt-btn {
  width: 100%;
  text-align: right;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}
.poll-opt-btn:hover { border-color: #0284c7; background: #f8fafc; }
.poll-opt-btn.voted { border-color: #10b981; background: #ecfdf5; }
.poll-bar-fill {
  height: 6px;
  background: linear-gradient(90deg, #0ea5e9, #10b981);
  border-radius: 6px;
  margin-top: 6px;
  transition: width 0.35s ease;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
  :root { --font-size-base: 15px !important; }
  html, body {
    font-size: 15px !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .top-header { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .user-info-bar strong { font-size: 1rem; }
  .user-info-bar span { font-size: 0.76rem; padding: 1px 8px; }
  .hamburger-btn, .notif-bell {
    width: 40px; height: 40px;
    font-size: 1.2rem;
    border-radius: 11px;
    flex-shrink: 0;
  }
  .sidebar {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 270px;
    max-width: 82vw;
    z-index: 160;
    padding: 16px 12px;
    overflow-y: auto;
  }
  .sidebar.closed { width: 0 !important; padding: 0 !important; border: none !important; }
  .mobile-sidebar-header { display: flex; }
  .content-area { padding: 10px; width: 100%; max-width: 100vw; overflow-x: hidden; }
  .card { padding: 14px 12px; margin-bottom: 14px; border-radius: 16px; width: 100%; }
  .card-title { font-size: 1.05rem; padding-bottom: 10px; margin-bottom: 12px; gap: 8px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; gap: 10px; }
  .date-select-group { grid-template-columns: 1fr 1.2fr 1fr; gap: 4px; }
  .btn { padding: 8px 12px; font-size: 0.88rem; max-width: 100%; }
  .btn-sm { padding: 5px 9px; font-size: 0.8rem; }
  .form-control { padding: 8px 10px; font-size: 0.92rem; max-width: 100%; }
  .table-wrap { width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  th, td { padding: 8px 6px; font-size: 0.84rem; }
  table { min-width: 100%; }
  .att-btn { min-width: 92px; padding: 6px 10px; font-size: 0.82rem; }
  .att-layout { grid-template-columns: 1fr !important; gap: 12px; }
  .att-sessions-col { max-height: 210px; }
  .wa-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 150px);
    min-height: 480px;
  }
  .wa-sidebar {
    height: 170px;
    max-height: 170px;
    flex-shrink: 0;
    border-left: none;
    border-bottom: 2px solid #cbd5e1;
  }
  .wa-main { flex: 1; height: auto; min-height: 0; }
  .wa-bubble { max-width: 90%; font-size: 0.9rem; padding: 8px 12px; }
  .login-card { padding: 24px 16px; border-radius: 22px; width: 100%; }
  .login-logo { width: 68px; height: 68px; font-size: 2rem; }
  .login-card h1 { font-size: 1.35rem; }
  .modal-card { padding: 16px 12px; border-radius: 18px; max-height: 92vh; width: 100%; }
  .teacher-folder { padding: 14px; flex-direction: column; align-items: flex-start; gap: 10px; }
}