:root {
  font-family: system-ui, -apple-system, "Microsoft YaHei", sans-serif;
  color: #f7eef2;
  background: #0f0a10;
  color-scheme: dark;
  --accent: #a72b53;
  --accent-soft: #6f243f;
  --accent-deep: #39202b;
  --panel-bg: #181117;
  --panel-raised: #21171f;
  --line: #3c2632;
  --muted: #ad9ca4;
  --speaker: #d99bae;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 86% 0%, #35111f 0, transparent 31%), #0f0a10;
  color: #f7eef2;
}

.topbar {
  height: 72px;
  padding: 0 max(18px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(17, 11, 17, .94);
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 11px; }
.brand strong, .brand small { display: block; }
.brand small { font-size: 10px; color: var(--muted); margin-top: 2px; }
.logo {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--accent);
  font-weight: 800; font-size: 19px;
}

main { width: min(680px, 100%); margin: 0 auto; padding: 24px 16px 56px; }

.card, .metric {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
}

.auth-card { max-width: 430px; margin: 36px auto; }

.eyebrow { margin: 0 0 6px; color: var(--speaker); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 27px; margin-bottom: 10px; }
h2 { font-size: 22px; margin-bottom: 8px; }
.muted { color: var(--muted); line-height: 1.6; }
.fineprint { font-size: 12px; color: #806f77; line-height: 1.55; margin: 15px 0 0; }

.notice {
  padding: 12px 15px; border-radius: 12px; margin-bottom: 14px;
  background: var(--panel-raised); border: 1px solid var(--line); color: #f7eef2;
}
.notice.error { background: #35232a; border-color: #65404b; color: #ffd9df; }

.auth-tabs, .tabs { display: flex; gap: 8px; }
.auth-tabs { margin: 20px 0 16px; }
.auth-tab, .tab, .text-button {
  border: 0; background: transparent; color: var(--muted);
  padding: 9px 13px; border-radius: 10px;
}
.auth-tab.active, .tab.active { background: var(--accent-deep); color: #fff; }

form { display: grid; gap: 14px; }
label { font-size: 13px; color: var(--muted); display: grid; gap: 7px; }
input, select, button { font: inherit; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: #f7eef2;
  border-radius: 11px;
  padding: 13px 14px;
  outline: none;
}
input:focus, select:focus {
  border-color: var(--speaker);
  box-shadow: 0 0 0 3px rgba(217, 155, 174, .18);
}
button { cursor: pointer; }

.primary, .secondary {
  border: 1px solid var(--accent);
  border-radius: 11px;
  padding: 13px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.secondary { background: var(--panel-raised); border-color: var(--line); }
.wide { width: 100%; margin-top: 14px; }

.device-illustration {
  width: 82px; height: 82px; margin: 20px auto;
  display: grid; place-items: center;
  border-radius: 24px;
  background: linear-gradient(145deg, var(--accent), var(--accent-soft));
  font-size: 32px; font-weight: 800;
}

.facts { margin: 14px 0 0; }
.facts div {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 650; word-break: break-all; }

.device-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.device-heading h1 { margin-bottom: 4px; }

.badge {
  border-radius: 999px; padding: 7px 12px; font-size: 13px;
  background: #1a3d31; color: #68d79a; border: 1px solid #2d6c56;
}
.badge.offline { background: #35232a; color: #ecabb9; border-color: #65404b; }

.tabs {
  padding: 5px; background: #171018;
  border: 1px solid var(--line); border-radius: 14px; margin-bottom: 16px;
}
.tab { flex: 1; }

.hero-card { display: flex; align-items: center; gap: 16px; }

.agent-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft);
  border: 2px solid var(--speaker);
  font-size: 27px; font-weight: 800; flex: 0 0 auto;
}

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.metric { padding: 17px; }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 12px; margin-bottom: 9px; }
.metric strong { font-size: 17px; }

.panel[hidden], [hidden] { display: none !important; }

.memory-count { display: flex; align-items: baseline; gap: 7px; margin: 22px 0; }
.memory-count strong { font-size: 56px; color: var(--speaker); }
.memory-count span { color: var(--muted); }

.text-button { font-size: 13px; }

@media (max-width: 480px) {
  main { padding-top: 18px; }
  .card { padding: 18px; }
  .grid { grid-template-columns: 1fr; }
  .device-heading { align-items: flex-start; }
  .hero-card { align-items: flex-start; }
  .tabs { gap: 2px; }
  .tab { padding: 9px 5px; font-size: 13px; }
}
