/* ============================================
   AVA Casuscreator — Prototype styles
   Clean modern aesthetic (Linear / Notion / Vercel)
   ============================================ */

:root {
  /* surface — warm paper tones */
  --bg: #f4f1ea;
  --surface: #fbfaf6;
  --surface-2: #ece7da;
  --surface-3: #e3ddcc;
  --hover: #efe9da;
  --selected: #ecdfc4;

  /* border */
  --border: #d9d2bf;
  --border-strong: #c0b7a0;
  --border-inset: rgba(60, 50, 20, 0.06);

  /* ink — slightly warmer, less cool */
  --ink: #221f1a;
  --ink-2: #4a4540;
  --ink-3: #7a7468;
  --ink-4: #a8a193;

  /* accent — terracotta orange (warmer than vercel orange) */
  --accent: #d96b1e;
  --accent-hover: #b8541a;
  --accent-soft: #f7e7d3;
  --accent-soft-2: #efd1a8;
  --accent-fg: #8a3d10;

  /* signal */
  --ok: #5a7a3a;
  --ok-soft: #e8edd4;
  --warn: #b87a1a;
  --warn-soft: #f4e3c4;
  --danger: #b53a2a;
  --danger-soft: #f4d8d2;
  --info: #3a6a8a;
  --info-soft: #dce8ef;

  /* shadow — softer, warmer */
  --shadow-sm: 0 1px 2px rgba(70, 50, 20, 0.04);
  --shadow: 0 2px 6px rgba(70, 50, 20, 0.05), 0 0 0 1px var(--border);
  --shadow-lg: 0 12px 32px -8px rgba(70, 50, 20, 0.14), 0 4px 8px rgba(70, 50, 20, 0.04);

  /* radius */
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;

  /* font */
  --ui: 'Geist', 'Inter Tight', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
  --hand: 'Caveat', 'Kalam', 'Geist', cursive;

  /* layout */
  --sidebar-w: 248px;
  --topbar-h: 52px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

button { font-family: inherit; }
input, textarea { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* =========== App shell =========== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-head {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}
.sidebar-head .logo {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.02em;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}
.sidebar-head .logo:hover { opacity: 0.85; }
.sidebar-head .name { font-weight: 600; font-size: 13px; }
.sidebar-settings-btn {
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 5px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-settings-btn:hover { background: var(--hover); opacity: 1 !important; }
.sidebar-head .meta { font-size: 11px; color: var(--ink-3); margin-top: -2px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.nav-section { margin-bottom: 4px; }
.nav-label {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 12px 8px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--selected); color: var(--ink); font-weight: 500; }
.nav-item .ico {
  width: 16px; height: 16px;
  flex-shrink: 0;
  color: var(--ink-3);
}
.nav-item.active .ico { color: var(--accent); }
.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.nav-divider { height: 1px; background: var(--border); margin: 8px 4px; }

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  flex: 1;
  cursor: pointer;
}
.user-chip:hover { background: var(--hover); }
.avatar-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.avatar-dot.m { background: #6366f1; }
.avatar-dot.k { background: #0891b2; }
.avatar-dot.s { background: #16a34a; }
.user-chip .name { font-size: 12px; font-weight: 500; }
.user-chip .org { font-size: 11px; color: var(--ink-3); }

/* Main pane */
.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  flex-shrink: 0;
}
.crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px;
  color: var(--ink-3);
}
.crumbs .sep { color: var(--ink-4); }
.crumbs .current { color: var(--ink); font-weight: 500; }
.topbar-spacer { flex: 1; }
.collab-stack { display: flex; align-items: center; }
.collab-stack .avatar-dot {
  width: 26px; height: 26px;
  border: 2px solid var(--surface);
  margin-left: -8px;
  font-size: 11px;
}
.collab-stack .avatar-dot:first-child { margin-left: 0; }

.content {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--bg);
}

/* =========== Buttons =========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: all 80ms ease;
  line-height: 1.2;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}
.btn.primary:hover { background: #000; border-color: #000; }
.btn.accent {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.sm { padding: 4px 9px; font-size: 12px; gap: 5px; }
.btn.xs { padding: 2px 7px; font-size: 11px; gap: 4px; border-radius: 5px; }
.btn .kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  padding: 0 4px;
  color: var(--ink-3);
  font-weight: 400;
}
.btn.primary .kbd { background: rgba(255,255,255,0.15); border-color: transparent; color: rgba(255,255,255,0.8); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* =========== Chip / Badge =========== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  line-height: 1.5;
}
.chip.accent { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent-fg); }
.chip.ok { background: var(--ok-soft); border-color: #bbf7d0; color: #166534; }
.chip.warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; }
.chip.danger { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.chip.info { background: var(--info-soft); border-color: #bfdbfe; color: #1e40af; }
.chip.muted { background: transparent; }
.chip .dot {
  width: 6px; height: 6px; border-radius: 99px;
  background: currentColor;
  opacity: 0.7;
}
.chip.live .dot { background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* =========== Icons (lucide-style stroke) =========== */
.ico-svg {
  width: 16px; height: 16px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* =========== Home (library) =========== */
.home-wrap { padding: 28px 32px 80px; max-width: 1180px; margin: 0 auto; }
.home-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.home-head h1 { margin: 0; font-family: var(--hand); font-size: 40px; font-weight: 600; letter-spacing: 0; line-height: 1; }
.home-head .lede { font-size: 13px; color: var(--ink-3); margin-top: 4px; }

.home-toolbar {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 18px;
}
.search-input {
  flex: 1; max-width: 360px;
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  color: var(--ink-3);
}

.filter-tabs {
  display: flex; gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.filter-tab {
  background: transparent; border: none;
  padding: 8px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  display: flex; align-items: center; gap: 6px;
}
.filter-tab:hover { color: var(--ink-2); }
.filter-tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.filter-tab .num {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--ink-3);
}
.filter-tab.active .num { background: var(--ink); color: var(--surface); }

.casus-list {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.casus-row {
  display: grid;
  grid-template-columns: 28px 1fr 120px 110px 110px 26px;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 80ms;
}
.casus-row:first-child { border-top: none; }
.casus-row:hover { background: var(--hover); }
.casus-row .nm { font-size: 13px; font-weight: 500; }
.casus-row .rl { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.casus-row .when { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.casus-row .progress-mini {
  display: flex; gap: 2px;
}
.casus-row .progress-mini .seg {
  width: 14px; height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.casus-row .progress-mini .seg.done { background: var(--ink); }
.casus-row .progress-mini .seg.active { background: var(--accent); }

.silhouette {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.silhouette svg { width: 100%; height: 100%; display: block; }

/* =========== Empty state =========== */
.empty-wrap {
  min-height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 32px;
  text-align: center;
}
.empty-greet {
  font-family: var(--hand);
  font-size: 56px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  margin: 0 0 12px;
}
.empty-greet .em { color: var(--accent); }
.empty-lede {
  font-size: 14px;
  color: var(--ink-3);
  max-width: 460px;
  line-height: 1.6;
  margin: 0 0 32px;
}
.empty-input {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: border-color 100ms;
}
.empty-input:focus-within {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}
.empty-input input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--ink);
  padding: 0;
}
.empty-input input::placeholder { color: var(--ink-4); }
.empty-input .actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.empty-input .hint { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }

.empty-examples {
  display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  max-width: 580px;
}
.example-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 80ms;
}
.example-chip:hover { background: var(--hover); border-color: var(--border-strong); }

/* =========== Interview (chat + card) =========== */
.interview {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Chat */
.chat-pane {
  display: flex; flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}
.chat-head {
  padding: 14px 24px 6px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.chat-head .ctx-title { font-size: 13px; font-weight: 500; }
.chat-head .ctx-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

.chat-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 24px 16px;
}
.chat-scroll .inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  gap: 16px;
}

.msg {
  display: flex; gap: 10px;
  animation: slideIn 200ms ease forwards;
}
@keyframes slideIn {
  from { transform: translateY(6px); }
  to { transform: translateY(0); }
}
.msg.user { flex-direction: row-reverse; }
.msg .ava {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  flex-shrink: 0;
}
.msg.ai .ava {
  background: var(--accent);
  color: white;
}
.msg .bubble {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.msg.ai .bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.msg.user .bubble {
  background: var(--ink);
  color: var(--surface);
  border-top-right-radius: 4px;
}
.msg .bubble .meta {
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 6px;
  display: flex; align-items: center; gap: 6px;
}
.msg.user .bubble .meta { color: rgba(255,255,255,0.55); }
.msg .bubble b { font-weight: 600; }
.msg .bubble i { font-style: italic; }

.msg.system {
  align-self: center;
}
.msg.system .bubble {
  background: transparent;
  border: 1px dashed var(--border-strong);
  font-size: 12px;
  color: var(--ink-3);
  border-radius: 999px;
  padding: 4px 12px;
}

.typing-dots {
  display: inline-flex; gap: 3px; align-items: center;
  padding: 0 4px;
}
.typing-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ink-3);
  animation: typing 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* Suggestion drawer (variant) */
.sugg-drawer {
  margin-left: 36px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  max-width: 92%;
  animation: slideIn 200ms ease forwards;
}
.sugg-drawer .lbl {
  font-family: var(--hand);
  font-size: 18px;
  color: var(--accent-fg);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px;
  line-height: 1;
}
.sugg-drawer .lbl .sparkle { font-size: 14px; }
.sugg-drawer .actions {
  display: flex; gap: 6px; margin-top: 10px;
}

/* Suggestion chips (variant) */
.sugg-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-left: 36px;
  max-width: 92%;
  animation: slideIn 200ms ease forwards;
}
/* Standalone sugg-chip used in quick-reply row */
.sugg-chip {
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 100ms;
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
}
.sugg-chips .sugg-chip {
  background: var(--warn-soft);
  border-color: #fde68a;
  color: #92400e;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 100ms;
  font-family: inherit;
}
.sugg-chips .sugg-chip:hover {
  background: #fde68a;
  border-color: #f59e0b;
  color: #78350f;
}

/* Chat input */
.chat-input-wrap {
  flex-shrink: 0;
  padding: 8px 24px 18px;
  background: var(--bg);
}
.chat-input {
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 100ms;
}
.chat-input:focus-within {
  border-color: var(--ink-3);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.04);
}
.chat-input .quick {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}
.chat-input .row {
  display: flex; align-items: flex-end; gap: 8px;
}
.chat-input textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 4px 0;
  min-height: 24px;
  max-height: 120px;
  line-height: 1.5;
  overflow-y: hidden;
}
.chat-input textarea::placeholder { color: var(--ink-4); }
.persona-summary {
  font-style: italic;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
  padding: 8px 12px;
  border-left: 2px solid var(--accent);
  margin: 8px 0;
}

/* Ghost text in input */
.ghost-input {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  padding: 4px 0;
  cursor: text;
  min-height: 24px;
}
.ghost-input .typed { color: var(--ink); }
.ghost-input .ghost {
  color: var(--ink-4);
  font-style: italic;
}
.ghost-input .ghost-kbd {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  font-style: normal;
  vertical-align: 2px;
}

.chat-input .icon-btn {
  width: 30px; height: 30px;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-input .icon-btn:hover { background: var(--hover); }
.chat-input .icon-btn.send {
  background: var(--ink); color: white; border-color: var(--ink);
}
.chat-input .icon-btn.send[disabled] { background: var(--surface-2); border-color: var(--border); color: var(--ink-4); }

.chat-input-foot {
  max-width: 720px;
  margin: 6px auto 0;
  font-size: 11px; color: var(--ink-4);
  font-family: var(--mono);
  letter-spacing: 0.02em;
  display: flex; justify-content: space-between;
}

/* Card pane */
.card-pane {
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.card-pane .ph {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-pane .ph-title { font-size: 13px; font-weight: 600; }
.card-pane .ph-meta { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.card-pane .pb {
  flex: 1; overflow-y: auto;
  padding: 18px;
}

.sil-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 0 12px;
}
.sil-name {
  font-family: var(--hand);
  font-size: 24px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: 0;
  line-height: 1.05;
}
.sil-role {
  font-size: 12px; color: var(--ink-3);
}

.field {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  align-items: baseline;
}
.field:last-of-type { border-bottom: none; }
.field .lbl { color: var(--ink-3); }
.field .val { color: var(--ink); line-height: 1.4; }
.field .val.empty { color: var(--ink-4); font-style: italic; font-size: 12px; }
.field.just-added {
  animation: highlight 800ms ease;
}
@keyframes highlight {
  0% { background: var(--accent-soft); }
  100% { background: transparent; }
}
.field .val .check {
  color: var(--ok);
  font-size: 11px;
  margin-left: 4px;
}
.conf-badge {
  font-size: 10px;
  opacity: 0.4;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.hexaco-pairs { display: flex; flex-direction: column; gap: 3px; }
.hexaco-pair  { display: flex; flex-direction: column; gap: 0; }
.hexaco-dim   { font-size: 10px; opacity: 0.5; text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.3; }
.hexaco-trait { font-size: 12.5px; line-height: 1.4; }

.sec {
  font-family: var(--hand);
  font-size: 17px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  margin: 18px 0 8px;
  display: flex; align-items: center; gap: 10px;
  line-height: 1;
}
.sec::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, var(--accent-soft-2), transparent);
}

.checklist { display: flex; flex-direction: column; gap: 4px; }
.checklist .item {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 3px 0;
}
.checklist .box {
  width: 14px; height: 14px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  position: relative;
  transition: all 100ms;
}
.checklist .item.done .box { background: var(--ink); border-color: var(--ink); }
.checklist .item.done .box::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><path d='M3 7l2.5 2.5L11 4' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}
.checklist .item.active .box {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.checklist .item.done .lbl { color: var(--ink-3); }
.checklist .item.active .lbl { color: var(--ink); font-weight: 500; }
.checklist .item .partial {
  font-size: 11px; color: var(--accent);
  background: var(--accent-soft);
  padding: 0 6px;
  border-radius: 999px;
  margin-left: auto;
}

.progress-bar {
  width: 100%; height: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 4px 0 12px;
}
.progress-bar .fill {
  height: 100%; background: var(--ink);
  transition: width 300ms ease;
  border-radius: inherit;
}

/* HEXACO bars in card */
.hex {
  display: grid;
  grid-template-columns: 92px 1fr 28px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
}
.hex .bar {
  height: 5px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}
.hex .bar .fill {
  height: 100%;
  background: var(--ink);
  border-radius: inherit;
  transition: width 400ms ease;
}
.hex .val {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* =========== Modal =========== */
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(28, 25, 23, 0.4);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn 150ms ease forwards;
}
@keyframes fadeIn { from { opacity: 0.7; } to { opacity: 1; } }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 92%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 180ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes scaleIn {
  from { transform: scale(0.97); }
  to { transform: scale(1); }
}
.modal-head {
  padding: 18px 22px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  margin: 0;
  font-family: var(--hand);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}
.modal-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.5;
}
.modal-body {
  padding: 16px 22px;
  overflow-y: auto;
}
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}

.opt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.opt-card {
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  cursor: pointer;
  background: var(--surface);
  transition: all 100ms;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.opt-card:hover { border-color: var(--border-strong); background: var(--hover); }
.opt-card.checked {
  border-color: var(--ink);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--ink) inset;
}
.opt-card .opt-check {
  width: 16px; height: 16px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
}
.opt-card.checked .opt-check {
  background: var(--ink); border-color: var(--ink);
}
.opt-card.checked .opt-check::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M3.5 8l3 3 6-6' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/contain no-repeat;
}
.opt-card .opt-body { flex: 1; min-width: 0; }
.opt-card .opt-title {
  font-size: 13px; font-weight: 600;
  margin-bottom: 2px;
}
.opt-card .opt-desc {
  font-size: 12px; color: var(--ink-3);
  line-height: 1.45;
}
.opt-card .opt-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* =========== Card detail (full) =========== */
.card-detail {
  padding: 24px 32px 80px;
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}
.identity-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  text-align: center;
  height: fit-content;
  position: sticky;
  top: 16px;
}
.identity-panel .name {
  font-family: var(--hand);
  font-size: 30px; font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  margin-top: 14px;
}
.identity-panel .role {
  font-size: 12px; color: var(--ink-3);
}
.identity-panel .badges {
  display: flex; flex-wrap: wrap; gap: 4px;
  justify-content: center; margin-top: 12px;
}

