:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;

  /* Status Triase */
  --red: #dc2626;
  --red-bg: #fef2f2;
  --yellow: #d97706;
  --yellow-bg: #fffbeb;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --slate: #475569;
  --slate-bg: #f1f5f9;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--card-bg);
  padding: 18px 20px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.header-badge {
  display: inline-block;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.app-title { font-size: 20px; font-weight: 800; color: #0f172a; line-height: 1.3; }
.app-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

/* Progress Bar */
.progress-wrap {
  background: var(--border);
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-fill {
  background: var(--primary);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

/* Card Box */
.step-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  flex: 1;
}
.step-tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.step-question {
  font-size: 18px;
  font-weight: 700;
  margin: 8px 0 6px 0;
  color: #1e293b;
}
.step-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* Form Inputs */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* Option Cards (Skala 0-3 & Pilihan Ganda Ramah Siswa) */
.options-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.opt-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  min-height: 58px;
  transition: all 0.15s ease;
  user-select: none;
}
.opt-btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.opt-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
}
.opt-emoji { font-size: 26px; line-height: 1; flex-shrink: 0; }
.opt-content { flex: 1; }
.opt-title { font-size: 15px; font-weight: 700; color: #1e293b; }
.opt-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Checklist Item */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  margin-bottom: 8px;
  min-height: 52px;
}
.check-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--red);
}
.check-title { font-size: 15px; font-weight: 600; color: #1e293b; }
.check-desc { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Buttons & Actions */
.btn-row {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.btn {
  flex: 1;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { background: #f1f5f9; color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover { background: #1eb954; }

/* Layar Darurat Merah (Tanda Bahaya) */
.danger-banner {
  background: var(--red-bg);
  border: 2px solid var(--red);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  color: #7f1d1d;
  animation: pulse-border 2s infinite;
}
@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}
.danger-header { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; color: var(--red); margin-bottom: 8px; }

/* Layar Hasil Siswa */
.result-card {
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}
.result-card.merah { background: var(--red-bg); border: 2px solid var(--red); color: #7f1d1d; }
.result-card.kuning { background: var(--yellow-bg); border: 2px solid var(--yellow); color: #78350f; }
.result-card.hijau { background: var(--green-bg); border: 2px solid var(--green); color: #14532d; }
.result-card.putih { background: var(--slate-bg); border: 2px solid var(--slate); color: #1e293b; }

.result-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.result-badge.merah { background: var(--red); color: #fff; }
.result-badge.kuning { background: var(--yellow); color: #fff; }
.result-badge.hijau { background: var(--green); color: #fff; }
.result-badge.putih { background: var(--slate); color: #fff; }

.result-title { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.result-text { font-size: 15px; line-height: 1.6; text-align: left; margin: 16px 0; }
.action-list { text-align: left; padding-left: 20px; margin: 12px 0; font-size: 15px; }
.action-list li { margin-bottom: 8px; }

/* Tooltip / Bantuan Istilah */
.term-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  border: 1px dashed #94a3b8;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #334155;
  margin-left: 6px;
}

/* Admin Dashboard Specific */
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.tab-filter {
  display: inline-flex;
  background: #e2e8f0;
  padding: 4px;
  border-radius: var(--radius-sm);
  gap: 4px;
}
.tab-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #475569;
}
.tab-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-box {
  background: var(--card-bg);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.stat-val { font-size: 24px; font-weight: 800; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Responsive Table */
.table-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  background: #f8fafc;
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:hover { background: #f8fafc; }
.data-table tr.row-merah { background: #fff5f5; }
.data-table tr.row-kuning { background: #fffbeb; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}
.modal-card {
  background: #fff;
  border-radius: var(--radius);
  max-width: 540px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

/* ============ ADMIN DASHBOARD ============ */

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.title-section {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card-bg);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card { padding: 20px; }

.stat-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.stat-big {
  font-size: 40px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
  margin: 4px 0;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tri-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.tri-cell {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
}

.tri-cell span { font-size: 16px; }

.tri-merah { background: var(--red); }
.tri-kuning { background: #d97706; }
.tri-hijau { background: #16a34a; }
.tri-putih { background: #475569; }

.section-title {
  font-size: 17px;
  font-weight: 800;
  margin: 28px 0 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-bg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}

.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f1f5f9;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: #f8fafc; }

.tri-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.wa-btn {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  background: #25d366;
  color: #fff !important;
  font-weight: 700;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
}

.wa-btn:hover { background: #1ebe5b; }

.login-card {
  max-width: 400px;
  margin: 60px auto;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin: 8px 0 4px;
}

.login-sub {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.5;
}

.login-input {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
}

.login-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.login-error {
  margin-top: 10px;
  padding: 10px;
  background: #fef2f2;
  color: var(--red);
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
}

.error-banner {
  background: #fef2f2;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.btn-secondary {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

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

