/* Prime Agent Hub v5 — styles */
:root {
  --bg: #0f1117;
  --bg-soft: #12151e;
  --panel: #171a23;
  --panel-2: #1d212c;
  --border: #262b3a;
  --text: #e6e8ee;
  --muted: #9aa3b5;
  --accent: #7c5cff;
  --accent2: #00d4aa;
  --user-bubble: #2b2f3e;
  --assistant-bubble: #1a1e2a;
  --danger: #ff6b6b;
  --ok: #00d4aa;
  --warn: #ffc107;
  --sidebar-w: 272px;
  --radius: 12px;
}
html[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-2: #eef0f4;
  --border: #d8dce4;
  --text: #1a1d26;
  --muted: #6b7280;
  --user-bubble: #e4e7ee;
  --assistant-bubble: #ffffff;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden;
}
button { font-family: inherit; }
.btn {
  background: transparent; color: var(--muted); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: all .2s;
}
.btn:hover { border-color: var(--accent); color: var(--text); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; font-weight: 700; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: rgba(255,107,107,.1); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn {
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  font-size: 18px; width: 34px; height: 34px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center; transition: all .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ===== Layout ===== */
#app { flex: 1; display: flex; min-height: 0; }

/* Sidebar */
#sidebar {
  width: var(--sidebar-w); flex-shrink: 0; display: flex; flex-direction: column;
  background: var(--bg-soft); border-right: 1px solid var(--border);
  transition: margin-left .25s ease;
}
#sidebar.collapsed { margin-left: calc(var(--sidebar-w) * -1); }
.side-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.side-head .logo-badge { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.side-title { font-weight: 700; font-size: 14.5px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#new-chat-btn { width: 100%; margin: 10px 12px; width: calc(100% - 24px); padding: 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text); font-size: 13.5px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
#new-chat-btn:hover { border-color: var(--accent); }
#session-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.sess-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px;
  cursor: pointer; font-size: 13px; color: var(--text); border: 1px solid transparent; margin-bottom: 2px;
}
.sess-item:hover { background: var(--panel-2); }
.sess-item.active { background: var(--panel-2); border-color: var(--accent); }
.sess-item .s-icon { font-size: 15px; flex-shrink: 0; }
.sess-item .s-main { flex: 1; min-width: 0; }
.sess-item .s-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-item .s-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.sess-item .s-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; display: inline-block; }
.sess-item.busy .s-dot { background: var(--warn); box-shadow: 0 0 6px var(--warn); animation: blink 1.2s infinite; }
.sess-item .s-close { color: var(--muted); font-size: 15px; line-height: 1; padding: 2px 4px; border: none; background: none; cursor: pointer; opacity: 0; transition: opacity .15s; }
.sess-item:hover .s-close { opacity: 1; }
.sess-item .s-close:hover { color: var(--danger); }
/* Pin chat (#15): tombol 📌 selalu terlihat */
.sess-item .s-pin { color: var(--muted); font-size: 13px; line-height: 1; padding: 2px 4px; border: none; background: none; cursor: pointer; opacity: .55; transition: opacity .15s; }
.sess-item .s-pin:hover { opacity: 1; }
.sess-item .s-pin:has(+ .s-close) { margin-right: 2px; }
@keyframes blink { 0%,80%,100% {opacity:.3} 40% {opacity:1} }

.side-foot { border-top: 1px solid var(--border); padding: 8px; }
.side-foot-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  cursor: pointer; font-size: 13px; color: var(--text); width: 100%; background: none; border: none; text-align: left;
}
.side-foot-item:hover { background: var(--panel-2); }
.side-foot-item .f-ico { font-size: 16px; width: 22px; text-align: center; }
.side-foot-item .f-name { flex: 1; }
.side-foot-item .f-badge { font-size: 10px; color: var(--muted); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--border); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #3a4160; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; color: #fff; flex-shrink: 0; }
.user-meta { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--muted); }