.img-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.img-option {
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-2);
  aspect-ratio: 1 / 1;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-option:hover:not([disabled]) { border-color: var(--accent-soft-2); }
.img-option.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.img-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.img-option .img-placeholder {
  font-size: 11px;
  color: var(--ink-4);
}
.img-option[disabled] { opacity: 0.4; cursor: default; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
}
.detail-card.full { grid-column: 1 / -1; }
.detail-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.detail-card h3 .tag { font-size: 10px; color: var(--ink-3); font-weight: 500; }

.network {
  width: 100%; aspect-ratio: 16/8;
  position: relative;
  background: var(--bg);
  border-radius: var(--r);
  border: 1px solid var(--border);
  margin-bottom: 10px;
}
.network .node {
  position: absolute;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  color: var(--ink-2);
  transform: translate(-50%, -50%);
}
.network .node.self {
  background: var(--ink); border-color: var(--ink); color: white;
  width: 36px; height: 36px;
}
.network .edge {
  position: absolute;
  height: 1px;
  background: var(--border-strong);
  transform-origin: 0 50%;
}

/* =========== Prompt preview =========== */
.prompt-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}
.prompt-doc {
  padding: 24px 32px;
  overflow-y: auto;
}
.prompt-doc .pdoc {
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px 28px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.prompt-doc h4 {
  font-family: var(--ui);
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 18px 0 6px;
}
.prompt-doc h4:first-child { margin-top: 0; }
.prompt-doc .pdoc .hl {
  background: var(--accent-soft);
  padding: 0 4px;
  border-radius: 3px;
  color: var(--accent-fg);
}
.prompt-doc .pdoc .nm { color: var(--ink); font-weight: 600; }

.test-pane {
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  padding: 24px;
  display: flex; flex-direction: column;
  min-height: 0;
}
.test-pane .sec { margin-top: 0; }
.test-pane .chat-mini {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  overflow-y: auto;
  margin-bottom: 12px;
}

/* =========== Voice mode =========== */
.voice-overlay {
  position: absolute; inset: 0;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  z-index: 100;
}
.voice-portrait {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  margin-bottom: 28px;
}
.voice-portrait::before, .voice-portrait::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.4;
  animation: ripple 2s infinite;
}
.voice-portrait::after { animation-delay: 1s; }
@keyframes ripple {
  0% { transform: scale(1); opacity: 0.4; }
  100% { transform: scale(1.4); opacity: 0; }
}
.voice-status {
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.voice-transcript {
  font-family: var(--hand);
  font-size: 32px;
  font-weight: 500;
  max-width: 580px;
  text-align: center;
  line-height: 1.25;
  letter-spacing: 0;
  margin-bottom: 32px;
}
.voice-transcript .pending { color: var(--ink-4); }
.waveform {
  display: flex; align-items: center; gap: 3px;
  height: 36px;
  margin-bottom: 28px;
}
.waveform .bar {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 1s infinite ease-in-out;
}
@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 30px; }
}
.voice-actions { display: flex; gap: 12px; }

