/* SargetCRM — premium gold & midnight design system */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

:root {
  --bg-base: #f7f5f0;
  --bg-soft: #f1ede4;
  --bg-surface: #ffffff;
  --bg-elevated: #faf8f3;
  --bg-hover: #f4efe4;
  --bg-active: #ece3cf;
  --bg-input: #ffffff;
  --bg-option: #ffffff;
  --option-color: #1c1810;

  --text-primary: #1c1810;
  --text-secondary: #5c5444;
  --text-muted: #8c8270;
  --text-inverse: #1c1810;

  --accent: #b8860f;
  --accent-strong: #96690a;
  --accent-soft: rgba(184, 134, 15, 0.13);
  --accent-dim: rgba(184, 134, 15, 0.13);
  --accent-glow: 0 16px 34px rgba(184, 134, 15, 0.24);
  --gold-1: #f0c869;
  --gold-2: #d4a943;
  --gold-3: #b8860f;
  --gold-4: #96690a;

  --green: #15803d;
  --green-dim: rgba(21, 128, 61, 0.12);
  --red: #b91c1c;
  --red-dim: rgba(185, 28, 28, 0.10);
  --blue: #1d4ed8;
  --blue-dim: rgba(29, 78, 216, 0.10);
  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.11);
  --orange: #c2620a;
  --orange-dim: rgba(194, 98, 10, 0.12);
  --cyan: #0e7490;
  --cyan-dim: rgba(14, 116, 144, 0.11);

  --border: rgba(28, 24, 16, 0.10);
  --border-strong: rgba(28, 24, 16, 0.18);
  --border-focus: rgba(184, 134, 15, 0.5);

  --sidebar-w: 272px;
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(28, 24, 16, 0.06);
  --shadow: 0 12px 30px rgba(28, 24, 16, 0.09);
  --shadow-lg: 0 24px 60px rgba(28, 24, 16, 0.16);

  --transition: 0.18s ease;
  --transition-slow: 0.28s ease;

  --font-display: 'Sora', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', 'Consolas', 'SFMono-Regular', monospace;
}

body.light-mode,
html.pre-light {
  --bg-base: #f7f5f0;
  --bg-soft: #f1ede4;
  --bg-surface: #ffffff;
  --bg-elevated: #faf8f3;
  --bg-hover: #f4efe4;
  --bg-active: #ece3cf;
  --bg-input: #ffffff;
  --bg-option: #ffffff;
  --option-color: #1c1810;

  --text-primary: #1c1810;
  --text-secondary: #5c5444;
  --text-muted: #8c8270;

  --border: rgba(28, 24, 16, 0.10);
  --border-strong: rgba(28, 24, 16, 0.18);
  --shadow-sm: 0 1px 2px rgba(28, 24, 16, 0.06);
  --shadow: 0 12px 30px rgba(28, 24, 16, 0.09);
  --shadow-lg: 0 24px 60px rgba(28, 24, 16, 0.16);
}

html:not(.pre-light) body:not(.light-mode) {
  --bg-base: #0a0c12;
  --bg-soft: #0e111a;
  --bg-surface: #13161f;
  --bg-elevated: #181c28;
  --bg-hover: #1f2433;
  --bg-active: #262c3e;
  --bg-input: #0e111a;
  --bg-option: #161a26;
  --option-color: #f3ecda;

  --text-primary: #f3ecda;
  --text-secondary: #b9b09a;
  --text-muted: #7d7665;

  --accent: #e3bb5f;
  --accent-strong: #f0c869;
  --accent-soft: rgba(227, 187, 95, 0.14);
  --accent-dim: rgba(227, 187, 95, 0.14);
  --accent-glow: 0 16px 34px rgba(227, 187, 95, 0.20);
  --gold-1: #f5d381;
  --gold-2: #e3bb5f;
  --gold-3: #c89638;
  --gold-4: #9c7424;

  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.13);
  --red: #fb7185;
  --red-dim: rgba(251, 113, 133, 0.13);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.13);
  --purple: #c084fc;
  --purple-dim: rgba(192, 132, 252, 0.13);
  --orange: #fb923c;
  --orange-dim: rgba(251, 146, 60, 0.13);
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.13);

  --border: rgba(227, 187, 95, 0.12);
  --border-strong: rgba(227, 187, 95, 0.20);
  --border-focus: rgba(227, 187, 95, 0.55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.50);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text-primary);
  background:
    radial-gradient(circle at top left, rgba(184, 134, 15, 0.07), transparent 34rem),
    linear-gradient(180deg, var(--bg-base), var(--bg-soft));
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--transition-slow), color var(--transition-slow);
}
html:not(.pre-light) body:not(.light-mode) {
  background:
    radial-gradient(circle at top left, rgba(227, 187, 95, 0.08), transparent 34rem),
    linear-gradient(180deg, #0a0c12, #0e111a 55%, #0a0c12);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--text-primary); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-muted) 45%, transparent); border-radius: 999px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
  transition: transform var(--transition-slow), background var(--transition-slow);
}
.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  padding: 30px;
  transition: margin-left var(--transition-slow);
}
.main-content.full-width { margin-left: 0; }
.container { width: min(100%, 1440px); margin: 0 auto; }

