/* Pherson — v0.2
   warm, intimate, late-night.
   ink + cream + amber. fraunces for him, inter for the interface.
   layout: narrow sidebar + spacious main.
*/

:root {
  /* c.ai-style neutral palette */
  --ink: #1c1c1e;
  --ink-soft: #3f3f46;
  --ink-mute: #71717a;

  --cream: #f4f4f5;
  --cream-warm: #e4e4e7;
  --paper: #ffffff;
  --paper-warm: #fafafa;

  /* c.ai uses near-black for primary actions, soft lilac accent */
  --amber: #6b6b70;
  --amber-soft: #a1a1aa;
  --amber-deep: #3f3f46;
  --amber-bg: rgba(0, 0, 0, 0.03);
  --amber-bg-strong: rgba(0, 0, 0, 0.06);

  /* near-black for strong text / primary buttons */
  --brown-deep: #18181b;

  --beaver: #a1a1aa;

  --line: rgba(0, 0, 0, 0.07);
  --line-strong: rgba(0, 0, 0, 0.12);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;

  --sidebar-w: 260px;
  --workspace-w: 60%;

  /* page background — c.ai light gray */
  --app-bg: #f4f4f5;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--app-bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
}

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  height: 100dvh;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sidebar-top { padding: 0 6px 24px; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-left: 4px;
}

.dot {
  display: none;
}

.brand-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}

.nav-item svg { flex-shrink: 0; opacity: 0.8; }

.nav-item:hover {
  background: rgba(26, 24, 20, 0.04);
  color: var(--ink);
}

.nav-item.active {
  background: rgba(26, 24, 20, 0.06);
  color: var(--ink);
}

.nav-item.subtle {
  color: var(--ink-mute);
  font-weight: 400;
  font-size: 13.5px;
}

.sidebar-bottom {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ---------- main ---------- */
.main {
  flex: 1;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.view {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}

.view.active { display: flex; }

/* ---------- chat view ---------- */
.chat-view {
  position: relative;
  flex-direction: column; /* override .view default */
}

/* The chat-split is the row container; it fills the chat-view */
.chat-split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

/* chat-main-area is a column flex container that holds greeting / scroll / composer */
.chat-main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
  transition: flex 0.4s cubic-bezier(0.22, 1, 0.36, 1), max-width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-split.split-active .chat-main-area {
  flex: 0 0 40%;
  max-width: 40%;
  border-right: 1px solid var(--line-strong);
}

.chat-greeting {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -65%);
  text-align: center;
  width: 90%;
  max-width: 560px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.chat-greeting.hidden { opacity: 0; pointer-events: none; }

.chat-greeting h1 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  font-size: 44px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
}

.greet-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: italic;
  font-size: 19px;
  color: var(--ink-mute);
  margin-top: 10px;
}

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 40px 32px 20px;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 3px;
}

/* ---------- messages ---------- */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: msgIn 0.28s ease-out;
}

.msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg.pherson {
  align-self: flex-start;
  align-items: flex-start;
}

.msg .bubble {
  padding: 12px 17px;
  border-radius: 20px;
  font-size: 15.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.user .bubble {
  background: var(--brown-deep);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg.pherson .bubble {
  background: #ececec;
  color: #1c1c1e;
  border-bottom-left-radius: 6px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 400;
  line-height: 1.6;
}

.typing {
  align-self: flex-start;
  background: #ececec;
  padding: 14px 18px;
  border-radius: 20px;
  border-bottom-left-radius: 6px;
  display: flex;
  gap: 5px;
  animation: msgIn 0.28s ease-out;
}

.typing span {
  width: 6px; height: 6px;
  background: var(--ink-soft);
  border-radius: 50%;
  opacity: 0.4;
  animation: bounce 1.4s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 0.9; }
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- composer card ---------- */
.composer-wrap {
  padding: 12px 32px 28px;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
}

.composer {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 14px 16px 10px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.15s, box-shadow 0.2s;
}

.composer:focus-within {
  border-color: var(--amber-soft);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(212, 130, 58, 0.08);
}

#input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  resize: none;
  max-height: 180px;
  padding: 4px 4px 8px;
}

#input::placeholder { color: var(--ink-mute); opacity: 0.7; }

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.composer-hint {
  font-size: 11.5px;
  color: var(--ink-mute);
  opacity: 0.65;
  letter-spacing: 0.01em;
}

#send {
  background: var(--ink);
  color: var(--cream);
  border: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  flex-shrink: 0;
}

#send:hover { background: var(--amber); }
#send:active { transform: scale(0.92); }
#send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- memory view ---------- */
#view-memory {
  overflow-y: auto;
  padding: 40px 32px 60px;
}

.memory-inner {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.view-header { margin-bottom: 28px; }

.view-header h2 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 34px;
  letter-spacing: -0.015em;
  margin-bottom: 8px;
}

.view-header p {
  color: var(--ink-mute);
  font-size: 15px;
  max-width: 520px;
}

.import-box {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 36px;
}

.import-box h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 20px;
  margin-bottom: 4px;
}

.import-box p {
  color: var(--ink-mute);
  font-size: 14px;
  margin-bottom: 14px;
}

#importText {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  min-height: 110px;
}

#importText:focus { border-color: var(--amber-soft); }

.import-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
}

.import-status, .save-status {
  font-size: 13px;
  color: var(--ink-mute);
  font-style: italic;
}

.import-status.ok, .save-status.ok { color: #4a7c3a; }
.import-status.err, .save-status.err { color: #b5462a; }

.btn-primary {
  background: var(--ink);
  color: var(--cream);
  border: none;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover { background: var(--amber); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.memory-fields {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: var(--ink);
}

.field .hint {
  font-size: 12.5px;
  color: var(--ink-mute);
  font-style: italic;
  margin-bottom: 4px;
}

.field textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink);
  resize: vertical;
  outline: none;
  min-height: 64px;
  transition: border-color 0.15s, background 0.15s;
}

.field textarea:focus {
  border-color: var(--amber-soft);
  background: #fff;
}

.memory-save {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

/* ---------- mobile ---------- */
.mobile-menu {
  display: none;
  position: fixed;
  top: 14px; left: 14px;
  z-index: 100;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 38px; height: 38px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  backdrop-filter: blur(8px);
}

@media (max-width: 768px) {
  .mobile-menu { display: flex; }

  .sidebar {
    position: fixed;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open { transform: translateX(0); }

  .chat-scroll { padding: 70px 18px 12px; }
  .composer-wrap { padding: 10px 18px 20px; }
  .chat-greeting h1 { font-size: 30px; }
  .greet-sub { font-size: 16px; }

  #view-memory { padding: 70px 18px 50px; }
  .view-header h2 { font-size: 26px; }

  .msg { max-width: 88%; }
}

/* ---------- customize view ---------- */
#view-customize {
  overflow-y: auto;
  padding: 40px 32px 60px;
}

.customize-inner {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.dial-group {
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin-bottom: 36px;
}

.dial {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.dial-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dial-head label {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 19px;
  color: var(--ink);
}

.dial-value {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px;
  color: var(--amber);
  font-feature-settings: "tnum";
  font-weight: 500;
}

.dial input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--line-strong);
  border-radius: 2px;
  outline: none;
  margin: 6px 0 14px;
}

.dial input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  background: var(--amber);
  border: 3px solid var(--paper);
  box-shadow: 0 2px 6px rgba(212, 130, 58, 0.35);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.dial input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }

.dial input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--amber);
  border: 3px solid var(--paper);
  box-shadow: 0 2px 6px rgba(212, 130, 58, 0.35);
  border-radius: 50%;
  cursor: pointer;
}

.dial-desc {
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.55;
}

.dial-desc span {
  display: block;
  opacity: 0.4;
  transition: opacity 0.2s;
}

.dial-desc span.active {
  opacity: 1;
  color: var(--ink);
  font-style: italic;
}

.customize-save {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.calibration-card {
  background: var(--amber-bg);
  border: 1px solid rgba(212, 130, 58, 0.2);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-top: 36px;
}

.calibration-card h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 17px;
  margin-bottom: 8px;
  color: var(--ink);
}

.calibration-card p {
  font-family: 'Inter', system-ui, sans-serif;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin-bottom: 12px;
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: rgba(26, 24, 20, 0.04); }

.danger-zone {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.danger-zone h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 17px;
  margin-bottom: 4px;
}

.danger-zone p {
  font-size: 13.5px;
  color: var(--ink-mute);
  margin-bottom: 12px;
}

.btn-danger {
  background: transparent;
  color: #b5462a;
  border: 1px solid rgba(181, 70, 42, 0.3);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover { background: rgba(181, 70, 42, 0.08); }

@media (max-width: 768px) {
  #view-customize { padding: 70px 18px 50px; }
}

/* ---------- v2.1: chat list in sidebar ---------- */
.new-chat-btn {
  margin-top: 18px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.new-chat-btn:hover { background: var(--amber); }
.new-chat-btn:active { transform: scale(0.97); }

.chat-list-wrap {
  flex: 1;
  overflow-y: auto;
  margin: 16px -8px 12px;
  padding: 0 8px;
  min-height: 60px;
}
.chat-list-wrap::-webkit-scrollbar { width: 4px; }
.chat-list-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }

.chat-list-label {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 8px 6px;
  font-weight: 500;
}

.chat-list { display: flex; flex-direction: column; gap: 1px; }

.chat-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.chat-list-item:hover { background: rgba(26, 24, 20, 0.04); }
.chat-list-item.active { background: rgba(26, 24, 20, 0.07); }

.chat-list-item .title-line {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.chat-list-item .chat-title-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Inter', system-ui, sans-serif;
}
.chat-list-item .chat-preview {
  font-size: 11.5px;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-item .chat-delete {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--ink-mute);
  width: 22px; height: 22px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.chat-list-item:hover .chat-delete { opacity: 0.7; }
.chat-list-item .chat-delete:hover { color: #b5462a; background: rgba(181, 70, 42, 0.08); opacity: 1; }

.nav-bottom {
  flex: none;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ---------- v2.1: chat header (current title) ---------- */
.chat-header {
  padding: 16px 32px 8px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.chat-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink-soft);
  font-weight: 500;
}

/* ---------- v2.1: message actions (thumbs, regen) ---------- */
.msg.pherson { position: relative; }
.msg-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.msg.pherson:hover .msg-actions,
.msg-actions.has-feedback { opacity: 1; }

@media (hover: none) {
  .msg-actions { opacity: 0.5; }
  .msg.pherson:hover .msg-actions { opacity: 1; }
}

.msg-action {
  background: transparent;
  border: 1px solid transparent;
  width: 26px; height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-mute);
  transition: all 0.12s;
  padding: 0;
}
.msg-action:hover { background: rgba(26, 24, 20, 0.05); color: var(--ink); }
.msg-action.active {
  color: var(--amber);
  background: var(--amber-bg);
}
.msg-action.active.thumb-down { color: #b5462a; background: rgba(181, 70, 42, 0.08); }

/* ---------- v2.1: italic markdown for *actions* in Pherson messages ---------- */
.msg.pherson .bubble em.action {
  font-style: italic;
  color: var(--ink-soft);
  opacity: 0.85;
}

/* ---------- mobile ---------- */
@media (max-width: 768px) {
  .chat-list-wrap { max-height: 200px; }
  .chat-header { padding: 16px 18px 8px; }
  .msg-actions { opacity: 0.6; }
}

/* ---------- v2.2: settings sections ---------- */
.settings-section {
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.settings-section:last-of-type { border-bottom: none; }

.settings-section h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 20px;
  margin-bottom: 14px;
}

.text-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.text-input:focus { border-color: var(--amber-soft); background: #fff; }
.text-input.small { max-width: 120px; }

select.text-input { cursor: pointer; }

.row-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 14px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14.5px;
}
.toggle-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--amber); }

/* ---------- v2.2: reminders ---------- */
.reminder-form-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.reminder-form-row input[type="datetime-local"],
.reminder-form-row input[type="text"] {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}
.reminder-form-row input:focus { border-color: var(--amber-soft); }

.reminder-list { display: flex; flex-direction: column; gap: 10px; }
.reminder-item {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.reminder-item.due { background: var(--amber-bg); border-color: rgba(212, 130, 58, 0.25); }
.reminder-item.completed { opacity: 0.4; text-decoration: line-through; }

.reminder-when {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  color: var(--amber);
  font-weight: 500;
  white-space: nowrap;
}
.reminder-note { flex: 1; font-size: 14.5px; }
.reminder-actions { display: flex; gap: 4px; }
.reminder-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-mute);
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.reminder-actions button:hover { background: rgba(26, 24, 20, 0.05); color: var(--ink); }

/* ---------- v2.2: version arrows on assistant messages ---------- */
.version-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-left: 6px;
}
.version-nav button {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: background 0.12s, color 0.12s;
}
.version-nav button:hover:not(:disabled) { background: rgba(26, 24, 20, 0.05); color: var(--ink); }
.version-nav button:disabled { opacity: 0.3; cursor: not-allowed; }
.version-indicator { font-variant-numeric: tabular-nums; min-width: 28px; text-align: center; }

/* ---------- v2.2: away note styling ---------- */
.msg.pherson.away-note .bubble {
  background: var(--amber-bg);
  border: 1px solid rgba(212, 130, 58, 0.15);
}
.away-note-tag {
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 4px 12px 0;
  font-weight: 500;
}

/* ---------- mobile tweaks ---------- */
@media (max-width: 768px) {
  .reminder-form-row { grid-template-columns: 1fr; }
  .row-2 { grid-template-columns: 1fr; }
}

