:root {
  --ca-navy: #0a1628;
  --ca-navy-2: #12233d;
  --ca-ink: #152033;
  --ca-muted: #5c6b7a;
  --ca-surface: #ffffff;
  --ca-surface-2: #f3f6f9;
  --ca-bg: #e6ecf2;
  --ca-accent: #0d5c63;
  --ca-accent-hover: #094548;
  --ca-accent-soft: rgba(13, 92, 99, 0.11);
  --ca-accent-mid: #1a8a94;
  --ca-success: #1b7a4a;
  --ca-warning: #b7791f;
  --ca-danger: #b42318;
  --ca-border: #d0dae6;
  --ca-border-strong: #b4c2d1;
  --ca-radius: 12px;
  --ca-radius-sm: 8px;
  --ca-shadow: 0 1px 2px rgba(10, 22, 40, 0.04), 0 6px 20px rgba(10, 22, 40, 0.05);
  --ca-shadow-lg: 0 10px 36px rgba(10, 22, 40, 0.11);
  --ca-font: "IBM Plex Sans", "Segoe UI", sans-serif;
  --ca-font-cond: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  --ca-nav-h: 58px;
  --ca-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body { height: 100%; }

::selection {
  background: rgba(13, 92, 99, 0.22);
  color: var(--ca-navy);
}

body.app-body {
  margin: 0;
  font-family: var(--ca-font);
  color: var(--ca-ink);
  background-color: var(--ca-bg);
  background-image:
    radial-gradient(1200px 520px at 8% -8%, rgba(26, 138, 148, 0.09), transparent 55%),
    radial-gradient(900px 480px at 100% 0%, rgba(10, 22, 40, 0.05), transparent 50%),
    linear-gradient(180deg, #edf2f6 0%, var(--ca-bg) 42%, #e2e9f0 100%);
  background-attachment: fixed;
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.guest {
  background: var(--ca-navy);
  background-image: none;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--ca-border-strong) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb {
  background: var(--ca-border-strong);
  border-radius: 8px;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ca-muted); }

/* ——— Top bar ——— */
.app-nav {
  height: var(--ca-nav-h);
  min-height: var(--ca-nav-h);
  background: linear-gradient(180deg, #0c1a2e 0%, var(--ca-navy) 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 0;
  padding-bottom: 0;
  box-shadow: 0 8px 28px rgba(10, 22, 40, 0.18);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-nav .navbar-brand {
  font-family: var(--ca-font-cond);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.app-nav .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(145deg, #24a8b2, #0d5c63);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 8px rgba(13, 92, 99, 0.45);
}

.app-nav .nav-link {
  font-weight: 500;
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.72) !important;
  padding: 0.42rem 0.72rem !important;
  border-radius: 8px;
  transition: background 0.15s var(--ca-ease), color 0.15s ease;
}

.app-nav .nav-link:hover,
.app-nav .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.09);
}

.app-nav .nav-link.active,
.app-nav .nav-item.active > .nav-link {
  color: #fff !important;
  background: rgba(26, 138, 148, 0.28);
}

.app-nav .dropdown-menu {
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  box-shadow: var(--ca-shadow-lg);
  padding: 0.45rem;
  min-width: 12.5rem;
  margin-top: 0.45rem !important;
  animation: dropIn 0.16s var(--ca-ease);
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.app-nav .dropdown-item {
  border-radius: 7px;
  font-size: 0.875rem;
  padding: 0.48rem 0.8rem;
  transition: background 0.12s ease;
}

.app-nav .dropdown-item:hover,
.app-nav .dropdown-item:focus {
  background: var(--ca-accent-soft);
  color: var(--ca-accent);
}

.app-nav .dropdown-item.active {
  background: var(--ca-accent-soft);
  color: var(--ca-accent);
  font-weight: 600;
}

.app-user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.8125rem;
  padding: 0.2rem 0.45rem 0.2rem 0.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.app-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ca-accent-mid), var(--ca-accent));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 0.72rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}