.notification-center {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 230;
  display: flex;
  align-items: center;
  gap: 8px;
}
.notification-sound {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.notification-sound:hover,
.notification-sound[aria-pressed="true"] { color: var(--accent); }
.notification-sound[aria-pressed="false"] { color: var(--text-muted); }
.notification-sound:focus-visible,
.notification-bell:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.notification-bell {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.notification-bell:hover { color: var(--accent); }
.notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  padding: 2px 5px;
  color: #fff;
  background: var(--red);
  border: 2px solid var(--bg-surface);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}
.notification-panel {
  position: absolute;
  top: 54px;
  right: 0;
  width: min(360px, calc(100vw - 32px));
  max-height: min(440px, calc(100vh - 100px));
  overflow: auto;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.notification-panel-header {
  position: sticky;
  top: 0;
  padding: 14px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}
.notification-item {
  display: grid;
  width: 100%;
  gap: 5px;
  padding: 13px 16px;
  color: var(--text-primary);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
}
.notification-item:hover { background: var(--bg-hover); }
.notification-item strong { font-size: 0.88rem; }
.notification-item span { color: var(--text-secondary); font-size: 0.83rem; overflow-wrap: anywhere; }
.notification-item time { color: var(--text-muted); font-size: 0.72rem; }
.notification-empty { margin: 0; padding: 18px 16px; color: var(--text-muted); font-size: 0.88rem; }
.notification-toasts {
  position: fixed;
  right: 24px;
  top: 76px;
  z-index: 240;
  display: grid;
  width: min(380px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}
.notification-toast {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 15px 18px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: notification-toast-in 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.25) both;
}
.notification-toast-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
}
.notification-toast-content { min-width: 0; }
.notification-toast strong { display: block; margin: 1px 0 4px; }
.notification-toast span { color: var(--text-secondary); font-size: 0.88rem; overflow-wrap: anywhere; }
@keyframes notification-toast-in {
  0% { opacity: 0; transform: translate3d(35px, -8px, 0) scale(0.94); }
  70% { opacity: 1; transform: translate3d(-5px, 2px, 0) scale(1.01); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .notification-toast { animation: none; }
}

.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 220;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(3px);
}
.overlay.visible { display: block; }

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}
.logo img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(184, 134, 15, 0.35));
  flex-shrink: 0;
}
.logo .logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.logo .logo-text .logo-brand {
  font-size: 1.08rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.02em;
}
.logo .logo-text .logo-sub {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.logo i {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #1c1810;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-3));
  border-radius: var(--radius);
  box-shadow: var(--accent-glow);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.user-info i { color: var(--accent); font-size: 1.6rem; }
.user-name { color: var(--text-primary); font-size: 0.9rem; font-weight: 700; }
.user-role { color: var(--text-muted); font-size: 0.76rem; margin-top: 2px; }

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  overflow-y: auto;
}
.nav-label {
  padding: 12px 11px 5px;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 10px 12px;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.91rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.nav-item i { width: 18px; text-align: center; color: var(--text-muted); }
.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border);
}
.nav-item:hover i { color: var(--accent); }
.nav-item.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.nav-item.active i { color: var(--accent); }
.nav-item .badge-dot {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--red);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
}
.sidebar-footer {
  flex-shrink: 0;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.logout-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: var(--red);
  border-radius: var(--radius);
  font-weight: 700;
  transition: background var(--transition);
}
.logout-btn:hover { background: var(--red-dim); }

.footer-credit {
  display: grid;
  gap: 6px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.footer-credit-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.footer-credit-links {
  display: grid;
  gap: 4px;
}
.footer-credit-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  transition: color var(--transition), transform var(--transition);
}
.footer-credit-link:hover {
  color: var(--accent);
  transform: translateX(1px);
}
.footer-credit-link i {
  width: 16px;
  text-align: center;
  color: var(--accent);
}

