@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  --ink: #172b3a;
  --muted: #6c7d89;
  --teal: #0f766e;
  --teal2: #14b8a6;
  --bg: #f0f5f6;
  --line: #e2eaec;
  --white: #fff;
  --red: #dc5b5b;
  --amber: #c88719;
  --shadow: 0 4px 24px rgba(15,50,60,.07);
  --shadow-lg: 0 12px 40px rgba(15,50,60,.10);
  --radius: 18px;
  --radius-sm: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.5;
  min-height: 100dvh;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { font: 800 30px/1.15 'Plus Jakarta Sans', sans-serif; margin-bottom: 8px; }
h2 { font: 800 21px/1.2 'Plus Jakarta Sans', sans-serif; margin-bottom: 6px; }
h3 { font: 700 15px/1.3 'Plus Jakarta Sans', sans-serif; margin-bottom: 12px; }

.shell {
  width: min(100% - 24px, 980px);
  margin: auto;
  padding: 20px 0 48px;
}

.hidden { display: none !important; }

/* ── Login ─────────────────────────────────────────────── */
.login-wrap {
  width: min(100%, 400px);
  margin: 6vh auto 0;
}

.brand-mark {
  width: 52px; height: 52px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--teal), var(--teal2));
  color: #fff;
  display: grid; place-items: center;
  font: 800 26px 'Plus Jakarta Sans';
  box-shadow: var(--shadow);
  margin-bottom: 4px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 800;
  color: var(--teal);
  text-transform: uppercase;
  margin: 16px 0 6px;
}
.eyebrow.light { color: #b9f6ec; margin: 0 0 8px; }

.muted, .hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ── Panel / Card ───────────────────────────────────────── */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 14px 0;
  box-shadow: var(--shadow);
}

/* ── Form controls ──────────────────────────────────────── */
label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #3d5260;
  letter-spacing: .3px;
  margin: 14px 0 0;
}

input:not([type=radio]):not([type=checkbox]):not([type=file]),
textarea,
select {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 1.5px solid #d8e4e7;
  border-radius: 11px;
  padding: 11px 13px;
  background: #f8fbfc;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
  font-size: 13.5px;
}

input:focus:not([type=radio]):not([type=checkbox]):not([type=file]),
textarea:focus,
select:focus {
  border-color: var(--teal2);
  box-shadow: 0 0 0 3px rgba(20,184,166,.14);
  background: #fff;
}

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

input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  display: inline-block !important;
  margin: 0 8px 0 0;
  padding: 0;
  vertical-align: middle;
  accent-color: var(--teal);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-weight: 700;
  font-size: 13px;
  transition: .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.97); }

