:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-strong: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --sidebar-width: 290px;
  --content-width: 1440px;
}

[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #111827;
  --surface-soft: #1f2937;
  --surface-strong: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
}

body.is-loading {
  cursor: progress;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: none;
}

h1,
.h1,
h2,
.h2,
h3,
.h3,
h4,
.h4,
h5,
.h5,
h6,
.h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

small,
.muted,
.text-muted,
.panel-muted {
  color: var(--muted);
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.9em;
}

.eyebrow,
.panel-tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ok {
  color: var(--success);
}

.warn {
  color: var(--warning);
}

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.flash-success {
  border-color: color-mix(in srgb, var(--success) 22%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}

.flash-error {
  border-color: color-mix(in srgb, var(--danger) 20%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.flash-warning {
  border-color: color-mix(in srgb, var(--warning) 20%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.btn,
.primary-button,
.ghost-button,
.danger-button,
.logout-button,
.nav-button,
.quick-link,
.text-link,
.inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.btn:disabled,
.primary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled,
.logout-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-primary,
.primary-button {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover,
.primary-button:hover,
.btn-primary:focus-visible,
.primary-button:focus-visible {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-secondary,
.ghost-button,
.quick-link,
.inline-link,
.nav-button,
.btn-soft {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover,
.ghost-button:hover,
.quick-link:hover,
.inline-link:hover,
.nav-button:hover,
.btn-soft:hover,
.btn-secondary:focus-visible,
.ghost-button:focus-visible,
.nav-button:focus-visible {
  background: var(--surface-soft);
  border-color: color-mix(in srgb, var(--primary) 24%, var(--border));
}

.btn-danger,
.danger-button,
.logout-button {
  background: var(--danger);
  color: #ffffff;
  border-color: var(--danger);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  border-color: var(--success);
}

.btn-danger:hover,
.danger-button:hover,
.logout-button:hover,
.btn-danger:focus-visible,
.danger-button:focus-visible,
.logout-button:focus-visible {
  background: color-mix(in srgb, var(--danger) 88%, black);
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  min-height: 46px;
  padding: 0 14px;
  font-weight: 600;
}

.nav-button.is-active {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 24%, var(--border));
}

.card,
.panel,
.module-card,
.stat-box,
.auth-panel,
.status-card,
.hero-card,
.auth-card,
.mini-card,
.compact-item,
.preset-card,
.template-item,
.hint-card,
.user-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card,
.panel,
.module-card,
.auth-panel,
.mini-card,
.compact-item,
.preset-card,
.hint-card,
.user-card {
  padding: 20px;
}

.hero-panel,
.info-panel,
.auth-panel-brand,
.auth-panel-form,
.hero-card,
.status-card {
  background: var(--surface);
}

.module-card h2,
.module-card h3,
.panel h2,
.panel h3,
.card h2,
.card h3,
.auth-panel h2 {
  margin-top: 12px;
}

.section-head,
.metric-line,
.calendar-toolbar,
.app-topbar,
.site-header,
.topbar-actions,
.login-footer,
.auth-actions,
.auth-actions-stacked,
.hero-actions,
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-head,
.metric-line,
.calendar-toolbar,
.app-topbar,
.site-header,
.login-footer,
.auth-actions,
.hero-actions,
.actions {
  justify-content: space-between;
}

.stack,
.form-stack,
.list-stack,
.compact-list,
.feature-list,
.steps,
.metric-stack,
.quick-links {
  display: grid;
  gap: 14px;
}

.grid,
.module-grid,
.hero-grid,
.stats-grid-dashboard,
.cards-grid,
.form-grid,
.quick-links,
.auth-shell {
  display: grid;
  gap: 20px;
}

.two-up,
.hero-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid-dashboard {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cards-grid,
.grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.two-columns,
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-wide {
  grid-column: span 2;
}

.stat-box {
  padding: 18px;
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-box strong {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
}

.metric-stack div,
.list-row,
.compact-item,
.preset-card,
.template-item,
.list-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 14px 16px;
}

.metric-stack small,
.list-row span,
.list-item span,
.preset-card span,
.template-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.template-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
}

.compact-head {
  margin-bottom: 14px;
}

.ficha-filter-card {
  margin-bottom: 0;
}

.premium-enrollment-form {
  display: grid;
  gap: 20px;
}

.ficha-premium-card,
.ficha-family-card,
.ficha-extra-card,
.ficha-actions-card {
  padding: 24px;
}

.ficha-premium-grid {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.ficha-photo-column {
  display: grid;
  gap: 14px;
}

.student-photo-frame {
  display: grid;
  justify-content: center;
}

.student-photo {
  width: 120px;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  border: 3px solid var(--surface);
  background: var(--surface-soft);
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.06);
}

.student-photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.photo-upload-action {
  gap: 8px;
}

.photo-upload-action span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.photo-upload-action input[type="file"] {
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
}

.ficha-main-column {
  display: grid;
  gap: 18px;
}

.student-summary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 18px;
}

.student-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.student-summary-name {
  display: block;
  font-size: 1.35rem;
  line-height: 1.15;
}

.student-summary-meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.student-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.student-summary-grid small {
  display: block;
  color: var(--muted);
}

.student-summary-grid strong {
  display: block;
  margin-top: 6px;
}

.ficha-main-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.family-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.family-column {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 18px;
}

.family-column h4 {
  margin: 0 0 14px;
  font-size: 1rem;
}

.family-column-wide {
  grid-column: span 2;
}

.ficha-actions-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.feature-list,
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feature-list li,
.steps li {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.feature-list li:first-child,
.steps li:first-child {
  border-top: 0;
  padding-top: 0;
}

.status-badge,
.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-pill[data-theme="success"] {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 30%, var(--border));
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}

.status-pill[data-theme="warning"] {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 30%, var(--border));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.status-pill[data-theme="danger"] {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
}

.status-pill[data-theme="info"] {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 26%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
}

input,
select,
textarea,
.input,
.auth-panel-form input,
.auth-panel-form select,
.auth-panel-form textarea,
.global-search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
textarea:focus,
.input:focus,
.global-search input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.table,
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  overflow-x: auto;
}

.table th,
.table td,
.data-table th,
.data-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table th,
.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--surface-soft);
}

.table tr:hover td,
.data-table tr:hover td {
  background: color-mix(in srgb, var(--surface-soft) 65%, transparent);
}

.table-actions {
  width: 1%;
  white-space: nowrap;
}

.table-avatar,
.avatar-fallback {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.table-avatar {
  object-fit: cover;
}

.avatar-fallback {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.app-sidebar,
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-top,
.sidebar-bottom,
.sidebar-nav {
  display: grid;
  gap: 16px;
}

.sidebar-branding {
  display: grid;
  gap: 14px;
}

.brand,
.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand strong,
.brand-copy strong {
  font-size: 1.1rem;
}

.brand small,
.brand-copy small {
  color: var(--muted);
}

.brand-logo,
.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--primary);
  font-weight: 700;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 15px;
}

.user-card strong {
  display: block;
}

.user-card span,
.user-card small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.app-main {
  padding: 24px;
  width: min(100%, var(--content-width));
}

.app-topbar,
.topbar {
  margin-bottom: 20px;
}

.page-title {
  margin-top: 8px;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.topbar-copy {
  min-width: 0;
}

.topbar-actions {
  justify-content: flex-end;
}

.topbar-user {
  display: grid;
  gap: 4px;
  min-width: 180px;
  padding: 12px 14px;
}

.topbar-user span {
  color: var(--muted);
  font-size: 0.9rem;
}

.global-search {
  position: relative;
  width: min(360px, 100%);
}

.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.search-group {
  display: grid;
  gap: 8px;
}

.search-group strong {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.search-item:hover,
.search-item:focus-visible {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--primary) 22%, var(--border));
}

.search-item span,
.search-empty {
  color: var(--muted);
}

.app-content {
  display: grid;
  gap: 20px;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--primary) 18%, transparent);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

.auth-shell {
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  align-items: stretch;
  padding: 24px;
}

.auth-panel {
  min-height: 100%;
}

.auth-panel-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-panel-brand h1 {
  margin-top: 14px;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1.08;
}

.auth-panel-brand p {
  margin-top: 16px;
  max-width: 44rem;
  color: var(--muted);
}

.auth-copy,
.auth-copy-centered {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-view {
  display: grid;
  gap: 18px;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-login-card,
.login-form,
.login-footer,
.login-hint,
.login-avatar,
.login-check,
.auth-text-link,
.login-orb {
  position: relative;
}

.login-avatar,
.login-orb {
  display: none;
}

.login-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.login-check input {
  width: 16px;
  min-height: 16px;
  height: 16px;
}

.auth-text-link {
  color: var(--primary);
  font-weight: 600;
}

.site-shell {
  width: min(100% - 32px, var(--content-width));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.site-header,
.site-main {
  width: 100%;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.header-row span {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.calendar-cell {
  min-height: 108px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.calendar-cell.is-today {
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
}

.calendar-cell.is-blank {
  background: transparent;
}

.calendar-event {
  display: block;
  padding: 5px 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
}

.empty-state {
  display: grid;
  gap: 10px;
  padding: 12px 0;
}

.fade-enter {
  opacity: 0;
  transform: translateY(6px);
}

.fade-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar,
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .auth-shell,
  .hero-grid,
  .two-up,
  .cards-grid,
  .grid,
  .stats-grid-dashboard,
  .form-grid,
  .two-columns,
  .ficha-premium-grid,
  .ficha-main-fields,
  .family-grid {
    grid-template-columns: 1fr;
  }

  .panel-wide {
    grid-column: span 1;
  }

  .family-column-wide {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .app-main,
  .app-sidebar,
  .auth-shell,
  .site-shell {
    padding: 16px;
  }

  .card,
  .panel,
  .module-card,
  .auth-panel,
  .mini-card,
  .compact-item,
  .preset-card,
  .hint-card,
  .user-card {
    padding: 16px;
  }

  .app-topbar,
  .topbar-actions,
  .calendar-toolbar,
  .section-head,
  .metric-line,
  .template-item,
  .hero-actions,
  .actions,
  .login-footer,
  .auth-actions,
  .auth-links {
    flex-direction: column;
    align-items: stretch;
  }

  .global-search {
    width: 100%;
  }

  .calendar-cell {
    min-height: 84px;
    padding: 10px;
  }
}
/* Premium fine tuning overrides */
.app-sidebar {
  background: var(--surface-soft) !important;
  border-right: 1px solid var(--border) !important;
}

.app-sidebar .institution-panel,
.app-sidebar .user-panel {
  background: rgba(255, 255, 255, 0.58) !important;
}

[data-theme="dark"] .app-sidebar .institution-panel,
[data-theme="dark"] .app-sidebar .user-panel {
  background: rgba(15, 23, 42, 0.36) !important;
}

.nav-button {
  font-size: 0.93rem !important;
  letter-spacing: 0.01em;
  padding: 0.78rem 0.92rem !important;
}

.nav-button span:last-child {
  line-height: 1.2;
}

.global-search {
  position: relative;
  max-width: 420px;
}

.global-search input,
#global-search-input {
  padding-left: 2.65rem !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.95rem center;
  background-size: 1rem;
}

#page-loading-indicator {
  font-size: 0 !important;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

#page-loading-indicator::after {
  content: "";
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 999px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#page-loading-indicator.is-visible::after {
  opacity: 1;
  transform: scale(1);
  animation: premium-spin 0.7s linear infinite;
}

@keyframes premium-spin {
  to {
    transform: rotate(360deg);
  }
}

.dashboard-card {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  padding: 24px !important;
  box-shadow:
    0 10px 25px rgba(15, 23, 42, 0.08),
    0 2px 8px rgba(15, 23, 42, 0.04) !important;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 18px 35px rgba(15, 23, 42, 0.12),
    0 6px 14px rgba(15, 23, 42, 0.06) !important;
}

.dashboard-premium-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.dashboard-metric {
  display: block;
  margin: 1rem 0 0.5rem;
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1;
  color: var(--text);
}

.dashboard-metric-date {
  font-size: 1.25rem;
  line-height: 1.25;
}

.dashboard-alerts-card {
  margin-top: 1rem;
}

.dashboard-alerts-list {
  display: grid;
  gap: 0.85rem;
}

.dashboard-alert-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  background: var(--surface-soft);
}

.dashboard-alert-item strong {
  display: block;
  margin-bottom: 0.35rem;
}

.dashboard-alert-item p {
  margin: 0;
  color: var(--muted);
}

.student-profile-highlight {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.student-profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.students-table-card .table-subtitle {
  color: var(--muted);
  font-size: 0.84rem;
  margin-top: 0.3rem;
}

.students-table-card .table-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.4rem;
}

.student-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 80;
}

.student-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.student-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(5px);
}

.student-modal {
  position: relative;
  width: min(1120px, 100%);
  max-height: calc(100vh - 4rem);
  overflow: hidden;
  border-radius: 26px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow:
    0 30px 80px rgba(15, 23, 42, 0.16),
    0 10px 30px rgba(15, 23, 42, 0.08);
  transform: translateY(18px) scale(0.985);
  transition: transform 0.24s ease;
}

.student-modal-overlay.is-open .student-modal {
  transform: translateY(0) scale(1);
}

.student-modal-header,
.student-modal-footer {
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-soft));
}

.student-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.student-modal-header h2 {
  margin: 0.3rem 0;
  font-size: 1.45rem;
}

.student-modal-header p {
  margin: 0;
  color: var(--muted);
}

.student-modal-close {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
}

.student-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1.2rem 1.75rem 0;
}

