:root {
  --bg: #08080b;
  --surface: #0e0e13;
  --surface-2: #15151c;
  --surface-3: #1c1c25;
  --border: #26262f;
  --border-strong: #34343f;
  --text: #eceaf2;
  --text-dim: #9a97a8;
  --text-faint: #6b6878;
  --accent: #43a184;
  --accent-soft: #6fc7a5;
  --accent-dim: rgba(67, 161, 132, 0.14);
  --user: #6f7fd6;
  --user-dim: rgba(111, 127, 214, 0.14);
  --ok: #5aa87f;
  --warn: #d6a155;
  --err: #cf5f5f;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;
  --sidebar-w: 264px;
  --rail-w: 320px;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #45454f; }

:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 2px; border-radius: 4px; }

/* layout */
body.page-scroll { overflow-y: auto; }
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
}

/* sidebar */
.hidden { display: none !important; }
#sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-head {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--accent), #2a6b54);
  display: grid; place-items: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(67, 161, 132, 0.35);
}

.brand-text { min-width: 0; }
.brand-title {
  font-family: var(--font-display);
  font-weight: 650;
  font-size: 13px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand-sub { font-size: 10.5px; color: var(--text-faint); line-height: 1.3; }

/* sidebar footer rows */
.sidebar-foot { flex-direction: column; align-items: stretch; gap: 8px; }
.foot-row { display: flex; gap: 6px; align-items: center; }
.foot-row .model-chip { flex: 1; min-width: 0; }
.user-row { justify-content: space-between; }
.user-name {
  font-size: 11.5px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* auth gate */
.auth {
  position: fixed;
  inset: 0;
  z-index: 70;
  background:
    radial-gradient(1000px 600px at 50% 110%, rgba(67, 161, 132, 0.16), transparent 60%),
    linear-gradient(rgba(8, 8, 12, 0.82), rgba(8, 8, 12, 0.9));
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}
.auth.hidden { display: none; }

/* animated photo wall behind the login card */
.auth-bg {
  position: absolute; inset: -60px; z-index: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
  -webkit-mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 25%, transparent 78%);
  mask-image: radial-gradient(ellipse 75% 70% at 50% 50%, #000 25%, transparent 78%);
  pointer-events: none;
}
.show-col { display: flex; flex-direction: column; gap: 14px; animation: show-scroll var(--dur, 42s) linear infinite; }
.show-col.rev { animation-direction: reverse; }
@keyframes show-scroll { to { transform: translateY(-50%); } }
.show-card {
  margin: 0; position: relative; border-radius: 16px; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.show-card img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; filter: brightness(0.62) saturate(1.05); }
.show-letter {
  display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 4;
  font-family: var(--font-display); font-size: 44px; color: var(--text-faint);
  background: var(--surface-3);
}
.show-card figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 12px 10px; font-size: 12.5px; font-weight: 650; letter-spacing: 0.01em;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
}
.auth-card { position: relative; z-index: 1; }
.auth-card {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.auth-mark {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent), #2a6b54);
  display: grid; place-items: center;
  font-size: 20px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(67, 161, 132, 0.35);
}
.auth-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.auth-sub { font-size: 12.5px; color: var(--text-faint); margin: 5px 0 18px; }
.auth-submit { width: 100%; margin-top: 4px; }
.auth-switch { font-size: 12px; color: var(--text-faint); text-align: center; margin-top: 14px; }
.auth-switch button {
  background: none;
  border: none;
  color: var(--accent-soft, var(--accent));
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}
.auth-switch button:hover { text-decoration: underline; }

/* character switcher */
.char-strip {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.char-strip.hidden { display: none; }
.char-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-faint);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.13s, color 0.13s, background 0.13s;
  flex-shrink: 0;
}
.char-chip img,
.char-chip > span {
  width: 20px; height: 20px;
  border-radius: 50%;
  object-fit: cover;
  display: grid; place-items: center;
  background: var(--surface-3);
  font-size: 10px;
  color: var(--text);
}
.char-chip em { font-style: normal; }
.char-chip:hover { color: var(--text); border-color: var(--border-strong, #3a3a47); }
.char-chip.active {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-dim, rgba(67, 161, 132, 0.14));
}

/* startup character picker */
.char-picker {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 8, 12, 0.86);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 24px;
}
.char-picker.hidden { display: none; }
.char-picker-inner { width: min(640px, 100%); text-align: center; }
.char-picker-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.char-picker-sub { font-size: 12.5px; color: var(--text-faint); margin-bottom: 26px; }
.char-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.char-card {
  padding: 22px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.char-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  transform: translateY(-2px);
}
.char-card-avatar {
  width: 76px; height: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-size: 28px;
  color: var(--text);
  margin-bottom: 10px;
  border: 2px solid var(--border);
}
.char-card:hover .char-card-avatar { border-color: var(--accent); }
.char-card-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.char-card-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.char-card-sub { font-size: 11.5px; color: var(--text-faint); }

