.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.auth-page {
  min-height: 100vh;
  background: #f3f6fb;
}

.auth-wrapper {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 650px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 22px;
  padding: 34px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo {
  width: 68px;
  height: 68px;
  margin: 0 auto 16px;
  border-radius: 20px;
  background: rgba(13, 110, 253, 0.1);
  color: var(--primary-color);
  display: grid;
  place-items: center;
  font-size: 2rem;
}

.auth-header h1 {
  margin: 0;
  font-weight: 700;
}

.auth-header p {
  margin: 4px 0 0;
  color: var(--text-muted-color);
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  color: var(--text-muted-color);
  font-size: 0.9rem;
}

.dashboard-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
}

.dashboard-header h1 {
  margin: 0;
}

.dashboard-header p {
  margin: 4px 0 0;
  color: var(--text-muted-color);
}

.dashboard-date {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.dashboard-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dashboard-card p {
  margin: 0;
  color: var(--text-muted-color);
}

.dashboard-card h2 {
  margin: 2px 0 0;
  font-size: 2rem;
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}

.bg-soft-red {
  background: var(--danger-soft-color);
  color: var(--danger-color);
}

.bg-soft-blue {
  background: var(--info-soft-color);
  color: var(--info-color);
}

.bg-soft-green {
  background: var(--success-soft-color);
  color: var(--success-color);
}

.bg-soft-orange {
  background: var(--warning-soft-color);
  color: var(--warning-color);
}

.bg-soft-purple {
  background: var(--purple-soft-color);
  color: var(--purple-color);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.session-list {
  display: grid;
  gap: 10px;
}

.session-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 12px;
}

.session-title {
  font-weight: 700;
}

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

.status-summary {
  display: grid;
  gap: 12px;
}

.status-summary div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-summary strong {
  margin-left: auto;
  font-size: 1.3rem;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.status-dot.present {
  background: var(--success-color);
}

.status-dot.late {
  background: var(--warning-color);
}

.status-dot.absent {
  background: var(--danger-color);
}

.status-dot.personal-leave {
  background: var(--info-color);
}

.status-dot.sick-leave {
  background: var(--purple-color);
}

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

.attendance-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
}

.attendance-filter {
  width: 260px;
}

.attendance-session-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.session-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 94px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.session-status.waiting {
  background: var(--warning-soft-color);
  color: var(--warning-color);
}

.session-status.completed {
  background: var(--success-soft-color);
  color: var(--success-color);
}

.session-status.cancelled {
  background: var(--danger-soft-color);
  color: var(--danger-color);
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.detail-header h3,
.detail-header p {
  margin: 0;
}

.detail-header p {
  color: var(--text-muted-color);
}

.attendance-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.attendance-date-input {
  width: 150px;
  font-size: 0.95rem;
}

.attendance-date span {
  color: var(--text-muted-color);
  white-space: nowrap;
}

.student-attendance-list {
  display: grid;
  gap: 10px;
}

.student-attendance-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.student-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.student-code {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft-color);
  color: var(--danger-color);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.student-name {
  font-weight: 700;
}

.status-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-btn {
  border: 1px solid var(--border-color);
  background: var(--surface-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-weight: 700;
}

.status-btn.active.present {
  background: var(--success-soft-color);
  color: var(--success-color);
  border-color: var(--success-color);
}

.status-btn.active.late {
  background: var(--warning-soft-color);
  color: var(--warning-color);
  border-color: var(--warning-color);
}

.status-btn.active.absent {
  background: var(--danger-soft-color);
  color: var(--danger-color);
  border-color: var(--danger-color);
}

.status-btn.active.personal_leave {
  background: var(--info-soft-color);
  color: var(--info-color);
  border-color: var(--info-color);
}

.status-btn.active.sick_leave {
  background: var(--purple-soft-color);
  color: var(--purple-color);
  border-color: var(--purple-color);
}

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

.toolbar-left {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-left .form-select {
  min-width: 170px;
}

.schedule-table-wrapper {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.schedule-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.schedule-table th,
.schedule-table td {
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  vertical-align: top;
  padding: 12px;
}

.schedule-table thead th {
  background: var(--bg-color);
  text-align: center;
  font-weight: 700;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
  width: 140px;
}

.schedule-table tr:last-child td,
.schedule-table tr:last-child th {
  border-bottom: 0;
}

.schedule-table th:last-child,
.schedule-table td:last-child {
  border-right: 0;
}

.time-cell {
  color: var(--text-muted-color);
  background: var(--bg-color);
  white-space: nowrap;
}

.schedule-session-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--warning-color);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

.schedule-session-title {
  font-weight: 700;
  margin-bottom: 2px;
}

.schedule-session-meta {
  color: var(--text-muted-color);
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.schedule-session-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-waiting {
  background: var(--warning-soft-color);
  color: var(--warning-color);
}

.status-completed {
  background: var(--success-soft-color);
  color: var(--success-color);
}

.status-cancelled {
  background: var(--danger-soft-color);
  color: var(--danger-color);
}

.type-normal {
  background: var(--info-soft-color);
  color: var(--info-color);
}

.type-special {
  background: var(--purple-soft-color);
  color: var(--purple-color);
}

.type-makeup {
  background: var(--danger-soft-color);
  color: var(--danger-color);
}

.schedule-session-card.waiting {
  border-left-color: var(--warning-color);
}

.schedule-session-card.completed {
  border-left-color: var(--success-color);
}

.schedule-session-card.cancelled {
  border-left-color: var(--danger-color);
}

.reports-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;

  margin-bottom: 24px;

  flex-wrap: wrap;
}

.reports-toolbar .form-select {
  max-width: 220px;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-toolbar {
  display: grid;
  grid-template-columns: 220px 150px 150px 180px 1fr auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.admin-toolbar-search,
.admin-toolbar-filter {
  width: 100%;
}

.admin-toolbar-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  grid-column: auto;
}

.admin-toolbar-actions .btn {
  white-space: nowrap;
}

.admin-toolbar .form-control {
  max-width: 320px;
}

.student-group-list {
  display: grid;
  gap: 18px;
}

.student-level-section {
  display: grid;
  gap: 10px;
}

.student-level-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 14px 18px;
  margin-bottom: 12px;

  border-radius: var(--radius-md);

  background: #f8fafc;
  border: 1px solid #e5e7eb;

  color: var(--text-color);
}

.student-level-title {
  font-size: 1.2rem;
  font-weight: 700;
}

.student-level-badge {
  background: rgba(185, 28, 28, 0.1);
  color: var(--primary-color);

  padding: 6px 12px;
  border-radius: 999px;

  font-weight: 700;
}

.student-level-header h3 {
  margin: 0;
  font-size: 1.25rem;
}

.student-level-header p {
  margin: 2px 0 0;
  color: var(--text-muted-color);
}

.student-name-main {
  font-weight: 700;
}

.student-name-sub {
  font-size: 0.9rem;
  color: var(--text-muted-color);
}

.group-card-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.group-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.group-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  gap: 12px;
  margin-bottom: 14px;
}

.group-card-header .badge {
  height: fit-content;
  align-self: flex-start;
}

.group-card-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.group-card-header p {
  margin: 4px 0 0;
  color: var(--text-muted-color);
}

.group-card-info {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.group-card-info div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 8px;
}

.group-card-info span {
  color: var(--text-muted-color);
}

.group-student-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.group-student-preview span {
  background: var(--danger-soft-color);
  color: var(--danger-color);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 700;
}

.group-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-student-picker {
  max-height: 360px;
  overflow-y: auto;
  display: grid;
  gap: 8px;
  text-align: left;
}

.student-check-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.student-check-item small {
  display: block;
  color: var(--text-muted-color);
  margin-top: 2px;
}

@media (max-width: 767.98px) {
  .attendance-header,
  .attendance-session-card,
  .student-attendance-card {
    align-items: stretch;
    flex-direction: column;
  }

  .attendance-filter {
    width: 100%;
  }

  .session-card-actions,
  .attendance-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

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

  .toolbar-left,
  .toolbar-left .form-select,
  #addSpecialSessionBtn {
    width: 100%;
  }

  .group-card-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .auth-wrapper {
    padding: 16px;
  }

  .auth-card {
    padding: 28px 22px;
    border-radius: 18px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .session-item {
    flex-direction: column;
  }

  .reports-toolbar .form-select,
  .reports-toolbar .btn {
    max-width: none;
    width: 100%;
  }

  .report-summary-grid {
    grid-template-columns: 1fr;
  }

  .admin-toolbar {
    flex-direction: column;
  }

  .admin-toolbar {
    grid-template-columns: 1fr;
  }

  .admin-toolbar-actions {
    flex-direction: column;
  }

  .admin-toolbar-actions .btn {
    width: 100%;
  }
}

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

  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (max-width: 1199.98px) {
  .admin-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .group-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
