@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@100..900&display=swap');

:root {
  --bg: #050609;
  --surface: #111219;
  --surface-soft: #181922;
  --surface-softer: #1f202a;
  --border-subtle: #2c2f3b;
  --border: var(--border-subtle);
  --accent: #ce5815;
  --accent-soft: rgba(206, 88, 21, 0.2);
  --positive: #44b0b9;
  --warning: #e69232;
  --text: #f5f5f8;
  --text-muted: #9c9fb0;
  --muted: var(--text-muted);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
  --shadow-soft: 0 22px 55px rgba(0, 0, 0, 0.7);
  --shadow-subtle: 0 12px 30px rgba(0, 0, 0, 0.55);

  /* Original variables retained for compatibility */
  --primary: #16a34a;
  --primary-2: #15803d;
  --danger: #dc2626;
  --success-bg: #dcfce7;
  --success-text: #166534;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
}

.app[data-theme="light"] {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-soft: #f3f4fb;
  --surface-softer: #ebeef9;
  --border-subtle: #d1d4e3;
  --border: var(--border-subtle);
  --text: #171823;
  --text-muted: #5e6070;
  --muted: var(--text-muted);
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.18);
  --shadow-subtle: 0 12px 32px rgba(15, 23, 42, 0.12);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #26273a 0, #050609 55%);
  color: var(--text);
}




.app-footer {
  padding: 1.25rem 1.5rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-footer-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  color: inherit;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(231, 229, 228, 0.95);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.app-footer-link:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 163, 74, 0.28);
  color: #166534;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.app-footer-logo {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  object-fit: cover;
  flex: 0 0 auto;
}

input,
select,
textarea,
button {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(22, 163, 74, 0.55) !important;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.10);
}

.hidden { display: none !important; }
.chart-container { position: relative; width: 100%; max-width: 450px; margin-left: auto; margin-right: auto; height: 300px; max-height: 350px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.app-header {
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(231, 229, 228, 0.95);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.teacher-shell,
.admin-shell {
  min-height: 100vh;
}

.app-header .max-w-7xl,
.app-header .max-w-6xl {
  padding-top: 6px !important;
  padding-bottom: 6px !important;
}

.app-header-top {
  position: relative;
  gap: 8px;
}

.app-header-top > * {
  min-width: 0;
}

.app-header-actions {
  justify-content: flex-end;
}

.app-context-grid {
  align-items: stretch;
}

.app-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-top-toggle {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(22, 163, 74, 0.18);
  background: #ffffff;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.app-top-toggle:hover {
  border-color: rgba(22, 163, 74, 0.35);
  background: #f7fcf8;
}

.app-context-mini {
  min-width: 0;
  overflow-wrap: anywhere;
}

.app-eyebrow {
  margin: 0 0 2px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 800;
  color: #16a34a;
}

.app-context-card {
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(250,250,249,0.95)),
    linear-gradient(180deg, rgba(22, 163, 74, 0.02), transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
  padding: 8px 10px !important;
}

.app-context-mini {
  background: linear-gradient(180deg, #ffffff, #fafaf9);
  padding: 10px 12px !important;
}

.app-main-nav {
  padding-top: 0;
  scrollbar-width: thin;
}

.app-nav-shell {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(249,250,251,0.98));
  padding: 6px 10px !important;
}

.workspace-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.workspace-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(231, 229, 228, 0.95);
  background: #fff;
  color: #57534e;
  font-size: 10px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.app-nav-top > * {
  min-width: 0;
}

.app-nav-top {
  align-items: center;
  gap: 8px;
}

.top-panel-collapsed .app-nav-shell {
  padding-top: 4px !important;
  padding-bottom: 4px !important;
}

.top-panel-collapsed .app-nav-top {
  grid-template-columns: 1fr;
  gap: 4px;
}

.top-panel-collapsed #workspace-description,
.top-panel-collapsed .workspace-badges {
  display: none !important;
}

.top-panel-collapsed #workspace-title {
  margin-top: 0 !important;
  font-size: 1rem !important;
}

.top-panel-collapsed .app-context-card {
  padding: 10px 12px !important;
}

.top-panel-collapsed .app-context-head {
  gap: 8px;
}

.top-panel-collapsed #top-panel-summary {
  font-size: 12px !important;
  line-height: 1.35;
}

.top-panel-collapsed .app-main-nav {
  margin-top: 0 !important;
}

.app-nav-top h2 {
  line-height: 1.15;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  line-height: inherit;
  cursor: pointer;
}

.app-brand:hover {
  color: #166534;
}

.app-brand:focus {
  outline: none;
  box-shadow: none;
}

.app-nav-top p {
  margin-bottom: 0;
}

.app-header + main,
header.app-header + main {
  padding-top: 6px;
}

.app-main {
  min-width: 0;
}

.teacher-main-layout {
  display: block;
}

.teacher-sidebar-host {
  display: none;
}

.teacher-main-content {
  min-width: 0;
}

.admin-main-layout {
  display: block;
}

.admin-sidebar-host {
  display: none;
}

.admin-main-content {
  min-width: 0;
}

.admin-side-tabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.mobile-workbar,
.mobile-sidebar-head,
.mobile-nav-scrim {
  display: none;
}

.mobile-workbar {
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid rgba(231, 229, 228, 0.95);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.mobile-workbar-copy {
  min-width: 0;
}

.mobile-workbar-title {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #16a34a;
}

.mobile-workbar-subtitle {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: #1c1917;
}

.mobile-nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(231, 229, 228, 0.95);
  background: #ffffff;
  color: #166534;
  font-size: 20px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.mobile-sidebar-head {
  justify-content: flex-end;
}

.mobile-nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.36);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.section-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,1), rgba(255,255,255,0.98));
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.045);
  border-radius: 20px;
}

.section-heading {
  position: relative;
  padding-left: 16px;
}

.section-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-head-row > div {
  min-width: 0;
}

.section-heading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #22c55e, #15803d);
  opacity: 0.9;
}

.metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(231, 229, 228, 0.9);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #fcfcfb);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  opacity: 0.9;
}

