:root {
  --bg-base: #18181B; --bg-deep: #0E0E10; --surface: rgba(255,255,255,0.04); --surface-hover: rgba(255,255,255,0.07);
  --raised: #27272E; --accent: #5E6AD2; --accent-hover: #6872D9; --accent-subtle: rgba(94,106,210,0.15);
  --text: #EDEDEF; --muted: #8A8F98; --dimmed: #555962; --border: rgba(255,255,255,0.06);
  --border-hover: rgba(255,255,255,0.12); --success: #10B981; --warning: #F59E0B; --danger: #EF4444;
  --danger-text: #FECACA; --user-bubble: #272A40; --user-border: rgba(139,147,230,0.24); --composer: #1F1F24;
  --focus: #8B93E6; --shadow: rgba(0,0,0,0.55);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg-deep); color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.ps-app { height: 100%; display: flex; flex-direction: column; }
.ps-top { display: flex; align-items: center; justify-content: space-between; padding: 0 20px; height: 52px;
  border-bottom: 1px solid var(--border); background: var(--bg-base); flex: none; }
.ps-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: 0.01em; }
.ps-logo { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #A78BFA);
  box-shadow: 0 0 0 1px rgba(139,147,230,0.28); }
.ps-top-actions { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.ps-btn { border: 1px solid var(--border-hover); background: var(--surface); border-radius: 8px; padding: 7px 14px; }
.ps-btn:hover { background: var(--surface-hover); }
.ps-btn--primary { background: var(--accent); border-color: transparent; color: #fff; font-weight: 600; }
.ps-btn--primary:hover { background: var(--accent-hover); }
.ps-btn--ghost { border-color: transparent; background: transparent; color: var(--muted); }
.ps-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ps-center { flex: 1; display: grid; place-items: center; padding: 24px; }
.ps-card { width: 100%; max-width: 400px; background: var(--bg-base); border: 1px solid var(--border);
  border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px var(--shadow); }
.ps-card h1 { margin: 0 0 6px; font-size: 20px; }
.ps-card p { margin: 0 0 20px; color: var(--muted); }
.ps-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.ps-field label { font-size: 12px; color: var(--muted); }
.ps-input { width: 100%; background: var(--bg-deep); border: 1px solid var(--border-hover); border-radius: 8px;
  padding: 9px 12px; }
.ps-input:focus { border-color: var(--accent); outline: none; }
.ps-error { color: var(--danger-text); background: rgba(239,68,68,0.10); border: 1px solid rgba(239,68,68,0.2);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; }
.ps-error:empty { display: none; }
.ps-main { flex: 1; display: flex; min-height: 0; }
.ps-side { width: 290px; flex: none; border-right: 1px solid var(--border); background: var(--bg-base);
  display: flex; flex-direction: column; min-height: 0; }
.ps-side-head { padding: 16px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--border); }
.ps-side-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ps-side-list { overflow-y: auto; padding: 8px; flex: 1; }
.ps-item { width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 10px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; margin-bottom: 2px; }
.ps-item:hover { background: var(--surface); }
.ps-item[aria-current="true"] { background: var(--accent-subtle); border-color: rgba(94,106,210,0.3); }
.ps-item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-item-meta { display: flex; gap: 8px; font-size: 12px; color: var(--muted); }
.ps-empty { color: var(--dimmed); padding: 12px; font-size: 13px; }
.ps-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.ps-chat-head { padding: 14px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; gap: 12px; }
.ps-chat-name { font-weight: 600; }
.ps-chip { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--surface); color: var(--muted);
  border: 1px solid var(--border-hover); }
.ps-chip--ok { color: var(--success); border-color: rgba(16,185,129,0.3); }
.ps-chip--warn { color: var(--warning); border-color: rgba(245,158,11,0.3); }
.ps-thread { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.ps-row { display: flex; gap: 10px; max-width: 760px; width: 100%; margin: 0 auto; }
.ps-row--partner { justify-content: flex-end; }
.ps-avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; background: var(--raised);
  box-shadow: 0 0 0 1px rgba(139,147,230,0.28); display: grid; place-items: center; font-size: 12px; }
.ps-bubble { padding: 10px 14px; border-radius: 14px; max-width: 80%; white-space: pre-wrap; overflow-wrap: anywhere; }
.ps-bubble--agent { background: var(--surface); border: 1px solid var(--border); border-top-left-radius: 4px; }
.ps-bubble--partner { background: var(--user-bubble); border: 1px solid var(--user-border); border-top-right-radius: 4px; }
.ps-time { font-size: 11px; color: var(--dimmed); margin-top: 4px; }
.ps-greeting { color: var(--muted); }
.ps-typing { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.ps-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ps-blink 1.2s infinite; }
.ps-dot:nth-child(2) { animation-delay: 0.2s; } .ps-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ps-blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.ps-summary { max-width: 760px; width: 100%; margin: 0 auto; background: var(--bg-base);
  border: 1px solid rgba(94,106,210,0.35); border-radius: 14px; padding: 16px 18px; }
.ps-summary h2 { margin: 0 0 8px; font-size: 15px; }
.ps-summary pre { margin: 0 0 14px; white-space: pre-wrap; font: inherit; color: var(--text); }
.ps-summary-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ps-note { max-width: 760px; width: 100%; margin: 0 auto; color: var(--muted); font-size: 13px; text-align: center; }
.ps-dock { padding: 12px 24px 18px; border-top: 1px solid var(--border); }
.ps-composer { max-width: 760px; margin: 0 auto; background: var(--composer); border: 1px solid var(--border-hover);
  border-radius: 14px; padding: 10px; box-shadow: 0 8px 30px var(--shadow); }
.ps-composer textarea { width: 100%; resize: none; border: 0; background: transparent; min-height: 52px;
  max-height: 240px; padding: 4px 6px; outline: none; }
.ps-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.ps-attach { display: flex; gap: 6px; flex-wrap: wrap; }
.ps-file { font-size: 12px; background: var(--surface); border: 1px solid var(--border-hover); border-radius: 8px;
  padding: 3px 8px; color: var(--muted); }
.ps-counter { font-size: 12px; color: var(--dimmed); }
.ps-hidden { display: none !important; }
.ps-banner { background: rgba(245,158,11,0.12); color: #FCD34D; text-align: center; font-size: 12px; padding: 4px; }
@media (max-width: 760px) {
  .ps-side { width: 100%; border-right: 0; }
  .ps-main.ps-has-chat .ps-side { display: none; }
  .ps-main:not(.ps-has-chat) .ps-chat { display: none; }
  .ps-thread, .ps-dock, .ps-chat-head { padding-left: 16px; padding-right: 16px; }
}
