/* NVFL Multi-Institute Attendance System - Archival Academic Design System */

:root {
  /* Archival Paper Surface Ramp */
  --bg-app: #f6f5f1;
  --bg-surface: #f0eee8;
  --bg-card: #fdfcf9;
  --bg-subtle: #eae7df;
  --bg-hover: #e2ded4;

  /* Ink Ramp */
  --text-main: #191815;
  --text-secondary: #545047;
  --text-muted: #6c665c;
  --text-light: #8f897e;

  /* Hairline Borders */
  --border-color: rgba(25, 24, 21, 0.08);
  --border-subtle: rgba(25, 24, 21, 0.14);
  --border-focus: rgba(2, 132, 199, 0.45);

  /* Brand & Accent (Calm Sky Blue) */
  --primary: #0369a1;
  --primary-hover: #075985;
  --primary-light: #e0f2fe;
  --primary-border: #7dd3fc;
  --primary-dark: #0c4a6e;
  --primary-color: #0369a1;
  --btn-primary-bg: #0369a1;
  --btn-primary-fg: #fdfcf9;

  /* Semantic Status Tokens */
  --success: #16a34a;
  --success-hover: #15803d;
  --success-fg: #fdfcf9;
  --success-light: #dcfce7;
  --success-border: #86efac;
  --success-text: #166534;

  --danger: #dc2626;
  --danger-fg: #fdfcf9;
  --danger-light: #fee2e2;
  --danger-border: #fca5a5;
  --danger-text: #991b1b;

  --warning: #b45309;
  --warning-fg: #fdfcf9;
  --warning-light: #fef3c7;
  --warning-border: #fcd34d;
  --warning-text: #92400e;

  --info: #475569;
  --info-fg: #fdfcf9;
  --info-light: #f1f5f9;
  --info-border: #cbd5e1;
  --info-text: #334155;

  /* Elevation & Geometry (4px grid) */
  --shadow-sm: 0 1px 2px rgba(25, 24, 21, 0.04);
  --shadow: 0 4px 12px rgba(25, 24, 21, 0.06);
  --shadow-lg: 0 14px 30px rgba(25, 24, 21, 0.10);

  --radius-badge: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-width: 248px;
  --header-height: 56px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 150ms var(--ease-out);
  --t-base: 200ms var(--ease-out);
}

[data-theme="dark"] {
  /* Warm Graphite Surface Ramp */
  --bg-app: #161513;
  --bg-surface: #111110;
  --bg-card: #1c1b18;
  --bg-subtle: #252320;
  --bg-hover: #2e2c28;

  /* Ink Ramp */
  --text-main: #eeebe3;
  --text-secondary: #ada79c;
  --text-muted: #8d877d;
  --text-light: #69645c;

  /* Hairline Borders */
  --border-color: rgba(238, 235, 227, 0.08);
  --border-subtle: rgba(238, 235, 227, 0.14);
  --border-focus: rgba(56, 189, 248, 0.50);

  /* Brand & Primary CTA */
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-light: rgba(56, 189, 248, 0.14);
  --primary-border: rgba(56, 189, 248, 0.34);
  --primary-dark: #0ea5e9;
  --primary-color: #38bdf8;
  --btn-primary-bg: #eeebe3;
  --btn-primary-fg: #141311;

  /* Dark Semantic Tokens */
  --success: #4ade80;
  --success-hover: #22c55e;
  --success-fg: #141311;
  --success-light: rgba(74, 222, 128, 0.16);
  --success-border: rgba(74, 222, 128, 0.34);
  --success-text: #86efac;

  --danger: #f87171;
  --danger-fg: #fdfcf9;
  --danger-light: rgba(248, 113, 113, 0.16);
  --danger-border: rgba(248, 113, 113, 0.36);
  --danger-text: #fca5a5;

  --warning: #e5a93c;
  --warning-fg: #141311;
  --warning-light: rgba(229, 169, 60, 0.12);
  --warning-border: rgba(229, 169, 60, 0.28);
  --warning-text: #fcd34d;

  --info: #94a3b8;
  --info-fg: #141311;
  --info-light: rgba(148, 163, 184, 0.12);
  --info-border: rgba(148, 163, 184, 0.26);
  --info-text: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 18px 36px rgba(0, 0, 0, 0.55);
}

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

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 400;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: block;
}