.metric-card--turma::after { background: linear-gradient(90deg, #22c55e, #15803d); }
.metric-card--alunos::after { background: linear-gradient(90deg, #84cc16, #16a34a); }
.metric-card--atividades::after { background: linear-gradient(90deg, #10b981, #059669); }
.metric-card--pendencias::after { background: linear-gradient(90deg, #f59e0b, #d97706); }

.metric-card p:last-child {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.toolbar-shell {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(231, 229, 228, 0.9);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(248,250,252,0.92), rgba(255,255,255,0.98));
}

.toolbar-actions {
  align-items: center;
}

.toolbar-actions button {
  min-height: 42px;
}

#table-lancamentos button,
#table-resumo button,
#table-recovery button,
#table-verificacoes button,
#annotations-list button,
#students-list button,
#admin-students-table button,
#assignments-table button,
#classes-table button,
#admin-users-table button,
#dashboard-classes-table button,
#audit-logs-table button {
  min-height: auto;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  line-height: 1.1;
  white-space: nowrap;
}

#table-lancamentos [data-open-paste-grades],
#table-lancamentos [data-del-activity],
#table-lancamentos [data-open-paste-saept],
#table-lancamentos [data-save-saept],
#table-resumo [data-open-paste-saept],
#table-resumo [data-save-saept],
#table-recovery button,
#table-verificacoes [data-del-verification],
#annotations-list [data-del-annotation],
#annotations-list [data-complete-alert],
#students-list [data-open-student-detail],
#students-list [data-edit-student],
#students-list [data-del-student],
#admin-students-table button,
#assignments-table button,
#classes-table button,
#admin-users-table button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding-left: 0.7rem !important;
  padding-right: 0.7rem !important;
  border-radius: 0.8rem;
  font-size: 0.78rem !important;
  font-weight: 700;
  white-space: nowrap;
}

#table-lancamentos .grid.grid-cols-2,
#table-resumo .grid.grid-cols-1 {
  align-items: stretch;
}

#table-lancamentos th,
#table-resumo th,
#table-recovery th {
  vertical-align: top;
}

#table-lancamentos .text-\[11px\],
#table-resumo .text-\[11px\] {
  line-height: 1.25;
}

.collapse-toggle-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(206, 88, 21, 0.3) !important;
  background: linear-gradient(
    135deg,
    rgba(206, 88, 21, 0.7),
    rgba(230, 146, 50, 0.1)
  ) !important;
  color: #ffffff !important;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.collapse-toggle-btn:hover {
  background: linear-gradient(
    135deg,
    rgba(206, 88, 21, 0.9),
    rgba(230, 146, 50, 0.25)
  ) !important;
  border-color: rgba(206, 88, 21, 0.5) !important;
}

.collapse-toggle-btn.is-collapsed {
  opacity: 0.85;
  border-color: rgba(231, 229, 228, 0.3) !important;
}

.collapse-toggle-btn--small {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 11px;
}

.section-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.tabs-shell {
  padding: 2px 0;
}

.tabs-shell button {
  min-height: 40px;
}

.admin-tabs-shell {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-sidebar-tabs {
  margin-top: 6px;
}

.admin-tab-btn {
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.95);
  color: #44403c;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.admin-tab-btn:hover {
  border-color: rgba(22, 163, 74, 0.35);
  color: #166534;
  background: #f7fcf8;
}

.admin-tab-btn.active {
  background: linear-gradient(180deg, #16a34a, #15803d);
  color: #fff;
  border-color: #15803d;
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.18);
}

/* Obsolete desktop styles commented out:
@media (min-width: 1220px) {
  :root {
    --sidebar-width: 300px;
  }

  .teacher-shell,
  .admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    align-items: start;
  }

  .teacher-shell > .app-header,
  .admin-shell > .app-header {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-bottom: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: none;
    background:
      radial-gradient(circle at top left, rgba(74, 222, 128, 0.16), transparent 30%),
      linear-gradient(180deg, #0f172a 0%, #102317 42%, #0b1410 100%);
    color: #f5f5f4;
  }

  .teacher-shell > .app-header .max-w-7xl,
  .admin-shell > .app-header .max-w-6xl {
    max-width: none !important;
    min-height: 100%;
    padding: 20px 18px !important;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .teacher-shell > .app-header .app-header-top,
  .admin-shell > .app-header .app-header-top {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .teacher-shell > .app-header .app-eyebrow,
  .admin-shell > .app-header .app-eyebrow {
    color: #86efac;
  }

  .teacher-shell > .app-header h1,
  .teacher-shell > .app-header .app-brand,
  .admin-shell > .app-header h1 {
    color: #f8fafc;
  }

  .teacher-shell > .app-header .text-stone-500,
  .admin-shell > .app-header .text-stone-500 {
    color: rgba(240, 253, 244, 0.72) !important;
  }

  .teacher-shell > .app-header .app-header-actions,
  .admin-shell > .app-header .app-header-actions {
    justify-content: flex-start;
    width: 100%;
    gap: 8px;
  }

  .teacher-shell > .app-header .app-header-actions a,
  .teacher-shell > .app-header .app-header-actions button,
  .teacher-shell > .app-header .app-header-actions span,
  .admin-shell > .app-header .app-header-actions a,
  .admin-shell > .app-header .app-header-actions button,
  .admin-shell > .app-header .app-header-actions span {
    min-height: 36px;
    border-radius: 14px !important;
  }

  .teacher-shell > .app-header #user-role-badge,
  .admin-shell > .app-header #user-role-badge {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
  }

  .teacher-shell > .app-header #user-display-name,
  .admin-shell > .app-header #admin-user-name {
    display: block !important;
    max-width: 100%;
    color: rgba(240, 253, 244, 0.72) !important;
  }

  .teacher-shell > .app-header .app-context-card,
  .teacher-shell > .app-header .app-nav-shell,
  .admin-shell > .app-header .section-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: none;
  }

  .teacher-shell > .app-header .app-context-card,
  .teacher-shell > .app-header .app-nav-shell {
    padding: 14px !important;
  }

  .teacher-shell > .app-header .app-context-mini {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .teacher-shell > .app-header .app-context-mini p:last-child {
    color: #f8fafc;
  }

  .teacher-shell > .app-header .app-top-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(134, 239, 172, 0.28);
    color: #dcfce7;
    box-shadow: none;
  }

  .teacher-shell > .app-header .app-nav-top {
    display: block;
  }

  .teacher-shell > .app-header .workspace-badges {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .teacher-shell > .app-header .workspace-badge {
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .teacher-shell > .app-header .app-main-nav,
  .admin-shell > .app-header .admin-tabs-shell {
    display: grid;
    gap: 8px;
  }

  .teacher-shell > .app-header .nav-btn,
  .admin-shell > .app-header .admin-tab-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 11px 14px !important;
    border-radius: 16px !important;
    box-shadow: none;
  }

  .teacher-shell > .app-header .nav-btn:not(.active),
  .admin-shell > .app-header .admin-tab-btn:not(.active) {
    background: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.06);
    color: #f5f5f4;
  }

  .teacher-shell > .app-header .nav-btn:not(.active):hover,
  .admin-shell > .app-header .admin-tab-btn:not(.active):hover {
    color: #ecfdf5 !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(134, 239, 172, 0.2) !important;
    transform: none;
  }

  .teacher-shell > .app-header .nav-btn.active,
  .admin-shell > .app-header .admin-tab-btn.active {
    background: linear-gradient(135deg, #22c55e, #15803d) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.24);
  }

  .teacher-shell > main.max-w-7xl,
  .admin-shell > main.max-w-6xl {
    max-width: none !important;
    width: 100%;
    padding: 24px 28px 32px !important;
  }

  .admin-shell > .app-header .admin-sidebar-tabs {
    margin-top: 8px;
  }

  .teacher-shell .app-header + main,
  .admin-shell .app-header + main {
    padding-top: 24px;
  }

  .teacher-shell #tab-dashboard .chart-container {
    max-width: 100%;
    height: 280px;
  }

  .app-footer {
    margin-left: var(--sidebar-width);
  }
}

 */
/* Obsolete mobile styles commented out:
@media (max-width: 1219px) {
  .teacher-shell,
  .admin-shell {
    display: block;
  }

  .mobile-workbar {
    display: flex;
  }

  .mobile-sidebar-head {
    display: flex;
  }

  .teacher-shell > .app-header,
  .admin-shell > .app-header {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    z-index: 60;
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    overflow-y: auto;
    border-right: 1px solid rgba(231, 229, 228, 0.95);
  }

  .teacher-shell.mobile-nav-open > .app-header,
  .admin-shell.mobile-nav-open > .app-header {
    transform: translateX(0);
  }

  .teacher-shell.mobile-nav-open > .mobile-nav-scrim,
  .admin-shell.mobile-nav-open > .mobile-nav-scrim {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }
}

 */
.table-shell {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
  background: #fff;
}

.table-scroll-top-shell {
  background: linear-gradient(180deg, #fafaf9, #f3f4f6);
}

.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  height: 16px;
  scrollbar-width: thin;
}

.table-scroll-top > div {
  height: 1px;
}

.table-ux-note {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(231, 229, 228, 0.9);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248,250,252,0.95), rgba(255,255,255,0.98));
  color: #57534e;
  font-size: 12px;
}

.table-ux-note span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-ux-note span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #16a34a;
  flex: 0 0 auto;
}

#table-lancamentos-shell,
#table-resumo-shell {
  scroll-behavior: smooth;
}

.admin-dashboard-cards > div {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(231, 229, 228, 0.9);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #ffffff, #fcfcfb);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.04);
}

.admin-dashboard-cards > div::after {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #22c55e, #15803d);
  opacity: 0.9;
}

.admin-dashboard-cards p:first-child {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #78716c;
  font-weight: 700;
}

.admin-dashboard-cards p:last-child {
  margin: 8px 0 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.admin-subcard {
  background: linear-gradient(180deg, rgba(250,250,249,0.92), rgba(255,255,255,0.98));
}

.dashboard-chart-container {
  max-width: 100%;
  height: 280px;
}

.boot-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.16), transparent 32%),
    linear-gradient(180deg, #f7fdf8 0%, #f5f5f4 100%);
  z-index: 1200;
}

.boot-loading.hidden { display: none !important; }

.boot-loading-card {
  width: 100%;
  max-width: 430px;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(34, 197, 94, 0.16);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(21, 128, 61, 0.10);
  padding: 32px 28px;
  text-align: center;
}

.boot-loading-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #14532d;
}

.boot-loading-text {
  margin: 12px 0 0;
  font-size: 14px;
  color: #78716c;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.16), transparent 32%),
    linear-gradient(160deg, rgba(22,163,74,0.14), rgba(21,128,61,0.08) 42%, #ffffff 100%);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 460px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(34, 197, 94, 0.16);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(21, 128, 61, 0.10);
  backdrop-filter: blur(10px);
  padding: 32px 28px 24px;
  text-align: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #ffffff;
  font-size: 34px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(21, 128, 61, 0.18);
}

.login-title { margin: 0; font-size: 28px; font-weight: 800; color: #14532d; }
.login-subtitle { margin: 12px 0 24px; font-size: 14px; color: #78716c; }

.login-input {
  width: 100%;
  height: 52px;
  border: 1px solid #d6d3d1;
  border-radius: 16px;
  background: #ffffff;
  padding: 0 18px;
  font-size: 16px;
  color: #1c1917;
  outline: none;
  margin-bottom: 14px;
  transition: all 0.2s ease;
  text-align: center;
}

.login-input:focus {
  border-color: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.10);
}

.login-error { min-height: 18px; margin: -4px 0 12px; font-size: 12px; color: #dc2626; }
.login-actions { display: flex; gap: 12px; margin-top: 8px; }

.btn-login-primary {
  flex: 1;
  height: 50px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 10px 20px rgba(21, 128, 61, 0.18);
}

.btn-login-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(21, 128, 61, 0.22);
}

.login-version { margin: 14px 0 0; font-size: 11px; letter-spacing: 2px; color: #a8a29e; }

.table-sticky-col { position: sticky; left: 0; background-color: white; z-index: 10; }
.sticky-id { left: 0; min-width: 80px; }
.sticky-name { left: 80px; min-width: 220px; }

#table-lancamentos thead th,
#table-resumo thead th,
#table-verificacoes thead th,
#dashboard-classes-table thead th,
#assignments-table thead th,
#admin-users-table thead th,
#classes-table thead th,
#audit-logs-table thead th,
#admin-students-table thead th {
  background: linear-gradient(180deg, #fafaf9, #f5f5f4);
  position: sticky;
  top: 0;
  z-index: 15;
  box-shadow: inset 0 -1px 0 rgba(231, 229, 228, 0.92);
}

#table-lancamentos thead,
#table-lancamentos thead tr {
  position: sticky;
  top: 0;
  z-index: 24;
}

#table-lancamentos thead th {
  top: 0;
  z-index: 26;
}

#table-lancamentos thead .sticky-id,
#table-lancamentos thead .sticky-name {
  z-index: 32;
}

#table-lancamentos tbody tr:nth-child(even),
#table-resumo tbody tr:nth-child(even),
#table-verificacoes tbody tr:nth-child(even),
#dashboard-classes-table tbody tr:nth-child(even),
#assignments-table tbody tr:nth-child(even),
#admin-users-table tbody tr:nth-child(even),
#classes-table tbody tr:nth-child(even),
#audit-logs-table tbody tr:nth-child(even),
#admin-students-table tbody tr:nth-child(even) {
  background: rgba(250,250,249,0.65);
}

#table-lancamentos tbody tr:hover,
#table-resumo tbody tr:hover,
#table-verificacoes tbody tr:hover,
#dashboard-classes-table tbody tr:hover,
#assignments-table tbody tr:hover,
#admin-users-table tbody tr:hover,
#classes-table tbody tr:hover,
#audit-logs-table tbody tr:hover,
#admin-students-table tbody tr:hover {
  background: rgba(220, 252, 231, 0.4);
}

