@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&family=IBM+Plex+Mono:wght@400;500&family=Noto+Sans+Arabic:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #d4af37;
  --primary-light: #f5d77f;
  --primary-dark: #aa7c11;
  --accent: #e5c158;
  --accent-light: #fff3bd;
  --accent-dark: #8c650d;
  --gold-gradient: linear-gradient(135deg, #f5d77f 0%, #d4af37 50%, #aa7c11 100%);
  --gold-glow: 0 0 18px rgba(212, 175, 55, 0.35);
  --success: #27ae60;
  --success-light: #2ecc71;
  --danger: #e74c3c;
  --danger-light: #ff6b6b;
  --warning: #f39c12;
  --warning-light: #f1c40f;
  --info: #3498db;
  --bg-dark: #0b0c10;
  --bg-body: #0e1015;
  --bg-card: #161820;
  --bg-card-hover: #1e212b;
  --bg-input: #181a22;
  --bg-sidebar: #08090c;
  --text-main: #f4f5f8;
  --text-muted: #9ea3b0;
  --text-dark: #121316;
  --border: #262936;
  --border-light: rgba(212, 175, 55, 0.2);
  --shadow: rgba(0, 0, 0, 0.5);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.25s ease;
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --topbar-height: 64px;
}

body.theme-light {
  --primary: #c59b27;
  --primary-light: #d4af37;
  --primary-dark: #8c650d;
  --accent: #d4af37;
  --accent-light: #f5d77f;
  --accent-dark: #aa7c11;
  --bg-dark: #ffffff;
  --bg-body: #f4f5f8;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f2f6;
  --bg-input: #ffffff;
  --bg-sidebar: #121316;
  --text-main: #121316;
  --text-muted: #646b79;
  --text-dark: #08090c;
  --border: #e0e3eb;
  --border-light: rgba(212, 175, 55, 0.3);
  --shadow: rgba(0, 0, 0, 0.08);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  direction: rtl;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Tajawal', sans-serif;
  font-weight: 700;
  line-height: 1.3;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

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

a:hover {
  color: var(--accent-light);
}

img {
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--accent);
  color: var(--primary-dark);
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow-x: auto;
  margin-bottom: 24px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-light);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------
   Premium Login Page Styles — Synthwave Perspective Grid
   --------------------------------------------------
   Background is rendered on <canvas id="bgCanvas"> (see index.html).
   The wrapper is transparent so the canvas shows through.
   Synthwave.show() / hide() control canvas visibility. */

@keyframes gridDriftUp {
  0%   { background-position: 0 0; }
  100% { background-position: 0 -120px; }
}

.login-page-wrapper {
  min-height: 100vh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;   /* canvas paints the bg */
  position: relative;
  overflow: hidden;
}

/* Holdover containers from previous design — neutralized so any
   leftover markup (`.login-grid-lines`, `.grid-line`, `.bg-orb`)
   in views/login.js renders nothing. */
.login-grid-lines,
.grid-line,
.bg-orb {
  display: none !important;
}

.login-container {
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 1020px;
  min-height: 620px;
  /* Obsidian Gold glassmorphism card */
  background: rgba(14, 16, 21, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 24px;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.15),
    0 25px 60px rgba(0, 0, 0, 0.85),
    0 0 80px rgba(212, 175, 55, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  z-index: 1;
  overflow: hidden;
  margin: 20px;
}

.login-brand-side {
  flex: 1;
  background: linear-gradient(145deg, rgba(10,12,16,0.75) 0%, rgba(20,23,30,0.7) 50%, rgba(10,12,16,0.75) 100%);
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: white;
  position: relative;
  border-left: 1px solid rgba(212, 175, 55, 0.25);
}

/* Subtle inner gold glow on brand side */
.login-brand-side::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(212,175,55,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.brand-content {
  position: relative;
  z-index: 2;
}

.brand-logo-wrap {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  background: #ffffff;
  padding: 6px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.5),
    0 8px 30px rgba(212, 175, 55, 0.25),
    0 10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.brand-logo-wrap:hover {
  transform: scale(1.03);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.8),
    0 12px 35px rgba(212, 175, 55, 0.35),
    0 12px 35px rgba(0, 0, 0, 0.6);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
}

.brand-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 4px;
  background: linear-gradient(135deg, #ffffff 0%, #f5d77f 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-tagline {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f5d77f;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  text-transform: uppercase;
  opacity: 0.9;
}

.brand-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.brand-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.18);
  transition: all 0.3s ease;
}

.feature-item:hover {
  background: rgba(212, 175, 55, 0.16);
  border-color: rgba(212, 175, 55, 0.4);
  transform: translateX(-4px);
}

