:root {
  --primary: #0b5cab;
  --primary-dark: #08417c;
  --primary-light: #e8f1fb;
  --accent: #f2a900;
  --text: #1f2937;
  --muted: #6b7280;
  --bg: #f4f6f9;
  --white: #ffffff;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(11, 92, 171, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg) 320px);
  color: var(--text);
  min-height: 100vh;
}

header.topbar {
  background: var(--primary);
  color: #fff;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

header.topbar .logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 18px;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
}

header.topbar p {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.85;
}

.container {
  max-width: 640px;
  margin: 36px auto;
  padding: 0 16px 60px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

.step-label {
  font-size: 13px;
  color: var(--primary);
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

h2.title {
  margin: 0 0 4px;
  font-size: 22px;
}

p.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}

.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.choice-btn {
  border: 2px solid #e2e8f0;
  background: var(--white);
  border-radius: var(--radius);
  padding: 26px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.choice-btn .icon {
  font-size: 30px;
  display: block;
  margin-bottom: 10px;
}

.choice-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 6px 0 22px;
}

.option-btn {
  border: 2px solid #e2e8f0;
  background: var(--white);
  border-radius: 10px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s ease;
  color: var(--text);
}

.option-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-btn.selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin: 16px 0 6px;
}

label:first-of-type { margin-top: 0; }

input[type="text"],
input[type="tel"],
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid #dfe4ea;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
  background: #fbfcfe;
}

input:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

button.primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 13px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex: 1;
  transition: background 0.15s ease;
}

button.primary:hover { background: var(--primary-dark); }

button.secondary {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid #dfe4ea;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}

button.secondary:hover { background: #f3f4f6; }

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
}

.alert.error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.alert.info {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid #bfdbfe;
}

.guest-preview {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.guest-preview h3 {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--primary-dark);
}

.guest-preview .row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 4px 0;
  border-bottom: 1px dashed #cfe0f5;
}

.guest-preview .row:last-child { border-bottom: none; }
.guest-preview .row span:first-child { color: var(--muted); }
.guest-preview .row span:last-child { font-weight: 600; text-align: right; }

.success-box {
  text-align: center;
  padding: 20px 0;
}

.success-box .check {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: #ecfdf3;
  color: var(--success);
  font-size: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}

.success-box h2 { margin: 0 0 6px; }
.success-box p { color: var(--muted); margin-bottom: 10px; }

#notify-wrap {
  border-top: 1px dashed #e2e8f0;
  padding-top: 18px;
  margin-top: 6px;
}

.notify-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1.5px solid #dfe4ea;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: #fbfcfe;
  transition: all 0.15s ease;
}

.notify-btn:hover {
  border-color: #25D366;
  background: #f0fdf4;
}

.notify-btn .wa-icon {
  color: #25D366;
  font-size: 16px;
  margin-right: 6px;
}

.notify-btn.sent {
  opacity: 0.6;
  cursor: default;
}

/* Survey modal (admin.html) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px 26px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
}

.modal-box h2 { margin: 0 0 6px; }
.modal-box p { color: var(--muted); margin-bottom: 24px; font-size: 14px; }

.survey-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.survey-btn {
  border: 2px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 22px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.15s ease;
  background: #fff;
}

.survey-btn .icon { font-size: 32px; display: block; margin-bottom: 8px; }

.survey-btn.puas:hover { border-color: var(--success); background: #ecfdf3; }
.survey-btn.tidak-puas:hover { border-color: var(--danger); background: #fef2f2; }

.petugas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.petugas-btn {
  border: 2px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 16px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  transition: all 0.15s ease;
  background: #fff;
}

.petugas-btn:hover { border-color: var(--primary, #0b5cab); background: #eef4fc; }

.petugas-tag {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}

.status-badge.menunggu { background: #fef9c3; color: #854d0e; }
.status-badge.selesai { background: #dcfce7; color: #166534; }
.status-badge.puas { background: #dcfce7; color: #166534; }
.status-badge.tidak_puas { background: #fee2e2; color: #991b1b; }
.status-badge.belum-survei { background: #f3f4f6; color: #6b7280; }

.btn-tiny {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-tiny:hover { background: var(--primary-dark); }

.btn-tiny.outline {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-tiny.outline:hover { background: var(--primary-light); }

.action-cell { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ---------- Toolbar / Filter ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

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

.toolbar .field label {
  margin: 0;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
}

.toolbar input[type="date"],
.toolbar input[type="text"],
.toolbar select {
  padding: 9px 10px;
  border: 1.5px solid #dfe4ea;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

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

.quick-filter-btn {
  border: 1.5px solid #dfe4ea;
  background: #fff;
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}

.quick-filter-btn:hover { border-color: var(--primary); }
.quick-filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.toolbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

/* ---------- Stat Cards ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
}

.stat-card .num { font-size: 24px; font-weight: 800; color: var(--primary-dark); }
.stat-card .lbl { font-size: 11.5px; color: var(--muted); margin-top: 2px; font-weight: 600; text-transform: uppercase; }
.stat-card.puas .num { color: var(--success); }
.stat-card.tidak-puas .num { color: var(--danger); }

/* ---------- Chart section ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
}

.chart-box h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text);
}

.chart-box canvas { max-height: 220px; }

@media (max-width: 760px) {
  .chart-grid { grid-template-columns: 1fr; }
  .toolbar-actions { margin-left: 0; width: 100%; }
}

/* ---------- Riwayat modal ---------- */
.modal-box.wide {
  max-width: 640px;
  text-align: left;
}

.riwayat-list {
  max-height: 360px;
  overflow-y: auto;
  margin: 10px 0 6px;
  text-align: left;
}

.riwayat-item {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.riwayat-item .top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.riwayat-item .date { font-size: 12px; color: var(--muted); }
.riwayat-item .ket { font-size: 13px; color: var(--text); margin-top: 4px; }

.footer-link {
  text-align: center;
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-link a { color: var(--primary); text-decoration: none; }

/* Admin page */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
}

th {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}

.badge.perizinan { background: #fef3c7; color: #92400e; }
.badge.non_perizinan { background: #dbeafe; color: #1e40af; }

.kategori-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 700;
  margin-left: 2px;
}
.kategori-tag.online { background: #dcfce7; color: #166534; }
.kategori-tag.offline { background: #f1f5f9; color: #475569; }

.edit-icon {
  cursor: pointer;
  font-size: 12px;
  opacity: 0.6;
}
.edit-icon:hover { opacity: 1; }

@media (max-width: 640px) {
  .choice-grid, .option-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 24px 18px; }
}
