/* ==========================================================================
   INDRAGANESAN COLLEGE OF ENGINEERING
   ACADEMIC MONITORING & ACCOUNTABILITY PLATFORM
   Modern Institutional SaaS Design System (Inspired by Reference Dashboards)
   Fully Responsive for Mobile (320px+), Tablet (768px+), Desktop (1024px+), TV (1920px+)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ==========================================================================
   1. DESIGN TOKENS
   ========================================================================== */
:root {
  /* Brand Theme Colors */
  --brand-navy-950: #070d1e;
  --brand-navy-900: #0b1329;
  --brand-navy-850: #0f1a36;
  --brand-navy-800: #142247;
  --brand-navy-700: #1c3166;
  --brand-primary:  #1e40af;
  --brand-accent:   #2563eb;
  --brand-accent-hover: #1d4ed8;
  --brand-cyan:     #06b6d4;
  --brand-purple:   #8b5cf6;

  /* 5-Status Academic Palette */
  --status-green:        #059669;
  --status-green-bg:     #ecfdf5;
  --status-green-border: #a7f3d0;
  --status-green-text:   #065f46;

  --status-yellow:        #d97706;
  --status-yellow-bg:     #fffbeb;
  --status-yellow-border: #fde68a;
  --status-yellow-text:   #92400e;

  --status-red:        #dc2626;
  --status-red-bg:     #fef2f2;
  --status-red-border: #fecaca;
  --status-red-text:   #991b1b;

  --status-blue:        #0284c7;
  --status-blue-bg:     #f0f9ff;
  --status-blue-border: #bae6fd;
  --status-blue-text:   #075985;

  --status-gray:        #64748b;
  --status-gray-bg:     #f8fafc;
  --status-gray-border: #e2e8f0;
  --status-gray-text:   #475569;

  /* Surfaces & Backgrounds */
  --bg-page:    #f8fafc;
  --bg-card:    #ffffff;
  --bg-muted:   #f1f5f9;
  --bg-surface: #ffffff;

  /* Borders */
  --border-subtle: #e2e8f0;
  --border-card:   #eaecf0;
  --border-focus:  #3b82f6;

  /* Text Colors */
  --text-main:      #0f172a;
  --text-muted:     #475569;
  --text-dim:       #64748b;
  --text-inverse:   #ffffff;
  --text-secondary: #6b7280;

  /* Elevation Shadows */
  --shadow-xs:   0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm:   0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px -1px rgba(16, 24, 40, 0.04);
  --shadow-md:   0 4px 8px -2px rgba(16, 24, 40, 0.08), 0 2px 4px -2px rgba(16, 24, 40, 0.05);
  --shadow-lg:   0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --shadow-card: 0 1px 3px rgba(16, 24, 40, 0.05), 0 1px 2px rgba(16, 24, 40, 0.03);

  /* Typography */
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body:    'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Dimensions */
  --sidebar-width: 250px;
  --topbar-height: 62px;
  --content-max:   1600px;

  /* Radii */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   2. BASE RESET & GLOBAL STYLES
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.25;
}

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ==========================================================================
   3. APP SHELL & LEFT SIDEBAR
   ========================================================================== */
.app-shell {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Mobile Sidebar Backdrop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 13, 30, 0.6);
  z-index: 999;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.sidebar-overlay.active { display: block; }

/* Left Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--brand-navy-950) 0%, var(--brand-navy-900) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  transition: transform var(--transition), width var(--transition);
}

.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
}

/* Sidebar Brand */
.sidebar-brand {
  padding: 1.1rem 1.15rem 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.brand-badge-logo {
  width: 38px;
  height: 38px;
  min-width: 38px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.05rem;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.4);
}

.brand-info { line-height: 1.2; min-width: 0; }

.brand-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 0.1rem;
}

.brand-tagline-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.2);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  margin-top: 0.25rem;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