.theme-toggle {
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-weight: 700;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.theme-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }
.toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  background: var(--bg-active);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: left var(--transition), background var(--transition);
}
body.light-mode .toggle-track { background: var(--accent); border-color: var(--accent); }
body.light-mode .toggle-thumb { left: 19px; background: #fff; }
.global-theme {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 600;
  width: auto;
  box-shadow: var(--shadow);
}
.global-theme .toggle-track { display: none; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.page-header h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0;
}
.page-header h1 i { color: var(--accent); font-size: 1.15rem; }
.page-header p { margin-top: 4px; color: var(--text-muted); font-size: 0.92rem; }
.page-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: color-mix(in srgb, var(--bg-surface) 96%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: background var(--transition-slow), border-color var(--transition-slow), box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 19px;
  background: color-mix(in srgb, var(--bg-elevated) 65%, transparent);
  border-bottom: 1px solid var(--border);
}
.card-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-size: 0.98rem;
  font-weight: 800;
}
.card-header h3 i { color: var(--accent); }
.card-body { padding: 19px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-height: 116px;
  padding: 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.stat-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  font-size: 1.08rem;
}
.stat-icon.blue { color: var(--blue); background: var(--blue-dim); }
.stat-icon.green { color: var(--green); background: var(--green-dim); }
.stat-icon.accent { color: var(--accent); background: var(--accent-dim); }
.stat-icon.purple { color: var(--purple); background: var(--purple-dim); }
.stat-icon.red { color: var(--red); background: var(--red-dim); }
.stat-icon.orange { color: var(--orange); background: var(--orange-dim); }
.stat-icon.cyan { color: var(--cyan); background: var(--cyan-dim); }
.stat-info { min-width: 0; flex: 1; }
.stat-label {
  margin-bottom: 5px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stat-value {
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.15;
  word-break: break-word;
}
.stat-sub { margin-top: 4px; color: var(--text-muted); font-size: 0.76rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 16px;
  color: var(--text-primary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn-sm { min-height: 32px; padding: 7px 12px; font-size: 0.8rem; }
.btn-xs { min-height: 28px; padding: 5px 9px; font-size: 0.75rem; }
.btn-primary { color: #1c1810; background: linear-gradient(135deg, var(--gold-1), var(--gold-3)); border-color: transparent; box-shadow: var(--accent-glow); font-weight: 800; }
.btn-primary:hover { filter: saturate(1.08) brightness(1.03); }
.btn-secondary { color: var(--text-secondary); background: var(--bg-elevated); }
.btn-secondary:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-success { color: var(--green); background: var(--green-dim); border-color: color-mix(in srgb, var(--green) 25%, transparent); }
.btn-danger { color: var(--red); background: var(--red-dim); border-color: color-mix(in srgb, var(--red) 25%, transparent); }
.btn-info { color: var(--blue); background: var(--blue-dim); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.btn-purple { color: var(--purple); background: var(--purple-dim); border-color: color-mix(in srgb, var(--purple) 25%, transparent); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.2;
}
.badge-active, .badge-paid, .badge-cash, .badge-present { color: var(--green); background: var(--green-dim); border-color: color-mix(in srgb, var(--green) 22%, transparent); }
.badge-inactive, .badge-transfer, .badge-late { color: var(--orange); background: var(--orange-dim); border-color: color-mix(in srgb, var(--orange) 22%, transparent); }
.badge-graduated, .badge-card, .badge-excused { color: var(--blue); background: var(--blue-dim); border-color: color-mix(in srgb, var(--blue) 22%, transparent); }
.badge-pending, .badge-bank { color: var(--purple); background: var(--purple-dim); border-color: color-mix(in srgb, var(--purple) 22%, transparent); }
.badge-unpaid, .badge-absent { color: var(--red); background: var(--red-dim); border-color: color-mix(in srgb, var(--red) 22%, transparent); }

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
}
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg-elevated); }
th {
  padding: 12px 15px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
td {
  padding: 13px 15px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

.entity-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.entity-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 800;
}
.entity-avatar,
.payment-avatar,
.student-avatar-xl,
.att-avatar,
.search-avatar,
.student-photo-preview-wrap {
  overflow: hidden;
}
.avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}
.entity-avatar.teacher { color: var(--blue); background: var(--blue-dim); }
.entity-avatar.group { color: var(--purple); background: var(--purple-dim); }
.entity-avatar.receptionist { color: var(--cyan); background: var(--cyan-dim); }
.entity-name { color: var(--text-primary); font-size: 0.9rem; font-weight: 800; }
.entity-sub { margin-top: 2px; color: var(--text-muted); font-size: 0.76rem; }

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 800;
}
.form-group label i { width: 14px; color: var(--accent); text-align: center; }
.form-control,
.form-select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
input[type="month"],
input[type="time"],
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.form-control:focus,
.form-select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.form-control::placeholder,
input::placeholder,
textarea::placeholder { color: var(--text-muted); }
.form-select,
select {
  padding-right: 36px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  color-scheme: light;
}
body:not(.light-mode) select { color-scheme: dark; }
select option {
  color: var(--option-color) !important;
  background-color: var(--bg-option) !important;
}
textarea.form-control, textarea { min-height: 92px; resize: vertical; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.form-check-input { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--accent); }
.form-check-label { color: var(--text-secondary); cursor: pointer; font-size: 0.88rem; }
.form-text { color: var(--text-muted); font-size: 0.76rem; }
.photo-upload-box {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.student-photo-preview-wrap {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--accent);
}
.student-photo-preview-wrap .avatar-image,
.student-photo-preview-wrap span {
  width: 100%;
  height: 100%;
}
.student-photo-preview-wrap span {
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 900;
  background: var(--accent-dim);
  color: var(--accent);
}
.photo-upload-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.photo-upload-body input[type="file"] {
  padding: 8px 12px;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 15px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.filter-bar form { display: contents; }
.filter-bar .form-group,
.filter-group { min-width: 150px; flex: 1; }
.filter-bar .form-group label { font-size: 0.74rem; }
.filter-bar .form-control,
.filter-bar .form-select { min-height: 38px; padding-top: 8px; padding-bottom: 8px; }
.filter-bar .btn { align-self: flex-end; }
.search-group { position: relative; min-width: 220px; flex: 2; }
.search-group i {
  position: absolute;
  left: 12px;
  top: 50%;
  z-index: 1;
  color: var(--text-muted);
  transform: translateY(-50%);
  pointer-events: none;
}
.search-group .form-control { padding-left: 35px; }

.messages-container { display: grid; gap: 8px; margin-bottom: 18px; }
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  transition: opacity var(--transition), transform var(--transition);
}
.alert i { flex-shrink: 0; }
.alert .close {
  margin-left: auto;
  color: inherit;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.65;
}
.alert .close:hover { opacity: 1; }
.alert-success { color: var(--green); background: var(--green-dim); border-color: color-mix(in srgb, var(--green) 24%, transparent); }
.alert-error { color: var(--red); background: var(--red-dim); border-color: color-mix(in srgb, var(--red) 24%, transparent); }
.alert-info { color: var(--blue); background: var(--blue-dim); border-color: color-mix(in srgb, var(--blue) 24%, transparent); }
.alert-warning { color: var(--orange); background: var(--orange-dim); border-color: color-mix(in srgb, var(--orange) 24%, transparent); }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}
.dashboard-main, .dashboard-side { display: flex; flex-direction: column; gap: 20px; }
.chart-wrapper { position: relative; height: 280px; }
.recent-payment-item,
.debtor-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.recent-payment-item:last-child,
.debtor-item:last-child { border-bottom: none; }
.payment-avatar {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: 50%;
  font-weight: 800;
}
.payment-info { flex: 1; min-width: 0; }
.payment-name, .debtor-name {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.payment-meta, .debtor-teacher { margin-top: 2px; color: var(--text-muted); font-size: 0.74rem; }
.payment-amount { color: var(--green); font-family: var(--font-mono); font-weight: 800; white-space: nowrap; }
.debtor-months {
  flex-shrink: 0;
  padding: 4px 8px;
  color: var(--red);
  background: var(--red-dim);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.amount { font-family: var(--font-mono); font-weight: 800; }
.amount-green, .text-success { color: var(--green); }
.amount-red { color: var(--red); }
.amount-accent { color: var(--accent); }
.text-center { text-align: center; }

.empty-state {
  padding: 46px 20px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state i { display: block; margin-bottom: 12px; font-size: 2.5rem; opacity: 0.55; }
.empty-state p { font-size: 0.92rem; }

.attendance-student-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.attendance-student-row:last-child { border-bottom: none; }
.attendance-options { display: flex; gap: 8px; flex-wrap: wrap; }
.att-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 800;
  transition: border-color var(--transition), background var(--transition);
}
.att-option input[type="radio"] { display: none; }
.att-option.present { color: var(--green); }
.att-option.late { color: var(--orange); }
.att-option.absent { color: var(--red); }
.att-option.excused { color: var(--blue); }
.att-option.present:has(input:checked) { background: var(--green-dim); border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.att-option.late:has(input:checked) { background: var(--orange-dim); border-color: color-mix(in srgb, var(--orange) 45%, transparent); }
.att-option.absent:has(input:checked) { background: var(--red-dim); border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.att-option.excused:has(input:checked) { background: var(--blue-dim); border-color: color-mix(in srgb, var(--blue) 45%, transparent); }

.progress-bar-wrapper { height: 7px; background: var(--bg-elevated); border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; transition: width 0.55s ease; }
.progress-bar.green { background: var(--green); }
.progress-bar.accent { background: var(--accent); }
.progress-bar.red { background: var(--red); }
.percent-wrapper {
  min-width: 94px;
  height: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
  border-radius: 999px;
}
.percent-bar {
  height: 100%;
  width: var(--percent, 0%);
  background: linear-gradient(90deg, var(--gold-2), var(--gold-1));
  border-radius: inherit;
}

.commission-highlight,
.info-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  color: var(--text-secondary);
  background: linear-gradient(135deg, var(--accent-dim), color-mix(in srgb, var(--gold-1) 16%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: var(--radius);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}
.login-box {
  width: min(100%, 410px);
  padding: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.login-logo { margin-bottom: 28px; text-align: center; }
.login-logo img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto 14px;
  display: block;
  filter: drop-shadow(0 8px 22px rgba(184, 134, 15, 0.35));
}
.login-logo i {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 12px;
  color: #1c1810;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-3));
  border-radius: 18px;
  box-shadow: var(--accent-glow);
  font-size: 1.75rem;
}
.login-logo h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-1), var(--gold-4));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-logo p { margin-top: 4px; color: var(--text-muted); font-size: 0.9rem; }
.login-form { display: grid; gap: 16px; }
.login-submit { width: 100%; min-height: 44px; margin-top: 4px; }

.confirm-delete-card { max-width: 500px; margin: 0 auto; }
.confirm-delete-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  color: var(--red);
  background: var(--red-dim);
  border-radius: 50%;
  font-size: 1.8rem;
}

.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single {
  min-height: 42px !important;
  padding: 9px 36px 9px 13px !important;
  color: var(--text-primary) !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  transition: border-color var(--transition), box-shadow var(--transition) !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 0 !important;
  color: var(--text-primary) !important;
  line-height: 1.45 !important;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--text-muted) !important; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
  top: 50% !important;
  right: 11px !important;
  transform: translateY(-50%) !important;
}
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 4px var(--accent-dim) !important;
}
.select2-dropdown {
  color: var(--option-color) !important;
  background: var(--bg-option) !important;
  border: 1px solid var(--border-focus) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  overflow: hidden;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
  padding: 9px 11px !important;
  color: var(--text-primary) !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  outline: none !important;
}
.select2-container--default .select2-results__option {
  padding: 9px 13px !important;
  color: var(--option-color) !important;
  background: var(--bg-option) !important;
  font-size: 0.88rem !important;
}
.select2-container--default .select2-results__option--highlighted {
  color: var(--accent-strong) !important;
  background: var(--accent-dim) !important;
}
.select2-container--default .select2-results__option[aria-selected="true"] {
  color: var(--text-primary) !important;
  background: var(--bg-hover) !important;
}