.student-step {
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.student-step.is-active {
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--primary) 40%, var(--border));
  color: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
}

.student-step.is-complete {
  color: var(--text);
  border-color: color-mix(in srgb, var(--primary) 28%, var(--border));
}

.student-modal-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.student-modal-body {
  padding: 1.5rem 1.75rem 0;
  overflow: auto;
}

.student-step-panel {
  display: none;
}

.student-step-panel.is-active {
  display: block;
  animation: premium-fade-up 0.2s ease;
}

@keyframes premium-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.student-stage-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.student-stage-top {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
  margin-bottom: 1.4rem;
}

.student-stage-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.student-additional-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.student-additional-grid .field-full {
  grid-column: 1 / -1;
}

.student-summary-card {
  padding: 1.1rem 1.15rem;
  border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, var(--surface-soft)), var(--surface-soft));
  border: 1px solid var(--border);
}

.student-summary-name {
  font-size: 1.3rem;
  line-height: 1.2;
}

.student-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1rem;
  margin-top: 1rem;
}

.student-summary-grid span,
.student-review-grid span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.28rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.student-summary-grid strong,
.student-review-grid strong {
  display: block;
  color: var(--text);
  line-height: 1.35;
}

.family-column h4 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.field-help {
  color: var(--muted);
  font-size: 0.84rem;
  margin: 0.1rem 0 0;
}

