/* Panel "Detail sesi" (gaya Claude Desktop) + panel Browser di kanan percakapan. */
.chat { position: relative; }
.session-panel-toggle.is-on, .browser-toggle.is-on { color: var(--accent-ink); background: var(--accent-soft); }

.session-panel {
  position: absolute; top: calc(var(--topbar-h) + 6px); right: 10px; bottom: 10px; width: 300px; z-index: 30;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-soft); font-size: 13px; animation: sp-in var(--t) var(--ease-out);
}
.chat.chat-empty > .session-panel { top: 6px; }
@keyframes sp-in { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }
[data-motion="reduce"] .session-panel { animation: none; }
.chat.chat-empty > .browser-pane { top: 0; }

.sp-scrim { display: none; }
.sp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.sp-tools { display: flex; align-items: center; gap: 2px; }
.sp-tool { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; min-width: 28px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); cursor: pointer; font: inherit; font-size: 12.5px; flex: none; }
.sp-tool:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.sp-tool:disabled { opacity: .35; cursor: default; }
.sp-share { margin-left: 4px; }

.sp-body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; }
.sp-sec { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.sp-sec:last-child { border-bottom: 0; }
.sp-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sp-sec-head h3 { margin: 0; font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: 0; }
.sp-mini { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; padding: 3px; border-radius: 5px; display: inline-flex; }
.sp-mini:hover { color: var(--ink); background: var(--surface-2); }
.sp-muted { margin: 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.45; }
.sp-warn { display: block; margin-top: 6px; color: var(--warn); font-size: 12px; }

.sp-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 0 6px; margin: 0 -6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; text-align: left; box-sizing: content-box; text-decoration: none; }
.sp-row > svg { flex: none; color: var(--ink-2); }
.sp-link { cursor: pointer; }
.sp-link:hover:not(:disabled) { background: var(--surface-2); }
.sp-row-label { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.sp-row-val { color: var(--ink-3); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; max-width: 55%; overflow: hidden; white-space: nowrap; }
.sp-row-val.ok { color: var(--ok); }
.sp-row-val.warn { color: var(--ink-3); }
.sp-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.sp-row .switch { margin: 0; flex: none; }
.sp-conn .sp-row-label b { font-weight: 600; }

.sp-ctx-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.sp-ctx-top b { font-size: 13px; font-weight: 600; color: var(--ink); }
.sp-ctx-top span { font-size: 12px; color: var(--ink-3); }
.sp-seg { display: flex; gap: 1px; height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-bottom: 10px; }
.sp-seg i { display: block; height: 100%; flex: none; }
.sp-ctx-rows { display: flex; flex-direction: column; }
.sp-ctx-row { display: grid; grid-template-columns: 10px 1fr auto 46px; align-items: center; gap: 10px; min-height: 24px; font-size: 12.5px; }
.sp-sw { width: 9px; height: 9px; border-radius: 2px; }
.sp-ctx-name { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-ctx-n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sp-ctx-row b { text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.sp-model { display: block; margin-top: 8px; font-size: 12px; }

.sp-files { display: flex; flex-direction: column; }
.sp-file { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 30px; padding: 0 6px; margin: 0 -6px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; text-align: left; cursor: pointer; box-sizing: content-box; }
.sp-file svg { color: var(--ink-3); flex: none; }
.sp-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-file small { color: var(--ink-3); font-size: 11.5px; }
.sp-file:hover { background: var(--surface-2); }
.sp-file.on { background: var(--accent-soft); }
.sp-more { margin-top: 4px; align-self: flex-start; border: 0; background: transparent; color: var(--ink-3); font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 0; }
.sp-more:hover { color: var(--ink); }

/* Tugas latar */
.sp-sub { font-size: 11.5px; color: var(--ok); font-weight: 400; }
.sp-task { position: relative; }
.sp-task.failed > svg { color: var(--danger); }
.sp-task.running > svg { color: var(--accent-ink); }
.sp-run { position: absolute; right: -2px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--accent); animation: sp-pulse 1.4s ease-in-out infinite; }
.sp-task.running .sp-row-val { margin-right: 8px; font-variant-numeric: tabular-nums; }
@keyframes sp-pulse { 0%, 100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
[data-motion="reduce"] .sp-run { animation: none; }
.sp-done-toggle .sp-row-label { color: var(--ink-2); }

/* Dialog "butuh aplikasi desktop" */
.dk-dlg { padding: 22px 24px 20px; max-width: 460px; }
.dk-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.dk-ic { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-ink); }
.dk-dlg h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.dk-dlg p { margin: 0 0 18px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.dk-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dk-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.dk-note { display: block; margin-top: 12px; font-size: 12px; color: var(--ink-3); }

/* ── Panel Browser (aplikasi desktop: halaman asli digambar di area .bp-view) ── */
.browser-pane { position: absolute; top: var(--topbar-h); right: 0; bottom: 0; width: 50%; z-index: 29; display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--line); }
.chat.with-session-panel > .browser-pane { right: 320px; width: calc(50% - 160px); }
.bp-bar { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line-soft); }
.bp-addr { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; margin: 0 4px; border-radius: 99px; background: var(--surface-2); color: var(--ink-3); }
.bp-addr input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; }
.bp-addr:focus-within { box-shadow: 0 0 0 2px var(--accent-line); }
.bp-progress { height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: bp-load 1s linear infinite; }
@keyframes bp-load { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.bp-err { padding: 8px 12px; font-size: 12px; color: var(--danger); border-bottom: 1px solid var(--line-soft); }
.bp-view { flex: 1; min-height: 0; background: #fff; }

/* Layar lebar: percakapan bergeser agar tidak tertutup panel. */
@media (min-width: 1100px) {
  /* Ruang kanan dicadangkan di wadah chat, jadi sambutan, composer, contoh, dan percakapan
     otomatis berada di tengah area yang tersisa (bukan di tengah layar penuh). */
  .chat.with-session-panel, .chat.with-browser { box-sizing: border-box; transition: padding-right var(--t) var(--ease-out); }
  .chat.with-session-panel { padding-right: 320px !important; }
  .chat.with-browser { padding-right: 50% !important; }
  .chat.with-browser.with-session-panel { padding-right: calc(50% + 160px) !important; }
  [data-motion="reduce"] .chat.with-session-panel, [data-motion="reduce"] .chat.with-browser { transition: none; }
}
/* Layar sedang & HP: panel melayang di atas percakapan. */
@media (max-width: 1099px) {
  .sp-scrim { display: block; position: absolute; inset: var(--topbar-h) 0 0 0; z-index: 28; border: 0; background: var(--scrim); cursor: default; }
  .chat.chat-empty > .sp-scrim { inset: 0; }
  .session-panel { box-shadow: var(--shadow-pop); }
  .browser-pane, .chat.with-session-panel > .browser-pane { right: 0; width: 100%; }
}
/* HP: bilah mode sempit; tombol browser & panel disembunyikan agar tombol Incognito tidak terpotong.
   Panel tetap bisa dibuka dari bilah atas percakapan. */
@media (max-width: 760px) {
  .chat-mode-bar .browser-toggle, .chat-mode-bar .session-panel-toggle { display: none; }
  .topbar .browser-toggle { display: none; }
}
@media (max-width: 520px) { .session-panel { width: auto; left: 10px; } }