.groups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  padding: 18px;
}
.group-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.group-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border-bottom: 1px solid var(--border);
}
.group-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-dim);
  border-radius: var(--radius);
}
.group-info { flex: 1; min-width: 0; }
.group-name { color: var(--text-primary); font-size: 1rem; font-weight: 800; }
.group-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.group-status.active { color: var(--green); font-size: 0.82rem; font-weight: 800; }
.group-status.inactive { color: var(--orange); font-size: 0.82rem; font-weight: 800; }
.group-teacher-small { color: var(--text-muted); font-size: 0.82rem; }
.group-actions { display: flex; gap: 7px; }
.btn-icon-sm {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.btn-icon-sm:hover { color: var(--text-primary); background: var(--bg-hover); }
.btn-icon-sm.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 20%, transparent); }
.group-body { padding: 14px 15px; }
.group-row { display: flex; align-items: center; gap: 12px; }
.group-col { flex: 1; min-width: 0; }
.label { margin-bottom: 6px; color: var(--text-muted); font-size: 0.73rem; font-weight: 700; }
.value { color: var(--text-primary); font-weight: 800; }
.group-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 15px;
  border-top: 1px solid var(--border);
}
.btn-link { color: var(--accent-strong); font-weight: 800; }
.btn-link i { margin-left: 7px; }

@media (min-width: 901px) {
  .global-theme { display: none; }
}

@media (max-width: 1350px) {
  .lead-table { display: block; min-width: 0; }
  .lead-table thead { display: none; }
  .lead-table tbody { display: grid; gap: 12px; }
  .lead-table tbody tr:not(.lead-empty-row) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .lead-table tbody td {
    display: grid;
    align-content: start;
    gap: 5px;
    min-width: 0;
    padding: 11px 12px;
    overflow-wrap: anywhere;
  }
  .lead-table tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .lead-table tbody td[data-label="Amallar"] { grid-column: 1 / -1; }
  .lead-table .lead-actions { min-width: 0; }
  .lead-table tbody tr.lead-empty-row { display: block; }
  .lead-table tbody tr.lead-empty-row td::before { content: none; }
}

/* O'quvchilar ro'yxati: tor ekranda har bir qator kartochkaga aylanadi.
   Ustunlar tartibi (data-label) shablon: student_list.html. */
@media (max-width: 1100px) {
  .student-table { display: block; min-width: 0; }
  .student-table thead { display: none; }
  .student-table tbody { display: grid; gap: 12px; }
  .student-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }
  .student-table tbody td {
    display: grid;
    align-content: start;
    gap: 5px;
    min-width: 0;
    padding: 11px 12px;
    overflow-wrap: anywhere;
  }
  .student-table tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .student-table tbody td[colspan] { display: block; }
  .student-table tbody td[colspan]::before { content: none; }
  .student-table td[data-label="O'quvchi"],
  .student-table td[data-label="Amallar"] { grid-column: 1 / -1; }
  .student-table tbody td[data-label="#"] { display: none; }
  .student-table .student-actions { display: flex; flex-wrap: wrap; gap: 6px; }
}

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  div[style*="grid-template-columns:320px 1fr"] { grid-template-columns: 1fr !important; }
  div[style*="grid-template-columns:1fr 260px"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 74px 16px 18px; }
  .menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row { grid-template-columns: 1fr; }
  .notification-center { top: 15px; right: 16px; }
  .notification-toasts { top: 68px; right: 16px; }
}

@media (max-width: 640px) {
  html { font-size: 14px; }
  .page-header { flex-direction: column; }
  .page-header-actions, .form-actions, .filter-bar { width: 100%; }
  .page-header-actions .btn, .form-actions .btn { flex: 1; }
  .stats-grid { grid-template-columns: 1fr; }
  .filter-bar { align-items: stretch; }
  .filter-bar .form-group, .filter-group, .search-group { min-width: 100%; }
  .attendance-student-row { grid-template-columns: 1fr; }
  th, td { padding: 10px 11px; }
  .login-box { padding: 28px 22px; }
  .groups-grid { grid-template-columns: 1fr; padding: 14px; }
  .lead-table tbody tr:not(.lead-empty-row) { grid-template-columns: 1fr; }
  .lead-table tbody td[data-label="Amallar"] { grid-column: auto; }
  .lead-table .lead-actions .btn { flex: 1 1 auto; }
  .notification-toasts { right: 12px; width: min(360px, calc(100vw - 24px)); }
}