/* =========== Error state =========== */
.banner {
  background: var(--danger-soft);
  border: 1px solid #fca5a5;
  border-radius: var(--r);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
  color: #7f1d1d;
  margin: 12px 24px 0;
}
.banner .ico-svg { color: var(--danger); }
.banner.warn {
  background: var(--warn-soft);
  border-color: #fde68a;
  color: #78350f;
}
.banner.warn .ico-svg { color: var(--warn); }
.banner .actions { margin-left: auto; display: flex; gap: 6px; }

/* =========== Collab cursors =========== */
.collab-cursor {
  position: absolute;
  pointer-events: none;
  z-index: 50;
  transition: top 600ms ease, left 600ms ease;
}
.collab-cursor .pointer {
  width: 18px; height: 18px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 2l4 14 3-5 5-3z' fill='%236366f1' stroke='white' stroke-width='1.2'/></svg>") center/contain no-repeat;
}
.collab-cursor.k .pointer {
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M3 2l4 14 3-5 5-3z' fill='%230891b2' stroke='white' stroke-width='1.2'/></svg>") center/contain no-repeat;
}
.collab-cursor .label {
  background: #6366f1;
  color: white;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
  margin-left: 12px;
  white-space: nowrap;
}
.collab-cursor.k .label { background: #0891b2; }

.collab-presence {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid #6366f1;
  border-radius: 5px;
  font-size: 10px;
  color: #4338ca;
  padding: 1px 5px;
  font-weight: 500;
  font-family: var(--mono);
}

/* =========== Tweaks panel host overrides =========== */
.aproto-tweaks-host {
  position: fixed;
  bottom: 0; right: 0;
  z-index: 9999;
}

/* Dashed placeholder feel for empty fields in card */
.field .val.empty {
  color: var(--ink-4); font-style: italic; font-size: 12px;
  font-family: var(--hand);
  font-size: 15px;
  letter-spacing: 0;
}

/* Soft paper texture overlay on the bg */
.content {
  background-image:
    radial-gradient(circle at 20% 30%, rgba(217, 107, 30, 0.025) 0, transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(184, 90, 60, 0.02) 0, transparent 40%);
}

.sidebar-head .name { font-family: var(--hand); font-size: 17px; line-height: 1; }
.sidebar-head .logo {
  background: var(--accent);
  font-family: var(--hand);
  font-size: 20px;
  font-weight: 700;
}

/* utility */
.row-flex { display: flex; align-items: center; gap: 8px; }
.row-flex.between { justify-content: space-between; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
.h1 { font-family: var(--hand); font-size: 32px; font-weight: 600; letter-spacing: 0; line-height: 1; margin: 0; }
.h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* Reusable tooltip — add data-tooltip="text" to any element */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  font-size: 11px;
  line-height: 1.4;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms;
  z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }
