/* =========================================================
   CLEANIN VOUCHER — design tokens
   Palette: deep teal (brand/ink), warm citrus (discount/accent),
   soft aqua (surface), paper white (background).
   Signature element: the perforated ticket-stub card used for
   every voucher, on screen and on the printed sheet.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --ink: #12302C;
  --teal: #0F5C56;
  --teal-deep: #0A3E3A;
  --aqua: #DDEEEA;
  --aqua-soft: #EFF7F5;
  --paper: #FAF9F4;
  --citrus: #F2B705;
  --citrus-deep: #C88F00;
  --red: #C1443B;
  --red-soft: #F7E4E2;
  --green: #2E7D4F;
  --green-soft: #E3F1E7;
  --line: #C9DAD6;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 14px;
  --shadow: 0 2px 10px rgba(18, 48, 44, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(15,92,86,0.07) 1px, transparent 0);
  background-size: 22px 22px;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  color: var(--teal-deep);
  margin: 0 0 8px 0;
  letter-spacing: -0.01em;
}

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

.mono { font-family: var(--font-mono); letter-spacing: 0.02em; }

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:focus-visible { outline: 3px solid var(--citrus); outline-offset: 2px; }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); }

.btn-accent { background: var(--citrus); color: var(--teal-deep); }
.btn-accent:hover { background: var(--citrus-deep); color: #fff; }

.btn-ghost { background: transparent; color: var(--teal); border-color: var(--line); }
.btn-ghost:hover { background: var(--aqua-soft); }

.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Cards / surfaces ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
  margin-bottom: 6px;
}

/* ---------- Forms ---------- */
label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-deep);
  margin-bottom: 6px;
}
input, select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15,92,86,0.12);
}
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.help { font-size: 12.5px; color: #5c7873; margin-top: 4px; }
.error-text { font-size: 13px; color: var(--red); margin-top: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(250,249,244,0.9);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--teal-deep);
  text-decoration: none;
}
.brand .mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--teal);
  color: var(--citrus);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
}

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.pill-idle { background: var(--aqua); color: var(--teal-deep); }
.pill-idle::before { background: var(--teal); }
.pill-active { background: var(--green-soft); color: var(--green); }
.pill-active::before { background: var(--green); }
.pill-expired { background: var(--red-soft); color: var(--red); }
.pill-expired::before { background: var(--red); }

/* =========================================================
   SIGNATURE ELEMENT — the ticket / voucher stub
   ========================================================= */
.ticket {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ticket-main {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ticket-brand {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--teal);
}
.ticket-discount {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: var(--teal-deep);
  line-height: 1;
}
.ticket-code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #5c7873;
}
.ticket-meta { font-size: 13px; color: #47615c; }
.ticket-meta strong { color: var(--ink); }

.ticket-stub {
  position: relative;
  width: 150px;
  background: var(--aqua-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-left: 2px dashed var(--line);
}
.ticket-stub img, .ticket-stub canvas { width: 100%; height: auto; }

/* perforation notches */
.ticket::before, .ticket::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  background: var(--paper);
  border-radius: 50%;
  right: 150px;
  margin-right: -9px;
  z-index: 2;
}
.ticket::before { top: -9px; }
.ticket::after { bottom: -9px; }

/* ---------- Tabs (admin dashboard) ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 24px;
}
.tab {
  padding: 12px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: #5c7873;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  margin-bottom: -1.5px;
}
.tab.active { color: var(--teal-deep); border-bottom-color: var(--citrus); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Scanner ---------- */
.scanner-box {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: #000;
  aspect-ratio: 1/1;
  max-width: 420px;
}
#scanner-view { width: 100%; height: 100%; }

/* ---------- Role picker (index page) ---------- */
.role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 28px;
}
.role-card {
  text-decoration: none;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.role-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(18,48,44,0.12);
  border-color: var(--teal);
}
.role-card .icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--teal);
  color: var(--citrus);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.role-card h2 { font-size: 19px; }
.role-card p { margin: 0; color: #47615c; font-size: 14px; line-height: 1.5; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 8px 6px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
th {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #5c7873;
}
.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s ease;
}
.btn-delete:hover {
  background: var(--red-soft);
}
@media (max-width:620px) {
  th, td { padding: 6px 4px; font-size: 11px; }
  th { font-size: 9px; }
  .pill { font-size: 10px; padding: 2px 6px; }
}

/* ---------- Print sheet ---------- */
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .print-sheet {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  .ticket { break-inside: avoid; box-shadow: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 620px) {
  .role-grid { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; }
  .ticket { grid-template-columns: 1fr; }
  .ticket-stub { border-left: none; border-top: 2px dashed var(--line); width: 100%; }
  .ticket::before, .ticket::after { display: none; }
}

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card { width: 100%; max-width: 380px; }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #5c7873;
}

/* Mobile table responsiveness */
@media (max-width:620px) {
  table { font-size:12px; }
  th, td { padding:8px 5px; font-size:12px; }
  th { font-size:10px; letter-spacing:0.06em; }
  .mono { font-size:10px; }
  .pill { font-size:10px; padding:3px 8px; }
}

@media (max-width:480px) {
  #tabel-voucher { overflow-x:auto; }
  table { min-width:600px; }
  th, td { padding:6px 4px; font-size:11px; }
  .field-row { flex-direction:column; gap:8px; }
}