/* Main */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  border-bottom: 1px solid var(--border); background: var(--panel); flex-shrink: 0;
}
#topbar .tb-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.model-select {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 8px; font-size: 12.5px; outline: none; max-width: 230px;
}
.model-select:focus { border-color: var(--accent); }
.status-pill { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 8px var(--ok); }
.status-pill.busy .status-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
#topbar .spacer { flex: 1; }

/* Chat */
#chat { flex: 1; overflow-y: auto; padding: 20px 0; scroll-behavior: smooth; }
.container { max-width: 820px; margin: 0 auto; padding: 0 20px; }
.msg { display: flex; margin-bottom: 18px; }
.msg.user { justify-content: flex-end; }
.msg.assistant { justify-content: flex-start; }
.bubble { max-width: 88%; padding: 12px 16px; border-radius: 16px; line-height: 1.65; font-size: 14.5px; word-wrap: break-word; min-width: 0; }
.bubble p { margin: 0 0 8px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 { margin: 12px 0 6px; line-height: 1.3; }
.bubble h1 { font-size: 18px; } .bubble h2 { font-size: 16px; } .bubble h3 { font-size: 15px; }
.bubble ul, .bubble ol { margin: 6px 0 10px; padding-left: 22px; }
.bubble li { margin-bottom: 3px; }
.bubble a { color: var(--accent2); }
.bubble table { border-collapse: collapse; margin: 8px 0; width: 100%; font-size: 13px; }
.bubble th, .bubble td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.bubble th { background: var(--panel-2); }
.bubble blockquote { border-left: 3px solid var(--accent); margin: 8px 0; padding: 2px 12px; color: var(--muted); }
.bubble img { max-width: 100%; border-radius: 8px; }
.user .bubble { background: var(--user-bubble); border-bottom-right-radius: 4px; }
.assistant .bubble { background: var(--assistant-bubble); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 15px; margin-right: 10px; margin-top: 4px; object-fit: cover; overflow: hidden; background: #262b3a; }
.assistant .avatar { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.assistant .avatar.thinking { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.user .avatar { background: #3a4160; margin-right: 0; margin-left: 10px; order: 2; }
.typing { color: var(--muted); font-size: 14px; }
.typing span { animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
.msg-actions { display: flex; gap: 2px; margin-top: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-actions { opacity: 1; }
.msg-actions .icon-btn { font-size: 14px; width: 28px; height: 28px; }
.code-block { position: relative; margin: 8px 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.code-block .code-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: #0d1016; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.code-block pre { margin: 0; padding: 14px; overflow-x: auto; max-height: 420px; }
.code-block code { font-family: "JetBrains Mono", "Fira Code", Consolas, monospace; font-size: 13px; background: transparent !important; }
.diff-add { background: rgba(0,212,170,.12); }
.diff-del { background: rgba(255,107,107,.12); }
.msg-error { color: var(--danger); }
/* Citations 2-lapis (Papi 16 Agu 2026): blok "Berdasarkan pengamatan saya di internet" tampil rapi */
.bubble blockquote { border-left: 3px solid var(--accent, #6c8cff); background: rgba(108,140,255,.07); margin: 10px 0; padding: 10px 14px; border-radius: 8px; color: var(--text); }
.bubble blockquote a { color: var(--accent, #6c8cff); text-decoration: underline; }
.bubble blockquote a:hover { opacity: .8; }

/* Input */
#input-area { border-top: 1px solid var(--border); background: var(--panel); padding: 14px 12px 14px; flex-shrink: 0; }
.input-wrap { max-width: 900px; margin: 0 auto; display: flex; gap: 8px; align-items: stretch; }
.input-side { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; justify-content: stretch; }
.input-side #upload-btn, .input-side #prompt-btn, .input-side #img-btn { width: 40px; height: 34px; }
#message { flex: 1; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 13px 16px; border-radius: 12px; font-size: 14.5px; outline: none; resize: none; min-height: 120px; max-height: 260px; }
#message:focus { border-color: var(--accent); }
#send { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border: none; width: 46px; border-radius: 12px; font-size: 18px; font-weight: 700; cursor: pointer; transition: opacity .2s; height: 46px; }
#send:disabled { opacity: .4; cursor: not-allowed; }
.input-right { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
#stop-btn { background: #d64545; color: #fff; border: none; border-radius: 12px; width: 46px; height: 46px; font-size: 18px; cursor: pointer; flex-shrink: 0; }
#stop-btn:hover { background: #b53434; }
.input-model-bar { max-width: 900px; margin: 10px auto 0; display: flex; }
.input-model-bar .model-select { width: auto; min-width: 200px; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 8px 12px; border-radius: 10px; font-size: 13px; outline: none; }
.input-model-bar .model-select:focus { border-color: var(--accent); }
#attach-btn { width: 38px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--muted); font-size: 16px; cursor: pointer; }
#attach-btn:hover { border-color: var(--accent); color: var(--text); }
#image-preview { display: flex; gap: 8px; max-width: 820px; margin: 0 auto 8px; }
#image-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.hint { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 10px; }

/* Artifacts (panel kanan) */
#artifacts { width: 300px; border-left: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; flex-shrink: 0; }
#artifacts.hidden { display: none !important; }
.art-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 14px; }
.art-count { color: var(--muted); font-size: 12px; font-weight: 400; }
#artifact-list { flex: 1; overflow-y: auto; padding: 8px; }
.art-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text); transition: background .15s; }
.art-item:hover { background: var(--panel-2); }
.art-item .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; }
.art-item .fsize { color: var(--muted); font-size: 11px; flex-shrink: 0; }
.art-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }
.art-empty b { color: var(--accent); }

/* Artifact viewer */
#artifact-viewer { position: fixed; inset: 0; background: rgba(8,9,14,.94); backdrop-filter: blur(4px); display: none; flex-direction: column; z-index: 90; }
#artifact-viewer.open { display: flex; }
.av-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--panel); }
.av-title { font-weight: 700; font-family: "JetBrains Mono", Consolas, monospace; font-size: 14px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.av-actions { display: flex; gap: 8px; flex-shrink: 0; }
.av-body { flex: 1; overflow: auto; padding: 0; }
.av-body pre { margin: 0; padding: 24px; font-size: 13.5px; }
.av-body iframe { width: 100%; height: 100%; border: none; background: #fff; }
.av-body img { max-width: 100%; display: block; margin: 0 auto; }
/* FIX (Papi 16 Agu 2026): preview dokumen Word/Excel/MD — kertas putih, rapi, scroll */
.docx-preview, .xlsx-preview, .md-preview, .txt-preview { background: #fff; color: #1a1a1a; padding: 24px 28px; min-height: 100%; }
.txt-preview pre { margin: 0; font-family: Consolas, "Courier New", monospace; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.docx-preview h1, .docx-preview h2, .docx-preview h3 { margin-top: 18px; }
.docx-preview p { line-height: 1.7; margin: 10px 0; }
.docx-preview img { max-width: 100%; }
.xlsx-preview table { border-collapse: collapse; width: 100%; font-size: 13px; }
.xlsx-preview td, .xlsx-preview th { border: 1px solid #ccc; padding: 6px 10px; }
.xlsx-preview th { background: #f1f1f1; font-weight: 700; }
.md-preview h1, .md-preview h2, .md-preview h3, .md-preview h4 { margin-top: 20px; color: #111; }
.md-preview p { line-height: 1.7; margin: 10px 0; }
.md-preview table { border-collapse: collapse; margin: 14px 0; }
.md-preview td, .md-preview th { border: 1px solid #ccc; padding: 6px 10px; }
.md-preview code { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.md-preview pre { background: #f5f5f5; padding: 14px; border-radius: 8px; overflow: auto; }
.md-preview img { max-width: 100%; }
.close-x { cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; background: none; border: none; }
.close-x:hover { color: var(--text); }

/* Settings drawer (dari sidebar, fullscreen overlay) */
#settings { position: fixed; inset: 0; background: rgba(8,9,14,.94); backdrop-filter: blur(4px); display: none; flex-direction: column; z-index: 95; }
#settings.open { display: flex; }
.set-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid var(--border); background: var(--panel); }
.set-title { font-weight: 700; font-size: 16px; }
.set-body { flex: 1; overflow: hidden; display: flex; min-height: 0; }
.set-tabs { width: 190px; border-right: 1px solid var(--border); padding: 14px 10px; flex-shrink: 0; overflow-y: auto; min-height: 0; }
.set-tab { padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.set-tab:hover { background: var(--panel-2); color: var(--text); }
.set-tab.active { background: var(--panel-2); color: var(--text); border-left: 3px solid var(--accent); }
.set-panel { flex: 1; padding: 22px 26px; overflow-y: auto; min-height: 0; }
.set-panel h3 { margin-bottom: 18px; font-size: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input[type="text"], .field input[type="password"], .field input[type="file"], .field select {
  width: 100%; max-width: 420px; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.avatar-preview { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; background: #3a4160; border: 3px solid var(--border); margin-bottom: 12px; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 800; color: #fff; }
.user-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.user-row .u-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #3a4160; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff; }
.user-row .u-info { flex: 1; }
.user-row .u-info .u-name { font-size: 14px; font-weight: 600; }
.user-row .u-info .u-username { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; font-size: 10.5px; padding: 2px 8px; border-radius: 10px; background: rgba(124,92,255,.18); color: var(--accent); font-weight: 600; }
.badge.member { background: rgba(154,163,181,.15); color: var(--muted); }
.msg-ok { color: var(--ok); font-size: 13px; margin-top: 6px; min-height: 18px; }
.msg-err { color: var(--danger); font-size: 13px; margin-top: 6px; min-height: 18px; }
.key-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.key-row .k-prov { font-weight: 700; font-size: 14px; width: 110px; }
.key-row .k-mask { font-family: "JetBrains Mono", Consolas, monospace; font-size: 12.5px; color: var(--muted); flex: 1; min-width: 120px; }
.key-row .k-actions { display: flex; gap: 6px; }

/* Login */
/* ===== Login (redesign Aaron 14 Agu — glassmorphism premium) ===== */
#login-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 800px at 15% -10%, #1b1e33 0%, #0c0e16 55%, #0a0b12 100%);
  overflow: hidden;
}
#login-overlay.hidden { display: none; }
.login-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: loginFloat 14s ease-in-out infinite alternate; will-change: transform; }
.login-blob.b1 { width: 480px; height: 480px; left: -100px; top: -80px; background: radial-gradient(circle, rgba(124,92,255,.55), transparent 65%); }
.login-blob.b2 { width: 420px; height: 420px; right: -120px; bottom: -60px; background: radial-gradient(circle, rgba(0,212,170,.4), transparent 65%); animation-delay: -4s; }
.login-blob.b3 { width: 320px; height: 320px; left: 38%; top: 55%; background: radial-gradient(circle, rgba(64,156,255,.32), transparent 65%); animation-delay: -8s; }
.login-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 75%); -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 75%); }
@keyframes loginFloat { 0% { transform: translate(0,0) scale(1); } 100% { transform: translate(40px,-30px) scale(1.08); } }
.login-card {
  position: relative; z-index: 2;
  width: 400px; max-width: 92%; text-align: center;
  padding: 40px 36px 28px;
  border-radius: 24px;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.08);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: loginIn .5s cubic-bezier(.2,.9,.3,1.2) both;
}
@keyframes loginIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 20px; }
.login-logo-wrap .logo-badge { width: 68px; height: 68px; border-radius: 20px; border: 2px solid rgba(255,255,255,.14); box-shadow: 0 10px 34px rgba(124,92,255,.45), 0 0 0 8px rgba(124,92,255,.08); }
.login-brand { font-size: 15px; font-weight: 800; letter-spacing: .12em; color: rgba(255,255,255,.85); text-transform: uppercase; }
.login-card h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; background: linear-gradient(90deg, #c9b8ff, #7cf7e0); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.login-card .login-sub { color: rgba(255,255,255,.55); font-size: 13.5px; margin-bottom: 24px; }
.login-field { position: relative; margin-bottom: 14px; }
.login-field .lf-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: .6; pointer-events: none; }
.login-field input {
  width: 100%; padding: 14px 14px 14px 42px;
  background: rgba(255,255,255,.05); color: #fff;
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  font-size: 14.5px; outline: none; transition: all .2s;
}
.login-field input::placeholder { color: rgba(255,255,255,.35); }
.login-field input:focus { border-color: #7c5cff; background: rgba(124,92,255,.08); box-shadow: 0 0 0 4px rgba(124,92,255,.14); }
#login-btn, #mfa-verify-btn {
  width: 100%; margin-top: 6px; padding: 14px;
  border: none; border-radius: 14px;
  background: linear-gradient(135deg, #7c5cff, #00d4aa);
  color: #fff; font-weight: 800; font-size: 15px; cursor: pointer;
  box-shadow: 0 10px 28px rgba(124,92,255,.35);
  transition: transform .15s, box-shadow .2s, filter .2s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
#login-btn:hover, #mfa-verify-btn:hover { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(124,92,255,.5); filter: brightness(1.05); }
#login-btn:active, #mfa-verify-btn:active { transform: translateY(0); }
#login-btn:disabled { opacity: .7; cursor: wait; transform: none; }
#mfa-verify-btn { background: linear-gradient(135deg, #00d4aa, #7c5cff); }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#login-error { margin-top: 14px; font-size: 12.5px; color: #ff8a8a; background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.25); border-radius: 10px; padding: 8px 10px; display: none; }
#login-error:not(:empty) { display: block; }
.login-foot { margin-top: 22px; font-size: 11px; color: rgba(255,255,255,.3); letter-spacing: .08em; }
.login-home { display: inline-flex; align-items: center; gap: 6px; color: rgba(255,255,255,.65); font-size: 13px; text-decoration: none; padding: 8px 14px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; background: rgba(255,255,255,.04); backdrop-filter: blur(8px); transition: all .2s; }
.login-home:hover { color: #fff; border-color: rgba(124,92,255,.6); background: rgba(124,92,255,.12); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--accent); color: var(--text); padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 200; display: none; box-shadow: 0 8px 30px rgba(0,0,0,.5); }

/* Responsive: mobile drawer */
@media (max-width: 768px) {
  #sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 80; box-shadow: 0 0 40px rgba(0,0,0,.5); }
  #sidebar.collapsed { margin-left: calc(var(--sidebar-w) * -1); }
  #sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 70; display: none; }
  #sidebar-overlay.show { display: block; }
  #artifacts { display: none; }
  #artifacts.open-mobile { display: flex; position: fixed; right: 0; top: 0; bottom: 0; z-index: 85; box-shadow: 0 0 40px rgba(0,0,0,.5); width: min(320px, 85vw); }
  .set-tabs { width: 150px; }
  /* FIX preview artefak mobile (Papi 16 Agu 2026): header 2 baris — baris atas = judul + Close (selalu terlihat),
     baris bawah = tombol aksi. Tidak ada yang terpotong di layar HP. */
  .av-head { padding: 10px 10px; gap: 8px; flex-wrap: wrap; }
  .av-title { font-size: 12px; flex: 1 1 100%; max-width: 100%; }
  .av-actions { flex: 1 1 100%; justify-content: flex-end; gap: 6px; }
  .av-actions .btn.small { padding: 6px 10px; font-size: 11.5px; }
  .av-actions .close-x { font-size: 22px; padding: 4px 8px; }
  /* Close tetap di baris ATAS (sebelah judul) — pindahkan ke awal dengan order */
  .av-actions { order: 2; }
  .av-title { order: 1; }
}
@media (min-width: 769px) {
  #sidebar-overlay { display: none !important; }
}

/* ===== SAKTI v6: Home, Plan Mode, Stop, Activity, Diff ===== */
.home-btn { font-size: 16px; }
.home-btn:hover { transform: rotate(-15deg); }
.input-tools { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; margin-top: 2px; flex-wrap: wrap; }
.tool-chip {
  background: var(--bg2, #1a1d27); color: var(--muted, #9aa4b2);
  border: 1px solid var(--border, #2a2f3a); border-radius: 999px;
  padding: 5px 12px; font-size: 12px; cursor: pointer; transition: all .2s;
}
.tool-chip.active { background: rgba(255,180,84,.12); color: var(--gold, #ffb454); border-color: rgba(255,180,84,.5); }
.tool-hint { font-size: 11.5px; color: var(--muted, #9aa4b2); }
.activity-bar {
  flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--gold, #ffb454);
  background: rgba(255,180,84,.07); border: 1px solid rgba(255,180,84,.25);
  border-radius: 999px; padding: 4px 12px;
}
.activity-spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#stop-btn { background: #d64545; color: #fff; border: none; border-radius: 12px; width: 46px; height: 46px; font-size: 18px; cursor: pointer; flex-shrink: 0; }
#stop-btn:hover { background: #b53434; }
.msg-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; opacity: 1 !important; }
.msg-actions .icon-btn { background: none; border: 1px solid var(--border, #2a2f3a); border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; color: var(--muted, #9aa4b2); }
.msg-actions .icon-btn:hover { color: var(--gold, #ffb454); border-color: rgba(255,180,84,.5); }
.msg-time { margin-left: auto; color: var(--muted, #9aa4b2); font-size: 11px; align-self: center; padding-right: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.diff-card {
  margin: 10px 0; border: 1px solid var(--border, #2a2f3a); border-radius: 10px; overflow: hidden;
  background: var(--bg2, #151821);
}
.diff-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(255,255,255,.03); font-size: 13px; }
.diff-head .fname { font-weight: 700; word-break: break-all; }
.diff-head .badge { font-size: 11px; border-radius: 999px; padding: 2px 8px; }
.badge.add { background: rgba(52,199,89,.15); color: #34c759; }
.badge.mod { background: rgba(255,149,0,.15); color: #ff9500; }
.badge.del { background: rgba(255,59,48,.15); color: #ff3b30; }
.diff-body { padding: 8px 12px; font-family: 'JetBrains Mono', Consolas, monospace; font-size: 12px; max-height: 260px; overflow: auto; white-space: pre; }
.diff-body .ln { display: block; }
.diff-body .ln.add { background: rgba(52,199,89,.12); color: #34c759; }
.diff-body .ln.del { background: rgba(255,59,48,.12); color: #ff3b30; }
.diff-body .ln.ctx { color: var(--muted, #9aa4b2); }
.diff-actions { padding: 6px 12px; border-top: 1px solid var(--border, #2a2f3a); display: flex; gap: 8px; }
.diff-actions .btn { font-size: 11.5px; }

/* ===== File tree ===== */
.art-folder { margin-bottom: 2px; }
.art-folder-head { display: flex; align-items: center; gap: 6px; padding: 4px 6px; cursor: pointer; font-size: 12.5px; color: var(--muted, #9aa4b2); border-radius: 6px; }
.art-folder-head:hover { background: rgba(255,255,255,.04); }
.art-folder-head::after { content: '▸'; margin-left: auto; font-size: 10px; transition: transform .2s; }
.art-folder.open > .art-folder-head::after { transform: rotate(90deg); }
.art-folder-body { display: none; padding-left: 14px; border-left: 1px solid var(--border, #2a2f3a); margin-left: 8px; }
.art-folder.open > .art-folder-body { display: block; }

/* ===== File upload chips ===== */
#upload-btn, #prompt-btn { background: none; border: none; font-size: 15px; cursor: pointer; color: var(--muted, #9aa4b2); padding: 4px 6px; border-radius: 8px; border: 1px solid var(--border, #2a2f3a); width: 38px; height: 40px; }
#upload-btn:hover, #prompt-btn:hover { color: var(--gold, #ffb454); border-color: var(--gold, #ffb454); }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255,180,84,.08); border: 1px solid rgba(255,180,84,.35);
  border-radius: 10px; padding: 6px 10px; margin: 4px 6px 4px 0;
  font-size: 12.5px; color: var(--text, #e8eaed);
}
.file-chip .fc-ico { font-size: 15px; }
.file-chip .fc-name { font-weight: 700; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .fc-desc { color: var(--muted, #9aa4b2); font-size: 11px; }
.file-chip .fc-x { cursor: pointer; color: var(--muted, #9aa4b2); font-size: 15px; padding: 0 2px; }
.file-chip .fc-x:hover { color: #ff3b30; }

/* Status Center (Mission Control) — Aaron 13 Agu 2026 */
.stat-card { background: var(--bg, #14171f); border: 1px solid var(--border, #2a2f3a); border-radius: 10px; padding: 10px 12px; }
.stat-label { color: var(--muted, #9aa4b2); font-size: 11px; margin-bottom: 4px; }
.stat-value { font-size: 15px; font-weight: 700; word-break: break-all; }

/* Typing activity di dalam chat — Aaron 13 Agu 2026 */
.activity-bubble { color: var(--muted, #9aa4b2); font-style: italic; font-size: 13px; }
.activity-spin { display: inline-block; animation: activity-spin 1.2s linear infinite; }
@keyframes activity-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Logo foto agent — Aaron 13 Agu 2026 */
img.logo-badge { object-fit: cover; background: none !important; border-radius: 12px; border: 2px solid var(--border, #2a2f3a); }

/* Artefak: jarak antar item + compact + tombol hapus — Aaron 13 Agu 2026 */
.art-item { margin-bottom: 8px; padding: 6px 8px; font-size: 12px; display: flex; align-items: center; gap: 6px; }
.art-item .fname { font-size: 12px; }
.art-item .fsize { font-size: 10px; }
.art-del { margin-left: auto; background: none; border: none; color: var(--muted, #9aa4b2); font-size: 16px; cursor: pointer; padding: 0 4px; line-height: 1; border-radius: 4px; }
.art-del:hover { color: #ff3b30; background: rgba(255,60,60,.1); }
.art-dl { background: none; border: none; color: var(--muted, #9aa4b2); font-size: 13px; cursor: pointer; padding: 0 4px; line-height: 1; border-radius: 4px; flex-shrink: 0; }
.art-dl:hover { color: var(--accent, #2aa198); background: rgba(42,161,152,.12); }

/* Kuota bar — komersial (Aaron 13 Agu 2026) */
.quota-bar { width: 100%; height: 10px; background: var(--bg2,#1a1d27); border-radius: 999px; overflow: hidden; margin: 6px 0; }
.quota-fill { height: 100%; border-radius: 999px; transition: width .5s ease; background: linear-gradient(135deg, var(--accent), var(--accent2)); }

/* Sub-menu settings (Kelola Agent / Kelola Bisnis) — Aaron 14 Agu 2026 */
.set-menu { margin-bottom: 4px; }
.set-menu-head { padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: 13.5px; color: var(--muted); margin-bottom: 2px; display: flex; justify-content: space-between; align-items: center; }
.set-menu-head:hover { background: var(--panel-2); color: var(--text); }
.set-menu.open .set-menu-head { color: var(--text); }
.set-menu-arrow { transition: transform .2s; font-size: 11px; }
.set-menu.open .set-menu-arrow { transform: rotate(90deg); }
.set-sub { padding: 8px 14px 8px 28px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--muted); margin-bottom: 2px; display: block; }
.set-sub:hover { background: var(--panel-2); color: var(--text); }
.set-sub.active { background: var(--panel-2); color: var(--text); border-left: 3px solid var(--accent); }

/* Tombol pilih cara bayar (panel Paket) — Aaron 14 Agu 2026 */
.pay-method-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 12px 8px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg); color: var(--text); cursor: pointer; transition: all .15s;
  font-family: inherit; text-align: center;
}
.pay-method-btn .pm-ico { font-size: 20px; }
.pay-method-btn .pm-name { font-weight: 800; font-size: 13px; }
.pay-method-btn .pm-desc { font-size: 10.5px; color: var(--muted); }
.pay-method-btn:hover { border-color: var(--accent); }
.pay-method-btn.active { border-color: var(--accent); background: rgba(124,92,255,.1); box-shadow: 0 0 0 3px rgba(124,92,255,.18); }