/* Sidebar Menu */
.sidebar-menu {
  padding: 0.85rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.nav-section { display: flex; flex-direction: column; gap: 0.15rem; }

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.65rem 0.2rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.58rem 0.75rem;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  line-height: 1.3;
}

.sidebar-nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

.sidebar-nav-item.active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.9) 0%, rgba(30, 64, 175, 0.9) 100%);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.sidebar-nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  color: inherit;
  opacity: 0.85;
}
.sidebar-nav-item.active .sidebar-nav-icon { opacity: 1; }

.sidebar-nav-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-full);
  line-height: 1.3;
}
.sidebar-nav-badge.red    { background: #ef4444; color: #fff; }
.sidebar-nav-badge.yellow { background: #f59e0b; color: #fff; }
.sidebar-nav-badge.blue   { background: #0284c7; color: #fff; }

/* Sidebar User Footer */
.sidebar-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}

.sidebar-user-meta { line-height: 1.2; min-width: 0; }

.sidebar-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.sidebar-user-role {
  font-size: 0.66rem;
  color: #94a3b8;
}

.sidebar-signout-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  display: flex;
  align-items: center;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
  flex-shrink: 0;
}
.sidebar-signout-btn:hover { color: #cbd5e1; }

.sidebar-toggle-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-main);
  transition: all var(--transition);
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover { background: var(--border-subtle); }

/* ==========================================================================
   4. TOP NAVBAR & APP HEADER
   ========================================================================== */
.app-main-layout {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.top-navbar {
  height: var(--topbar-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  gap: 0.75rem;
  box-shadow: var(--shadow-xs);
}

.top-navbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.breadcrumb-area {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumb-area strong {
  color: var(--text-main);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 320px;
}

.top-navbar-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

/* Search Box */
.search-pill-box { position: relative; }
.search-pill-input {
  width: 220px;
  padding: 0.45rem 0.85rem 0.45rem 2.1rem;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-main);
  outline: none;
  transition: all var(--transition);
}
.search-pill-input:focus {
  background: #fff;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  width: 280px;
}
.search-pill-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  color: var(--text-dim);
}

/* Role Switcher Pills */
.role-pills-wrapper {
  display: flex;
  align-items: center;
  background: var(--brand-navy-900);
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  gap: 0.15rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.role-pill-label {
  font-size: 0.65rem;
  color: #64748b;
  padding: 0 0.4rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.role-pill-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 0.32rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.role-pill-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.role-pill-btn.active {
  background: var(--brand-accent);
  color: #fff;
  box-shadow: 0 2px 5px rgba(37, 99, 235, 0.35);
}

/* Live Clock Badge */
.live-clock-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 0.38rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ==========================================================================
   5. APP CONTENT BODY & PAGE HEADERS
   ========================================================================== */
.app-content-body {
  padding: 1.5rem;
  flex: 1;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  align-self: stretch;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-head-title h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  line-height: 1.2;
}

.page-head-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
  max-width: 60ch;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   6. CARDS & KPI METRIC GRIDS
   ========================================================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.card-body { padding: 1.25rem; }

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-left: 3px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.kpi-card.green  { border-left-color: var(--status-green); }
.kpi-card.blue   { border-left-color: var(--status-blue); }
.kpi-card.yellow { border-left-color: var(--status-yellow); }
.kpi-card.red    { border-left-color: var(--status-red); }
.kpi-card.purple { border-left-color: #8b5cf6; }

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  letter-spacing: -0.03em;
}

.kpi-subtext {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* ==========================================================================
   7. FORM CONTROLS & FILTER BAR ALIGNMENTS (Pixel-Perfect Clean Row)
   ========================================================================== */
.filter-bar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-card);
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  width: 100%;
}

.filter-inputs-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  flex: 1;
}

.filter-field {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.filter-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-select, .filter-input, .filter-date {
  padding: 0.42rem 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
  height: 34px;
}
.filter-select:hover, .filter-date:hover {
  border-color: #cbd5e1;
}
.filter-select:focus, .filter-input:focus, .filter-date:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* General Form Elements */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.form-label.required::after { content: '*'; color: var(--status-red); margin-left: 0.15rem; }

.form-control {
  width: 100%;
  padding: 0.52rem 0.85rem;
  background: #ffffff;
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--text-main);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  line-height: 1.5;
}
.form-control:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-help {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
}

.form-row-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

/* ==========================================================================
   8. BUTTONS & BADGES
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.3;
  text-decoration: none;
  height: 34px;
}
.btn:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }

.btn-primary {
  background: var(--brand-accent);
  color: #ffffff;
  border-color: var(--brand-accent);
}
.btn-primary:hover { background: var(--brand-accent-hover); border-color: var(--brand-accent-hover); }

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-card);
}
.btn-outline:hover { background: var(--bg-muted); border-color: #cbd5e1; }

.btn-success { background: var(--status-green); color: #fff; border-color: var(--status-green); }
.btn-success:hover { background: #047857; }

.btn-danger { background: var(--status-red); color: #fff; border-color: var(--status-red); }
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; height: 30px; }
.btn-xs { padding: 0.22rem 0.55rem; font-size: 0.7rem; height: 24px; }

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.18rem 0.55rem;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}
.badge-green  { background: var(--status-green-bg);  color: var(--status-green-text);  border: 1px solid var(--status-green-border); }
.badge-yellow { background: var(--status-yellow-bg); color: var(--status-yellow-text); border: 1px solid var(--status-yellow-border); }
.badge-red    { background: var(--status-red-bg);    color: var(--status-red-text);    border: 1px solid var(--status-red-border); }
.badge-blue   { background: var(--status-blue-bg);   color: var(--status-blue-text);   border: 1px solid var(--status-blue-border); }
.badge-gray   { background: var(--status-gray-bg);   color: var(--status-gray-text);   border: 1px solid var(--status-gray-border); }

/* ==========================================================================
   9. DATA TABLES & MONITORING MATRIX
   ========================================================================== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  min-width: 600px;
}

.data-table thead {
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
  padding: 0.7rem 0.9rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
  color: var(--text-main);
  line-height: 1.45;
}

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

/* Period Monitoring Matrix */
.matrix-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-card);
  background: var(--bg-card);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.matrix-table thead {
  background: linear-gradient(90deg, var(--brand-navy-900) 0%, var(--brand-navy-850) 100%);
}

.matrix-table th {
  padding: 0.8rem 0.65rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.matrix-table th:first-child {
  text-align: left;
  padding-left: 1rem;
  min-width: 150px;
}

.matrix-table td {
  padding: 0.5rem 0.45rem;
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.matrix-table td:first-child { padding-left: 1rem; }

.matrix-row-header {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 140px;
}
.matrix-row-header strong { font-size: 0.8rem; font-weight: 700; }

.matrix-dept-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  background: var(--brand-navy-800);
  color: #93c5fd;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  margin-right: 0.3rem;
}

.matrix-cell-chip {
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  min-width: 90px;
  border: 1px solid transparent;
}
.matrix-cell-chip:hover { transform: scale(1.03); box-shadow: var(--shadow-md); z-index: 1; position: relative; }

.matrix-cell-chip.green  { background: var(--status-green-bg);  border-color: var(--status-green-border); }
.matrix-cell-chip.blue   { background: var(--status-blue-bg);   border-color: var(--status-blue-border); }
.matrix-cell-chip.yellow { background: var(--status-yellow-bg); border-color: var(--status-yellow-border); }
.matrix-cell-chip.red    { background: var(--status-red-bg);    border-color: var(--status-red-border); }
.matrix-cell-chip.gray   { background: var(--status-gray-bg);   border-color: var(--status-gray-border); }

.cell-subject {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
  line-height: 1.3;
}

.cell-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  gap: 0.25rem;
}

.cell-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}
.cell-status-dot.green  { background: var(--status-green); }
.cell-status-dot.blue   { background: var(--status-blue); }
.cell-status-dot.yellow { background: var(--status-yellow); }
.cell-status-dot.red    { background: var(--status-red); }
.cell-status-dot.gray   { background: var(--status-gray); }