#table-lancamentos td,
#table-lancamentos th,
#table-resumo td,
#table-resumo th,
#table-verificacoes td,
#table-verificacoes th,
#dashboard-classes-table td,
#dashboard-classes-table th,
#assignments-table td,
#assignments-table th,
#admin-users-table td,
#admin-users-table th,
#classes-table td,
#classes-table th,
#audit-logs-table td,
#audit-logs-table th,
#admin-students-table td,
#admin-students-table th {
  vertical-align: top;
}

#table-lancamentos .table-sticky-col,
#table-resumo .table-sticky-col,
#table-verificacoes .table-sticky-col {
  box-shadow: 1px 0 0 rgba(231, 229, 228, 0.9), 10px 0 18px rgba(15, 23, 42, 0.03);
  background-color: #fff;
}

#table-lancamentos tbody .table-sticky-col {
  z-index: 12;
}

#table-lancamentos td,
#table-lancamentos th,
#table-resumo td,
#table-resumo th {
  min-width: 92px;
}

#table-lancamentos .sticky-id,
#table-resumo .sticky-id {
  min-width: 74px;
  background: linear-gradient(180deg, #ffffff, #fcfcfb);
}

#table-lancamentos .sticky-name,
#table-resumo .sticky-name {
  min-width: 220px;
  background: linear-gradient(180deg, #ffffff, #fcfcfb);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal.active { display: flex; }

.modal-card {
  position: relative;
  width: min(100%, 960px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-top: 8px;
  margin-bottom: 8px;
}

.modal-body-scroll {
  overflow-y: auto;
  padding-right: 4px;
}

.modal-footer-sticky {
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), #ffffff 28%);
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid rgba(231, 229, 228, 0.95);
}

.nav-btn {
  transition: all 0.18s ease;
  min-height: 38px;
  padding: 8px 13px !important;
  border-radius: 14px !important;
}

.nav-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.06);
}

.nav-btn.active {
  background: linear-gradient(135deg, #16a34a, #15803d) !important;
  color: white !important;
  border-color: transparent !important;
  box-shadow: 0 6px 14px rgba(21, 128, 61, 0.14);
}

.nav-btn:not(.active) {
  background: rgba(255,255,255,0.9) !important;
}

.nav-btn:not(.active):hover {
  border-color: rgba(22, 163, 74, 0.35) !important;
  color: #166534 !important;
}

.badge-ok { background: var(--success-bg); color: var(--success-text); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); }

input[data-grade],
input[data-saept] {
  transition: all 0.18s ease;
}

input[data-grade]::-webkit-outer-spin-button,
input[data-grade]::-webkit-inner-spin-button,
input[data-saept]::-webkit-outer-spin-button,
input[data-saept]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[data-grade],
input[data-saept] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[data-grade]:focus,
input[data-saept]:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.10);
}

.unsaved-note {
  border-color: #f59e0b !important;
  background: #fffbeb !important;
}

.is-busy {
  opacity: 0.78;
  pointer-events: none;
}

.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 10px;
  z-index: 3000;
  width: min(340px, calc(100vw - 24px));
}

.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.96);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.10);
  animation: toast-in 0.18s ease;
}

.toast--success { border-color: rgba(22, 163, 74, 0.18); }
.toast--error { border-color: rgba(220, 38, 38, 0.18); }
.toast__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 5px;
  background: var(--primary);
  flex: 0 0 auto;
}

.toast--success .toast__dot { background: #16a34a; }
.toast--error .toast__dot { background: var(--danger); }
.toast__title { font-size: 13px; font-weight: 800; color: var(--text); }
.toast__body { font-size: 13px; color: var(--muted); line-height: 1.5; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

@media (max-width: 768px) {
  .app-header {
    position: static;
  }
  .app-header .max-w-7xl,
  .app-header .max-w-6xl {
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
  .app-header-top {
    gap: 8px;
  }
  .app-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .app-header-actions > * {
    flex: 0 0 auto;
  }
  .app-context-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .app-context-head {
    align-items: flex-start;
  }
  .app-context-grid > label {
    grid-column: 1 / -1;
  }
  .app-nav-top {
    gap: 10px;
  }
  .app-nav-shell,
  .app-context-card {
    padding: 7px 8px !important;
  }
  .app-context-mini {
    padding: 8px 10px !important;
  }
  .app-eyebrow {
    font-size: 10px;
    margin-bottom: 1px;
  }
  .app-header h1 {
    font-size: 1.95rem !important;
    line-height: 1;
  }
  .chart-container { height: 240px; max-width: 100%; }
  .sticky-name { min-width: 160px; }
  .section-heading {
    padding-left: 12px;
  }
  .toolbar-shell {
    padding: 10px;
  }
  .workspace-badges {
    display: none;
  }
  .workspace-badge {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .admin-dashboard-cards {
    grid-template-columns: 1fr 1fr !important;
  }
  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .toolbar-actions > * {
    width: 100%;
  }
  .toolbar-actions button,
  .toolbar-actions a,
  .toolbar-actions select {
    min-height: 40px;
  }
  .section-head-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .collapse-toggle-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .section-inline-head {
    align-items: flex-start;
  }
  .tabs-shell {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 8px;
  }
  .table-ux-note {
    font-size: 11px;
    gap: 8px;
    padding: 7px 10px;
  }
  .app-main-nav {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    padding-bottom: 2px;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
  }
  .admin-tabs-shell {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .tabs-shell button {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .admin-tab-btn {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .nav-btn {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .section-card {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  .table-scroll-top {
    height: 14px;
  }
  #table-lancamentos .sticky-name,
  #table-resumo .sticky-name {
    min-width: 160px;
  }
  #table-lancamentos .sticky-id,
  #table-resumo .sticky-id {
    min-width: 58px;
  }
  #table-lancamentos td,
  #table-lancamentos th {
    min-width: 84px;
  }
  .toast-container {
    top: auto;
    bottom: 12px;
    left: 12px;
    right: 12px;
    width: auto;
  }
}

@media (max-width: 560px) {
  body {
    overflow-x: hidden;
  }
  .app-header .max-w-7xl,
  .app-header .max-w-6xl,
  main.max-w-7xl,
  main.max-w-6xl {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
  .app-header .max-w-7xl,
  .app-header .max-w-6xl {
    gap: 8px !important;
  }
  .app-header-top {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 8px !important;
  }
  .app-header-top > div:first-child {
    min-width: 0;
  }
  .app-header-actions {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    gap: 6px !important;
    margin-left: auto;
    flex-wrap: wrap;
  }
  .app-context-head {
    align-items: center;
    gap: 6px;
  }
  .app-top-toggle {
    width: auto;
    justify-content: center;
    text-align: center;
    align-self: flex-start;
  }
  .app-header-actions #user-display-name,
  .app-header-actions #admin-user-name {
    max-width: none;
    white-space: normal;
    display: none !important;
  }
  .app-header-actions a,
  .app-header-actions button,
  .app-header-actions span[id="user-role-badge"] {
    width: auto;
    justify-content: center;
    text-align: center;
    min-height: 32px;
    padding: 6px 10px !important;
    font-size: 12px !important;
    border-radius: 12px !important;
  }
  .app-header-top > div:first-child > p.text-stone-500 {
    margin-top: 2px !important;
    margin-bottom: 0 !important;
    max-width: 320px;
  }
  .app-header-top h1 {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    line-height: 0.98;
  }
  .app-header-top .app-eyebrow {
    margin-bottom: 0;
  }
  .workspace-badges {
    margin-left: -2px;
    margin-right: -2px;
  }
  .workspace-badge {
    font-size: 10px;
    min-height: 28px;
    padding: 5px 9px;
  }
  .nav-btn,
  .admin-tab-btn {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 12px;
  }
  .app-context-card,
  .app-nav-shell,
  .section-card {
    border-radius: 16px;
  }
  .section-card {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
  }
  .app-context-card {
    margin-top: 0 !important;
  }
  .app-nav-top h2 {
    font-size: 0.98rem;
  }
  .app-nav-top > div:first-child > p:first-child {
    display: none;
  }
  .app-nav-top #workspace-description {
    display: none;
  }
  .app-context-grid {
    gap: 8px !important;
  }
  .top-panel-collapsed .app-nav-shell {
    padding: 8px 10px !important;
  }
  .top-panel-collapsed .app-context-card {
    padding: 8px 10px !important;
  }
  .top-panel-collapsed .app-context-head {
    flex-direction: column;
    align-items: stretch;
  }
  .top-panel-collapsed .app-context-head > div {
    min-width: 0;
  }
  .top-panel-collapsed .app-context-head p.text-sm {
    font-size: 13px !important;
    line-height: 1.2;
  }
  .top-panel-collapsed #top-panel-summary {
    font-size: 11px !important;
    margin-top: 2px !important;
  }
  .top-panel-collapsed .app-top-toggle {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 11px;
  }
  .top-panel-collapsed .app-nav-top > div:first-child > p:first-child {
    display: none;
  }
  .top-panel-collapsed #workspace-title {
    font-size: 0.95rem !important;
  }
  .top-panel-collapsed .app-main-nav {
    padding-top: 0;
    padding-bottom: 2px;
  }
  .top-panel-collapsed .nav-btn {
    min-height: 34px;
    padding: 7px 10px !important;
    font-size: 11px;
  }
  .app-context-mini p:first-child {
    font-size: 10px !important;
  }
  .app-context-mini p:last-child {
    font-size: 12px !important;
    line-height: 1.35;
  }
  .app-main-nav {
    padding-top: 0;
  }
  .section-heading {
    padding-left: 10px;
  }
  .admin-dashboard-cards {
    grid-template-columns: 1fr !important;
  }
  .toolbar-actions {
    grid-template-columns: 1fr;
  }
  .toolbar-shell {
    gap: 8px;
    padding: 9px;
  }
  .toolbar-filters {
    gap: 8px !important;
  }
  .toolbar-actions button,
  .collapse-toggle-btn,
  .nav-btn,
  .admin-tab-btn {
    min-height: 36px;
    font-size: 12px !important;
  }
  .section-inline-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .table-ux-note {
    display: none;
  }
  #table-lancamentos .sticky-name,
  #table-resumo .sticky-name {
    min-width: 132px;
  }
  #table-lancamentos td,
  #table-lancamentos th {
    min-width: 78px;
  }
}

@media (max-width: 420px) {
  .app-context-grid {
    grid-template-columns: 1fr !important;
  }
  .app-context-grid > label {
    grid-column: auto;
  }
  .app-header-top {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px !important;
  }
  .app-header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    margin-left: 0;
    gap: 6px !important;
  }
  .app-header-actions a,
  .app-header-actions button,
  .app-header-actions span[id="user-role-badge"] {
    flex: 0 0 auto;
  }
  .app-header h1 {
    font-size: 1.65rem !important;
  }
  .app-header-top > div:first-child > p.text-stone-500 {
    font-size: 12px !important;
  }
  .top-panel-collapsed .app-context-head {
    align-items: stretch;
  }
}