.sidebar-section { border-bottom: 1px solid var(--border); flex-shrink: 0; }
.section-label {
  padding: 13px 14px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.icon-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-dim);
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }

.conv-list {
  overflow-y: auto;
  max-height: 32vh;
  padding: 0 7px 9px;
  min-height: 0;
}

.conv-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-dim);
  transition: background 0.13s, color 0.13s;
  position: relative;
}
.conv-item:hover { background: var(--surface-2); color: var(--text); }
.conv-item.active { background: var(--accent-dim); color: var(--text); }
.conv-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2px; height: 15px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}
.conv-title {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.conv-who {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text-faint); letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-who img { width: 13px; height: 13px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.conv-count { font-size: 10px; color: var(--text-faint); font-family: var(--mono); }
.conv-del {
  opacity: 0;
  width: 19px; height: 19px;
  border-radius: 4px;
  display: grid; place-items: center;
  color: var(--text-faint);
  flex-shrink: 0;
  transition: opacity 0.13s, background 0.13s, color 0.13s;
}
.conv-item:hover .conv-del { opacity: 1; }
.conv-del:hover { background: rgba(207, 95, 95, 0.18); color: var(--err); }

.btn-new {
  margin: 11px 11px 13px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent) 55%, #2a6b54);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 18px rgba(67, 161, 132, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
  flex-shrink: 0;
}
.btn-new:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 26px rgba(67, 161, 132, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn-new:active { transform: translateY(0) scale(0.98); box-shadow: 0 2px 10px rgba(67, 161, 132, 0.3); }
.btn-new-ico {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: grid; place-items: center; flex-shrink: 0;
}

.sidebar-foot {
  margin-top: auto;
  padding: 10px 11px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  gap: 6px;
  align-items: center;
}

.model-chip {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.13s, background 0.13s;
}
.model-chip:hover { background: var(--surface-3); border-color: var(--border-strong); }
.model-chip-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}
.model-chip-value {
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-dim);
}
.model-chip-value.ready { color: var(--ok); }
.model-chip-value.empty { color: var(--warn); }

/* main */
#main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  background: rgba(14, 14, 19, 0.85);
  backdrop-filter: blur(12px);
}