/* ==========================================================================
   10. MODALS & DIALOGS
   ========================================================================== */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 13, 30, 0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-backdrop.active { display: flex; }

.modal-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18), 0 8px 20px rgba(0, 0, 0, 0.12);
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  gap: 0.75rem;
}

.modal-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
  font-family: var(--font-heading);
}

.modal-close-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}
.modal-close-btn:hover { background: var(--border-subtle); color: var(--text-main); }

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.modal-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.7rem 1rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.modal-tab-btn:hover { color: var(--text-main); }
.modal-tab-btn.active {
  color: var(--brand-accent);
  border-bottom-color: var(--brand-accent);
  background: var(--bg-card);
}

.modal-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.25rem;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ==========================================================================
   11. VERIFICATION SUMMARY & SCENARIO CARDS
   ========================================================================== */
.truth-model-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-card);
}

.truth-layers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-top: 1rem;
}

.truth-layer-col {
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  border: 1px solid transparent;
}
.truth-layer-col.planned  { background: var(--status-blue-bg);   border-color: var(--status-blue-border); }
.truth-layer-col.reported { background: #f5f3ff; border-color: #ddd6fe; }
.truth-layer-col.verified { background: var(--status-green-bg);  border-color: var(--status-green-border); }

.truth-layer-badge {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.truth-layer-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.truth-item-list { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }

.truth-item-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  gap: 0.5rem;
}

.truth-item-key { color: var(--text-muted); font-weight: 500; flex-shrink: 0; }
.truth-item-val { color: var(--text-main);  font-weight: 600; text-align: right; }

.scenario-launcher {
  background: linear-gradient(135deg, var(--brand-navy-950) 0%, var(--brand-navy-900) 100%);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  color: #fff;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-md);
}

.scenario-launcher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.scenario-launcher-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #f1f5f9;
}

