:root {
  color-scheme: light;
  --ink:#232337;
  --muted:#67677a;
  --line:#e6e4ee;
  --accent:#5741b3;
  --accent-ink:#493590;
  --paper:#f7f7fb;
  --sidebar:#17162a;
  font-family:"Segoe UI",system-ui,sans-serif;
  font-size:15px;
  color:var(--ink);
  background:var(--paper);
}
* { box-sizing:border-box; }
body { margin:0; }
[hidden] { display:none !important; }
button,input,select,textarea { font:inherit; }
button { cursor:pointer; }
button:disabled { cursor:wait; opacity:.55; }
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible { outline:2px solid #8759e9; outline-offset:2px; }
h1,h2,h3,p { margin-top:0; }
button { border:0; border-radius:9px; }
.shell { display:grid; grid-template-columns:245px minmax(0,1fr); min-height:100dvh; }
.sidebar { position:sticky; top:0; height:100dvh; display:flex; flex-direction:column; gap:24px; padding:22px 15px 16px; background:var(--sidebar); color:#f3f0ff; }
.brand { display:flex; gap:11px; align-items:center; padding:0 8px; font-size:21px; font-weight:700; letter-spacing:-.4px; }
nav { display:grid; gap:4px; }
nav button,.agent-link { display:flex; align-items:center; gap:11px; width:100%; padding:10px 11px; background:transparent; color:#c8c4dc; text-align:left; }
nav button span { min-width:18px; color:#bca7ff; font-size:18px; line-height:19px; text-align:center; }
nav button:hover,.agent-link:hover { background:#24213c; color:#fff; }
nav button[aria-current="page"],.agent-link.selected { background:#30264b; color:#fff; }
nav small { margin-left:auto; color:#d1c1fd; }
.section-grid { display:grid; gap:22px; }
.section-grid h2 { font-size:18px; margin:0 0 10px; }
.section-grid pre { white-space:pre-wrap; overflow-wrap:anywhere; }
.section-toolbar { display:flex; flex-wrap:wrap; gap:9px; margin-bottom:12px; }
.stats { font-size:1.6rem; font-weight:700; }
.usage-metric .stats { margin:7px 0; overflow-wrap:anywhere; }
.usage-table-scroll { max-width:100%; overflow-x:auto; border:1px solid var(--line); border-radius:12px; background:#fff; }
.usage-table { width:100%; border-collapse:collapse; font-variant-numeric:tabular-nums; }
.usage-table th,.usage-table td { padding:12px; border-bottom:1px solid var(--line); text-align:left; white-space:nowrap; }
.usage-table thead { background:#f1eef7; font-size:12px; }
.usage-table tbody tr:last-child > * { border-bottom:0; }
.usage-table th:first-child { white-space:normal; min-width:165px; overflow-wrap:anywhere; }
.usage-table th:not(:first-child),.usage-table td { text-align:right; }
.usage-table small { display:block; margin-top:3px; font-weight:400; }
.usage-bars { display:grid; gap:8px; font-variant-numeric:tabular-nums; }
.usage-bar { display:grid; grid-template-columns:46px minmax(0,1fr) minmax(60px,auto); align-items:center; gap:10px; }
.usage-bar strong { text-align:right; }
.usage-bar meter { width:100%; }
.usage-bar meter::-webkit-meter-optimum-value { background:var(--accent); }
.side-agents { border-top:1px solid #34314a; padding-top:13px; overflow:auto; }
.side-agents header { display:flex; align-items:center; justify-content:space-between; padding:0 8px 6px; }
.side-agents h2 { margin:0; font-size:12px; font-weight:650; color:#b5b0ca; }
.side-agents header button,.side-footer button { background:transparent; color:#ddd3ff; width:29px; height:29px; font-size:20px; }
.side-agents header button:hover,.side-footer button:hover { background:#30264b; }
.mini { display:grid; place-items:center; width:29px; height:29px; flex:0 0 29px; background:#eae1ff; color:#483685; border-radius:9px; font-weight:700; font-size:12px; }
.mini.c1 { background:#dcf5f1; color:#176961; }.mini.c2 { background:#f9e7d7; color:#8a4620; }.mini.c3 { background:#e0ebff; color:#244f95; }
.agent-link { padding:7px 8px; }
.agent-link .agent-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.side-footer { margin-top:auto; display:flex; align-items:center; gap:8px; padding:9px 7px 0; border-top:1px solid #34314a; color:#c0bbd5; font-size:12px; }
.side-footer i { width:8px; height:8px; border-radius:50%; background:#73d3ae; }
.side-footer button { margin-left:auto; width:auto; padding:3px 8px; font-size:12px; }
.native-server-link { color:inherit; font-size:13px; }
.login-card .native-server-link { display:block; margin:14px 0 0; text-align:center; color:var(--accent-ink); }
.drawer-open,.drawer-close,.drawer-shade { display:none; }
main { min-width:0; }
.topbar { min-height:93px; padding:18px clamp(16px,4vw,52px); background:#fff; border-bottom:1px solid var(--line); display:flex; align-items:center; justify-content:space-between; gap:12px; }
.breadcrumb { color:var(--muted); font-size:12px; }
.topbar h1 { margin:3px 0 0; font-size:26px; font-weight:720; letter-spacing:-.55px; overflow-wrap:anywhere; }
.actions { display:flex; gap:8px; flex-wrap:wrap; }
#content { padding:24px clamp(16px,4vw,52px) 32px; max-width:1450px; margin:auto; }
.primary,.secondary,.subtle { min-height:37px; padding:8px 13px; font-size:13px; font-weight:650; }
.primary { color:white; background:var(--accent); }
.primary:hover { background:#493398; }
.secondary { background:#fff; color:var(--ink); border:1px solid #dedbe8; }
.secondary:hover,.subtle:hover { background:#f1edfa; }
.subtle { background:transparent; color:var(--accent-ink); }
.hero { position:relative; isolation:isolate; overflow:hidden; border:1px solid #e3dafc; border-radius:19px; background:linear-gradient(112deg,#f1ebff,#ebe7fb 67%,#ded5f9); padding:34px min(6vw,58px); min-height:195px; display:grid; align-content:center; }
.hero::before,.hero::after { position:absolute; content:""; border:1px solid #a58ce6; width:210px; height:210px; right:42px; top:-16px; border-radius:30px; transform:rotate(38deg); z-index:-1; opacity:.5; pointer-events:none; }
.hero::after { right:72px; top:-11px; transform:rotate(58deg); }
.hero h2 { font-size:clamp(25px,4vw,37px); letter-spacing:-1px; margin:0 0 8px; color:#2e2450; }
.hero p { color:#554772; max-width:460px; margin-bottom:20px; }
.hero button { justify-self:start; }
.section-title { font-size:17px; margin:27px 0 12px; }
.card-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(225px,100%),1fr)); gap:13px; }
.card { background:#fff; border:1px solid var(--line); border-radius:13px; padding:17px; min-width:0; }
.card h3 { margin:8px 0 4px; font-size:16px; overflow-wrap:anywhere; }
.card p { color:var(--muted); font-size:13px; margin:0 0 12px; overflow-wrap:anywhere; }
.card .mini { width:36px; height:36px; }
.pill { display:inline-flex; align-items:center; border-radius:999px; background:#eee8ff; color:#4d3b89; font-size:11px; font-weight:650; padding:4px 8px; }
.pill.done { color:#25614d; background:#e4f4ed; }.pill.failed { color:#8b263b; background:#f9e7ec; }.pill.cancelled { color:#545466; background:#eeedf2; }
.card-buttons { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.workspace { display:grid; grid-template-columns:minmax(0,1fr) minmax(210px,255px); gap:14px; }
.conversation { min-width:0; height:max(560px,calc(100dvh - 150px)); display:flex; flex-direction:column; background:#fff; border:1px solid var(--line); border-radius:14px; overflow:hidden; }
.threadbar { display:flex; align-items:center; gap:7px; padding:11px 12px; border-bottom:1px solid var(--line); }
.threadbar select { flex:1; min-width:0; }
.transcript { overflow:auto; flex:1; padding:18px clamp(13px,3vw,30px); }
.empty { padding:25px 14px; color:var(--muted); text-align:center; }
.empty strong { display:block; color:var(--ink); font-size:16px; margin-bottom:5px; }
.bubble { max-width:min(100%,720px); padding:11px 14px; margin:0 0 11px; border:1px solid #eeecf4; background:#f8f7fc; border-radius:13px; }
.bubble.user { margin-left:auto; max-width:min(89%,680px); background:#eee7ff; border:0; }
.bubble header { color:#635389; font-weight:700; font-size:11px; margin-bottom:4px; }
.bubble p { white-space:pre-wrap; overflow-wrap:anywhere; font-size:14px; line-height:1.5; margin:0; }
.bubble small { display:block; margin-top:6px; color:var(--muted); }
.pending-message { border-style:dashed; }
.compose { padding:10px 12px; border-top:1px solid var(--line); }
.compose textarea { width:100%; resize:vertical; min-height:64px; max-height:210px; }
.compose footer { display:flex; gap:10px; align-items:center; justify-content:space-between; margin-top:7px; color:var(--muted); font-size:12px; }
.tools { display:grid; gap:12px; align-content:start; min-width:0; }
.tools h3 { margin:0 0 10px; }
.tools label.check { display:flex; gap:5px; align-items:flex-start; margin:6px 0; min-width:0; }
.tools label.check span { overflow-wrap:anywhere; }
.note-row { display:flex; align-items:center; justify-content:space-between; gap:4px; }
.note-row button { padding:5px 8px; }
.job-list { display:grid; gap:9px; }
.job { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:12px; align-items:start; }
.job .preview { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.job h3 { margin-top:0; }
.job .card-buttons { justify-content:flex-end; }
.workflow-steps { display:grid; gap:8px; }
input:not([type=checkbox]),select,textarea { background:#fff; border:1px solid #dcd9e7; border-radius:8px; padding:8px 9px; color:var(--ink); width:100%; min-height:36px; }
textarea { line-height:1.35; }
label { display:grid; gap:4px; margin:0 0 12px; font-size:13px; font-weight:600; }
label.check { display:flex; align-items:center; font-weight:500; }
fieldset { border:1px solid var(--line); border-radius:9px; padding:9px 12px; margin:0 0 12px; min-width:0; }
fieldset .check:last-child { margin-bottom:0; }
dialog { width:min(530px,calc(100% - 28px)); max-height:90dvh; border:1px solid var(--line); border-radius:15px; padding:19px; color:var(--ink); box-shadow:0 14px 75px #15122435; }
dialog::backdrop { background:#18142c77; }
.dialog-head,.dialog-head+.actions,dialog footer { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.dialog-head h2 { margin:0 0 13px; font-size:20px; }
dialog footer { justify-content:flex-end; }
.icon-button { font-size:21px; background:#f1eef7; width:32px; height:32px; align-self:start; }
.error { color:#a32440 !important; overflow-wrap:anywhere; }
.hint { font-size:12px; color:var(--muted); }
#toast { position:fixed; bottom:13px; right:13px; max-width:calc(100% - 26px); background:var(--sidebar); color:#fff; border-radius:9px; padding:12px 16px; z-index:3; }
.login { min-height:100dvh; display:grid; place-items:center; background:radial-gradient(ellipse at 60% -5%,#e6dcff,#f7f7fb 57%); padding:16px; }
.login-card { width:min(390px,100%); padding:29px; background:#fff; border:1px solid var(--line); border-radius:16px; box-shadow:0 14px 50px #2f185013; }
.login-card h1 { margin:8px 0 4px; }.login-card p { color:var(--muted); }.login-card button { width:100%; }.login-card .error:empty { display:none; }
@media (max-width:950px) {
  .shell { grid-template-columns:190px minmax(0,1fr); }
  .workspace { grid-template-columns:1fr; }
  .tools { grid-template-columns:repeat(auto-fit,minmax(min(235px,100%),1fr)); }
}
@media (max-width:700px) {
  body.drawer-active { overflow:hidden; }
  .shell { display:block; }
  .sidebar { position:fixed; top:0; left:0; z-index:5; width:min(82vw,320px); height:100dvh; padding:20px 14px max(14px,env(safe-area-inset-bottom)); gap:17px;
    background:linear-gradient(155deg,#261d42 0,#17162a 72%); overflow:auto; overscroll-behavior:contain;
    transform:translateX(-103%); visibility:hidden; transition:transform .18s ease,visibility .18s; }
  .drawer-active .sidebar { visibility:visible; transform:translateX(0); box-shadow:12px 0 44px #21193644; }
  .drawer-shade { width:100%; height:100%; position:fixed; inset:0; z-index:4; border-radius:0; background:#1f183965; }
  .drawer-active .drawer-shade { display:block; }
  .brand { padding:5px 46px 5px 7px; font-size:21px; }
  .brand img { width:30px; height:30px; }
  .drawer-close { display:grid; place-items:center; position:absolute; top:19px; right:12px; width:42px; height:42px; background:#ffffff15; color:white; font-size:24px; }
  .drawer-open { display:grid; place-items:center; flex:0 0 42px; width:42px; height:42px; background:#eee9fa; color:#513e83; border:1px solid #e2daf2; border-radius:13px; }
  .drawer-open svg { width:23px; height:23px; }
  .sidebar nav { gap:3px; }
  nav button { min-height:44px; font-size:14px; padding:8px 10px; gap:10px; }
  .side-agents { display:none; }
  .side-footer { padding:8px 5px 0; }
  .side-footer a,.side-footer button { min-height:42px; display:grid; align-items:center; padding-inline:10px; }
  .topbar { padding:9px 14px; min-height:62px; gap:9px; background:var(--paper); }
  .topbar > div:first-of-type { flex:1; min-width:0; }
  .topbar .breadcrumb { display:none; }
  .topbar h1 { font-size:21px; margin:0; }
  #content { padding:14px; }
  #content:has(.inbox) { padding:0; }
  .inbox { display:flex; flex-direction:column; min-height:calc(100dvh - 62px); padding:6px 14px 10px; }
  .inbox-list { flex:1; }
  .inbox-row { display:flex; align-items:center; gap:3px; border-bottom:1px solid var(--line); }
  .inbox-open { display:grid; grid-template-columns:42px minmax(0,1fr) auto; gap:11px; text-align:left; align-items:center;
    min-height:73px; min-width:0; flex:1; padding:8px 3px; color:var(--ink); background:transparent; }
  .inbox-open:active,.inbox-edit:active { background:#eae4f5; }
  .inbox-open .mini { width:42px; height:42px; border-radius:14px; font-size:15px; }
  .inbox-person { min-width:0; display:grid; gap:4px; }
  .inbox-person strong,.inbox-preview { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .inbox-person strong { font-size:15px; }
  .inbox-preview,.inbox-time { color:var(--muted); font-size:12px; }
  .inbox-time { align-self:start; padding-top:7px; }
  .inbox-edit { min-width:36px; min-height:44px; background:transparent; color:var(--muted); font-size:18px; }
  .inbox-empty { margin:22px 4px; color:var(--muted); }
  .inbox-search { position:sticky; bottom:0; display:flex; align-items:center; padding:8px 0 max(8px,env(safe-area-inset-bottom));
    background:var(--paper); }
  .inbox-search-icon { position:absolute; left:13px; font-size:22px; color:var(--accent-ink); pointer-events:none; }
  .inbox-search input { min-height:45px; border-radius:14px; padding-left:38px; background:#eeebf5; border-color:#e3deee; }
  .hero { padding:20px 16px; }.hero::before,.hero::after { right:-150px; }
  .conversation { height:62dvh; min-height:370px; }
  .actions { justify-content:flex-end; gap:4px; max-width:54%; }.actions button { font-size:11px; padding:5px 7px; }
}
.settings-index { display:grid; gap:23px; max-width:680px; margin:0 auto; }
.settings-group h2 { margin:0 0 8px 5px; color:var(--muted); font-size:13px; font-weight:680; }
.settings-surface { display:grid; border:1px solid var(--line); border-radius:17px; overflow:hidden; background:var(--surface,#fff); }
.settings-row { display:grid; grid-template-columns:32px minmax(0,1fr) 19px; align-items:center; gap:12px;
  min-height:62px; padding:9px 12px; text-align:left; background:transparent; color:var(--ink); border-radius:0; }
.settings-row + .settings-row { border-top:1px solid var(--line); }
.settings-row:hover,.settings-row:active { background:var(--settings-hover,#f1edf9); }
.settings-icon { width:32px; height:32px; display:grid; place-items:center; border-radius:11px;
  color:var(--accent-ink); background:var(--settings-icon,#ece6f8); font-size:17px; }
.settings-label { display:grid; gap:3px; min-width:0; }
.settings-label strong { font-size:1rem; font-weight:700; overflow-wrap:anywhere; }
.settings-label small { color:var(--muted); font-size:.8rem; overflow-wrap:anywhere; }
.settings-chevron { justify-self:center; color:var(--muted); font-size:22px; }
.settings-native-action { display:inline-flex; align-items:center; text-decoration:none; }
.settings-switch { min-height:40px; padding:8px; accent-color:var(--accent); }
html[data-text-size="large"] { font-size:17px; }
html[data-text-size="extra"] { font-size:19px; }
html[data-text-size="large"] :is(.bubble p,.inbox-preview,.inbox-person strong,.compose textarea) { font-size:1rem; }
html[data-text-size="extra"] :is(.bubble p,.inbox-preview,.inbox-person strong,.compose textarea) { font-size:1rem; }
html[data-compact="true"] .compose { padding:5px 8px; }
html[data-compact="true"] .compose textarea { min-height:40px; height:42px; }
html[data-motion="reduced"] *,html[data-motion="reduced"] *::before,html[data-motion="reduced"] *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
@media (prefers-reduced-motion:reduce) { html:not([data-motion="full"]) .sidebar { transition:none; } }
html[data-theme="dark"] { color-scheme:dark; --ink:#eeeaf8; --muted:#bdb6ce; --line:#3a344c; --paper:#201c2b;
  --surface:#2a2439; --accent:#8b70eb; --accent-ink:#d4c5ff; --settings-hover:#3a2e50; --settings-icon:#3b3053; }
@media (prefers-color-scheme:dark) {
  html[data-theme="system"] { color-scheme:dark; --ink:#eeeaf8; --muted:#bdb6ce; --line:#3a344c; --paper:#201c2b;
    --surface:#2a2439; --accent:#8b70eb; --accent-ink:#d4c5ff; --settings-hover:#3a2e50; --settings-icon:#3b3053; }
}
:is(.card,.topbar,.conversation,.usage-table-scroll,.login-card,.compose) { background:var(--surface,#fff); }
:is(input:not([type=checkbox]),select,textarea,dialog,.secondary) { background:var(--surface,#fff); border-color:var(--line); }
.usage-table thead,.inbox-search input,.drawer-open,.icon-button { background:var(--settings-hover,#f1eef7); color:var(--ink); }
.login { background:var(--paper); }
.bubble.user { background:var(--settings-hover,#efe8ff); }
.bubble.assistant { background:var(--surface,#fff); border-color:var(--line); }
.bubble header { color:var(--accent-ink); }
@media (max-width:700px) {
  .topbar { background:var(--paper); }
  .settings-index { margin:0; }
  main[data-page="settings"] #content { padding-top:18px; }
  .settings-row { min-height:64px; }
}
