/* ============================================================
   QR Work Report — Roto-Rooter
   Navy / merah / putih-abu. Mobile-first, tanpa dependensi.
   ============================================================ */
:root {
  --navy-900: #0b1f3d;
  --navy-800: #10294e;
  --navy-700: #16355f;
  --navy-100: #dbe4f0;
  --red-600: #d31920;
  --red-700: #b3121a;
  --bg: #f3f5f9;
  --card: #ffffff;
  --line: #dfe5ee;
  --text: #16233a;
  --muted: #5b6b84;
  --ok-bg: #e7f6ec; --ok-fg: #1c7c3d;
  --warn-bg: #fdf3e3; --warn-fg: #9a6b16;
  --err-bg: #fdecec; --err-fg: #b3121a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 31, 61, .07), 0 4px 14px rgba(11, 31, 61, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--navy-700); }
code { background: #eef2f8; border-radius: 5px; padding: 1px 6px; font-size: .88em; word-break: break-all; }
.break { overflow-wrap: anywhere; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .86em; }
.t-right { text-align: right; }
.grow { flex: 1 1 180px; min-width: 0; }

.h-big { font-size: 1.45rem; margin: 0 0 .25rem; line-height: 1.25; color: var(--navy-900); }
.h-med { font-size: 1.08rem; margin: 0 0 .6rem; color: var(--navy-900); }
.crumb { margin: 0 0 .3rem; font-size: .85rem; color: var(--muted); }
.crumb a { color: var(--muted); }

/* ---------- Kartu & layout ---------- */
.container { max-width: 1060px; margin: 0 auto; padding: 18px 14px 56px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}
.card.narrow { max-width: 680px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr; }
.grid-outlet { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 880px) {
  .grid-2 { grid-template-columns: 1fr 1.4fr; }
  .grid-outlet { grid-template-columns: 360px 1fr; }
}

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Topbar ---------- */
.topbar { background: var(--navy-900); color: #fff; box-shadow: 0 1px 0 rgba(255,255,255,.08); }
.topbar-inner { max-width: 1060px; margin: 0 auto; padding: 10px 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topbar-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.topbar-app { font-weight: 500; opacity: .85; font-size: .92em; border-left: 1px solid rgba(255,255,255,.25); padding-left: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: .2px; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-text { text-transform: uppercase; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red-600); display: inline-block; }
.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a {
  color: #d6e0f0; text-decoration: none; padding: 7px 12px; border-radius: 8px; font-size: .95em;
}
.topnav a:hover { background: var(--navy-700); color: #fff; }
.topnav a.active { background: var(--red-600); color: #fff; font-weight: 600; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip { font-size: .85em; opacity: .9; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 1.05em; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .topnav, .topbar-user { display: none; width: 100%; }
  body.nav-open .topnav { display: flex; flex-direction: column; }
  body.nav-open .topnav a { padding: 11px 12px; }
  body.nav-open .topbar-user { display: flex; justify-content: space-between; }
}

.footer { text-align: center; color: var(--muted); font-size: .85em; padding: 18px 10px 30px; }

/* ---------- Tombol ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border-radius: 9px; border: 1px solid transparent;
  padding: 10px 16px; min-height: 42px; line-height: 1.2;
  transition: background .12s, border-color .12s;
}
.btn:focus-visible { outline: 3px solid #9fb6da; outline-offset: 1px; }
.btn-primary { background: var(--red-600); color: #fff; }
.btn-primary:hover { background: var(--red-700); }
.btn-secondary { background: var(--navy-800); color: #fff; }
.btn-secondary:hover { background: var(--navy-700); }
.btn-ghost { background: #fff; color: var(--navy-800); border-color: var(--line); }
.btn-ghost:hover { background: #f0f4fa; }
.btn-danger-ghost { background: #fff; color: var(--red-700); border-color: #f1c6c8; }
.btn-danger-ghost:hover { background: var(--err-bg); }
.btn-sm { padding: 6px 11px; min-height: 34px; font-size: .9em; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-stack { display: flex; flex-direction: column; gap: 9px; }
.inline-form { display: inline-block; }

/* ---------- Form ---------- */
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-weight: 600; font-size: .92em; margin-bottom: 5px; color: var(--navy-900); }
.req { color: var(--red-600); }
input[type="text"], input[type="password"], input[type="search"], input[type="date"],
select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: #fff; border: 1px solid #c4cedd; border-radius: 9px;
  padding: 10px 12px; min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #bcd0ec; border-color: var(--navy-700); }
input[type="file"] { width: 100%; padding: 9px; background: #fff; border: 1px dashed #b7c3d6; border-radius: 9px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--red-600); }
.field-row { display: grid; gap: 0 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .field-row { grid-template-columns: 1fr 1fr; } }
.field-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 8px; margin: 0 0 14px; }
.field-group legend { padding: 0 6px; }
.hint { display: block; font-size: .84em; color: var(--muted); margin-top: 5px; }
.note { background: #eef3fb; border: 1px solid #d4e0f2; border-radius: var(--radius); padding: 10px 14px; font-size: .93em; margin-bottom: 14px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.choice-row { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.choice { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; }
.toggle-pane { margin-bottom: 8px; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filter-row.wrap select, .filter-row.wrap input[type="date"] { width: auto; }
.filter-date { display: inline-flex; align-items: center; gap: 6px; font-size: .9em; color: var(--muted); }
.inline-edit { display: flex; gap: 6px; align-items: center; }
.inline-edit input { min-width: 140px; }

/* ---------- Flash & badge ---------- */
.flash { border-radius: var(--radius); padding: 11px 14px; margin-bottom: 14px; font-size: .95em; border: 1px solid; white-space: pre-line; }
.flash-success { background: var(--ok-bg); color: var(--ok-fg); border-color: #bfe5cc; }
.flash-error { background: var(--err-bg); color: var(--err-fg); border-color: #f1c0c3; }
.badge { display: inline-block; border-radius: 999px; padding: 2px 11px; font-size: .78em; font-weight: 700; vertical-align: middle; }
.badge-pub { background: var(--ok-bg); color: var(--ok-fg); }
.badge-draft { background: #eef1f6; color: var(--muted); }
.badge-off { background: var(--err-bg); color: var(--err-fg); }
.badge-neutral { background: var(--navy-100); color: var(--navy-800); }

/* ---------- Statistik ---------- */
.stat-grid { display: grid; gap: 14px; grid-template-columns: 1fr; margin-bottom: 18px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.stat { text-align: center; padding: 20px 12px; margin-bottom: 0; }
.stat-num { font-size: 2.1rem; font-weight: 800; color: var(--navy-900); line-height: 1.1; }
.stat-accent { color: var(--red-600); }
.stat-label { color: var(--muted); font-size: .9em; margin-top: 4px; }

/* ---------- Tabel -> kartu di HP ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95em; }
.table th { text-align: left; font-size: .8em; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.td-address { max-width: 260px; }
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; padding: 6px 2px; background: #fff; }
  .table td { border: 0; padding: 6px 12px; }
  .table td[data-th]::before { content: attr(data-th); display: block; font-size: .74em; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 1px; }
  .table td.t-right { text-align: left; }
}
.empty { color: var(--muted); padding: 18px 6px; text-align: center; }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 14px 0 4px; }
.pager-btn { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; color: var(--navy-800); padding: 0 10px; }
.pager-btn.current { background: var(--navy-800); color: #fff; border-color: var(--navy-800); font-weight: 700; }
.pager-btn.disabled { opacity: .4; }
.pager-dots { align-self: center; color: var(--muted); }

/* ---------- Detail outlet ---------- */
.qr-card { text-align: center; }
.qr-holder { max-width: 250px; margin: 6px auto 4px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: #fff; }
.qr-holder svg { display: block; width: 100%; height: auto; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: .82em; color: var(--muted); }
.admin-tools { margin-top: 16px; border-top: 1px dashed var(--line); padding-top: 10px; text-align: left; }
.admin-tools summary { cursor: pointer; color: var(--muted); font-size: .9em; }
.stack-form { margin-top: 8px; }
.row-actions summary { list-style: none; display: inline-flex; }
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions-pane { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.row-actions-pane form { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.row-actions-pane input[type="password"] { min-height: 34px; padding: 5px 10px; width: 170px; }

.report-list { list-style: none; margin: 0; padding: 0; }
.report-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.report-main { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.report-date { font-weight: 700; color: var(--navy-900); min-width: 128px; }
.report-info { flex: 1 1 240px; min-width: 0; }
.report-status { margin-left: auto; }
.report-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }

/* ---------- Lampiran & unggah ---------- */
.att-list, .file-preview { list-style: none; margin: 0 0 6px; padding: 0; }
.att-item { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.att-name { flex: 1 1 180px; min-width: 0; }
.att-del { display: inline-flex; gap: 6px; align-items: center; color: var(--red-700); font-size: .88em; cursor: pointer; }
.file-chip { display: flex; justify-content: space-between; gap: 10px; align-items: center; background: #eef3fb; border: 1px solid #d4e0f2; border-radius: 8px; padding: 7px 11px; margin-top: 7px; font-size: .9em; }
.file-chip-err { background: var(--err-bg); border-color: #f1c0c3; color: var(--err-fg); }
.file-remove { border: 0; background: none; color: var(--red-700); font-size: 1.05em; cursor: pointer; padding: 2px 6px; }
.progress { position: relative; background: #e6ebf3; border-radius: 999px; height: 30px; overflow: hidden; margin: 6px 0 12px; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0%; background: var(--navy-700); transition: width .2s; }
.progress-text { position: relative; display: flex; align-items: center; justify-content: center; height: 100%; color: #fff; font-size: .85em; font-weight: 600; mix-blend-mode: difference; }

.suggest-box { border: 1px solid #e3d9b8; background: #fffbea; border-radius: var(--radius); padding: 10px 12px; margin: -6px 0 14px; }
.suggest-head { font-size: .85em; color: #8a6d1a; margin-bottom: 6px; }
.suggest-item { display: block; padding: 7px 9px; border-radius: 8px; text-decoration: none; color: var(--text); }
.suggest-item:hover { background: #fdf3cf; }

/* ---------- Info list ---------- */
.info-list dt { font-weight: 700; color: var(--navy-900); margin-top: 12px; }
.info-list dd { margin: 3px 0 0; }
.logo-preview { max-height: 56px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }

/* ---------- Login & installer ---------- */
body.auth { background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-800) 55%, #1d3c6b 100%); min-height: 100vh; }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 26px 14px; }
.auth-card { width: 100%; max-width: 400px; padding: 26px 24px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 8px; color: var(--navy-900); }
.install-card { width: 100%; max-width: 680px; padding: 24px; }
.check-table td:first-child { width: 36px; }
.check { display: inline-flex; width: 24px; height: 24px; border-radius: 50%; align-items: center; justify-content: center; font-weight: 800; font-size: .85em; }
.check-ok { background: var(--ok-bg); color: var(--ok-fg); }
.check-warn { background: var(--warn-bg); color: var(--warn-fg); }
.check-fail { background: var(--err-bg); color: var(--err-fg); }
.install-ack { margin: 10px 0 14px; font-size: .9em; }

/* ============================================================
   HALAMAN PUBLIK (hasil scan QR) — mobile-first
   ============================================================ */
body.public { background: var(--bg); }
.public-wrap { max-width: 640px; margin: 0 auto; padding: 18px 14px 40px; }
.public-head { background: var(--navy-900); color: #fff; border-radius: 14px; padding: 20px 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.public-head.center { text-align: center; }
.public-brand { color: #fff; margin-bottom: 10px; display: inline-flex; }
.public-brand .brand-logo { height: 34px; background: #fff; border-radius: 8px; padding: 4px 8px; }
.public-outlet h1 { color: #fff; font-size: 1.25rem; margin: 2px 0; }
.public-outlet-name { margin: 0; font-weight: 600; color: #ffd9db; }
.public-outlet .muted { color: #b9c6dc; margin: 4px 0 0; font-size: .92em; }
.public-title { font-size: 1.02rem; text-transform: uppercase; letter-spacing: .6px; color: var(--navy-800); margin: 0 0 12px; }
.public-summary { display: flex; gap: 18px; justify-content: space-around; text-align: center; padding: 14px; flex-wrap: wrap; }
.sum-num { display: block; font-size: 1.6rem; font-weight: 800; color: var(--red-600); line-height: 1.15; }
.sum-num.small-num { font-size: 1.05rem; color: var(--navy-900); }
.sum-label { font-size: .82em; color: var(--muted); }
.public-filter { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.public-filter select { flex: 1 1 130px; width: auto; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { position: relative; padding-left: 18px; border-left: 4px solid var(--navy-800); }
.tl-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tl-date { font-weight: 800; color: var(--navy-900); }
.tl-service { background: var(--navy-100); color: var(--navy-800); border-radius: 999px; padding: 2px 11px; font-size: .78em; font-weight: 700; }
.tl-title { margin: 7px 0 4px; font-size: 1rem; color: var(--text); }
.tl-summary { margin: 0 0 8px; color: var(--muted); font-size: .94em; }
.tl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 6px; }
.tl-files { list-style: none; margin: 6px 0 0; padding: 0; }
.tl-files li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px dashed var(--line); flex-wrap: wrap; }
.file-ic { flex: 0 0 auto; }
.file-name { flex: 1 1 150px; min-width: 0; font-size: .93em; }
.file-actions { display: flex; gap: 6px; margin-left: auto; }
.empty-card { text-align: center; padding: 30px 16px; }
.public-footer { text-align: center; padding: 10px 0 34px; font-size: .9em; }
.public-footer a { color: var(--muted); text-decoration: none; }

/* ============================================================
   LABEL CETAK QR
   ============================================================ */
body.label-page { background: #e8ecf3; }
.label-toolbar { max-width: 760px; margin: 0 auto; padding: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.label-sheet { display: flex; justify-content: center; padding: 10px 14px 30px; }
.label-card {
  width: 90mm; min-height: 120mm; background: #fff; border: 1.2mm solid var(--navy-900);
  border-radius: 4mm; padding: 7mm 6mm; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 3mm;
  box-shadow: var(--shadow);
}
.label-brand { color: var(--navy-900); }
.label-brandline .brand-logo { height: 11mm; }
.label-brandline { font-size: 1.25em; }
.label-customer { font-weight: 700; color: var(--navy-900); font-size: 1.02em; line-height: 1.3; }
.label-outlet-name { font-weight: 800; font-size: 1.14em; color: var(--red-600); line-height: 1.3; }
.label-code { font-size: .82em; color: var(--muted); letter-spacing: 1px; margin-top: 1mm; }
.label-qr { width: 52mm; height: 52mm; flex: 0 0 auto; }
.label-qr svg { width: 52mm; height: 52mm; display: block; }
.label-caption { font-size: .9em; font-weight: 600; color: var(--navy-900); max-width: 70mm; }
.label-web { font-size: .8em; color: var(--muted); margin-top: auto; }

@media print {
  .no-print { display: none !important; }
  body.label-page { background: #fff; }
  .label-sheet { padding: 0; }
  .label-card { box-shadow: none; page-break-inside: avoid; }
  @page { margin: 8mm; }
}
