/* AFB Brain — component styles.
   Working (tool-step) blocks, citation chips, status card, email draft,
   message actions, Today's-Brief empty state, suggestion chips, unlock
   overlay, toasts. Kept faithful to ui_previews/chosen_design.html. */

/* ---------- Status card ---------- */
.status-line {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  margin: 4px 0 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 22px;
  row-gap: 4px;
  font-size: 14px;
  background: var(--surface);
}
.status-line .k {
  font-size: 11px;
  font-weight: 550;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: 1px;
}
.status-line .v { font-weight: 500; color: var(--ink); white-space: nowrap; }
.status-line .v.num { font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 500; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Citation chips ---------- */
.cites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cite {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--ink-3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 2px 8px;
  font-family: "JetBrains Mono", monospace;
  transition: color .12s ease, border-color .12s ease;
}
button.cite { cursor: pointer; }
.cite:hover { color: var(--ink-2); border-color: var(--line); }
.cite .verified { color: var(--accent); }
.cite.open { color: var(--ink-2); border-color: var(--line); }
.cite-detail {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
  padding: 10px 12px;
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-2);
}
.cite-detail .row { display: flex; gap: 8px; }
.cite-detail .row + .row { margin-top: 2px; }
.cite-detail .cd-k {
  flex: none;
  width: 74px;
  color: var(--ink-3);
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: .05em;
  font-weight: 550;
  padding-top: 2px;
}
.cite-detail .cd-v { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.cite-detail .cd-snip { font-family: "Inter", sans-serif; color: var(--ink-2); }

/* ---------- Working (tool-step) block ---------- */
.working {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  margin: 4px 0;
  overflow: hidden;
  background: var(--surface);
}
.working-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  text-align: left;
  transition: background .12s ease;
}
.working-head:hover { background: var(--bg-soft); }
.working-head .chev {
  margin-left: auto;
  color: var(--ink-3);
  transition: transform .18s ease;
}
.working.open .working-head .chev { transform: rotate(180deg); }
.working.busy .working-title { animation: shimmer-text 2s ease-in-out infinite; }
@keyframes shimmer-text { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

.working-steps {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .22s ease;
}
.working.open .working-steps { grid-template-rows: 1fr; }
.working-steps-inner { overflow: hidden; }
.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.step:first-child { border-top: 1px solid var(--line-soft); padding-top: 11px; }
.step:last-child { padding-bottom: 13px; }
.step .detail { color: var(--ink-3); font-size: 12.5px; margin-left: auto; font-family: "JetBrains Mono", monospace; }
.step.failed .detail { color: #c0492f; }
.check { width: 16px; height: 16px; color: var(--accent); }
.step-x { width: 16px; height: 16px; color: #c0492f; }
.spinner {
  width: 14px; height: 14px;
  margin: 1px;
  border: 1.5px solid var(--line);
  border-top-color: var(--ink-3);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Email draft / code block ---------- */
.draft {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 4px 0 10px;
  overflow: hidden;
  background: var(--code-bg);
}
.draft-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 14px;
  font-size: 12px;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line-soft);
  font-family: "JetBrains Mono", monospace;
}
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 500;
  font-family: "Inter", sans-serif;
  color: var(--ink-2);
  padding: 4px 9px;
  border-radius: 6px;
  transition: background .12s ease, color .12s ease;
}
.copy-btn:hover { background: var(--line-soft); color: var(--ink); }
.draft-body {
  padding: 14px 16px 16px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--ink);
}

/* ---------- Message actions (hover-revealed) ---------- */
.msg-actions {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  opacity: 0;
  transition: opacity .15s ease;
}
.msg-ai:hover .msg-actions { opacity: 1; }
.msg-actions:focus-within { opacity: 1; }
.act {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--ink-3);
  transition: background .12s ease, color .12s ease;
}
.act:hover { background: var(--bg-soft); color: var(--ink); }
.act.ok { color: var(--accent); }

/* ---------- Today's Brief (empty state) ---------- */
.brief { padding: 34px 0 8px; }
.brief-greet { font-size: 26px; font-weight: 550; letter-spacing: -.01em; color: var(--ink); }
.brief-date { margin-top: 4px; font-size: 14px; color: var(--ink-3); }
.brief-cards { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.brief-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  background: var(--surface);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.brief-card:hover { border-color: var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.04); }
[data-theme="dark"] .brief-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.brief-card .placeholder-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.brief-card .placeholder-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-3); opacity: .6;
}
.brief-card h3 { font-size: 15px; font-weight: 550; color: var(--ink); }
.brief-card p { margin-top: 3px; font-size: 13.5px; color: var(--ink-2); }
.brief-ask {
  margin-top: 11px;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 500;
  color: var(--accent);
  padding: 3px 2px;
  transition: gap .12s ease;
}
.brief-ask:hover { gap: 8px; }
.brief-ask svg { width: 13px; height: 13px; }

/* ---------- Suggestion chips ---------- */
.suggestions {
  max-width: 720px;
  margin: 0 auto 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.suggestions:empty { display: none; }
.chip {
  font-size: 13px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 99px;
  padding: 6px 13px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.chip:hover { background: var(--bg-soft); color: var(--ink); border-color: var(--ink-3); }

/* ---------- Unlock overlay ---------- */
.unlock {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}
.unlock[hidden] { display: none; }
.unlock-card {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}
.unlock-brand {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 19px; font-weight: 550; color: var(--ink);
  margin-bottom: 6px;
}
.unlock-brand .brand-mark { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
.unlock-sub { font-size: 13.5px; color: var(--ink-3); margin-bottom: 22px; }
.unlock-input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.unlock-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.unlock-btn {
  margin-top: 10px;
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  font-size: 14.5px;
  border-radius: 10px;
  padding: 11px 14px;
  transition: opacity .12s ease;
}
.unlock-btn:hover { opacity: .9; }
.unlock-btn:disabled { opacity: .5; }
.unlock-error { margin-top: 12px; font-size: 13px; color: #c0492f; }
.unlock-error[hidden] { display: none; }

/* ---------- Toasts ---------- */
.toasts {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 380px;
  background: var(--sidebar-bg);
  color: #f2f2f4;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  animation: toast-in .2s ease;
}
.toast .dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 6px; flex: none; background: #e0a03a; }
.toast.fatal .dot { background: #d9694b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
