:root {
  --bg: #0b1220; --panel: #131d2e; --panel-2: #192539; --line: #2a3950; --text: #e8eefb; --muted: #9faec5;
  --accent: #35b7a5; --accent-ink: #06211f; --gold: #d9b878; --danger: #ff6b7a; --warn: #f5c84c; --info: #7aa7ff; --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }

/* top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: linear-gradient(180deg, #0f1828, #0b1220); border-bottom: 1px solid rgba(217,184,120,.35); }
.top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.top .brand img { height: 26px; }
.top .brand small { color: var(--gold); font-weight: 600; }
.tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 8px 12px; border-radius: 10px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--text); }
.tabs .count { margin-left: 6px; background: var(--danger); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; }
.me { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.me form { margin: 0; }

main { padding: 18px 20px 40px; max-width: 1500px; margin: 0 auto; }
h2 { font-size: 20px; margin: 0 0 4px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.mb { margin-bottom: 12px; }
.mt { margin-top: 12px; }
.m0 { margin: 0; }
.grow { flex: 1; min-width: 0; width: auto; }

/* buttons & inputs */
.btn { border: 1px solid var(--line); background: var(--panel-2); padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; color: var(--text); }
.btn:hover { border-color: #3c5170; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.field.full { grid-column: 1 / -1; }
input, select, textarea { width: 100%; padding: 9px 11px; border-radius: 9px; border: 1px solid #3a4a63; background: #0d1625; color: var(--text); }
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 12px; font-size: 13px; color: var(--text); }
.checks label { display: flex; gap: 6px; align-items: center; }
.checks input { width: auto; }

.stack > .btn { justify-self: start; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack { display: grid; gap: 12px; }

/* office */
.office { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; align-items: start; }
.scene-wrap { background: #070b14; position: relative; height: calc(100vh - 150px); min-height: 460px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.scene-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.scene-labels { position: absolute; inset: 0; pointer-events: none; }
.scene-label { position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; border: 0; background: rgba(255,255,255,.94); color: #1b2433; font-size: 12px; font-weight: 600; box-shadow: 0 2px 8px rgba(20,30,50,.18); white-space: nowrap; cursor: pointer; }
.scene-label.room { cursor: default; font-size: 13px; background: rgba(255,255,255,.75); }
.scene-label .dot { width: 8px; height: 8px; border-radius: 50%; }
.compact .scene-label { padding: 3px 8px; font-size: 11px; }
.compact .scene-label.room, .compact .scene-label.player, .compact .scene-label .sub { display: none; }
.scene-label .badge { background: var(--danger); color: #fff; border-radius: 99px; padding: 0 6px; font-size: 11px; }
.scene-ctrl { position: absolute; right: 10px; bottom: 10px; display: grid; gap: 6px; }
.scene-ctrl button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255,255,255,.95); color: #1b2433; font-weight: 700; cursor: pointer; box-shadow: 0 2px 8px rgba(20,30,50,.2); }
.scene-hint { position: absolute; left: 12px; top: 58px; background: rgba(27,36,51,.85); color: #fff; padding: 6px 12px; border-radius: 10px; font-size: 13px; }

.agent-panel { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; }
.agent-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #0b1220; flex: none; }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; }
.worklist { margin: 6px 0 12px; padding-left: 18px; color: var(--muted); font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { border: 1px solid var(--line); background: none; color: var(--muted); padding: 5px 11px; border-radius: 99px; cursor: pointer; font-size: 13px; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: rgba(53,183,165,.15); }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.agent-grid button { text-align: left; }

.reminders { display: grid; gap: 6px; margin-bottom: 14px; }
.reminder { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--panel); border-left: 4px solid var(--warn); font-size: 14px; }
.reminder.danger { border-color: var(--danger); }
.reminder.info { border-color: var(--info); }
.reminder .date { color: var(--muted); font-size: 12px; min-width: 84px; }

/* tasks */
.task { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; }
.task header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status { font-size: 12px; padding: 2px 9px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }
.status.menunggu_review { background: rgba(245,200,76,.18); color: var(--warn); }
.status.disetujui { background: rgba(53,183,165,.18); color: var(--accent); }
.status.ditolak { background: rgba(255,107,122,.15); color: var(--danger); }
.task pre { white-space: pre-wrap; margin: 0; font: inherit; background: #0d1625; border-radius: 9px; padding: 10px; }
.task details { font-size: 13px; color: var(--muted); }
.task .after { font-size: 13px; color: var(--muted); border-left: 3px solid var(--accent); padding-left: 8px; }
.task-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 13px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--panel); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.split { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.voucher-card { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
.voucher-card img { width: 150px; height: 150px; background: #fff; border-radius: 10px; }
.code { font: 700 18px/1.2 ui-monospace, Consolas, monospace; letter-spacing: .06em; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); padding: 0; width: min(760px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(5,10,20,.65); }
dialog .dlg-body { padding: 18px; display: grid; gap: 14px; max-height: calc(100vh - 80px); overflow-y: auto; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2c42; border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; z-index: 50; box-shadow: 0 8px 24px rgba(0,0,0,.35); max-width: calc(100vw - 32px); }
.toast.error { border-color: var(--danger); }
.notice { padding: 10px 12px; border-radius: 10px; background: rgba(245,200,76,.12); color: var(--warn); font-size: 13px; }

/* login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, #18304a, var(--bg) 60%); }
.login-card { width: min(400px, 100%); display: grid; gap: 14px; }
.login-card img { height: 32px; justify-self: start; }

/* virtual HQ */
.floor-nav { position: absolute; left: 12px; top: 12px; display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(10,15,26,.82); border: 1px solid rgba(217,184,120,.35); backdrop-filter: blur(6px); max-width: calc(100% - 24px); overflow-x: auto; scrollbar-width: none; }
.floor-nav button { border: 0; background: none; color: #cfd8e8; padding: 6px 11px; border-radius: 9px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.floor-nav button[aria-pressed="true"] { background: var(--gold); color: #1b1408; }
.floor-nav button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.scene-label.human { background: #fffaf0; border-left: 3px solid var(--gold); }
.scene-label.human.leader { background: linear-gradient(90deg, #f6e7c4, #fffaf0); }
.scene-label.player { padding: 2px 8px; font-size: 11px; background: rgba(12,18,30,.78); color: #eef3ff; box-shadow: none; }
.scene-label.court, .scene-label.floor { background: rgba(12,18,30,.85); color: #f6e7c4; border: 1px solid rgba(217,184,120,.55); }
.scene-label.floor { font-size: 13px; padding: 6px 12px; }
.gold { color: var(--gold); }
.pill-gold { display: inline-block; margin: 0; padding: 2px 10px; border-radius: 99px; font-size: 12px; background: rgba(217,184,120,.16); color: var(--gold); }
.division { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.division-head { display: flex; align-items: center; gap: 8px; }
.division-head .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.division > .btn { justify-self: start; }
.agent-panel details summary { cursor: pointer; color: var(--muted); font-size: 13px; }

@media (max-width: 1100px) {
  .office { grid-template-columns: 1fr; }
  .agent-panel { position: static; max-height: none; }
  .scene-wrap { height: 62vh; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 8px 16px; gap: 8px; }
  .tabs { order: 3; flex-basis: 100%; }
  main { padding: 12px 16px 32px; }
  .task-list { grid-template-columns: 1fr; }
  .voucher-card { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* /lapor — store staff report form (phone first) */
.lapor-main { max-width: 720px; display: grid; gap: 16px; }
.lapor .top .me { margin-left: auto; }
fieldset.step { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 12px 0 0; display: grid; gap: 10px; min-width: 0; }
fieldset.step legend { padding: 0 8px 0 0; font-weight: 700; color: var(--gold); font-size: 14px; }
.form-grid.two { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 8px; }
.pick.multi { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-btn { display: flex; gap: 8px; align-items: center; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; text-align: left; font-size: 14px; min-height: 48px; }
.pick-btn .ico { font-size: 20px; }
.pick-btn[aria-checked="true"] { border-color: var(--accent); background: rgba(53,183,165,.16); box-shadow: inset 0 0 0 1px var(--accent); }
.pick .chip { padding: 8px 12px; font-size: 14px; }
.btn.big { padding: 14px 18px; font-size: 16px; justify-self: stretch; justify-content: center; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img { width: 86px; height: 86px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.thumb { position: relative; }
.thumb .btn { position: absolute; top: 4px; right: 4px; padding: 2px 7px; }
.ticket { display: grid; gap: 6px; }
.progress { display: flex; gap: 4px; padding: 0; margin: 4px 0; list-style: none; counter-reset: s; flex-wrap: wrap; }
.progress li { flex: 1; min-width: 70px; font-size: 11px; color: var(--muted); border-top: 3px solid var(--line); padding-top: 4px; }
.progress li.on { border-color: var(--accent); color: var(--text); }
.status.mt-baru { background: rgba(255,107,122,.15); color: var(--danger); }
.status.mt-selesai { background: rgba(53,183,165,.18); color: var(--accent); }
.status.mt-dibatalkan { text-decoration: line-through; }

/* app shell without the 3D building (marketing / maintenance accounts) */
.office.no-scene { grid-template-columns: minmax(0, 760px); }
.office.no-scene .agent-panel { position: static; max-height: none; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.store-btn { display: grid; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; }
.store-btn.has-open { border-color: var(--warn); }
.store-btn.has-urgent { border-color: var(--danger); background: rgba(255,107,122,.08); }
.store-btn .muted { font-size: 12px; }
.archive-group { display: grid; gap: 4px; }
.archive-group ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; columns: 2; }
.scene-label.store { background: rgba(255,107,122,.95); color: #fff; }
.scene-label.store.ok { background: rgba(12,18,30,.78); color: #eef3ff; box-shadow: none; padding: 2px 8px; font-size: 11px; }
.compact .scene-label.store.ok { display: none; }
.scene-label.owner { background: #fff4dc; border-left: 3px solid var(--gold); }
.scene-label.bench { opacity: .82; }