/* ---------- v2.3: evals tab ---------- */
#view-evals { overflow-y: auto; padding: 40px 32px 60px; }

.eval-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.stat-label {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 4px;
}
.stat-value {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 24px;
  color: var(--ink);
  font-weight: 500;
}
.stat-value.amber { color: var(--amber); }
.stat-sub { font-size: 12px; color: var(--ink-mute); margin-top: 4px; }

.charge-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 12.5px;
}
.charge-bar .name {
  text-transform: capitalize;
  min-width: 90px;
  color: var(--ink-soft);
}
.charge-bar .bar {
  flex: 1;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.charge-bar .fill {
  height: 100%;
  background: var(--amber);
  border-radius: 3px;
}
.charge-bar .score { font-variant-numeric: tabular-nums; min-width: 50px; text-align: right; color: var(--ink-mute); }

.failure-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.failure-tag {
  background: rgba(181, 70, 42, 0.08);
  color: #b5462a;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 500;
}
.failure-tag .count { opacity: 0.6; margin-left: 4px; }

.eval-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin: 12px 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-sm);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.check-row input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--amber); cursor: pointer; }

.eval-list { display: flex; flex-direction: column; gap: 14px; }
.eval-item {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.eval-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}
.eval-score-badge {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 18px;
  padding: 3px 12px;
  border-radius: 12px;
  background: var(--amber-bg);
  color: var(--amber);
}
.eval-score-badge.low { background: rgba(181, 70, 42, 0.08); color: #b5462a; }
.eval-score-badge.high { background: rgba(74, 124, 58, 0.1); color: #4a7c3a; }
.eval-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
}
.eval-tag {
  background: rgba(26, 24, 20, 0.06);
  padding: 2px 8px;
  border-radius: 8px;
  color: var(--ink-soft);
}
.eval-snippet {
  font-size: 13px;
  color: var(--ink-soft);
  border-left: 2px solid var(--line-strong);
  padding-left: 10px;
  margin: 8px 0;
  font-style: italic;
}
.eval-delete {
  background: transparent;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
}
.eval-delete:hover { color: #b5462a; background: rgba(181, 70, 42, 0.08); }

/* ---------- v2.4: copy button + downloads ---------- */
.msg-actions.user-actions {
  justify-content: flex-end;
  margin-top: 4px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.msg.user:hover .user-actions,
.msg.user .user-actions:focus-within { opacity: 1; }

.msg-action.copy-btn.copied {
  color: #4a7c3a;
  background: rgba(74, 124, 58, 0.08);
}

.eval-download {
  background: transparent;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
}
.eval-download:hover { color: var(--amber); background: var(--amber-bg); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
}
.btn-ghost:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-bg);
}

/* ---------- v2.5: Sessions ---------- */
#view-sessions {
  overflow-y: auto;
  padding: 0;
  position: relative;
}
.sessions-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 32px 60px;
}
.sessions-actions {
  margin: 18px 0 28px;
}
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.session-card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.session-card:hover {
  border-color: var(--amber-soft);
  background: rgba(255, 255, 255, 0.75);
}
.session-card-main { flex: 1; min-width: 0; }
.session-card-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 3px;
}
.session-card-meta {
  font-size: 12.5px;
  color: var(--ink-mute);
  display: flex;
  gap: 10px;
  align-items: center;
}
.session-card-type {
  background: var(--amber-bg);
  color: var(--amber);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.session-card-summary {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 7px;
  font-style: italic;
  line-height: 1.5;
}
.session-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.session-card-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-mute);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.session-card-actions button:hover { color: var(--amber); background: var(--amber-bg); }
.session-card.closed { opacity: 0.85; }

/* Active session takeover */
.active-session {
  position: absolute;
  inset: 0;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}
.active-session-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
}
.active-session-back {
  background: transparent;
  border: none;
  color: var(--ink-mute);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}
.active-session-back:hover { color: var(--amber); background: var(--amber-bg); }
.active-session-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.active-session-name-input {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 19px;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 2px 4px;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.active-session-note-input {
  border: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink-mute);
  padding: 2px 4px;
  font-family: inherit;
}
.active-session-name-input:focus, .active-session-note-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
}

.active-session-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 0;
}

/* Playground */
.playground {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
}
.playground-pane {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.playground-pane-flex { flex: 1; min-height: 0; }
.playground-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.playground-field {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6);
  padding: 12px 14px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
  min-height: 80px;
}
.playground-field:focus {
  outline: none;
  border-color: var(--amber-soft);
  background: #fff;
}
.playground-field-tall { min-height: 180px; flex: 1; }
.playground-grade-btn { margin-top: 10px; align-self: flex-start; }
.playground-grades {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.playground-grade-item {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.playground-grade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--ink-mute);
}
.playground-grade-stars {
  display: flex;
  gap: 2px;
}
.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--ink-mute);
  padding: 0 2px;
}
.star-btn.active { color: var(--amber); }
.playground-grade-text { font-size: 13.5px; line-height: 1.55; color: var(--ink); }

/* Session chat panel */
.session-chat {
  display: flex;
  flex-direction: column;
  background: var(--cream);
  min-height: 0;
}
.session-chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.session-msg {
  max-width: 90%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
}
.session-msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  font-size: 13.5px;
}
.session-msg.pherson {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  border: 1px solid var(--line);
}
.session-msg.pherson em { font-style: italic; color: var(--ink-mute); }
.session-chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}
#sessionChatInput {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13.5px;
  resize: none;
}
#sessionChatInput:focus { outline: none; border-color: var(--amber-soft); }
#sessionChatSend {
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: flex-end;
}
#sessionChatSend:hover { background: var(--amber); }

/* Session suggestion button in regular chat */
.suggestion-card {
  margin-top: 10px;
  background: var(--amber-bg);
  border: 1px solid var(--amber-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}
.suggestion-card .label {
  color: var(--ink-soft);
}
.suggestion-card button {
  background: var(--amber);
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
}
.suggestion-card button:hover { background: var(--ink); }

/* Smaller refinements */
.empty-state h1 { letter-spacing: -0.025em; }

/* Memory transparency hint in sessions */
.session-card-pherson-memory {
  font-size: 11.5px;
  color: var(--ink-mute);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---------- v2.6: chat-attached workspace ---------- */

/* chat-split layout rules live up in the chat-view section. */
.workspace-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  min-width: 0;
  overflow: hidden;
  animation: workspaceBloomIn 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  transform-origin: right center;
}
.workspace-panel[hidden] { display: none !important; }
@keyframes workspaceBloomIn {
  0% {
    transform: translateX(60px) scale(0.96);
    opacity: 0;
    filter: blur(3px);
  }
  60% {
    opacity: 0.85;
    filter: blur(0);
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
    filter: blur(0);
  }
}
.workspace-panel > * {
  animation: workspaceContentFadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
.workspace-panel > *:nth-child(1) { animation-delay: 0.10s; }
.workspace-panel > *:nth-child(2) { animation-delay: 0.18s; }
.workspace-panel > *:nth-child(3) { animation-delay: 0.24s; }
@keyframes workspaceContentFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.workspace-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.4);
}
.workspace-title {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.workspace-name-input {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  border: none;
  background: transparent;
  color: var(--ink);
  padding: 2px 4px;
  font-weight: 500;
  letter-spacing: -0.01em;
  width: 100%;
}
.workspace-note-input {
  border: none;
  background: transparent;
  font-size: 12.5px;
  color: var(--ink-mute);
  padding: 2px 4px;
  font-family: inherit;
  width: 100%;
}
.workspace-name-input:focus, .workspace-note-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
}
.workspace-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.workspace-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-mute);
  padding: 6px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
}
.workspace-close-btn:hover { color: var(--amber); background: var(--amber-bg); }

.workspace-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.workspace-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.workspace-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.workspace-section-actions {
  display: flex;
  gap: 6px;
}
.workspace-label {
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.workspace-field {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
  padding: 11px 13px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
  min-height: 70px;
}
.workspace-field:focus {
  outline: none;
  border-color: var(--amber-soft);
  background: #fff;
}

.workspace-rendered {
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 6px;
}
.workspace-rendered p { margin: 0 0 8px; }
.workspace-rendered h3, .workspace-rendered h4 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  margin: 10px 0 4px;
  color: var(--ink);
}
.workspace-rendered ul { margin: 4px 0 8px 18px; }
.workspace-rendered li { margin: 2px 0; }
.workspace-rendered strong { color: var(--brown-deep); }
.workspace-rendered blockquote {
  border-left: 2px solid var(--amber-soft);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--ink-soft);
}

/* Upload buttons */
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 500;
  font-family: inherit;
}
.upload-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-bg);
}
.upload-btn.primary-upload {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-bg);
}
.upload-btn input { display: none; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Pairs */
.pair-empty {
  font-size: 12.5px;
  color: var(--ink-mute);
  text-align: center;
  padding: 16px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong);
}
.pair-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pair-item {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.pair-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.pair-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.pair-actions {
  display: flex;
  gap: 4px;
}
.pair-grade-btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 4px 11px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  font-weight: 500;
}
.pair-grade-btn:hover { background: var(--amber); }
.pair-grade-btn:disabled { opacity: 0.5; cursor: wait; }
.pair-delete-btn {
  background: transparent;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  font-size: 16px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  line-height: 1;
}
.pair-delete-btn:hover { color: #b5462a; background: rgba(181, 70, 42, 0.08); }

.pair-fields { display: flex; flex-direction: column; gap: 4px; }
.pair-field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-mute);
  margin-top: 4px;
}
.pair-field {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  padding: 8px 10px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  resize: vertical;
}
.pair-field:focus { outline: none; border-color: var(--amber-soft); }

/* Grade card on graded pair */
.grade-card {
  margin-top: 10px;
  background: var(--amber-bg);
  border: 1px solid rgba(175, 139, 71, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
}
.grade-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.grade-score {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 500;
  font-size: 16px;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--amber);
  color: #fff;
}
.grade-score.low { background: #b5462a; }
.grade-score.high { background: #4a7c3a; }
.grade-tags { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.grade-tag {
  background: rgba(255, 255, 255, 0.6);
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--ink-soft);
}
.grade-card-actions {
  display: flex;
  gap: 3px;
  margin-left: auto;
}
.grade-card-btn {
  background: transparent;
  border: none;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 11px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.grade-card-btn:hover { color: var(--amber); background: rgba(255, 255, 255, 0.6); }
.grade-reason {
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  font-style: italic;
}

/* Session-closed card in chat */
.session-closed-card {
  margin: 14px 0;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--amber-soft);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  align-self: stretch;
}
.session-closed-icon {
  color: var(--amber);
  flex-shrink: 0;
}
.session-closed-body { flex: 1; min-width: 0; }
.session-closed-title {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14.5px;
  color: var(--ink);
  margin-bottom: 2px;
}
.session-closed-text {
  font-size: 12.5px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.45;
}
.session-closed-link {
  background: transparent;
  border: 1px solid var(--amber);
  color: var(--amber);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
}
.session-closed-link:hover { background: var(--amber); color: #fff; }

/* Sessions tab list — kept */
#view-sessions { overflow-y: auto; padding: 0; }
.sessions-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 32px 60px;
}
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.session-card {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.session-card:hover {
  border-color: var(--amber-soft);
  background: rgba(255, 255, 255, 0.75);
}
.session-card-main { flex: 1; min-width: 0; }
.session-card-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 3px;
}
.session-card-headline {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.session-card-meta {
  font-size: 12px;
  color: var(--ink-mute);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.session-card-type {
  background: var(--amber-bg);
  color: var(--amber);
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.session-card.active .session-card-type {
  background: rgba(74, 124, 58, 0.1);
  color: #4a7c3a;
}
.session-card-summary {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 7px;
  font-style: italic;
  line-height: 1.5;
}
.session-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.session-card-actions button {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink-mute);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: inherit;
}
.session-card-actions button:hover { color: var(--amber); background: var(--amber-bg); }
.session-card.closed { opacity: 0.9; }

/* The old chat header is gone — kill empty header style */
.chat-header { display: none; }

/* ---------- v2.6.2: removed labeled-triple golden items, back to simple textarea ---------- */

/* ---------- v2.6.2: grade discussion thread ---------- */
.grade-revised {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(175, 139, 71, 0.18);
  color: var(--brown-deep);
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 500;
}
.grade-discuss-thread {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grade-discuss-msg {
  font-size: 12.5px;
  line-height: 1.5;
  padding: 5px 9px;
  border-radius: 8px;
}
.grade-discuss-msg.user {
  background: rgba(31, 26, 20, 0.06);
  color: var(--ink);
}
.grade-discuss-msg.assistant {
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink-soft);
}
.grade-discuss-msg strong {
  font-weight: 500;
  color: var(--brown-deep);
  margin-right: 4px;
}
.grade-discuss-bar {
  margin-top: 8px;
}
.grade-discuss-toggle {
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--ink-mute);
  padding: 5px 11px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.grade-discuss-toggle:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-bg);
  border-style: solid;
}
.grade-discuss-input {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.grade-discuss-textarea {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  min-height: 40px;
  outline: none;
}
.grade-discuss-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.grade-discuss-send {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 4px 14px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  font-weight: 500;
}
.grade-discuss-send:hover { background: var(--amber); }
.grade-discuss-send:disabled { opacity: 0.55; cursor: wait; }

/* ---------- v2.7: evals tab schema preview ---------- */
.schema-preview-box {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.schema-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 10px;
}
.schema-preview-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  font-weight: 500;
}
.schema-preview-hint {
  font-size: 11.5px;
  color: var(--beaver);
  font-style: italic;
}
.schema-preview-box .workspace-field {
  font-size: 12.5px;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
}
.schema-preview-box .workspace-rendered:not([hidden]) {
  margin-top: 8px;
}

/* ---------- v2.7: offer-save card in chat ---------- */
.offer-save-card {
  align-self: center;
  max-width: 520px;
  margin: 12px auto;
  padding: 12px 16px;
  background: var(--paper);
  border: 1px solid var(--amber-soft);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(101, 70, 32, 0.06);
}
.offer-save-text {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  font-style: italic;
}
.offer-save-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.offer-save-actions .btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
}
.offer-save-actions .btn-primary:hover { background: var(--amber); }

/* ---------- v2.7.1: rename chat title ---------- */
.chat-rename {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--ink-mute);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.chat-list-item:hover .chat-rename { opacity: 0.7; }
.chat-rename:hover { color: var(--amber); opacity: 1; background: rgba(175, 139, 71, 0.08); }
.chat-title-input {
  background: var(--paper);
  border: 1px solid var(--amber-soft);
  border-radius: 5px;
  padding: 4px 7px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  width: 100%;
  font-weight: 500;
  outline: none;
}
.chat-title-input:focus {
  border-color: var(--amber);
  background: #fff;
}

/* ---------- v2.7.2: workspace open accent pulse ---------- */
.chat-split.split-active .chat-main-area::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--amber-soft), transparent);
  opacity: 0;
  animation: dividerPulse 1.2s ease-out;
  pointer-events: none;
}
@keyframes dividerPulse {
  0% { opacity: 0; }
  30% { opacity: 0.7; }
  100% { opacity: 0; }
}