.scenario-launcher-hint {
  font-size: 0.68rem;
  color: #64748b;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.65rem;
}

.scenario-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  text-align: left;
  color: #94a3b8;
  cursor: pointer;
  transition: all var(--transition);
  display: block;
  width: 100%;
}
.scenario-btn:hover {
  background: rgba(37, 99, 235, 0.25);
  border-color: #60a5fa;
  color: #fff;
  transform: translateY(-1px);
}

.scenario-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.scenario-desc {
  font-size: 0.7rem;
  color: #64748b;
  line-height: 1.45;
}

/* ==========================================================================
   12. TOASTS, BANNERS & UTILITIES
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 2rem));
}

.toast {
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  pointer-events: auto;
  border-left: 3px solid var(--brand-accent);
  font-size: 0.8rem;
  line-height: 1.45;
  animation: toastIn 0.25s ease-out;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-icon {
  display: flex;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.toast-icon svg { width: 16px; height: 16px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.toast.success { border-left-color: var(--status-green); }
.toast.success .toast-icon svg { stroke: var(--status-green); }
.toast.error   { border-left-color: var(--status-red); }
.toast.error   .toast-icon svg { stroke: var(--status-red); }
.toast.warning { border-left-color: var(--status-yellow); }
.toast.warning .toast-icon svg { stroke: var(--status-yellow); }
.toast.info    { border-left-color: var(--status-blue); }
.toast.info    .toast-icon svg { stroke: var(--status-blue); }

.attendance-sum-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.5rem;
  gap: 0.5rem;
}
.attendance-sum-banner.valid   { background: var(--status-green-bg);  color: var(--status-green-text);  border: 1px solid var(--status-green-border); }
.attendance-sum-banner.invalid { background: var(--status-red-bg);    color: var(--status-red-text);    border: 1px solid var(--status-red-border); }

.admin-tab-panel { display: block; }

.auditor-banner {
  background: #0f172a;
  color: #f59e0b;
  padding: 0.4rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  border-bottom: 2px solid #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  z-index: 1500;
}
.auditor-banner svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Global Utilities */
.text-muted     { color: var(--text-muted) !important; }
.text-dim       { color: var(--text-dim) !important; }
.text-success   { color: var(--status-green) !important; }
.text-danger    { color: var(--status-red) !important; }
.text-warning   { color: var(--status-yellow) !important; }
.fw-700         { font-weight: 700 !important; }
.fw-600         { font-weight: 600 !important; }
.font-mono      { font-family: var(--font-mono) !important; }
.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2          { gap: 0.5rem; }
.gap-3          { gap: 0.75rem; }
.mt-1           { margin-top: 0.25rem; }
.mt-2           { margin-top: 0.5rem; }
.mt-3           { margin-top: 0.75rem; }
.mb-2           { margin-bottom: 0.5rem; }
.mb-3           { margin-bottom: 0.75rem; }
.mb-4           { margin-bottom: 1.25rem; }

