/* Majelis AI — kulit Grok monokrom. Latar #000000, panel #0A0A0A/#111111/#171717,
   border hairline #262626, teks #FFFFFF, sekunder #A3A3A3. Tanpa warna aksen,
   gradasi, glow, atau glassmorphism. */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #000000;
  --panel: #0a0a0a;
  --panel2: #111111;
  --panel3: #171717;
  --border: #262626;
  --text: #ffffff;
  --muted: #a3a3a3;
  --hover: rgba(255, 255, 255, 0.09);
  --radius: 12px;
}
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: #525252; }
::placeholder { color: #737373; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- layout 3 kolom ---------- */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
header#topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  background: var(--panel); flex: 0 0 auto; min-height: 52px;
}
#topbar .group-mark {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%;
  border: 1px solid #525252; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: 0.5px; background: var(--panel3);
}
#topbar .titles { min-width: 0; flex: 1 1 auto; }
#topbar h1 { font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar .subtitle { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); border: 1px solid transparent; flex: 0 0 auto;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
#btn-menu-left, #btn-menu-right { display: none; }

#main { display: flex; flex: 1 1 auto; min-height: 0; }

/* ---------- sidebar kiri ---------- */
#sidebar {
  width: 264px; flex: 0 0 auto; background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.side-scroll { overflow-y: auto; flex: 1 1 auto; padding: 10px 8px; }
.side-section { margin-bottom: 18px; }
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--muted); text-transform: uppercase;
}
.side-head .add-btn {
  width: 20px; height: 20px; border-radius: 50%; font-size: 15px; line-height: 1;
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
}
.side-head .add-btn:hover { background: var(--hover); color: var(--text); }
.ws-item { margin-bottom: 2px; }
.ws-header {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: 8px; text-align: left; font-weight: 600;
}
.ws-header:hover { background: var(--hover); }
.ws-header.active { background: var(--hover); }
.ws-header .chev { color: var(--muted); font-size: 11px; width: 12px; flex: 0 0 auto; transition: transform 0.15s; }
.ws-header.open .chev { transform: rotate(90deg); }
.ws-header .ws-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-header .ws-tools { display: none; gap: 2px; }
.ws-header:hover .ws-tools, .ws-header.open .ws-tools { display: inline-flex; }
.ws-tools button { color: var(--muted); padding: 2px 5px; border-radius: 6px; font-size: 12px; }
.ws-tools button:hover { background: var(--panel3); color: var(--text); }
.ws-seats { display: none; padding: 2px 0 6px 30px; }
.ws-item.open .ws-seats { display: block; }
.ws-seat { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 6px; color: var(--muted); font-size: 13px; }
.ws-seat:hover { background: var(--hover); color: var(--text); }
.ws-seat .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text); flex: 0 0 auto; }
.channel {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: 8px; text-align: left; color: var(--muted);
}
.channel:hover { background: var(--hover); color: var(--text); }
.channel.active { background: var(--hover); color: var(--text); font-weight: 600; }
.channel .hash { color: var(--muted); }
.channel .busy-mark { margin-left: auto; color: var(--muted); font-size: 12px; }
.side-foot { border-top: 1px solid var(--border); padding: 10px; }
.owner-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.owner-card:hover { background: var(--hover); }
.owner-card .meta { min-width: 0; }
.owner-card .name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.owner-card .role { font-size: 12px; color: var(--muted); }

/* avatar lingkaran inisial monokrom */
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto;
  border: 1px solid #525252; background: var(--panel3);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text);
}
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }

/* ---------- kolom tengah ---------- */
#center { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
#seat-strip {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--panel); flex: 0 0 auto;
}
.seat-chip {
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px 4px 4px;
  background: var(--panel2);
}
.seat-chip .sname { font-weight: 600; font-size: 13px; }
.seat-chip .srole { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; }
.seat-chip .pres { width: 7px; height: 7px; border-radius: 50%; background: var(--text); border: 1px solid #525252; }

#chat-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-bottom: 1px solid var(--border); flex: 0 0 auto;
}
#chat-head .room-title { font-weight: 700; font-size: 14px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#chat-head .room-title .sub { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.pill-btn {
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px;
  font-size: 12px; color: var(--text); background: var(--panel2); white-space: nowrap;
}
.pill-btn:hover { background: var(--panel3); }
.pill-btn.primary { background: var(--text); color: #000; border-color: var(--text); font-weight: 600; }
.pill-btn.primary:hover { background: #e5e5e5; }

/* panel ringkasan tugas */
#task-panel {
  border-bottom: 1px solid var(--border); background: var(--panel);
  padding: 10px 14px; flex: 0 0 auto;
}
#task-panel.hidden { display: none; }
#task-panel .tp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
#task-panel .tp-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; flex: 1 1 auto; }
#task-panel .tp-close { color: var(--muted); font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 6px; }
#task-panel .tp-close:hover { background: var(--hover); color: var(--text); }
#task-panel .tp-status { font-size: 13px; }
#task-panel .tp-snippet { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* area chat */
#chat-scroll { flex: 1 1 auto; overflow-y: auto; padding: 14px; min-height: 0; }
#chat-scroll .day-sep { text-align: center; color: var(--muted); font-size: 11px; margin: 10px 0; }
.msg { display: flex; gap: 10px; padding: 7px 4px; border-radius: 8px; }
.msg:hover { background: var(--panel); }
.msg .m-body { min-width: 0; flex: 1 1 auto; }
.msg .m-head { display: flex; align-items: baseline; gap: 8px; font-size: 12px; margin-bottom: 2px; flex-wrap: wrap; }
.msg .m-name { font-weight: 700; }
.msg .m-role { color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; font-size: 11px; }
.msg .m-time { color: var(--muted); font-size: 11px; }
.msg .m-step { color: var(--muted); font-size: 11px; border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; }
.msg .m-text { font-size: 14px; overflow-wrap: anywhere; }
.msg .m-text p { margin: 0 0 8px; }
.msg .m-text p:last-child { margin-bottom: 0; }
.msg .m-text ul, .msg .m-text ol { margin: 4px 0 8px 20px; }
.msg .m-text li { margin-bottom: 2px; }
.msg .m-text code { background: var(--panel3); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.msg .m-text pre { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; margin: 6px 0; }
.msg .m-text pre code { background: none; border: none; padding: 0; }
.msg .m-text h1, .msg .m-text h2, .msg .m-text h3 { font-size: 14px; margin: 10px 0 4px; }
.msg .m-text img { max-width: 100%; border: 1px solid var(--border); border-radius: 10px; margin-top: 6px; display: block; }
.msg .m-text a { color: var(--text); text-decoration: underline; }
.msg.error .m-text { border: 1px solid var(--border); border-left: 2px solid #737373; background: var(--panel2); border-radius: 8px; padding: 8px 10px; }
.msg .img-prompt { font-size: 12px; color: var(--muted); margin-top: 6px; }
.msg.owner-msg .m-name { color: var(--text); }
.typing { color: var(--muted); font-size: 12px; padding: 4px; }

/* working bar + chips + composer */
#working-bar {
  display: none; padding: 7px 14px; border-top: 1px solid var(--border);
  background: var(--panel); font-size: 12px; color: var(--muted); flex: 0 0 auto;
}
#working-bar.show { display: flex; align-items: center; gap: 8px; }
#working-bar .spin { display: inline-block; width: 12px; height: 12px; border: 2px solid #525252; border-top-color: var(--text); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#chips { display: flex; gap: 8px; padding: 8px 14px 0; flex: 0 0 auto; flex-wrap: wrap; }
#composer { display: flex; gap: 10px; align-items: flex-end; padding: 8px 14px 12px; flex: 0 0 auto; }
#composer textarea {
  flex: 1 1 auto; resize: none; max-height: 120px; min-height: 42px;
  background: var(--panel2); line-height: 1.45;
}
#send-btn {
  background: var(--text); color: #000; border-radius: 999px; font-weight: 700;
  padding: 10px 20px; flex: 0 0 auto;
}
#send-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- panel kanan (anggota) ---------- */
#members {
  width: 240px; flex: 0 0 auto; background: var(--panel);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0;
}
#members .mem-scroll { overflow-y: auto; padding: 12px 10px; flex: 1 1 auto; }
#members h2 { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; padding: 4px 8px 8px; }
.member { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.member:hover { background: var(--hover); }
.member .meta { min-width: 0; flex: 1 1 auto; }
.member .name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.member .role { font-size: 12px; color: var(--muted); }
.member .pres { width: 7px; height: 7px; border-radius: 50%; background: var(--text); border: 1px solid #525252; flex: 0 0 auto; }
.member .busy { font-size: 11px; color: var(--muted); }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.72);
  display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px;
  overflow-y: auto;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 560px; padding: 18px;
}
.modal h2 { font-size: 16px; margin-bottom: 4px; }
.modal .sub { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.modal .field input, .modal .field textarea, .modal .field select { width: 100%; }
.modal .field textarea { min-height: 110px; resize: vertical; }
.modal .row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal .check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modal .check-list label {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; margin: 0; cursor: pointer;
}
.modal .check-list input { width: auto; accent-color: #fff; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.toggle-row .t-label { font-weight: 600; font-size: 13px; }
.toggle-row .t-desc { font-size: 12px; color: var(--muted); }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; background: var(--panel3); border: 1px solid var(--border);
  border-radius: 999px; cursor: pointer; transition: background 0.15s;
}
.switch .slider:before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: var(--muted); border-radius: 50%; transition: transform 0.15s, background 0.15s;
}
.switch input:checked + .slider { background: var(--text); }
.switch input:checked + .slider:before { transform: translateX(18px); background: #000; }
#conn-result { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; max-height: 180px; overflow-y: auto; margin-top: 8px; }
#conn-result:empty { display: none; }
.mem-note { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; background: var(--panel2); }
.mem-note .txt { flex: 1 1 auto; font-size: 13px; }
.mem-note button { color: var(--muted); padding: 0 4px; }
.mem-note button:hover { color: var(--text); }
.empty-note { color: var(--muted); font-size: 13px; }

/* toast */
#toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel3); border: 1px solid var(--border); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; z-index: 80;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* menu @mention */
#mention-menu {
  position: absolute; bottom: 100%; left: 0; margin-bottom: 6px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  min-width: 220px; max-height: 240px; overflow-y: auto; z-index: 40; display: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}
#mention-menu.show { display: block; }
#mention-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; text-align: left; border-radius: 8px; }
#mention-menu button:hover { background: var(--hover); }
#composer-wrap { position: relative; flex: 1 1 auto; display: flex; }

/* ---------- responsif ---------- */
@media (max-width: 980px) {
  #members {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 60;
    transform: translateX(100%); transition: transform 0.2s; width: 280px;
    box-shadow: -8px 0 30px rgba(0, 0, 0, 0.5);
  }
  #members.open { transform: translateX(0); }
  #btn-menu-right { display: inline-flex; }
}
@media (max-width: 720px) {
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    transform: translateX(-100%); transition: transform 0.2s; width: 280px;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.5);
  }
  #sidebar.open { transform: translateX(0); }
  #btn-menu-left { display: inline-flex; }
  #topbar .subtitle { display: none; }
  #chat-head .room-title .sub { display: none; }
}
#scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 55; display: none;
}
#scrim.show { display: block; }