.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1rem 0.9rem;
  background: linear-gradient(180deg, #0c1a2e 0%, var(--ca-navy) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 36px rgba(10, 22, 40, 0.18);
  overflow: auto;
}
.app-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #fff;
  text-decoration: none;
  margin-bottom: 1rem;
}
.app-sidebar-brand strong {
  display: block;
  font-family: var(--ca-font-cond);
  font-size: 1.02rem;
  font-weight: 700;
}
.app-sidebar-brand small {
  display: block;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.74rem;
}
.app-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}
.app-sidebar-user strong {
  display: block;
  font-size: 0.9rem;
}
.app-sidebar-user small {
  color: rgba(255, 255, 255, 0.66);
}
.app-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.app-side-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.app-side-group summary {
  list-style: none;
  cursor: pointer;
  padding: 0.75rem 0.9rem;
  color: #dbe7f4;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.app-side-group summary::-webkit-details-marker {
  display: none;
}
.app-side-link {
  display: block;
  margin: 0.2rem;
  padding: 0.62rem 0.78rem;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.app-side-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.app-side-link.active {
  background: rgba(26, 138, 148, 0.28);
  color: #fff;
}
.app-shell-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.15rem;
  background: rgba(230, 236, 242, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(176, 191, 208, 0.55);
}
.app-topbar-copy strong {
  display: block;
  color: var(--ca-navy);
  font-size: 1rem;
}
.app-topbar-copy span {
  display: block;
  color: var(--ca-muted);
  font-size: 0.78rem;
}
.app-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.app-topbar .btn-nav-ghost {
  color: var(--ca-navy);
  border-color: rgba(10, 22, 40, 0.14);
  background: rgba(255, 255, 255, 0.7);
}
.app-topbar .btn-nav-ghost:hover {
  color: var(--ca-accent);
  background: #fff;
  border-color: rgba(13, 92, 99, 0.25);
}
.notif-btn-light {
  color: var(--ca-navy);
}
.notif-btn-light:hover {
  background: rgba(13, 92, 99, 0.08);
  color: var(--ca-accent);
}
.app-topbar-logout {
  color: var(--ca-navy);
}
.app-topbar-logout:hover {
  color: var(--ca-navy);
}

.btn-nav-ghost {
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.32rem 0.8rem;
  border-radius: 8px;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-nav-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}
.ui-mode-toggle {
  white-space: nowrap;
}
.ui-mode-fab {
  position: fixed;
  right: 1rem;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  z-index: 1050;
  border: 1px solid rgba(13, 92, 99, 0.28);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ca-accent);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: var(--ca-shadow-lg);
}
.ui-mode-fab[hidden] {
  display: none !important;
}
.device-menu-fab {
  display: none;
  position: fixed;
  left: max(0.85rem, env(safe-area-inset-left));
  bottom: calc(5.25rem + env(safe-area-inset-bottom));
  z-index: 1100; /* above .att-device (40) so menu/logout stay clickable */
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: #12233d;
  color: #e8f1f4;
  box-shadow: 0 10px 28px rgba(7, 16, 28, 0.45);
  padding: 0;
}
body.device-mode .device-menu-fab:not([hidden]),
body.att-device-mode .device-menu-fab:not([hidden]) {
  display: grid;
}
.device-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(0, 0, 0, 0.48);
}
.device-menu-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 46;
  width: min(84vw, 320px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0c1a2e 0%, var(--ca-navy) 100%);
  color: #e8f1f4;
  box-shadow: 14px 0 36px rgba(7, 16, 28, 0.45);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  animation: deviceDrawerIn 0.24s ease;
}
@keyframes deviceDrawerIn {
  from { transform: translateX(-100%); }
  to { transform: none; }
}
.device-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.9rem + env(safe-area-inset-top)) 1rem 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.device-menu-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.device-menu-user strong,
.device-menu-user span {
  display: block;
}
.device-menu-user strong {
  font-size: 0.95rem;
  font-weight: 700;
}
.device-menu-user span {
  color: rgba(232, 241, 244, 0.68);
  font-size: 0.75rem;
}
.device-menu-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
}
.device-menu-links {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.8rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.device-menu-link {
  display: block;
  padding: 0.78rem 0.9rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.84);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.device-menu-link:hover,
.device-menu-link.active {
  color: #fff;
  background: rgba(20, 184, 166, 0.16);
  border-color: rgba(154, 209, 212, 0.16);
}
.device-menu-link.is-danger {
  color: #fecaca;
}
.device-menu-link.is-danger:hover {
  background: rgba(185, 28, 28, 0.18);
  border-color: rgba(254, 202, 202, 0.16);
}

@media (max-width: 1199.98px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 991.98px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-sidebar {
    position: relative;
    height: auto;
  }
  .app-topbar {
    position: relative;
  }
}

.notif-btn {
  position: relative;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.8);
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.notif-btn:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.notif-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  background: #e53e3e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: none;
  place-items: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--ca-navy);
}
.notif-badge.show { display: grid; }