.topbar-title {
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.topbar-sub { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.topbar-spacer { flex: 1; }

.mood-strip {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-shrink: 0;
}
.mood-btn {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  white-space: nowrap;
  transition: background 0.13s, color 0.13s;
}
.mood-btn:hover { color: var(--text); background: var(--surface-3); }
.mood-btn.active {
  background: var(--accent-dim);
  color: var(--accent-soft);
  font-weight: 600;
}
.mood-btn.active[data-mood="aggressive"] { background: rgba(207,95,95,0.16); color: #e08a8a; }
.mood-btn.active[data-mood="hyper"] { background: rgba(214,161,85,0.16); color: #e0b97a; }
.mood-btn.active[data-mood="passive"] { background: rgba(111,127,214,0.16); color: #96a2e8; }
.mood-btn.active[data-mood="cold"] { background: rgba(120,132,150,0.18); color: #a6b0be; }
.mood-btn.active[data-mood="needy"] { background: rgba(150,110,200,0.16); color: #b79ae0; }

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}
.status-dot.live { background: var(--ok); box-shadow: 0 0 7px rgba(90, 168, 127, 0.6); }
.status-dot.busy { background: var(--warn); animation: pulse 1.1s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.32; } }

#scenario-bar {
  padding: 9px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-dim);
}
#scenario-bar.hidden { display: none; }
.scenario-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  flex-shrink: 0;
}
.scenario-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* messages */
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 26px 0 12px;
  min-height: 0;
  scroll-behavior: smooth;
}

.msg-wrap {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
  overflow: hidden;
}
.msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.msg-avatar.her {
  background: linear-gradient(140deg, var(--accent), #2a6b54);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(67, 161, 132, 0.28);
}
.msg-avatar.you {
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
}

.msg-body { min-width: 0; flex: 1; }

.msg-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 10.5px;
  color: var(--text-faint);
}
.msg-sender { font-weight: 600; color: var(--text-dim); }
.msg-time { font-family: var(--mono); font-size: 10px; }
.msg-del {
  opacity: 0;
  width: 18px; height: 18px;
  border-radius: 4px;
  display: grid; place-items: center;
  color: var(--text-faint);
  transition: opacity 0.13s, background 0.13s, color 0.13s;
}
.msg-wrap:hover .msg-del { opacity: 1; }
.msg-del:hover { background: rgba(207, 95, 95, 0.18); color: var(--err); }

.bubble {
  padding: 11px 15px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 13.5px;
  line-height: 1.66;
  white-space: pre-wrap;
  word-break: break-word;
}
.bubble.her { border-top-left-radius: 4px; }

/* inner monologue — visually separate from spoken dialogue */
.bubble .thought {
  display: block;
  margin: 8px 0 2px;
  padding: 2px 0 2px 11px;
  border-left: 2px solid rgba(67, 161, 132, 0.5);
  font-style: italic;
  font-weight: 400;
  color: var(--accent-soft);
  opacity: 0.92;
  letter-spacing: 0.004em;
}
.bubble .thought::before {
  content: 'thought';
  display: block;
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  opacity: 0.6;
  margin-bottom: 1px;
}
.bubble .aside { color: var(--accent-soft); font-style: italic; }
.bubble.you {
  background: var(--user-dim);
  border-color: rgba(111, 127, 214, 0.26);
  border-top-left-radius: var(--radius);
  border-top-right-radius: 4px;
}

.cursor-blink {
  display: inline-block;
  width: 6px; height: 14px;
  background: var(--accent-soft);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
  border-radius: 1px;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* empty state */
#empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 30px;
  text-align: center;
}
#empty.hidden { display: none; }
.empty-avatar {
  width: 168px; height: 200px;
  border-radius: 28px;
  background: linear-gradient(140deg, var(--accent), #2a6b54);
  display: grid; place-items: center;
  font-size: 32px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(67, 161, 132, 0.3);
  border: 1px solid rgba(67, 161, 132, 0.3);
}
.empty-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.empty-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.empty-sub { font-size: 12.5px; color: var(--text-faint); max-width: 320px; }

.scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 22px;
  max-width: 460px;
}
.scenario-chip {
  padding: 6px 11px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--text-dim);
  transition: all 0.13s;
}
.scenario-chip:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--text);
}

/* composer */
#composer {
  border-top: 1px solid var(--border);
  padding: 13px 24px 16px;
  background: var(--surface);
  flex-shrink: 0;
}
.composer-inner {
  max-width: 660px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 7px 7px 7px 14px;
  transition: border-color 0.15s;
}
.composer-inner:focus-within { border-color: var(--border-strong); }