@media (min-width: 1024px) {
  .app-header .app-context-card,
  .app-header .app-nav-shell {
    border-radius: 20px;
  }
  .app-nav-top {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, auto);
    gap: 18px;
  }
  .app-nav-top #workspace-description {
    max-width: 700px;
  }
}

/* Obsolete mobile styles commented out:
@media (max-width: 1219px) {
  .admin-top-tabs-section {
    display: none !important;
  }

  .teacher-shell > .app-header,
  .admin-shell > .app-header {
    width: min(420px, 100vw);
    padding-bottom: 18px;
  }

  .teacher-shell > .app-header .max-w-7xl,
  .admin-shell > .app-header .max-w-6xl {
    padding: 18px 16px 20px !important;
    gap: 14px !important;
  }

  .teacher-shell > .app-header .app-header-top,
  .admin-shell > .app-header .app-header-top {
    display: block !important;
  }

  .teacher-shell > .app-header .app-header-top > div:first-child,
  .admin-shell > .app-header .app-header-top > div:first-child {
    margin-bottom: 12px;
  }

  .teacher-shell > .app-header .app-header-actions,
  .admin-shell > .app-header .app-header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    margin: 0 !important;
    gap: 10px !important;
  }

  .teacher-shell > .app-header .app-header-actions > *,
  .admin-shell > .app-header .app-header-actions > * {
    flex: 0 0 auto;
  }

  .teacher-shell > .app-header h1,
  .admin-shell > .app-header h1 {
    font-size: 2.1rem !important;
    line-height: 0.95;
    margin: 0 !important;
  }

  .teacher-shell > .app-header .app-eyebrow,
  .admin-shell > .app-header .app-eyebrow {
    margin-bottom: 4px;
  }

  .teacher-shell > .app-header .text-stone-500,
  .admin-shell > .app-header .text-stone-500 {
    line-height: 1.35;
  }

  .teacher-shell > .app-header .app-main-nav,
  .admin-shell > .app-header .admin-tabs-shell,
  .teacher-shell > .app-header .tabs-shell,
  .admin-shell > .app-header .tabs-shell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  .teacher-shell > .app-header .nav-btn,
  .admin-shell > .app-header .admin-tab-btn,
  .teacher-shell > .app-header .tabs-shell button,
  .admin-shell > .app-header .tabs-shell button {
    width: 100% !important;
    min-height: 46px !important;
    justify-content: flex-start !important;
    text-align: left !important;
    white-space: normal !important;
    padding: 10px 14px !important;
  }

  .teacher-shell > .app-header .app-nav-shell,
  .teacher-shell > .app-header .app-context-card,
  .admin-shell > .app-header .section-card {
    border-radius: 22px !important;
  }
}

 */
@media (max-width: 768px) {
  .teacher-shell > .app-header .app-main-nav,
  .admin-shell > .app-header .admin-tabs-shell {
    grid-template-columns: 1fr !important;
  }

  .teacher-shell > .app-header .app-nav-top > div:first-child > p:first-child,
  .teacher-shell > .app-header #workspace-description {
    display: block !important;
  }

  .teacher-shell > .app-header .workspace-badges {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .teacher-shell > .app-header .workspace-badge {
    justify-content: flex-start;
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .teacher-shell > .app-header,
  .admin-shell > .app-header {
    width: 100vw;
  }

  .teacher-shell > .app-header .max-w-7xl,
  .admin-shell > .app-header .max-w-6xl {
    padding: 16px 14px 18px !important;
    gap: 12px !important;
  }

  .teacher-shell > .app-header h1,
  .admin-shell > .app-header h1 {
    font-size: 2rem !important;
  }

  .teacher-shell > .app-header .app-header-actions,
  .admin-shell > .app-header .app-header-actions {
    gap: 8px !important;
  }

  .teacher-shell > .app-header .app-header-actions a,
  .teacher-shell > .app-header .app-header-actions button,
  .teacher-shell > .app-header .app-header-actions span[id="user-role-badge"],
  .admin-shell > .app-header .app-header-actions a,
  .admin-shell > .app-header .app-header-actions button,
  .admin-shell > .app-header .app-header-actions span[id="user-role-badge"] {
    min-height: 36px !important;
    padding: 7px 12px !important;
    font-size: 13px !important;
    border-radius: 14px !important;
  }

  .teacher-shell > .app-header .app-nav-shell,
  .teacher-shell > .app-header .app-context-card,
  .admin-shell > .app-header .section-card {
    padding: 12px !important;
  }

  .mobile-workbar {
    padding: 9px 10px;
    margin-bottom: 12px;
  }
}

.table-shell {
  position: relative;
  overflow: auto;
  max-height: min(72vh, 780px);
  overscroll-behavior: contain;
}

#table-lancamentos-shell,
#table-resumo-shell,
#table-verificacoes-shell {
  overflow: auto !important;
}

#table-lancamentos thead th,
#table-resumo thead th,
#table-verificacoes thead th {
  top: 0 !important;
}

#table-lancamentos thead .sticky-id,
#table-lancamentos thead .sticky-name,
#table-resumo thead .sticky-id,
#table-resumo thead .sticky-name {
  top: 0 !important;
}

