:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #637083;
  --border: #dde3ea;
  --primary: #1d4ed8;
  --primary-soft: #e8f0ff;
  --green: #16803c;
  --green-soft: #e7f7ed;
  --orange: #c95415;
  --orange-soft: #fff0e6;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  zoom: 0.75;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: #eef2f7;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card h1 {
  margin: 4px 0 0;
  font-size: 1.45rem;
  letter-spacing: 0;
}

.error-text {
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell[hidden],
.auth-screen[hidden],
.employee-portal[hidden] {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: #182235;
  color: #ffffff;
}

.sidebar-account {
  display: grid;
  gap: 10px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 16px;
}

.sidebar-account span {
  color: #c9d3e3;
  font-weight: 700;
}

.sidebar-logout {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-weight: 700;
}

.sidebar-logout:hover {
  background: rgba(255, 255, 255, 0.16);
}

.sidebar h1 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.sidebar p {
  margin: 0;
  color: #c9d3e3;
  line-height: 1.5;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-group {
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.nav-group[open] {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
}

.nav-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  color: #d7e0ee;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  list-style: none;
  user-select: none;
  cursor: pointer;
}

.nav-label::-webkit-details-marker {
  display: none;
}

.nav-chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.nav-group[open] .nav-chevron {
  transform: rotate(225deg);
}

.nav-items {
  display: grid;
  gap: 4px;
  padding: 0 8px 8px;
}

.nav-btn {
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #ffffff;
  padding: 10px 11px;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.18);
}

.nav-btn.active {
  box-shadow: inset 3px 0 0 #7dd3fc;
}

.main-content {
  min-width: 0;
  padding: 22px;
}

.employee-portal {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.employee-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  background: #182235;
  color: #ffffff;
  padding: 24px 18px;
}

.employee-sidebar h1 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  letter-spacing: 0;
}

.employee-sidebar p {
  margin: 0;
  color: #c9d3e3;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.logged-user {
  display: grid;
  gap: 3px;
  min-height: 40px;
  justify-content: end;
  padding: 4px 10px;
  text-align: right;
}

.logged-user span,
.logged-user small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.logged-user strong {
  color: var(--text);
  font-size: 0.92rem;
}

.eyebrow,
.month-filter span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.topbar h2 {
  margin: 3px 0 0;
  font-size: 1.45rem;
  letter-spacing: 0;
}

.month-filter {
  display: grid;
  gap: 5px;
  min-width: 180px;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.stat-card,
.card,
.day-card,
.empty-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  display: block;
  min-height: 34px;
  font-size: 1.55rem;
  line-height: 1.2;
}

.accent-blue {
  border-top: 4px solid var(--primary);
}

.accent-green {
  border-top: 4px solid var(--green);
}

.accent-orange {
  border-top: 4px solid var(--orange);
}

.summary-row,
.work-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.summary-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.employee-portal .work-grid {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-areas:
    "checkin boards"
    "leave boards";
}

.employee-portal #employeeSelfAttendanceForm {
  grid-area: checkin;
}

.employee-portal .leave-request-panel {
  grid-area: leave;
}

.leave-request-panel {
  padding: 0;
  overflow: hidden;
}

.leave-request-panel summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 14px;
  cursor: pointer;
  color: #ffffff;
  font-weight: 800;
  background: #2563eb;
}

.leave-request-panel summary::-webkit-details-marker {
  display: none;
}

.leave-request-panel summary::marker {
  content: "";
}

.leave-request-panel form {
  padding: 14px;
  border-top: 1px solid var(--border);
}

.employee-portal .work-grid > .stacked-panels {
  grid-area: boards;
}

.student-overview-card {
  margin-bottom: 14px;
}

.overview-table {
  min-width: 0;
  font-size: 0.9rem;
}

.overview-table th,
.overview-table td {
  padding: 10px 12px;
}