code, pre, .code-mono, .mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.code-chip {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 2px 6px;
  border-radius: var(--radius-badge);
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==============================================
   APP SHELL & SIDEBAR
   ============================================== */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform var(--t-base);
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  min-height: var(--header-height);
}

.school-logo {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.school-logo svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.6;
}

.school-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.school-title h1 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.school-title span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.nav-menu {
  padding: 12px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  font-weight: 600;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
  flex-shrink: 0;
}

.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  margin-left: auto;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: var(--radius-badge);
  flex-shrink: 0;
}

.nav-badge-tag {
  margin-left: auto;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: var(--radius-badge);
  flex-shrink: 0;
}

.nav-badge-live {
  background: var(--success-light);
  color: var(--success-text);
  border-color: var(--success-border);
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-stats-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quick-stats-pill strong {
  color: var(--text-main);
  font-weight: 500;
  font-family: var(--font-mono);
}

/* Main Content Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-app);
  min-width: 0;
}

/* ==============================================
   TOPBAR
   ============================================== */
.topbar {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn.menu-toggle {
  display: none;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  cursor: pointer;
}

.icon-btn.menu-toggle:hover {
  background: var(--primary-border);
  border-color: var(--primary);
  color: var(--primary-dark);
}

[data-theme="dark"] .icon-btn.menu-toggle:hover {
  background: rgba(56, 189, 248, 0.24);
  border-color: var(--primary);
  color: var(--primary-hover);
}

.current-datetime {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 400;
}

.current-datetime svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.5;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}

.user-info-text {
  display: flex;
  flex-direction: column;
}

.user-info-text .name {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-main);
}

.user-info-text .role {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
}

/* Broadcast Banner */
.ota-broadcast-banner,
.portal-broadcast-banner {
  background: var(--bg-card);
  color: var(--text-main);
  border-bottom: 1px solid var(--border-subtle);
  border-left: 3px solid var(--warning);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 500;
}

.ota-broadcast-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ota-banner-close {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-badge);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: color var(--t-fast), background-color var(--t-fast);
}

.ota-banner-close:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

/* ==============================================
   PAGE CONTENT & HEADERS
   ============================================== */
.content-body {
  padding: 24px;
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}

.page-section {
  display: none;
  animation: fadeRise var(--t-base) forwards;
}

.page-section.active {
  display: block;
}

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

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-group h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
}

.page-title-group p,
.page-subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.header-actions,
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==============================================
   BUTTONS
   ============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 1.5;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-fg);
  border-color: var(--btn-primary-bg);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-subtle);
  color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: var(--success-fg);
}

.btn-success:hover:not(:disabled) {
  background: var(--success-hover);
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-outline-primary:hover:not(:disabled) {
  background: var(--primary-light);
}

.btn-outline-danger {
  background: transparent;
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.btn-outline-danger:hover:not(:disabled) {
  background: var(--danger-light);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 4px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color var(--t-fast), opacity var(--t-fast);
}

.btn-text-action:hover {
  text-decoration: underline;
}

/* ==============================================
   KPI STAT CARDS
   ============================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-value {
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.15;
}

.stat-subtext {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ==============================================
   CARDS & CHARTS
   ============================================== */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.card,
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.card-header,
.table-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h3,
.table-card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}

.chart-container {
  width: 100%;
  min-height: 240px;
  position: relative;
}

/* Charts.js Comparison & Breakdown Helpers */
.chart-comparison-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-comparison-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  margin-bottom: 6px;
  gap: 8px;
}

.chart-comparison-label {
  font-weight: 500;
  color: var(--text-main);
}

.chart-comparison-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: 6px;
}

.chart-comparison-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 500;
}

.chart-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 4px;
}

.breakdown-panel {
  display: flex;
  flex-direction: column;
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
}

.breakdown-hero {
  font-size: 32px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text-main);
}

.breakdown-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.breakdown-total {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-muted);
}

.breakdown-bar {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 10px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-subtle);
  margin: 14px 0 16px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
}

.breakdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid var(--border-color);
  font-size: 13px;
}

.breakdown-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
}

