/* Panel Dev & Admin — simpel, senada & nyaman */
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.top { position: sticky; top: 0; z-index: 30; background: linear-gradient(145deg, #134430, #1B5E3F); border-bottom: 0; color: #fff; }
.top .row { display: flex; align-items: center; gap: 12px; min-height: 62px; }
.who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.who .logo { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.16); color: #fff; display: grid; place-items: center; flex: none; }
.who h1 { font-size: 16px; font-family: var(--font); font-style: normal; }
.who small { color: rgba(255,255,255,.75); font-size: 12.5px; display: block; }
.top .btn.ghost, .top .open-switch { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); color: #fff; }
.top .open-switch .knob { background: rgba(255,255,255,.4); }
.top .open-switch.on .knob { background: var(--accent); }

main { padding: 20px 0 48px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; flex-wrap: wrap; }
.section-title h2 { font-size: 18px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; }

.tenants { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); align-items: start; }
.tenant { padding: 16px; display: grid; gap: 14px; }
.t-head { display: flex; gap: 12px; align-items: center; }
.t-head .thumb { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; flex: none; }
.t-head .thumb img { width: 100%; height: 100%; object-fit: cover; }
.t-head .thumb .ph { width: 100%; height: 100%; }
.t-head h3 { font-size: 16px; }
.t-head small { color: var(--muted); }
.t-body { display: grid; gap: 8px; font-size: 13.5px; }
.t-body .r { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.t-body .r > span:first-child { color: var(--muted); }
.t-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.t-actions .btn { flex: 1; min-width: 96px; }
.qris-prev { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.qris-prev img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); }
.qris-prev .none { width: 64px; height: 64px; border-radius: 8px; background: var(--fill-soft); color: var(--muted); display: grid; place-items: center; }
.qris-prev .txt { flex: 1; min-width: 0; font-size: 13px; }
.qris-prev .txt b { display: block; font-size: 14px; }
.sw { position: relative; width: 46px; height: 26px; border-radius: 99px; border: 0; background: var(--switch-off); padding: 0; transition: background .2s; flex: none; cursor: pointer; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.sw.on { background: var(--brand); }
.sw.on::after { transform: translateX(20px); }
.sw:disabled { opacity: .62; cursor: not-allowed; }
.sw.sm { width: 40px; height: 22px; }
.sw.sm::after { width: 16px; height: 16px; }
.sw.sm.on::after { transform: translateX(18px); }

.meja-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.meja { padding: 14px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.meja .qrbox { width: 130px; height: 130px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.meja .qrbox svg, .meja .qrbox img { width: 100%; height: 100%; display: block; }
.meja b { font-size: 16px; }
.meja code { font-size: 11px; color: var(--muted); word-break: break-all; }
.link-box { display: flex; gap: 8px; align-items: center; padding: 10px 12px; background: var(--info-soft); color: var(--info); border-radius: 12px; font-size: 13px; word-break: break-all; }


/* ---------- Polesan elegan ---------- */
.top {
  background: radial-gradient(circle at 88% 0%, rgba(200,150,46,.22), transparent 42%),
              linear-gradient(145deg, #134430, #1B5E3F);
  box-shadow: 0 6px 20px rgba(19,68,48,.18);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.order, .tenant, .meja, .menu-card { border-radius: 18px; transition: box-shadow .2s, transform .2s, border-color .2s; }
.order:hover, .tenant:hover, .meja:hover, .menu-card:hover { box-shadow: var(--shadow); border-color: var(--brand-line); transform: translateY(-2px); }

/* ---------- cetak QR meja ----------
   #printArea ditempel langsung ke <body> dan memakai <img> data URL
   agar QR pasti tercetak hitam-putih tajam di semua browser & printer. */
.print-area { display: none; }
@media print {
  @page { size: A4; margin: 10mm; }
  body > *:not(.print-area) { display: none !important; }
  html, body {
    background: #fff !important; color: #000 !important;
    margin: 0 !important; padding: 0 !important;
    -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important;
  }
  .print-area {
    display: grid !important; grid-template-columns: repeat(2, 1fr);
    gap: 14px; padding: 0; background: #fff !important;
  }
  .print-card {
    border: 2px solid #000 !important; border-radius: 12px; padding: 14px;
    text-align: center; break-inside: avoid; page-break-inside: avoid;
    background: #fff !important; color: #000 !important;
  }
  .print-card h2 { font-size: 22px; margin-bottom: 4px; color: #000 !important; font-style: normal; }
  .print-card p  { font-size: 12px; margin-bottom: 8px; color: #222 !important; }
  .print-card .qr { display: flex; justify-content: center; align-items: center; background: #fff !important; }
  .print-card .qr img, .print-card .qr svg {
    width: 60mm; height: 60mm; display: block;
    image-rendering: pixelated; background: #fff !important;
  }
  .print-card small { display: block; margin-top: 6px; font-size: 11px; color: #333 !important; }
}

.tabbar.dock .tab { font-size: 11.5px; }
@media (max-width: 899px) { main { padding-bottom: 24px; } .toasts { bottom: 100px; } }
@media (min-width: 900px) {
  body.has-tabbar { padding-bottom: 0; }
  .tabbar.dock {
    position: sticky; top: 62px; bottom: auto; left: auto; right: auto; z-index: 25;
    max-width: none; margin: 0; border-radius: 0; border: 0;
    border-bottom: 1px solid var(--line); box-shadow: none;
    padding: 8px max(16px, calc((100% - 1148px) / 2));
    gap: 6px; justify-content: flex-start;
    background: var(--surface);
  }
  .tabbar.dock .tab {
    flex: 0 0 auto; flex-direction: row; gap: 7px;
    padding: 8px 14px; border-radius: 10px; font-size: 13.5px;
  }
  .tabbar.dock .count { position: static; margin-left: 2px; }
}

/* ---------- rekap pembayaran ---------- */
.rk-dates { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.rk-dates[hidden] { display: none; }
.rk-stats { margin-top: 14px; }
.rk-stats .stat:first-child { grid-column: 1 / -1; }
.rk-stats .k { display: flex; align-items: center; gap: 6px; }
.rk-table th:first-child, .rk-table td:first-child { padding-left: 14px; width: 34%; overflow-wrap: anywhere; }
.rk-table th:last-child, .rk-table td:last-child { padding-right: 14px; }
@media (min-width: 1000px) { .rk-stats { grid-template-columns: repeat(3, 1fr); } .rk-stats .stat:first-child { grid-column: auto; } .rk-table { font-size: 14px; } }
.rk-card { margin-top: 14px; padding: 0; overflow: hidden; }
.rk-scroll { overflow-x: auto; }
.rk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rk-table th, .rk-table td { padding: 11px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.rk-table th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.rk-table .n { text-align: right; white-space: nowrap; }
.rk-table td small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.rk-table tbody tr { cursor: pointer; }
.rk-table tbody tr:hover, .rk-table tbody tr:focus-visible { background: var(--brand-soft); outline: none; }
.rk-table tfoot td { font-weight: 700; background: var(--accent-soft); color: var(--accent-ink); border-bottom: 0; }
.rd-sum { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); margin-bottom: 8px; }
.rd-list { display: grid; max-height: 50vh; overflow-y: auto; }
.rd-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px dashed var(--line); }
.rd-row > div { flex: 1; min-width: 0; }
.rd-row small { display: block; color: var(--muted); font-size: 12px; }

@media (prefers-color-scheme: dark) {
  .top { background: linear-gradient(145deg, #172A22, #1B4332); border-bottom: 1px solid var(--line); }
}


/* ---------- grafik, log, meja ---------- */
.gr-wrap { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .gr-wrap { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.bars { padding: 16px; display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: var(--fill-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 99px; }
.top-list { padding: 6px 16px; }
.top-list .r { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.top-list .n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.top-list .t { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.top-list .q { color: var(--muted); font-size: 12.5px; text-align: right; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .search { flex: 1; min-width: 200px; }
.meja .pick { justify-self: end; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

@media print {
  .print-doc { grid-column: 1 / -1; color: #000 !important; background: #fff !important; font-size: 12px; }
  .print-doc h2 { font-size: 20px; font-style: normal; margin-bottom: 2px; color: #000 !important; }
  .print-doc p { margin-bottom: 10px; color: #333 !important; }
  .print-doc table { width: 100%; border-collapse: collapse; }
  .print-doc th, .print-doc td { border: 1px solid #000; padding: 6px 8px; text-align: left; color: #000 !important; background: #fff !important; }
  .print-doc th { font-weight: 700; }
  .print-doc .n { text-align: right; white-space: nowrap; }
  .print-doc .par { width: 60px; }
  .print-doc tfoot td { font-weight: 800; }
  .print-doc small { display: block; margin-top: 8px; color: #555 !important; }
}

/* ---------- user & hak akses (kategori + accordion) ---------- */
.usr-groups { display: grid; gap: 16px; }
.usr-group { display: grid; gap: 8px; }
.usr-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px; }
.usr-group-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--text); }
.usr-group-sub { font-size: 12px; color: var(--muted); }
.usr-list-card { padding: 0; overflow: hidden; border-radius: 16px; }
.usr-item { border-bottom: 1px solid var(--line); }
.usr-item:last-child { border-bottom: 0; }
.usr-row-head {
  width: 100%; border: 0; background: transparent; color: inherit; text-align: left; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; transition: background .15s;
}
.usr-row-head:hover { background: var(--surface-2); }
.usr-item.open .usr-row-head { background: var(--brand-soft); }
.usr-row-main { min-width: 0; flex: 1; }
.usr-id { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.usr-id b { font-size: 15px; }
.usr-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.usr-row-right { display: flex; align-items: center; gap: 10px; flex: none; }
.usr-chev { display: inline-flex; color: var(--muted); transition: transform .2s ease; }
.usr-item.open .usr-chev { transform: rotate(90deg); color: var(--brand-ink); }
.usr-row-body {
  padding: 12px 16px 16px; border-top: 1px dashed var(--line); background: var(--surface);
  display: grid; gap: 12px;
}
.usr-row-body[hidden] { display: none; }
.usr-row-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; font-size: 12.5px; color: var(--muted);
}
.usr-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.perm-grid { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .perm-grid { grid-template-columns: repeat(2, 1fr); } }
.perm-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-radius: 11px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: 13px; cursor: pointer; user-select: none;
}
.perm-row.locked { opacity: .88; cursor: default; }
.stat-btn { text-align: left; cursor: pointer; font: inherit; transition: border-color .15s, transform .15s, box-shadow .15s, background .15s; }
.stat-btn:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-btn.active { border-color: var(--brand); background: var(--brand-soft); }
.stat-btn.active .k { color: var(--brand-ink); }