.overview-table td:nth-child(2),
.overview-table td:nth-child(3) {
  white-space: nowrap;
}

.overview-table td:last-child {
  color: var(--muted);
}

.card {
  padding: 16px;
}

.form-card {
  align-self: start;
}

#students .form-card {
  position: sticky;
  top: 22px;
}

.import-card {
  padding: 12px 16px;
  overflow: hidden;
  align-self: start;
}

.import-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--text);
}

.import-summary strong {
  font-size: 1.02rem;
}

.import-body {
  display: grid;
  gap: 8px;
}

.import-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.file-input-label input {
  min-height: 38px;
  padding: 6px 8px;
}

.import-preview {
  margin-top: 2px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.import-preview-table {
  min-width: 640px;
  font-size: 0.86rem;
}

.card h3,
.schedule-panel h3 {
  margin: 0 0 14px;
  font-size: 1.02rem;
  letter-spacing: 0;
}

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

.section-heading h3 {
  margin: 0;
}

.muted-text {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.salary-fieldset {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
}

.salary-fieldset legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 700;
}

.work-plan-fieldset {
  gap: 12px;
}

.work-day-grid,
.work-slot-grid {
  display: grid;
  gap: 6px;
}

.work-day-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.work-slot-grid {
  grid-template-columns: 64px repeat(3, minmax(0, 1fr));
}

.work-day-grid label,
.work-slot-grid label,
.work-session-grid label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 6px 8px;
  font-size: 0.82rem;
  font-weight: 800;
}

.work-slot-grid > span,
.work-slot-grid > strong {
  display: grid;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.work-day-grid input,
.work-slot-grid input,
.work-session-grid input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
}

.work-slot-grid label:has(input:checked) {
  border-color: #9bbcff;
  background: var(--primary-soft);
  color: var(--primary);
}

.work-session-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: center;
}

.work-session-grid input[type="time"] {
  display: none;
}

.schedule-choice-fieldset {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
}

.schedule-choice-fieldset legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 700;
}

.schedule-choice-grid {
  display: grid;
  grid-template-columns: 72px repeat(3, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.schedule-choice-grid > strong,
.schedule-choice-grid > span {
  display: grid;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.schedule-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
}

.schedule-choice input {
  width: auto;
  min-height: 0;
  margin: 0 6px 0 0;
}

.schedule-choice:has(input:checked) {
  border-color: #9bbcff;
  background: var(--primary-soft);
  color: var(--primary);
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.checkbox-row {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.checkbox-row input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.form-status.success {
  color: #166534;
}

.form-status.error {
  color: var(--danger);
}

.access-notes {
  margin-top: 12px;
}

.locked-field {
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(29, 78, 216, 0.14);
}

input:disabled {
  background: #eef2f7;
  cursor: not-allowed;
}

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 12px;
  font-weight: 700;
}

.primary-btn {
  background: var(--primary);
  color: #ffffff;
}

.primary-btn:hover {
  background: #173ea9;
}

.secondary-btn {
  background: var(--surface-soft);
  color: var(--text);
  border-color: var(--border);
}

.secondary-btn:hover {
  background: #eef2f7;
}

.danger-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #ffd2cf;
}

.danger-btn:hover {
  background: #ffe4e1;
}

.secondary-btn.compact,
.danger-btn.compact,
.primary-btn.compact {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.84rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.student-schedule-card {
  max-height: calc(100vh - 170px);
  overflow: hidden;
}

.student-schedule-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 240px);
  overflow-y: auto;
  padding-right: 4px;
}

.student-schedule-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.student-schedule-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.student-schedule-summary::-webkit-details-marker {
  display: none;
}

.student-schedule-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}

.student-schedule-item[open] .student-schedule-summary::after {
  transform: rotate(225deg);
}

.student-schedule-main,
.student-schedule-meta,
.student-schedule-row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.student-schedule-main span,
.student-schedule-meta span,
.student-schedule-row span,
.student-schedule-info {
  color: var(--muted);
  font-size: 0.88rem;
}