.breakdown-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.breakdown-metrics {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.breakdown-metrics strong {
  font-weight: 500;
  color: var(--text-main);
}

.breakdown-pct {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 34px;
  text-align: right;
}

/* ==============================================
   STATUS BADGES & NOTICES
   ============================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-badge);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.badge-present {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-absent {
  background: var(--danger-light);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-late {
  background: var(--warning-light);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.badge-excused {
  background: var(--info-light);
  color: var(--info-text);
  border: 1px solid var(--info-border);
}

.badge-neutral {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.notice-banner {
  margin-bottom: 16px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
}

/* ==============================================
   FILTER BARS & FORM CONTROLS
   ============================================== */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.form-control {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-sans);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--t-fast), background-color var(--t-fast);
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* ==============================================
   ATTENDANCE TALLY & TABLES
   ============================================== */
.attendance-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.tally-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.tally-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text-secondary);
}

.tally-item strong {
  color: var(--text-main);
  font-family: var(--font-mono);
  font-weight: 600;
}

.tally-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.tally-dot.p { background: var(--success); }
.tally-dot.a { background: var(--danger); }
.tally-dot.l { background: var(--warning); }
.tally-dot.e { background: var(--info); }

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-responsive,
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.data-table th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--bg-surface);
}

.student-info-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.student-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.student-avatar.is-risk {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

/* Segmented Status Switch Group */
.status-pill-group {
  display: inline-flex;
  background: var(--bg-surface);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  gap: 2px;
}

.status-btn {
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-badge);
  border: 1px solid transparent;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
}

.status-btn:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.status-btn.selected-p {
  background: var(--success-light);
  color: var(--success-text);
  border-color: var(--success-border);
  font-weight: 600;
}

.status-btn.selected-a {
  background: #dc2626;
  color: #fdfcf9;
  border-color: #dc2626;
  font-weight: 600;
}

.data-table tbody tr.attendance-row-present {
  background: rgba(34, 197, 94, 0.09);
}

.data-table tbody tr.attendance-row-present:hover {
  background: rgba(34, 197, 94, 0.14);
}

.data-table tbody tr.attendance-row-present .student-avatar {
  background: var(--success-light);
  color: var(--success-text);
  border-color: var(--success-border);
}

.data-table tbody tr.attendance-row-absent {
  background: rgba(220, 38, 38, 0.075);
}

.data-table tbody tr.attendance-row-absent:hover {
  background: rgba(220, 38, 38, 0.12);
}

.data-table tbody tr.attendance-row-absent .student-avatar {
  background: var(--danger-light);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.matrix-cell.P { border: 1px solid var(--success-border); }
.matrix-cell.A { border: 1px solid var(--danger-border); }

.status-btn.selected-l {
  background: var(--warning);
  color: var(--warning-fg);
}

.status-btn.selected-e {
  background: var(--info);
  color: var(--info-fg);
}

/* ==============================================
   MONTHLY MATRIX REGISTER
   ============================================== */
.matrix-container {
  overflow-x: auto;
  max-width: 100%;
}

.matrix-table th,
.matrix-table td {
  padding: 6px;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.matrix-table th.student-col,
.matrix-table td.student-col {
  text-align: left;
  padding-left: 12px;
  position: sticky;
  left: 0;
  background: var(--bg-card);
  z-index: 2;
  border-right: 1px solid var(--border-color);
}

.matrix-table thead th.student-col {
  background: var(--bg-surface);
}

.matrix-cell {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
}

.matrix-cell.P { background: var(--success-light); color: var(--success-text); }
.matrix-cell.A { background: var(--danger-light); color: var(--danger-text); }
.matrix-cell.L { background: var(--warning-light); color: var(--warning-text); }
.matrix-cell.E { background: var(--info-light); color: var(--info-text); }
.matrix-cell.empty { color: var(--text-light); }

.weekend-col {
  background: var(--bg-subtle) !important;
  color: var(--text-light);
}

/* ==============================================
   STUDENT PORTAL PASSCARD & CALENDAR
   ============================================== */
.student-profile-header {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-top: 3px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.student-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.student-meta h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
}

.student-large-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.attendance-gauge-box {
  background: var(--bg-surface);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-align: right;
  border: 1px solid var(--border-color);
}

.attendance-gauge-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.attendance-gauge-rate {
  font-size: 28px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-main);
}

.calendar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.calendar-header h3 {
  font-size: 15px;
  font-weight: 600;
}

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

.calendar-day-name {
  text-align: center;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
  padding-bottom: 6px;
}

.calendar-day {
  aspect-ratio: 1;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-surface);
  transition: border-color var(--t-fast);
}