/* Device-mode notifications (top nav is hidden) */
.device-notif-fab {
  display: none;
  position: fixed;
  right: max(0.85rem, env(safe-area-inset-right));
  bottom: calc(5.25rem + env(safe-area-inset-bottom));
  z-index: 1100;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: #12233d;
  color: #e8f1f4;
  box-shadow: 0 10px 28px rgba(7, 16, 28, 0.45);
  padding: 0;
}
body.device-mode .device-notif-fab:not([hidden]),
body.att-device-mode .device-notif-fab:not([hidden]) {
  display: grid;
}
.device-notif-fab .notif-badge {
  top: -2px;
  right: -2px;
  box-shadow: 0 0 0 2px #12233d;
}
.device-notif-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(0, 0, 0, 0.55);
}
.device-notif-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-height: min(70vh, 560px);
  display: flex;
  flex-direction: column;
  background: #0e1a2b;
  color: #e8f1f4;
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 0;
  box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.45);
  padding-bottom: env(safe-area-inset-bottom);
  animation: deviceNotifUp 0.28s ease;
}
@keyframes deviceNotifUp {
  from { transform: translateY(100%); }
  to { transform: none; }
}
.device-notif-handle {
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  margin: 0.55rem auto 0.25rem;
}
.device-notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.35rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.device-notif-head strong {
  font-size: 0.95rem;
  font-weight: 700;
}
.device-notif-markall {
  border: 0;
  background: transparent;
  color: #9ad1d4;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0;
}
.device-notif-list {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.35rem 0.5rem;
}
.device-notif-empty {
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
  padding: 1.5rem 0.75rem;
}
.device-notif-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  padding: 0.7rem 0.75rem;
  margin-bottom: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.device-notif-item:not(.is-read) {
  background: rgba(13, 92, 99, 0.22);
  border-color: rgba(154, 209, 212, 0.25);
}
.device-notif-item-title {
  font-size: 0.86rem;
  font-weight: 650;
  margin-bottom: 0.15rem;
}
.device-notif-item.is-read .device-notif-item-title { font-weight: 500; color: #cbd5e1; }
.device-notif-item-msg {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.35;
}
.dropdown-menu .device-notif-item {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: inherit;
  margin: 0;
  padding: 0.55rem 0.85rem;
}
.dropdown-menu .device-notif-item:not(.is-read) {
  background: rgba(13, 92, 99, 0.08);
  border: 0;
}
.dropdown-menu .device-notif-item-title { color: inherit; }
.dropdown-menu .device-notif-item.is-read .device-notif-item-title { color: inherit; }
.dropdown-menu .device-notif-item-msg { color: var(--ca-muted, #5c6b7a); }
.dropdown-menu .device-notif-empty { color: var(--ca-muted, #5c6b7a); }
.device-notif-foot {
  display: flex;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.device-notif-foot .att-btn,
.device-notif-foot button {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #e8f1f4;
  font-weight: 600;
}
body.device-menu-open,
body.device-notif-open { overflow: hidden; }

/* ——— Main ——— */
.app-main {
  max-width: 1360px;
  margin: 0 auto;
  padding-left: 1.35rem !important;
  padding-right: 1.35rem !important;
  animation: pageIn 0.35s var(--ca-ease);
}
.app-main-bleed {
  padding: 0 !important;
  max-width: none;
  animation: none;
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  margin-bottom: 1.35rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(176, 190, 206, 0.45);
}
.page-head h1,
.page-head .h3 {
  font-family: var(--ca-font-cond);
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ca-navy);
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.55rem);
}
.page-head .text-muted,
.page-eyebrow {
  font-size: 0.78rem;
  color: var(--ca-muted);
  margin: 0.15rem 0 0;
}
.page-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ca-accent);
  opacity: 0.9;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.surface {
  background: var(--ca-surface);
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  box-shadow: var(--ca-shadow);
  overflow: hidden;
}
.surface-pad { padding: 1.15rem 1.25rem; }
.surface-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  border-bottom: 1px solid var(--ca-border);
  background: linear-gradient(180deg, #fafcfd 0%, var(--ca-surface-2) 100%);
}

.panel-title {
  font-family: var(--ca-font-cond);
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ca-navy);
  margin: 0 0 0.75rem;
}

.stat-tile {
  background: var(--ca-surface);
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--ca-shadow);
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: border-color 0.18s var(--ca-ease), box-shadow 0.18s var(--ca-ease), transform 0.18s var(--ca-ease);
}
.stat-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--ca-accent-mid), var(--ca-accent));
  opacity: 0.55;
}
.stat-tile:hover {
  border-color: var(--ca-border-strong);
  box-shadow: var(--ca-shadow-lg);
  transform: translateY(-2px);
}
a.stat-tile.stat-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.stat-tile.stat-link:hover { border-color: var(--ca-accent); }
a.stat-tile.stat-link:hover .stat-val { color: var(--ca-accent); }