/* Offer-save card entry animation */
.offer-save-card {
  animation: offerSaveIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes offerSaveIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Session-closed card entry animation */
.session-closed-card {
  animation: sessionClosedIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes sessionClosedIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- v2.7.3: train-hint in eval tab ---------- */
.train-hint {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(175, 139, 71, 0.08);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink-soft);
  font-style: italic;
}
.train-hint svg { color: var(--amber); }

/* ---------- v2.7.3: coursework workspace ---------- */
.workspace-meta-row {
  display: flex;
  gap: 12px;
}
.workspace-meta-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.workspace-section-hint {
  font-size: 11.5px;
  color: var(--beaver);
  font-style: italic;
  margin-left: auto;
}
.workspace-field-large {
  min-height: 280px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--ink);
}
.cw-status-row {
  display: flex;
  gap: 8px;
}
.cw-status-btn {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 5px 14px;
  font-size: 12px;
  font-family: inherit;
  color: var(--ink-mute);
  cursor: pointer;
  transition: all 0.15s;
}
.cw-status-btn:hover {
  border-color: var(--amber-soft);
  color: var(--ink);
}
.cw-status-btn.active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--paper);
  font-weight: 500;
}

/* ---------- v2.7.3: file upload review card ---------- */
.composer-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}
.composer-upload-btn {
  background: transparent;
  border: none;
  padding: 7px;
  cursor: pointer;
  color: var(--ink-mute);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}
.composer-upload-btn:hover {
  color: var(--amber);
  background: rgba(175, 139, 71, 0.1);
}
.upload-review-card {
  align-self: center;
  width: 95%;
  max-width: 720px;
  margin: 14px auto;
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  background: var(--paper);
  border: 1px solid var(--amber-soft);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(101, 70, 32, 0.06);
  animation: offerSaveIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.upload-review-icon {
  color: var(--amber);
  flex-shrink: 0;
  padding-top: 2px;
}
.upload-review-body {
  flex: 1;
  min-width: 0;
}
.upload-review-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  gap: 12px;
}
.upload-review-filename {
  font-weight: 500;
  font-size: 13px;
  color: var(--brown-deep);
}
.upload-review-meta {
  font-size: 11px;
  color: var(--beaver);
}
.upload-review-headline {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 6px;
  font-weight: 500;
}
.upload-review-summary {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin-bottom: 8px;
  font-style: italic;
}
.upload-review-suggestions {
  margin: 6px 0 12px 18px;
  padding: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.upload-review-suggestions li { margin-bottom: 3px; }
.upload-review-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.upload-review-actions .btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
}
.upload-review-actions .btn-primary:hover { background: var(--amber); }
.upload-review-ask {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.upload-review-ask-input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  min-height: 40px;
  outline: none;
}
.upload-review-ask-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.upload-review-ask-actions .btn-primary {
  background: var(--ink); color: var(--paper); border: none;
  padding: 4px 14px; border-radius: 5px; cursor: pointer;
  font-size: 11.5px; font-family: inherit; font-weight: 500;
}
.upload-review-card.thinking .upload-review-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-mute);
  font-style: italic;
}
.upload-review-card.thinking .typing-dots {
  display: inline-flex;
  gap: 3px;
}
.upload-review-card.thinking .typing-dots span {
  width: 5px; height: 5px;
  background: var(--amber);
  border-radius: 50%;
  animation: dotPulse 1.2s infinite;
}
.upload-review-card.thinking .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.upload-review-card.thinking .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ---------- v2.7.3: editable session-closed card + reply ---------- */
.session-closed-card {
  flex-direction: column;
  align-items: stretch !important;
  gap: 0 !important;
}
.session-closed-body {
  flex: 1;
}
.session-closed-title.editing,
.session-closed-text.editing {
  outline: 1px solid var(--amber-soft);
  outline-offset: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.5);
  padding: 4px 6px;
}
.session-closed-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.session-closed-action-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  transition: all 0.15s;
}
.session-closed-action-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-bg, rgba(175, 139, 71, 0.08));
}
.session-closed-edit-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.session-closed-edit-actions .btn-primary {
  background: var(--ink); color: var(--paper); border: none;
  padding: 4px 14px; border-radius: 5px; cursor: pointer;
  font-size: 11.5px; font-family: inherit; font-weight: 500;
}
.session-closed-reply {
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  padding: 8px;
}
.session-closed-reply-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  resize: vertical;
  min-height: 40px;
  outline: none;
}
.session-closed-reply-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}
.session-closed-reply-actions .btn-primary {
  background: var(--ink); color: var(--paper); border: none;
  padding: 4px 14px; border-radius: 5px; cursor: pointer;
  font-size: 11.5px; font-family: inherit; font-weight: 500;
}

/* ---------- v2.7.4: shape-to-draft action bar ---------- */
.shape-to-draft-bar {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--amber-soft);
  display: flex;
  gap: 8px;
  align-items: center;
}
.shape-to-draft-bar .btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s;
}
.shape-to-draft-bar .btn-primary:hover { background: var(--amber); }
.shape-to-draft-bar .btn-ghost { font-size: 11.5px; }

/* ---------- v2.7.4: LLM-as-judge inline card ---------- */
.msg-action.judge-btn { color: var(--ink-mute); }
.msg-action.judge-btn:hover { color: var(--amber); }
.msg-action.judge-btn.judging { animation: pulseHint 1.2s infinite; }
@keyframes pulseHint {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.judgment-card {
  margin-top: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  animation: offerSaveIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.judgment-card.thinking {
  font-style: italic;
  color: var(--ink-mute);
}
.judgment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.judgment-score {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 5px;
}
.judgment-score.high { background: #d4e4c7; color: #4a6b3a; }
.judgment-score.mid { background: #f0e2c2; color: #7a5e2a; }
.judgment-score.low { background: #efc8c0; color: #8a3a30; }
.judgment-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--beaver);
}
.judgment-reason {
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.judgment-better {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
}
.judgment-better strong { color: var(--brown-deep); font-weight: 500; }
.judgment-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
.judgment-actions .btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 4px 11px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  font-weight: 500;
}
.judgment-actions .btn-primary:hover { background: var(--amber); }
.judgment-actions .btn-primary:disabled { opacity: 0.6; }
.judgment-error {
  color: #a44;
  font-style: italic;
}

/* ---------- v2.7.5: image upload preview + inline message images ---------- */
.composer-image-preview {
  padding: 10px 12px 4px;
  background: transparent;
}
.composer-image-thumb-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  max-width: 100%;
}
.composer-image-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--line);
}
.composer-image-filename {
  font-size: 12px;
  color: var(--ink-soft);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-image-remove {
  background: var(--ink);
  color: var(--paper);
  border: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.composer-image-remove:hover { background: var(--amber); }

.msg-image-wrap {
  margin-top: 8px;
}
.msg-image {
  display: block;
  max-width: 280px;
  max-height: 280px;
  border-radius: 8px;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.msg.user .msg-image {
  margin-left: auto;
}

/* ---------- v2.7.6: role-based UI gating ---------- */
body.role-evaluator .msg-action.judge-btn,
body.role-user .msg-action.judge-btn {
  display: none !important;
}

/* ---------- v2.7.7: context display in judgment card ---------- */
.judgment-context {
  font-size: 12px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.5);
  border-left: 2px solid var(--amber-soft);
  padding: 5px 9px;
  border-radius: 0 4px 4px 0;
  margin-bottom: 6px;
}
.judgment-context strong { color: var(--brown-deep); font-weight: 500; }

/* ---------- v2.8: Pherson's World editor ---------- */
.world-friends-list, .world-threads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.world-friend-row {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 6px;
  padding: 6px;
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--line);
  border-radius: 6px;
  align-items: start;
}
.world-friend-row .friend-name {
  margin: 0;
}
.world-friend-row .friend-details {
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
  resize: vertical;
}
.world-friend-row .friend-remove,
.world-thread-row .thread-remove {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.world-friend-row .friend-remove:hover,
.world-thread-row .thread-remove:hover {
  border-color: #c66;
  color: #c66;
}
.world-thread-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
}
.world-life-display {
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.life-where {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line);
  font-style: italic;
  color: var(--brown-deep);
}
.life-where strong {
  font-style: normal;
  color: var(--amber);
}
.life-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.life-event {
  font-size: 12.5px;
}
.life-event-when {
  color: var(--beaver);
  font-style: italic;
  margin-right: 4px;
}

/* ---------- v2.10: admin-only UI + queue picker ---------- */
body.role-evaluator .msg-action.queue-btn,
body.role-user .msg-action.queue-btn {
  display: none !important;
}
.msg-action.queue-btn {
  color: var(--ink-mute);
}
.msg-action.queue-btn:hover {
  color: var(--amber);
}

.queue-charge-picker {
  margin-top: 8px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  font-size: 12px;
  animation: offerSaveIn 0.3s ease;
}
.qcp-label {
  font-size: 11px;
  color: var(--beaver);
  margin-bottom: 6px;
  font-style: italic;
}
.qcp-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.qcp-buttons button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-mute);
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  transition: all 0.15s;
}
.qcp-buttons button:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(175, 139, 71, 0.08);
}
.qcp-status {
  margin-top: 6px;
  font-size: 11px;
  color: var(--beaver);
}

/* ---------- v2.10.1: stricter role gating ---------- */
/* Anything marked data-admin-only is hidden by default. Only role-admin shows it. */
[data-admin-only] {
  display: none !important;
}
body.role-admin [data-admin-only] {
  display: flex !important;
}
body.role-admin .nav-item[data-admin-only] {
  display: flex !important;
}

/* Judge button — admin only (existing rule reinforced) */
body.role-evaluator .msg-action.judge-btn,
body.role-user .msg-action.judge-btn,
body:not(.role-admin):not(.role-evaluator):not(.role-user) .msg-action.judge-btn {
  display: none !important;
}

/* Queue button — admin only */
body.role-evaluator .msg-action.queue-btn,
body.role-user .msg-action.queue-btn,
body:not(.role-admin) .msg-action.queue-btn {
  display: none !important;
}

/* While role is unknown (whoami still loading), hide admin-y stuff to avoid flicker */
body:not(.role-admin):not(.role-evaluator):not(.role-user) [data-admin-only] {
  display: none !important;
}

.quota-notice {
  align-self: center;
  margin: 12px auto;
  padding: 10px 16px;
  background: rgba(175, 139, 71, 0.08);
  border: 1px solid var(--amber-soft);
  border-radius: 8px;
  color: var(--brown-deep);
  font-size: 13px;
  font-style: italic;
  text-align: center;
  max-width: 480px;
}

/* ---------- v2.10.3: Admin Users Panel ---------- */
.users-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 32px;
}
.users-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 24px 0 28px;
}
.users-summary-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
}
.usc-label {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  color: var(--beaver);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.usc-val {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 28px;
  color: var(--brown-deep);
  font-weight: 500;
}
.users-table-wrap {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--beaver);
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  background: rgba(175, 139, 71, 0.04);
}
.users-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.users-table tbody tr:last-child td {
  border-bottom: none;
}
.users-table tbody tr:hover {
  background: rgba(175, 139, 71, 0.04);
}
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar, .user-avatar-placeholder {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--cream);
  color: var(--brown-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid var(--line);
}
.user-avatar { object-fit: cover; }
.user-cell-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.user-name {
  color: var(--ink);
  font-weight: 500;
}
.user-email {
  color: var(--beaver);
  font-size: 11.5px;
}
.role-select {
  background: white;
  border: 1px solid var(--line);
  padding: 5px 8px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.3s;
}
.role-select:hover { border-color: var(--amber); }
.metric-small { color: var(--beaver); font-size: 12px; }
.metric-big { color: var(--ink); font-weight: 500; }
.user-delete-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--beaver);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-delete-btn:hover {
  border-color: #a44;
  color: #a44;
}
.users-loading {
  text-align: center;
  padding: 30px;
  color: var(--beaver);
  font-style: italic;
}

