:root {
  --bg: #0f0d17; --panel: #17142a; --card: #1e1a33; --line: #2e2848; --text: #ece9f7; --muted: #9a93b8;
  --accent: #8b5cf6; --accent2: #a78bfa; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
h2 { margin: 0 0 4px; font-size: 22px; } h3 { margin: 24px 0 8px; }
.muted { color: var(--muted); margin: 0 0 14px; }
.err { color: var(--bad); min-height: 1em; }
code { background: #00000055; padding: 1px 5px; border-radius: 4px; }
input, select, textarea { background: #120f20; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; font: inherit; width: 100%; }
textarea { resize: vertical; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #04210f; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.wide { width: 100%; margin: 14px 0; }
.btn:disabled { opacity: .5; cursor: wait; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.filters { display: flex; gap: 8px; } .filters select { width: auto; }

.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 360px; display: grid; gap: 10px; }

.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; } .brand small { display: block; color: var(--muted); }
.logo { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #ec4899); display: grid; place-items: center; font-weight: 800; }
nav { display: grid; gap: 2px; }
nav a { padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); }
nav a:hover { background: var(--card); color: var(--text); }
nav a.active { background: var(--card); color: var(--text); border-left: 3px solid var(--accent); }
.budget { margin-top: auto; font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: #0006; border-radius: 4px; margin-top: 6px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--accent); width: 0; }
.me { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
main { padding: 24px; min-width: 0; }
.banner { background: #f59e0b22; border: 1px solid var(--warn); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; }

/* office floor */
.office { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; padding: 18px; border-radius: 16px;
  background: repeating-linear-gradient(90deg, #1b1730 0 60px, #1d1934 60px 120px); border: 1px solid var(--line); }
.desk { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; transition: transform .15s, border-color .15s; }
.desk:hover { transform: translateY(-3px); border-color: var(--accent2); }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; position: relative; flex: none; }
.avatar.kerja::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ok); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .2; } }
.desk .who { display: flex; gap: 10px; align-items: center; }
.desk .role { color: var(--muted); font-size: 12px; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: #ffffff14; color: var(--muted); }
.pill.kerja, .pill.dikerjakan { background: #22c55e22; color: var(--ok); }
.pill.review { background: #f59e0b22; color: var(--warn); }
.pill.gagal { background: #ef444422; color: var(--bad); }
.pill.selesai { background: #8b5cf622; color: var(--accent2); }
.pill.tinggi { background: #ef444422; color: #fca5a5; }
.desk .stats { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }

/* tasks */
.task .meta { color: var(--muted); font-size: 12px; display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0; }
.task .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.result { background: #0f0c1c; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-top: 10px; max-height: 420px; overflow: auto; }
.result.qa { border-color: var(--warn); }
.md h1, .md h2, .md h3, .md h4 { font-size: 15px; margin: 10px 0 4px; }
.md p { margin: 6px 0; } .md ul, .md ol { margin: 4px 0; padding-left: 20px; }
.md table { border-collapse: collapse; margin: 6px 0; } .md td, .md th { border: 1px solid var(--line); padding: 4px 8px; }
.md blockquote { border-left: 3px solid var(--accent); margin: 6px 0; padding-left: 10px; color: var(--muted); }

/* chat */
.chatlog { height: calc(100vh - 260px); min-height: 260px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 80%; padding: 10px 12px; border-radius: 12px; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.assistant { align-self: flex-start; background: #0f0c1c; border: 1px solid var(--line); }
.chatform { display: flex; gap: 8px; align-items: flex-end; }
.chk { display: flex; gap: 4px; align-items: center; white-space: nowrap; color: var(--muted); } .chk input { width: auto; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; }
label.f { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
table.t { width: 100%; border-collapse: collapse; } .t td, .t th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }

.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal-box { width: 100%; max-width: 620px; max-height: 90vh; overflow: auto; position: relative; }
.modal-box form { display: grid; gap: 10px; }
.x { position: absolute; right: 10px; top: 6px; background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.menu { display: grid; gap: 8px; margin-top: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--card); border: 1px solid var(--accent); padding: 10px 16px; border-radius: 10px; z-index: 20; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  nav { grid-template-columns: repeat(3, 1fr); }
  main { padding: 16px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .msg { max-width: 95%; }
}