/* ==========================================================================
   13. RESPONSIVE BREAKPOINTS (Mobile, Tablet, Desktop, TV/4K)
   ========================================================================== */

/* ── Mobile Phone: 320–479px ─────────────────────────────────────── */
@media (max-width: 479px) {
  html { font-size: 13px; }

  :root {
    --topbar-height: 54px;
    --sidebar-width: 280px;
  }

  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: none;
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.35);
  }

  .app-main-layout { margin-left: 0; }
  .sidebar-toggle-btn { display: flex; }
  .app-content-body { padding: 0.85rem; }

  .page-head { flex-direction: column; gap: 0.5rem; }
  .page-head-title h2 { font-size: 1.1rem; }
  .page-head-actions { width: 100%; justify-content: flex-start; }

  .filter-row { flex-direction: column; align-items: stretch; gap: 0.65rem; }
  .filter-inputs-group { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .filter-field { display: flex; justify-content: space-between; width: 100%; }
  .filter-select, .filter-input, .filter-date { width: 60%; }
  .filter-actions { width: 100%; justify-content: flex-start; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .kpi-value { font-size: 1.45rem; }

  .role-pills-wrapper { display: none; }
  .role-pill-label    { display: none; }
  .search-pill-box    { display: none; }
  .live-clock-badge   { display: none; }

  .breadcrumb-area { font-size: 0.75rem; }
  .breadcrumb-area strong { max-width: 180px; }

  .scenario-grid { grid-template-columns: 1fr; }
  .truth-layers-grid { grid-template-columns: 1fr; }
  .form-row-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }

  .modal-container { max-height: 95vh; border-radius: var(--radius-md); }
  .modal-body { padding: 0.9rem; }
  .modal-header { padding: 0.85rem 0.9rem; }
  .modal-footer { padding: 0.75rem 0.9rem; }

  .data-table { font-size: 0.75rem; }
  .data-table th, .data-table td { padding: 0.55rem 0.6rem; }

  .top-navbar { padding: 0 0.85rem; gap: 0.5rem; }
}

/* ── Small Mobile / Phablet: 480–767px ──────────────────────────────────── */
@media (min-width: 480px) and (max-width: 767px) {
  html { font-size: 13.5px; }

  :root {
    --topbar-height: 56px;
    --sidebar-width: 280px;
  }

  .app-sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }
  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
  }

  .app-main-layout { margin-left: 0; }
  .sidebar-toggle-btn { display: flex; }
  .app-content-body { padding: 1rem; }

  .page-head { flex-direction: column; }
  .page-head-title h2 { font-size: 1.15rem; }

  .filter-row { flex-direction: column; align-items: stretch; gap: 0.65rem; }
  .filter-inputs-group { flex-wrap: wrap; gap: 0.5rem; }
  .filter-actions { width: 100%; justify-content: flex-start; }

  .kpi-grid { grid-template-columns: repeat(2, 1fr); }

  .role-pills-wrapper { display: none; }
  .search-pill-box    { display: none; }
  .live-clock-badge   { display: none; }

  .scenario-grid { grid-template-columns: repeat(2, 1fr); }
  .truth-layers-grid { grid-template-columns: 1fr; }
  .form-row-grid { grid-template-columns: repeat(2, 1fr); }

  .top-navbar { padding: 0 1rem; }
}