.calendar-day:hover {
  border-color: var(--border-subtle);
}

.calendar-day.other-month {
  opacity: 0.3;
  pointer-events: none;
}

.calendar-day.status-present {
  border-color: var(--success-border);
  background: var(--success-light);
}

.calendar-day.status-absent {
  border-color: var(--danger-border);
  background: var(--danger-light);
}

.calendar-day.status-late {
  border-color: var(--warning-border);
  background: var(--warning-light);
}

.calendar-day.status-excused {
  border-color: var(--info-border);
  background: var(--info-light);
}

.day-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  align-self: flex-end;
}

/* ==============================================
   MODALS & TOASTS
   ============================================== */
body.modal-open {
  overflow: hidden !important;
  height: 100vh !important;
  touch-action: none;
}

.modal-overlay,
.modal-backdrop {
  display: none;
  position: fixed !important;
  inset: 0 !important;
  background: rgba(17, 17, 16, 0.65);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-overlay.active,
.modal-backdrop.active {
  display: flex;
  animation: fadeRise var(--t-fast) forwards;
}

.modal-card,
.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  margin: auto;
  flex-shrink: 0;
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3,
.modal-title {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 100000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  max-width: 380px;
  animation: fadeRise var(--t-fast) forwards;
}

.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error { border-left: 3px solid var(--danger); }
.toast.toast-info { border-left: 3px solid var(--primary); }

/* ==============================================
   DYNAMIC QR ATTENDANCE & SCANNER
   ============================================== */
.pulse-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
  vertical-align: middle;
}

.qr-canvas-container {
  padding: 12px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  display: inline-block;
  margin: 12px 0;
}

.qr-timer-track {
  width: 100%;
  max-width: 260px;
  height: 6px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0 4px;
}

.qr-timer-progress {
  height: 100%;
  width: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.1s linear;
}

.qr-code-digits {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--primary);
  background: var(--primary-light);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin: 6px 0;
  border: 1px solid var(--primary-border);
}

.qr-live-attendees-box {
  max-height: 170px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  margin-top: 8px;
  text-align: left;
  background: var(--bg-surface);
}

.scanner-viewfinder {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin: 12px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-surface);
}

.scanner-laser {
  position: absolute;
  inset: 16px;
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  pointer-events: none;
}

.qr-alert-box {
  display: none;
  font-size: 12.5px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  text-align: left;
  line-height: 1.45;
}

.qr-alert-box.is-error {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}

.qr-alert-box.is-warning {
  background: var(--warning-light);
  border: 1px solid var(--warning-border);
  color: var(--warning-text);
}

.qr-alert-box.is-success {
  background: var(--success-light);
  border: 1px solid var(--success-border);
  color: var(--success-text);
}

.qr-alert-box.is-info {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--text-main);
}

/* Data Sheet Helpers */
.sheet-auto-sync-btn {
  background: var(--success-light);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.sheet-auto-sync-btn.is-paused {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border-color: var(--border-color);
}

/* ==============================================
   GATEWAY & LOGIN SCREENS
   ============================================== */
.login-screen-wrapper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.login-card-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 460px;
  width: 100%;
  padding: 28px 24px;
  margin: auto;
  animation: fadeRise var(--t-base) forwards;
}

.gate-card {
  text-align: left;
}

.gate-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 20px;
}

.gate-crest {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.gate-hero h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.25;
}

.gate-kicker {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 3px 8px;
  border-radius: var(--radius-badge);
}

.gate-form-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.gate-demo-section {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 16px;
  margin-bottom: 14px;
}

.gate-demo-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.gate-demo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gate-mobile-link {
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

.gate-mobile-link a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.gate-mobile-link a:hover {
  text-decoration: underline;
}

.login-inst-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 20px;
}

.login-inst-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
  flex: 1;
  min-width: 0;
}

