/* ============================================================
   Chan Compass UI kit — app-level styling.
   Tokens come from styles.css; this is layout + the few patterns
   (data table, flow bars, AI empty states) the kit needs.
   ============================================================ */

.cc-app {
  max-width: var(--container-max);
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}

/* ---- Header ---- */
.cc-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-300);
  padding: var(--space-300) var(--space-400) var(--space-250);
}
.cc-brand { display: flex; align-items: center; gap: var(--space-200); }
.cc-mark {
  width: 44px; height: 44px; flex: none; border-radius: var(--radius-lg);
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--s2-blue-900) 0%, var(--s2-indigo-700) 60%, var(--s2-purple-900) 100%);
  box-shadow: var(--shadow-accent);
}
.cc-wordmark { font: var(--font-weight-bold) 22px/1.1 var(--font-sans); color: var(--text-heading); letter-spacing: -.01em; }
.cc-wordmark span { font-weight: var(--font-weight-regular); color: var(--text-muted); }
.cc-tagline { font: var(--type-detail); color: var(--text-muted); margin-top: 3px; }
.cc-header-right { display: flex; align-items: center; gap: var(--space-200); }

/* ---- Nav ---- */
.cc-navbar { padding: 0 var(--space-400); }

/* ---- Main ---- */
.cc-main { flex: 1; padding: var(--space-400); }

/* ---- Footer ---- */
.cc-footer {
  display: flex; align-items: center; gap: var(--space-100); flex-wrap: wrap;
  padding: var(--space-300) var(--space-400) var(--space-400);
  font: var(--type-detail); color: var(--text-muted);
  border-top: 1px solid var(--border-hairline); margin: var(--space-200) var(--space-400) 0;
}
.cc-foot-sep { color: var(--border-strong); }

/* ---- grow helper for Field ---- */
.grow { flex: 1; min-width: 0; }

/* ---- Data table ---- */
.cc-table { border: 1px solid var(--border-hairline); border-radius: var(--radius-lg); overflow: hidden; }
.cc-table table { width: 100%; border-collapse: collapse; font: var(--type-ui); }
.cc-table thead th {
  text-align: left; font: var(--font-weight-semibold) var(--font-size-75)/1 var(--font-sans);
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 14px; background: var(--surface-subtle); border-bottom: 1px solid var(--border-hairline);
}
.cc-table th.num, .cc-table td.num { text-align: right; }
.cc-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-hairline); color: var(--text-body); }
.cc-table tbody tr:last-child td { border-bottom: none; }
.cc-table tbody tr { cursor: pointer; transition: background var(--duration-fast) var(--ease-default); }
.cc-table tbody tr:hover { background: var(--surface-subtle); }
.cc-table tbody tr.sel { background: var(--accent-subtle); }
.cc-table tbody tr.sel td { box-shadow: inset 2px 0 0 var(--accent); }
.cc-table.compact tbody td, .cc-table.compact thead th { padding: 8px 12px; }

.mono { font-family: var(--font-code); }
.bold { font-weight: var(--font-weight-bold); color: var(--text-heading); }
.dim { color: var(--text-muted); }

/* ---- Decision log ---- */
.cc-log {
  display: flex; flex-direction: column; gap: 8px;
  padding: var(--space-200); background: var(--surface-subtle);
  border-radius: var(--radius-default); font: var(--type-body); color: var(--text-body);
}
.cc-log .dim { display: inline-block; width: 116px; }
.cc-log-note { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border-hairline); color: var(--text-secondary); }

/* ---- AI empty state ---- */
.cc-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  min-height: 160px; text-align: center; color: var(--text-muted); font: var(--type-body);
  border: 1.5px dashed var(--border-default); border-radius: var(--radius-lg); padding: var(--space-300);
}
.cc-empty.tall { min-height: 220px; }

/* ---- Flow bars (rotation) ---- */
.cc-flow { display: flex; flex-direction: column; gap: 9px; }
.cc-flow-row { display: grid; grid-template-columns: 1fr 130px auto; align-items: center; gap: var(--space-200); }
.cc-flow-name { font: var(--type-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-flow-track { position: relative; height: 16px; background: var(--surface-subtle); border-radius: var(--radius-sm); }
.cc-flow-bar { position: absolute; top: 0; height: 100%; border-radius: var(--radius-sm); }
.cc-flow-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--border-strong); }

/* ---- Step tracker (research) ---- */
.cc-step { display: flex; align-items: center; gap: var(--space-150); font: var(--type-body); }
.cc-step-dot {
  width: 22px; height: 22px; flex: none; border-radius: var(--radius-full);
  display: grid; place-items: center; font: var(--font-weight-bold) 11px/1 var(--font-sans);
  background: var(--surface-subtle); color: var(--text-muted); border: 1px solid var(--border-default);
}
.cc-step-dot.active { background: var(--accent); color: #fff; border-color: var(--accent); animation: cc-pulse 1.2s var(--ease-out) infinite; }
.cc-step-dot.done { background: var(--positive); color: #fff; border-color: var(--positive); }
@keyframes cc-pulse { 0%,100%{ opacity:1 } 50%{ opacity:.55 } }

/* ---- Lists (reports) ---- */
.cc-list { display: flex; flex-direction: column; gap: 4px; }
.cc-list-item {
  display: flex; align-items: center; gap: var(--space-100); text-align: left;
  padding: 9px 11px; border: none; background: none; border-radius: var(--radius-default);
  cursor: pointer; font: var(--type-ui); color: var(--text-body);
  transition: background var(--duration-fast) var(--ease-default);
}
.cc-list-item:hover { background: var(--surface-subtle); }
.cc-list-item.sel { background: var(--accent-subtle); color: var(--accent-text); }

/* ---- Radios (model) ---- */
.cc-radios { display: flex; flex-direction: column; gap: 8px; }
.cc-radio {
  display: flex; align-items: center; gap: var(--space-150);
  padding: 12px 14px; border: 1.5px solid var(--border-default); border-radius: var(--radius-default);
  cursor: pointer; transition: var(--transition-colors); font: var(--type-ui); color: var(--text-body);
}
.cc-radio:hover { border-color: var(--text-secondary); }
.cc-radio.sel { border-color: var(--accent); background: var(--accent-subtle); }
.cc-radio-dot {
  width: 16px; height: 16px; flex: none; border-radius: var(--radius-full);
  border: 2px solid var(--border-field); position: relative;
}
.cc-radio.sel .cc-radio-dot { border-color: var(--accent); }
.cc-radio.sel .cc-radio-dot::after { content:''; position:absolute; inset:3px; border-radius:var(--radius-full); background:var(--accent); }
.cc-radio .s2-badge { margin-left: auto; }

.cc-quiet { padding: 9px 2px; }

/* ── live AI output panel (framed, neutral, auto-grows) ── */
.cc-llm-out { border:1px solid var(--border-hairline); border-radius: var(--radius-lg);
  background: var(--surface-card); padding: 14px 16px; min-height: 120px;
  font-size: 14px; line-height: 1.5; overflow:auto; }
.cc-md h1,.cc-md h2,.cc-md h3,.cc-md h4 { color: var(--accent); margin: 12px 0 6px; }
.cc-md h1 { font-size: 19px; } .cc-md h2 { font-size: 16px; } .cc-md h3 { font-size: 14px; }
.cc-md p { margin: 4px 0; } .cc-md ul { margin: 6px 0 6px 18px; }
.cc-md blockquote { border-left: 3px solid var(--accent); margin: 6px 0; padding: 2px 12px; color: var(--text-muted); }
.cc-md code { background: var(--surface-subtle); padding: 1px 5px; border-radius: 5px; font-family: var(--font-mono); font-size: 12.5px; }
.cc-md a { color: var(--accent); }
.cc-md-table { border-collapse: collapse; margin: 8px 0; font-size: 13px; width: 100%; }
.cc-md-table th { text-align: left; padding: 6px 10px; border-bottom: 2px solid var(--border-hairline); }
.cc-md-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-hairline); }