.input-textarea {
  min-height: 118px;
  resize: vertical;
}

.student-review-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, var(--surface-soft)), var(--surface));
}

.student-review-layout {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.student-review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.student-modal-footer {
  margin-top: 1.35rem;
  border-top: 1px solid var(--border);
  border-bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.student-modal-footer-left,
.student-modal-footer-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.is-hidden {
  display: none !important;
}

body.has-student-modal-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .dashboard-premium-grid {
    grid-template-columns: 1fr;
  }

  .student-modal-overlay {
    padding: 1rem;
  }

  .student-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-stage-top,
  .student-review-layout,
  .student-stage-fields,
  .student-additional-grid,
  .student-review-grid {
    grid-template-columns: 1fr;
  }

  .student-modal {
    max-height: calc(100vh - 2rem);
  }
}

@media (max-width: 720px) {
  .student-modal-header,
  .student-modal-body,
  .student-modal-footer,
  .student-stepper {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .student-modal-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .student-modal-footer-left,
  .student-modal-footer-right {
    width: 100%;
    justify-content: stretch;
  }

  .student-modal-footer-right .btn,
  .student-modal-footer-left .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
}

/* Critical premium corrections */
.app-sidebar {
  background: #e2e8f0 !important;
}

.sidebar-branding {
  display: grid;
  gap: 1rem;
}

.brand-logo {
  width: 76px;
  height: 76px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.nav-button {
  font-size: 0.9rem !important;
  min-height: 42px !important;
  padding: 0 12px !important;
}

.sidebar .nav-button,
.sidebar .menu-item {
  font-size: 14px !important;
}

.global-search {
  width: min(380px, 100%);
}

.topbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.app-topbar {
  justify-content: flex-end !important;
}

.topbar-search {
  position: relative;
  width: 260px;
}

.topbar-search input {
  width: 100%;
  padding: 10px 12px 10px 36px !important;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  outline: none;
}

.topbar-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions button {
  padding: 8px 12px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid var(--border);
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #ef4444;
  color: #ffffff;
  border: 1px solid #ef4444;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #cbd5f5;
  color: #1e3a8a;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.topbar-user {
  min-width: 120px;
  padding: 0.75rem 1rem !important;
}

.global-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 20;
}

.dashboard-premium-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 860px;
}

.dashboard-card-gradient {
  background: linear-gradient(135deg, #2563eb, #3b82f6) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
  border-color: transparent !important;
}

[data-theme="dark"] .dashboard-card-gradient {
  background: linear-gradient(135deg, #2563eb, #3b82f6) !important;
}

.dashboard-card-gradient h2,
.dashboard-card-gradient .dashboard-metric,
.dashboard-card-gradient .eyebrow {
  color: #ffffff !important;
}

.dashboard-card-gradient .eyebrow {
  background: rgba(255, 255, 255, 0.16) !important;
}

.dashboard-clean {
  display: grid;
  gap: 1rem;
}

.settings-shell,
.settings-form,
.settings-grid {
  display: grid;
  gap: 1rem;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-section {
  padding: 1.4rem;
}

.settings-section-wide {
  grid-column: 1 / -1;
}

.settings-branding {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.settings-logo-preview {
  width: 120px;
  height: 120px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.settings-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-fields-stack,
.settings-actions {
  display: grid;
  gap: 1rem;
}

.settings-theme-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.student-photo-shell {
  width: 120px;
  min-height: 160px;
}

.student-photo {
  width: 120px !important;
  height: 160px !important;
  object-fit: cover !important;
  border-radius: 10px !important;
  border: 3px solid var(--surface) !important;
  box-shadow:
    0 10px 20px rgba(0, 0, 0, 0.08),
    0 2px 6px rgba(0, 0, 0, 0.06) !important;
}

.student-photo-placeholder {
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--muted);
}

.student-modal {
  width: min(1080px, 100%) !important;
  background: var(--surface) !important;
}

.student-step-panel {
  visibility: hidden;
  height: 0;
  overflow: hidden;
}

.student-step-panel.is-active {
  visibility: visible;
  height: auto;
  overflow: visible;
}

.student-modal-header,
.student-modal-footer {
  background: var(--surface) !important;
}

.student-summary-card,
.student-review-card {
  background: var(--surface-soft) !important;
}

.family-grid-single {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.btn-primary {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

.btn-success {
  background: #16a34a !important;
  border-color: #16a34a !important;
}

.btn-danger {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

.btn-secondary {
  background: #e5e7eb !important;
  border-color: #d1d5db !important;
  color: #111827 !important;
}

@media (max-width: 900px) {
  .settings-grid,
  .dashboard-premium-grid-two,
  .settings-branding,
  .family-grid-single {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 12px 14px;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* Reference alignment: sidebar + enrollment modal */
.app-shell {
  gap: 0;
}

.sidebar-branding {
  gap: 1rem !important;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.brand-copy strong {
  font-size: 1.05rem;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.82rem;
}

.sidebar-nav {
  display: grid;
  gap: 0.35rem;
}

.nav-button {
  gap: 0.7rem !important;
  background: transparent !important;
  border-color: transparent !important;
  border-radius: 12px !important;
  font-weight: 500 !important;
  color: #334155 !important;
}

.nav-button .nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  opacity: 0.88;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
}

.nav-button[data-nav-icon="home"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 10.5 12 3l9 7.5'/%3E%3Cpath d='M5 9.5V21h14V9.5'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="students"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='8.5' cy='7' r='4'/%3E%3Cpath d='M20 8v6'/%3E%3Cpath d='M23 11h-6'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="classes"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 7 8-4 8 4-8 4-8-4Z'/%3E%3Cpath d='m4 12 8 4 8-4'/%3E%3Cpath d='m4 17 8 4 8-4'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="finance"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M14.8 9.2A2.8 2.8 0 0 0 12 8a2.5 2.5 0 0 0 0 5 2.5 2.5 0 0 1 0 5 2.8 2.8 0 0 1-2.8-1.2'/%3E%3Cpath d='M12 6v12'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="calendar"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="grades"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5A2.5 2.5 0 0 1 6.5 17H20'/%3E%3Cpath d='M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2Z'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="attendance"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3Cpath d='m8 16 2 2 5-5'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="docs"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 2v6h6'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="certificate"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Ccircle cx='10' cy='14' r='2'/%3E%3Cpath d='m8.5 16 0 4 1.5-1 1.5 1 0-4'/%3E%3C/svg%3E"); }
.nav-button[data-nav-icon="settings"] .nav-icon,
.nav-button[data-nav-icon="master"] .nav-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23556981' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 2v4'/%3E%3Cpath d='M12 18v4'/%3E%3Cpath d='m4.93 4.93 2.83 2.83'/%3E%3Cpath d='m16.24 16.24 2.83 2.83'/%3E%3Cpath d='M2 12h4'/%3E%3Cpath d='M18 12h4'/%3E%3Cpath d='m4.93 19.07 2.83-2.83'/%3E%3Cpath d='m16.24 7.76 2.83-2.83'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }

.nav-button.is-active {
  background: linear-gradient(135deg, #15979d, #2ca6a9) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 20px rgba(14, 165, 164, 0.18);
}

.nav-button.is-active .nav-icon {
  filter: brightness(0) invert(1);
}

.student-stepper {
  position: relative;
  padding-top: 1.45rem !important;
  padding-bottom: 0.4rem !important;
}

.student-stepper::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 2.1rem;
  height: 1px;
  background: var(--border);
}

.student-step {
  position: relative;
  z-index: 1;
  display: grid !important;
  justify-items: center;
  gap: 0.45rem;
  background: transparent !important;
  border: 0 !important;
  padding: 0 0 0.85rem !important;
  font-size: 0.88rem !important;
  font-weight: 600 !important;
}

.student-step::before {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
}

.student-step[data-step-marker="0"]::before { content: "1"; }
.student-step[data-step-marker="1"]::before { content: "2"; }
.student-step[data-step-marker="2"]::before { content: "3"; }
.student-step[data-step-marker="3"]::before { content: "4"; }

.student-step.is-active {
  color: #0f172a !important;
}

.student-step.is-active::before {
  background: #15979d;
  border-color: #15979d;
  color: #ffffff;
}

.student-step.is-complete::before {
  border-color: #15979d;
  color: #15979d;
}

.student-stage-card {
  padding: 1.45rem !important;
  border-radius: 18px !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04) !important;
}

.student-stage-top {
  grid-template-columns: 126px minmax(0, 1fr) !important;
  gap: 1.3rem !important;
  margin-bottom: 1.65rem !important;
}

.student-stage-heading {
  margin-bottom: 1rem;
}

.student-stage-heading h3 {
  font-size: 1.06rem;
  font-weight: 700;
  color: #0f172a;
}

.student-summary-card {
  border-radius: 16px !important;
  min-height: 132px;
  display: grid;
  align-content: start;
  background: #ffffff !important;
  padding: 1rem 1.1rem !important;
  box-shadow: none !important;
}

.student-summary-name {
  font-size: 1.15rem !important;
  margin-top: 0.45rem;
}

.student-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  margin-top: 0.95rem !important;
}

.student-summary-grid span,
.student-review-grid span {
  font-size: 0.76rem !important;
  letter-spacing: 0.03em !important;
}

.student-summary-grid strong,
.student-review-grid strong {
  font-size: 0.98rem;
}

.photo-upload-action {
  width: 120px;
  margin-top: 0.7rem;
  min-height: 38px !important;
  border-radius: 10px !important;
}

.photo-upload-action span {
  width: 100%;
  min-height: 38px !important;
  border-radius: 10px !important;
  background: #ffffff !important;
}

.student-review-grid > div {
  padding: 0.7rem 0.8rem;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
}

.student-modal {
  border-radius: 20px !important;
}

.student-modal-header {
  padding: 1.35rem 1.55rem !important;
}

.student-modal-header h2 {
  font-size: 1.9rem !important;
  font-weight: 700 !important;
  color: #1e293b !important;
}

.student-modal-header p {
  color: #64748b !important;
  margin-top: 0.25rem !important;
}

.student-modal-close {
  border: 0 !important;
  background: transparent !important;
  font-size: 1.6rem !important;
  color: #64748b !important;
  width: 2rem !important;
  height: 2rem !important;
}

.student-modal-body {
  padding-top: 1.15rem !important;
}

.student-stage-fields label span,
.family-grid-single label span,
.student-additional-grid label span {
  display: inline-block;
  margin-bottom: 0.38rem;
  font-size: 0.9rem;
  color: #475569;
}

.student-stage-fields .input,
.family-grid-single .input,
.student-additional-grid .input {
  min-height: 50px;
  border-radius: 10px !important;
  background: #ffffff !important;
}

.student-additional-grid .input-textarea {
  min-height: 120px;
}

.student-modal-footer {
  padding: 1rem 1.55rem 1.35rem !important;
}

.student-modal-footer .btn {
  min-width: 120px;
  border-radius: 10px !important;
}

.student-modal-footer .btn-secondary {
  background: #f8fafc !important;
}

.student-modal-footer .btn-primary {
  background: #15979d !important;
  border-color: #15979d !important;
}

.student-modal-footer .btn-primary:hover {
  background: #127f84 !important;
  border-color: #127f84 !important;
}

.matricula-shell .students-table-card {
  border-radius: 18px !important;
}

[data-theme="dark"] .nav-button {
  color: #cbd5e1 !important;
}

[data-theme="dark"] .student-summary-card,
[data-theme="dark"] .student-review-grid > div,
[data-theme="dark"] .photo-upload-action span,
[data-theme="dark"] .student-stage-fields .input,
[data-theme="dark"] .family-grid-single .input,
[data-theme="dark"] .student-additional-grid .input {
  background: #0f172a !important;
}

@media (max-width: 900px) {
  .student-summary-grid {
    grid-template-columns: 1fr !important;
  }

  .student-stage-top {
    grid-template-columns: 1fr !important;
  }

  .student-photo-column {
    display: grid;
    justify-content: start;
  }
}

/* Critical fixes: search, dashboard cards, modal scroll */
[hidden] {
  display: none !important;
}

.topbar-search .global-search-results[hidden],
#global-search-results[hidden] {
  display: none !important;
}

.dashboard-card.dashboard-card-gradient {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  color: #ffffff !important;
  border: 0 !important;
  box-shadow:
    0 14px 30px rgba(37, 99, 235, 0.22),
    0 6px 12px rgba(37, 99, 235, 0.12) !important;
  transform: translateY(0);
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    filter 0.22s ease !important;
}

.dashboard-card.dashboard-card-gradient:hover {
  transform: translateY(-6px);
  filter: saturate(1.04);
  box-shadow:
    0 20px 36px rgba(37, 99, 235, 0.26),
    0 8px 16px rgba(37, 99, 235, 0.14) !important;
}

.dashboard-card.dashboard-card-gradient:nth-child(2) {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%) !important;
  box-shadow:
    0 14px 30px rgba(99, 102, 241, 0.22),
    0 6px 12px rgba(99, 102, 241, 0.12) !important;
}

.dashboard-card.dashboard-card-gradient:nth-child(2):hover {
  box-shadow:
    0 20px 36px rgba(99, 102, 241, 0.26),
    0 8px 16px rgba(99, 102, 241, 0.14) !important;
}

.student-modal {
  display: flex !important;
  flex-direction: column !important;
  max-height: calc(100vh - 2.5rem) !important;
  overflow: hidden !important;
}

.student-modal-form {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.student-modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-bottom: 1rem !important;
}

.student-modal-footer {
  flex: 0 0 auto !important;
}

/* Final polish fixes */
.dashboard-only-cards {
  padding-top: 0.25rem;
}

.dashboard-only-cards .dashboard-premium-grid-two {
  max-width: 920px;
  align-items: stretch;
}

.dashboard-card.dashboard-card-gradient {
  min-height: 146px;
  border-radius: 22px !important;
  padding: 28px !important;
  color: #ffffff !important;
  border: 0 !important;
  transform: translateY(0);
  transition:
    transform 0.24s ease,
    box-shadow 0.24s ease,
    filter 0.24s ease !important;
}

.dashboard-card.dashboard-card-gradient p,
.dashboard-card.dashboard-card-gradient h2,
.dashboard-card.dashboard-card-gradient strong,
.dashboard-card.dashboard-card-gradient span {
  color: #ffffff !important;
}

.dashboard-card-students {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  box-shadow:
    0 16px 34px rgba(37, 99, 235, 0.24),
    0 6px 14px rgba(37, 99, 235, 0.12) !important;
}

.dashboard-card-classes {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%) !important;
  box-shadow:
    0 16px 34px rgba(99, 102, 241, 0.22),
    0 6px 14px rgba(99, 102, 241, 0.12) !important;
}

.dashboard-card.dashboard-card-gradient:hover {
  transform: translateY(-6px);
}

.dashboard-card-students:hover {
  box-shadow:
    0 22px 42px rgba(37, 99, 235, 0.28),
    0 10px 18px rgba(37, 99, 235, 0.14) !important;
}

.dashboard-card-classes:hover {
  box-shadow:
    0 22px 42px rgba(99, 102, 241, 0.28),
    0 10px 18px rgba(99, 102, 241, 0.14) !important;
}

.dashboard-card.dashboard-card-gradient .eyebrow {
  background: rgba(255, 255, 255, 0.14) !important;
}

.dashboard-card.dashboard-card-gradient p {
  margin-top: 0.35rem;
  opacity: 0.92;
}

#app-content .global-search,
#app-content .topbar-search,
#app-content #global-search-input,
#app-content .global-search-results,
.dashboard-clean .global-search,
.dashboard-clean .topbar-search {
  display: none !important;
}

.topbar .global-search-results[hidden],
.topbar-search .global-search-results[hidden],
#global-search-results[hidden] {
  display: none !important;
}

.student-modal-overlay {
  align-items: flex-start !important;
  overflow-y: auto !important;
  padding-top: 1.25rem !important;
  padding-bottom: 1.25rem !important;
}

.student-modal {
  margin: auto !important;
  height: auto !important;
  max-height: none !important;
}

.student-modal-form {
  overflow: visible !important;
}

.student-modal-body {
  overflow-y: visible !important;
  max-height: none !important;
}

/* Canonical conflict-safe layer */
.app-sidebar.sidebar {
  background: #e2e8f0 !important;
  border-right: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.35);
}

.app-topbar.topbar {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  min-height: 72px;
  background: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
}

.topbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.topbar-search.global-search {
  position: relative !important;
  width: 260px !important;
  max-width: 260px !important;
}

.topbar-search.global-search > input,
.topbar-search.global-search > .input,
#global-search-input {
  width: 100% !important;
  min-height: 42px !important;
  padding: 10px 12px 10px 36px !important;
  border-radius: 10px !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  box-shadow: none !important;
}

.topbar .global-search-results {
  top: calc(100% + 8px) !important;
  left: 0 !important;
  right: 0 !important;
}

.topbar .global-search-results[hidden],
#global-search-results[hidden] {
  display: none !important;
}

.dashboard-clean,
.dashboard-only-cards {
  display: grid !important;
  gap: 1rem !important;
}

.dashboard-premium-grid.dashboard-premium-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  max-width: 920px !important;
  gap: 1rem !important;
}