/* ── Tablet: 768–1023px ───────────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --sidebar-width: 220px;
    --topbar-height: 58px;
  }

  .app-content-body { padding: 1.25rem; }
  .page-head-title h2 { font-size: 1.25rem; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }

  .filter-inputs-group { gap: 0.5rem; }
  .filter-field { gap: 0.3rem; }

  .role-pill-label  { display: none; }
  .role-pill-btn    { padding: 0.28rem 0.55rem; font-size: 0.7rem; }
  .search-pill-input { width: 175px; }
  .search-pill-input:focus { width: 220px; }
  .live-clock-badge { display: none; }

  .scenario-grid { grid-template-columns: repeat(2, 1fr); }
  .truth-layers-grid { grid-template-columns: 1fr; }
  .form-row-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Desktop: 1024–1439px ─────────────────────────────────────────────── */
@media (min-width: 1024px) {
  :root {
    --sidebar-width: 250px;
    --topbar-height: 60px;
  }

  .sidebar-overlay { display: none !important; }

  .app-sidebar {
    transform: translateX(0) !important;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
  }

  .app-main-layout { margin-left: var(--sidebar-width); }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .scenario-grid { grid-template-columns: repeat(4, 1fr); }
  .truth-layers-grid { grid-template-columns: repeat(3, 1fr); }
  .search-pill-input { width: 220px; }
}

/* ── Large Desktop: 1440–1919px ──────────────────────────────────────── */
@media (min-width: 1440px) {
  :root {
    --sidebar-width: 265px;
    --topbar-height: 64px;
    --content-max: 1600px;
  }

  html { font-size: 15px; }
  .app-content-body { padding: 1.75rem 2rem; }
  .kpi-value { font-size: 2rem; }
  .search-pill-input { width: 250px; }
  .search-pill-input:focus { width: 320px; }
}

/* ── 4K / TV Screens: 1920px+ ─────────────────────────────────────────── */
@media (min-width: 1920px) {
  :root {
    --sidebar-width: 290px;
    --topbar-height: 68px;
    --content-max: 1800px;
  }

  html { font-size: 16px; }
  .app-content-body { padding: 2rem 2.5rem; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
  .kpi-value { font-size: 2.2rem; }
  .data-table { font-size: 0.9rem; }
  .data-table th { font-size: 0.78rem; }
  .data-table td { padding: 0.9rem 1.1rem; }
  .matrix-table { font-size: 0.85rem; }
  .matrix-cell-chip { min-width: 110px; padding: 0.55rem 0.65rem; }
  .cell-subject { font-size: 0.8rem; max-width: 120px; }
}

/* ── Ultra-Wide 2560px+ ──────────────────────────────────────────────── */
@media (min-width: 2560px) {
  :root { --content-max: 2200px; }
  html { font-size: 17px; }
}

/* ==========================================================================
   14. PRINT STYLES
   ========================================================================== */
@media print {
  .app-sidebar, .top-navbar, .sidebar-toggle-btn, .sidebar-overlay,
  .btn, .role-pills-wrapper, .search-pill-box, .modal-backdrop { display: none !important; }

  .app-main-layout { margin-left: 0 !important; }
  .app-content-body { padding: 0 !important; max-width: 100% !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  .data-table { font-size: 10pt; }
}
