/* Absensi Bilik Kopi — design system v3, Mode Malam (Navy). Satu kolom selebar HP; dashboard melebar di layar besar. */
:root {
  --pasir: #E8DCC8; --navy: #1B2A3D; --mustar: #D9A441; --tanah: #8C7355; --charcoal: #231F20;
  color-scheme: dark;
  --bg: #1B2A3D; --ink: #E8DCC8; --muted: #B9AC94;
  --surface: #24364B; --line: #3B4F67; --soft: #142030; --accent: var(--mustar);
  --panel: #E8DCC8; --panel-ink: #1B2A3D;
  --warn-bg: #4F3F16; --warn-ink: #F3DDA6; --bad-bg: #5E2515; --bad-ink: #F2CDBF; --ok-bg: #2D4226; --ok-ink: #D7E2CB;
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --sans: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pill: 999px; --r: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
.wrap { max-width: 460px; margin: 0 auto; padding-inline: 18px; padding-block: 18px 40px; display: flex; flex-direction: column; gap: 18px; min-height: 100dvh; }
.wrap.wide { max-width: 1040px; }
header.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-weight: 600; letter-spacing: .01em; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
h1 { font: 600 30px/1.15 var(--serif); margin: 0; text-wrap: balance; }
h2 { font: 600 14px/1.3 var(--sans); margin: 0; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

button, input, select { font: inherit; color: inherit; }
.btn { border: 0; border-radius: var(--pill); padding: 15px 22px; font-weight: 600; background: var(--panel); color: var(--panel-ink); cursor: pointer; width: 100%; }
.btn.accent { background: var(--accent); color: var(--navy); }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.sm { width: auto; padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: default; }
.link { background: none; border: 0; padding: 4px 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; }
:focus-visible { outline: 3px solid var(--mustar); outline-offset: 2px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; }
.field input, .field select { background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; width: 100%; min-width: 0; }

.names { display: flex; flex-direction: column; gap: 8px; }
.name { text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px 16px; cursor: pointer; font-weight: 500; }
.name span { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }

.dots { display: flex; gap: 14px; justify-content: center; padding-block: 6px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.dots i.on { background: var(--ink); }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keys button { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 16px 0; font-size: 22px; font-weight: 500; cursor: pointer; }
.keys button.blank { visibility: hidden; }

.status { background: var(--soft); color: var(--ink); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.status .clock { font: 600 44px/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.status .state { display: inline-flex; align-self: flex-start; align-items: center; gap: 8px; background: var(--mustar); color: var(--navy); border-radius: var(--pill); padding: 5px 12px; font-size: 13px; font-weight: 600; margin-top: 8px; }
.status .state.off { background: var(--surface); color: var(--muted); border: 1.5px solid var(--line); }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1 1 140px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--pill); padding: 11px 14px; cursor: pointer; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--panel-ink); border-color: var(--panel); }

.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding-block: 12px; border-top: 1px solid var(--line); }
.row > div { min-width: 0; flex: 1; }
.row .t { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }

.chip { display: inline-block; border-radius: var(--pill); padding: 2px 9px; font-size: 12px; font-weight: 500; background: var(--warn-bg); color: var(--warn-ink); white-space: nowrap; }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.plain { background: transparent; border: 1px solid var(--line); color: var(--muted); }

.msg { border-radius: 10px; padding: 10px 14px; background: var(--bad-bg); color: var(--bad-ink); font-size: 14px; }
.msg.info { background: var(--warn-bg); color: var(--warn-ink); }

/* Kamera */
.cam { position: fixed; inset: 0; background: var(--charcoal); color: var(--pasir); display: flex; flex-direction: column; z-index: 10; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.cam .stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam video, .cam img.shot { width: 100%; height: 100%; object-fit: contain; }
.cam video { transform: scaleX(-1); }
.cam .live { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 18px 14px; background: linear-gradient(transparent, rgba(35,31,32,.85)); font-size: 13px; line-height: 1.45; }
.cam .live b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.cam .bar { padding: 14px 18px 18px; display: flex; gap: 10px; }
.cam .bar .btn.ghost { color: var(--pasir); border-color: var(--tanah); }
.cam .msg { margin: 0 18px; }

/* Dashboard */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { background: transparent; border: 1.5px solid var(--line); border-radius: var(--pill); padding: 8px 16px; cursor: pointer; font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--panel); color: var(--panel-ink); border-color: var(--panel); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border-radius: var(--r); padding: 14px 16px; }
.tile b { display: block; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { font-size: 13px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card { background: var(--surface); border-radius: var(--r); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.card .who { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.card .who b { min-width: 0; overflow-wrap: anywhere; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shot { display: flex; flex-direction: column; gap: 4px; font-size: 13px; min-width: 0; }
.shot .ph { aspect-ratio: 3/4; width: 100%; border-radius: 10px; background: var(--line); border: 0; padding: 0; overflow: hidden; cursor: zoom-in; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; text-align: center; }
.shot .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .ph.none { cursor: default; }
.flags { display: flex; gap: 4px; flex-wrap: wrap; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-top: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; border-top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.box { background: var(--surface); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.lightbox { position: fixed; inset: 0; background: rgba(35,31,32,.92); z-index: 20; display: flex; align-items: center; justify-content: center; padding: 18px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
section { display: flex; flex-direction: column; gap: 12px; }
@media (prefers-reduced-motion: no-preference) { .btn, .name, .keys button { transition: transform .08s; } .btn:active, .name:active, .keys button:active { transform: scale(.98); } }
