:root {
  color-scheme: dark;
  --bg: #050816;
  --panel: rgba(14, 21, 47, 0.76);
  --panel-strong: #101938;
  --line: rgba(133, 167, 255, 0.16);
  --text: #f4f7ff;
  --muted: #8f9bb9;
  --cyan: #20d9ff;
  --blue: #316cff;
  --violet: #8e4dff;
  --pink: #e946ff;
  --green: #39e5a3;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 78% 5%, rgba(62, 70, 255, .19), transparent 34%), radial-gradient(circle at 12% 92%, rgba(12, 209, 255, .11), transparent 35%), var(--bg); color: var(--text); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: 36px 36px; mask-image: linear-gradient(to bottom, black, transparent); }
button, input, textarea, select { font: inherit; }
button { color: white; border: 0; border-radius: 10px; padding: 11px 16px; background: linear-gradient(120deg, var(--blue), var(--violet)); cursor: pointer; font-weight: 700; }
button:hover { filter: brightness(1.12); }
input, textarea, select { width: 100%; color: var(--text); background: rgba(3, 7, 22, .72); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: rgba(32, 217, 255, .6); box-shadow: 0 0 0 3px rgba(32, 217, 255, .08); }
textarea { resize: vertical; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 244px; padding: 28px 18px 18px; border-right: 1px solid var(--line); background: rgba(5, 8, 22, .82); backdrop-filter: blur(20px); display: flex; flex-direction: column; z-index: 20; }
.wordmark { width: 164px; max-height: 54px; object-fit: contain; object-position: left center; }
.eyebrow { color: #66749a; font-size: 10px; letter-spacing: .18em; font-weight: 800; }
nav { display: grid; gap: 6px; margin-top: 30px; }
.nav-item { display: flex; gap: 12px; align-items: center; width: 100%; background: transparent; color: var(--muted); text-align: left; font-weight: 600; }
.nav-item.active { color: white; background: linear-gradient(100deg, rgba(49,108,255,.22), rgba(142,77,255,.12)); box-shadow: inset 2px 0 var(--cyan); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; }
.text-button { background: transparent; color: var(--muted); padding: 8px; }
.agent-compact { padding: 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); font-size: 12px; }
.content { margin-left: 244px; padding: 46px clamp(24px, 4vw, 64px); max-width: 1500px; }
.view { display: none; }
.view.active { display: block; }
.page-title { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 28px; }
h1 { margin: 4px 0 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.04em; }
h2 { margin: 0; font-size: 18px; }
p { line-height: 1.55; }
.muted, .panel-heading p { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.metric, .panel, .task-card, .memory-card, .device-card { border: 1px solid var(--line); background: linear-gradient(145deg, rgba(18, 28, 63, .8), rgba(7, 12, 31, .74)); border-radius: 18px; box-shadow: 0 18px 60px rgba(0,0,0,.16); }
.metric { padding: 22px; display: grid; gap: 7px; }
.metric span, .metric small { color: var(--muted); }
.metric strong { font-size: 27px; }
.panel { padding: 22px; margin-bottom: 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.panel-heading p { margin: 4px 0 0; font-size: 13px; }
.task-form { display: grid; gap: 12px; }
.form-row { display: flex; gap: 10px; justify-content: flex-end; }
.form-row select { width: auto; min-width: 130px; }
.list { display: grid; }
.list-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 14px 2px; border-top: 1px solid var(--line); }
.list-item:first-child { border-top: 0; }
.list-item p, .list-item small { margin: 0; color: var(--muted); }
.badge { width: fit-content; border-radius: 999px; padding: 5px 9px; background: rgba(49,108,255,.14); color: #9db9ff; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.badge.completed { color: var(--green); background: rgba(57,229,163,.12); }
.badge.needs_attention, .badge.failed { color: #ff8099; background: rgba(255,70,110,.12); }
.task-grid, .memory-grid, .device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.task-card, .memory-card, .device-card { padding: 18px; }
.task-card h3, .memory-card h3, .device-card h3 { margin: 10px 0 6px; }
.task-card p, .memory-card p, .device-card p { color: var(--muted); overflow-wrap: anywhere; }
.result { border-top: 1px solid var(--line); padding-top: 12px; white-space: pre-wrap; color: #dce5ff !important; max-height: 240px; overflow: auto; }
.chat-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; }
.conversation-list { display: grid; align-content: start; gap: 8px; }
.conversation-button { text-align: left; background: rgba(13,20,45,.7); color: var(--muted); }
.conversation-button.active { color: white; box-shadow: inset 2px 0 var(--cyan); }
.chat-panel { min-height: 66vh; display: flex; flex-direction: column; }
.messages { flex: 1; min-height: 300px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.message { max-width: min(78%, 680px); padding: 12px 14px; border-radius: 14px; background: var(--panel-strong); white-space: pre-wrap; }
.message.user { align-self: flex-end; background: linear-gradient(120deg, rgba(49,108,255,.5), rgba(142,77,255,.5)); }
.composer { display: flex; gap: 10px; align-items: end; padding-top: 18px; }
.inline-form { display: flex; gap: 10px; }
.pair-code { font: 800 34px ui-monospace, monospace; letter-spacing: .16em; color: var(--cyan); padding: 14px 0; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #ff5577; box-shadow: 0 0 12px currentColor; }
.status-dot.online { background: var(--green); }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.login-card { width: min(430px, 100%); text-align: center; padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: rgba(8,13,34,.86); backdrop-filter: blur(18px); box-shadow: 0 35px 100px rgba(0,0,0,.35); }
.login-logo { width: 126px; border-radius: 28px; }
.login-card form { display: grid; gap: 12px; text-align: left; margin-top: 28px; }
.error { color: #ff8099; min-height: 1.5em; margin: 0; }
.toast { position: fixed; right: 24px; bottom: 24px; padding: 13px 18px; background: #17234a; border: 1px solid var(--line); border-radius: 12px; z-index: 50; }
.mobile-header { display: none; }
@media (max-width: 760px) {
  .mobile-header { position: sticky; top: 0; z-index: 15; height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 10px 15px; background: rgba(5,8,22,.9); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
  .mobile-header img { width: 120px; max-height: 36px; object-fit: contain; }
  .icon-button { background: transparent; padding: 9px; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 60px rgba(0,0,0,.45); }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; padding: 24px 15px 50px; }
  .metrics { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; }
  .conversation-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row, .composer, .inline-form { flex-direction: column; align-items: stretch; }
  .form-row select { width: 100%; }
  .message { max-width: 90%; }
  .page-title { align-items: end; }
}