/* ---------- v2.11.3: Discover — c.ai-style compact horizontal cards ---------- */
#view-home,
#view-users {
  overflow-y: auto;
  padding: 0;
}
.home-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}
.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.home-header h2 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brown-deep);
  margin-bottom: 2px;
  line-height: 1.1;
}
.home-header p {
  max-width: 600px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-mute);
}
.create-char-btn {
  background: var(--brown-deep) !important;
  color: #fff !important;
  border: none !important;
  padding: 11px 18px !important;
  border-radius: 100px !important;
  font-family: 'Inter', system-ui, sans-serif !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  transition: opacity 0.15s !important;
  white-space: nowrap !important;
}
.create-char-btn:hover { opacity: 0.82 !important; }

.character-section-label {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--brown-deep);
  margin: 28px 0 12px;
  letter-spacing: -0.005em;
}
.character-section-label:first-of-type { margin-top: 4px; }

/* c.ai-style horizontal scrolling rows */
.character-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
  margin-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.character-row::-webkit-scrollbar { height: 6px; }
.character-row::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
.character-row::-webkit-scrollbar-track { background: transparent; }

/* fallback for any old .character-grid references */
.character-grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.character-card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
  position: relative;
  width: 340px;
  flex: 0 0 340px;
  scroll-snap-align: start;
  min-height: 104px;
}
.character-card:hover {
  background: #fafafa;
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: var(--shadow-sm);
}
.cc-image {
  width: 104px;
  height: auto;
  align-self: stretch;
  flex-shrink: 0;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cc-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cc-image-placeholder {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 36px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}
.cc-featured {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--brown-deep);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  text-transform: uppercase;
}
.cc-body {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0; /* allow text truncation */
  justify-content: center;
}
.cc-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  color: #111;
  margin: 0;
  letter-spacing: -0.005em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-name-row { display: none; } /* old structure */
.cc-age { display: none; }
.cc-author-inline {
  font-size: 12px;
  color: #888;
  margin-bottom: 2px;
}
.cc-tagline {
  font-size: 13px;
  color: #555;
  line-height: 1.35;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cc-tags { display: none; } /* hide on compact card */
.cc-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #888;
  margin-top: 4px;
}
.cc-meta svg { width: 13px; height: 13px; opacity: 0.6; }
.cc-loading {
  width: 100%;
  text-align: center;
  padding: 48px 20px;
  color: #888;
  font-size: 13.5px;
}

/* ---------- v2.11.3: Chat character header — c.ai style ---------- */
.chat-char-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.cch-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
  overflow: hidden;
}
.cch-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cch-text { display: flex; flex-direction: column; gap: 0; min-width: 0; }
.cch-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  color: #111;
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.cch-tagline {
  font-size: 12px;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

/* ---------- v2.11: Modal for character creation ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(42, 31, 18, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.is-open {
  display: flex;
  animation: modalFade 0.15s ease;
}
@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--paper);
  border-radius: 16px;
  border: 1px solid var(--line);
  max-width: 640px;
  width: 100%;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 36px 40px;
  position: relative;
  animation: modalSlide 0.22s cubic-bezier(.2,.8,.3,1);
  box-shadow: 0 20px 60px rgba(42, 31, 18, 0.18);
}
@keyframes modalSlide { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-card h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--brown-deep);
}
.modal-sub {
  color: var(--ink-soft);
  margin: 0 0 24px;
  font-size: 13.5px;
  line-height: 1.5;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--beaver);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.modal-close:hover { background: var(--cream); color: var(--ink); }

.char-form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label {
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  font-weight: 500;
}
.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="url"],
.form-row select,
.form-row textarea {
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
}
.form-row textarea {
  font-family: inherit;
  resize: vertical;
  line-height: 1.5;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--amber);
}
.form-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.form-row-grid > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-row-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  border: none;
  padding: 0;
}
.form-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
}

/* Vibe picker — single-select chips */
.vibe-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.vibe-btn {
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.12s;
}
.vibe-btn:hover { border-color: var(--amber); }
.vibe-btn.is-active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Avatar uploader */
.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.avatar-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--cream);
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--amber);
  flex-shrink: 0;
  overflow: hidden;
}
.avatar-preview.has-image { border-style: solid; }
.avatar-preview img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.avatar-remove-btn { font-size: 12px !important; padding: 6px 12px !important; }
.form-row-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.form-row-checkbox label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.form-row-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--amber);
}
.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}
.btn-primary, .btn-secondary {
  padding: 10px 18px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid;
  transition: all 0.12s;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--amber); border-color: var(--amber); }
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover { border-color: var(--amber); color: var(--amber); }
.form-status {
  font-size: 12px;
  text-align: right;
  min-height: 16px;
  color: var(--beaver);
}
.form-status.ok { color: var(--brown-deep); }
.form-status.err { color: #a44; }

/* Sidebar — chat list character grouping */
.chat-list-character-group {
  margin-bottom: 14px;
}
.chat-list-character-label {
  font-size: 10px;
  letter-spacing: 0.07em;
  color: var(--beaver);
  text-transform: uppercase;
  padding: 4px 12px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-list-character-label .clcl-avatar {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--amber);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.chat-list-character-label .clcl-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- v2.11.4: chat list avatars (c.ai style sidebar) ---------- */
.chat-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cli-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
}
.cli-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-list-item .title-line {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* ---------- v2.11.4: character profile modal ---------- */
.profile-modal-card {
  max-width: 480px;
  text-align: center;
  padding: 32px 32px 28px;
}
.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 44px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #111;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.profile-author {
  font-size: 13px;
  color: #888;
  margin-bottom: 8px;
}
.profile-stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #666;
}
.profile-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.profile-tagline {
  font-size: 14px;
  color: #555;
  font-style: italic;
  margin: 0 0 14px;
  line-height: 1.5;
}
.profile-description {
  font-size: 14px;
  color: #333;
  line-height: 1.55;
  text-align: left;
  margin-bottom: 22px;
  white-space: pre-wrap;
}
.profile-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.profile-chat-btn {
  min-width: 160px;
  padding: 12px 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  border-radius: 100px !important;
}
.profile-delete-btn {
  color: #c44 !important;
}
.profile-delete-btn:hover {
  border-color: #c44 !important;
  color: #c44 !important;
}

/* ============================================================
   2.11.6 — c.ai-style redesign layer
   Appended last so these rules win over the original styles.
   Touches: sidebar layout, chat header, character cards (Discover),
   character create modal, user-chip footer, modal polish.
   ============================================================ */

/* --- sidebar layout: nav at top, chats scrollable, user chip at bottom --- */
.sidebar {
  display: flex;
  flex-direction: column;
  padding: 18px 12px 0;
}
.sidebar-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px 14px;
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.015em;
  color: var(--ink);
  padding: 4px 6px 6px;
}
.new-chat-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 11px 18px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s;
  margin: 4px 0 10px;
}
.new-chat-btn:hover { background: #000; }
.new-chat-btn svg { stroke: #fff; }

.nav.nav-top {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  margin: 0;
}
.nav.nav-top .nav-item,
.nav.nav-admin .nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.1s, color 0.1s;
}
.nav.nav-top .nav-item:hover,
.nav.nav-admin .nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
}
.nav.nav-top .nav-item.active,
.nav.nav-admin .nav-item.active {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
  font-weight: 600;
}
.nav.nav-top .nav-item svg,
.nav.nav-admin .nav-item svg { width: 17px; height: 17px; opacity: 0.85; flex-shrink: 0; }

.admin-block { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.admin-label { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-mute); padding: 0 12px 6px; }

.chat-list-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 0 12px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
}
.chat-list-label {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  padding: 6px 12px 6px;
}
.chat-list-bucket {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  padding: 12px 12px 4px;
  letter-spacing: 0;
  text-transform: none;
}

.chat-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.chat-list-item:hover { background: rgba(0, 0, 0, 0.04); }
.chat-list-item.active { background: rgba(0, 0, 0, 0.07); }
.cli-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.cli-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cli-avatar span { font-size: 12px; font-weight: 600; color: #fff; }
.chat-list-item .title-line {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1;
  min-width: 0;
}
.chat-list-item .chat-title-text {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.chat-list-item .chat-preview {
  font-size: 11.5px;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-list-item .chat-rename,
.chat-list-item .chat-delete {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--ink-mute);
  border-radius: 6px;
  transition: opacity 0.1s, background 0.1s;
}
.chat-list-item:hover .chat-rename,
.chat-list-item:hover .chat-delete { opacity: 1; }
.chat-list-item .chat-rename:hover,
.chat-list-item .chat-delete:hover { background: rgba(0, 0, 0, 0.06); color: var(--ink); }

/* --- user footer chip (c.ai-style identity at bottom) --- */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 14px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 10px;
  flex: 1;
  min-width: 0;
}
.user-chip-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5d142, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.user-chip-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-chip-text { display: flex; flex-direction: column; min-width: 0; }
.user-chip-name { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.user-chip-handle { font-size: 11.5px; color: var(--ink-mute); line-height: 1.2; }
.sidebar-signout {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--ink-mute);
  transition: background 0.1s, color 0.1s;
}
.sidebar-signout:hover { background: rgba(0, 0, 0, 0.06); color: var(--ink); }

/* --- chat header: clickable, prominent, opens profile modal --- */
.chat-char-header {
  padding: 14px 22px !important;
  gap: 12px !important;
  transition: background 0.12s;
}
.chat-char-header:hover { background: rgba(0, 0, 0, 0.02); }
.cch-avatar {
  width: 40px !important;
  height: 40px !important;
}
.cch-text { flex: 1; min-width: 0; }
.cch-name { font-size: 15px !important; }
.cch-tagline { font-size: 12.5px !important; }
.cch-view-profile {
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 500;
  margin-left: auto;
}
.cch-chev { color: var(--ink-mute); opacity: 0.7; flex-shrink: 0; }
.chat-char-header:hover .cch-view-profile,
.chat-char-header:hover .cch-chev { color: var(--ink); opacity: 1; }
@media (max-width: 600px) {
  .cch-view-profile { display: none; }
}

/* --- discover redesign: vertical cards with photo on top --- */
#characterGrid.discover-grid { display: flex; flex-direction: column; gap: 6px; }
.character-section { margin-bottom: 28px; }
.character-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}
.character-section-label {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  margin: 0 !important;
  letter-spacing: -0.01em;
}
.character-section-sub {
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 400;
}

.character-row {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px !important;
  overflow: visible !important;
  padding-bottom: 0 !important;
}
@media (max-width: 900px) {
  .character-row {
    display: flex !important;
    grid-template-columns: none;
    overflow-x: auto !important;
    scroll-snap-type: x proximity;
  }
  .character-row .character-card { flex: 0 0 220px; width: 220px; scroll-snap-align: start; }
}

.character-card {
  flex-direction: column !important;
  width: 100% !important;
  flex: 1 1 auto !important;
  min-height: 0 !important;
  border-radius: 16px !important;
  overflow: hidden;
  background: #fff !important;
  border: 1px solid var(--line) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s !important;
}
.character-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08) !important;
  border-color: var(--line-strong) !important;
}
.cc-image {
  width: 100% !important;
  aspect-ratio: 1 / 1;
  height: auto !important;
  align-self: auto !important;
}
.cc-body {
  padding: 14px 16px !important;
  gap: 4px !important;
}
.cc-name {
  font-size: 15px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-author-inline {
  font-size: 11.5px !important;
  color: var(--ink-mute) !important;
  margin-bottom: 2px !important;
}
.cc-tagline {
  font-size: 12.5px !important;
  color: var(--ink-soft) !important;
  line-height: 1.4 !important;
  -webkit-line-clamp: 2;
  min-height: 35px;
}
.cc-meta {
  font-size: 11.5px !important;
  color: var(--ink-mute) !important;
  margin-top: 6px !important;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.cc-featured {
  background: rgba(0, 0, 0, 0.65) !important;
  color: #fff !important;
  font-size: 9px !important;
  letter-spacing: 0.08em !important;
  padding: 3px 7px !important;
}

/* --- create character modal: expanded form (greeting + definition + visibility) --- */
.form-row .muted-label { color: var(--ink-mute); font-weight: 400; font-size: 12px; }
.form-row textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  resize: vertical;
  min-height: 60px;
  transition: border-color 0.1s;
}
.form-row textarea:focus { outline: none; border-color: var(--ink); }
.form-details {
  background: rgba(0, 0, 0, 0.025);
  border-radius: 12px;
  padding: 12px 14px;
}
.form-details summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  list-style: none;
  padding: 4px 0;
}
.form-details summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform 0.15s;
  color: var(--ink-mute);
}
.form-details[open] summary::before { transform: rotate(90deg); }
.form-details code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 12px;
}