.primary { background: var(--teal); color: #fff; }
.primary:hover:not(:disabled) { background: #0b5e57; }

.secondary { background: #e4f4f2; color: var(--teal); }
.secondary:hover:not(:disabled) { background: #ccedea; }

.ghost { background: #edf1f2; color: #4e6572; }
.ghost:hover:not(:disabled) { background: #e2e8ea; }

.small { padding: 8px 13px; font-size: 12px; }
.full { width: 100%; margin-top: 14px; }

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 16px;
  gap: 12px;
}
.topbar .eyebrow { margin: 0 0 2px; }
.topbar strong { font: 800 17px 'Plus Jakarta Sans'; }

/* ── Nav tabs ───────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 5px;
  background: #e2eaec;
  border-radius: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 18px;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  border: 0;
  background: transparent;
  color: #5e737c;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 15px;
  border-radius: 10px;
  white-space: nowrap;
  transition: .15s;
  flex-shrink: 0;
}
.tab.active {
  background: #fff;
  color: var(--teal);
  box-shadow: 0 2px 10px rgba(15,118,110,.10);
}

/* ── Welcome card ───────────────────────────────────────── */
.welcome-card {
  background: linear-gradient(130deg, #0d6b63, #12a899);
  border-radius: 20px;
  padding: 22px 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
}
.welcome-card h2 { font-size: 22px; margin-bottom: 2px; }
.welcome-card p { margin: 0; color: #d4fff9; font-size: 12.5px; }

.date-icon {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 15px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center;
  font-size: 24px;
}

/* ── Stats grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 14px 12px;
  min-width: 0;
}
.stat strong { display: block; font: 800 24px 'Plus Jakarta Sans'; color: var(--teal); }
.stat span { font-size: 10.5px; color: var(--muted); }

/* ── Section heading ────────────────────────────────────── */
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.section-heading .eyebrow { margin: 0 0 4px; }
.section-heading h2, .section-heading h3 { margin: 0; }

/* ── Status pill ────────────────────────────────────────── */
.status-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 6px 11px;
  border-radius: 20px;
  background: #eef2f3;
  color: #5e737c;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ── Status options ─────────────────────────────────────── */
.status-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0 20px;
}

.status-option { position: relative; }
.status-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.status-option span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  border: 1.5px solid var(--line);
  padding: 14px 6px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .15s;
}
.status-option input:checked + span {
  background: #e6f7f4;
  border-color: var(--teal2);
  color: var(--teal);
}

/* ── Camera section ─────────────────────────────────────── */
/* Tampilan seperti aplikasi kamera bawaan HP: viewfinder potret 3:4,
   tombol rana bulat di tengah bawah. */
.camera-section {
  background: #000;
  border-radius: 20px;
  overflow: hidden;
  margin: 4px 0 12px;
}

.camera-box {
  position: relative;
  /* lebar penuh, tetapi tinggi dibatasi 75% layar agar tombol rana tetap terlihat */
  width: min(100%, calc(75vh * 3 / 4));
  width: min(100%, calc(75dvh * 3 / 4));
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  background: #0d1f28;
  overflow: hidden;
}

.camera-box video,
.camera-box .photo-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* cover: isi penuh seperti kamera bawaan (hasil foto dipotong sama persis) */
  object-fit: cover;
  object-position: center;
  display: block;
  background: #0d1f28;
}
.camera-box video.mirror { transform: scaleX(-1); }   /* pratinjau kamera depan */

#captureCanvas { display: none; }

.camera-placeholder {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #6a8898;
  text-align: center;
  padding: 20px;
  pointer-events: none;
}
.camera-placeholder .cam-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.camera-placeholder p { font-size: 12px; margin: 0; color: #8fa9b5; }

.camera-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 16px 18px 18px;
  background: #000;
}
.cam-side {
  justify-self: start;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.cam-side.invisible { visibility: hidden; }
.cam-flip {
  justify-self: end;
  width: 46px; height: 46px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(255,255,255,.16);
  color: #fff;
  font-size: 20px;
  line-height: 1;
}
.shutter {
  width: 72px; height: 72px;
  border-radius: 50%;
  padding: 0;
  background: #fff;
  border: 4px solid #000;
  box-shadow: 0 0 0 3px #fff;
  transition: transform .1s, opacity .15s;
}
.shutter:active:not(:disabled) { transform: scale(.9); }
.shutter:disabled { opacity: .3; cursor: default; }

/* ── Location info ──────────────────────────────────────── */
.location-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 4px;
}
.location-row .hint { flex: 1; margin: 0; }

/* ── Submit ─────────────────────────────────────────────── */
.submit-status {
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  margin: 10px 0 0;
  color: var(--muted);
  min-height: 1.4em;
}

/* ── Page title ─────────────────────────────────────────── */
.page-title { margin: 8px 2px 16px; }
.page-title .eyebrow { margin: 0 0 5px; }
.page-title h2 { font-size: 25px; }

/* ── History items ──────────────────────────────────────── */
.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.history-item:last-child { border: 0; padding-bottom: 0; }
.history-item strong { font-size: 13px; line-height: 1.4; }
.history-item small { display: block; color: var(--muted); margin-top: 3px; font-size: 11.5px; line-height: 1.5; }

.pill {
  font-size: 10px;
  font-weight: 800;
  border-radius: 20px;
  padding: 5px 10px;
  background: #e6f7f4;
  color: var(--teal);
  white-space: nowrap;
  height: max-content;
  margin-top: 2px;
}
.pill.late { background: #fff4de; color: var(--amber); }
.pill.bad { background: #fff0f0; color: var(--red); }

/* ── Form grid ──────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

/* ── Tables ─────────────────────────────────────────────── */
.search {
  max-width: 220px !important;
  margin: 0 !important;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border-radius: 12px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
  white-space: nowrap;
}
th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
}
tr:last-child td { border-bottom: 0; }
th {
  color: #6e818a;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  font-weight: 700;
  background: #f6f9fa;
}
th:first-child { border-radius: 10px 0 0 0; }
th:last-child { border-radius: 0 10px 0 0; }

td button {
  border: 0;
  background: #e8f4f3;
  color: var(--teal);
  padding: 5px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  margin-right: 4px;
  transition: .15s;
}
td button:hover { background: #c8e9e5; }

/* ── Button row ─────────────────────────────────────────── */
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.button-row .btn { flex: 1; min-width: 100px; }

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -160%);
  background: #132e38;
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  z-index: 999;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  max-width: calc(100vw - 32px);
  text-align: center;
}
.toast.show { transform: translate(-50%, 0); }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ── Footer ─────────────────────────────────────────────── */
footer {
  text-align: center;
  color: #9aadb5;
  font-size: 11px;
  padding: 28px 0 8px;
}
footer span { padding: 0 6px; }

/* ── Piket picker ───────────────────────────────────────── */
#piketStudentPicker {
  border-left: 3px solid var(--teal2);
}
#piketStudentPicker h3 { color: var(--teal); }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 680px) {
  .shell { width: min(100% - 20px, 980px); padding-top: 12px; }

  h1 { font-size: 26px; }
  h2 { font-size: 19px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:last-child { grid-column: span 2; }

  .panel { padding: 16px; border-radius: 15px; }
  .welcome-card { padding: 18px 16px; }
  .welcome-card h2 { font-size: 19px; }

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

  .button-row .btn { min-width: 0; }

  .section-heading { align-items: flex-start; }
  .search { max-width: 140px !important; }

  .tabs { gap: 2px; }
  .tab { padding: 9px 12px; }
}

@media (max-width: 420px) {
  .status-options { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .status-option span { padding: 11px 4px; font-size: 11px; }
}
