:root {
  --bg: #fff8ec; --panel: rgba(255, 252, 245, 0.94); --ink: #2b2d42; --muted: #7a7f9a; --line: #2b2d42;
  --pink: #ff5d8f; --orange: #ff8a3d; --yellow: #ffc83d; --green: #2ec27e; --teal: #3dd6d0; --blue: #3d8bff; --purple: #e85d04;
  --d-yayasan: #22335e; --d-direksi: #8b1e3f; --d-sekretariat: #a78bfa; --d-bisnis: #2563eb; --d-ops: #16a34a; --d-mkt: #ec4899; --d-cs: #14b8a6; --d-tamu: #94a3b8;
  --shadow: 0 4px 0 rgba(43, 45, 66, 0.9);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd3ff; color: var(--ink); font: 600 13px/1.45 Nunito, system-ui, sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
#app, #scene { position: fixed; inset: 0; }
#scene canvas { display: block; }
.label-layer { position: absolute; inset: 0; pointer-events: none; }
h3, .cname, #clock, .cn, .fbtn b, .logo { font-family: Fredoka, Nunito, sans-serif; }
.panel-box { background: var(--panel); border: 3px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }

/* ---------- bilah atas ---------- */
#topbar { position: fixed; top: 12px; left: 12px; right: 12px; height: 62px; display: flex; align-items: center; gap: 14px; padding: 0 14px;
  background: var(--panel); border: 3px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); z-index: 5; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff; flex: none;
  background: linear-gradient(135deg, #ffb347, #ff7a00 55%, #e85d04); border: 3px solid var(--line); text-shadow: 0 2px 0 var(--line); }
.logo.big { width: 72px; height: 72px; font-size: 26px; border-radius: 18px; margin: 0 auto 12px; animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(-4deg); } }
.cname { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { color: var(--purple); font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clockbox { text-align: center; }
#clock { font-weight: 700; font-size: 24px; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
#day { color: var(--muted); font-size: 11px; margin-top: -4px; }
.phase { padding: 5px 12px; border-radius: 99px; font-weight: 800; font-size: 12px; background: var(--blue); color: #fff; border: 2px solid var(--line); }
.phase[data-phase="Ishoma"], .phase[data-phase^="Sholat"] { background: var(--green); } .phase[data-phase="Kerja Malam"] { background: #3b2f80; } .phase[data-phase="Malam"] { background: #7a3a10; } .phase[data-phase="Pagi"] { background: #ffb347; color: var(--ink); } .phase[data-phase="Jam kerja"] { background: #ff7a00; }
.speed { display: flex; gap: 4px; background: #fff; padding: 3px; border-radius: 12px; border: 2px solid var(--line); }
.speed button, .ai { border: 0; background: transparent; padding: 6px 10px; border-radius: 9px; cursor: pointer; font-weight: 800; }
.speed button.on { background: var(--yellow); }
.speed button:hover:not(.on), .ai:hover { background: #ffe9c7; }
.ai { border: 2px solid var(--line); background: #fff; white-space: nowrap; }
.ai.on { background: #c6f6d5; }

/* ---------- panel lantai ---------- */
#floors { position: fixed; left: 12px; top: 90px; width: 220px; display: flex; flex-direction: column; gap: 6px; padding: 10px;
  background: var(--panel); border: 3px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); z-index: 4; }
.ftitle { font-size: 10px; letter-spacing: 2px; color: var(--muted); padding: 0 4px; font-weight: 800; }
.fbtn { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 6px 8px; border-radius: 12px;
  border: 2px solid transparent; background: #fff; cursor: pointer; }
.fbtn b { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; color: #fff; border: 2px solid var(--line); background: var(--muted); }
.fbtn[data-floor="1"] b { background: #ffb347; } .fbtn[data-floor="2"] b { background: #ff9a3c; } .fbtn[data-floor="3"] b { background: #f48c06; }
.fbtn[data-floor="4"] b { background: #ff7a00; } .fbtn[data-floor="5"] b { background: #e85d04; } .fbtn.all b { background: var(--yellow); color: var(--ink); }
.fbtn span { font-size: 11px; line-height: 1.25; color: var(--ink); }
.fbtn .cnt { font-style: normal; font-size: 11px; background: #ffe9c7; padding: 1px 8px; border-radius: 99px; font-weight: 800; }
.fbtn.on { border-color: var(--line); background: #fff3c4; transform: translateX(3px); }
.fbtn:hover:not(.on) { background: #fff8e1; }

/* ---------- panel kanan ---------- */
#panel { position: fixed; right: 12px; top: 90px; bottom: 46px; width: 340px; display: flex; flex-direction: column;
  background: var(--panel); border: 3px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); z-index: 4; overflow: hidden; }
#tabs { display: flex; padding: 6px; gap: 4px; border-bottom: 3px solid var(--line); background: #fff; }
#tabs button { flex: 1; border: 0; background: transparent; padding: 7px 4px; border-radius: 10px; cursor: pointer; font-weight: 800; color: var(--muted); }
#tabs button.on { background: #ff7a00; color: #fff; }
#pbody { overflow: auto; padding: 8px; flex: 1; }
.arow { display: grid; grid-template-columns: 12px 1fr auto; gap: 9px; align-items: center; padding: 7px 8px; border-radius: 12px; cursor: pointer; border: 2px solid transparent; }
.arow:hover { background: #fff3c4; }
.arow.on { background: #fff3c4; border-color: var(--line); }
.ainfo small { color: var(--muted); font-size: 11px; }
.ast { font-size: 11.5px; color: #4b4f6b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; font-weight: 600; }
.afl { white-space: nowrap; font-size: 11px; font-weight: 800; background: #ffe9c7; padding: 1px 7px; border-radius: 99px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: var(--d-tamu); flex: none; border: 2px solid var(--line); }
.dept-yayasan.dot, .avatar.dept-yayasan { background: var(--d-yayasan); }
.dept-direksi.dot, .avatar.dept-direksi { background: var(--d-direksi); }
.dept-sekretariat.dot, .avatar.dept-sekretariat { background: var(--d-sekretariat); }
.dept-bisnis.dot, .avatar.dept-bisnis { background: var(--d-bisnis); }
.dept-ops.dot, .avatar.dept-ops { background: var(--d-ops); }
.dept-mkt.dot, .avatar.dept-mkt { background: var(--d-mkt); }
.dept-cs.dot, .avatar.dept-cs { background: var(--d-cs); }
.note { color: var(--muted); font-size: 12px; padding: 10px 8px; }
.lrow { display: grid; grid-template-columns: 42px 22px 1fr; gap: 4px; padding: 5px 4px; border-bottom: 2px dashed #f1e4cc; font-size: 12px; }
.lt { color: var(--purple); font-weight: 800; font-variant-numeric: tabular-nums; }
.trow { padding: 10px; border: 2px solid var(--line); border-radius: 14px; margin-bottom: 8px; background: #fff; }
.thead { display: flex; justify-content: space-between; align-items: center; }
.ttext { margin: 4px 0; }
.tflow { font-size: 11.5px; color: var(--muted); }
.badge { font-size: 10.5px; padding: 2px 9px; border-radius: 99px; background: #e2e8f0; font-weight: 800; border: 2px solid var(--line); }
.s-selesai { background: #b9f6ca; } .s-dikerjakan { background: #bde0fe; } .s-ditinjau { background: #ffe066; } .s-diproses { background: #e9d5ff; }
.org, .org ul { list-style: none; margin: 0; padding-left: 14px; }
.org { padding-left: 0; }
.org li { position: relative; padding: 3px 0 3px 12px; border-left: 3px dotted #ffb347; }
.onode { display: inline-flex; gap: 6px; align-items: center; padding: 4px 9px; border-radius: 10px; background: #fff; border: 2px solid var(--line); cursor: pointer; }
.onode:hover { background: #fff3c4; }
.onode small { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 4px; padding: 8px; font-size: 11px; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.mini, .row button, .primary { border: 2px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 10px; cursor: pointer; margin-top: 6px; font-weight: 800; box-shadow: 0 2px 0 var(--line); }
.mini:hover, .row button:hover { background: #fff3c4; }
.mini:active, .row button:active, .primary:active { transform: translateY(2px); box-shadow: none; }
.primary { background: var(--yellow) !important; }
button.on { background: #fff3c4; }

/* ---------- kartu agen ---------- */
#card { position: fixed; left: 12px; bottom: 46px; width: 350px; max-height: calc(100vh - 430px); min-height: 200px; overflow: auto; padding: 14px;
  background: var(--panel); border: 3px solid var(--line); border-radius: 18px; z-index: 6; box-shadow: 0 6px 0 var(--line); }
.x { position: absolute; top: 8px; right: 8px; border: 2px solid var(--line); background: #fff; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-weight: 800; }
.chead { display: flex; gap: 10px; align-items: center; padding-right: 30px; }
.avatar { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font: 700 20px Fredoka; color: #fff; background: var(--d-tamu); flex: none; border: 3px solid var(--line); }
.cn { font-weight: 700; font-size: 17px; line-height: 1.2; }
.cr { color: var(--purple); font-size: 12px; font-weight: 800; } .cd { color: var(--muted); font-size: 11px; }
.cgrid { display: grid; grid-template-columns: 82px 1fr; gap: 4px 8px; margin: 12px 0 6px; font-size: 12px; }
.cgrid span { color: var(--muted); } .cgrid b { font-weight: 700; }
.cgrid a { color: var(--purple); cursor: pointer; text-decoration: underline dotted; }
.cprog { height: 10px; border-radius: 6px; background: #f1e4cc; overflow: hidden; margin: 4px 0 8px; border: 2px solid var(--line); }
.cprog i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(45deg, var(--green), var(--green) 8px, #58d68d 8px, #58d68d 16px); transition: width .4s; }
#card label, .mbox label { display: block; font-size: 11px; color: var(--muted); margin: 10px 0 4px; font-weight: 800; letter-spacing: .3px; }
textarea, input, select { width: 100%; background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 8px; outline: none; font-weight: 600; }
textarea:focus, input:focus, select:focus { box-shadow: 0 0 0 3px #ffe066; }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1; width: auto; }
.row button { margin-top: 0; white-space: nowrap; }
.cbtns { margin-top: 12px; }
.answer { margin-top: 8px; padding: 10px; border-radius: 12px; background: #e6fff2; border: 2px solid var(--green); white-space: pre-wrap; font-size: 12.5px; }

/* ---------- modal ---------- */
#modal { position: fixed; inset: 0; background: rgba(43,45,66,.45); display: grid; place-items: center; z-index: 20; padding: 16px; }
#modal[hidden] { display: none; }
.mbox { position: relative; width: min(720px, 100%); max-height: 88vh; overflow: auto; padding: 20px; background: var(--bg); border: 3px solid var(--line); border-radius: 20px; box-shadow: 0 8px 0 var(--line); }
.mbox h3 { margin: 0 0 10px; font-size: 20px; }
.muted { color: var(--muted); } .small { font-size: 11px; }
.chk { display: flex !important; gap: 8px; align-items: center; color: var(--ink) !important; font-size: 13px !important; }
.chk input { width: auto; }
.report { white-space: pre-wrap; background: #fff; padding: 14px; border-radius: 12px; border: 2px dashed var(--line); font: 12.5px/1.55 ui-monospace, Menlo, Consolas, monospace; max-height: 60vh; overflow: auto; }
code { background: #ffe9c7; padding: 1px 5px; border-radius: 5px; }

/* ---------- label 3D ---------- */
.agent-label { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; border-radius: 99px; font: 700 11.5px Fredoka, Nunito, sans-serif; white-space: nowrap;
  background: #fff; border: 2px solid var(--line); color: var(--ink); pointer-events: auto; cursor: pointer; position: relative; box-shadow: 0 2px 0 var(--line); }
.agent-label.sel { background: var(--yellow); transform: scale(1.12); }
.agent-label.dept-yayasan { border-left: 6px solid var(--d-yayasan); }
.agent-label.dept-direksi { border-left: 6px solid var(--d-direksi); }
.agent-label.dept-sekretariat { border-left: 6px solid var(--d-sekretariat); }
.agent-label.dept-bisnis { border-left: 6px solid var(--d-bisnis); }
.agent-label.dept-ops { border-left: 6px solid var(--d-ops); }
.agent-label.dept-mkt { border-left: 6px solid var(--d-mkt); }
.agent-label.dept-cs { border-left: 6px solid var(--d-cs); }
.agent-label.guest { opacity: .9; font-weight: 600; background: #f8fafc; }
.agent-label .bar { position: absolute; left: 8px; right: 8px; bottom: -6px; height: 4px; border-radius: 3px; background: #f1e4cc; overflow: hidden; border: 1px solid var(--line); }
.agent-label .bar i { display: block; height: 100%; background: var(--green); width: 0; }
.room-label { font: 700 11px Fredoka, Nunito, sans-serif; color: var(--ink); background: #fff; padding: 2px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none; border: 2px solid var(--line); }
.room-label.small { font-size: 10px; opacity: .85; }

/* ---------- lain-lain ---------- */
#help { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--ink); background: var(--panel); padding: 5px 14px; border-radius: 99px; z-index: 3; white-space: nowrap; border: 2px solid var(--line); font-weight: 700; }
#toasts { position: fixed; top: 86px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 30; align-items: center; }
.toast { background: #fff; border: 3px solid var(--line); padding: 8px 16px; border-radius: 14px; box-shadow: var(--shadow); animation: tin .25s; font-weight: 800; }
.toast.click { cursor: pointer; background: #fff3c4; }
@keyframes tin { from { opacity: 0; transform: translateY(-6px) scale(.95); } }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(135deg, #ffe2c2, #fff3c4, #ffd08a); z-index: 50; text-align: center; font: 700 16px Fredoka, Nunito; }
#loading small { display: block; margin-top: 12px; color: var(--muted); font: 600 12px Nunito; }

@media (max-width: 1100px) { #panel { width: 290px; } .tag { display: none; } }
@media (max-width: 820px) {
  #topbar { flex-wrap: wrap; height: auto; padding: 8px; gap: 8px; } .brand { flex-basis: 100%; }
  #floors { top: auto; bottom: 46px; width: auto; flex-direction: row; flex-wrap: wrap; } .fbtn span { display: none; } .fbtn { grid-template-columns: 32px auto; }
  #panel { display: none; } #card { width: calc(100% - 24px); bottom: 116px; } #help { display: none; }
}