/* ── Additional Utility Classes ─────────────────────────────── */

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  background: color-mix(in srgb, var(--bg-elevated) 55%, transparent);
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.p-0 { padding: 0 !important; }
.table-responsive { width: 100%; overflow-x: auto; }
.btn-lg { min-height: 44px; padding: 11px 20px; font-size: 0.95rem; }

.group-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 700;
  color: var(--purple);
  background: var(--purple-dim);
}
.attendance-summary { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.summary-badge.present { color: var(--green); background: var(--green-dim); }
.summary-badge.late    { color: var(--orange); background: var(--orange-dim); }
.summary-badge.absent  { color: var(--red); background: var(--red-dim); }

.empty-row { text-align: center; padding: 32px 20px !important; color: var(--text-muted); }
.empty-row i { font-size: 1.8rem; display: block; margin-bottom: 8px; opacity: 0.45; }

.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.text-muted { color: var(--text-muted); }
.lead-stats { margin-bottom: 18px; }
.student-status-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.student-status-count { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-surface); color: var(--text-secondary); text-decoration: none; }
.student-status-count strong { color: var(--text-primary); font-size: 1.05rem; }
.student-status-count.selected { border-color: var(--accent); background: var(--accent-dim); }
.payment-receipt-link { display: inline-block; margin-top: 3px; color: var(--accent); font-size: 0.72rem; white-space: nowrap; }
.student-report-period, .student-report-send { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.student-report-period .form-group, .student-report-send > label { min-width: 190px; }
.student-report-range { margin: 14px 0; color: var(--text-secondary); }
.student-report-download { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.student-report-download .form-select { max-width: 220px; }
.student-report-link { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.student-report-link summary { color: var(--accent); font-weight: 700; cursor: pointer; }
.student-report-link-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.student-report-link-code { margin: 10px 0; font-size: 1rem; }
.student-report-link-code code { padding: 8px 12px; background: var(--bg-elevated); border-radius: var(--radius-sm); user-select: all; overflow-wrap: anywhere; }
.lead-list-card { overflow: visible; }
.lead-list-card > .card-body { padding: 16px; }
.lead-list-count { color: var(--text-muted); font-size: 0.8rem; }
.lead-filter { margin-bottom: 16px; }
.lead-search { min-width: 220px; flex: 2; }
.lead-status-filter { min-width: 190px; }
.lead-table-wrapper { border: 1px solid var(--border); }
.lead-table { min-width: 1080px; }
.lead-table th:last-child { min-width: 275px; }
.lead-name { color: var(--text-primary); }
.lead-phone { color: var(--text-secondary); white-space: nowrap; }
.lead-phone i { margin-right: 4px; color: var(--text-muted); font-size: 0.75rem; }
.lead-status-form { display: grid; gap: 6px; min-width: 170px; }
.lead-status-form [hidden] { display: none !important; }
.lead-status-form .lead-status-select { font-size: 0.78rem; padding: 3px 8px; border-radius: 6px; font-weight: 700; cursor: pointer; }
.lead-status-select.status-new { background: var(--accent-dim); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.lead-status-select.status-callback { background: var(--orange-dim); color: var(--orange); border-color: color-mix(in srgb, var(--orange) 30%, transparent); }
.lead-status-select.status-enrolled { background: var(--green-dim); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.lead-status-select.status-not_interested,
.lead-status-select.status-invalid { background: var(--red-dim); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.lead-follow-up-input { min-width: 0; padding: 6px; font-size: 0.78rem; }
.lead-status-time { display: block; margin-top: 6px; color: var(--text-muted); font-size: 0.72rem; white-space: nowrap; }
.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; }
.lead-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 250px; }
.lead-actions form { display: inline-flex; }
.lead-actions .btn { white-space: nowrap; }
.lead-form-card,
.lead-history-card { max-width: 900px; margin-bottom: 20px; }
.lead-form .form-row { row-gap: 18px; }
.lead-form-full { grid-column: 1 / -1; }
.lead-form textarea { min-height: 82px; }
.required-mark { color: var(--red); }
.lead-form-actions { justify-content: flex-start; }
.lead-history-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.lead-history-item:first-child { padding-top: 0; }
.lead-history-item:last-child { padding-bottom: 0; border-bottom: 0; }
.lead-history-item p { margin-top: 4px; color: var(--text-secondary); white-space: pre-wrap; }
.lead-history-item time { flex-shrink: 0; color: var(--text-muted); font-size: 0.78rem; }

.summary-stats { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.summary-stat { display: flex; align-items: center; gap: 5px; font-size: 0.82rem; color: var(--text-muted); }
.summary-stat strong { color: var(--text-primary); }

/* fa-spin */
@keyframes fa-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.fa-spin { animation: fa-spin 0.8s linear infinite; }

.pagination-bar, .pagination-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pagination-bar { justify-content: space-between; padding: 16px 0; }
.work-section { margin-bottom: 24px; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)); gap: 16px; }
.work-grid .card-header { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.work-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.work-item:last-child { border-bottom: none; }
.work-item > div { min-width: 0; overflow-wrap: anywhere; }
.work-item p { margin: 6px 0; }
.work-item form, .work-item > .btn { flex-shrink: 0; }
.notification-all { display: block; padding: 14px 16px; border-top: 1px solid var(--border); }
@media (max-width: 640px) {
  .work-item { flex-direction: column; }
  .pagination-actions { gap: 8px; }
}

/* Print */
@media (max-width: 1350px) {
  .lead-table { min-width: 0; }
  .lead-table .lead-actions { min-width: 0; }
}

/* Shared responsive behavior for every page extending core/base.html. */
.main-content,
.container,
.card,
.card-body,
.card-header,
.page-header,
.page-header > div,
.dashboard-grid,
.dashboard-main,
.dashboard-side {
  min-width: 0;
}

.table-wrapper,
.table-responsive {
  max-width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

table:not(.student-table):not(.lead-table) {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

td {
  overflow-wrap: anywhere;
}

input,
select,
textarea,
.form-control,
.form-select,
.select2-container {
  max-width: 100%;
  min-width: 0;
}

img,
video,
canvas,
iframe {
  max-width: 100%;
}

@media (max-width: 1100px) {
  .main-content { padding: 24px 20px; }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .card-header { flex-wrap: wrap; }
  .filter-bar { align-items: flex-end; }
  .filter-bar .form-group,
  .filter-group,
  .search-group { min-width: min(100%, 180px); }
  .select2-container { width: 100% !important; }
}

@media (max-width: 900px) {
  .sidebar { width: min(var(--sidebar-w), calc(100vw - 56px)); }
  .main-content { padding: 72px 18px 22px; }
  div[style*="grid-template-columns"] {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)) !important;
  }
  .form-actions { justify-content: stretch; }
  .form-actions > * { min-width: min(100%, 160px); }
  .notification-center { gap: 6px; }
  .notification-panel { width: min(360px, calc(100vw - 24px)); }
}

@media (max-width: 640px) {
  .main-content { padding: 68px 12px 18px; }
  .page-header { gap: 10px; margin-bottom: 16px; }
  .page-header h1 { font-size: clamp(1.2rem, 6vw, 1.55rem); overflow-wrap: anywhere; }
  .page-header-actions,
  .header-actions,
  .form-actions,
  .student-report-download,
  .student-report-link-actions {
    width: 100%;
    align-items: stretch;
  }
  .page-header-actions > *,
  .header-actions > *,
  .form-actions > *,
  .student-report-link-actions > * {
    flex: 1 1 100%;
    min-width: 0;
  }
  .page-header-actions .btn,
  .header-actions .btn,
  .form-actions .btn,
  .student-report-link-actions .btn {
    width: 100%;
    white-space: normal;
  }
  .card-header { align-items: flex-start; padding: 14px; }
  .card-body { padding: 14px; }
  .filter-bar { padding: 12px; }
  .filter-bar .form-group,
  .filter-group,
  .search-group,
  .student-report-period .form-group,
  .student-report-send > label {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }
  .student-report-period,
  .student-report-send { align-items: stretch; }
  .student-report-period .btn,
  .student-report-send .btn,
  .student-report-download .btn { width: 100%; }
  .student-report-download .form-select { width: 100%; max-width: none; }
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .photo-upload-box { align-items: flex-start; flex-direction: column; }
  .photo-upload-body { width: 100%; }
  .summary-stats,
  .attendance-summary,
  .pagination-bar,
  .pagination-actions { width: 100%; }
  .summary-stat { flex-wrap: wrap; }
  .pagination-bar { justify-content: center; }
  .pagination-actions { justify-content: center; }
  .lead-history-item { flex-direction: column; gap: 6px; }
  .lead-history-item time { white-space: normal; }
  .work-item { flex-direction: column; }
  .work-item form,
  .work-item > .btn { width: 100%; }
  .alert { align-items: flex-start; overflow-wrap: anywhere; }
  .notification-center { top: 12px; right: 12px; }
  .notification-sound { width: 36px; height: 36px; }
  .notification-bell { width: 40px; height: 40px; }
  .notification-panel { top: 60px; right: 12px; width: calc(100vw - 24px); max-height: min(70vh, 560px); }
  .notification-toasts { top: 62px; right: 12px; width: calc(100vw - 24px); }
  .global-theme { right: 12px; bottom: 12px; }
  .login-page { min-height: 100svh; padding: 16px; }
  .login-box { padding: 24px 18px; }
  .login-logo { margin-bottom: 24px; }
  .login-logo img { width: 84px; height: 84px; }
  .login-footer { padding: 0 8px; line-height: 1.5; }
  .login-footer span { flex-wrap: wrap; justify-content: center; }
  .student-table tbody tr:not(.lead-empty-row) { grid-template-columns: minmax(0, 1fr); }
}

.staff-permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: 16px; margin: 20px 0; }
.staff-permission-group { min-width: 0; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); }
.staff-permission-group legend { padding: 0 6px; color: var(--accent-strong); font-weight: 700; }
.staff-permission-option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.staff-permission-option input { flex-shrink: 0; margin-top: 3px; accent-color: var(--accent); }

/* Unified sections and report workspace. */
.center-navigation { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 14px 16px; margin-bottom: 22px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.center-navigation-title { display: inline-flex; gap: 10px; align-items: center; font-weight: 800; }
.center-navigation-title i { color: var(--accent); }
.center-tabs { display: flex; gap: 5px; padding: 4px; border-radius: 12px; background: var(--bg-elevated); }
.center-tab { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 9px 18px; border-radius: 9px; font-size: 0.84rem; font-weight: 700; color: var(--text-secondary); transition: background var(--transition), color var(--transition); }
.center-tab.active { color: var(--accent-strong); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.center-tab:hover { color: var(--accent); }
.center-tab:focus-visible, .report-preset:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.report-page-header { align-items: center; }
.report-eyebrow { display: block; color: var(--accent-strong); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; margin-bottom: 7px; }
.report-builder { display: grid; grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.6fr); align-items: start; gap: 20px; margin-bottom: 32px; }
.report-builder > .card { min-width: 0; }
.report-builder .card-header { padding: 18px 20px; }
.report-builder h2 { display: flex; gap: 10px; align-items: center; color: var(--text-primary); font-size: 0.93rem; line-height: 1.5; }
.report-step { display: inline-grid; place-items: center; flex-shrink: 0; width: 28px; height: 28px; border-radius: 9px; color: var(--accent-strong); background: var(--accent-soft); font-family: var(--font-mono); font-size: 0.82rem; }
.report-field-label, .report-field label { display: block; margin-bottom: 7px; color: var(--text-secondary); font-size: 0.78rem; font-weight: 700; }
.report-guide { display: flex; gap: 13px; align-items: flex-start; padding: 18px 0; line-height: 1.7; color: var(--text-secondary); font-size: 0.87rem; }
.report-guide > i { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; color: var(--accent); background: var(--accent-soft); border-radius: 12px; }
.report-tip { display: flex; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: 0.78rem; line-height: 1.7; }
.report-tip > i { margin-top: 5px; color: var(--accent); }
.report-tip strong { color: var(--text-secondary); }
.report-presets { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.report-preset { padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: var(--bg-elevated); color: var(--text-secondary); }
.report-preset:hover, .report-preset.active { color: var(--accent-strong); background: var(--accent-soft); border-color: var(--border-focus); }
.report-filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: 15px; }
.report-field { min-width: 0; }
.report-field input, .report-field select { width: 100%; }
.report-field .errorlist { list-style: none; color: var(--red); margin-top: 5px; font-size: 0.76rem; }
.report-help { margin-top: 10px; color: var(--text-muted); line-height: 1.6; font-size: 0.78rem; }
.report-advanced { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.report-advanced > summary { cursor: pointer; font-size: 0.84rem; color: var(--text-secondary); font-weight: 700; }
.report-advanced > summary > span { display: block; font-size: 0.73rem; color: var(--text-muted); margin: 5px 0 0 16px; font-weight: 400; }
.report-filter-section { margin-top: 18px; min-width: 0; border: 0; }
.report-filter-section[hidden] { display: none; }
.report-filter-section legend { padding-bottom: 10px; color: var(--accent-strong); font-size: 0.79rem; font-weight: 700; }
.report-filter-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.report-result-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.report-result-heading h2 { font-family: var(--font-display); font-size: 1.18rem; margin-bottom: 7px; }
.report-result-heading p { color: var(--text-muted); font-size: 0.82rem; }
.report-preview-badge { padding: 7px 12px; color: var(--text-secondary); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 999px; font-size: 0.74rem; white-space: nowrap; }
.report-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.report-metric { display: flex; align-items: flex-start; gap: 13px; padding: 19px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.report-metric > div { min-width: 0; }
.report-metric-icon { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent); border-radius: 11px; }
.report-metric div > span { display: block; color: var(--text-secondary); font-size: 0.79rem; line-height: 1.5; }
.report-metric strong { display: block; margin: 7px 0 5px; font-family: var(--font-display); font-size: clamp(1.2rem, 1.7vw, 1.7rem); overflow-wrap: anywhere; }
.report-metric small { display: block; font-size: 0.7rem; line-height: 1.6; color: var(--text-muted); font-weight: 400; }
.report-metric strong small { display: inline; }
.report-metric-accent { border-color: var(--border-focus); background: linear-gradient(120deg, var(--accent-soft), var(--bg-surface)); }
.report-balances { display: flex; flex-wrap: wrap; gap: 18px 30px; padding: 16px 20px; margin-bottom: 20px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); }
.report-balances > span { font-size: 0.76rem; color: var(--text-muted); }
.report-balances strong { display: block; margin-top: 5px; font-size: 0.9rem; color: var(--text-primary); }
.report-balances > small { align-self: center; margin-left: auto; color: var(--text-muted); font-size: 0.72rem; }
.report-source-details { margin-bottom: 20px; }
.report-source-details > summary { display: flex; justify-content: space-between; align-items: center; padding: 17px 20px; font-weight: 700; font-size: 0.86rem; cursor: pointer; }
.report-source-details > summary i { font-size: 0.72rem; color: var(--text-muted); }
.report-preview-card .card-header { gap: 16px; flex-wrap: wrap; }
.report-preview-card .report-help { margin-top: 5px; }
.report-download { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.report-download .form-select { width: auto; }
@media (max-width: 1150px) {
  .report-builder { grid-template-columns: minmax(0, 1fr); }
  .report-metric { padding: 15px; gap: 9px; }
}
@media (max-width: 640px) {
  .center-navigation { align-items: stretch; gap: 12px; padding: 12px; }
  .center-navigation-title { width: 100%; font-size: 0.88rem; }
  .center-tabs { width: 100%; }
  .center-tab { flex: 1; padding: 9px 10px; }
  .report-builder { gap: 14px; margin-bottom: 24px; }
  .report-metrics { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .report-metric strong { font-size: 1.4rem; }
  .report-download, .report-download .form-select { width: 100%; }
  .report-download .btn { flex: 1; }
  .report-filter-actions > * { flex: 1 1 100%; }
  .report-balances > small { margin-left: 0; width: 100%; }
}
@media print {
  .center-navigation, .report-builder, .report-download { display: none !important; }
}

/* Status columns keep the admission queue compact on desktop and mobile. */
.lead-board-hint { display: flex; gap: 8px; margin: 0 0 13px; color: var(--text-muted); font-size: 0.8rem; line-height: 1.6; }
.lead-board-filters { margin-bottom: 16px; }
.lead-board-filters > summary { color: var(--text-secondary); font-size: 0.84rem; font-weight: 700; cursor: pointer; padding: 4px 0; }
.lead-board-filters .lead-filter { margin-top: 14px; }
.lead-board-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.lead-board-heading h2 { font-size: 1rem; }
.lead-board-heading p { margin-top: 4px; color: var(--text-muted); font-size: 0.75rem; }
.lead-full-list { margin-top: 28px; scroll-margin-top: 76px; }
.lead-board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 245px); align-items: start; gap: 10px; overflow-x: auto; max-width: 100%; padding-bottom: 10px; scroll-snap-type: x proximity; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.lead-board:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.lead-column { min-width: 0; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; scroll-snap-align: start; }
.lead-column-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border-top: 3px solid var(--accent); border-bottom: 1px solid var(--border); }
.lead-column-header h3 { font-size: 0.87rem; }
.lead-column-header > span { display: grid; place-items: center; min-width: 28px; min-height: 26px; padding: 3px 8px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text-secondary); font-size: 0.76rem; font-weight: 800; }
.lead-column-new .lead-column-header { border-top-color: var(--blue); }
.lead-column-callback .lead-column-header { border-top-color: var(--orange); }
.lead-column-enrolled .lead-column-header { border-top-color: var(--green); }
.lead-column-invalid .lead-column-header, .lead-column-not_interested .lead-column-header { border-top-color: var(--text-muted); }
.lead-column-body { display: grid; align-content: start; gap: 7px; min-height: 92px; max-height: 240px; padding: 7px; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-width: thin; }
.lead-board-card { min-width: 0; padding: 9px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); }
.lead-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lead-card-heading .lead-name { font-weight: 800; font-size: 0.8rem; overflow-wrap: anywhere; }
.lead-card-heading > span { color: var(--text-muted); font-size: 0.7rem; flex-shrink: 0; }
.lead-card-course { margin: 5px 0; color: var(--text-secondary); font-size: 0.73rem; overflow-wrap: anywhere; }
.lead-card-course i { color: var(--accent); margin-right: 4px; }
.lead-board-card .lead-phone { font-size: 0.82rem; }
.lead-card-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: 0.68rem; color: var(--text-muted); }
.lead-card-owner { margin-top: 9px; font-size: 0.73rem; color: var(--text-secondary); overflow-wrap: anywhere; }
.lead-card-callback { margin-top: 9px; padding: 7px 9px; border-radius: 7px; color: var(--orange); background: var(--orange-dim); font-size: 0.74rem; font-weight: 700; }
.lead-board-card .lead-actions { min-width: 0; }
.lead-card-primary-actions { margin-top: 12px; }
.lead-card-controls { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.lead-card-controls > summary { color: var(--text-muted); font-size: 0.74rem; font-weight: 700; cursor: pointer; }
.lead-card-controls .lead-status-form { min-width: 0; margin: 12px 0; }
.lead-card-controls label { font-size: 0.73rem; color: var(--text-secondary); }
.lead-column-empty { display: grid; gap: 10px; padding: 30px 10px; text-align: center; color: var(--text-muted); font-size: 0.8rem; }
.lead-column-empty i { font-size: 1.3rem; opacity: 0.6; }
.lead-column-pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px; border-top: 1px solid var(--border); font-size: 0.73rem; color: var(--text-muted); }
@media (max-width: 640px) {
  .lead-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .lead-stats .stat-card { padding: 12px 9px; min-width: 0; }
  .lead-stats .stat-icon { display: none; }
  .lead-stats .stat-label { font-size: 0.67rem; }
  .lead-stats .stat-value { font-size: 1.3rem; }
  .lead-board { grid-auto-columns: minmax(0, min(72vw, 245px)); gap: 9px; }
  .lead-column-body { max-height: 210px; }
}
@media print {
  .lead-board { display: block; overflow: visible; }
  .lead-column { margin-bottom: 16px; }
  .lead-column-body { display: block; max-height: none; overflow: visible; }
  .lead-board-card { break-inside: avoid; margin-bottom: 8px; }
  .lead-card-controls, .lead-card-primary-actions, .lead-column-pagination { display: none; }
}

