/* Soul portal. Design read: a companion app for a desk robot, phone first, playful but precise.
   Dials (taste-skill): VARIANCE 6, MOTION 4, DENSITY 4.
   Palette: cool porcelain like the robot's shell, ink, and ONE accent, the cobalt of its wheel
   rims. The eye blue (#7fc8ff) only ever appears inside the robot's face screen.
   Radius rule: stages 32px, cards 24px, inputs 14px, buttons and chips full pill. */
:root {
  --paper: #eef1f4;
  --paper-2: #e3e8ed;
  --surface: #fbfcfd;
  --ink: #111a22;
  --muted: #5a6672;
  --line: #d6dde3;
  --accent: #2b5bd7;
  --accent-ink: #f7f9ff;
  --accent-soft: #dfe7fb;
  --danger: #bf3b2c;
  --danger-soft: #fbe5e1;
  --stage: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #e7ecf1 55%, #d9e0e7 100%);
  --floor: rgba(17, 26, 34, 0.22);
  --shadow: 0 1px 1px rgba(17, 26, 34, 0.04), 0 10px 30px -12px rgba(17, 26, 34, 0.18);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1318;
    --paper-2: #121a20;
    --surface: #151d24;
    --ink: #e6ecf1;
    --muted: #94a1ac;
    --line: #25313a;
    --accent: #7c9fff;
    --accent-ink: #0b1221;
    --accent-soft: #1b2843;
    --danger: #ff8f80;
    --danger-soft: #3a1d1a;
    --stage: radial-gradient(120% 90% at 50% 0%, #26323c 0%, #18212a 55%, #121a20 100%);
    --floor: rgba(0, 0, 0, 0.55);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px -14px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 "Be Vietnam Pro", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.icon { width: 22px; height: 22px; flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 16px; letter-spacing: -0.005em; text-decoration: none; white-space: nowrap;
  cursor: pointer; touch-action: manipulation;
  transition: transform 0.18s var(--ease), background-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 20px -10px var(--accent); }
.btn-quiet { background: var(--surface); border-color: var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; flex: none;
  border-radius: 999px; border: 0; background: transparent; cursor: pointer; color: inherit;
  transition: background-color 0.18s var(--ease);
}
.icon-btn:hover { background: var(--paper-2); }

/* ---------- the robot (robot-figure.js) ---------- */
.robot-fig { position: relative; width: 100%; }
.robot-fig::after { /* contact shadow on the desk */
  content: ""; position: absolute; left: 12%; right: 10%; bottom: -3%; height: 10%; z-index: -1;
  background: radial-gradient(closest-side, var(--floor), transparent); filter: blur(2px);
}
.robot-fig__inner { position: absolute; left: 0; top: 0; transform: scale(var(--s, 0)); transform-origin: 0 0; }
.robot-fig__inner img { display: block; width: 100%; height: 100%; }
.robot-fig__face { position: absolute; left: 0; top: 0; width: 320px; height: 240px; transform-origin: 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .robot-fig.idle .robot-fig__inner { animation: hover 5s var(--ease) infinite; }
  @keyframes hover { 50% { translate: 0 -1.2%; } }
}

/* ---------- sign-in ---------- */
.login {
  min-height: 100dvh; display: grid; grid-template-columns: 1fr;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.login-stage {
  position: relative; display: grid; align-content: end; gap: 18px;
  padding: 28px 20px 26px; background: var(--stage); border-radius: 0 0 32px 32px; overflow: hidden;
}
.login-stage .robot-fig { width: min(78%, 420px); justify-self: center; margin-bottom: 6px; }
.login-stage h1 {
  font-size: clamp(30px, 8.2vw, 56px); line-height: 1.04; font-weight: 800; letter-spacing: -0.035em;
  max-width: 16ch; text-wrap: balance;
}
.login-stage p { color: var(--muted); max-width: 34ch; }
.login-panel { display: grid; align-content: start; gap: 18px; padding: 24px 20px 32px; }
@media (min-width: 900px) {
  .login { grid-template-columns: minmax(0, 7fr) minmax(380px, 5fr); }
  .login-stage { border-radius: 0 32px 32px 0; padding: 56px 64px; align-content: center; }
  .login-stage .robot-fig { width: min(86%, 620px); justify-self: start; margin: 0 0 24px -2%; }
  .login-panel { align-content: center; padding: 56px clamp(32px, 6vw, 88px); max-width: 560px; }
}

.tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px;
  border-radius: 999px; background: var(--paper-2);
}
.tabs::before { /* the sliding thumb shows which mode is active */
  content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: 999px; background: var(--surface); box-shadow: var(--shadow);
  transition: translate 0.32s var(--ease);
}
.tabs:has(#tab-register[aria-selected="true"])::before { translate: 100% 0; }
.tabs button {
  position: relative; min-height: 46px; border: 0; border-radius: 999px; background: transparent;
  font-weight: 700; color: var(--muted); cursor: pointer; touch-action: manipulation;
  transition: color 0.2s var(--ease);
}
.tabs button[aria-selected="true"] { color: var(--ink); }

.auth { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-weight: 700; font-size: 15px; }
.field input {
  width: 100%; min-height: 52px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); font-size: 16px; /* 16px: iOS does not zoom on focus */
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field .hint { color: var(--muted); font-size: 13.5px; }
.password { position: relative; display: grid; }
.password input { padding-right: 56px; }
.password .icon-btn { position: absolute; right: 4px; top: 50%; translate: 0 -50%; color: var(--muted); }
.password .icon-btn[aria-pressed="true"] { color: var(--accent); }
.form-error {
  padding: 12px 14px; border-radius: 14px; background: var(--danger-soft); color: var(--danger);
  font-size: 15px; font-weight: 500;
}
.auth .btn, .alt .btn { width: 100%; }
.alt { display: grid; gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- my robots ---------- */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; font-size: 18px; }
.brand-mark {
  width: 30px; height: 22px; border-radius: 8px; background: #0b1014; position: relative;
  box-shadow: 0 0 0 1.5px var(--line); /* keeps the dark screen visible on the dark theme */
}
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; top: 7px; width: 5px; height: 8px; border-radius: 3px; background: #7fc8ff;
}
.brand-mark::before { left: 8px; }
.brand-mark::after { right: 8px; }
.me { display: flex; align-items: center; gap: 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; object-fit: cover; overflow: hidden;
}

main.home { width: min(1120px, 100%); margin: 0 auto; padding: 12px 16px calc(40px + env(safe-area-inset-bottom)); }
.greeting { display: grid; gap: 6px; margin: 8px 4px 24px; }
.greeting h1 { font-size: clamp(30px, 7.4vw, 48px); line-height: 1.05; font-weight: 800; letter-spacing: -0.035em; }
.greeting p { color: var(--muted); }

.robots { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 720px) {
  .robots { grid-template-columns: repeat(6, 1fr); gap: 20px; }
  /* The first robot leads; the rest and the add slot share the row beside or below it. */
  .robots > li { grid-column: span 3; }
  .robots > li:first-child:not(.add) { grid-column: span 4; grid-row: span 2; }
  .robots > li:first-child:not(.add) ~ li { grid-column: span 2; }
}
.robot-card {
  position: relative; display: grid; grid-template-rows: 1fr auto; height: 100%; min-height: 300px;
  border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  overflow: hidden; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.robot-card:has(a.open:active) { transform: scale(0.985); }
.robot-card .stage {
  display: grid; place-items: center; padding: 28px 22px 34px; background: var(--stage);
}
.robot-card .robot-fig { width: min(86%, 340px); }
.robot-card .info { display: flex; align-items: center; gap: 12px; padding: 16px 12px 16px 20px; }
.robot-card .info > div { flex: 1; min-width: 0; }
.robot-card h2 { font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.robot-card .info p { color: var(--muted); font-size: 14px; }
.robot-card a.open { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.robot-card .go {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14.5px; white-space: nowrap;
}
.robot-card .menu-btn { position: relative; z-index: 2; color: var(--muted); }
.robot-card .info p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Narrow phones: the whole card already opens the chat, so the chip keeps only its icon. */
@media (max-width: 440px) {
  .robot-card .go { width: 40px; padding: 0; justify-content: center; }
  .robot-card .go .label { display: none; }
}
.robots > li:first-child:not(.add) .robot-card { min-height: 420px; }
.robots > li:first-child:not(.add) .robot-card h2 { font-size: 30px; }

.add-slot {
  display: grid; place-items: center; align-content: center; gap: 12px; width: 100%; height: 100%; min-height: 200px;
  padding: 24px; border-radius: 24px; border: 2px dashed var(--line); background: transparent;
  color: var(--muted); font-weight: 700; cursor: pointer; text-align: center;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.add-slot .plus {
  width: 56px; height: 56px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); transition: transform 0.25s var(--ease);
}
.add-slot:hover { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.add-slot:hover .plus { transform: rotate(90deg); }
.add-slot small { font-weight: 500; font-size: 13.5px; }
.add-slot[disabled] { cursor: default; opacity: 0.7; background: transparent; border-color: var(--line); color: var(--muted); }
.add-slot[disabled] .plus { background: var(--paper-2); color: var(--muted); transform: none; }

.empty {
  display: grid; gap: 18px; justify-items: start; padding: 28px 24px 28px; margin-bottom: 16px;
  border-radius: 32px; background: var(--stage);
}
.empty .robot-fig { width: min(80%, 440px); justify-self: center; margin: 8px 0 12px; }
.empty h2 { font-size: clamp(24px, 6vw, 32px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.empty p { color: var(--muted); max-width: 36ch; }
@media (min-width: 900px) {
  .empty { grid-template-columns: 1.2fr 1fr; align-items: center; padding: 48px 56px; }
  .empty .robot-fig { grid-row: span 3; order: 2; width: 100%; }
}

.skeleton { border-radius: 24px; min-height: 300px; background: var(--paper-2); }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { background: linear-gradient(100deg, var(--paper-2) 40%, var(--surface) 50%, var(--paper-2) 60%) 0 0 / 200% 100%;
              animation: shimmer 1.4s linear infinite; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .robots > li { animation: rise 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
  @keyframes rise { from { opacity: 0; translate: 0 14px; } }
}
.list-error { margin-top: 16px; }

/* small popover menu on a robot card */
.menu {
  position: absolute; right: 12px; bottom: 64px; z-index: 3; min-width: 180px; padding: 6px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.35);
}
.menu button, .menu .menu-item {
  display: flex; text-decoration: none; color: inherit; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0;
  border-radius: 10px; background: transparent; cursor: pointer; font-weight: 600; text-align: left;
}
.menu button:hover, .menu .menu-item:hover { background: var(--paper-2); }
.menu .danger { color: var(--danger); }

/* ---------- sheet (bottom sheet on phones, dialog on wide screens) ---------- */
dialog.sheet {
  margin: auto auto 0; width: 100%; max-width: 480px; border: 0; padding: 0;
  background: var(--surface); color: var(--ink); border-radius: 28px 28px 0 0;
}
dialog.sheet::backdrop { background: rgba(8, 12, 16, 0.5); }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 28px; } }
@media (prefers-reduced-motion: no-preference) {
  dialog.sheet[open] { animation: sheet-in 0.36s var(--ease); }
  @keyframes sheet-in { from { translate: 0 24px; opacity: 0; } }
}
.sheet form { display: grid; gap: 18px; padding: 24px 22px calc(22px + env(safe-area-inset-bottom)); }
.sheet .grabber { justify-self: center; width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: -8px 0 2px; }
@media (min-width: 640px) { .sheet .grabber { display: none; } }
.sheet h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.025em; }
.sheet p { color: var(--muted); }
.sheet .robot-fig { width: 62%; justify-self: center; }
.actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.field .error { color: var(--danger); font-size: 14px; font-weight: 500; }
.field .error:empty { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- robot settings ---------- */
.talk-link { min-height: 40px; padding: 0 16px; font-size: 14.5px; }
.settings { width: min(720px, 100%); margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }
.settings-hero { display: grid; gap: 8px; padding: 20px 20px 24px; border-radius: 32px; background: var(--stage); margin-bottom: 8px; }
.settings-hero .robot-fig { width: min(64%, 300px); justify-self: center; margin-bottom: 8px; }
.settings-hero h1 { font-size: clamp(28px, 7vw, 40px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; }
.settings-hero p { color: var(--muted); max-width: 46ch; }
.settings-form { display: grid; }
.group { border: 0; margin: 0; padding: 22px 4px; border-bottom: 1px solid var(--line); display: grid; gap: 12px; min-width: 0; }
.group:last-child { border-bottom: 0; }
.group legend, .group-title, .advanced summary { font-weight: 800; font-size: 18px; letter-spacing: -0.015em; padding: 0; }
.group legend { margin-bottom: 2px; }
.group .hint { color: var(--muted); font-size: 13.5px; }
.group textarea {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface);
  font: inherit; font-size: 16px; line-height: 1.5; resize: vertical; min-height: 96px;
}
.group textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.look-stage { height: clamp(220px, 46vw, 300px); border-radius: 24px; overflow: hidden; background: var(--paper-2); touch-action: pan-y; }
.look-stage canvas { display: block; width: 100%; height: 100%; }
.look-row { display: grid; gap: 8px; }
.look-label { font-weight: 700; font-size: 14.5px; color: var(--muted); }
.pills, .swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { position: relative; cursor: pointer; }
.pill input, .swatch input { position: absolute; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.pill input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.pill input:focus-visible + span, .swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch { cursor: pointer; }
.swatch span {
  display: block; width: 44px; height: 44px; border-radius: 999px; background: var(--c);
  box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.12); transition: box-shadow 0.18s var(--ease), transform 0.18s var(--ease);
}
.swatch input:checked + span { box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, 0.12), 0 0 0 3px var(--surface), 0 0 0 5.5px var(--accent); }
.swatch:active span { transform: scale(0.94); }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: grid; gap: 2px; min-height: 76px; align-content: center; padding: 12px 16px; border-radius: 20px;
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.choice b { font-size: 16px; }
.choice small { color: var(--muted); font-size: 13.5px; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice:active span { transform: scale(0.98); }

.slider { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0; }
.slider::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.slider::-moz-range-track { height: 8px; border-radius: 999px; background: var(--paper-2); }
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 999px;
  background: var(--accent); border: 4px solid var(--surface); box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.45);
}
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 999px; background: var(--accent); border: 4px solid var(--surface); }
.ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-top: -6px; }

.voices, .switches { display: grid; gap: 8px; }
.voice, .switch {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 8px 8px 16px; border-radius: 18px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.voice input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.voice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.voice-text, .switch-text { display: grid; flex: 1; min-width: 0; }
.voice-text small, .switch-text small { color: var(--muted); font-size: 13.5px; }
.voice .play { background: var(--accent); color: var(--accent-ink); }
.voice .play:hover { background: var(--accent); filter: brightness(1.08); }

.switch { padding-right: 16px; }
.switch input {
  -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 52px; height: 32px; margin: 0;
  border-radius: 999px; background: var(--line); cursor: pointer; transition: background-color 0.2s var(--ease);
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 999px;
  background: var(--surface); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25); transition: translate 0.24s var(--ease);
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { translate: 20px 0; }
.switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.switch.soon { cursor: default; opacity: 0.6; }
.switch.soon input { cursor: default; }

.advanced summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::after { content: "+"; font-size: 24px; font-weight: 500; color: var(--muted); transition: rotate 0.2s var(--ease); }
.advanced[open] summary::after { rotate: 45deg; }

.savebar {
  position: fixed; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom)); translate: -50% 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(688px, calc(100vw - 24px)); padding: 10px 10px 10px 20px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: 0 20px 44px -16px rgba(0, 0, 0, 0.35);
}
.savebar span { color: var(--muted); font-size: 14px; font-weight: 600; min-width: 0; }
.savebar .btn { min-height: 46px; flex: none; }
.page-error { width: min(720px, calc(100% - 32px)); margin: 16px auto; }

/* ---------- robot pages: knowledge, tools ---------- */
.page { width: min(720px, 100%); margin: 0 auto; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.page-head { display: grid; gap: 8px; padding: 8px 4px 4px; }
.page-head h1 { font-size: clamp(28px, 7vw, 40px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; }
.page-head p { color: var(--muted); max-width: 52ch; }
.panel { display: grid; gap: 14px; padding: 20px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); }
.panel h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.015em; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel .hint { color: var(--muted); font-size: 13.5px; }
.panel textarea {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper);
  font: inherit; font-size: 16px; line-height: 1.5; resize: vertical;
}
.panel textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.empty-line { color: var(--muted); font-size: 15px; }

.drop {
  display: grid; justify-items: center; gap: 6px; padding: 28px 16px; border-radius: 20px; text-align: center;
  border: 2px dashed var(--line); background: var(--paper); cursor: pointer;
  transition: border-color 0.18s var(--ease), background-color 0.18s var(--ease);
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop small { color: var(--muted); }
.drop-icon { width: 34px; height: 34px; color: var(--accent); }

.rows { list-style: none; margin: 0; padding: 0; display: grid; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row > .icon { color: var(--accent); }
.row-text { display: grid; flex: 1; min-width: 0; }
.row-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text small { color: var(--muted); font-size: 13.5px; }

.search { display: flex; gap: 8px; }
.search input {
  flex: 1; min-width: 0; min-height: 50px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--paper); font-size: 16px;
}
.search input:focus { outline: none; border-color: var(--accent); }
.search .icon-btn { width: 50px; height: 50px; background: var(--accent); color: var(--accent-ink); }
.hits { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hits li:not(.empty-line) { padding: 12px 14px; border-radius: 16px; background: var(--paper); }
.hits b { font-size: 14px; color: var(--accent); }
.hits p { font-size: 15px; white-space: pre-line; }

.switch.tool { cursor: default; }
.switch.tool .icon-btn { color: var(--muted); }
.chat-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 18px; font-size: 15.5px; white-space: pre-line; }
.msg.bot { justify-self: start; background: var(--paper); border-bottom-left-radius: 6px; }
.msg.me { justify-self: end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.draft { display: grid; gap: 12px; padding: 16px; border-radius: 20px; border: 1.5px solid var(--accent); background: var(--accent-soft); }
.draft-head { display: flex; gap: 12px; align-items: center; }
.draft-head > .icon { color: var(--accent); }
.draft-head div { display: grid; min-width: 0; }
.draft-head small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.draft .field input { background: var(--surface); }
.test-result {
  margin: 0; padding: 12px; border-radius: 14px; background: var(--surface); font-size: 12.5px;
  max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* settings: links to the robot's knowledge and tools */
.links { display: grid; gap: 8px; }
.link-row {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 16px; border-radius: 18px;
  border: 1.5px solid var(--line); background: var(--surface); text-decoration: none; color: inherit;
}
.link-row > .icon:first-child { color: var(--accent); }
.link-row:hover { border-color: var(--accent); }
.link-row .caret { color: var(--muted); margin-left: auto; }

.google-row { cursor: default; }
.google-row .google-btn { min-height: 40px; padding: 0 16px; font-size: 14.5px; flex: none; }