.dashboard-card.dashboard-card-gradient {
  min-height: 152px !important;
  border-radius: 22px !important;
  padding: 28px !important;
  border: 0 !important;
  color: #ffffff !important;
  transform: translateY(0) !important;
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    filter 0.22s ease !important;
}

.dashboard-card.dashboard-card-gradient .eyebrow {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

.dashboard-card.dashboard-card-gradient h2,
.dashboard-card.dashboard-card-gradient strong,
.dashboard-card.dashboard-card-gradient p {
  color: #ffffff !important;
}

.dashboard-card.dashboard-card-gradient:hover {
  transform: translateY(-6px) !important;
}

.dashboard-card-students {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  box-shadow:
    0 16px 34px rgba(37, 99, 235, 0.24),
    0 6px 14px rgba(37, 99, 235, 0.12) !important;
}

.dashboard-card-students:hover {
  box-shadow:
    0 22px 42px rgba(37, 99, 235, 0.28),
    0 10px 18px rgba(37, 99, 235, 0.14) !important;
}

.dashboard-card-classes {
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%) !important;
  box-shadow:
    0 16px 34px rgba(99, 102, 241, 0.22),
    0 6px 14px rgba(99, 102, 241, 0.12) !important;
}

.dashboard-card-classes:hover {
  box-shadow:
    0 22px 42px rgba(99, 102, 241, 0.28),
    0 10px 18px rgba(99, 102, 241, 0.14) !important;
}

.student-modal-overlay {
  position: fixed !important;
  inset: 0 !important;
  display: flex !important;
  align-items: flex-start !important;
  justify-content: center !important;
  overflow-y: auto !important;
  padding: 1.25rem !important;
}

.student-modal {
  width: min(1080px, 100%) !important;
  max-height: none !important;
  height: auto !important;
  margin: auto !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

.student-modal-form {
  display: flex !important;
  flex-direction: column !important;
  overflow: visible !important;
}

.student-modal-body {
  overflow: visible !important;
  max-height: none !important;
  min-height: auto !important;
}

@media (max-width: 900px) {
  .dashboard-premium-grid.dashboard-premium-grid-two {
    grid-template-columns: 1fr !important;
  }

  .topbar-actions {
    width: 100% !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
  }

  .topbar-search.global-search {
    width: min(260px, 100%) !important;
  }
}
