/* =========================================================================
   Absensi PM — Pemantapan Materi Kelas 9
   ========================================================================= */

:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --ink: #10201d;
  --muted: #64748b;
  --line: #e2e9e6;
  --line-strong: #cfded9;

  --primary: #0f766e;
  --primary-700: #0b5f58;
  --primary-soft: #e6f4f1;

  --green: #16a34a;
  --green-soft: #f0fdf4;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 12px 32px -22px rgba(15, 32, 29, 0.38);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(820px 420px at 8% -12%, rgba(15, 118, 110, 0.09), transparent 62%),
    radial-gradient(760px 420px at 102% 0%, rgba(245, 158, 11, 0.08), transparent 62%);
}

body.modal-open {
  overflow: hidden;
}

h1, h2, h3, p {
  margin-top: 0;
}

:where(button, a, input, select, textarea):focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------- shell -------------------------------- */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px clamp(16px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
  flex: 0 0 auto;
}

.brand-logo.is-missing {
  display: none;
}

.brand-text {
  min-width: 0;
}

.brand-kicker {
  margin: 0 0 1px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.brand-title {
  margin: 0;
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.brand-title span {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: #edf3f1;
  border: 1px solid #e1ebe8;
  flex: 0 0 auto;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  padding: 8px 20px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  background: #fff;
  color: var(--primary-700);
  box-shadow: 0 2px 8px -4px rgba(15, 32, 29, 0.35);
}

.page {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 30px) clamp(16px, 4vw, 40px) 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-footer {
  margin-top: auto;
  padding: 4px 16px 26px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.app-footer p {
  margin: 0;
}

/* --------------------------------- shared -------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.muted {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  transition: background 0.18s ease, border-color 0.18s ease,
    color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #12867c, var(--primary));
  box-shadow: 0 7px 18px -10px rgba(15, 118, 110, 0.75);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #0f7a70, var(--primary-700));
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line);
  color: #334155;
}

.btn-ghost:hover:not(:disabled) {
  background: #f8faf9;
  border-color: var(--line-strong);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary-700);
  border-color: #cce9e3;
}

.btn-soft:hover:not(:disabled) {
  background: #d9efeb;
}

.btn-danger-ghost {
  background: #fff;
  border-color: #fecaca;
  color: #b91c1c;
}

.btn-danger-ghost:hover:not(:disabled) {
  background: #fef2f2;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 14.5px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
  flex: 0 0 auto;
}

.icon-btn:hover {
  background: #f1f5f4;
  border-color: var(--line-strong);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* -------------------------------- toolbar -------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 13px 15px;
}

.date-nav,
.toolbar-actions,
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.date-field {
  position: relative;
  display: flex;
  align-items: center;
}

.date-field .field-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.date-field input {
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
}

.date-field input:hover {
  border-color: #b9cdc7;
}

.input,
.select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
}

.select {
  padding-right: 34px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}

.input:hover,
.select:hover {
  border-color: #b9cdc7;
}

/* -------------------------------- layout --------------------------------- */

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.session-panel {
  padding: 17px;
  position: sticky;
  top: 88px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15.5px;
  letter-spacing: -0.01em;
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef3f2;
  color: #475569;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  max-height: calc(100vh - 235px);
  padding-right: 3px;
}

.session-list::-webkit-scrollbar {
  width: 6px;
}

.session-list::-webkit-scrollbar-thumb {
  background: #d7e2df;
  border-radius: 999px;
}

.session-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 12px;
  gap: 10px;
  align-items: start;
  width: 100%;
  padding: 12px;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease,
    box-shadow 0.18s ease;
}

.session-card:hover {
  border-color: #a8d8d0;
  background: #fbfefd;
}

.session-card.is-active {
  border-color: var(--primary);
  background: #f1faf8;
  box-shadow: inset 3px 0 0 var(--primary);
}

.session-time {
  padding: 5px 6px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary-700);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: anywhere;
}

.session-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.session-materi {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.session-meta {
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.progress {
  height: 5px;
  margin-top: 3px;
  border-radius: 999px;
  background: #edf3f1;
  overflow: hidden;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2dd4bf, var(--primary));
  transition: width 0.25s ease;
}

.session-progress {
  font-size: 10.8px;
  color: var(--muted);
}

.session-chevron {
  align-self: center;
  color: #9aaca7;
  font-size: 20px;
  line-height: 1;
}

.skeleton-card {
  height: 78px;
  border-radius: 12px;
  background: linear-gradient(90deg, #f1f5f4 25%, #e6eeeb 37%, #f1f5f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* --------------------------------- empty --------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 52px 24px;
  text-align: center;
  border: 1px dashed #d5e2de;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfefd, #f6fbfa);
}

.empty.small {
  padding: 26px 16px;
}

.empty-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
  border-radius: 16px;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty h3 {
  margin: 0;
  font-size: 15px;
}

.empty p {
  max-width: 36ch;
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}

/* ------------------------------- attendance ------------------------------ */

.attendance-panel {
  padding: 20px;
  min-height: 460px;
}

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

.attendance-title-wrap {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
}

.attendance-title {
  margin: 0;
  font-size: clamp(19px, 2.3vw, 24px);
  line-height: 1.25;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.attendance-sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.att-head-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.stat-row {
  display: grid;
  grid-template-columns: 1.15fr repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 16px 0;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.stat span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat strong {
  font-size: 20px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat small {
  font-size: 10.5px;
  color: var(--muted);
}

.stat-total {
  background: #f8fafc;
}

.stat-hadir {
  border-color: #bbf7d0;
  background: var(--green-soft);
}

.stat-hadir strong {
  color: #15803d;
}

.stat-izin {
  border-color: #bfdbfe;
  background: var(--blue-soft);
}

.stat-izin strong {
  color: #1d4ed8;
}

.stat-sakit {
  border-color: #fde68a;
  background: var(--amber-soft);
}

.stat-sakit strong {
  color: #b45309;
}

.stat-alpha {
  border-color: #fecaca;
  background: var(--red-soft);
}

.stat-alpha strong {
  color: #b91c1c;
}

.att-tools {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.search-wrap {
  position: relative;
  flex: 1 1 200px;
  min-width: 170px;
}

.search-wrap svg {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 36px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
}

.search-wrap input::placeholder {
  color: #9aa9a5;
}

.search-wrap input:hover {
  border-color: #b9cdc7;
}

.search-wrap input:focus {
  border-color: var(--primary);
}

/* ------------------------------- students -------------------------------- */

.student-list {
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.student-head,
.student-row {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto 210px;
  gap: 12px;
  align-items: center;
}

.student-head {
  padding: 8px 14px;
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.student-head span:nth-child(2) {
  justify-self: start;
}

.student-row {
  position: relative;
  padding: 9px 14px;
  background: #fff;
  border-bottom: 1px solid #eef3f2;
  transition: background 0.15s ease;
}

.student-row:last-child {
  border-bottom: 0;
}

.student-row:hover {
  background: #fcfefd;
}

.student-row.is-hadir {
  box-shadow: inset 3px 0 0 #22c55e;
}

.student-row.is-izin {
  box-shadow: inset 3px 0 0 #3b82f6;
}

.student-row.is-sakit {
  box-shadow: inset 3px 0 0 #f59e0b;
}

.student-row.is-alpha {
  box-shadow: inset 3px 0 0 #ef4444;
}

.student {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  user-select: none;
}

.avatar-sm {
  width: 31px;
  height: 31px;
  font-size: 10.5px;
}

.student-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.student-name {
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.student-sub {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.student-sub em {
  font-style: normal;
  font-weight: 650;
  color: #b45309;
}

.status-group {
  display: flex;
  gap: 3px;
  justify-self: start;
  padding: 3px;
  border-radius: 10px;
  background: #f0f5f3;
}

.status-btn {
  border: 0;
  border-radius: 7px;
  padding: 6px 9px;
  background: transparent;
  color: #5b6b67;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.status-btn:hover {
  background: rgba(255, 255, 255, 0.75);
}

.status-btn.status-hadir.is-active {
  background: #16a34a;
  color: #fff;
  box-shadow: 0 3px 9px -4px rgba(22, 163, 74, 0.75);
}

.status-btn.status-izin.is-active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 3px 9px -4px rgba(37, 99, 235, 0.75);
}

.status-btn.status-sakit.is-active {
  background: #d97706;
  color: #fff;
  box-shadow: 0 3px 9px -4px rgba(217, 119, 6, 0.75);
}

.status-btn.status-alpha.is-active {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 3px 9px -4px rgba(220, 38, 38, 0.75);
}

.keterangan-input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfc;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}

.keterangan-input::placeholder {
  color: #a5b3af;
}

.keterangan-input:hover {
  border-color: #c7d8d3;
}

.keterangan-input:focus {
  background: #fff;
  border-color: var(--primary);
  outline: 3px solid rgba(20, 184, 166, 0.14);
  outline-offset: 0;
}

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 13px 0 2px;
  border-top: 1px dashed #d9e4e1;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55), #fff 42%);
}

.save-info {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.save-info strong {
  font-weight: 750;
}

.save-info .warn {
  color: #b45309;
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 42px 16px;
  font-size: 13px;
  color: var(--muted);
}

.spinner {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid #d8e3e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --------------------------------- rekap --------------------------------- */

.rekap-toolbar {
  align-items: flex-end;
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.field-inline .input,
.field-inline .select {
  height: 38px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

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

.summary-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.summary-card span {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-card strong {
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.summary-card.is-accent {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #12867c, #0b5f58);
}

.summary-card.is-accent span {
  color: rgba(255, 255, 255, 0.78);
}

.table-card {
  overflow: hidden;
}

.table-head {
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.table-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.table-wrap {
  overflow-x: auto;
}

.rekap-table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
  font-size: 13px;
}

.rekap-table th {
  padding: 10px 14px;
  background: #f8faf9;
  border-bottom: 1px solid var(--line);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  color: var(--muted);
  white-space: nowrap;
}

.rekap-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #eef3f2;
  vertical-align: middle;
}

.rekap-table tbody tr:last-child td {
  border-bottom: 0;
}

.rekap-table tbody tr:hover {
  background: #fbfdfc;
}

.rekap-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rekap-table td.is-hadir {
  font-weight: 750;
  color: #15803d;
}

.rekap-table td.is-alpha {
  font-weight: 750;
  color: #b91c1c;
}

.table-student {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 180px;
}

.table-student strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.3;
}

.table-student small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3f2;
  color: #475569;
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
}

.percent {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.mini-progress {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #edf3f1;
  overflow: hidden;
}

.mini-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.percent small {
  width: 40px;
  font-size: 11.5px;
  font-weight: 750;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.percent.is-good .mini-progress span {
  background: #16a34a;
}

.percent.is-good small {
  color: #15803d;
}

.percent.is-warn .mini-progress span {
  background: #f59e0b;
}

.percent.is-warn small {
  color: #b45309;
}

.percent.is-bad .mini-progress span {
  background: #ef4444;
}

.percent.is-bad small {
  color: #b91c1c;
}

.table-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

/* --------------------------------- modal --------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(660px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 34px 90px -24px rgba(15, 23, 42, 0.55);
  animation: dialog-in 0.18s ease;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.modal-head h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.015em;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-top: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field > span {
  font-size: 12px;
  font-weight: 650;
  color: #3f4f4b;
}

.field em {
  font-style: normal;
  color: var(--red);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
  min-height: 58px;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #b9cdc7;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(20, 184, 166, 0.14);
  outline-offset: 0;
}

.field-wide {
  grid-column: 1 / -1;
}

.form-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  font-size: 11.5px;
  color: #92400e;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

/* --------------------------------- toast --------------------------------- */

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(430px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  padding: 12px 15px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.65);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast-success {
  background: #0f766e;
}

.toast-error {
  background: #b91c1c;
}

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .student-head,
  .student-row {
    grid-template-columns: minmax(180px, 1fr) auto 170px;
    gap: 9px;
  }

  .status-btn {
    padding: 6px 7px;
    font-size: 11px;
  }
}

@media (max-width: 1000px) {
  .topbar {
    position: static;
  }

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

  .session-panel {
    position: static;
  }

  .session-list {
    max-height: 320px;
  }

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

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

@media (max-width: 760px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .tabs {
    align-self: flex-start;
  }

  .toolbar {
    align-items: stretch;
  }

  .date-nav {
    width: 100%;
  }

  .date-field {
    flex: 1;
  }

  .date-field input {
    width: 100%;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions .btn {
    flex: 1;
  }

  .attendance-panel {
    padding: 15px;
    min-height: 0;
  }

  .attendance-head {
    flex-direction: column;
  }

  .att-head-actions {
    width: 100%;
  }

  .att-head-actions .btn {
    flex: 1;
  }

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

  .stat-total {
    grid-column: 1 / -1;
  }

  .student-head {
    display: none;
  }

  .student-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    padding: 12px 13px;
  }

  .status-group {
    width: 100%;
  }

  .status-btn {
    flex: 1;
    padding: 7px 4px;
    font-size: 11.5px;
  }

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

  .save-bar .btn {
    width: 100%;
  }

  .rekap-toolbar {
    align-items: stretch;
  }

  .toolbar-group {
    width: 100%;
  }

  .field-inline {
    flex: 1 1 140px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-wide {
    grid-column: auto;
  }

  .modal-dialog {
    padding: 18px;
  }

  .rekap-table {
    min-width: 760px;
  }
}

@media (max-width: 460px) {
  .page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

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

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

  .search-wrap {
    flex-basis: 100%;
  }

  .toast-stack {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