.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(245, 215, 127, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f5d77f;
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* Form side */
.login-form-side {
  flex: 1;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: rgba(14, 16, 21, 0.5);
}

.form-wrapper {
  max-width: 400px;
  width: 100%;
  margin: 0 auto;
}

.form-header {
  margin-bottom: 32px;
}

.form-header h2 {
  font-size: 1.85rem;
  color: var(--text-main);
  margin-bottom: 8px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #f5d77f 50%, #d4af37 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.form-header p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Role selector — dark style */
.role-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.role-card-modern {
  background: rgba(212, 175, 55, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 14px;
  padding: 16px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.role-card-modern::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.role-card-modern:hover {
  border-color: rgba(212, 175, 55, 0.5);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.2);
}

.role-card-modern:hover::before {
  opacity: 1;
}

.role-card-modern.active {
  background: rgba(212, 175, 55, 0.15);
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.4),
    0 8px 25px rgba(212, 175, 55, 0.25),
    0 0 20px rgba(212, 175, 55, 0.3);
  transform: translateY(-3px);
}

.role-card-modern.active .role-icon {
  color: var(--accent);
  transform: scale(1.15);
  filter: drop-shadow(0 0 6px rgba(232, 184, 75, 0.5));
}

.role-icon {
  font-size: 1.4rem;
  color: rgba(168, 158, 196, 0.7);
  margin-bottom: 8px;
  transition: all 0.3s ease;
  display: block;
}

.role-name {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color 0.3s;
}

.role-card-modern.active .role-name {
  color: var(--text-main);
}

/* Form visibility */
.hidden-form {
  display: none;
}

.show-form {
  display: block;
  animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpFade {
  0% {
    opacity: 0;
    transform: translateY(16px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form field groups */
.form-group-modern {
  margin-bottom: 20px;
}

.form-group-modern label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.input-with-icon {
  position: relative;
}

.input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-size: 1rem;
  pointer-events: none;
}

.input-with-icon input {
  width: 100%;
  padding: 13px 44px 13px 44px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  transition: all 0.3s ease;
}

.input-with-icon input:focus {
  outline: none;
  background: var(--bg-card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25), 0 0 15px rgba(212, 175, 55, 0.15);
}

.input-with-icon input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.password-toggle {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.password-toggle:hover {
  color: var(--text-main);
}

.forgot-password-link {
  text-align: left;
  margin-bottom: 24px;
}

.forgot-password-link a {
  color: var(--primary);
  font-size: 0.83rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s;
}

.forgot-password-link a:hover {
  color: var(--primary-light);
}

/* Login submit button */
.btn-login-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #f5d77f 0%, #d4af37 50%, #aa7c11 100%);
  color: #08090c;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.35);
  position: relative;
  overflow: hidden;
}

.btn-login-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transition: left 0.5s ease;
}

.btn-login-submit:hover::before {
  left: 100%;
}

.btn-login-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(212, 175, 55, 0.5), 0 0 20px rgba(212, 175, 55, 0.3);
}

.btn-login-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-login-submit .arrow-icon {
  transition: transform 0.3s ease;
}

.btn-login-submit:hover .arrow-icon {
  transform: translateX(-5px);
}

.btn-login-submit .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Error message */
.login-error-msg {
  background: rgba(231, 76, 60, 0.1);
  color: var(--danger-light);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  margin-bottom: 20px;
  border-right: 3px solid var(--danger);
  animation: slideUpFade 0.3s ease;
  border-left: none;
}

.shake {
  animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* Sign-up link */
.signup-link {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.signup-link span {
  font-size: 0.85rem;
}

.btn-signup {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  color: #d4af37;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  justify-content: center;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.btn-signup:hover {
  color: #f5d77f;
  background: rgba(212, 175, 55, 0.08);
  border-radius: 8px;
  text-decoration-color: rgba(245, 215, 127, 0.5);
}

@keyframes shake {

  10%,
  90% {
    transform: translate3d(-1px, 0, 0);
  }

  20%,
  80% {
    transform: translate3d(2px, 0, 0);
  }

  30%,
  50%,
  70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%,
  60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* Mobile Login */
@media (max-width: 900px) {
  .login-container {
    flex-direction: column;
    max-width: 460px;
    min-height: auto;
  }

  .login-brand-side {
    padding: 32px 28px;
    text-align: center;
    border-left: none;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  }

  .brand-logo-wrap {
    margin: 0 auto 14px;
    width: 90px;
    height: 90px;
  }

  .brand-title {
    font-size: 1.7rem;
  }

  .brand-subtitle {
    margin-bottom: 0;
  }

  .hidden-mobile {
    display: none;
  }

  .login-form-side {
    padding: 32px 24px;
  }
}

/* =====================================================
   NEW LUXURY SIGNUP MODAL / CARD DESIGN
   ===================================================== */
.signup-card-modal {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.signup-header-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, rgba(10, 12, 16, 0.6) 100%);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 16px;
}

.signup-header-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f5d77f 0%, #d4af37 50%, #aa7c11 100%);
  color: #08090c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 18px rgba(212, 175, 55, 0.35);
}

.signup-header-text h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.signup-header-text p {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin: 0;
}

.role-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.role-select-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(22, 24, 32, 0.75);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
}

.role-select-card:hover {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.3);
}

.role-select-card.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.18), rgba(20, 23, 30, 0.85));
  border-color: #d4af37;
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.2);
}