#input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  max-height: 168px;
  padding: 6px 0;
  font-size: 13.5px;
  line-height: 1.55;
}
#input::placeholder { color: var(--text-faint); }

#send {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent-soft), var(--accent) 60%, #2a6b54);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 3px 14px rgba(67, 161, 132, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
#send:hover:not(:disabled) { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(67, 161, 132, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
#send:active:not(:disabled) { transform: scale(0.93); }
#send:disabled { filter: grayscale(0.7) brightness(0.75); box-shadow: none; cursor: default; }

#stop {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-3); color: var(--text-dim);
  display: grid; place-items: center; flex-shrink: 0; cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease;
}
#stop:hover:not(:disabled) { background: #3a3a46; color: var(--text); }
#stop:active:not(:disabled) { transform: scale(0.93); }

#greet {
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; color: var(--text-faint);
  display: grid; place-items: center; flex-shrink: 0; cursor: pointer;
  border: 1px dashed var(--border-strong); font-size: 15px;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.1s ease;
}
#greet:hover:not(:disabled) { color: var(--accent-soft); border-color: var(--accent-soft); }
#greet:active:not(:disabled) { transform: scale(0.93); }

.composer-hint {
  max-width: 660px;
  margin: 7px auto 0;
  font-size: 10.5px;
  color: var(--text-faint);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
kbd {
  font-family: var(--mono);
  font-size: 9.5px;
  padding: 1px 4px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface-2);
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 4, 7, 0.78);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 24px;
}
.modal-backdrop.hidden { display: none; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  animation: rise 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.modal-body { padding: 20px; overflow-y: auto; }

.modal-foot {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* form */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.field-hint {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 5px;
  line-height: 1.45;
}

.input, .textarea, .select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  outline: none;
  font-size: 13px;
  transition: border-color 0.13s, background 0.13s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  background: var(--surface-3);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 78px; line-height: 1.6; }
.textarea.tall { min-height: 190px; font-family: var(--mono); font-size: 11.5px; }
.input.mono { font-family: var(--mono); font-size: 11.5px; }
.select { appearance: none; cursor: pointer; }
.select-wrap { position: relative; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 12px; top: 50%;
  width: 5px; height: 5px;
  border-right: 1.5px solid var(--text-dim);
  border-bottom: 1.5px solid var(--text-dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.btn {
  padding: 8px 15px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.1s ease, border-color 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease;
  border: 1px solid transparent;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary {
  background: linear-gradient(140deg, var(--accent-soft), var(--accent) 60%, #2a6b54);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 3px 14px rgba(67, 161, 132, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 6px 22px rgba(67, 161, 132, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); border-color: var(--accent); }
.btn-danger { background: rgba(207, 95, 95, 0.14); color: var(--err); }
.btn-danger:hover:not(:disabled) { background: rgba(207, 95, 95, 0.24); }
.btn-sm { padding: 5px 10px; font-size: 11.5px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.mood-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}
.mood-card {
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.13s, background 0.13s;
}
.mood-card:hover { background: var(--surface-3); border-color: var(--border-strong); }
.mood-card.active { border-color: var(--accent); background: var(--accent-dim); }
.mood-card-label { font-size: 12.5px; font-weight: 600; }
.mood-card.active .mood-card-label { color: var(--accent-soft); }
.mood-card-hint { font-size: 10.5px; color: var(--text-faint); line-height: 1.4; margin-top: 2px; }

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 9px;
  margin-bottom: 18px;
}
.tab {
  flex: 1;
  padding: 7px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-dim);
  transition: background 0.13s, color 0.13s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-3); color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.alert {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  margin-bottom: 14px;
  border: 1px solid;
  line-height: 1.5;
}
.alert-err { background: rgba(207, 95, 95, 0.1); border-color: rgba(207, 95, 95, 0.3); color: #e89191; }
.alert-ok { background: rgba(90, 168, 127, 0.1); border-color: rgba(90, 168, 127, 0.3); color: #85c9a3; }
.alert-info { background: var(--accent-dim); border-color: rgba(67, 161, 132, 0.3); color: var(--accent-soft); }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.row-between > .input { flex: 1; min-width: 0; }

.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color 0.13s, background 0.13s;
}
.toggle-row:hover { border-color: rgba(67, 161, 132, 0.45); }
.toggle-row input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  width: 34px;
  height: 19px;
  min-width: 34px;
  margin: 1px 0 0;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.toggle-row input[type='checkbox']::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: transform 0.15s, background 0.15s;
}
.toggle-row input[type='checkbox']:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-row input[type='checkbox']:checked::after {
  transform: translateX(15px);
  background: #fff;
}
.toggle-row .field-hint { margin-top: 3px; }

.fact-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}
.fact-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.5;
}
.fact-text { color: var(--text); }
.fact-row .conv-del { opacity: 0.5; margin-top: 1px; }
.fact-row:hover .conv-del { opacity: 1; }
.fact-empty {
  padding: 14px 12px;
  font-size: 12px;
  color: var(--text-faint);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}

.char-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.char-preview-avatar {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), #2a6b54);
  display: grid; place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}
.char-preview-name { font-weight: 600; font-size: 13px; }
.char-preview-sub { font-size: 11px; color: var(--text-faint); }

@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }
  #app { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }
  #sidebar.open { transform: none; box-shadow: var(--shadow); }
  .msg-wrap { padding: 0 14px; }
  #composer { padding: 11px 14px 13px; }
  .form-row { grid-template-columns: 1fr; }
}
/* --------- admin panel --------- */
.admin-shell { min-height: 100vh; display: flex; align-items: stretch; background: var(--bg); }
.admin-side {
  width: 264px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px 18px;
  background:
    radial-gradient(420px 300px at 20% -60px, rgba(67, 161, 132, 0.14), transparent 65%),
    var(--surface);
  border-right: 1px solid var(--border);
}
.admin-brand { display: flex; align-items: center; gap: 12px; padding: 2px 10px 18px; }
.admin-head-right { display: flex; align-items: center; gap: 8px; }
.admin-user { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-body { flex: 1; min-width: 0; }
.admin-main { width: 100%; max-width: 980px; margin: 0 auto; padding: 26px 22px 80px; flex: 1; }

/* sidebar nav (reuses .tabs/.tab hooks) */
.admin-nav.tabs {
  display: flex; flex-direction: column; gap: 2px;
  background: transparent; border-radius: 0; padding: 0; margin: 0; flex: 1;
  overflow-y: auto;
}
.nav-section {
  font-size: 10.5px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-faint); padding: 14px 12px 6px;
}
.nav-section:first-child { padding-top: 0; }
.admin-nav .tab {
  flex: none; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 550; color: var(--text-dim);
  background: transparent; cursor: pointer; text-decoration: none; text-align: left;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.admin-nav .tab svg { flex-shrink: 0; opacity: 0.75; }
.admin-nav .tab:hover { color: var(--text); background: var(--surface-2); }
.admin-nav .tab:hover svg { opacity: 1; }
.admin-nav .tab.active { background: var(--surface-3); color: var(--text); border-color: var(--border); }
.admin-nav .tab.active::before {
  content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.admin-nav .tab:focus-visible, .quick-link:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
a.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.admin-side-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 10px 0; border-top: 1px solid var(--border); margin-top: 8px;
}

@media (max-width: 900px) {
  .admin-shell { flex-direction: column; }
  .admin-side {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 5;
    padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  }
  .admin-brand { padding: 0 2px 10px; }
  .admin-nav.tabs { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
  .admin-nav .tab { white-space: nowrap; }
  .admin-nav .tab.active::before { display: none; }
  .nav-section { display: none; }
  .admin-side-foot { border-top: 0; padding: 10px 2px 0; }
}

@media (prefers-reduced-motion: reduce) {
  .admin-nav .tab, .quick-link, .pick-card, .btn, .btn-new, #send, #stop, .icon-btn { transition: none; }
  .pick-card:hover, .quick-link:hover, .btn-new:hover, #send:hover:not(:disabled), .btn-primary:hover:not(:disabled) { transform: none; }
  .show-col { animation: none; }
}
.admin-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px; margin-bottom: 16px;
}
.admin-section-title {
  font-family: var(--font-display); font-size: 14px; font-weight: 650;
  letter-spacing: -0.01em; margin-bottom: 14px;
}
.admin-section .field:last-child { margin-bottom: 0; }

/* character cards */
.char-head { display: flex; align-items: center; gap: 14px; }
.char-meta { flex: 1; min-width: 0; }
.char-meta .admin-section-title { margin-bottom: 3px; }
.admin-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.char-avatar {
  width: 44px; height: 44px; border-radius: 12px; overflow: hidden;
  background: var(--surface-3); color: var(--text-dim);
  display: grid; place-items: center; font-weight: 650; flex-shrink: 0;
}
.char-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-char .hidden { margin-top: 16px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-faint); font-weight: 600; padding: 8px 10px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.cell-actions { text-align: right; white-space: nowrap; }
.cell-actions .btn { margin-left: 5px; }
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 10.5px;
  background: var(--surface-3); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em;
}
.badge-admin { background: rgba(67, 161, 132, 0.18); color: var(--accent-soft, var(--accent)); }