/* Shared navigation: collapsible groups and four mobile shortcuts. */
.nav-group { flex-shrink: 0; }
.nav-group[hidden] { display: none; }
.nav-group-toggle {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  text-align: left;
  font-weight: 700;
  transition: background var(--transition), color var(--transition);
}
.nav-group-toggle > i:first-child { width: 20px; color: var(--accent); text-align: center; }
.nav-group-chevron { margin-left: auto; font-size: 0.7rem; transition: transform var(--transition-slow); }
.nav-group.expanded .nav-group-chevron { transform: rotate(180deg); }
.nav-group-toggle:hover,
.nav-group.has-active > .nav-group-toggle,
.nav-group.expanded > .nav-group-toggle { color: var(--accent-strong); background: var(--accent-soft); }
.nav-group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-group-panel {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition: grid-template-rows var(--transition-slow), visibility var(--transition-slow);
}
.nav-group.expanded .nav-group-panel { grid-template-rows: 1fr; visibility: visible; }
.nav-group-links { min-height: 0; overflow: hidden; }
.nav-group-links .nav-item { margin: 4px 2px 4px 10px; font-size: 0.84rem; }
.sidebar-nav { gap: 8px; }
.sidebar { height: 100vh; height: 100dvh; overflow: hidden; }
.sidebar-header { flex-shrink: 0; }
.sidebar-nav {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: var(--text-muted) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 10px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--text-muted); border: 2px solid var(--bg-surface); }
.sidebar-nav > * { flex-shrink: 0; }
.menu-toggle {
  display: flex;
  left: calc(var(--sidebar-w) - 22px);
  transition: left var(--transition-slow), background var(--transition), color var(--transition);
}
.menu-toggle:hover { color: var(--accent); background: var(--bg-hover); }
.menu-toggle:focus-visible,
.mobile-nav-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.sidebar-collapsed .main-content { margin-left: 0; padding-top: 76px; }
.sidebar-collapsed .menu-toggle { left: 16px; }
.overlay {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-slow), visibility var(--transition-slow);
}
.overlay.visible { opacity: 1; visibility: visible; pointer-events: auto; }
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .sidebar { z-index: 300; padding-top: env(safe-area-inset-top, 0px); }
  .sidebar-header { padding-top: 70px; }
  .sidebar-footer { padding-bottom: max(12px, env(safe-area-inset-bottom, 0px)); }
  .menu-toggle { left: 16px; top: max(16px, env(safe-area-inset-top, 0px)); z-index: 320; }
  .overlay { z-index: 290; }
  body.menu-open { overflow: hidden; }
  .menu-open .sidebar { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .menu-open .mobile-nav { z-index: 310; }
  .has-navigation .main-content { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .has-navigation .global-theme { display: none; }
  .mobile-nav {
    position: fixed;
    z-index: 280;
    left: 12px;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
    padding: 7px;
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--bg-surface) 94%, transparent);
    border: 1px solid var(--border-strong);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
  }
  .mobile-nav--payments { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    min-height: 54px;
    padding: 7px 2px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: inherit;
    font-size: 0.65rem;
    font-weight: 700;
    transition: background var(--transition), color var(--transition), transform var(--transition);
  }
  .mobile-nav-item i { font-size: 1.15rem; }
  .mobile-nav-item.active,
  .mobile-nav-item:hover,
  .mobile-nav-item[aria-expanded="true"] { color: var(--accent-strong); background: var(--accent-soft); }
  .mobile-nav-item:active { transform: scale(0.94); }
  .mobile-nav-item.active i { transform: translateY(-2px); }
}

