/* School Master — UI/UX Final Polish v2 / Batch 2
   Route-scoped refinements for the most-used ERP workflows only.
   No public marketing, print-document geometry, permissions or business logic changes. */

html[data-sm-workflow-route] .sm-content {
  --sm-workflow-accent: #6330d6;
  --sm-workflow-accent-soft: color-mix(in srgb, #6330d6 8%, var(--sm-surface));
}

html[data-sm-workflow-route] .sm-page-head {
  align-items: center;
  padding: 2px 2px 4px;
}

html[data-sm-workflow-route] .sm-page-head h1 {
  letter-spacing: -.035em;
}

html[data-sm-workflow-route] .sm-panel {
  border-color: color-mix(in srgb, var(--sm-border) 82%, #6330d6 18%);
}

html[data-sm-workflow-route] .sm-panel-head h2 {
  font-size: 1.06rem;
  letter-spacing: -.018em;
}

html[data-sm-workflow-route] .sm-panel-head p {
  max-width: 76ch;
}

html[data-sm-workflow-route] .sm-table-wrap {
  border: 1px solid var(--sm-border);
  border-radius: 13px;
  background: var(--sm-surface);
}

html[data-sm-workflow-route] .sm-table {
  margin: 0;
}

html[data-sm-workflow-route] .sm-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--sm-surface-2) 94%, #6330d6 6%);
  color: color-mix(in srgb, var(--sm-text) 85%, #6330d6 15%);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .055em;
  border-bottom: 1px solid color-mix(in srgb, var(--sm-border) 72%, #6330d6 28%);
}

html[data-sm-workflow-route] .sm-table tbody tr {
  transition: background .15s ease;
}

html[data-sm-workflow-route] .sm-table tbody tr:hover {
  background: color-mix(in srgb, #6330d6 3.5%, var(--sm-surface));
}

html[data-sm-workflow-route] .sm-core-filter-bar,
html[data-sm-workflow-route] .sm-core-attendance-actions,
html[data-sm-workflow-route] .sm-batch3-filter,
html[data-sm-workflow-route] .sm-toolbar.sm-toolbar-wrap {
  padding: 9px;
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  background: var(--sm-surface-2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

html[data-sm-workflow-route] .sm-core-filter-bar label,
html[data-sm-workflow-route] .sm-batch3-filter label,
html[data-sm-workflow-route] .sm-toolbar label {
  font-size: 10px;
  font-weight: 780;
  color: var(--sm-muted);
  letter-spacing: .015em;
}

html[data-sm-workflow-route] .sm-status-chip {
  border: 1px solid color-mix(in srgb, #6330d6 18%, var(--sm-border));
  background: color-mix(in srgb, #6330d6 7%, var(--sm-surface));
  color: color-mix(in srgb, var(--sm-text) 82%, #6330d6 18%);
  font-weight: 800;
}

html[data-sm-workflow-route] .sm-empty-table,
html[data-sm-workflow-route] .sm-empty-mini {
  min-height: 92px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 22px;
  border-radius: 12px;
  color: var(--sm-muted);
  background: linear-gradient(145deg, var(--sm-surface), var(--sm-surface-2));
}

html[data-sm-workflow-route] .sm-summary-line {
  border: 1px solid var(--sm-border);
  border-radius: 12px;
  background: var(--sm-surface-2);
}

/* Admissions — clear enquiry / selected / pipeline hierarchy */
html[data-sm-workflow-route="admissions"] .sm-work-grid > .sm-panel:first-child {
  border-top: 3px solid #2563eb;
}

html[data-sm-workflow-route="admissions"] .sm-work-grid > .sm-panel:nth-child(2) {
  border-top: 3px solid #f59e0b;
}

html[data-sm-workflow-route="admissions"] .sm-selected-box {
  padding: 14px;
  border: 1px solid color-mix(in srgb, #f59e0b 28%, var(--sm-border));
  border-radius: 13px;
  background: color-mix(in srgb, #f59e0b 6%, var(--sm-surface));
  box-shadow: 0 8px 20px rgba(68,52,23,.05);
}

html[data-sm-workflow-route="admissions"] .sm-selected-box > strong {
  font-size: 1rem;
}

html[data-sm-workflow-route="admissions"] .sm-work-grid > .sm-panel:nth-child(2) > label {
  display: grid;
  gap: 5px;
  margin-top: 13px;
  font-size: 11px;
  font-weight: 800;
  color: var(--sm-muted);
}

html[data-sm-workflow-route="admissions"] .sm-work-grid > .sm-panel:nth-child(2) > .btn-danger {
  margin-top: 8px;
}

html[data-sm-workflow-route="admissions"] .sm-work-grid + .sm-panel .sm-table td:first-child {
  color: var(--sm-muted);
  font-variant-numeric: tabular-nums;
}

/* Student Master — operational master data hierarchy */
html[data-sm-workflow-route="students"] .student-capacity-strip {
  position: relative;
  overflow: hidden;
  border-width: 1px;
  box-shadow: 0 8px 24px rgba(45,32,90,.06);
}

html[data-sm-workflow-route="students"] .student-capacity-strip > div:first-child > strong {
  font-size: .96rem;
}

html[data-sm-workflow-route="students"] article.sm-panel:first-of-type {
  border-top: 3px solid #2563eb;
}

html[data-sm-workflow-route="students"] .sm-table td:first-child strong {
  display: inline-flex;
  min-width: 68px;
  justify-content: center;
  padding: 4px 7px;
  border-radius: 8px;
  background: color-mix(in srgb, #2563eb 7%, var(--sm-surface));
  color: color-mix(in srgb, var(--sm-text) 78%, #2563eb 22%);
  font-variant-numeric: tabular-nums;
}

html[data-sm-workflow-route="students"] .sm-table td:last-child .sm-action-row {
  flex-wrap: nowrap;
  gap: 5px;
}

html[data-sm-workflow-route="students"] article.sm-panel:last-of-type .sm-action-row {
  padding-top: 4px;
}

/* Fees — emphasize student selection, amount truth and receipt flow */
html[data-sm-workflow-route="fees"] .sm-work-grid > .sm-panel:first-child {
  border-top: 3px solid #0a9c9c;
}

html[data-sm-workflow-route="fees"] .sm-student-picker {
  padding: 12px;
  border: 1px solid color-mix(in srgb, #0a9c9c 25%, var(--sm-border));
  border-radius: 13px;
  background: color-mix(in srgb, #0a9c9c 4%, var(--sm-surface-2));
}

html[data-sm-workflow-route="fees"] .sm-picker-search {
  position: relative;
}

html[data-sm-workflow-route="fees"] .sm-picker-search > span:first-child {
  width: 18px;
  height: 18px;
  overflow: hidden;
  color: transparent;
  background: currentColor;
  color: #0a8f8f;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") center/contain no-repeat;
}

html[data-sm-workflow-route="fees"] .sm-picker-result {
  border-radius: 11px;
}

html[data-sm-workflow-route="fees"] .sm-picker-result:hover {
  border-color: color-mix(in srgb, #0a9c9c 42%, var(--sm-border));
  background: color-mix(in srgb, #0a9c9c 5%, var(--sm-surface));
}

html[data-sm-workflow-route="fees"] .sm-selected-student {
  border-color: color-mix(in srgb, #0a9c9c 34%, var(--sm-border));
  background: linear-gradient(135deg, color-mix(in srgb, #0a9c9c 7%, var(--sm-surface)), var(--sm-surface));
  box-shadow: 0 9px 22px rgba(14,103,103,.07);
}

html[data-sm-workflow-route="fees"] .sm-work-grid > .sm-panel:first-child .sm-summary-line {
  margin-top: 12px;
  padding: 13px 14px;
  border-color: color-mix(in srgb, #0a9c9c 28%, var(--sm-border));
  background: linear-gradient(135deg, color-mix(in srgb, #0a9c9c 8%, var(--sm-surface)), var(--sm-surface));
}

html[data-sm-workflow-route="fees"] .sm-work-grid > .sm-panel:first-child .sm-summary-line strong {
  font-size: 1.35rem;
  color: #087b7b;
  font-variant-numeric: tabular-nums;
}

html[data-sm-workflow-route="fees"] .sm-work-grid > .sm-panel:first-child > .sm-gradient-btn {
  min-width: 180px;
  margin-top: 10px;
}

html[data-sm-workflow-route="fees"] .sm-table td:nth-child(7) {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Attendance — fast teacher workflow with compact status truth */
html[data-sm-workflow-route="attendance"] > body .sm-content > .sm-panel:first-of-type {
  border-top: 3px solid #ed3b52;
}

html[data-sm-workflow-route="attendance"] .sm-core-attendance-actions {
  align-items: center;
}

html[data-sm-workflow-route="attendance"] .sm-core-attendance-actions .sm-gradient-btn {
  box-shadow: 0 7px 18px rgba(84,32,201,.18);
}

html[data-sm-workflow-route="attendance"] .sm-table td:nth-child(3) .form-select {
  min-width: 125px;
  font-weight: 800;
}

html[data-sm-workflow-route="attendance"] .sm-table td:first-child {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: color-mix(in srgb, var(--sm-text) 80%, #ed3b52 20%);
}

/* Reports — dense filters become a professional analysis deck */
html[data-sm-workflow-route="reports"] .sm-batch3-filter {
  display: grid;
  grid-template-columns: repeat(5, minmax(135px, 1fr)) auto auto;
  align-items: end;
  gap: 9px;
}

html[data-sm-workflow-route="reports"] .sm-kpi-grid .sm-kpi-card {
  min-height: 108px;
}

html[data-sm-workflow-route="reports"] .sm-kpi-grid .sm-kpi-icon {
  position: relative;
  color: transparent !important;
  overflow: hidden;
}

html[data-sm-workflow-route="reports"] .sm-kpi-grid .sm-kpi-icon::before {
  content: "";
  width: 21px;
  height: 21px;
  background: var(--accent);
  -webkit-mask: var(--report-icon) center/contain no-repeat;
  mask: var(--report-icon) center/contain no-repeat;
}

html[data-sm-workflow-route="reports"] .sm-kpi-grid .sm-kpi-card:nth-child(1) { --report-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9' cy='8' r='3'/%3E%3Cpath d='M3.5 20c.7-4 2.8-6 5.5-6s4.8 2 5.5 6'/%3E%3Ccircle cx='17' cy='9' r='2.2'/%3E%3Cpath d='M15.5 15.5c2.7-.4 4.6 1.1 5 4.5'/%3E%3C/svg%3E"); }
html[data-sm-workflow-route="reports"] .sm-kpi-grid .sm-kpi-card:nth-child(2) { --report-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 4h10M7 8h10M9 4c4 0 6 1.8 6 4.5S13 13 9 13H7l8 7'/%3E%3C/svg%3E"); }
html[data-sm-workflow-route="reports"] .sm-kpi-grid .sm-kpi-card:nth-child(3) { --report-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m7.5 12 3 3 6-7'/%3E%3C/svg%3E"); }
html[data-sm-workflow-route="reports"] .sm-kpi-grid .sm-kpi-card:nth-child(4) { --report-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8 12h8'/%3E%3C/svg%3E"); }

html[data-sm-workflow-route="reports"] .sm-summary-line strong {
  font-variant-numeric: tabular-nums;
}

/* Print Center — document selection first, output second */
html[data-sm-workflow-route="print-center"] .sm-print-hub {
  gap: 10px;
}

html[data-sm-workflow-route="print-center"] .sm-print-hub-card {
  min-height: 92px;
  padding: 15px;
  border: 1px solid var(--sm-border);
  border-radius: 14px;
  background: linear-gradient(145deg, var(--sm-surface), var(--sm-surface-2));
  box-shadow: 0 8px 22px rgba(38,32,84,.055);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

html[data-sm-workflow-route="print-center"] .sm-print-hub-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, #6330d6 32%, var(--sm-border));
  box-shadow: 0 12px 28px rgba(57,40,123,.10);
}

html[data-sm-workflow-route="print-center"] .sm-print-hub + .sm-panel {
  border-top: 3px solid #7b31dd;
}

html[data-sm-workflow-route="print-center"] .sm-static-results {
  margin-top: 10px;
}

html[data-sm-workflow-route="print-center"] .sm-no-print {
  border-color: color-mix(in srgb, #7b31dd 25%, var(--sm-border));
  background: color-mix(in srgb, #7b31dd 3%, var(--sm-surface));
}

/* Phone/tablet workflow ergonomics */
@media (max-width: 1040px) {
  html[data-sm-workflow-route] .sm-core-filter-bar,
  html[data-sm-workflow-route] .sm-core-attendance-actions,
  html[data-sm-workflow-route] .sm-batch3-filter,
  html[data-sm-workflow-route] .sm-toolbar.sm-toolbar-wrap {
    width: 100%;
  }

  html[data-sm-workflow-route="reports"] .sm-batch3-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-sm-workflow-route="reports"] .sm-batch3-filter .btn {
    width: 100%;
  }
}

@media (max-width: 720px) {
  html[data-sm-workflow-route] .sm-table-wrap {
    border-radius: 11px;
    box-shadow: inset -12px 0 18px -18px rgba(40,31,84,.55);
  }

  html[data-sm-workflow-route] .sm-table thead th {
    top: 0;
  }

  html[data-sm-workflow-route="students"] .sm-table td:last-child .sm-action-row {
    display: flex !important;
    width: auto;
  }

  html[data-sm-workflow-route="fees"] .sm-work-grid > .sm-panel:first-child > .sm-gradient-btn {
    width: 100%;
  }

  html[data-sm-workflow-route="attendance"] .sm-core-attendance-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-sm-workflow-route="attendance"] .sm-core-attendance-actions .sm-search-small,
  html[data-sm-workflow-route="attendance"] .sm-core-attendance-actions .sm-gradient-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  html[data-sm-workflow-route="reports"] .sm-batch3-filter {
    grid-template-columns: 1fr;
  }

  html[data-sm-workflow-route="print-center"] .sm-print-hub {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  html[data-sm-workflow-route="attendance"] .sm-core-attendance-actions,
  html[data-sm-workflow-route="print-center"] .sm-print-hub {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-sm-workflow-route] .sm-table tbody tr,
  html[data-sm-workflow-route="print-center"] .sm-print-hub-card {
    transition: none;
  }
}

@media print {
  html[data-sm-workflow-route] .sm-table-wrap,
  html[data-sm-workflow-route="print-center"] .sm-print-hub-card {
    box-shadow: none !important;
  }
}