.role-card-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.role-select-card.active .role-card-badge {
  background: linear-gradient(135deg, #f5d77f 0%, #d4af37 100%);
  color: #08090c;
  font-weight: bold;
}

.role-card-info {
  display: flex;
  flex-direction: column;
}

.role-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.role-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-section-box {
  background: rgba(16, 18, 24, 0.65);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f5d77f;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.2);
  padding-bottom: 8px;
}

.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 640px) {
  .form-grid-2col, .role-select-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------
   Matrix Table Styles — Enhanced
   -------------------------------------------------- */

.matrix-table th {
  white-space: normal;
  word-break: break-word;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: none;
}

.matrix-square {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: white;
  margin: 0 auto;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  position: relative;
}

.matrix-square:hover {
  transform: scale(1.15);
  filter: brightness(1.2);
  z-index: 2;
}

.matrix-square.empty {
  background: rgba(38, 41, 54, 0.5);
  border: 1px dashed rgba(212, 175, 55, 0.3);
  color: transparent;
}

.matrix-square.empty:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: rgba(212, 175, 55, 0.5);
}

/* Attendance statuses */
.matrix-square.present {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
}

.matrix-square.absent {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.matrix-square.late {
  background: linear-gradient(135deg, #d68910, #f39c12);
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.4);
}

.matrix-square.excused {
  background: linear-gradient(135deg, #1a6f9c, #3498db);
  box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

/* Payment statuses */
.matrix-square.paid {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
}

.matrix-square.unpaid {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.matrix-square.pending {
  background: linear-gradient(135deg, #d68910, #f39c12);
  box-shadow: 0 2px 8px rgba(243, 156, 18, 0.4);
}

.matrix-bar {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.matrix-bar.paid {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white;
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
}

.matrix-bar.unpaid {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  color: white;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

/* Matrix legend */
.matrix-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 12px;
  background: rgba(22, 24, 32, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.matrix-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Session header styling */
.session-header {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(22, 24, 32, 0.8));
  border-bottom: 2px solid rgba(212, 175, 55, 0.4);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-align: center;
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}

/* Badge accent for accounts */
.badge-accent {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent);
}

/* Payments/attendance filter bars */
.payments-header {
  flex-wrap: wrap;
  gap: 8px;
}

.payments-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding: 12px;
  background: rgba(22, 24, 32, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.payments-filters .form-select,
.payments-filters .form-input {
  min-width: 120px;
  height: 36px;
}

/* Matrix month header bar */
.matrix-month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 16px 0 8px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  padding: 8px 12px;
  background: rgba(212, 175, 55, 0.08);
  border-radius: var(--radius-sm);
  border-right: 4px solid var(--primary);
}

.matrix-session-badge {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: rgba(212, 175, 55, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
}

/* ── Monthly merged "bar" cell — payments grid ─────────────
   Renders one wide pill across N session columns for "monthly"
   students. Same color semantics as matrix-square (green=paid,
   red=unpaid) but stretched horizontally. */
.matrix-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  padding: 4px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  color: white;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.matrix-bar:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.matrix-bar.paid {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.4);
}

.matrix-bar.unpaid {
  background: linear-gradient(135deg, #c0392b, #e74c3c);
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

/* ── RTL text overflow fix ───────────────────────────────
   Arabic names in narrow table cells were getting visually
   clipped because `white-space:nowrap` + cell width would push
   the last glyph past the cell edge. The fix is to allow
   wrapping on word boundaries AND clip with ellipsis if a
   single token is still too long. Apply to any cell that holds
   user-entered Arabic text. */
.rtl-cell {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-overflow: ellipsis;
  line-height: 1.35;
}

/* Force the payments matrix table cells to not cut RTL text. */
.payments-grid td,
.payments-grid th {
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* ── Student-view timeline ──────────────────────────────── */
.timeline {
  display: grid;
  gap: 12px;
}

.timeline-month-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}