@media (max-height: 650px) {
  .sidebar-header { padding-bottom: 10px; }
  .sidebar-header .logo { margin-bottom: 8px; }
  .sidebar-footer { gap: 5px; padding-top: 8px; }
  .sidebar-footer .footer-credit { display: none; }
}

@media (max-width: 900px) and (max-height: 500px) {
  .sidebar { padding-top: 66px; }
  .sidebar-header { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar, .main-content, .menu-toggle, .overlay, .mobile-nav-item,
  .nav-group-panel, .nav-group-chevron { transition: none; }
}

@media print {
  .pagination-bar { display: none !important; }
  .sidebar, .menu-toggle, .overlay, .global-theme, .mobile-nav,
  .page-header-actions, .filter-bar, .att-quick-actions { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 20px !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: white !important; color: black !important; }
}

.profile-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  align-items: start;
  gap: 16px;
}
.profile-work-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.profile-work-row:first-child { padding-top: 0; }
.profile-work-row:last-of-type { border-bottom: 0; }
.profile-work-label { color: var(--text-muted); }
.profile-work-value { color: var(--text-primary); font-weight: 700; text-align: right; }
.profile-photo-preview { margin-bottom: 16px; }
.profile-photo-preview img {
  width: 88px;
  height: 88px;
  object-fit: cover;
  border: 2px solid var(--border);
  border-radius: 50%;
}