.visibility-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}
.vis-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}
.vis-opt:hover { background: rgba(0, 0, 0, 0.02); }
.vis-opt input[type=radio] {
  margin-top: 3px;
  accent-color: var(--ink);
  flex-shrink: 0;
}
.vis-opt:has(input:checked) {
  border-color: var(--ink);
  background: rgba(0, 0, 0, 0.03);
}
.vis-opt-body { display: flex; flex-direction: column; gap: 2px; }
.vis-opt-body strong { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.vis-opt-body em { font-size: 12px; color: var(--ink-mute); font-style: normal; }
@media (max-width: 480px) {
  .visibility-row { grid-template-columns: 1fr; }
}

/* --- view header refinement (Discover heading) --- */
.home-header { align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.home-header h2 { font-size: 28px !important; font-weight: 700 !important; letter-spacing: -0.02em; }
.home-header p { font-size: 14px; color: var(--ink-mute); max-width: 560px; }
.create-char-btn { flex-shrink: 0; }

/* --- modal polish --- */
.modal-overlay { background: rgba(20, 18, 16, 0.55) !important; }
.modal-card {
  border-radius: 20px !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-lg);
}

/* --- admin gating: explicit defaults so non-admins truly never see admin nav --- */
[data-admin-only] { display: none !important; }
body.role-admin [data-admin-only] { display: flex !important; }
body.role-admin .admin-block[data-admin-only] { display: block !important; }
body.role-admin .nav-item[data-admin-only] { display: flex !important; }

/* --- mobile: sidebar slides over --- */
@media (max-width: 768px) {
  .sidebar { padding: 14px 10px 0; }
  .character-section-label { font-size: 16px !important; }
}

/* ============================================================
   2.11.7 — c.ai parity layer (overrides 2.11.6 where needed)
   Horizontal cards, profile-as-page, chat right sidebar,
   top-right account widget, layout cleanup.
   ============================================================ */

/* --- Discover: HORIZONTAL cards (image left, text right) like c.ai's Popular row --- */
#characterGrid.discover-grid .character-row {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px !important;
}
@media (min-width: 1100px) {
  #characterGrid.discover-grid .character-row { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1500px) {
  #characterGrid.discover-grid .character-row { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
  #characterGrid.discover-grid .character-row { grid-template-columns: 1fr; }
}

#characterGrid.discover-grid .character-card {
  flex-direction: row !important;
  width: 100% !important;
  height: 170px;
  min-height: 0 !important;
  aspect-ratio: auto !important;
  display: flex !important;
}
#characterGrid.discover-grid .cc-image {
  width: 170px !important;
  height: 170px !important;
  aspect-ratio: 1 / 1 !important;
  flex-shrink: 0;
}
#characterGrid.discover-grid .cc-body {
  flex: 1;
  padding: 14px 16px !important;
  gap: 4px !important;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}
#characterGrid.discover-grid .cc-name {
  font-size: 16px !important;
  font-weight: 600 !important;
}
#characterGrid.discover-grid .cc-tagline {
  -webkit-line-clamp: 2;
  min-height: 0;
  font-size: 13px !important;
  color: var(--ink-soft) !important;
}
#characterGrid.discover-grid .cc-meta {
  margin-top: 4px !important;
  padding-top: 0 !important;
  border-top: none !important;
}

/* Don't lead with "Create a character" — make it small/secondary, right-aligned */
.home-header .create-char-btn {
  font-size: 13px !important;
  padding: 8px 14px !important;
  font-weight: 500 !important;
}

/* --- Chat right sidebar (c.ai-style action column) --- */
.chat-side {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--line);
  background: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}
.cs-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.cs-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 26px;
  margin-bottom: 4px;
}
.cs-avatar img { width: 100%; height: 100%; object-fit: cover; }
.cs-name { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.cs-author { font-size: 12px; color: var(--ink-mute); }
.cs-stats {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}
.cs-actions { display: flex; flex-direction: column; gap: 2px; }
.cs-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 0.1s;
}
.cs-btn:hover { background: rgba(0, 0, 0, 0.05); }
.cs-btn svg { flex-shrink: 0; opacity: 0.8; }
.cs-btn span { flex: 1; }
.cs-chev { opacity: 0.5; width: 14px !important; height: 14px !important; }
.cs-btn-danger { color: #c44; }
.cs-btn-danger:hover { background: rgba(196, 68, 68, 0.06); }
.cs-btn-danger svg { color: #c44; }

@media (max-width: 1100px) {
  .chat-side { display: none; }
}

/* --- Chat header is clickable (cursor + hover) — no "View profile" label needed --- */
.cch-view-profile, .cch-chev { display: none !important; }
.chat-char-header { cursor: pointer; }

/* --- Profile as a PAGE (was a modal) --- */
#view-profile { padding: 32px 40px; overflow-y: auto; }
.profile-inner { max-width: 720px; margin: 0 auto; }
.profile-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 18px;
  transition: background 0.1s, color 0.1s;
}
.profile-back-btn:hover { background: rgba(0, 0, 0, 0.05); color: var(--ink); }

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-bottom: 28px;
}
.profile-hero .profile-avatar {
  width: 140px !important;
  height: 140px !important;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 56px;
  margin-bottom: 6px;
}
.profile-hero .profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-hero .profile-name {
  font-size: 28px !important;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin: 0;
}
.profile-hero .profile-author {
  font-size: 14px;
  color: var(--ink-mute);
}
.profile-action-row {
  display: flex;
  gap: 10px;
  margin: 14px 0 6px;
  align-items: center;
}
.profile-hero .profile-chat-btn {
  min-width: 200px;
  padding: 12px 28px !important;
  border-radius: 100px !important;
  font-weight: 600 !important;
}
.profile-hero .profile-stats {
  display: flex;
  gap: 18px;
  margin-top: 8px;
  color: var(--ink-mute);
  font-size: 13px;
}
.profile-hero .profile-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.profile-body {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.profile-body .profile-tagline {
  font-size: 16px;
  color: var(--ink);
  font-weight: 500;
  font-style: italic;
  text-align: center;
  margin-bottom: 18px;
}
.profile-body .profile-description {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

.profile-edit-btn, .profile-delete-btn {
  padding: 12px 20px !important;
  border-radius: 100px !important;
  font-size: 14px !important;
}
.profile-delete-btn { color: #c44 !important; }
.profile-delete-btn:hover { border-color: #c44 !important; }

/* --- Top-right user widget (across all views) --- */
.topbar-user {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 90;
}
.topbar-user-btn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.12s, transform 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.topbar-user-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.topbar-user-avatar {
  display: flex;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5d142, #f59e0b);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.topbar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.topbar-user-menu {
  position: absolute;
  top: 46px;
  right: 0;
  width: 240px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  animation: tumIn 0.12s ease;
}
@keyframes tumIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.tum-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.tum-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5d142, #f59e0b);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.tum-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tum-meta { min-width: 0; }
.tum-name { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.tum-handle { font-size: 12px; color: var(--ink-mute); line-height: 1.2; }
.tum-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: none;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13.5px;
  text-align: left;
  font-weight: 500;
}
.tum-item:hover { background: rgba(0, 0, 0, 0.04); }
.tum-item svg { opacity: 0.7; }
.tum-item-danger { color: #c44; }
.tum-item-danger:hover { background: rgba(196, 68, 68, 0.06); }

/* Hide topbar avatar on small screens (mobile menu button takes precedence) */
@media (max-width: 768px) {
  .topbar-user { top: 10px; right: 12px; }
  .topbar-user-btn { width: 32px; height: 32px; }
  .topbar-user-avatar { width: 28px; height: 28px; font-size: 12px; }
}

/* --- chat split needs to accommodate the right-side panel --- */
.chat-split { display: flex; flex-direction: row; min-height: 0; }
.chat-main-area { flex: 1; min-width: 0; }

/* ============================================================
   2.11.8 — cleanup, c.ai parity refinements
   Kill V topbar + chat-side, add chat-intro card, AI disclaimer,
   labeled profile stats, "Content by Pherson AI" badge.
   ============================================================ */

/* --- Kill the things the user complained about --- */
.topbar-user, .chat-side { display: none !important; }

/* --- Chat intro (c.ai-style profile card at top of chat) --- */
.chat-intro {
  max-width: 720px;
  margin: 32px auto 28px;
  padding: 28px 24px 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.ci-avatar {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #c4c4c8, #6b6b70);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 28px;
  margin-bottom: 10px;
}
.ci-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ci-avatar span { font-weight: 700; font-size: 28px; }
.ci-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.ci-tagline {
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 480px;
  line-height: 1.5;
}
.ci-author {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.ci-badge {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink-soft);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
}

/* --- AI disclaimer below composer (c.ai-style) --- */
.composer-disclaimer {
  text-align: center;
  font-size: 11.5px;
  color: var(--ink-mute);
  padding: 10px 18px 14px;
  margin: 0 auto;
  max-width: 720px;
  letter-spacing: 0.01em;
}

/* --- Profile stats: labeled blocks like c.ai's "52.0m Interactions" --- */
.profile-stats {
  flex-direction: row !important;
  gap: 22px !important;
  flex-wrap: wrap;
  justify-content: center;
}
.profile-stats .stat-block {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 400;
}
.profile-stats .stat-block strong {
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
}
.profile-stats .stat-block svg {
  color: var(--ink-mute);
}
.profile-content-badge {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink-soft);
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 500;
  margin-bottom: 6px;
  display: inline-block;
}

/* --- 2-col version of form grid (used after Age removal) --- */
.form-row-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sub-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-mute);
  display: block;
  margin-bottom: 4px;
}

/* --- chat-split: only main + workspace remain --- */
.chat-split { display: flex; flex-direction: row; min-height: 0; }
.chat-main-area { flex: 1; min-width: 0; }

/* --- improve memory icon (was a striped block, now a thought-bubble) --- */
/* (icons updated inline in HTML — this is a hook in case overrides needed) */

/* --- mobile composer disclaimer tighter --- */
@media (max-width: 600px) {
  .composer-disclaimer { font-size: 10.5px; padding: 8px 14px 12px; }
  .chat-intro { margin: 18px auto 16px; padding: 16px 18px 10px; }
  .ci-avatar { width: 64px; height: 64px; }
  .ci-name { font-size: 18px; }
}

/* ============================================================
   2.11.9 — Visual overhaul: c.ai card layout, compact profile,
   premium message bubbles, click animations, mobile fixes,
   like button, admin boost panel.
   ============================================================ */

/* ---- DISCOVER: c.ai horizontal card (square image left, tight text right) ---- */
/* Force all character-row cards to the same c.ai horizontal layout */
.character-section .character-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 12px !important;
  overflow: visible !important;
}
.character-section .character-card {
  flex: 0 0 calc(50% - 6px);
  max-width: calc(50% - 6px);
  flex-direction: row !important;
  height: 110px !important;
  min-height: 0 !important;
  border-radius: 14px !important;
  overflow: hidden;
  background: #fff !important;
  border: 1px solid rgba(0,0,0,0.08) !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  cursor: pointer;
  display: flex !important;
  align-items: stretch !important;
}
@media (min-width: 1400px) {
  .character-section .character-card { flex: 0 0 calc(25% - 9px); max-width: calc(25% - 9px); }
}
@media (max-width: 900px) {
  .character-section .character-card { flex: 0 0 100%; max-width: 100%; }
}
@media (max-width: 640px) {
  .character-section .character-card { height: 96px !important; }
}
.character-section .character-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}
.character-section .cc-image {
  width: 110px !important;
  height: 110px !important;
  flex-shrink: 0 !important;
  aspect-ratio: 1 / 1 !important;
  border-radius: 0 !important;
}
@media (max-width: 640px) {
  .character-section .cc-image { width: 96px !important; height: 96px !important; }
}
.character-section .cc-image img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
}
.character-section .cc-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  background: linear-gradient(135deg, #888, #555);
}
.character-section .cc-body {
  flex: 1 !important;
  padding: 10px 12px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  gap: 0 !important;
  min-width: 0 !important;
  overflow: hidden !important;
}
.character-section .cc-name {
  font-size: 14px !important;
  font-weight: 700 !important;
  color: var(--ink) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.2 !important;
}
.character-section .cc-author-inline {
  font-size: 11px !important;
  color: var(--ink-mute) !important;
  margin: 1px 0 3px !important;
  line-height: 1.2 !important;
}
.character-section .cc-tagline {
  font-size: 12px !important;
  color: var(--ink-soft) !important;
  line-height: 1.4 !important;
  overflow: hidden !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  min-height: 0 !important;
  flex: 1;
}
.character-section .cc-meta {
  font-size: 11px !important;
  color: var(--ink-mute) !important;
  margin-top: 4px !important;
  padding-top: 0 !important;
  border-top: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
}
.character-section .cc-featured {
  display: none !important;
}

/* ---- PROFILE PAGE: compact, information-first (fix the whitespace complaint) ---- */
#view-profile {
  padding: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  height: 100% !important;
}
.profile-inner {
  max-width: 680px !important;
  margin: 0 auto !important;
  padding: 24px 24px 60px !important;
}
.profile-back-btn { margin-bottom: 12px !important; }
.profile-hero {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  text-align: left !important;
  gap: 20px !important;
  padding-bottom: 18px !important;
}
.profile-hero .profile-avatar {
  width: 96px !important;
  height: 96px !important;
  font-size: 36px !important;
  flex-shrink: 0;
}
.profile-hero-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.profile-hero .profile-name {
  font-size: 22px !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}
.profile-hero .profile-author { font-size: 13px !important; margin: 0 !important; }
.profile-action-row { margin: 8px 0 4px !important; }
.profile-hero .profile-stats {
  margin-top: 4px !important;
  flex-wrap: wrap !important;
  gap: 14px !important;
}
.profile-body { padding-top: 18px !important; }
.profile-body .profile-tagline {
  font-size: 15px !important;
  margin-bottom: 12px !important;
  text-align: left !important;
}
.profile-body .profile-description {
  font-size: 14px !important;
  line-height: 1.65 !important;
}