/* stats + chart */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px;
}
.stat-value {
  font-family: var(--font-display); font-size: 26px; font-weight: 650; letter-spacing: -0.03em;
}
.stat-label { font-size: 11px; color: var(--text-faint); margin-top: 3px; }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; }
.chart-col {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  height: 100%; gap: 6px; min-width: 0;
}
.chart-bar {
  width: 100%; border-radius: 5px 5px 2px 2px; min-height: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(67, 161, 132, 0.35));
}
.chart-col span { font-size: 9.5px; color: var(--text-faint); }

/* --------- admin dashboard --------- */
.mono { font-family: var(--mono); font-size: 11.5px; }
.dash-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.dash-sub { font-size: 11.5px; color: var(--text-faint); }
.dash-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-actions a.btn { text-decoration: none; line-height: 1; }
.dash-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}
.dash-section-head .admin-section-title { margin-bottom: 0; }
.dash-2col {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 16px;
}
.dash-2col > .admin-section { margin-bottom: 0; }
.dash-2col { margin-bottom: 16px; }

.chart-legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-faint); }
.chart-legend .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  margin-right: 5px; vertical-align: -1px;
}
.dot-user { background: var(--accent); }
.dot-bot { background: rgba(120, 140, 200, 0.75); }

.chart-stack {
  width: 100%; height: 132px;
  display: flex; flex-direction: column; justify-content: flex-end;
  border-radius: 5px; overflow: hidden;
}
.chart-mini .chart-stack { height: 74px; }
.seg { width: 100%; min-height: 0; }
.seg-user { background: linear-gradient(180deg, var(--accent), rgba(67, 161, 132, 0.55)); }
.seg-bot { background: linear-gradient(180deg, rgba(120, 140, 200, 0.85), rgba(120, 140, 200, 0.4)); }
.seg-alt { background: linear-gradient(180deg, rgba(90, 168, 127, 0.85), rgba(90, 168, 127, 0.35)); }
.chart-mini { margin-top: 8px; }