.student-schedule-meta {
  grid-column: 2;
  text-align: right;
}

.student-schedule-body {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: var(--surface-soft);
}

.student-schedule-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.student-schedule-rows {
  display: grid;
  gap: 8px;
}

.student-schedule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface);
}

.compact-empty {
  box-shadow: none;
  padding: 10px;
}

.attendance-suggestions {
  display: grid;
  gap: 8px;
}

.attendance-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.attendance-suggestion div:first-child {
  display: grid;
  gap: 3px;
}

.attendance-suggestion span,
.attendance-suggestion small {
  color: var(--muted);
}

.status-pill {
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  padding: 5px 9px;
  font-weight: 800;
  white-space: nowrap;
}

.camera-checkin {
  display: grid;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-soft);
}

.camera-preview {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111827;
  color: #cbd5e1;
}

.camera-preview video,
.camera-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #cbd5e1;
  font-weight: 700;
}

.camera-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

#startSelfCamera {
  grid-column: 1 / -1;
}

.checkin-meta {
  display: grid;
  gap: 8px;
}

.checkin-meta div,
.teacher-student-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.checkin-meta div {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.checkin-meta span,
.teacher-student-item span,
.teacher-student-item small,
.evidence-cell small,
.attendance-shift-cell small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.attendance-shift-cell {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.attendance-shift-cell strong {
  color: var(--text);
}

.teacher-student-list {
  display: grid;
  gap: 8px;
}

.portal-board {
  display: grid;
}

.portal-board summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 0 12px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.portal-board summary::-webkit-details-marker {
  display: none;
}

.portal-board summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.16s ease;
}

.portal-board[open] summary {
  border-color: #9bbcff;
  background: var(--primary-soft);
  color: var(--primary);
}

.portal-board[open] summary::after {
  transform: rotate(225deg);
}

.portal-board > .card {
  margin-top: 8px;
}

.teacher-student-item {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.teacher-student-item div {
  display: grid;
  gap: 3px;
}

.teacher-student-item strong {
  color: var(--text);
}

.evidence-cell {
  display: grid;
  gap: 5px;
  min-width: 180px;
}

.evidence-badge {
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.evidence-thumb {
  width: 54px;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0;
  background: #ffffff;
}

.evidence-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-panel {
  margin-top: 14px;
}

.student-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(15, 23, 42, 0.48);
  padding: 22px;
}

.student-detail-modal[hidden] {
  display: none;
}

.student-detail-dialog {
  width: min(1080px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.detail-grid h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.detail-grid > section:first-child,
.detail-grid > section:nth-child(2) {
  grid-column: 1 / -1;
}

.detail-summary-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.detail-summary-grid .wide-box {
  grid-column: span 2;
}

.payroll-breakdown div small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}

.detail-table {
  min-width: 680px;
  font-size: 0.88rem;
}

.filter-bar {
  display: grid;
  grid-template-columns: 150px 180px minmax(220px, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin: 12px 0;
}

.filter-bar label {
  display: grid;
  gap: 5px;
  margin: 0;
}

.filter-bar span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.student-list-card {
  min-width: 0;
  overflow: hidden;
}

.student-list-card .table-wrap {
  max-width: 100%;
  max-height: calc(100vh - 290px);
  overflow: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.student-list-table {
  width: max-content;
  min-width: 1040px;
}

.student-list-table th,
.student-list-table td {
  white-space: nowrap;
}

.student-list-table .account-cell {
  min-width: 220px;
  white-space: nowrap;
}

.student-list-table .account-cell small {
  white-space: nowrap;
}

.student-list-table .row-actions {
  min-width: 180px;
  flex-wrap: nowrap;
}

.student-list-table th:nth-child(2),
.student-list-table td:nth-child(2),
.student-list-table th:nth-child(3),
.student-list-table td:nth-child(3),
.student-list-table th:nth-child(4),
.student-list-table td:nth-child(4),
.student-list-table th:nth-child(5),
.student-list-table td:nth-child(5),
.student-list-table th:nth-child(6),
.student-list-table td:nth-child(6) {
  min-width: 110px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

td {
  line-height: 1.35;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.full-time {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge.part-time {
  background: var(--green-soft);
  color: var(--green);
}

.badge.contract {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.active {
  background: var(--green-soft);
  color: var(--green);
}

.badge.approved {
  background: var(--green-soft);
  color: var(--green);
}

.badge.pending,
.badge.trial,
.badge.scheduled,
.badge.attended {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge.reserved {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.converted {
  background: var(--green-soft);
  color: var(--green);
}

.badge.pass,
.badge.registered {
  background: var(--green-soft);
  color: var(--green);
}

.badge.follow_up {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge.not_registered {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.fail,
.badge.no_show {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.ended {
  background: var(--surface-soft);
  color: var(--muted);
}

.badge.canceled {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.rejected {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.paused {
  background: var(--orange-soft);
  color: var(--orange);
}

.badge.inactive {
  background: var(--danger-soft);
  color: var(--danger);
}

.tuition-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.payslip-live-summary {
  margin-bottom: 12px;
}

.tuition-layout.editor-open {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  align-items: start;
}

.tuition-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px;
  gap: 10px;
}

.tuition-program-filter,
.student-program-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.student-program-filter {
  margin-bottom: 12px;
}

.filter-chip {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 6px 11px;
  font-weight: 800;
}

.filter-chip.active {
  border-color: #9bbcff;
  background: var(--primary-soft);
  color: var(--primary);
}

.tuition-student-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  margin-top: 12px;
  padding-right: 4px;
}

.tuition-student-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.tuition-student-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.tuition-student-summary::-webkit-details-marker {
  display: none;
}

.tuition-student-summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
}

.tuition-student-item[open] .tuition-student-summary::after {
  transform: rotate(225deg);
}

.tuition-student-main,
.tuition-student-meta {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tuition-student-meta {
  justify-items: end;
  text-align: right;
}

.tuition-student-body {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: var(--surface);
}

.tuition-student-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tuition-student-main strong {
  font-size: 1rem;
}

.tuition-student-main span,
.tuition-student-meta strong,
.tuition-student-footer small,
.tuition-status-grid span {
  color: var(--muted);
}

.tuition-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tuition-status-grid > div {
  display: grid;
  gap: 4px;
  min-height: 62px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  padding: 9px;
}

.tuition-status-grid strong {
  overflow-wrap: anywhere;
}

.tuition-debt.success {
  border-color: #bde8cd;
  background: #f1fbf5;
}

.tuition-debt.warning {
  border-color: #ffd7a8;
  background: #fff7ed;
}

.tuition-editor {
  position: sticky;
  top: 22px;
}

.account-cell {
  display: grid;
  gap: 3px;
  font-weight: 700;
}

.account-cell small {
  color: var(--muted);
  font-weight: 600;
}

.plain-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.plain-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.plain-list li:last-child {
  border-bottom: none;
}

.plain-list strong {
  text-align: right;
}

.schedule-panel {
  min-width: 0;
}

.stacked-panels {
  display: grid;
  gap: 14px;
  min-width: 0;
  align-content: start;
}

.payroll-breakdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payroll-breakdown div {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.payroll-breakdown span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.payroll-breakdown .total-box {
  background: var(--primary-soft);
  border-color: #bed4ff;
}

.schedule-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.schedule-calendar-wrap {
  max-height: calc(100vh - 220px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.schedule-calendar-table {
  min-width: 980px;
}

.schedule-calendar-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
}

.schedule-calendar-table th:first-child,
.schedule-calendar-table td:first-child {
  width: 150px;
  min-width: 150px;
  white-space: nowrap;
}

.schedule-calendar-table td:first-child {
  vertical-align: top;
}

.schedule-calendar-table td:first-child strong,
.schedule-calendar-table td:first-child small {
  display: block;
}

.schedule-calendar-table td:first-child small {
  color: var(--muted);
  margin-top: 4px;
}

.schedule-calendar-table td {
  vertical-align: top;
}

.schedule-teacher-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: start;
  max-height: 132px;
  overflow: auto;
}

.schedule-teacher-pill {
  display: inline-grid;
  gap: 2px;
  min-width: 132px;
  max-width: 180px;
  border: 1px solid #cfe0ff;
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--primary-soft);
  color: var(--text);
}

.schedule-teacher-pill.fixed {
  border-color: #cfe0ff;
  background: var(--primary-soft);
}

.schedule-teacher-pill.teaching {
  border-color: #b8e8ca;
  background: var(--green-soft);
}

.schedule-teacher-pill strong,
.schedule-teacher-pill small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-teacher-pill small {
  color: var(--muted);
  font-size: 0.78rem;
}

.schedule-teacher-pill em {
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  line-height: 1.35;
}

.day-card {
  padding: 12px;
}

.day-card h4 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

.slot {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-soft);
  margin-bottom: 8px;
}

.slot:last-child {
  margin-bottom: 0;
}

.slot span,
.slot small {
  color: var(--muted);
}

.empty-table,
.empty-panel,
.empty-state {
  color: var(--muted);
  text-align: center;
}

.empty-panel {
  padding: 24px;
}

.student-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: grid;
  place-items: center;
  overflow: auto;
  background: rgba(15, 23, 42, 0.48);
  padding: 22px;
}

.student-edit-modal[hidden] {
  display: none;
}

.student-edit-dialog {
  width: min(680px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
}

.modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.modal-heading h3 {
  margin: 3px 0 0;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full-span {
  grid-column: 1 / -1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.payslip-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: start center;
  overflow: auto;
  background: rgba(15, 23, 42, 0.45);
  padding: 24px;
}

.payslip-modal[hidden] {
  display: none;
}

.payslip-dialog {
  width: min(210mm, 100%);
}

.payslip-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

.payslip-print-area {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  padding: 16mm;
  overflow: visible;
}

.payslip-document {
  display: grid;
  gap: 12px;
  color: #111827;
  font-size: 0.88rem;
}

.payslip-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding-bottom: 12px;
  border-bottom: 2px solid #111827;
}

.payslip-brand span {
  display: block;
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.payslip-brand h1 {
  margin: 5px 0 3px;
  font-size: 1.65rem;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: uppercase;
}

.payslip-brand p {
  margin: 0;
  color: #4b5563;
  font-weight: 700;
}

.payslip-stamp {
  display: grid;
  gap: 4px;
  text-align: right;
}

.payslip-stamp span,
.payslip-info span,
.payslip-summary span,
.signature-row span {
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 700;
}

.payslip-stamp strong {
  font-size: 0.95rem;
}

.payslip-stamp small {
  color: var(--muted);
  font-weight: 700;
}

.payslip-info,
.payslip-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  border: 1px solid #d1d5db;
  border-bottom: none;
}

.payslip-info div,
.payslip-summary div {
  display: grid;
  gap: 4px;
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  padding: 8px 10px;
}

.payslip-info div:last-child,
.payslip-summary div:last-child {
  border-right: none;
}

.payslip-summary .total-box {
  background: #172033;
  border-color: #172033;
  color: #ffffff;
}

.payslip-summary .total-box span {
  color: #dbeafe;
}

.payslip-summary strong {
  font-size: 1.08rem;
}

.payslip-section h2 {
  margin: 6px 0 8px;
  font-size: 0.95rem;
  letter-spacing: 0;
}

.payslip-table {
  width: 100%;
  min-width: 0;
  border: 1px solid #d1d5db;
  font-size: 0.8rem;
}

.payslip-table th {
  background: #f3f4f6;
  color: #111827;
  font-weight: 800;
}

.payslip-table th,
.payslip-table td {
  padding: 7px 8px;
  vertical-align: top;
}

.payslip-table small {
  display: block;
  margin-top: 2px;
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 600;
}

.payslip-total-row td {
  background: #f9fafb;
  color: #111827;
  font-weight: 800;
}

.payslip-total-row td:last-child {
  color: #111827;
  font-size: 0.95rem;
}

.confirmation-text {
  margin: 4px 0 0;
  color: #374151;
  line-height: 1.45;
}

.signature-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px;
  margin-top: 30px;
}

.signature-row div {
  display: grid;
  min-height: 82px;
  align-content: start;
  justify-items: center;
  gap: 6px;
  border-top: 1px solid #111827;
  padding-top: 8px;
  text-align: center;
}

@media (max-width: 980px) {
  .app-shell,
  .employee-portal,
  .summary-row,
  .work-grid,
  .tuition-layout.editor-open {
    grid-template-columns: 1fr;
  }

  .employee-portal .work-grid {
    grid-template-areas:
      "checkin"
      "leave"
      "boards";
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 16px;
  }

  nav {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .nav-group {
    align-content: start;
  }

  .nav-btn {
    text-align: left;
  }

  .nav-label {
    padding: 0 12px;
  }

  .tuition-editor {
    position: static;
  }
}

@media (max-width: 720px) {
  .main-content,
  .sidebar {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .tuition-student-main,
  .tuition-student-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .logged-user {
    justify-content: start;
    text-align: left;
    padding-inline: 0;
  }

  .stats-grid,
  .two-columns,
  .camera-actions,
  .detail-grid,
  .filter-bar,
  .import-actions,
  .payroll-breakdown,
  .detail-summary-grid,
  .tuition-filter,
  .tuition-status-grid,
  nav {
    grid-template-columns: 1fr;
  }

  .tuition-student-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .tuition-student-meta {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
  }

  .schedule-choice-fieldset {
    overflow-x: auto;
  }

  .schedule-choice-grid {
    min-width: 520px;
  }

  table {
    min-width: 640px;
  }

  .overview-table {
    min-width: 0;
  }

  .payslip-modal {
    padding: 12px;
  }

  .student-edit-modal {
    padding: 12px;
  }

  .student-detail-modal {
    padding: 12px;
  }

  .student-edit-dialog {
    max-height: calc(100vh - 24px);
  }

  .employee-portal {
    display: block;
    min-height: 100dvh;
    background: #eef2f7;
  }

  .employee-portal .employee-sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    padding: 13px 16px;
    background: #111827;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  }

  .employee-portal .employee-sidebar h1 {
    margin: 0;
    font-size: 1.05rem;
  }

  .employee-portal .employee-sidebar p {
    display: none;
  }

  .employee-portal .main-content {
    padding: 12px;
  }

  .employee-portal .topbar {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 12px;
    box-shadow: var(--shadow);
  }

  .employee-portal .topbar h2 {
    font-size: 1.16rem;
    line-height: 1.25;
  }

  .employee-portal .topbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
  }

  .employee-portal .month-filter {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .employee-portal .logged-user {
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 8px 10px;
  }

  .employee-portal .logged-user strong,
  .employee-portal .logged-user small {
    overflow-wrap: anywhere;
  }

  .employee-portal .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }

  .employee-portal .stat-card {
    padding: 12px;
    box-shadow: none;
  }

  .employee-portal .stat-card span {
    min-height: 34px;
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.25;
  }

  .employee-portal .stat-card strong {
    min-height: 0;
    font-size: 1.18rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .employee-portal .work-grid,
  .employee-portal .stacked-panels {
    gap: 12px;
  }

  .employee-portal .card {
    padding: 14px;
    box-shadow: none;
  }

  .employee-portal .leave-request-panel {
    padding: 0;
  }

  .employee-portal .card h3,
  .employee-portal .section-heading {
    margin-bottom: 10px;
  }

  .employee-portal input,
  .employee-portal select,
  .employee-portal .primary-btn,
  .employee-portal .secondary-btn,
  .employee-portal .danger-btn {
    min-height: 46px;
  }

  .employee-portal .primary-btn {
    width: 100%;
  }

  .employee-portal .two-columns {
    gap: 10px;
  }

  .work-day-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-slot-grid {
    grid-template-columns: 58px repeat(3, minmax(0, 1fr));
  }

  #employeeSelfAttendanceForm {
    border-color: #b7dfc7;
    background: #fbfffd;
  }

  #employeeSelfAttendanceForm > h3 {
    font-size: 1.12rem;
  }

  .employee-portal .camera-checkin {
    padding: 8px;
  }

  .employee-portal .camera-preview {
    aspect-ratio: 3 / 4;
    max-height: 420px;
  }

  .employee-portal .camera-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .employee-portal #startSelfCamera {
    grid-column: 1 / -1;
  }

  .employee-portal .checkin-meta {
    grid-template-columns: 1fr;
  }

  .employee-portal .teacher-student-list {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 2px;
  }

  .employee-portal .teacher-student-item {
    padding: 12px;
  }

  .employee-portal .schedule-board {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .employee-portal .day-card {
    padding: 12px;
    box-shadow: none;
  }

  .employee-portal .table-wrap {
    overflow: visible;
  }

  .employee-portal .mobile-card-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 8px;
  }

  .employee-portal .mobile-card-table thead {
    display: none;
  }

  .employee-portal .mobile-card-table,
  .employee-portal .mobile-card-table tbody,
  .employee-portal .mobile-card-table tr,
  .employee-portal .mobile-card-table td {
    display: block;
    width: 100%;
  }

  .employee-portal .mobile-card-table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    padding: 8px 10px;
  }

  .employee-portal .mobile-card-table td {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    border: 0;
    padding: 7px 0;
    vertical-align: top;
  }

  .employee-portal .mobile-card-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .employee-portal .mobile-card-table .empty-table {
    display: block;
    text-align: left;
  }

  .employee-portal .mobile-card-table .empty-table::before {
    content: none;
  }

  .employee-portal .evidence-cell {
    min-width: 0;
  }

  .employee-portal .evidence-badge {
    max-width: 100%;
  }

  .student-detail-dialog {
    max-height: calc(100vh - 24px);
  }

  .modal-heading,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .payslip-print-area {
    width: 100%;
    min-height: auto;
    padding: 18px;
  }

  .payslip-header,
  .payslip-info,
  .payslip-summary,
  .signature-row {
    grid-template-columns: 1fr;
  }

  .payslip-header {
    display: grid;
  }

  .payslip-stamp {
    text-align: left;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    zoom: 1;
    background: #ffffff;
  }

  body.printing-payslip .app-shell,
  body.printing-payslip .employee-portal,
  body.printing-payslip .auth-screen {
    display: none;
  }

  body.printing-payslip .payslip-modal {
    position: static;
    display: block;
    overflow: visible;
    background: #ffffff;
    padding: 0;
  }

  body.printing-payslip .payslip-dialog {
    width: 210mm;
  }

  body.printing-payslip .payslip-actions {
    display: none;
  }

  body.printing-payslip .payslip-print-area {
    width: 210mm;
    min-height: 297mm;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 16mm;
  }

  body.printing-payslip .payslip-header {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body.printing-payslip .payslip-info,
  body.printing-payslip .payslip-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.printing-payslip .signature-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.printing-payslip .payslip-stamp {
    text-align: right;
  }

  body.printing-payslip table {
    min-width: 0;
  }
}