/* On mobile, profile stays compact vertical */
@media (max-width: 600px) {
  .profile-hero {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    gap: 12px !important;
  }
  .profile-hero .profile-avatar { width: 88px !important; height: 88px !important; }
  .profile-hero .profile-name { font-size: 20px !important; }
  .profile-action-row { justify-content: center !important; }
  .profile-hero .profile-stats { justify-content: center !important; }
  .profile-body .profile-tagline { text-align: center !important; }
  .profile-inner { padding: 16px 16px 48px !important; }
}

/* profile-hero-right div — wrapper for name/author/action/stats on desktop */
.profile-hero-right {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
@media (max-width: 600px) {
  .profile-hero-right {
    align-items: center;
    width: 100%;
  }
}

/* ---- LIKE BUTTON ---- */
.profile-like-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  color: var(--ink-mute);
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0;
}
.profile-like-btn:hover { background: rgba(0,0,0,0.04); color: var(--ink); transform: scale(1.08); }
.profile-like-btn.liked { color: #3b82f6; border-color: #3b82f6; background: rgba(59,130,246,0.06); }
.profile-like-btn.liked svg { fill: #3b82f6; stroke: #3b82f6; }
.profile-like-btn:active { transform: scale(0.92); }

/* ---- ADMIN BOOST PANEL ---- */
.profile-boost-panel {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.03);
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
}
.boost-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.boost-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.boost-inputs input {
  width: 130px;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
  color: var(--ink);
}
.boost-btn {
  padding: 7px 16px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s;
}
.boost-btn:hover { opacity: 0.82; }

/* ---- MESSAGE BUBBLES: premium, lightweight, tighter spacing ---- */
/* Assistant bubble */
.message.assistant .message-text {
  background: #f4f4f5 !important;
  color: #1a1a1a !important;
  border: none !important;
  border-radius: 4px 18px 18px 18px !important;
  padding: 12px 16px !important;
  font-size: 14.5px !important;
  line-height: 1.55 !important;
  max-width: 72% !important;
  box-shadow: none !important;
}
/* User bubble */
.message.user .message-text {
  background: #1a1a1a !important;
  color: #fff !important;
  border: none !important;
  border-radius: 18px 4px 18px 18px !important;
  padding: 12px 16px !important;
  font-size: 14.5px !important;
  line-height: 1.55 !important;
  max-width: 72% !important;
}
/* Reduce paragraph spacing inside bubbles */
.message-text p { margin: 0 0 6px !important; }
.message-text p:last-child { margin: 0 !important; }
/* Tighten action lines (*italics*) */
.message-text em { display: inline; line-height: 1.4; }
.message { margin-bottom: 10px !important; }
.message.assistant { padding: 0 8px 0 0 !important; }
.message.user { padding: 0 0 0 8px !important; }
/* Message action buttons */
.message-actions button {
  opacity: 0;
  transition: opacity 0.12s;
}
.message:hover .message-actions button { opacity: 1; }

/* ---- CLICK ANIMATIONS (ripple + scale) ---- */
@keyframes ripple {
  to { transform: scale(2.5); opacity: 0; }
}
.btn-primary, .btn-secondary, .new-chat-btn, .nav-item, .character-card, .profile-chat-btn {
  position: relative;
  overflow: hidden;
}
.btn-primary:active, .btn-secondary:active, .new-chat-btn:active {
  transform: scale(0.97);
  transition: transform 0.1s;
}
.nav-item:active { background: rgba(0,0,0,0.08) !important; }
.character-card:active { transform: scale(0.98) !important; }
.ripple-dot {
  position: absolute;
  border-radius: 50%;
  width: 10px;
  height: 10px;
  background: rgba(0,0,0,0.12);
  transform: scale(0);
  animation: ripple 0.45s linear;
  pointer-events: none;
}
/* Smooth all interactive transitions */
button, a, .character-card, .chat-list-item, .nav-item {
  transition: background 0.13s ease, transform 0.13s ease, box-shadow 0.13s ease, opacity 0.13s ease !important;
}

/* ---- MOBILE: tighten everything ---- */
@media (max-width: 768px) {
  /* Sidebar slides over full-width */
  .sidebar { width: 100vw !important; max-width: 320px !important; }
  /* Chat header: smaller */
  .chat-char-header { padding: 10px 14px !important; }
  .cch-avatar { width: 34px !important; height: 34px !important; }
  .cch-name { font-size: 14px !important; }
  .cch-tagline { font-size: 11.5px !important; }
  /* Composer tighter */
  .composer-wrap { padding: 10px !important; }
  /* Message bubbles mobile */
  .message.assistant .message-text,
  .message.user .message-text { max-width: 88% !important; font-size: 14px !important; }
  /* Profile page */
  .profile-hero .profile-avatar { width: 76px !important; height: 76px !important; }
  /* Hide character section sub on small screens */
  .character-section-sub { display: none !important; }
}
@media (max-width: 380px) {
  .message.assistant .message-text,
  .message.user .message-text { max-width: 94% !important; font-size: 13.5px !important; }
}

/* ---- PROFILE PAGE: wrap name/author/actions/stats in right column div ---- */
/* (The profile-hero-right div is injected by JS; this CSS supports it) */
.profile-hero-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

/* ============================================================
   2.11.10 — Immersive dark discover + bottom nav + back arrow
   DO NOT change layout of sidebar/chat/views — mobile-first only
   ============================================================ */

/* ---- DISCOVER APP CONTAINER ---- */
#view-home {
  background: #0d0d0d !important;
  overflow: hidden !important;
  /* NO display here — controlled by .view / .view.active toggle */
  flex-direction: column !important;
  height: 100% !important;
  padding: 0 !important;
}

.discover-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ---- TOP BAR: tabs + create button ---- */
.discover-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 10px;
  background: linear-gradient(to bottom, rgba(13,13,13,1) 60%, transparent);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}
.discover-tabs {
  display: flex;
  gap: 4px;
}
.dtab {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.55);
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 16px;
  border-radius: 100px;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  transition: all 0.15s ease;
}
.dtab:hover { background: rgba(255,255,255,0.14); color: rgba(255,255,255,0.8); }
.dtab.active {
  background: #fff;
  color: #0d0d0d;
  font-weight: 600;
}
.discover-create-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.discover-create-btn:hover { background: rgba(255,255,255,0.22); }

/* ---- MASONRY GRID — 2 columns, full-bleed image cards ---- */
.discover-masonry {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px 90px;
  column-count: 2;
  column-gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.discover-masonry::-webkit-scrollbar { display: none; }

.discover-loading {
  color: rgba(255,255,255,0.4);
  text-align: center;
  padding: 60px 20px;
  font-size: 14px;
  column-span: all;
}

/* ---- DCARD: full-bleed image, gradient, text overlay ---- */
.dcard {
  display: inline-block;
  width: 100%;
  margin-bottom: 8px;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  cursor: pointer;
  background-color: #1e1e1e;
  background-size: cover;
  background-position: center top;
  break-inside: avoid;
  /* Varying heights for masonry feel */
  aspect-ratio: auto;
  min-height: 220px;
  transition: transform 0.15s ease;
}
/* Alternating heights for masonry depth */
.dcard:nth-child(3n+1) { min-height: 260px; }
.dcard:nth-child(3n+2) { min-height: 210px; }
.dcard:nth-child(3n+3) { min-height: 290px; }

.dcard:active { transform: scale(0.97); }

.dcard-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: 700;
  color: rgba(255,255,255,0.2);
  background: linear-gradient(135deg, #1a1a2e, #16213e);
}

/* Dark gradient overlay — stronger at bottom for text legibility */
.dcard-grad {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 20%,
    rgba(0,0,0,0.2) 55%,
    rgba(0,0,0,0.75) 80%,
    rgba(0,0,0,0.92) 100%
  );
  border-radius: 14px;
}

/* Text overlay at bottom */
.dcard-body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 11px 12px;
  z-index: 2;
}
.dcard-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 3px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dcard-hook {
  font-size: 11.5px;
  color: rgba(255,255,255,0.75);
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.dcard-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.dcard-creator {
  font-size: 10.5px;
  color: rgba(255,255,255,0.5);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}
.dcard-count {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
  flex-shrink: 0;
}
.dcard-count svg { opacity: 0.7; }

/* ---- BOTTOM NAV (mobile-first) ---- */
.bottom-nav {
  display: none; /* desktop: hidden */
}
@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 80;
    background: rgba(13,13,13,0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 8px 0 max(12px, env(safe-area-inset-bottom));
    align-items: center;
    justify-content: space-around;
  }
}
.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 10px;
  font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  padding: 6px 20px;
  transition: color 0.15s;
}
.bnav-item.active { color: #fff; }
.bnav-item svg { opacity: 0.7; }
.bnav-item.active svg { opacity: 1; }

/* ---- BACK ARROW (replaces hamburger — transparent, only in chat) ---- */
.mobile-menu, .chat-back-btn {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 90;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(8px);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
}
@media (max-width: 768px) {
  .chat-back-btn { display: flex; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .chat-back-btn.visible { opacity: 1; pointer-events: all; }
  /* Mobile sidebar stays hidden — we use bottom nav now */
  .sidebar { display: none !important; }
  /* Main takes full width */
  .main { margin-left: 0 !important; width: 100% !important; }
  /* Extra padding for bottom nav */
  .chat-scroll { padding-bottom: 80px !important; }
  .composer-wrap { padding-bottom: max(24px, env(safe-area-inset-bottom)) !important; }
  /* Discover fills screen */
  #view-home { padding: 0 !important; }
}

/* ============================================================
   2.11.11 — ROUTING FIX (corrected): views use display toggle,
   NO position:absolute (that broke desktop by escaping flex flow).
   display:none already prevents bleed-through.
   ============================================================ */

/* Ensure main contains views properly */
.main {
  position: relative !important;
  overflow: hidden !important;
}

/* Views: hidden by default, shown via .active — NO absolute positioning.
   The base CSS (.view { display:none } / .view.active { display:flex })
   handles routing correctly. We just reinforce overflow containment. */
.view {
  display: none !important;
  flex-direction: column !important;
  overflow: hidden !important;
  flex: 1 !important;
  min-height: 0 !important;
}
.view.active {
  display: flex !important;
}

/* Discover: dark background, internal scroll */
#view-home {
  overflow: hidden !important;
  background: #0d0d0d !important;
  padding: 0 !important;
}
.discover-app {
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
  overflow: hidden !important;
}
.discover-masonry {
  flex: 1 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
}

/* Topbar stays inside discover-app flow */
.discover-topbar {
  position: relative !important;
  flex-shrink: 0;
}

/* Bottom nav: only on mobile */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 100 !important;
}

/* Mobile: sidebar hidden, main fills screen */
@media (max-width: 768px) {
  .sidebar { display: none !important; }
  .main {
    margin-left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
  }
  .chat-scroll { padding-bottom: 80px !important; }
  .discover-masonry { padding-bottom: 80px !important; }
  #view-profile { overflow-y: auto !important; }
  #view-chat-list { overflow-y: auto !important; }
  #view-account { overflow-y: auto !important; }
}

/* ============================================================
   2.11.11 — Mobile chat-list view + account view styles
   ============================================================ */

/* Mobile chat list */
#view-chat-list {
  background: #fff;
  overflow: hidden;
}
.mobile-chatlist {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.mcl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.mcl-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}
.mcl-newchat {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ink);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mcl-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 80px;
}
.mcl-empty {
  text-align: center;
  color: var(--ink-mute);
  padding: 60px 24px;
  font-size: 14px;
}
.mcl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.1s;
}
.mcl-item:hover, .mcl-item:active { background: rgba(0,0,0,0.04); }
.mcl-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #888, #444);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.mcl-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mcl-text { flex: 1; min-width: 0; }
.mcl-char { font-size: 15px; font-weight: 600; color: var(--ink); }
.mcl-preview { font-size: 13px; color: var(--ink-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* Mobile account view */
#view-account {
  background: #f4f4f5;
  overflow-y: auto;
}
.mobile-account {
  padding: 40px 24px 100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.mac-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: #fff;
  border-radius: 16px;
}
.mac-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f5d142, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  flex-shrink: 0;
  overflow: hidden;
}
.mac-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mac-info { min-width: 0; }
.mac-name { font-size: 18px; font-weight: 700; color: var(--ink); }
.mac-handle { font-size: 13px; color: var(--ink-mute); margin-top: 2px; }
.mac-actions {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
}
.mac-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.mac-btn:last-child { border-bottom: none; }
.mac-btn:hover, .mac-btn:active { background: rgba(0,0,0,0.04); }
.mac-logout {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #fff;
  border: none;
  border-radius: 16px;
  color: #c44;
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  width: 100%;
}
.mac-logout:hover, .mac-logout:active { background: rgba(196,68,68,0.06); }

/* ============================================================
   2.11.19 — c.ai-style character profile (two-column, animated)
   ============================================================ */

/* Hide every old .prof-* / .profile-* layout artifact */
.prof-banner, .prof-scroll, .prof-avatar-wrap, .prof-avatar,
.prof-meta, .prof-name, .prof-author, .prof-stats, .prof-tags,
.prof-tag, .prof-actions, .prof-chat-btn, .prof-like-btn,
.prof-edit-btn, .prof-delete-btn, .prof-tab-bar, .prof-tab,
.prof-tab-content, .prof-tagline, .prof-description, .prof-back,
.profile-modal-card, .profile-avatar, .profile-name, .profile-author,
.profile-stats, .profile-tagline, .profile-description, .profile-actions,
.profile-chat-btn, .profile-delete-btn, .profile-inner, .profile-hero,
.profile-hero-right, .profile-body, .profile-back-btn,
.profile-action-row, .profile-edit-btn, .profile-like-btn,
.profile-boost-panel, .profile-content-badge {
  display: none !important;
}

