/* Bizzpuls app — chat-first identity pass (owner request 2026-08-19).
   Changelog (rule 7, rules/00-general.md):
     2026-08-19  Claude Code  Chat-first visual pass: sidebar shell, full-height chat
                              column, onboarding tiles, Inter type, softened cards/
                              shadows/radii. All existing class hooks kept.
     2026-08-19  Claude Code  D8 task model: nav count pill, urgent badge/card, manual-task steps pane.
     2026-08-19  Claude Code  Featured-image figure on proposal cards.
     2026-08-19  Claude Code  Milestone status line for streaming chat (owner request).
     2026-08-18  Claude Code  Rendered-preview typography for approval panes (owner request).
     2026-08-18  Claude Code  M4 chat styles: chips, change cards, before/after panes.
     2026-08-18  Claude Code  Channel badge + notice hint styles (connections polish).
     2026-08-18  Claude Code  Focus ring made neutral (--focus) — red accent on a
                              focused empty input read as a validation error (owner report).
     2026-08-18  Claude Code  Chat styles (log, bubbles); Connections view styles; Created. */

:root {
  --ink: #1c2330;
  --muted: #67707e;
  --line: #e6e8ee;
  --accent: #d64550;
  --accent-soft: #fdf1f2;
  --focus: #5b7290;   /* neutral focus ring — red is reserved for real errors */
  --bg: #f6f7f9;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(28, 35, 48, 0.05), 0 4px 16px rgba(28, 35, 48, 0.05);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.wordmark {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.25rem;
}
.wordmark span { color: var(--accent); }
.wordmark.small { font-size: 1.2rem; }

/* ---------- Sign-in ---------- */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(50rem 30rem at 85% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.25rem;
  width: 100%;
  max-width: 25rem;
}
.tagline { color: var(--muted); margin: 0 0 1.5rem; }
form { display: grid; gap: 0.6rem; }
label { font-size: 0.85rem; color: var(--muted); }
input {
  font: inherit;
  font-size: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
input:focus { outline: 2px solid var(--focus); border-color: transparent; }
#code { letter-spacing: 0.4em; text-align: center; font-size: 1.3rem; }
button {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.62rem 1rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
button:hover { filter: brightness(0.94); }
button.ghost { background: transparent; color: var(--muted); font-weight: 400; }
button.ghost:hover { background: var(--bg); filter: none; color: var(--ink); }
button.small { font-size: 0.85rem; padding: 0.45rem 0.7rem; }
.note { min-height: 1.2em; color: var(--muted); font-size: 0.9rem; }
.note.error { color: var(--accent); }
.fine { color: var(--muted); font-size: 0.8rem; margin-top: 1.25rem; }

/* ---------- Shell: sidebar + main ---------- */
.shell { display: flex; min-height: 100vh; }
#side {
  width: 15.5rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem;
  background: var(--card);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}
#side nav { display: flex; flex-direction: column; gap: 0.15rem; }
#side nav button {
  display: flex;
  align-items: center;
  text-align: left;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-weight: 500;
}
#side nav button:hover { background: var(--bg); color: var(--ink); filter: none; }
#side nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* "Your business" panel — the connect concept, always in sight */
.biz { border-top: 1px solid var(--line); padding-top: 1rem; }
.biz h5 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.biz-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.2rem;
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
.biz-item em { color: var(--muted); font-style: normal; font-size: 0.75rem; margin-left: auto; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot.ok { background: #2c9a63; }
.dot.err { background: var(--accent); }
.biz .empty-hint { color: var(--muted); font-size: 0.83rem; margin: 0 0 0.3rem; }

.session {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}
.session button { align-self: flex-start; }

#views { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; overflow-y: auto; }
.view { max-width: 62rem; width: 100%; margin: 0 auto; padding: 2rem 1.5rem; }
.view h2 { margin-top: 0; letter-spacing: -0.01em; }
.empty {
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2.25rem 1.5rem;
  text-align: center;
}

/* ---------- Chat: the center of the world ---------- */
#view-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 48rem;
  padding-bottom: 1rem;
}
.chat-wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0.25rem 1rem;
}
.msg {
  max-width: 88%;
  padding: 0.7rem 1rem;
  border-radius: 16px;
  white-space: pre-wrap;
  line-height: 1.55;
  font-size: 0.97rem;
}
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow);
}
.msg.pending { color: var(--muted); }
.msg.status {
  align-self: flex-start;
  background: none;
  border: 0;
  box-shadow: none;
  padding: 0 0.35rem;
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
  animation: statuspulse 1.4s ease-in-out infinite;
}
@keyframes statuspulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.chat-dock { padding-top: 0.4rem; }
.tasksnote {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.tasksnote::before { content: "●"; color: var(--accent); margin-right: 0.4rem; font-size: 0.6rem; vertical-align: 2px; }
.chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0 0 0.6rem; }
.chip {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 400;
}
.chip:hover { border-color: var(--focus); background: var(--card); filter: none; }
.chat-input {
  display: flex;
  gap: 0.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  padding: 0.35rem 0.35rem 0.35rem 1.1rem;
}
.chat-input input { flex: 1; border: 0; padding: 0.5rem 0; background: transparent; }
.chat-input input:focus { outline: none; }
.chat-input:focus-within { outline: 2px solid var(--focus); }
.chat-input button { border-radius: 999px; padding: 0.55rem 1.2rem; }

/* Onboarding — chat's empty state teaches the connect concept */
.onboard { margin: auto 0; text-align: center; padding: 2rem 0 3rem; }
.onboard h2 { font-size: 1.7rem; margin-bottom: 0.4rem; }
.onboard .lead { color: var(--muted); max-width: 30rem; margin: 0 auto 2rem; line-height: 1.6; }
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.9rem;
  text-align: left;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  font: inherit;
}
.tile strong { font-size: 0.95rem; }
.tile span { font-size: 0.82rem; color: var(--muted); }
.tile.live { cursor: pointer; box-shadow: var(--shadow); border-color: #e8b6ba; color: var(--ink); }
.tile.live span { color: var(--accent); font-weight: 600; }
.tile.live:hover { filter: none; border-color: var(--accent); }
.tile.soon { opacity: 0.75; }

/* ---------- Cards (connections, tasks) ---------- */
.connect-card, .conn-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.connect-card h3 { margin: 0 0 0.4rem; }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0.35rem 0; }
.row { display: flex; gap: 0.6rem; }
.row input { flex: 1; }
.conn-head { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.conn-head strong { flex: 1; overflow-wrap: anywhere; }
.badge {
  font-size: 0.75rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.ok { color: #1e7f4f; border-color: #bfe3d0; background: #effaf4; }
.badge.warn { color: #9a6700; border-color: #ecd9a9; background: #fdf7e7; }
.badge.channel { color: #3a5a86; border-color: #c9d8ec; background: #eef4fb; font-weight: 600; }
.badge.urgent { background: var(--accent); color: #fff; border-color: var(--accent); }

.change-card { border-left: 3px solid #ecd9a9; }
.change-card.urgent { border-left: 3px solid var(--accent); }
.change-actions { margin-top: 0.75rem; }
.hint.story { margin: 0.2rem 0 0.5rem; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 700px) { .ba { grid-template-columns: 1fr; } }
.pane h4 { margin: 0.4rem 0 0.3rem; font-size: 0.85rem; color: var(--muted); }
.pane h4 a { pointer-events: auto; color: #3a5a86; font-weight: 400; }
.pane-body {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.5;
  max-height: 14rem;
  overflow-y: auto;
  white-space: pre-wrap;
}
.pane-body.steps { white-space: pre-wrap; }

/* Rendered page preview — article typography, everything inert */
.pane-body.rendered {
  white-space: normal;
  background: var(--card);
  padding: 1rem 1.2rem;
  max-height: 24rem;
  font-size: 0.95rem;
  line-height: 1.65;
}
.rendered h1 { font-size: 1.35rem; margin: 0 0 0.6rem; }
.rendered h2 { font-size: 1.15rem; margin: 1rem 0 0.4rem; }
.rendered h3, .rendered h4 { font-size: 1rem; margin: 0.8rem 0 0.3rem; }
.rendered p { margin: 0 0 0.7rem; }
.rendered ul, .rendered ol { margin: 0 0 0.7rem; padding-left: 1.3rem; }
.rendered img { max-width: 100%; height: auto; border-radius: 8px; }
.rendered a { color: #3a5a86; text-decoration: underline; pointer-events: none; }
.rendered blockquote { border-left: 3px solid var(--line); margin: 0 0 0.7rem; padding: 0.2rem 0 0.2rem 0.8rem; color: var(--muted); }
.rendered table { border-collapse: collapse; margin: 0 0 0.7rem; max-width: 100%; }
.rendered td, .rendered th { border: 1px solid var(--line); padding: 0.3rem 0.5rem; }
.rendered .feat { margin: 0 0 0.9rem; }
.rendered .feat img { max-height: 180px; border-radius: 8px; display: block; }
.rendered .feat figcaption { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }

#nav .count {
  display: inline-block;
  min-width: 1.2rem;
  margin-left: auto;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.2rem;
  text-align: center;
}

/* ---------- Small screens: sidebar becomes a top bar ---------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  #side {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  #side nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .biz, .session { display: none; } /* Connections stays reachable from the nav */
  #views { height: auto; }
  #view-chat { min-height: calc(100vh - 8rem); }
}
