:root {
  --bg: #070b14;
  --bg-deep: #0b1220;
  --paper: rgba(15, 23, 38, 0.86);
  --ink: #e8eef9;
  --muted: #93a0b8;
  --line: rgba(148, 176, 214, 0.18);
  --accent: #3ee0ff;
  --accent-deep: #1aa8d6;
  --accent-soft: rgba(62, 224, 255, 0.12);
  --amber: #f5b942;
  --danger: #ff6b7a;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
  font-family: "SF Pro Text", "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 420px at 12% -10%, rgba(62, 224, 255, 0.16), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(88, 101, 242, 0.18), transparent 50%),
    linear-gradient(180deg, #0c1424 0%, var(--bg) 42%);
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}
.card {
  width: min(440px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
  padding: 36px 32px 28px;
}
.mark {
  letter-spacing: 0.22em;
  font-size: 12px;
  font-weight: 650;
  color: var(--accent);
  margin: 0 0 10px;
  text-transform: uppercase;
}
h1 {
  font-weight: 650;
  font-size: 32px;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 8px;
}
.lede { margin: 0 0 28px; color: var(--muted); line-height: 1.6; }
label { display: block; font-size: 13px; margin-bottom: 8px; color: var(--muted); }
input[type="text"], input[type="password"], input[type="tel"], input[type="search"], input[type="number"], textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.72);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
input:focus, textarea:focus {
  border-color: rgba(62, 224, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(62, 224, 255, 0.12);
}
.stack { display: grid; gap: 16px; }
.primary, .ghost, .danger {
  border-radius: 12px;
  padding: 11px 16px;
  border: 1px solid transparent;
}
.primary {
  background: linear-gradient(180deg, #67e8f9 0%, #22b8e6 100%);
  color: #04202a;
  font-weight: 650;
  box-shadow: 0 8px 24px rgba(34, 184, 230, 0.28);
}
.primary:hover:not(:disabled) { filter: brightness(1.06); }
.ghost, .danger { background: rgba(255, 255, 255, 0.03); }
.ghost { border-color: var(--line); }
.ghost:hover:not(:disabled) { border-color: rgba(62, 224, 255, 0.45); }
.danger { border-color: rgba(255, 107, 122, 0.4); color: #ffc1c8; }
.hint { margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 14px; }

.thread {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 28px 16px;
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.top h1 { font-size: 26px; }
.status { margin: 6px 0 0; color: var(--muted); }
.status.live { color: #7dffa8; }
.status.wait { color: var(--amber); }
.log {
  flex: 1;
  overflow: auto;
  padding: 22px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bubble, .note { max-width: min(78%, 520px); }
.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bubble .who { display: block; font-size: 12px; margin-bottom: 4px; opacity: 0.72; }
.bubble.in {
  background: rgba(18, 28, 46, 0.92);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.bubble.out {
  margin-left: auto;
  background: linear-gradient(180deg, #164e63 0%, #0e3a52 100%);
  border: 1px solid rgba(62, 224, 255, 0.28);
  border-bottom-right-radius: 6px;
  color: #f3fbff;
}
.note {
  align-self: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.composer {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.composer input { flex: 1; }
.linkdown { color: var(--amber); }

.desk { height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: rgba(8, 13, 24, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.bar h1 { font-size: 20px; }
.bar-actions { display: flex; align-items: center; gap: 10px; }
.whoami { color: var(--muted); font-size: 14px; }
.pill {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}
.pill.on {
  border-color: rgba(125, 255, 168, 0.45);
  color: #b8ffcf;
  background: rgba(16, 80, 48, 0.45);
  box-shadow: 0 0 18px rgba(125, 255, 168, 0.12);
}
.work { min-height: 0; display: grid; grid-template-rows: auto 1fr; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.stat {
  background: rgba(15, 23, 38, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  min-width: 0;
}
.stat > span { display: block; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; }
.stat strong { display: block; margin-top: 4px; font-size: 22px; font-weight: 650; letter-spacing: -0.03em; }
.stat em, .stat-agents p em { color: var(--muted); font-style: normal; font-size: 12px; }
.stat > em { display: block; margin-top: 4px; }
.stat-agents { max-height: 108px; overflow: auto; }
.stat-agents p { margin: 6px 0 0; font-size: 13px; }
.body { display: grid; grid-template-columns: 320px 1fr; min-height: 0; }
.list { border-right: 1px solid var(--line); overflow: auto; background: rgba(6, 10, 18, 0.35); }
.list h2 {
  margin: 0;
  padding: 16px 16px 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 650;
}
.item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 16px;
}
.item.active {
  background: linear-gradient(90deg, rgba(62, 224, 255, 0.14), transparent 80%);
  box-shadow: inset 2px 0 0 var(--accent);
}
.item strong { display: block; font-weight: 650; }
.item span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { color: var(--muted); padding: 8px 16px 16px; margin: 0; font-size: 14px; }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: rgba(9, 14, 26, 0.55); }
.chat .log { padding: 22px 20px; }
.chat .composer { padding: 12px 16px 16px; }
.chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 13, 24, 0.55);
}
.chat-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.placeholder { margin: auto; color: var(--muted); }

.shell { min-height: 0; display: grid; grid-template-columns: 168px 1fr; }
.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: rgba(6, 10, 18, 0.55);
}
.menu button {
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  white-space: nowrap;
}
.menu button.on {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge, .count {
  display: inline-block;
  min-width: 1.2em;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ff8b97, #e11d48);
  color: #fff;
  font-size: 12px;
  font-style: normal;
  line-height: 1.5;
  text-align: center;
}
.item { position: relative; }
.item .count { position: absolute; right: 12px; top: 12px; margin: 0; }
.receipt { display: block; margin-top: 6px; font-size: 12px; opacity: 0.75; }
.shot { display: block; max-width: min(220px, 100%); max-height: 220px; margin-top: 4px; border-radius: 10px; }
.recalled { color: var(--muted); font-style: italic; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 0; }
.quick button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
}
.quick button:hover { border-color: rgba(62, 224, 255, 0.45); }
.recall {
  margin-top: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 0;
}
.panel { overflow: auto; padding: 20px; background: transparent; }
.panel h2 { margin: 0 0 16px; font-weight: 650; letter-spacing: -0.02em; }
.settings { width: min(640px, 100%); display: grid; gap: 14px; }
textarea { min-height: 88px; resize: vertical; }
.contact { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.contact span + span { margin-left: 12px; }
.accounts { display: grid; gap: 10px; margin-top: 18px; }
.account {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(15, 23, 38, 0.72);
}
.account strong { font-weight: 650; }
.account span, .account em { color: var(--muted); font-style: normal; font-size: 13px; }
.account input { width: 160px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.check input { width: auto; }
.search { padding: 12px 16px 0; }
.search input { border-radius: 12px; }
.history { display: grid; grid-template-columns: 280px 1fr; min-height: 0; height: 100%; }
.history .list { background: transparent; }

@media (max-width: 800px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .body { grid-template-columns: 1fr; grid-template-rows: 38vh 1fr; }
  .list { border-right: 0; border-bottom: 1px solid var(--line); }
  .bar { align-items: flex-start; flex-direction: column; }
  .bar-actions { flex-wrap: wrap; }
  .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .menu { flex-direction: row; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .menu button { flex: none; }
  .history { grid-template-columns: 1fr; grid-template-rows: 32vh 1fr; }
  .card { padding: 28px 20px 22px; }
}