/* Obsolete desktop styles commented out:
@media (min-width: 1220px) {
  .teacher-shell,
  .admin-shell {
    display: block;
  }

  .teacher-shell > .app-header,
  .admin-shell > .app-header {
    position: sticky;
    top: 0;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid rgba(231, 229, 228, 0.95);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    background:
      radial-gradient(circle at top left, rgba(22, 163, 74, 0.08), transparent 26%),
      rgba(255, 255, 255, 0.98);
    color: var(--text);
  }

  .teacher-shell > .app-header .max-w-7xl,
  .admin-shell > .app-header .max-w-6xl {
    max-width: 1680px !important;
    padding: 14px 16px !important;
    display: grid;
    gap: 14px;
  }

  .teacher-shell > .app-header .app-header-top,
  .admin-shell > .app-header .app-header-top {
    display: flex !important;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
  }

  .teacher-shell > .app-header .app-header-top > div:first-child,
  .admin-shell > .app-header .app-header-top > div:first-child {
    margin-bottom: 0;
  }

  .teacher-shell > .app-header .app-eyebrow,
  .admin-shell > .app-header .app-eyebrow {
    color: #16a34a;
  }

  .teacher-shell > .app-header h1,
  .teacher-shell > .app-header .app-brand,
  .admin-shell > .app-header h1 {
    color: var(--text);
  }

  .teacher-shell > .app-header .text-stone-500,
  .admin-shell > .app-header .text-stone-500 {
    color: #78716c !important;
  }

  .teacher-shell > .app-header .app-header-actions,
  .admin-shell > .app-header .app-header-actions {
    justify-content: flex-end !important;
    width: auto !important;
    gap: 10px !important;
    margin: 0 !important;
  }

  .teacher-shell > .app-header #user-role-badge,
  .admin-shell > .app-header #user-role-badge {
    background: #f5f5f4 !important;
    color: #44403c !important;
  }

  .teacher-shell > .app-header #user-display-name,
  .admin-shell > .app-header #admin-user-name {
    color: #57534e !important;
    max-width: 240px;
  }

  .teacher-shell > .app-header .app-context-card,
  .teacher-shell > .app-header .app-nav-shell,
  .admin-shell > .app-header .section-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.98));
    border-color: rgba(231, 229, 228, 0.95);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  }

  .teacher-shell > .app-header .app-context-card,
  .teacher-shell > .app-header .app-nav-shell {
    padding: 12px 14px !important;
  }

  .teacher-shell > .app-header .app-context-mini {
    background: linear-gradient(180deg, #ffffff, #fafaf9);
    border-color: rgba(231, 229, 228, 0.95);
  }

  .teacher-shell > .app-header .app-top-toggle {
    background: #ffffff;
    border-color: rgba(22, 163, 74, 0.18);
    color: #166534;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  }

  .teacher-shell > .app-header .app-nav-top {
    display: grid;
    grid-template-columns: minmax(280px, 1.15fr) minmax(280px, 1fr);
    gap: 18px;
    align-items: start;
  }

  .teacher-shell > .app-header .workspace-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-content: flex-start;
    gap: 8px;
    margin-top: 0;
  }

  .teacher-shell > .app-header .workspace-badge {
    justify-content: center;
    background: #fff;
    border-color: rgba(231, 229, 228, 0.95);
    white-space: nowrap;
  }

  .teacher-shell > .app-header .app-main-nav,
  .admin-shell > .app-header .admin-tabs-shell {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
  }

  .teacher-shell > .app-header .nav-btn,
  .admin-shell > .app-header .admin-tab-btn {
    width: auto !important;
    justify-content: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    padding: 10px 16px !important;
    border-radius: 14px !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  }

  .teacher-shell > .app-header .nav-btn:not(.active),
  .admin-shell > .app-header .admin-tab-btn:not(.active) {
    background: rgba(255, 255, 255, 0.98) !important;
    border-color: rgba(231, 229, 228, 0.95) !important;
    color: #44403c !important;
  }

  .teacher-shell > .app-header .nav-btn.active,
  .admin-shell > .app-header .admin-tab-btn.active {
    background: linear-gradient(135deg, #22c55e, #15803d) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.18);
  }

  .teacher-shell > main.max-w-7xl,
  .admin-shell > main.max-w-6xl {
    max-width: 1680px !important;
    width: 100%;
    padding: 18px 16px 32px !important;
  }

  .teacher-shell .app-context-card {
    display: grid;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px 18px !important;
  }

  .teacher-shell .app-context-head {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    padding-right: 18px;
    min-height: 100%;
    border-right: 1px solid rgba(231, 229, 228, 0.9);
  }

  .teacher-shell .app-context-head > .min-w-0 {
    width: 100%;
  }

  .teacher-shell #top-panel-summary {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.45;
  }

  .teacher-shell .app-top-toggle {
    width: 100%;
    justify-content: center;
  }

  .teacher-shell #top-panel-details {
    margin-top: 0 !important;
  }

  .teacher-shell .app-context-grid {
    grid-template-columns: minmax(420px, 2fr) minmax(200px, 0.9fr) minmax(200px, 0.9fr) !important;
    gap: 12px !important;
  }

  .teacher-shell .app-context-grid > label:first-child {
    grid-column: 1 / 2 !important;
  }

  .teacher-shell.top-panel-collapsed .app-context-card {
    grid-template-columns: 1fr;
    gap: 0;
    align-items: center;
  }

  .teacher-shell.top-panel-collapsed .app-context-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    border-right: 0;
    padding-right: 0;
    align-items: center;
    justify-content: stretch;
    gap: 14px;
  }

  .teacher-shell.top-panel-collapsed .app-context-head > .min-w-0 {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .teacher-shell.top-panel-collapsed #top-panel-summary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 4px !important;
  }

  .teacher-shell.top-panel-collapsed .app-top-toggle {
    width: auto;
    min-width: 160px;
    justify-content: center;
    align-self: center;
  }

  .teacher-shell.top-panel-collapsed #top-panel-details {
    display: none !important;
  }

  .teacher-main-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .admin-main-layout {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }

  .teacher-sidebar-host {
    display: block;
    position: sticky;
    top: 120px;
    align-self: start;
    min-width: 0;
  }

  .admin-sidebar-host {
    display: block;
    position: sticky;
    top: 120px;
    align-self: start;
    min-width: 0;
  }

  .teacher-sidebar-host .app-nav-shell {
    padding: 14px !important;
    border-radius: 22px !important;
    background: linear-gradient(180deg, #ffffff, #fafaf9);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
  }

  .admin-sidebar-host .admin-tabs-shell {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 14px !important;
    border: 1px solid rgba(231, 229, 228, 0.95);
    border-radius: 22px !important;
    background: linear-gradient(180deg, #ffffff, #fafaf9);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
  }

  .teacher-sidebar-host .app-nav-top {
    display: block !important;
    margin-bottom: 14px;
  }

  .teacher-sidebar-host .app-nav-top #workspace-description,
  .teacher-sidebar-host .workspace-badges {
    display: none !important;
  }

  .teacher-sidebar-host .app-nav-top p:first-child {
    margin-bottom: 6px;
  }

  .teacher-sidebar-host .app-nav-top h2 {
    font-size: 1rem;
    margin-top: 0 !important;
  }

  .teacher-sidebar-host .app-main-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-top: 0 !important;
  }

  .teacher-sidebar-host .nav-btn {
    width: 100% !important;
    justify-content: flex-start !important;
    text-align: left !important;
    white-space: normal !important;
    min-height: 42px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
    box-shadow: none;
  }

  .admin-sidebar-host .admin-tab-btn {
    width: 100% !important;
    justify-content: flex-start !important;
    text-align: left !important;
    white-space: normal !important;
    min-height: 42px !important;
    padding: 10px 12px !important;
    border-radius: 16px !important;
    box-shadow: none;
  }

  .admin-shell > .app-header .admin-sidebar-tabs {
    display: none !important;
  }
}

 */
@media (min-width: 1500px) {
  .teacher-shell > .app-header .max-w-7xl,
  .admin-shell > .app-header .max-w-6xl,
  .teacher-shell > main.max-w-7xl,
  .admin-shell > main.max-w-6xl {
    max-width: 1800px !important;
  }

  .teacher-main-layout {
    grid-template-columns: 216px minmax(0, 1fr);
  }

  .admin-main-layout {
    grid-template-columns: 216px minmax(0, 1fr);
  }
}

@media print {
  body { background: #ffffff !important; }
  header, #login-overlay, #import-modal, #grades-paste-modal, #student-modal, #main-nav, #tab-lancamentos, #tab-verificacoes, #tab-anotacoes, #tab-config, #btn-print-report, #btn-logout, #admin-link, #toast-container { display: none !important; }
  #tab-resumo { display: block !important; }
  main, .bg-white, .shadow-sm { box-shadow: none !important; }
  .border, .rounded-2xl, .rounded-xl { border-color: #d6d3d1 !important; border-radius: 0 !important; }
  .overflow-x-auto { overflow: visible !important; }
}


/* NEW MODERN SIDEBAR LAYOUT STYLES */

.app {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  width: 260px;
  background: radial-gradient(circle at top left, #26273a 0, #060710 55%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-shrink: 0;
  transition: width 0.2s ease;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar.collapsed {
  width: 76px;
}

.sidebar-header {
  display: flex;
  align-items: center;
}

.logo-btn {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  padding: 0.3rem 0.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  width: 100%;
  justify-content: center;
}

.logo-mark {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: conic-gradient(from 210deg, #ce5815, #e69232, #44b0b9, #ce5815);
  display: inline-block;
  flex-shrink: 0;
}

.logo-text {
  font-weight: 600;
  letter-spacing: 0.03em;
}

.sidebar.collapsed .logo-text {
  display: none;
}

/* Nav */

.sidebar-nav {
  flex: 1;
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

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

.nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0 0.3rem;
}

.sidebar.collapsed .nav-label {
  display: none;
}

.nav-item {
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.35rem 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, transform 0.1s ease;
  width: 100%;
}

.nav-item .nav-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  transform: translateY(-0.5px);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar.collapsed .nav-text {
  display: none;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.status-pill {
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.45);
  padding: 0.26rem 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  color: var(--text-muted);
  justify-content: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  flex-shrink: 0;
}

.sidebar.collapsed .status-text {
  display: none;
}

/* Main */

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top left, #1c1e30 0, #050609 50%);
  min-width: 0;
}

/* Topbar */

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr) minmax(0, 320px);
  gap: 0.75rem;
  padding: 0.9rem 1.25rem 0.4rem;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.breadcrumb {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.crumb-main {
  font-size: 0.95rem;
  font-weight: 500;
}

.crumb-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.search {
  max-width: 420px;
  margin: 0 auto;
  position: relative;
  width: 100%;
}

.search input {
  width: 100%;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.35rem 0.8rem 0.35rem 1.7rem;
}

.search input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
}

/* Pills / buttons */

.pill-btn {
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--surface-soft);
  color: var(--text);
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  box-shadow: var(--shadow-subtle);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.1s ease, box-shadow 0.1s ease;
}

.pill-btn-ghost {
  background: transparent;
  box-shadow: none;
}

.pill-btn.small {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.pill-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
  border-color: var(--accent-soft);
}

.icon-puck {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: radial-gradient(circle at top, #22c55e, #16a34a);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-puck .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.avatar-pill {
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.44);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.15rem 0.55rem 0.15rem 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.avatar-circle {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ce5815, #e69232);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.77rem;
  font-weight: 600;
  color: #fff;
}

.avatar-meta {
  display: flex;
  flex-direction: column;
}

.avatar-name {
  font-size: 0.82rem;
}

.avatar-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Content */

.content {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  flex: 1;
}

/* KPI row */

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

.card {
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  padding: 0.7rem 0.85rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.kpi-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.kpi-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
}

.kpi-tag {
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.04);
}

.kpi-tag.positive {
  color: var(--positive);
}

.kpi-tag.warning {
  color: var(--warning);
}

.kpi-tag.neutral {
  color: var(--text-muted);
}

.kpi-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.kpi-value {
  font-weight: 600;
  font-size: 1.05rem;
}

.kpi-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.kpi-sparkline {
  margin-top: 0.3rem;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(255, 255, 255, 0.16), transparent),
    linear-gradient(90deg, rgba(206, 88, 21, 0.2), transparent);
  position: relative;
  overflow: hidden;
}

.kpi-sparkline::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      135deg,
      rgba(206, 88, 21, 0.7),
      rgba(230, 146, 50, 0.1)
    );
  opacity: 0.55;
  mix-blend-mode: screen;
}

/* Main grid */

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: flex-start;
}

.main-grid .full-width {
  grid-column: 1 / -1;
}

/* Focus card */

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.card-header.tight {
  align-items: flex-start;
}

.card-header h2 {
  margin: 0;
  font-size: 0.95rem;
}

