:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080b14;
  color: #edf1ff;
  --panel: #101522;
  --panel-2: #151b2a;
  --line: #273047;
  --muted: #98a2bb;
  --blue: #6c82ff;
  --blue-2: #425be2;
  --warn: #ffbd59;
  --danger: #ff6b7a;
  --ok: #54d39a;
}
* { box-sizing: border-box; }
html, body, #app { margin: 0; min-height: 100%; }
body { min-height: 100dvh; overflow: hidden; }
button, input, textarea, select { font: inherit; }
button, .manager-row { min-height: 44px; }
button { border: 0; border-radius: 12px; background: var(--blue-2); color: white; padding: .68rem 1rem; font-weight: 700; cursor: pointer; }
button.secondary { background: #222a3d; color: #e2e7f7; }
button.danger { background: #5a2731; color: #ffdce0; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, textarea, select { width: 100%; color: #f5f7ff; background: #0b101b; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
textarea { resize: vertical; }
label { display: grid; gap: .4rem; color: #cbd3e8; font-size: .9rem; }
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; }
.login-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 1.5rem; box-shadow: 0 24px 80px #0008; }
.login-card h1 { margin: 0 0 .35rem; }
.login-card form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.eyebrow { color: #8ea0ff; text-transform: uppercase; letter-spacing: .13em; font-size: .72rem; font-weight: 800; }
.muted { color: var(--muted); }
.error { color: #ffd4d9; background: #401b24; border: 1px solid #76313f; padding: .75rem; border-radius: 10px; }
.shell { height: 100dvh; display: grid; grid-template-columns: 310px minmax(0, 1fr); }
.sidebar { background: #0b0f19; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.sidebar-head { padding: 1.15rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.sidebar-head h1 { font-size: 1.15rem; margin: 0; }
.icon-button { width: 44px; padding: 0; font-size: 1.35rem; }
.manager-list { padding: 0 .65rem 1rem; overflow-y: auto; }
.manager-row { width: 100%; text-align: left; background: transparent; padding: .8rem; margin: .15rem 0; display: grid; grid-template-columns: 10px 1fr auto; align-items: start; gap: .7rem; border: 1px solid transparent; }
.manager-row:hover, .manager-row.active { background: var(--panel-2); border-color: var(--line); }
.manager-name { display: block; overflow-wrap: anywhere; }
.manager-sub { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .35rem; color: var(--muted); font-size: .74rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: .35rem; background: #667085; }
.dot.WORKING { background: var(--blue); box-shadow: 0 0 12px var(--blue); }
.dot.HUMAN_REQUIRED, .dot.WAITING { background: var(--warn); }
.dot.COMPLETE { background: var(--ok); }
.dot.BLOCKED, .dot.ERROR { background: var(--danger); }
.badge { min-width: 22px; text-align: center; padding: .15rem .42rem; border-radius: 999px; background: #29324a; color: #dfe5ff; font-size: .72rem; }
.badge.warn { background: #594013; color: #ffe1a5; }
.sidebar-foot { margin-top: auto; padding: .75rem; border-top: 1px solid var(--line); }
.sidebar-foot button { width: 100%; }
.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 70% -15%, #1d2540 0, #080b14 44%); }
.empty { margin: auto; text-align: center; color: var(--muted); padding: 2rem; max-width: 520px; }
.manager-header { padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: #0b101be8; backdrop-filter: blur(12px); display: flex; align-items: center; gap: .8rem; }
.manager-title { min-width: 0; flex: 1; }
.manager-title h2 { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.manager-title p { margin: .3rem 0 0; color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-pill { border-radius: 999px; border: 1px solid var(--line); padding: .34rem .6rem; font-size: .7rem; font-weight: 800; }
.tabs { display: flex; gap: .2rem; padding: .45rem .75rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs button { background: transparent; color: var(--muted); white-space: nowrap; padding: .55rem .68rem; }
.tabs button.active { background: #1c2335; color: white; }
.view { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.thread { flex: 1; overflow-y: auto; padding: 1.2rem max(1rem, calc((100% - 820px)/2)); scroll-behavior: smooth; }
.message { max-width: min(82%, 700px); margin: .8rem 0; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: .85rem 1rem; background: var(--panel-2); overflow-wrap: anywhere; }
.message.human { margin-left: auto; background: #263a8c; border-color: #516ae0; border-radius: 16px 16px 4px 16px; }
.message.system, .message.status { max-width: 100%; background: #111827; color: #cbd3e8; }
.message.human_required { max-width: 100%; background: #33250e; border-color: #805a16; }
.message.completion { max-width: 100%; background: #123126; border-color: #28654c; }
.message p { white-space: pre-wrap; margin: .35rem 0; line-height: 1.5; }
.message time { color: #9ca8c1; font-size: .7rem; }
.action-card { background: #2c210f; border: 1px solid #956b1f; border-radius: 16px; padding: 1rem; margin: 0 0 1rem; }
.action-card h3 { margin: .4rem 0; }
.action-card dl { display: grid; gap: .55rem; }
.action-card dt { color: var(--warn); font-size: .72rem; text-transform: uppercase; font-weight: 800; }
.action-card dd { margin: .16rem 0 0; overflow-wrap: anywhere; }
.composer { padding: .8rem max(1rem, calc((100% - 820px)/2)) max(.8rem, env(safe-area-inset-bottom)); background: #0b101bf2; border-top: 1px solid var(--line); }
.composer-box { display: grid; grid-template-columns: 1fr auto; gap: .65rem; align-items: end; }
.composer textarea { min-height: 48px; max-height: 180px; resize: none; }
.panel { width: min(860px, 100%); margin: 0 auto; padding: 1.2rem; overflow-y: auto; }
.panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 1rem; display: grid; gap: 1rem; }
.panel-card h3 { margin: 0; }
.path-list { display: grid; gap: .5rem; }
.path-row { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.button-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.mobile-menu { display: none; }
dialog { width: min(620px, calc(100% - 1rem)); max-height: calc(100dvh - 1rem); overflow: auto; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 1.2rem; }
dialog::backdrop { background: #000b; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.modal-head h2 { margin: 0; }
.form-grid { display: grid; gap: .9rem; margin-top: 1rem; }
.adapter-note { background: #121a2a; padding: .7rem; border-radius: 10px; color: var(--muted); font-size: .82rem; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; inset: 0 15% 0 0; transform: translateX(-105%); transition: transform .2s; box-shadow: 25px 0 80px #000b; }
  .shell.drawer-open .sidebar { transform: translateX(0); }
  .shell.drawer-open::after { content: ""; position: fixed; z-index: 19; inset: 0; background: #0008; }
  .mobile-menu { display: inline-grid; place-items: center; width: 44px; padding: 0; background: #1b2334; }
  .manager-header { padding-top: max(.7rem, env(safe-area-inset-top)); }
  .manager-header .status-pill { max-width: 112px; }
  .thread { padding: .8rem; }
  .message { max-width: 92%; }
  .composer { padding: .65rem .7rem max(.65rem, env(safe-area-inset-bottom)); }
  .composer-box { grid-template-columns: 1fr auto; }
  .composer button { padding-inline: .8rem; }
  .panel { padding: .8rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