/* PROFILE VIEW — full-bleed, scrollable, light theme */
#view-profile {
  padding: 0 !important;
  overflow: hidden !important;
  background: #fff !important;
  position: relative;
}
#view-profile.active .cprof-scroll {
  animation: cprof-fade-in 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes cprof-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cprof-scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Back button — fixed in top-left, semi-transparent */
.cprof-back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 30;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.18s ease, color 0.18s ease;
}
.cprof-back:hover { background: rgba(0, 0, 0, 0.12); color: var(--ink); transform: translateX(-2px); }
.cprof-back:active { transform: scale(0.92); }

/* Two-column grid (collapses on mobile) */
.cprof-grid {
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 32px 80px;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 48px;
  align-items: flex-start;
}

/* LEFT COLUMN: identity + actions */
.cprof-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: sticky;
  top: 32px;
}
.cprof-avatar-wrap {
  position: relative;
  margin-bottom: 16px;
  animation: cprof-avatar-in 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cprof-avatar-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}
.cprof-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #888, #444);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}
.cprof-avatar:hover {
  transform: scale(1.04);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.18);
}
.cprof-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.cprof-avatar span { color: #fff; font-size: 54px; font-weight: 700; }

.cprof-name {
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.02em;
  animation: cprof-slide-up 360ms 60ms backwards ease;
}
.cprof-author {
  font-size: 14px;
  color: var(--ink-mute);
  margin-bottom: 18px;
  animation: cprof-slide-up 360ms 120ms backwards ease;
}
@keyframes cprof-slide-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Action row: Chat + thumbs/share */
.cprof-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  animation: cprof-slide-up 360ms 180ms backwards ease;
}
.cprof-chat-btn {
  padding: 12px 40px;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.cprof-chat-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.cprof-chat-btn:active { transform: scale(0.96); }
/* Ripple effect */
.cprof-chat-btn::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
  transition: width 0.45s ease, height 0.45s ease, opacity 0.45s ease;
  opacity: 0;
  pointer-events: none;
}
.cprof-chat-btn:active::after {
  width: 220px; height: 220px; opacity: 1;
  transition: 0s;
}

.cprof-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-mute);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
}
.cprof-icon-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
  transform: translateY(-2px);
}
.cprof-icon-btn:active { transform: scale(0.9); }

.cprof-like-btn.liked {
  color: #3b82f6;
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  animation: cprof-like-bounce 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cprof-like-btn.liked svg { fill: #3b82f6; stroke: #3b82f6; }
.cprof-dislike-btn.disliked {
  color: #ef4444;
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}
.cprof-dislike-btn.disliked svg { fill: #ef4444; stroke: #ef4444; }
@keyframes cprof-like-bounce {
  0%   { transform: scale(0.9); }
  40%  { transform: scale(1.2); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.cprof-share-btn.copied { color: #10b981; border-color: #10b981; background: rgba(16, 185, 129, 0.08); }

/* Owner-only actions row */
.cprof-owner-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.cprof-owner-actions:empty { display: none; }
.cprof-edit-btn, .cprof-delete-btn {
  padding: 7px 16px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink-soft);
  transition: all 0.18s ease;
}
.cprof-edit-btn:hover { background: rgba(0, 0, 0, 0.04); color: var(--ink); }
.cprof-delete-btn { color: #c44; border-color: rgba(196, 68, 68, 0.3); }
.cprof-delete-btn:hover { background: rgba(196, 68, 68, 0.06); border-color: #c44; }

/* Boost panel */
.cprof-boost-panel {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 16px;
  width: 100%;
  max-width: 320px;
}
.cprof-boost-panel .boost-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.cprof-boost-panel .boost-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px;
}
.cprof-boost-panel input {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
  min-width: 0;
}
.cprof-boost-panel .boost-btn {
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

/* Stats — stacked vertically with icons */
.cprof-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  margin: 8px 0 16px;
  animation: cprof-slide-up 360ms 240ms backwards ease;
}
.cprof-stats .cps-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}
.cprof-stats .cps-item svg { opacity: 0.55; flex-shrink: 0; }
.cprof-stats .cps-item strong { font-weight: 700; color: var(--ink); }

/* Tags */
.cprof-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 16px;
  animation: cprof-slide-up 360ms 280ms backwards ease;
}
.cprof-tags:empty { display: none; }
.cprof-tag {
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.05);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background 0.18s ease, transform 0.18s ease;
}
.cprof-tag:hover { background: rgba(0, 0, 0, 0.08); transform: translateY(-1px); }
.cprof-tag-ai { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.cprof-tag-ai:hover { background: rgba(59, 130, 246, 0.16); }

/* Description block */
.cprof-description-block {
  width: 100%;
  text-align: left;
  animation: cprof-slide-up 360ms 320ms backwards ease;
}
.cprof-tagline {
  font-size: 15px;
  font-weight: 500;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 12px;
  line-height: 1.5;
}
.cprof-tagline:empty { display: none; }
.cprof-description {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-soft);
  white-space: pre-wrap;
}

/* RIGHT COLUMN: tabs */
.cprof-right {
  min-width: 0;
  animation: cprof-slide-up 360ms 200ms backwards ease;
}
.cprof-tab-nav {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--line);
  position: relative;
  margin-bottom: 24px;
}
.cprof-tab {
  padding: 12px 0;
  background: transparent;
  border: none;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-mute);
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  position: relative;
  transition: color 0.22s ease;
}
.cprof-tab:hover { color: var(--ink-soft); }
.cprof-tab.active { color: var(--ink); }
.cprof-tab-indicator {
  position: absolute;
  bottom: -1px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: left 0.32s cubic-bezier(0.65, 0, 0.35, 1),
              width 0.32s cubic-bezier(0.65, 0, 0.35, 1);
  pointer-events: none;
}

.cprof-panels { position: relative; }
.cprof-panel {
  display: none;
  animation: cprof-panel-in 320ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cprof-panel.active { display: block; }
@keyframes cprof-panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cprof-section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}

/* Chat starter cards */
.cprof-starters {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cprof-starter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  text-align: left;
  font-family: 'Inter', system-ui, sans-serif;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  animation: cprof-card-in 380ms cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}
.cprof-starter-card:nth-child(1) { animation-delay: 60ms; }
.cprof-starter-card:nth-child(2) { animation-delay: 120ms; }
.cprof-starter-card:nth-child(3) { animation-delay: 180ms; }
.cprof-starter-card:nth-child(4) { animation-delay: 240ms; }
@keyframes cprof-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cprof-starter-card:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: var(--line-strong);
  transform: translateX(2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}
.cprof-starter-card:active { transform: scale(0.98); }
.cprof-starter-card .cps-arrow {
  color: var(--ink-mute);
  flex-shrink: 0;
  transition: transform 0.22s ease, color 0.22s ease;
}
.cprof-starter-card:hover .cps-arrow {
  transform: translateX(4px);
  color: var(--ink);
}

/* Similar character rows */
.cprof-similar {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cprof-sim-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
  animation: cprof-card-in 360ms cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}
.cprof-sim-item:nth-child(1) { animation-delay: 60ms; }
.cprof-sim-item:nth-child(2) { animation-delay: 110ms; }
.cprof-sim-item:nth-child(3) { animation-delay: 160ms; }
.cprof-sim-item:nth-child(4) { animation-delay: 210ms; }
.cprof-sim-item:nth-child(5) { animation-delay: 260ms; }
.cprof-sim-item:hover { background: rgba(0, 0, 0, 0.035); }
.cprof-sim-item:active { transform: scale(0.99); }
.cprof-sim-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #888, #444);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}
.cprof-sim-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.cprof-sim-body { flex: 1; min-width: 0; }
.cprof-sim-name {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cprof-sim-tagline {
  font-size: 12.5px;
  color: var(--ink-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.cprof-sim-stat {
  font-size: 11.5px;
  color: var(--ink-mute);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cprof-sim-chat {
  padding: 7px 18px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.cprof-sim-chat:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.cprof-sim-chat:active { transform: scale(0.94); }

.cprof-empty {
  padding: 30px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-mute);
}

/* ============================================================
   MOBILE — collapse to single column, restack content
   ============================================================ */
@media (max-width: 768px) {
  .cprof-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 56px 18px 100px;
  }
  .cprof-left {
    position: static;
    top: auto;
  }
  .cprof-avatar { width: 112px; height: 112px; }
  .cprof-avatar span { font-size: 44px; }
  .cprof-name { font-size: 24px; }
  .cprof-author { margin-bottom: 14px; }
  .cprof-chat-btn { padding: 11px 32px; font-size: 14px; }
  .cprof-icon-btn { width: 38px; height: 38px; }
  .cprof-stats { align-items: center; }
  .cprof-description-block { text-align: left; }
  .cprof-back {
    top: 12px;
    left: 12px;
    width: 34px;
    height: 34px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--line);
  }
  .cprof-tab-nav { gap: 20px; }
  .cprof-tab { font-size: 14px; }
  .cprof-sim-avatar { width: 48px; height: 48px; font-size: 18px; }
  .cprof-sim-name { font-size: 14px; }
  .cprof-starter-card { padding: 14px 16px; font-size: 13.5px; }
}

/* Tiny phones */
@media (max-width: 380px) {
  .cprof-grid { padding: 52px 14px 100px; }
  .cprof-actions { gap: 8px; }
  .cprof-chat-btn { padding: 10px 26px; }
  .cprof-sim-tagline { display: none; }
}

/* --- DISCOVERY GRID: CSS Grid instead of column-count (fixes mobile truncation) --- */
.discover-masonry {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr) !important;
  gap: 8px !important;
  column-count: unset !important;
  padding: 0 8px 90px !important;
}
@media (min-width: 900px) {
  .discover-masonry { grid-template-columns: repeat(3, 1fr) !important; }
}
@media (min-width: 1200px) {
  .discover-masonry { grid-template-columns: repeat(4, 1fr) !important; }
}
@media (min-width: 1600px) {
  .discover-masonry { grid-template-columns: repeat(5, 1fr) !important; }
}
/* Cards no longer need inline-block/break-inside for masonry */
.dcard {
  display: block !important;
  width: auto !important;
  break-inside: unset !important;
}

/* ============================================================
   2.11.15 — Fix blank mobile views + robust layout
   ============================================================ */

/* Force mobile views to fill their parent with flex, not height:100% */
.mobile-chatlist {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 !important;
  height: auto !important;
  min-height: 0 !important;
}
.mobile-account {
  flex: 1 !important;
  overflow-y: auto !important;
}
/* Ensure the mcl-list fills remaining space */
.mcl-list {
  flex: 1 !important;
  overflow-y: auto !important;
  min-height: 0 !important;
}
/* Empty state must be visible regardless */
.mcl-empty {
  padding: 60px 24px !important;
  text-align: center !important;
  color: var(--ink-mute) !important;
  font-size: 15px !important;
}

/* Ensure views have proper background for visibility */
#view-chat-list {
  background: #fff !important;
}
#view-account {
  background: #f4f4f5 !important;
}

/* 2.11.16: chat-intro visible on ALL screens — character image belongs in chat */

/* 2.11.17: focal-point crop for all character avatars */
.cli-avatar img,
.mcl-avatar img,
.cch-avatar img {
  object-position: center 20% !important;
}

/* 2.11.18: chat list timestamp + row layout */
.mcl-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.mcl-time {
  font-size: 11px;
  color: var(--ink-mute);
  white-space: nowrap;
  flex-shrink: 0;
}
.mcl-avatar {
  width: 48px !important;
  height: 48px !important;
}
.mcl-item {
  padding: 14px 20px !important;
  border-bottom: 1px solid var(--line);
}
.mcl-preview {
  color: var(--ink-mute) !important;
  font-size: 13px !important;
  margin-top: 3px !important;
}

/* ============================================================
   2.11.20 — Admin Users panel: scrolling + refresh button
   ============================================================ */

/* Override the global .view{overflow:hidden!important} for users only */
#view-users {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  -webkit-overflow-scrolling: touch;
  padding: 0 !important;
}
.users-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 28px 96px;
  width: 100%;
}

/* Header row with refresh button on the right */
.users-header-row {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px;
  flex-wrap: wrap;
}
.users-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
  flex-shrink: 0;
}
.users-refresh-btn:hover { background: rgba(0,0,0,0.04); border-color: var(--ink); }
.users-refresh-btn:active { transform: scale(0.96); }
.users-refresh-btn svg { transition: transform 0.3s ease; }
.users-refresh-btn:hover svg { transform: rotate(-30deg); }
.users-refresh-btn.spinning svg {
  animation: users-spin 0.9s linear infinite;
}
@keyframes users-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Make the table itself horizontally scrollable on narrow widths */
.users-table-wrap {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .users-inner { padding: 24px 16px 100px; }
  .users-header-row { gap: 10px; }
  .users-refresh-btn { padding: 7px 12px; font-size: 12.5px; }
  .users-refresh-btn span { display: none; } /* icon-only on mobile */
}


/* ============================================================
   2.11.20 — Discover: c.ai-style welcome + search + sections
   Desktop (>=769px): header (welcome + search) + stacked rails.
   Mobile  (<=768px): existing tabs + masonry + a search button.
   ============================================================ */

