@font-face { font-family: "Geist"; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; }

:root {
  --bg: #0a0a0a; --bg-subtle: #111; --bg-hover: #1a1a1a; --bg-active: #1f1f1f;
  --border: #1f1f1f; --border-strong: #2e2e2e;
  --fg: #ededed; --fg-muted: #a1a1a1; --fg-subtle: #707070;
  --green: #45c46b; --amber: #f5a524; --red: #f04a4a;
  --ring: 0 0 0 1px #525252, 0 0 0 4px rgba(255, 255, 255, .08);
  --mono: "Geist Mono", Menlo, Consolas, monospace;
  --top: env(safe-area-inset-top, 0px); --bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 15px/1.45 "Geist", -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
#app { height: 100dvh; display: flex; flex-direction: column; }
svg.i { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- common */
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bar { flex: none; display: flex; align-items: center; gap: 8px; padding: calc(var(--top) + 8px) 12px 8px; min-height: calc(var(--top) + 52px); border-bottom: 1px solid var(--border); }
.bar h1 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .sub { color: var(--fg-subtle); font-size: 12px; font-weight: 400; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--fg-muted); flex: none; }
.icon-btn:active { background: var(--bg-active); }
.scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px calc(var(--bottom) + 16px); }
.btn { height: 44px; padding: 0 16px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; }
.btn.primary { background: var(--fg); color: #0a0a0a; }
.btn.secondary { border: 1px solid var(--border-strong); }
.btn:disabled { opacity: .5; }
.muted { color: var(--fg-muted); }
.subtle { color: var(--fg-subtle); font-size: 13px; }
.error { color: var(--red); font-size: 14px; min-height: 20px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #404040; flex: none; }
.dot.online { background: var(--fg-muted); }
.dot.busy { background: var(--green); box-shadow: 0 0 0 3px rgba(69, 196, 107, .18); animation: pulse 1.4s ease-in-out infinite; }
.dot.attention { background: var(--amber); box-shadow: 0 0 0 3px rgba(245, 165, 36, .2); }
.dot.exited { background: var(--red); }
@keyframes pulse { 50% { box-shadow: 0 0 0 1px rgba(69, 196, 107, .05); } }
.notice { margin: 12px; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px; color: var(--fg-muted); font-size: 14px; }
.notice.warn { border-color: rgba(245, 165, 36, .5); color: #f5c76e; }

/* ---------- login */
.input { width: 100%; height: 46px; padding: 0 14px; background: var(--bg); color: var(--fg); border: 1px solid var(--border-strong); border-radius: 10px; font: inherit; outline: none; }
.input:focus { border-color: transparent; box-shadow: var(--ring); }

/* ---------- lists */
.card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px; width: 100%; text-align: left; }
.card:active { background: var(--bg-hover); }
.card .main { flex: 1; min-width: 0; }
.card .title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { color: var(--fg-subtle); font-size: 12px; font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chevron { color: var(--fg-subtle); }
.section { color: var(--fg-subtle); font-size: 12px; font-weight: 500; margin: 16px 2px 8px; }

.tabs { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 17px; color: var(--fg-muted); white-space: nowrap; }
.chip.on { background: var(--fg); color: #0a0a0a; border-color: var(--fg); }
.chip .sq { width: 8px; height: 8px; border-radius: 2px; background: #3a3a3a; }
.badge { font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.badge.att { background: var(--amber); color: #0a0a0a; }
.badge.busy { background: rgba(69, 196, 107, .15); color: var(--green); }

/* ---------- terminal */
.term-wrap { flex: 1; min-height: 0; overflow: auto; background: var(--bg); -webkit-overflow-scrolling: touch; }
.term-host { padding: 6px 4px; }
.keys { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 8px 8px 6px; border-top: 1px solid var(--border); scrollbar-width: none; }
.keys::-webkit-scrollbar { display: none; }
.key { flex: none; min-width: 44px; height: 38px; padding: 0 10px; border-radius: 8px; background: var(--bg-active); border: 1px solid var(--border-strong); font: 13px var(--mono); color: var(--fg); }
.key:active, .key.on { background: var(--fg); color: #0a0a0a; }
.compose { flex: none; display: flex; gap: 8px; align-items: flex-end; padding: 6px 8px calc(var(--bottom) + 8px); }
.compose textarea { flex: 1; min-height: 42px; max-height: 120px; resize: none; padding: 10px 12px; background: var(--bg); color: var(--fg); border: 1px solid var(--border-strong); border-radius: 10px; font: 15px "Geist", sans-serif; outline: none; }
.compose textarea:focus { border-color: #525252; }
.send { width: 42px; height: 42px; border-radius: 10px; background: var(--fg); color: #0a0a0a; display: flex; align-items: center; justify-content: center; flex: none; }

/* ---------- sign in / sign up */
.auth { flex: 1; min-height: 0; display: flex; }
.auth-side { display: none; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: calc(var(--top) + 24px) 20px calc(var(--bottom) + 24px); overflow-y: auto; }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.auth-logo img { width: 44px; height: 44px; display: block; }
.auth-card h2 { margin: 6px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.auth-sub { margin: -6px 0 6px; color: var(--fg-muted); }
.auth-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--fg-muted); }
.auth-field small { font-weight: 400; color: var(--fg-subtle); font-size: 12px; }
.auth-card .btn.primary { margin-top: 4px; }
.auth-card .btn:disabled, .auth-card .input:disabled { opacity: .45; }
.auth-switch { text-align: center; color: var(--fg-subtle); font-size: 14px; }
.auth-switch a { color: var(--fg); text-decoration: none; font-weight: 500; }
.auth-switch a:hover { text-decoration: underline; }
@media (min-width: 900px) {
  .auth-side { display: flex; flex-direction: column; justify-content: space-between; width: 46%; max-width: 620px; padding: 40px 48px; border-right: 1px solid var(--border); background: radial-gradient(120% 80% at 0% 0%, #161616 0%, var(--bg) 60%); }
  .auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; }
  .auth-brand img { width: 32px; height: 32px; }
  .auth-pitch h1 { margin: 0 0 28px; font-size: 38px; line-height: 1.12; font-weight: 600; letter-spacing: -0.03em; max-width: 480px; }
  .auth-pitch ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 14px; color: var(--fg-muted); max-width: 440px; }
  .auth-pitch li { padding-left: 22px; position: relative; }
  .auth-pitch li::before { content: ""; position: absolute; left: 0; top: 8px; width: 8px; height: 8px; border-radius: 2px; background: var(--green); }
  .auth-pitch b { color: var(--fg); font-weight: 500; }
  .auth-foot { color: var(--fg-subtle); font-size: 13px; }
  .auth-logo { display: none; }
}

/* ---------- account */
.avatar { width: 30px; height: 30px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 14px; text-shadow: 0 1px 1px rgba(0, 0, 0, .25); }
.me-btn { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px; border-radius: 10px; min-width: 0; }
.me-btn:active, .me-btn:hover { background: var(--bg-hover); }
.me-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.me-btn.wide { width: 100%; height: 48px; text-align: left; }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-mail { font-size: 12px; color: var(--fg-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn.ghost { color: var(--fg-muted); font-weight: 400; height: 36px; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; border: 1px solid var(--border-strong); border-radius: 8px; }
.btn.small svg { width: 15px; height: 15px; }
.btn.small:hover { background: var(--bg-hover); }

.pop-layer { position: fixed; inset: 0; z-index: 60; }
.pop { position: fixed; min-width: 220px; padding: 4px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.pop-head { padding: 8px 10px; }
.pop-name { font-weight: 600; }
.pop-mail { color: var(--fg-subtle); font-size: 13px; }
.pop-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.pop-item { display: block; width: 100%; text-align: left; height: 36px; padding: 0 10px; border-radius: 8px; font-size: 14px; }
.pop-item:hover, .pop-item:active { background: var(--bg-active); }
.pop-item.danger { color: #ff8a8e; }

.overlay { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .6); display: flex; align-items: flex-start; justify-content: center; padding: 18vh 16px 0; }
.dialog { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 20px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 14px; }
.dialog h2 { margin: 0; font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions .btn { height: 38px; }

/* ---------- wide screens: the full app */
@media (min-width: 900px) {
  .agents-list { max-width: 640px; width: 100%; margin: 0 auto; }
}
.desk { flex: 1; min-height: 0; display: flex; }
.desk-side { width: 260px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); font-size: 14px; }
.ds-head { height: 52px; display: flex; align-items: center; gap: 10px; padding: 0 16px; font-weight: 600; }
.ds-logo { width: 22px; height: 22px; border-radius: 6px; background: var(--fg); color: #0a0a0a; display: flex; align-items: center; justify-content: center; }
.ds-logo svg { width: 13px; height: 13px; stroke-width: 2.2; }
.ds-computer { margin: 0 10px 8px; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 10px; text-align: left; }
.ds-computer:hover { background: var(--bg-hover); }
.ds-cname { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-cstate { color: var(--fg-subtle); font-size: 12px; }
.ds-label { padding: 10px 16px 4px; font-size: 12px; color: var(--fg-subtle); font-weight: 500; }
.ds-tabs { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 10px; }
.ds-ws-item { width: 100%; height: 34px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border-radius: 8px; color: var(--fg-muted); text-align: left; }
.ds-ws-item:hover { background: var(--bg-hover); color: var(--fg); }
.ds-ws.on > .ds-ws-item { background: var(--bg-active); color: var(--fg); }
.ds-ws-item .sq { width: 8px; height: 8px; border-radius: 2px; background: #3a3a3a; flex: none; }
.ds-ws-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ds-terms { margin: 2px 0 6px 13px; padding-left: 10px; border-left: 1px solid var(--border); }
.ds-term { width: 100%; height: 30px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 6px; color: var(--fg-subtle); text-align: left; font-size: 13px; }
.ds-term:hover, .ds-term.focused { background: var(--bg-hover); color: var(--fg); }
.ds-tname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-foot { border-top: 1px solid var(--border); padding: 8px; }
.desk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.desk-bar { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--border); }
.desk-title { font-weight: 600; }
.spacer { flex: 1; }
.desk-grid { flex: 1; min-height: 0; display: flex; }
.desk-empty { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.desk-empty .notice { max-width: 460px; }
.ds-split { display: flex; min-width: 0; min-height: 0; }
.ds-split.row { flex-direction: row; }
.ds-split.col { flex-direction: column; }
.ds-gutter { flex: none; background: var(--border-strong); }
.ds-split.row > .ds-gutter { width: 1px; }
.ds-split.col > .ds-gutter { height: 1px; }
.dp { min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }
.dp::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.dp.attention::after { box-shadow: inset 0 0 0 1px rgba(245, 165, 36, .8); }
.dp-head { height: 34px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--border); color: var(--fg-muted); font-size: 13px; cursor: default; }
.dp.focused .dp-head { background: var(--bg-subtle); color: var(--fg); }
.dp-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.dp-cwd { flex: 1; min-width: 0; color: var(--fg-subtle); font: 12px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-btn { width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--fg-subtle); }
.dp-btn:hover { background: var(--bg-active); color: var(--fg); }
.dp-btn svg { width: 14px; height: 14px; }
.dp-body { flex: 1; min-height: 0; position: relative; }
.dp-host { position: absolute; inset: 6px 4px 4px 10px; overflow: hidden; }

/* ---------- toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--bottom) + 90px); transform: translateX(-50%); padding: 10px 14px; background: var(--bg); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: 0 12px 32px rgba(0, 0, 0, .6); z-index: 50; max-width: 90vw; }