#login-active-inst-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.login-header {
  text-align: center;
  margin-bottom: 20px;
}

.login-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
}

.login-logo svg {
  width: 24px;
  height: 24px;
}

.login-header h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-section-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.role-selector-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.role-card {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.role-card:hover {
  border-color: var(--primary-border);
  background: var(--bg-subtle);
}

.role-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.role-card-icon {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.role-card.active .role-card-icon {
  color: var(--primary);
}

.role-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-main);
}

.role-card-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  stroke-width: 1.5;
  color: var(--text-muted);
  pointer-events: none;
}

.login-input {
  padding-left: 36px !important;
  font-size: 14px;
  padding-top: 9px;
  padding-bottom: 9px;
}

.login-btn-primary {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  margin-top: 6px;
}

.login-alert-box {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}

.demo-logins-box {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.demo-logins-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.demo-chips-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.demo-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: color var(--t-fast), background-color var(--t-fast), border-color var(--t-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.credentials-reference-card {
  margin-top: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  overflow: hidden;
}

.creds-ref-header {
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.creds-ref-content {
  padding: 8px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}

.creds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.creds-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-muted);
  font-weight: 500;
}

.creds-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color);
}

.creds-table tr:last-child td {
  border-bottom: none;
}

.login-footer-links {
  text-align: center;
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ==============================================
   MAINTENANCE OVERLAY
   ============================================== */
.maint-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #111110;
  color: #eeebe3;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.maint-card {
  max-width: 520px;
  width: 100%;
  text-align: center;
  background: #1c1b18;
  border: 1px solid rgba(238, 235, 227, 0.12);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
}

.maint-icon-box {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: var(--radius-md);
  background: rgba(229, 169, 60, 0.14);
  border: 1px solid rgba(229, 169, 60, 0.28);
  color: #e5a93c;
  display: flex;
  align-items: center;
  justify-content: center;
}

.maint-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-badge);
  margin-bottom: 12px;
  background: rgba(229, 169, 60, 0.14);
  color: #fcd34d;
  border: 1px solid rgba(229, 169, 60, 0.28);
}

.maint-meta-card {
  background: #161513;
  border: 1px solid rgba(238, 235, 227, 0.08);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: left;
  font-size: 13px;
}

.maint-meta-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

/* ==============================================
   RESPONSIVE BREAKPOINTS (< 768px)
   ============================================== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    height: 52px !important;
    padding: 0 12px !important;
    gap: 8px !important;
  }
  .current-datetime {
    display: none !important;
  }
  .topbar-right {
    gap: 6px !important;
    margin-left: auto !important;
  }
  .user-badge {
    padding: 2px !important;
    background: transparent !important;
    border: none !important;
  }
  .user-info-text {
    display: none !important;
  }
  #topbar-app-btn span:last-child,
  .topbar-right button[onclick="App.logout()"] span,
  #topbar-qr-btn span:last-child {
    display: none !important;
  }

  .content-body {
    padding: 16px 12px !important;
  }

  .page-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  .header-actions,
  .page-actions {
    width: 100% !important;
  }
  .header-actions .btn,
  .page-actions .btn {
    flex: 1 1 auto;
    justify-content: center !important;
  }

  .student-profile-header {
    padding: 16px !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .attendance-gauge-box {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    text-align: left !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  .stat-card {
    padding: 12px !important;
  }
  .stat-value {
    font-size: 22px !important;
  }

  .charts-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .gate-demo-row {
    grid-template-columns: 1fr !important;
  }

  .filter-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 12px !important;
  }
  .filter-group {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .filter-group select,
  .filter-group input {
    width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 600px) {
  .login-screen-wrapper {
    padding: 12px 8px;
    align-items: flex-start;
  }
  .login-card-container {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }
  .demo-chips-grid {
    grid-template-columns: 1fr;
  }
}

/* Print Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  .sidebar,
  .topbar,
  .filter-bar,
  .header-actions,
  .bulk-actions,
  .status-pill-group,
  .icon-btn,
  #toast-container {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  .content-body {
    padding: 0 !important;
  }
  .page-section {
    display: none !important;
  }
  .page-section.active {
    display: block !important;
  }
  .matrix-table {
    font-size: 9pt !important;
  }
}
