:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #ffffff;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --green: #059669;
  --green-bg: #d1fae5;
  --rose: #e11d48;
  --violet: #7c3aed;
  --slate: #475569;
  --panel: #1e293b;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(#dbe3ec 1px, transparent 1px);
  background-size: 18px 18px;
  color: var(--ink);
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }

/* ---------- topbar ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 10px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.topbar h1 { margin: 0; font-size: 22px; }
.subtitle { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.livebox {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px;
  font-size: 12px; background: #f8fafc;
}
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  animation: pulse 1.6s infinite;
}
.livebox.offline .live-dot { background: var(--rose); animation: none; }
.live-text { font-weight: 600; }
.live-time { color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.topbar-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.toggle-btn {
  border: 0; background: #fff; padding: 8px 18px; font-weight: 600; color: var(--muted);
}
.toggle-btn.active { background: var(--blue); color: #fff; }
.updated-line { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 8px 14px; font-weight: 600; color: var(--ink);
}
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:disabled { opacity: .6; }
.btn-outline.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-danger { color: var(--rose); border-color: #fecdd3; }
.btn-block { width: 100%; padding: 11px; }

/* ---------- board ---------- */
main { max-width: 860px; margin: 0 auto; padding: 14px 14px 40px; }
.board-section { margin-bottom: 22px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.section-head h2 { font-size: 17px; margin: 0 0 10px; }
.count {
  display: inline-block; min-width: 22px; text-align: center;
  background: var(--ink); color: #fff; border-radius: 999px;
  font-size: 12px; padding: 2px 7px; margin-left: 4px;
}
.cards { display: grid; gap: 10px; }
.empty { color: var(--muted); font-size: 14px; margin: 4px 0; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 13px 14px;
}
.card-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 7px; }
.badge {
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 3px 9px;
  text-transform: uppercase; letter-spacing: .03em;
}
.badge-role-wasdiman { background: #dbeafe; color: #1d4ed8; }
.badge-role-maintenance { background: var(--green-bg); color: #047857; }
.badge-role-client_baru { background: var(--amber-bg); color: #92400e; }
.badge-role-migrasi { background: #ede9fe; color: #6d28d9; }
.badge-project { background: #f1f5f9; color: var(--slate); border: 1px solid var(--line); text-transform: none; letter-spacing: 0; }
.since { font-size: 12px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.card h3 { margin: 0 0 6px; font-size: 16px; line-height: 1.35; }
.note { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: #334155; white-space: pre-wrap; word-break: break-word; }
.question {
  margin: 0 0 8px; font-size: 14px; line-height: 1.5;
  background: #fffbeb; border: 1px solid #fde68a; border-radius: 10px; padding: 9px 11px;
  white-space: pre-wrap; word-break: break-word;
}
.question-label { display: block; font-size: 11px; font-weight: 700; color: var(--amber); text-transform: uppercase; margin-bottom: 3px; }
.answer-shown {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 9px 11px;
  font-size: 14px; line-height: 1.5; margin: 0 0 8px; white-space: pre-wrap; word-break: break-word;
}
.answer-shown .answer-label { display: block; font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; margin-bottom: 3px; }
.answer-form textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  font-size: 14px; resize: vertical; min-height: 64px;
}
.answer-form textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
.answer-actions { display: flex; gap: 8px; margin-top: 8px; }
.link-btn { background: none; border: 0; color: var(--blue); font-size: 13px; font-weight: 600; padding: 4px 0; }
.kelola-controls {
  display: flex; gap: 8px; margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line); flex-wrap: wrap; align-items: center;
}
.kelola-controls select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; }
details.older { border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; padding: 10px 14px; }
details.older summary { font-weight: 700; cursor: pointer; font-size: 14px; }
details.older .cards { margin-top: 10px; }
details.older .card { opacity: .85; }

/* ---------- office ---------- */
#officeView { max-width: 1080px; }
.office-wrap { display: flex; gap: 14px; align-items: flex-start; }
.office-scene {
  position: relative; flex: 1; min-height: 480px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line);
  background-color: #efe6cf;
  background-image: repeating-conic-gradient(#e7dcc0 0% 25%, #efe6cf 0% 50%);
  background-size: 48px 48px;
}
.carpet {
  position: absolute; left: 6%; right: 6%; top: 12%; bottom: 8%;
  background: #3b82f6;
  background-image: radial-gradient(#60a5fa 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  border-radius: 12px;
  border: 3px solid #1d4ed8;
}
.desk-spot { position: absolute; width: 120px; text-align: center; }
.desk-spot .monitor {
  width: 64px; height: 44px; margin: 0 auto; background: #0f172a; border-radius: 6px 6px 0 0;
  border: 3px solid #334155; border-bottom: 0; position: relative; overflow: hidden;
}
.desk-spot .monitor .screen {
  position: absolute; inset: 4px; background: #020617; border-radius: 2px; overflow: hidden;
}
.desk-spot.working .monitor { box-shadow: 0 0 14px rgba(96, 165, 250, .9); }
.desk-spot.working .screen::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, transparent 0 4px, rgba(74, 222, 128, .85) 4px 5px, transparent 5px 9px);
  animation: codelines 1.1s steps(3) infinite;
}
@keyframes codelines { 0% { transform: translateY(0); } 100% { transform: translateY(9px); } }
.desk-spot .desk-top {
  height: 12px; margin: 0 auto; width: 104px; background: #92400e; border-radius: 3px;
  border: 2px solid #78350f;
}
.char-wrap { position: relative; margin-top: 2px; }
.char-wrap canvas { image-rendering: pixelated; width: 48px; height: 64px; }
.desk-spot.working .char-wrap canvas { animation: typing-bob .38s infinite; }
@keyframes typing-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
.name-tag {
  display: inline-block; margin-top: 2px; background: rgba(15, 23, 42, .85); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap;
}
.bubble {
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px;
  font-size: 12px; line-height: 1.35; width: 168px; text-align: left; z-index: 5;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .18);
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px;
  background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
}
.bubble .bubble-label { display: block; font-size: 10px; font-weight: 700; color: var(--green); text-transform: uppercase; }
.bubble .typing-dots i {
  display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--muted);
  margin-left: 2px; animation: dotblink 1s infinite;
}
.bubble .typing-dots i:nth-child(2) { animation-delay: .2s; }
.bubble .typing-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dotblink { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.status-line { font-size: 11px; color: #475569; margin-top: 2px; }
.office-tree { position: absolute; left: 14px; bottom: 12px; }
.office-tree canvas { image-rendering: pixelated; width: 44px; height: 52px; }
.boss-spot { position: absolute; top: 10px; right: 14px; width: 120px; text-align: center; z-index: 4; }
.boss-badge {
  position: absolute; top: -6px; right: 18px; background: var(--rose); color: #fff;
  font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; z-index: 6;
}

.team-panel {
  width: 320px; flex-shrink: 0; background: var(--panel); color: #e2e8f0;
  border-radius: 16px; padding: 14px;
}
.team-panel h2 { margin: 0 0 10px; font-size: 14px; letter-spacing: .12em; color: #94a3b8; }
.team-member { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #334155; }
.team-member:last-child { border-bottom: 0; }
.team-member canvas { image-rendering: pixelated; width: 28px; height: 36px; flex-shrink: 0; background: #0f172a; border-radius: 6px; }
.team-member.working canvas { animation: typing-bob .38s infinite; }
.team-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: #22c55e; }
.dot-yellow { background: #eab308; }
.dot-grey { background: #64748b; }
.team-activity { font-size: 12px; color: #cbd5e1; line-height: 1.4; margin-top: 2px; word-break: break-word; }
.boss-tray { margin-top: 14px; border-top: 1px solid #334155; padding-top: 12px; }
.boss-tray h3 { margin: 0 0 8px; font-size: 13px; color: #fbbf24; }
.boss-tray .count { background: var(--rose); }
.tray-card {
  background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 10px; margin-bottom: 8px;
}
.tray-card h4 { margin: 0 0 5px; font-size: 13px; color: #fff; }
.tray-card .question { background: #1e293b; border-color: #475569; color: #e2e8f0; font-size: 13px; }
.tray-card textarea {
  width: 100%; border: 1px solid #475569; background: #1e293b; color: #fff;
  border-radius: 8px; padding: 8px 10px; font-size: 13px; resize: vertical; min-height: 52px;
}
.tray-card .answer-shown { background: #052e16; border-color: #166534; color: #dcfce7; font-size: 13px; }
.tray-card .empty { color: #94a3b8; }

/* ---------- modal / toast / login ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 20px 14px; overflow-y: auto;
}
.modal { background: #fff; border-radius: 16px; padding: 18px; width: 100%; max-width: 520px; }
.modal h2 { margin: 0 0 12px; font-size: 18px; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 11px; }
.modal input, .modal textarea, .modal select {
  display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; font-size: 14px; background: #fff;
}
.modal textarea { resize: vertical; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 3px; }
.form-error { color: var(--rose); font-size: 13px; margin: 0 0 10px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 999px; padding: 10px 18px;
  font-size: 14px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); max-width: 92vw; text-align: center;
}
.login-page { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
.login-wrap { width: 100%; max-width: 400px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.login-card h1 { margin: 0 0 4px; font-size: 24px; }
.login-card .subtitle { margin-bottom: 18px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.login-card input {
  display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px; font-size: 16px;
}

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .office-wrap { flex-direction: column; }
  .office-scene { width: 100%; min-height: 430px; }
  .team-panel { width: 100%; }
  .topbar h1 { font-size: 19px; }
  .live-time { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
}