.dsearch-input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: #fff; font-size: 14px;
  font-family: 'Inter', system-ui, sans-serif;
}
.dsearch-input::placeholder { color: rgba(255,255,255,0.4); }
.dsearch-icon { color: rgba(255,255,255,0.5); flex-shrink: 0; }
.dsearch-clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; padding: 0;
  background: rgba(255,255,255,0.1); border: none; color: rgba(255,255,255,0.7);
  cursor: pointer; flex-shrink: 0;
}
.dsearch-clear:hover { background: rgba(255,255,255,0.2); color: #fff; }
.dsearch-clear[hidden] { display: none; }

/* DESKTOP header */
.discover-header {
  display: none; /* shown on desktop only */
  align-items: center; gap: 16px;
  padding: 20px 26px 14px; flex-shrink: 0;
  font-family: 'Inter', system-ui, sans-serif;
}
.discover-welcome { display: flex; flex-direction: column; line-height: 1.15; flex-shrink: 0; }
.dwelcome-label { font-size: 13px; color: rgba(255,255,255,0.45); font-weight: 500; }
.dwelcome-name { font-size: 22px; font-weight: 700; color: #fff; }
.discover-search {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px; padding: 10px 16px; max-width: 560px; margin-left: auto;
  transition: border-color 0.15s, background 0.15s;
}
.discover-search:focus-within { border-color: rgba(255,255,255,0.22); background: rgba(255,255,255,0.12); }
.discover-create-desktop { display: none; }

/* MOBILE topbar actions */
.discover-topbar-actions { display: flex; align-items: center; gap: 8px; }
.discover-search-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: background 0.15s; flex-shrink: 0;
}
.discover-search-btn:hover, .discover-search-btn.active { background: rgba(255,255,255,0.24); }

/* MOBILE search bar */
.discover-search-mobile {
  display: flex; align-items: center; gap: 9px;
  margin: 0 14px 8px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 100px; padding: 9px 14px; flex-shrink: 0;
}
.discover-search-mobile[hidden] { display: none; }

/* DESKTOP sections / rails */
.discover-sections {
  display: none; /* shown on desktop only */
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 26px 40px;
}
.discover-sections::-webkit-scrollbar { width: 10px; }
.discover-sections::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 8px; }
.dsection { margin-bottom: 26px; }
.dsection-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.dsection-title { font-size: 18px; font-weight: 700; color: #fff; margin: 0; }
.dsection-rail {
  display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden;
  padding-bottom: 6px; scroll-snap-type: x proximity;
}
.dsection-rail::-webkit-scrollbar { height: 8px; }
.dsection-rail::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 8px; }
.dcard-rail {
  flex: 0 0 auto; width: 188px; min-height: 250px !important;
  margin-bottom: 0 !important; scroll-snap-align: start; display: block;
}

/* SEARCH results */
.discover-results { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.discover-results-head { padding: 14px 26px 8px; flex-shrink: 0; }
.discover-results-label { color: rgba(255,255,255,0.7); font-size: 14px; font-weight: 500; }
.discover-results-grid {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 0 16px 90px; column-count: 2; column-gap: 10px;
}
.discover-results-grid::-webkit-scrollbar { display: none; }
.discover-results-grid .dcard { margin-bottom: 10px; }

/* SEARCH state — hide normal content, show results */
.discover-app.is-searching .discover-sections,
.discover-app.is-searching #characterGrid,
.discover-app.is-searching .discover-tabs { display: none !important; }
.discover-app.is-searching .discover-results { display: flex !important; }

/* responsive switch */
@media (min-width: 769px) {
  .discover-header { display: flex; }
  .discover-sections { display: block; }
  #characterGrid { display: none !important; }
  .discover-topbar { display: none !important; }
  .discover-search-mobile { display: none !important; }
  .discover-results-grid { column-count: 4; padding: 0 26px 40px; }
}
@media (max-width: 768px) {
  .discover-header { display: none !important; }
  .discover-sections { display: none !important; }
  .discover-results-head { padding: 12px 14px 8px; }
}

/* ============================================================
   2.11.21 — Fix desktop discover blank cards + admin view scroll
   Root cause #1: the 2.11.13 masonry retrofit (.dcard { width: auto !important })
   beat my 2.11.20 .dcard-rail width with no !important — desktop rail cards
   collapsed to ~zero. Override with !important.
   Root cause #2: .view { overflow: hidden !important } from 2.11.11 wasn't
   exempted for admin content views (evals/memory/etc) so they couldn't scroll.
   ============================================================ */

/* Rail container — guarantee height so cards always have somewhere to live */
.dsection-rail {
  min-height: 260px;
  align-items: stretch;
}

/* Rail cards — beat the masonry !important block above */
.dcard-rail {
  display: block !important;
  width: 188px !important;
  flex: 0 0 188px !important;
  height: 250px !important;
  min-height: 250px !important;
  break-inside: unset !important;
  scroll-snap-align: start;
}

/* Search-results grid cards — same fix so search results show on desktop too */
.discover-results-grid .dcard {
  display: block !important;
  width: auto !important;
  break-inside: avoid !important;
}

/* Admin content views — escape the .view { overflow: hidden !important } cage
   so long forms (evals, memory, customize, etc.) can scroll. Mirrors the
   2.11.11 exception list (profile / chat-list / account). */
#view-evals,
#view-memory,
#view-customize,
#view-reminders,
#view-sessions,
#view-users {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* ============================================================
   2.11.22 — Desktop "create character" button + admin analytics
   ============================================================ */

/* Desktop create button — was display:none on web (couldn't find the +).
   Show it as a labelled pill in the discover header. */
.discover-create-desktop span { display: inline; }
@media (min-width: 769px) {
  .discover-create-desktop {
    display: inline-flex !important;
    align-items: center;
    width: auto;
    height: 40px;
    gap: 7px;
    padding: 0 18px 0 15px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    white-space: nowrap;
  }
}

/* live activity */
.usc-val.usc-live { color: #1e8e54; }
.live-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #2ecc71; margin-left: 7px; vertical-align: middle;
  animation: livePulse 1.8s infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(46,204,113,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(46,204,113,0); }
  100% { box-shadow: 0 0 0 0 rgba(46,204,113,0); }
}

/* table cell helpers */
.metric-sub { color: var(--ink-mute); font-size: 11px; }
.topchar { font-weight: 600; }
.user-row { cursor: pointer; }
.user-row:hover { background: rgba(0,0,0,0.02); }
.user-row.expanded { background: rgba(175,139,71,0.06); }
.user-expand-caret { display: inline-block; width: 12px; color: var(--ink-mute); font-size: 10px; margin-right: 2px; }

/* return badges */
.return-cell { white-space: nowrap; }
.ret-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 6px; margin-right: 3px; }
.ret-yes { background: rgba(46,204,113,0.14); color: #1e8e54; }
.ret-no  { background: rgba(0,0,0,0.05); color: var(--ink-mute); }
.ret-pct { font-weight: 700; }
.ret-pct.ret-yes { color: #1e8e54; background: transparent; }
.ret-pct.ret-no  { color: var(--ink-mute); background: transparent; }

/* expandable user detail */
.user-detail-row > td { background: rgba(175,139,71,0.05); padding: 0; }
.user-detail { padding: 16px 18px 18px 40px; display: flex; gap: 28px; flex-wrap: wrap; }
.udc-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 22px; flex: 1 1 340px; }
.udc-metric { display: flex; flex-direction: column; gap: 2px; }
.udc-k { font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.03em; }
.udc-v { font-size: 15px; font-weight: 600; }
.udc-chars { flex: 1 1 280px; min-width: 240px; }
.udc-chars-title { font-size: 11px; color: var(--ink-mute); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px; }
.udc-char { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.udc-char:last-child { border-bottom: none; }
.udc-char-name { font-weight: 600; }
.udc-char-msgs { font-size: 12px; color: var(--ink-mute); white-space: nowrap; }
.udc-empty { color: var(--ink-mute); font-size: 13px; }

/* platform-wide characters section */
.users-characters { margin-top: 34px; }
.users-characters .uc-h2 { font-size: 22px; }
.users-char-table th, .users-char-table td { text-align: left; }

/* ============================================================
   2.11.23 — Daily cap: earn modal + reward card
   ============================================================ */
.earn-card { max-width: 460px; width: 100%; position: relative; }
.earn-title { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.earn-sub { color: var(--ink-mute); font-size: 14px; margin: 0 0 18px; }
.earn-sub strong { color: var(--ink); }

.earn-row { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.earn-row:first-of-type { border-top: none; }
.earn-row-icon {
  flex-shrink: 0; width: 38px; height: 38px; border-radius: 10px;
  background: var(--cream); display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.earn-row-body { flex: 1; min-width: 0; }
.earn-row-title { font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.earn-row-desc { color: var(--ink-mute); font-size: 13px; line-height: 1.4; margin-bottom: 10px; }

.earn-link-row { display: flex; gap: 8px; margin-bottom: 8px; }
.earn-link-input {
  flex: 1; min-width: 0; font-size: 13px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--cream);
  color: var(--ink); font-family: 'Inter', system-ui, sans-serif;
}
.earn-copy-btn { padding: 9px 16px !important; font-size: 13px !important; white-space: nowrap; }
.earn-share-btn {
  display: inline-block; font-size: 13px; font-weight: 500; color: var(--amber);
  background: none; border: none; cursor: pointer; padding: 4px 0; text-decoration: none;
}
.earn-share-btn:hover { text-decoration: underline; }
.earn-x-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.earn-claim-btn { padding: 8px 14px !important; font-size: 13px !important; }
.earn-x-done { color: #1e8e54; font-size: 13px; font-weight: 600; margin-top: 8px; }
.earn-foot { color: var(--ink-mute); font-size: 12px; text-align: center; margin: 16px 0 0; }

/* reward celebration card */
.reward-card { max-width: 380px; width: 100%; text-align: center; padding: 30px 26px 24px; }
.reward-burst { font-size: 46px; line-height: 1; margin-bottom: 10px; animation: rewardPop 0.45s ease; }
@keyframes rewardPop {
  0% { transform: scale(0.4); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}
.reward-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; line-height: 1.25; }
.reward-sub { color: var(--ink-mute); font-size: 14px; margin: 0 0 20px; }
.reward-actions { display: flex; gap: 10px; }
.reward-actions button { flex: 1; }

/* daily-cap inline notice reuses .quota-notice (already styled) */

/* ============================================================
   2.11.24 — Away-message opt-out toggle (account view)
   ============================================================ */
.mac-notify {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 15px 18px; background: var(--cream); border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 14px; text-align: left;
}
.mac-notify-title { font-weight: 600; font-size: 14px; }
.mac-notify-desc { font-size: 12.5px; color: var(--ink-mute); margin-top: 2px; line-height: 1.45; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track { position: absolute; inset: 0; background: #cfc7b6; border-radius: 100px; transition: background .18s; }
.switch-track::before {
  content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .18s;
}
.switch input:checked + .switch-track { background: var(--amber); }
.switch input:checked + .switch-track::before { transform: translateX(20px); }

/* ============================================================
   2.11.25 — Gamified usage card + admin usage/activity dashboard
   ============================================================ */
.usage-card {
  background: var(--cream); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 14px; text-align: left;
}
.usage-card-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.usage-card-title { font-size: 13px; font-weight: 600; color: var(--ink-mute); text-transform: uppercase; letter-spacing: .04em; }
.usage-card-count { font-size: 22px; font-weight: 700; color: var(--ink); }
.usage-bar { height: 10px; border-radius: 100px; background: #e7ddc9; overflow: hidden; }
.usage-bar-fill { height: 100%; width: 0%; background: var(--amber); border-radius: 100px; transition: width .4s ease; }
.usage-bar-fill.usage-bar-low { background: #d6743f; }
.usage-sub { font-size: 12.5px; color: var(--ink-mute); margin-top: 8px; }
.usage-card.usage-card-low .usage-card-count { color: #c25a2c; }
.usage-earn-btn {
  margin-top: 12px; width: 100%; padding: 10px; border-radius: 100px; border: none; cursor: pointer;
  background: var(--amber); color: #fff; font-weight: 600; font-size: 14px;
  font-family: 'Inter', system-ui, sans-serif;
}
.usage-earn-btn:hover { filter: brightness(1.05); }

/* admin: daily-usage pill in the row */
.today-pill {
  display: inline-block; margin-top: 4px; font-size: 11px; font-weight: 600;
  color: var(--amber); background: rgba(175,139,71,0.12); padding: 2px 8px; border-radius: 6px;
}
.today-pill.today-pill-out { color: #c25a2c; background: rgba(194,90,44,0.12); }

/* admin detail dashboard: usage bar + activity chart */
.udc-side { flex: 1 1 300px; min-width: 250px; display: flex; flex-direction: column; gap: 18px; }
.udc-usage-bar { height: 9px; border-radius: 100px; background: #e7ddc9; overflow: hidden; margin-bottom: 6px; }
.udc-usage-fill { height: 100%; background: var(--amber); border-radius: 100px; }
.udc-usage-label { font-size: 12px; color: var(--ink-mute); }
.udc-usage-label strong { color: var(--ink); }
.tod-chart { display: flex; align-items: flex-end; gap: 10px; height: 64px; margin-bottom: 8px; }
.tod-bar { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.tod-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.tod-bar-fill { width: 100%; background: #d8cbb0; border-radius: 5px 5px 0 0; min-height: 4px; }
.tod-bar-fill.tod-peak { background: var(--amber); }
.tod-bar-label { font-size: 10px; color: var(--ink-mute); margin-top: 5px; }