.charstat { margin-bottom: 14px; }
.charstat:last-child { margin-bottom: 0; }
.charstat-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 6px;
}
.charstat-name { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.charstat-name img {
  width: 22px; height: 22px; border-radius: 6px; object-fit: cover;
}
.charstat-nums { font-size: 11.5px; color: var(--text-faint); }
.charstat-bar { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.charstat-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #2a6b54);
}

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.feed-item {
  display: flex; align-items: baseline; gap: 9px; min-width: 0;
  font-size: 12px; line-height: 1.45;
}
.feed-time { color: var(--text-faint); font-family: var(--mono); font-size: 10.5px; flex-shrink: 0; }
.feed-badge {
  flex-shrink: 0; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 5px; font-weight: 650;
}
.from-user { background: rgba(67, 161, 132, 0.18); color: var(--accent-soft, var(--accent)); }
.from-bot { background: rgba(120, 140, 200, 0.18); color: #9aa8d6; }
.feed-text { color: var(--text-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.feed-text b { color: var(--text); font-weight: 600; }

.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 12.5px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; color: var(--text-dim); min-width: 0; overflow-wrap: anywhere; }
.badge-ok { background: rgba(90, 168, 127, 0.16); color: #85c9a3; }
.badge-err { background: rgba(207, 95, 95, 0.16); color: #e89191; }

.auth-switch a { color: var(--accent-soft, var(--accent)); font-size: 12px; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* character avatar upload */
.avatar-edit { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.avatar-big { width: 84px; height: 84px; border-radius: 16px; font-size: 30px; }
.avatar-edit-actions { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.avatar-edit-actions .input[type=file] { padding: 7px 10px; font-size: 12px; }
.avatar-edit-actions .btn { align-self: flex-start; }

/* --------- character picker page --------- */
.pick-page {
  position: fixed; inset: 0; z-index: 60;
  background:
    radial-gradient(1200px 620px at 18% -12%, rgba(67, 161, 132, 0.18), transparent 62%),
    radial-gradient(900px 500px at 110% 110%, rgba(120, 140, 200, 0.12), transparent 60%),
    var(--bg);
  overflow-y: auto;
  display: grid; place-items: center;
  padding: 46px 24px;
}
.pick-page.hidden { display: none; }
.pick-inner { width: min(980px, 100%); }
.pick-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 30px; }
.pick-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #2a6b54); color: #fff; font-size: 19px;
  box-shadow: 0 6px 20px rgba(67, 161, 132, 0.35); flex-shrink: 0;
}
.pick-title { font-family: var(--font-display); font-size: 27px; font-weight: 650; letter-spacing: -0.03em; }
.pick-sub { font-size: 13px; color: var(--text-faint); margin-top: 4px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.pick-card {
  text-align: left; padding: 22px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; gap: 11px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.pick-card:hover, .pick-card:focus-visible {
  transform: translateY(-3px); border-color: var(--accent); background: var(--surface-2); outline: none;
}
.pick-card-avatar {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  background: var(--surface-3); display: grid; place-items: center;
  font-family: var(--font-display); font-size: 34px; color: var(--text-faint);
  border: 2px solid var(--border);
}
.pick-card:hover .pick-card-avatar { border-color: var(--accent); }
.pick-card-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-card-name { font-family: var(--font-display); font-size: 19px; font-weight: 650; letter-spacing: -0.02em; }
.pick-card-bio {
  font-size: 12.5px; line-height: 1.65; color: var(--text-dim);
  min-height: 62px;
}
.pick-card-cta { margin-top: auto; font-size: 12.5px; font-weight: 600; color: var(--accent-soft, var(--accent)); }
.pick-card-cta::after { content: " \2192"; }

/* full-bleed photo cards (dedicated /pick page) */
.pick-card.photo-full { padding: 0 0 20px; overflow: hidden; gap: 0; }
.pick-card-photo { position: relative; margin-bottom: 14px; background: var(--surface-3); }
.pick-card-photo img { display: block; width: 100%; aspect-ratio: 3 / 3.4; object-fit: cover; }
.pick-photo-letter {
  display: grid; place-items: center; width: 100%; aspect-ratio: 3 / 3.4;
  font-family: var(--font-display); font-size: 64px; color: var(--text-faint);
}
.pick-card.photo-full:hover .pick-card-photo img { transform: scale(1.03); }
.pick-card-photo img { transition: transform 0.35s ease; }
.pick-card.photo-full .pick-card-name,
.pick-card.photo-full .pick-card-lang,
.pick-card.photo-full .tag-row,
.pick-card.photo-full .pick-card-bio,
.pick-card.photo-full .pick-card-cta { padding-left: 18px; padding-right: 18px; }
.pick-card.photo-full .pick-card-lang { margin-top: 2px; }
.pick-card.photo-full .tag-row { margin-top: 9px; }
.pick-card.photo-full .pick-card-bio { margin-top: 9px; min-height: 0; }
.pick-card.photo-full .pick-card-cta { margin-top: 12px; }
body.is-picking { overflow: hidden; }

/* --------- dedicated picker page: topbar, search, filters --------- */
.pick-inner.page { width: min(1120px, 100%); }
.pick-topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.pick-back { font-size: 13px; font-weight: 600; color: var(--text-dim); text-decoration: none; white-space: nowrap; }
.pick-back:hover { color: var(--accent-soft, var(--accent)); }
.pick-search-wrap {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 0 14px; color: var(--text-faint);
}
.pick-search-wrap:focus-within { border-color: var(--accent); }
.pick-search-wrap.overlay { margin-bottom: 24px; }
.pick-search {
  flex: 1; background: transparent; border: 0; outline: 0; color: var(--text);
  font-size: 14px; padding: 12px 0; font-family: inherit;
}
.pick-search::placeholder { color: var(--text-faint); }
.pick-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.pick-filters .chip {
  font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; transition: border-color 0.15s ease, color 0.15s ease;
}
.pick-filters .chip:hover { border-color: var(--accent); color: var(--text); }
.pick-filters .chip.active { border-color: var(--accent); color: var(--accent-soft, var(--accent)); background: rgba(67, 161, 132, 0.12); }
.pick-card-lang { font-size: 11.5px; color: var(--text-faint); letter-spacing: 0.03em; }
.pick-age { font-size: 12px; font-weight: 600; color: var(--text-faint); }
.pick-empty { text-align: center; padding: 60px 20px; color: var(--text-faint); font-size: 14px; }
.pick-empty.hidden { display: none; }
.browse-all {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-faint);
  text-decoration: none; padding: 8px 4px 2px;
}
.browse-all:hover { color: var(--accent-soft, var(--accent)); }

/* --------- admin dashboard quick nav --------- */
.quick-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 22px; }
.quick-link {
  display: flex; align-items: center; gap: 12px; text-align: left;
  padding: 13px 15px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.quick-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.quick-ico {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
  background: rgba(67, 161, 132, 0.14); color: var(--accent-soft, #a9dcc2); font-size: 15px;
}
.quick-link b { display: block; font-size: 13px; font-weight: 650; }
.quick-link i { display: block; font-style: normal; font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* --------- personality tags --------- */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 10.5px; letter-spacing: 0.04em; text-transform: lowercase;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(67, 161, 132, 0.14); color: var(--accent-soft, #a9dcc2);
  border: 1px solid rgba(67, 161, 132, 0.26);
}

/* --------- right profile rail --------- */
#profile-rail {
  border-left: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  padding: 26px 22px 40px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.rail-avatar {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden;
  background: var(--surface-3); display: grid; place-items: center;
  font-family: var(--font-display); font-size: 64px; color: var(--text-faint);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}
.rail-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rail-name { font-family: var(--font-display); font-size: 24px; font-weight: 650; letter-spacing: -0.025em; }
.rail-bio { font-size: 13px; line-height: 1.7; color: var(--text-dim); }
.rail-fade { font-size: 11px; color: var(--text-faint); margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); }
.rail-fade.hidden { display: none; }

@media (min-width: 761px) {
  #app { grid-template-columns: var(--sidebar-w) 1fr var(--rail-w); }
}
@media (max-width: 1180px) {
  #profile-rail { display: none; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  #app { grid-template-columns: var(--sidebar-w) 1fr; }
}
