/*
  Tema "Buku Log Lapangan": kertas kerja + clipboard, bukan dashboard SaaS generik.
  Palet: slate gelap (header/aksi utama), kertas krem-abu terang (kanvas),
  amber (aksen aktif/tepat waktu), hijau/biru/merah (status).
*/

:root {
  --ink: #1c2b33;
  --ink-soft: #46586326;
  --paper: #f6f5f1;
  --paper-card: #ffffff;
  --line: #dedad0;
  --amber: #e8952c;
  --amber-dark: #b5711a;
  --ok: #2f8a5b;
  --ok-bg: #e3f3ea;
  --progress: #2f6f9c;
  --progress-bg: #e4eef5;
  --blocked: #c14a3c;
  --blocked-bg: #fbe7e3;
  --muted: #6b7178;
  --radius: 10px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px);
  background-size: 100% 32px;
}

a { color: var(--progress); }

.wrap {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.wrap.wide { max-width: 900px; }

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.topbar .who { font-weight: 600; font-size: 17px; }
.topbar .streak {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #ffd699;
  margin-top: 2px;
}
.topbar form { margin: 0; }
.btn-logout {
  background: transparent;
  border: 1px solid #ffffff55;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  min-height: 36px;
}

/* Cards */
.card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.card h2 {
  margin: 0 0 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Inputs */
textarea, input[type=text], input[type=password], select {
  width: 100%;
  font-size: 16px;
  font-family: inherit;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
label { font-size: 13px; color: var(--muted); display: block; margin: 10px 0 4px; }

button, .btn {
  min-height: 48px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px 18px;
}
.btn-primary { background: var(--amber); color: #2a1a03; width: 100%; }
.btn-primary:active { background: var(--amber-dark); }
.btn-secondary { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; font-size: 13px; padding: 6px 12px; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-selesai { background: var(--ok-bg); color: var(--ok); }
.badge-progres { background: var(--progress-bg); color: var(--progress); }
.badge-terhambat { background: var(--blocked-bg); color: var(--blocked); }
.badge-belum { background: #eee; color: var(--muted); }

/* Confirmation card */
.confirm-card { border-left: 4px solid var(--amber); }
.confirm-row { display: flex; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.confirm-row:last-child { border-bottom: none; }
.confirm-row .k { width: 90px; color: var(--muted); flex-shrink: 0; }
.confirm-row .v { font-weight: 600; }
.confirm-actions { display: flex; gap: 8px; margin-top: 14px; }
.confirm-actions button { flex: 1; }

/* Leaderboard */
table.leaderboard { width: 100%; border-collapse: collapse; font-size: 14px; }
table.leaderboard td, table.leaderboard th {
  padding: 8px 4px; text-align: left; border-bottom: 1px solid var(--line);
}
table.leaderboard .rank { font-family: var(--font-mono); color: var(--muted); width: 24px; }
table.leaderboard .me { background: #fff6e8; }

/* History list */
.log-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 14px;
}
.log-entry .meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.log-entry .date { font-family: var(--font-mono); color: var(--muted); font-size: 13px; }
.log-entry .blocker { color: var(--blocked); margin-top: 4px; font-size: 13px; }

/* Admin */
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }
.staff-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--paper-card); }
.staff-card .name { font-weight: 700; font-size: 14px; }
.staff-card .summary { font-size: 12px; color: var(--muted); margin-top: 4px; }

.alert-item { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 13px; }
.alert-terhambat, .alert-kendala_berulang { background: var(--blocked-bg); color: var(--blocked); }
.alert-belum_submit { background: #fff3d6; color: #8a6414; }

.chat-log { max-height: 260px; overflow-y: auto; margin-bottom: 10px; }
.chat-msg { padding: 8px 10px; border-radius: 8px; margin-bottom: 6px; font-size: 14px; }
.chat-msg.user { background: var(--progress-bg); }
.chat-msg.bot { background: var(--paper); border: 1px solid var(--line); }
.chat-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select, .filters input { width: auto; }

table.admin-log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin-log-table th, table.admin-log-table td {
  border-bottom: 1px solid var(--line); padding: 6px; text-align: left; vertical-align: top;
}
table.admin-log-table th { color: var(--muted); font-weight: 600; }

.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.error-box { background: var(--blocked-bg); color: var(--blocked); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.canvas-wrap { background: var(--paper-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 16px; }

.login-title { text-align: center; margin: 24px 0 8px; }
.login-title .stamp {
  display: inline-block; border: 2px solid var(--ink); color: var(--ink);
  padding: 4px 12px; border-radius: 6px; font-weight: 700; letter-spacing: 0.05em;
  transform: rotate(-2deg);
}
.login-heading { font-size: 19px; line-height: 1.35; margin: 16px 0 6px; color: var(--ink); }
.login-sub { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.register-link { text-align: center; font-size: 14px; color: var(--muted); margin-top: 14px; }
.register-link a { color: var(--amber-dark); font-weight: 600; text-decoration: none; }
.register-link a:hover { text-decoration: underline; }

/* Toggle switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch-row .label { font-size: 14px; }
.switch-row .label .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.switch {
  position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0; background-color: #ccc7ba;
  transition: 0.15s; border-radius: 999px;
}
.switch .slider::before {
  position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background-color: white; transition: 0.15s; border-radius: 50%;
}
.switch input:checked + .slider { background-color: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Mic button */
.textarea-row { position: relative; }
.btn-mic {
  position: absolute; right: 8px; bottom: 8px; width: 40px; height: 40px;
  border-radius: 50%; background: var(--paper-card); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  min-height: unset; padding: 0;
}
.btn-mic.recording { background: var(--blocked); border-color: var(--blocked); }
.btn-mic.recording svg { fill: #fff; }
.btn-mic svg { fill: var(--ink); width: 18px; height: 18px; }
.mic-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* User management table */
table.user-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.user-table th, table.user-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.status-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.status-pill.aktif { background: var(--ok-bg); color: var(--ok); }
.status-pill.nonaktif { background: #eee; color: var(--muted); }
.email-tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.email-tag { background: var(--progress-bg); color: var(--progress); padding: 4px 10px; border-radius: 999px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.email-tag button { background: none; border: none; color: var(--progress); cursor: pointer; font-size: 14px; padding: 0; min-height: unset; font-weight: 700; }