.card-header p {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.chip {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-soft);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chip-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.chart-shell {
  position: relative;
  border-radius: 14px;
  background: radial-gradient(circle at top left, #26283a 0, #111219 55%);
  padding: 0.65rem 0.7rem;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.chart-lines {
  position: relative;
  height: 130px;
}

.chart-line {
  position: absolute;
  inset: 0;
}

.chart-line-1::before,
.chart-line-2::before {
  content: "";
  position: absolute;
  inset: 10% 0;
  border-radius: 999px;
}

.chart-line-1::before {
  background-image: linear-gradient(
    135deg,
    rgba(206, 88, 21, 0.05),
    rgba(206, 88, 21, 0.55)
  );
  box-shadow: 0 0 40px rgba(206, 88, 21, 0.4);
}

.chart-line-2::before {
  background-image: linear-gradient(
    135deg,
    rgba(68, 176, 185, 0.05),
    rgba(68, 176, 185, 0.8)
  );
  box-shadow: 0 0 34px rgba(68, 176, 185, 0.4);
  transform: translateY(14px);
}

.chart-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.08) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 0 0;
  opacity: 0.32;
  pointer-events: none;
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.legend-1 {
  background: linear-gradient(135deg, #ce5815, #e69232);
}

.legend-2 {
  background: linear-gradient(135deg, #44b0b9, #22c1c3);
}

.card-footer-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.meta-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.meta-value {
  font-size: 0.82rem;
}

/* Side column */

.side-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.main-grid .centered-cards {
  grid-column: 1 / -1 !important;
  display: flex !important;
  justify-content: center !important;
  gap: 0.75rem !important;
  flex-wrap: wrap !important;
  width: 100% !important;
}

.main-grid .centered-cards .card {
  flex: 1 !important;
  max-width: 520px !important;
  min-width: 320px !important;
}

/* Pipeline */

.pipeline-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pipeline-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.pipeline-main {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.pipeline-label {
  font-size: 0.8rem;
}

.pipeline-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.pipeline-meta {
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.pipeline-value {
  font-size: 0.8rem;
  text-align: right;
}

.pipeline-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.pipeline-bar > div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ce5815, #e69232);
}

/* Team load */

.team-load {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.team-main {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.avatar-small {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: radial-gradient(circle at top, #ffffff, #cbd5f5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #111827;
}

.team-name {
  font-size: 0.82rem;
}

.team-role {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.team-meta {
  font-size: 0.78rem;
}

.pill {
  border-radius: 999px;
  padding: 0.16rem 0.55rem;
  font-size: 0.76rem;
}

.pill-soft {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.pill-green {
  color: var(--positive);
}

.pill-amber {
  color: var(--warning);
}

/* Activity */

.activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.activity-feed {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ce5815, #e69232);
}

.activity-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.activity-title {
  font-size: 0.82rem;
}

.activity-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.activity-table-wrapper {
  overflow-x: auto;
}

.activity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.activity-table th,
.activity-table td {
  padding: 0.32rem 0.45rem;
  text-align: left;
}

.activity-table thead {
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.activity-table tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

/* Placeholders for other views */

.hidden {
  display: none !important;
}

.placeholder {
  padding: 0.6rem 0.1rem 0.1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Compact mode */

.app[data-compact="true"] .sidebar {
  width: 76px;
}

.app[data-compact="true"] .sidebar .logo-text,
.app[data-compact="true"] .sidebar .nav-label,
.app[data-compact="true"] .sidebar .nav-text,
.app[data-compact="true"] .sidebar .status-text {
  display: none;
}

.app[data-compact="true"] .card {
  padding: 0.6rem 0.7rem;
}

.app[data-compact="true"] .kpi-card .kpi-value {
  font-size: 0.95rem;
}

.app[data-compact="true"] .card-header h2 {
  font-size: 0.9rem;
}

/* Card entrance animation */
.card {
  opacity: 0;
  transform: translateY(12px);
  animation: cardIn 0.45s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.05s; }
.card:nth-child(2) { animation-delay: 0.10s; }
.card:nth-child(3) { animation-delay: 0.15s; }
.card:nth-child(4) { animation-delay: 0.20s; }

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive */

@media (max-width: 1120px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .main-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: auto;
  }
  .kpi-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    display: none;
  }
  .main {
    padding-left: 0;
  }
}

/* Sidebar adjustments for collapsing and compact mode */
.sidebar {
  overflow-x: hidden !important;
}

.sidebar.collapsed {
  width: 76px !important;
  padding: 1.1rem 0.5rem !important;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .status-text,
.sidebar.collapsed .logout-text,
.sidebar.collapsed .compact-text {
  display: none !important;
}

.sidebar.collapsed .logo-btn {
  padding: 0.3rem 0 !important;
  width: 100% !important;
}

.sidebar.collapsed .nav-item {
  justify-content: center !important;
  padding: 0.35rem 0 !important;
}

/* Compact mode sidebar and card adjustments */
.app[data-compact="true"] .sidebar {
  width: 76px !important;
  padding: 1.1rem 0.5rem !important;
}

.app[data-compact="true"] .sidebar .logo-text,
.app[data-compact="true"] .sidebar .nav-label,
.app[data-compact="true"] .sidebar .nav-text,
.app[data-compact="true"] .sidebar .status-text,
.app[data-compact="true"] .sidebar .logout-text,
.app[data-compact="true"] .sidebar .compact-text {
  display: none !important;
}

.app[data-compact="true"] .sidebar .logo-btn {
  padding: 0.3rem 0 !important;
  width: 100% !important;
}

.app[data-compact="true"] .sidebar .nav-item {
  justify-content: center !important;
  padding: 0.35rem 0 !important;
}

.app[data-compact="true"] .card {
  padding: 0.6rem 0.7rem !important;
}

.app[data-compact="true"] .kpi-card .kpi-value {
  font-size: 0.95rem !important;
}

.app[data-compact="true"] .card-header h2 {
  font-size: 0.9rem !important;
}

/* Highly specific theme overrides to override dynamically loaded Tailwind utility classes */

/* Sidebar Navigation Buttons */
#app-container .sidebar .nav-btn:not(.active) {
  background: transparent !important;
  color: var(--text-muted) !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  margin: 0 !important;
  min-height: 0 !important;
  padding: 0.35rem 0.6rem !important;
  font-size: 0.85rem !important;
  font-weight: 500 !important;
}

#app-container .sidebar .nav-btn:not(.active):hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text) !important;
}

#app-container .sidebar .nav-btn.active {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
  font-weight: 600 !important;
  border: none !important;
  box-shadow: none !important;
  transform: none !important;
  margin: 0 !important;
  min-height: 0 !important;
  padding: 0.35rem 0.6rem !important;
  font-size: 0.85rem !important;
}

body[data-theme="light"] #app-container .sidebar .nav-btn:not(.active):hover {
  background: rgba(0, 0, 0, 0.05) !important;
  color: var(--text) !important;
}

body[data-theme="light"] #app-container .sidebar .nav-btn.active {
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

/* If compact/collapsed, center items and remove text spacing */
#app-container .sidebar.collapsed .nav-btn,
#app-container.app[data-compact="true"] .sidebar .nav-btn {
  justify-content: center !important;
  padding: 0.35rem 0 !important;
}

/* Cards, containers and dropdown panels background and borders */
#app-container .bg-white,
#app-container .bg-white\/80,
#app-container .section-card,
#app-container .app-context-card,
#app-container .app-nav-shell,
#app-container .metric-card,
#import-modal .bg-white,
#student-modal .bg-white,
#student-detail-modal .bg-white,
#grades-paste-modal .bg-white,
#summary-export-modal .bg-white {
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  background-image: none !important;
  border-color: var(--border-subtle) !important;
  color: var(--text) !important;
}

#app-container .bg-stone-50,
#import-modal .bg-stone-50,
#student-modal .bg-stone-50,
#student-detail-modal .bg-stone-50,
#grades-paste-modal .bg-stone-50,
#summary-export-modal .bg-stone-50 {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
  background-image: none !important;
  border-color: var(--border-subtle) !important;
}

body:not([data-theme="light"]) #app-container .bg-stone-100 {
  background-color: var(--surface-soft) !important;
}

body:not([data-theme="light"]) #app-container .toolbar-shell,
body:not([data-theme="light"]) #app-container .table-ux-note,
body:not([data-theme="light"]) #app-container .table-scroll-top-shell {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
  background-image: none !important;
  border-color: var(--border-subtle) !important;
}

/* Dark theme overrides for sticky table columns to prevent overlap issues and keep them dark */
body:not([data-theme="light"]) #app-container th.table-sticky-col,
body:not([data-theme="light"]) #app-container th.sticky-id,
body:not([data-theme="light"]) #app-container th.sticky-name {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
  border-color: var(--border-subtle) !important;
}

body:not([data-theme="light"]) #app-container td.table-sticky-col,
body:not([data-theme="light"]) #app-container td.sticky-id,
body:not([data-theme="light"]) #app-container td.sticky-name {
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  color: var(--text-muted) !important;
  border-color: var(--border-subtle) !important;
}

body:not([data-theme="light"]) #app-container tr:nth-child(even) td.table-sticky-col,
body:not([data-theme="light"]) #app-container tr:nth-child(even) td.sticky-id,
body:not([data-theme="light"]) #app-container tr:nth-child(even) td.sticky-name {
  background: #14151e !important;
  background-color: #14151e !important;
}

body:not([data-theme="light"]) #app-container tr:hover td.table-sticky-col,
body:not([data-theme="light"]) #app-container tr:hover td.sticky-id,
body:not([data-theme="light"]) #app-container tr:hover td.sticky-name {
  background: var(--surface-softer) !important;
  background-color: var(--surface-softer) !important;
}

body:not([data-theme="light"]) #app-container th {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
  background-image: none !important;
}

body:not([data-theme="light"]) #app-container .table-shell {
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  box-shadow: none !important;
}

#app-container .border-stone-200,
#app-container .border-stone-100,
#import-modal .border-stone-200,
#student-modal .border-stone-200,
#student-detail-modal .border-stone-200,
#grades-paste-modal .border-stone-200,
#summary-export-modal .border-stone-200 {
  border-color: var(--border-subtle) !important;
}

/* Modals wrapper and card override */
.modal-card {
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text) !important;
}

/* Specific warning panels in dark mode */
body:not([data-theme="light"]) #app-container .bg-amber-50,
body:not([data-theme="light"]) #teacher-alerts-panel .bg-amber-50 {
  background: rgba(230, 146, 50, 0.1) !important;
  background-color: rgba(230, 146, 50, 0.1) !important;
  border-color: rgba(230, 146, 50, 0.3) !important;
}
body:not([data-theme="light"]) #app-container .text-amber-900,
body:not([data-theme="light"]) #teacher-alerts-panel .text-amber-900 {
  color: #fbd38d !important;
}
body:not([data-theme="light"]) #app-container .text-amber-800,
body:not([data-theme="light"]) #teacher-alerts-panel .text-amber-800 {
  color: #f6ad55 !important;
}

