:root {
  --bg: #0b1017; --panel: #121a25; --panel2: #18222f; --line: #263445; --text: #e6edf5; --muted: #8b9bb0;
  --accent: #35c2a1; --accent-ink: #04221b;
  --idle: #6b7d93; --working: #35c2a1; --queued: #4d9de0; --waiting: #e08a3c; --approval: #f2c94c; --failed: #e5534b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); overflow: hidden; font-size: 14px; }
[hidden] { display: none !important; }
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3b4e66; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.danger { border-color: #6b2b28; color: #ff8f88; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
input, textarea, select { background: #0d141d; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-right: 8px; box-shadow: 0 0 10px var(--accent); }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); margin-left: 6px; }
.badge.warn { color: var(--approval); border-color: #6a5a20; }
.badge.ok { color: var(--working); border-color: #1f5a4c; }
.count { background: var(--approval); color: #2a2000; border-radius: 99px; padding: 0 7px; font-weight: 700; font-size: 12px; margin-left: 4px; }

#topbar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: linear-gradient(#0b1017ee, #0b101700); z-index: 5; }
.brandmark { font-weight: 700; font-size: 16px; display: flex; align-items: center; }
.stats { color: var(--muted); font-size: 12px; flex: 1; }
#topbar nav { display: flex; gap: 8px; }
#legend { position: fixed; left: 16px; bottom: 14px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); z-index: 4;
  background: #0b1017cc; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); max-width: calc(100vw - 32px); }
.s { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.s.idle { background: var(--idle); } .s.working { background: var(--working); } .s.queued { background: var(--queued); }
.s.waiting { background: var(--waiting); } .s.approval { background: var(--approval); } .s.failed { background: var(--failed); }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.s.none { background: transparent; border: 1px solid var(--line); }
#floors { position: fixed; left: 16px; top: 64px; display: flex; flex-direction: column; gap: 6px; z-index: 4; max-height: calc(100vh - 150px); overflow-y: auto; }
.floorbtn { display: flex; align-items: center; gap: 8px; text-align: left; background: #0b1017cc; border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px 7px 10px; cursor: pointer; min-width: 190px; }
.floorbtn:hover { border-color: #3b4e66; }
.floorbtn.on { border-color: var(--accent); background: #10231fcc; }
.floorbtn span { display: block; font-weight: 600; }
.floorbtn small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
#gmbar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(620px, calc(100vw - 32px)); display: flex; gap: 8px; z-index: 5;
  background: #0b1017ee; border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 8px 24px #0008; }
#gmbar input { border: 0; background: transparent; }
#legend { bottom: 76px; }
.floor-sign { pointer-events: auto; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--muted); background: #0b1017dd; border: 1px solid var(--line); border-radius: 8px; padding: 3px 10px; white-space: nowrap; }
.floor-sign:hover { color: var(--text); border-color: var(--accent); }
.room-sign.project { border-color: #2f5a7a; }
.tag.compact { font-size: 11px; }
.tag.compact[data-status="idle"] { display: none; }
.card.slim { padding: 9px 12px; margin-top: 8px; }
.card .detail { white-space: pre-wrap; color: var(--text); margin: 6px 0 0; line-height: 1.5; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.check { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-size: 13px; }
.check input { width: auto; }

/* 3D sahnedeki etiketler */
.tag { font-size: 12px; text-align: center; pointer-events: none; user-select: none; text-shadow: 0 1px 3px #000; }
.tag b { display: block; font-weight: 600; }
.tag span { display: inline-block; margin-top: 2px; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #0b1017cc; border: 1px solid; }
.tag .idle { color: var(--idle); } .tag .working { color: var(--working); } .tag .queued { color: var(--queued); }
.tag .waiting { color: var(--waiting); } .tag .approval { color: var(--approval); } .tag .failed { color: var(--failed); }
.room-sign { pointer-events: auto; cursor: pointer; background: #0b1017dd; border: 1px solid var(--line); border-radius: 10px; padding: 5px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.room-sign small { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 11px; }
.room-sign small.on { color: var(--working); }

#drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(430px, 100vw); background: var(--panel); border-left: 1px solid var(--line);
  z-index: 6; display: flex; flex-direction: column; box-shadow: -12px 0 30px #0008; }
.dh { padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.dh h2 { margin: 0; font-size: 18px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dh .sub { color: var(--muted); margin-top: 4px; font-size: 12px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 99px; border: 1px solid; font-weight: 600; }
.pill.idle { color: var(--idle); } .pill.working { color: var(--working); } .pill.queued { color: var(--queued); }
.pill.waiting { color: var(--waiting); } .pill.approval { color: var(--approval); } .pill.failed { color: var(--failed); }
.db { padding: 14px 18px; overflow-y: auto; flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; } .row > .fit { flex: 0 0 auto; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.log { background: #0a0f16; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; max-height: 260px; overflow-y: auto;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.log .tool { color: var(--queued); } .log .system { color: var(--muted); } .log .error { color: var(--failed); }
.log .tool::before { content: "⚙ "; } .log .system::before { content: "· "; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; background: var(--panel2); }
.hist li:hover { border-color: #3b4e66; }
.hist .meta { color: var(--muted); font-size: 11px; display: flex; gap: 8px; justify-content: space-between; margin-top: 3px; }
.hist .p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-done { color: var(--working); } .st-failed { color: var(--failed); } .st-running { color: var(--working); }
.st-queued { color: var(--queued); } .st-cancelled { color: var(--muted); }
.muted { color: var(--muted); font-size: 12px; line-height: 1.5; }

#modal { position: fixed; inset: 0; background: #05080ccc; z-index: 8; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(720px, 100%); padding: 20px 22px; }
.sheet h2 { margin: 0 0 4px; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 12px; background: var(--panel2); }
.card .top { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.ap { display: grid; grid-template-columns: 180px 1fr; gap: 12px; }
.ap .img { aspect-ratio: 1; background: #0a0f16; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted);
  font-size: 12px; text-align: center; overflow: hidden; cursor: pointer; padding: 8px; }
.ap .img img { width: 100%; height: 100%; object-fit: cover; margin: -8px; width: calc(100% + 16px); height: calc(100% + 16px); max-width: none; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.err { color: var(--failed); font-size: 12px; min-height: 1em; margin: 6px 0 0; }
.switch { flex: 0 0 auto; width: 38px; height: 22px; border-radius: 99px; background: #2a3646; border: 0; position: relative; cursor: pointer; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #c9d4e2; transition: left .15s; }
.switch[aria-checked="true"] { background: var(--accent); } .switch[aria-checked="true"]::after { left: 19px; background: #fff; }
@media (max-width: 900px) { .stats { display: none; } #legend { display: none; } }
@media (max-width: 560px) { .ap { grid-template-columns: 1fr; } #floors { display: none; } #topbar { flex-wrap: wrap; } }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 9px 16px;
  border-radius: 10px; z-index: 10; max-width: 90vw; box-shadow: 0 8px 24px #0008; }
#toast.bad { border-color: #6b2b28; color: #ff8f88; }

#login { position: fixed; inset: 0; margin: auto; width: min(340px, 90vw); height: fit-content; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px; z-index: 20; }
#login h1 { font-size: 20px; margin: 0 0 14px; display: flex; align-items: center; }
#login .btn { width: 100%; margin-top: 14px; }