.kpi-mini {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.55rem;
  border-radius: var(--ca-radius-sm);
  background: var(--ca-surface-2);
  border: 1px solid transparent;
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.kpi-mini:hover {
  background: var(--ca-accent-soft);
  color: var(--ca-accent);
  border-color: rgba(13, 92, 99, 0.18);
}
.kpi-mini strong { font-size: 1rem; line-height: 1.2; }
.kpi-mini span {
  font-size: 0.68rem;
  color: var(--ca-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.dept-card { transition: box-shadow 0.15s ease, transform 0.15s ease; }
.dept-card:hover { box-shadow: var(--ca-shadow-lg); transform: translateY(-2px); }

.stat-val {
  font-family: var(--ca-font-cond);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ca-navy);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.stat-lbl {
  color: var(--ca-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  margin-top: 0.4rem;
}

.current-class-card {
  background: linear-gradient(135deg, #0f6b72 0%, #0a1628 78%);
  color: #fff;
  border: 0;
  border-radius: var(--ca-radius);
  padding: 1.3rem 1.45rem;
  box-shadow: var(--ca-shadow-lg);
  position: relative;
  overflow: hidden;
}
.current-class-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.current-class-card .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.75;
}
.current-class-card .btn-light { font-weight: 600; border: 0; }

.table {
  --bs-table-bg: transparent;
  margin-bottom: 0;
  font-size: 0.875rem;
}
.table thead th {
  background: linear-gradient(180deg, #f8fafc, var(--ca-surface-2));
  color: var(--ca-muted);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  border-bottom: 1px solid var(--ca-border);
  padding: 0.72rem 1rem;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.table > :not(caption) > * > * {
  vertical-align: middle;
  padding: 0.72rem 1rem;
  border-color: var(--ca-border);
}
.table-hover > tbody > tr { transition: background 0.12s ease; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #eef6f7; }
.table-success { --bs-table-bg: #e8f5ef !important; }
.table-bordered > :not(caption) > * > * { border-color: #e2e8f0; }

.matrix-table {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
}
.matrix-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3f7;
  box-shadow: inset 0 -1px 0 var(--ca-border);
}
.matrix-table th:nth-child(-n+3),
.matrix-table td:nth-child(-n+3) {
  position: sticky;
  background: #fff;
  z-index: 1;
}
.matrix-table thead th:nth-child(-n+3) {
  z-index: 3;
  background: #eef3f7;
}
.matrix-table thead th:nth-child(1),
.matrix-table td:nth-child(1) { left: 0; min-width: 4.5rem; }
.matrix-table thead th:nth-child(2),
.matrix-table td:nth-child(2) { left: 4.5rem; min-width: 9rem; }
.matrix-table thead th:nth-child(3),
.matrix-table td:nth-child(3) {
  left: 13.5rem;
  min-width: 4.5rem;
  box-shadow: 4px 0 8px -6px rgba(10, 22, 40, 0.18);
}
.matrix-table td.text-danger { font-weight: 600; }

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.status-pill.active, .status-pill.present, .status-pill.completed {
  background: #e8f5ef; color: var(--ca-success); border-color: #cde9db;
}
.status-pill.pending, .status-pill.upcoming {
  background: #f7f1e6; color: var(--ca-warning); border-color: #ead9b8;
}
.status-pill.absent, .status-pill.inactive {
  background: #fceceb; color: var(--ca-danger); border-color: #f3d0cd;
}
.status-pill.current {
  background: var(--ca-accent-soft); color: var(--ca-accent); border-color: rgba(13, 92, 99, 0.18);
}

.form-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ca-muted);
  text-transform: uppercase;
  letter-spacing: 0.035em;
  margin-bottom: 0.32rem;
}
.form-control, .form-select {
  border-color: var(--ca-border);
  border-radius: var(--ca-radius-sm);
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  background-color: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control-sm, .form-select-sm {
  padding: 0.38rem 0.65rem;
  font-size: 0.84rem;
  border-radius: 7px;
}
.form-control:hover, .form-select:hover { border-color: var(--ca-border-strong); }
.form-control:focus, .form-select:focus {
  border-color: var(--ca-accent);
  box-shadow: 0 0 0 3px var(--ca-accent-soft);
}

.btn {
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--ca-radius-sm);
  padding: 0.45rem 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.8125rem; border-radius: 7px; }
.btn-primary {
  --bs-btn-bg: var(--ca-accent);
  --bs-btn-border-color: var(--ca-accent);
  --bs-btn-hover-bg: var(--ca-accent-hover);
  --bs-btn-hover-border-color: var(--ca-accent-hover);
  --bs-btn-active-bg: var(--ca-accent-hover);
  --bs-btn-active-border-color: var(--ca-accent-hover);
  box-shadow: 0 1px 2px rgba(13, 92, 99, 0.2);
}
.btn-primary:hover { box-shadow: 0 4px 12px rgba(13, 92, 99, 0.28); }
.btn-outline-primary {
  --bs-btn-color: var(--ca-accent);
  --bs-btn-border-color: rgba(13, 92, 99, 0.35);
  --bs-btn-hover-bg: var(--ca-accent);
  --bs-btn-hover-border-color: var(--ca-accent);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--ca-accent-hover);
  --bs-btn-active-border-color: var(--ca-accent-hover);
}
.btn-outline-secondary {
  --bs-btn-color: var(--ca-muted);
  --bs-btn-border-color: var(--ca-border-strong);
  --bs-btn-hover-bg: var(--ca-surface-2);
  --bs-btn-hover-color: var(--ca-ink);
  --bs-btn-hover-border-color: var(--ca-border-strong);
  background: #fff;
}
.btn-success {
  --bs-btn-bg: var(--ca-success);
  --bs-btn-border-color: var(--ca-success);
}

.modal-content {
  border: 1px solid var(--ca-border);
  border-radius: 14px;
  box-shadow: var(--ca-shadow-lg);
  overflow: hidden;
}
.modal-header {
  border-bottom-color: var(--ca-border);
  background: linear-gradient(180deg, #fafcfd, var(--ca-surface-2));
  padding: 1rem 1.2rem;
}
.modal-title { font-family: var(--ca-font-cond); font-weight: 600; }
.modal-footer {
  border-top-color: var(--ca-border);
  background: #fafcfd;
  gap: 0.4rem;
}
.modal-body { padding: 1.2rem; }

.nav-tabs {
  border-bottom-color: var(--ca-border);
  gap: 0.15rem;
}
.nav-tabs .nav-link {
  color: var(--ca-muted);
  font-weight: 600;
  font-size: 0.85rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.7rem 1rem;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.nav-tabs .nav-link:hover { color: var(--ca-ink); }
.nav-tabs .nav-link.active {
  color: var(--ca-accent);
  background: transparent;
  border-bottom-color: var(--ca-accent);
}

.alert {
  border-radius: var(--ca-radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
}
.alert-danger {
  background: #fdf2f1;
  border-color: #f3d0cd;
  color: var(--ca-danger);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--ca-navy);
}
.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.5rem 3rem;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(10, 22, 40, 0.55), rgba(13, 92, 99, 0.78)),
    radial-gradient(900px 520px at 18% 85%, rgba(26, 138, 148, 0.4), transparent 58%),
    radial-gradient(600px 400px at 90% 10%, rgba(255, 255, 255, 0.06), transparent 50%),
    var(--ca-navy-2);
  position: relative;
  overflow: hidden;
}
.login-aside::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  pointer-events: none;
  opacity: 0.5;
}
.login-aside > * { position: relative; z-index: 1; }
.login-aside h1 {
  font-family: var(--ca-font-cond);
  font-size: clamp(1.8rem, 3vw, 2.45rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 14ch;
  line-height: 1.15;
  margin: 0 0 0.75rem;
  animation: pageIn 0.55s var(--ca-ease);
}
.login-aside p {
  color: rgba(255, 255, 255, 0.72);
  max-width: 36ch;
  margin: 0;
  animation: pageIn 0.7s var(--ca-ease);
}
.login-aside-footer {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.45);
}
.login-panel {
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(600px 300px at 70% 20%, rgba(13, 92, 99, 0.06), transparent 60%),
    var(--ca-surface-2);
}
.login-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--ca-border);
  border-radius: 16px;
  padding: 2rem 1.75rem;
  box-shadow: var(--ca-shadow-lg);
  animation: pageIn 0.4s var(--ca-ease);
}
.login-brand {
  font-family: var(--ca-font-cond);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ca-navy);
}
.login-sub { color: var(--ca-muted); margin-bottom: 1.35rem; font-size: 0.9rem; }
.link-face { color: var(--ca-accent); font-weight: 600; text-decoration: none; }
.link-face:hover { text-decoration: underline; }

.filter-bar {
  background: var(--ca-surface);
  border: 1px solid var(--ca-border);
  border-radius: var(--ca-radius);
  padding: 1rem 1.15rem;
  box-shadow: var(--ca-shadow);
  margin-bottom: 1.1rem;
  position: relative;
}
.filter-bar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--ca-accent-mid), var(--ca-accent));
  border-radius: var(--ca-radius) 0 0 var(--ca-radius);
  opacity: 0.7;
}