/* Text Colors - Dark Mode */
body:not([data-theme="light"]) #app-container .text-stone-900,
body:not([data-theme="light"]) #app-container .text-stone-800,
body:not([data-theme="light"]) #app-container .text-stone-700,
body:not([data-theme="light"]) #app-container h1,
body:not([data-theme="light"]) #app-container h2,
body:not([data-theme="light"]) #app-container h3,
body:not([data-theme="light"]) #app-container h4,
body:not([data-theme="light"]) #app-container label span,
body:not([data-theme="light"]) #app-container th,
body:not([data-theme="light"]) #app-container .app-brand,
body:not([data-theme="light"]) #app-container .text-text,
body:not([data-theme="light"]) #app-container .workspace-badges span,
/* also cover modals */
body:not([data-theme="light"]) .modal-card h2,
body:not([data-theme="light"]) .modal-card h3,
body:not([data-theme="light"]) .modal-card label span,
body:not([data-theme="light"]) .modal-card .text-stone-900 {
  color: var(--text) !important;
}

body:not([data-theme="light"]) #app-container .text-stone-500,
body:not([data-theme="light"]) #app-container .text-stone-600,
body:not([data-theme="light"]) #app-container p,
body:not([data-theme="light"]) #app-container td,
body:not([data-theme="light"]) #app-container .text-muted,
body:not([data-theme="light"]) .modal-card p,
body:not([data-theme="light"]) .modal-card .text-stone-500 {
  color: var(--text-muted) !important;
}

/* Text Colors - Light Mode */
body[data-theme="light"] #app-container .text-stone-900,
body[data-theme="light"] #app-container .text-stone-800,
body[data-theme="light"] #app-container .text-stone-700,
body[data-theme="light"] #app-container h1,
body[data-theme="light"] #app-container h2,
body[data-theme="light"] #app-container h3,
body[data-theme="light"] #app-container h4,
body[data-theme="light"] #app-container label span,
body[data-theme="light"] #app-container th,
body[data-theme="light"] #app-container .app-brand,
body[data-theme="light"] #app-container .text-text,
body[data-theme="light"] #app-container .workspace-badges span,
body[data-theme="light"] .modal-card h2,
body[data-theme="light"] .modal-card h3,
body[data-theme="light"] .modal-card label span,
body[data-theme="light"] .modal-card .text-stone-900 {
  color: var(--text) !important;
}

body[data-theme="light"] #app-container .text-stone-500,
body[data-theme="light"] #app-container .text-stone-600,
body[data-theme="light"] #app-container p,
body[data-theme="light"] #app-container td,
body[data-theme="light"] #app-container .text-muted,
body[data-theme="light"] .modal-card p,
body[data-theme="light"] .modal-card .text-stone-500 {
  color: var(--text-muted) !important;
}

/* Form Elements (input, select, textarea) */
#app-container input[type="text"],
#app-container input[type="password"],
#app-container input[type="email"],
#app-container input[type="number"],
#app-container input[type="date"],
#app-container input[type="time"],
#app-container select,
#app-container textarea,
.modal-card input,
.modal-card select,
.modal-card textarea {
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.55rem 0.85rem !important;
  font-size: 0.82rem !important;
}

body:not([data-theme="light"]) #app-container input[type="date"],
body:not([data-theme="light"]) #app-container input[type="time"],
body:not([data-theme="light"]) .modal-card input[type="date"],
body:not([data-theme="light"]) .modal-card input[type="time"] {
  color-scheme: dark !important;
}

body[data-theme="light"] #app-container input[type="date"],
body[data-theme="light"] #app-container input[type="time"],
body[data-theme="light"] .modal-card input[type="date"],
body[data-theme="light"] .modal-card input[type="time"] {
  color-scheme: light !important;
}

/* Compact form elements and inputs inside tables */
#app-container #table-lancamentos input,
#app-container #table-resumo input,
#app-container #table-recovery input,
#app-container input[data-grade],
#app-container input[data-saept],
#app-container input[data-recovery-score],
#app-container input[data-edit-activity-name] {
  padding: 0.25rem 0.5rem !important;
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  font-size: 0.82rem !important;
}

#app-container input::placeholder,
#app-container textarea::placeholder,
.modal-card input::placeholder,
.modal-card textarea::placeholder {
  color: var(--text-muted) !important;
  opacity: 0.65;
}

/* Tables elements */
#app-container table {
  background-color: var(--surface) !important;
  color: var(--text-muted) !important;
}

#app-container th {
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
  font-weight: 600 !important;
  border-bottom: 1px solid var(--border-subtle) !important;
}

#app-container td {
  border-bottom: 1px solid var(--border-subtle) !important;
  color: var(--text-muted) !important;
}

#app-container tr:nth-child(even) td {
  background-color: rgba(255, 255, 255, 0.01) !important;
}

#app-container tr:hover td {
  background-color: var(--surface-softer) !important;
}

body[data-theme="light"] #app-container tr:hover td {
  background-color: var(--surface-soft) !important;
}

/* Theme gradients for body */
body {
  background: radial-gradient(circle at top, #26273a 0, #050609 55%) !important;
  color: var(--text) !important;
}

body[data-theme="light"] {
  background: radial-gradient(circle at top, #ebeef9 0, #f4f5fb 55%) !important;
  color: var(--text) !important;
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-soft: #f3f4f8;
  --surface-softer: #e9ebf2;
  --border-subtle: #cfd3de;
  --border: var(--border-subtle);
  --text: #171823;
  --text-muted: #5e6070;
  --muted: var(--text-muted);
  --shadow-soft: 0 18px 50px rgba(15, 23, 42, 0.18);
  --shadow-subtle: 0 12px 32px rgba(15, 23, 42, 0.12);
}

/* Fix for custom scrollbars to blend in dark mode */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

body:not([data-theme="light"]) #app-container .metric-card p:last-child {
  color: var(--text) !important;
}

/* Secondary button and file input dark mode styling */
body:not([data-theme="light"]) #app-container .bg-stone-200,
body:not([data-theme="light"]) .modal-card .bg-stone-200 {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-subtle) !important;
}

body:not([data-theme="light"]) #app-container .bg-stone-200:hover,
body:not([data-theme="light"]) .modal-card .bg-stone-200:hover {
  background: var(--surface-softer) !important;
  background-color: var(--surface-softer) !important;
}

body:not([data-theme="light"]) #app-container input[type="file"]::file-selector-button,
body:not([data-theme="light"]) .modal-card input[type="file"]::file-selector-button {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.25rem 0.65rem !important;
  cursor: pointer;
}

body:not([data-theme="light"]) #app-container input[type="file"]::file-selector-button:hover,
body:not([data-theme="light"]) .modal-card input[type="file"]::file-selector-button:hover {
  background: var(--surface-softer) !important;
  background-color: var(--surface-softer) !important;
}

/* Loader Styles */
.boot-loading,
#admin-loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(circle farthest-corner at center, #26273a 0%, #050609 100%) !important;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

body[data-theme="light"] .boot-loading,
body[data-theme="light"] #admin-loading {
  background-image: radial-gradient(circle farthest-corner at center, #ebeef9 0%, #f4f5fb 100%) !important;
}

.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

.loader {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  perspective: 800px;
  position: relative;
}

.inner {
  position: absolute;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border-radius: 50%;  
}