.empty-state {
  text-align: center;
  padding: 2.75rem 1.25rem;
  color: var(--ca-muted);
  font-size: 0.9rem;
}

.toast-host {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1080;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.app-toast {
  background: linear-gradient(135deg, #12233d, var(--ca-navy));
  color: #fff;
  padding: 0.8rem 1.05rem;
  border-radius: 10px;
  box-shadow: var(--ca-shadow-lg);
  font-size: 0.875rem;
  min-width: 220px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  animation: slideIn 0.28s var(--ca-ease);
}
@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.pwa-install-bar {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.85rem + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 16px;
  background: #12233d;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 14px 36px rgba(7, 16, 28, 0.45);
  color: #e8f1f4;
}
body.device-mode .pwa-install-bar,
body.att-device-mode .pwa-install-bar {
  bottom: calc(5.35rem + env(safe-area-inset-bottom));
}
.pwa-install-copy {
  flex: 1;
  min-width: 10rem;
}
.pwa-install-copy strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
}
.pwa-install-copy span {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.35;
}
.pwa-install-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.pwa-install-dismiss,
.pwa-install-go {
  min-height: 40px;
  border-radius: 11px;
  padding: 0.4rem 0.75rem;
  font-weight: 650;
  font-size: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  cursor: pointer;
}
.pwa-install-dismiss {
  background: transparent;
  color: #cbd5e1;
}
.pwa-install-go {
  background: #14b8a6;
  border-color: transparent;
  color: #042f2e;
}

code {
  color: var(--ca-accent);
  font-size: 0.85em;
  background: var(--ca-accent-soft);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.master-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border: none;
  margin-bottom: 0;
}
.master-tabs .nav-link {
  border: 1px solid transparent;
  border-radius: var(--ca-radius-sm) var(--ca-radius-sm) 0 0;
  color: var(--ca-muted);
  font-weight: 500;
  font-size: 0.8125rem;
  padding: 0.55rem 0.9rem;
  background: transparent;
}
.master-tabs .nav-link:hover { color: var(--ca-ink); background: rgba(255, 255, 255, 0.55); }
.master-tabs .nav-link.active {
  color: var(--ca-accent);
  background: var(--ca-surface);
  border-color: var(--ca-border) var(--ca-border) var(--ca-surface);
}
.master-tab-panel {
  border-top-left-radius: 0;
  border-top-right-radius: var(--ca-radius);
}

.master-flow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--ca-muted, #5a6b7d);
  margin-bottom: .75rem;
}
.master-flow-strip span {
  padding: .28rem .55rem;
  border-radius: .4rem;
  background: rgba(13, 110, 110, .08);
  color: var(--ca-accent, #0d6e6e);
}
.master-flow-strip .flow-tx {
  background: transparent;
  color: var(--ca-muted, #5a6b7d);
  font-weight: 500;
}

.pct-bar {
  height: 6px;
  border-radius: 999px;
  background: #e4ebf2;
  overflow: hidden;
  margin-top: 0.35rem;
}
.pct-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ca-accent), var(--ca-accent-mid));
}

.chart-box {
  position: relative;
  min-height: 180px;
}
.chart-box canvas { max-height: 220px; }

.group-list-row td {
  padding-top: 0.45rem !important;
  padding-bottom: 0.45rem !important;
  font-size: 0.84rem;
}