.inner.one {
  left: 0%;
  top: 0%;
  animation: rotate-one 1s linear infinite;
  border-bottom: 3px solid var(--accent, #ce5815);
}

.inner.two {
  right: 0%;
  top: 0%;
  animation: rotate-two 1s linear infinite;
  border-right: 3px solid var(--accent, #ce5815);
}

.inner.three {
  right: 0%;
  bottom: 0%;
  animation: rotate-three 1s linear infinite;
  border-top: 3px solid var(--accent, #ce5815);
}

.loader-brand {
  font-family: "Outfit", "Manrope", sans-serif;
  font-size: 2.2rem;
  font-weight: 200;
  letter-spacing: 0.15em;
  color: var(--text);
  margin-top: 0.5rem;
  text-transform: uppercase;
  animation: pulse-brand 2s ease-in-out infinite;
}

@keyframes pulse-brand {
  0%, 100% { opacity: 0.6; transform: scale(0.98); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes rotate-one {
  0% { transform: rotateX(35deg) rotateY(-45deg) rotateZ(0deg); }
  100% { transform: rotateX(35deg) rotateY(-45deg) rotateZ(360deg); }
}

@keyframes rotate-two {
  0% { transform: rotateX(50deg) rotateY(10deg) rotateZ(0deg); }
  100% { transform: rotateX(50deg) rotateY(10deg) rotateZ(360deg); }
}

@keyframes rotate-three {
  0% { transform: rotateX(35deg) rotateY(55deg) rotateZ(0deg); }
  100% { transform: rotateX(35deg) rotateY(55deg) rotateZ(360deg); }
}

/* Light Theme Layout Overrides */
.app[data-theme="light"] {
  background: var(--bg) !important;
}

.app[data-theme="light"] .sidebar {
  background: radial-gradient(circle at top left, #fbfbfd 0, #eaecf6 80%) !important;
  border-right: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.app[data-theme="light"] .main {
  background: radial-gradient(circle at top left, #f7f9fc 0, #edf0f8 65%) !important;
}

.app[data-theme="light"] .topbar {
  border-bottom: 1px solid rgba(0, 0, 0, 0.07) !important;
  background: rgba(255, 255, 255, 0.4) !important;
}

.app[data-theme="light"] .logo-btn {
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  background: rgba(255, 255, 255, 0.6) !important;
  color: var(--text) !important;
}

.app[data-theme="light"] .search input {
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  background: rgba(255, 255, 255, 0.8) !important;
  color: var(--text) !important;
}

/* Table dark mode overrides */
body:not([data-theme="light"]) #app-container table,
body:not([data-theme="light"]) #app-container thead,
body:not([data-theme="light"]) #app-container tr,
body:not([data-theme="light"]) #app-container th,
body:not([data-theme="light"]) #app-container td,
body:not([data-theme="light"]) .modal-card table,
body:not([data-theme="light"]) .modal-card thead,
body:not([data-theme="light"]) .modal-card tr,
body:not([data-theme="light"]) .modal-card th,
body:not([data-theme="light"]) .modal-card td {
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border-subtle) !important;
}

body:not([data-theme="light"]) #app-container tr:nth-child(even) td,
body:not([data-theme="light"]) #app-container thead tr th,
body:not([data-theme="light"]) .modal-card tr:nth-child(even) td,
body:not([data-theme="light"]) .modal-card thead tr th {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
}

body:not([data-theme="light"]) #app-container tr:hover td,
body:not([data-theme="light"]) .modal-card tr:hover td {
  background: var(--surface-softer) !important;
  background-color: var(--surface-softer) !important;
}

/* Status badge and priority overrides in dark mode */
body:not([data-theme="light"]) #app-container .bg-emerald-100,
body:not([data-theme="light"]) .modal-card .bg-emerald-100 {
  background-color: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
}

body:not([data-theme="light"]) #app-container .bg-amber-100,
body:not([data-theme="light"]) .modal-card .bg-amber-100 {
  background-color: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
}

/* Collapse toggle buttons and sparkline light theme overrides */
.app[data-theme="light"] .collapse-toggle-btn {
  background: var(--surface-soft) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text) !important;
  box-shadow: var(--shadow-subtle) !important;
}

.app[data-theme="light"] .collapse-toggle-btn:hover {
  background: var(--surface-softer) !important;
  border-color: var(--border-subtle) !important;
}

.app[data-theme="light"] .kpi-sparkline {
  background: var(--surface-soft) !important;
  border: 1px solid var(--border-subtle) !important;
}

.app[data-theme="light"] .kpi-sparkline::after {
  display: none !important;
}

/* Loader brand text color light mode override */
body[data-theme="light"] .loader-brand {
  color: #171823 !important;
}

/* SESI Table styles */
#table-sesi {
  table-layout: auto;
  width: max-content;
  min-width: 100%;
}
#table-sesi .table-sticky-col {
  box-shadow: 1px 0 0 rgba(231, 229, 228, 0.9), 10px 0 18px rgba(15, 23, 42, 0.03);
  background-color: #fff;
}
#table-sesi td,
#table-sesi th {
  min-width: 92px;
  white-space: normal;
  vertical-align: top;
  line-height: 1.35;
}
#table-sesi .sticky-id {
  min-width: 74px;
  background: linear-gradient(180deg, #ffffff, #fcfcfb);
}
#table-sesi .sticky-name {
  left: 74px;
  min-width: 220px;
  background: linear-gradient(180deg, #ffffff, #fcfcfb);
  white-space: nowrap;
}
#table-sesi .metric-head {
  min-width: 150px;
}
#table-sesi .metric-head-meta {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 500;
}
#table-sesi .metric-value-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
#table-sesi .metric-general-cell,
#table-sesi .metric-total-cell {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.98));
}
#table-sesi .metric-total-head,
#table-sesi .metric-total-cell {
  min-width: 160px;
}
body[data-theme="dark"] #table-sesi .table-sticky-col {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.96)) !important;
  box-shadow: 1px 0 0 rgba(71, 85, 105, 0.82), 10px 0 18px rgba(2, 6, 23, 0.22) !important;
}
body[data-theme="dark"] #table-sesi .sticky-id,
body[data-theme="dark"] #table-sesi .sticky-name {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.96)) !important;
  color: #f1f5f9 !important;
}
body[data-theme="dark"] #table-sesi .metric-general-cell,
body[data-theme="dark"] #table-sesi .metric-total-cell {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.9)) !important;
}

html.login-scroll-locked,
body.login-scroll-locked {
  overflow: hidden;
}

.mobile-menu-trigger,
.mobile-menu-close {
  display: none;
}

.grades-save-dock {
  position: sticky;
  top: 12px;
  z-index: 35;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 2px 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(22, 163, 74, 0.24);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(14px);
}

.grades-save-dock__info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.autosave-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #292524;
  font-size: 0.84rem;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.autosave-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.autosave-switch {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d6d3d1;
  box-shadow: inset 0 0 0 1px rgba(68, 64, 60, 0.12);
  transition: background-color 160ms ease, box-shadow 160ms ease;
}

.autosave-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.24);
  transition: transform 160ms ease;
}

.autosave-control input:checked + .autosave-switch {
  background: #16a34a;
  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.2), 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.autosave-control input:checked + .autosave-switch::after {
  transform: translateX(18px);
}

.autosave-control input:focus-visible + .autosave-switch {
  outline: 3px solid rgba(34, 197, 94, 0.3);
  outline-offset: 2px;
}

.autosave-control--profile {
  align-items: flex-start;
  width: 100%;
}

.grades-autosave-status {
  overflow: hidden;
  color: #78716c;
  font-size: 0.76rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grades-autosave-status.is-saving {
  color: #15803d;
  font-weight: 700;
}

body[data-theme="dark"] .grades-save-dock {
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(15, 23, 42, 0.92);
}

body[data-theme="dark"] .autosave-control {
  color: #f1f5f9;
}

body[data-theme="dark"] .grades-autosave-status {
  color: #cbd5e1;
}

@media (max-width: 720px) {
  .grades-save-dock {
    top: 8px;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .grades-save-dock__info {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .grades-save-dock #btn-save-grades {
    width: 100%;
  }

  .mobile-menu-trigger,
  .mobile-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #app-container.mobile-nav-open .sidebar {
    display: flex !important;
    position: fixed !important;
    inset: 0 auto 0 0;
    width: min(88vw, 320px) !important;
    z-index: 1001;
    box-shadow: 24px 0 60px rgba(15, 23, 42, 0.35);
  }

  #app-container.mobile-nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
  }
}

/* Admin modals live outside #app-container, so they must inherit the body theme. */
body.admin-page[data-theme="dark"] {
  --bg: #050609;
  --surface: #111219;
  --surface-soft: #181922;
  --surface-softer: #22242f;
  --border-subtle: #353846;
  --border: var(--border-subtle);
  --text: #f5f5f8;
  --text-muted: #b1b4c2;
  --muted: var(--text-muted);
}

body.admin-page .modal {
  background: rgba(3, 5, 10, 0.7);
  backdrop-filter: blur(3px);
}

body.admin-page[data-theme="light"] .modal {
  background: rgba(15, 23, 42, 0.42);
}

body.admin-page .modal-card {
  background: var(--surface) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text) !important;
}

body.admin-page .modal-card .bg-white,
body.admin-page .modal-card .bg-stone-50,
body.admin-page .modal-card .bg-stone-50\/70,
body.admin-page .modal-card .bg-stone-100 {
  background: var(--surface-soft) !important;
  background-color: var(--surface-soft) !important;
  color: var(--text) !important;
  border-color: var(--border-subtle) !important;
}

body.admin-page .modal-card .border-stone-100,
body.admin-page .modal-card .border-stone-200,
body.admin-page .modal-card .border-stone-300 {
  border-color: var(--border-subtle) !important;
}

body.admin-page .modal-card h2,
body.admin-page .modal-card h3,
body.admin-page .modal-card h4,
body.admin-page .modal-card .text-stone-900,
body.admin-page .modal-card .text-stone-800,
body.admin-page .modal-card .text-stone-700,
body.admin-page .modal-card label,
body.admin-page .modal-card label span {
  color: var(--text) !important;
}

body.admin-page .modal-card p,
body.admin-page .modal-card .text-stone-600,
body.admin-page .modal-card .text-stone-500,
body.admin-page .modal-card .text-stone-400 {
  color: var(--text-muted) !important;
}

body.admin-page .modal-card input,
body.admin-page .modal-card select,
body.admin-page .modal-card textarea {
  background: var(--surface-soft) !important;
  border-color: var(--border-subtle) !important;
  color: var(--text) !important;
}

body.admin-page .modal-card option {
  background: var(--surface) !important;
  color: var(--text) !important;
}

body.admin-page .modal-card input:disabled,
body.admin-page .modal-card select:disabled,
body.admin-page .modal-card textarea:disabled {
  background: var(--surface-softer) !important;
  color: var(--text-muted) !important;
  opacity: 0.78 !important;
}

body.admin-page .modal-card button[data-close-modal]:not(.bg-stone-200) {
  color: var(--text-muted) !important;
}

body.admin-page .modal-card button[data-close-modal]:not(.bg-stone-200):hover {
  background: var(--surface-softer) !important;
  color: var(--text) !important;
}

body.admin-page .modal-footer-sticky {
  background: var(--surface) !important;
  border-color: var(--border-subtle) !important;
}

body.admin-page[data-theme="dark"] .modal-card .bg-green-50 {
  background: rgba(34, 197, 94, 0.14) !important;
  border-color: rgba(74, 222, 128, 0.48) !important;
}

body.admin-page[data-theme="dark"] .modal-card .text-green-900,
body.admin-page[data-theme="dark"] .modal-card .text-green-800,
body.admin-page[data-theme="dark"] .modal-card .text-green-700 {
  color: #bbf7d0 !important;
}

body.admin-page[data-theme="dark"] .modal-card .bg-amber-50 {
  background: rgba(245, 158, 11, 0.14) !important;
  border-color: rgba(251, 191, 36, 0.45) !important;
}

body.admin-page[data-theme="dark"] .modal-card .text-amber-900,
body.admin-page[data-theme="dark"] .modal-card .text-amber-800 {
  color: #fde68a !important;
}

body.admin-page[data-theme="dark"] .modal-card .bg-red-50 {
  background: rgba(239, 68, 68, 0.14) !important;
  border-color: rgba(248, 113, 113, 0.45) !important;
}

body.admin-page[data-theme="dark"] .modal-card .text-red-700 {
  color: #fecaca !important;
}

body.admin-page[data-theme="dark"] .modal-card .bg-stone-900 {
  background: var(--surface-softer) !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text) !important;
}
