/* ==========================================================================
   Competitive Intelligence Platform - Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   Design Tokens
   -------------------------------------------------------------------------- */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e2e5ea;
  --border-light: #f0f1f3;
  --text: #1a1d23;
  --text-secondary: #5a5f6b;
  --text-tertiary: #8b8f9a;
  --accent: #1a56db;
  --accent-light: #e8effc;
  --green: #0d7a3f;
  --green-bg: #ecf6f0;
  --yellow: #9a6700;
  --yellow-bg: #fef7e6;
  --red: #c0392b;
  --red-bg: #fdf0ee;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
  --transition: 150ms ease;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 40px;
}

.header {
  margin-bottom: 32px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.header h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

.section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

/* --------------------------------------------------------------------------
   Top Bar (report pages)
   -------------------------------------------------------------------------- */

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 56px;
}

.top-bar .logo {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

body.has-top-bar {
  padding-top: 56px;
}

/* --------------------------------------------------------------------------
   Scorecard
   -------------------------------------------------------------------------- */

.scorecard-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.scorecard-wrap {
  overflow-x: auto;
}

.scorecard-wrap table,
table.scorecard {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.scorecard-wrap th,
table.scorecard th,
.scorecard-wrap td,
table.scorecard td {
  padding: 12px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.scorecard-wrap th,
table.scorecard th {
  background: var(--bg);
  color: var(--text-tertiary);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.scorecard-wrap th:first-child,
table.scorecard th:first-child,
.scorecard-wrap td:first-child,
table.scorecard td:first-child {
  text-align: left;
  font-weight: 500;
  min-width: 200px;
  color: var(--text-secondary);
}

.scorecard-wrap tr:last-child td,
table.scorecard tr:last-child td {
  border-bottom: none;
}

.sbd-col {
  background: var(--accent-light);
}

thead .sbd-col {
  background: rgba(26, 86, 219, 0.08);
  font-weight: 600;
  color: var(--accent);
}

.overall-row td {
  border-top: 2px solid var(--border);
  font-weight: 600;
  background: var(--bg);
}

.overall-row td:first-child {
  color: var(--text);
}

.score {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}

.score-high {
  background: var(--green-bg);
  color: var(--green);
}

.score-mid {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.score-low {
  background: var(--red-bg);
  color: var(--red);
}

/* --------------------------------------------------------------------------
   Head-to-Head
   -------------------------------------------------------------------------- */

.h2h-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.h2h-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.h2h-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.h2h-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.h2h-row:last-child {
  border-bottom: none;
}

.h2h-dim {
  color: var(--text-secondary);
  flex: 1;
}

.h2h-winner {
  font-weight: 600;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
}

.win-sbd {
  background: var(--green-bg);
  color: var(--green);
}

.win-comp {
  background: var(--red-bg);
  color: var(--red);
}

.win-tie {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.h2h-summary {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.h2h-tally {
  display: flex;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  font-weight: 600;
}

.h2h-tally span {
  padding: 3px 10px;
  border-radius: 12px;
}

/* --------------------------------------------------------------------------
   Insights
   -------------------------------------------------------------------------- */

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.insight-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  border-left: 3px solid var(--border);
}

.insight-card.advantage {
  border-left-color: var(--green);
}

.insight-card.gap {
  border-left-color: var(--red);
}

.insight-card.signal {
  border-left-color: var(--yellow);
}

.insight-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.insight-card.advantage .insight-label {
  color: var(--green);
}

.insight-card.gap .insight-label {
  color: var(--red);
}

.insight-card.signal .insight-label {
  color: var(--yellow);
}

.insight-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.insight-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Tables (ad-table, funding-table, etc.)
   -------------------------------------------------------------------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ad-table th,
.funding-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.ad-table td,
.funding-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: top;
}

.ad-table tr:last-child td,
.funding-table tr:last-child td {
  border-bottom: none;
}

.ad-table tr:hover td,
.funding-table tr:hover td {
  background: var(--bg);
}

.sbd-row {
  background: var(--accent-light);
}

.sbd-row td {
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Actions
   -------------------------------------------------------------------------- */

.action-phase {
  margin-bottom: 28px;
}

.phase-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.action-item {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.action-item:last-child {
  border-bottom: none;
}

.action-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-body {
  flex: 1;
}

.action-body h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.action-body p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.action-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.action-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.tag-cost {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: transparent;
}

.tag-impact-high {
  background: var(--green-bg);
  color: var(--green);
  border-color: transparent;
}

.tag-impact-med {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: transparent;
}

.tag-time {
  background: var(--accent-light);
  color: var(--accent);
  border-color: transparent;
}

/* --------------------------------------------------------------------------
   Market Context
   -------------------------------------------------------------------------- */

.market-context {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.market-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
}
.stat-value.stat-value-sm {
  font-size: 16px;
}

.stat-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.market-detail {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.market-detail p + p {
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */

.timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.timeline-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.timeline-col h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}

.timeline-item {
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
}

.timeline-item:last-child {
  border-bottom: none;
}

.timeline-item strong {
  color: var(--text);
  font-weight: 600;
}

.timeline-note {
  font-size: 12px;
  color: var(--text-tertiary);
  font-style: italic;
  margin-top: 12px;
}

/* --------------------------------------------------------------------------
   Methodology
   -------------------------------------------------------------------------- */

.methodology {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.methodology h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.methodology ul {
  margin: 10px 0;
  padding-left: 20px;
}

.methodology li {
  margin-bottom: 4px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  text-align: center;
  padding: 24px 0;
  font-size: 12px;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* --------------------------------------------------------------------------
   Badges: Aggression
   -------------------------------------------------------------------------- */

.aggression {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.agg-dominant {
  background: var(--red-bg);
  color: var(--red);
}

.agg-very-high {
  background: #fde8d8;
  color: #c05621;
}

.agg-high {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.agg-moderate {
  background: var(--accent-light);
  color: var(--accent);
}

.agg-low {
  background: var(--green-bg);
  color: var(--green);
}

/* --------------------------------------------------------------------------
   Badges: SERP
   -------------------------------------------------------------------------- */

.serp-highlight {
  background: var(--green-bg);
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.serp-none {
  background: var(--bg);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

/* ==========================================================================
   NEW COMPONENTS
   ========================================================================== */

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #154ab5;
  border-color: #154ab5;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
  border-color: var(--text-tertiary);
}

.btn-danger {
  background: var(--red);
  color: #ffffff;
  border-color: var(--red);
}

.btn-danger:hover {
  background: #a93226;
  border-color: #a93226;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding-left: 4px;
  padding-right: 4px;
}

.btn-ghost:hover {
  color: var(--text);
  text-decoration: underline;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238b8f9a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
  line-height: 1.5;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

.competitor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.competitor-list .form-input {
  margin-bottom: 0;
}

.add-competitor-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

.add-competitor-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Admin Table
   -------------------------------------------------------------------------- */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover td {
  background: var(--bg);
}

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  text-transform: capitalize;
}

.status-badge.running {
  background: var(--accent-light);
  color: var(--accent);
}

.status-badge.complete {
  background: var(--green-bg);
  color: var(--green);
}

.status-badge.failed {
  background: var(--red-bg);
  color: var(--red);
}

.status-badge.queued {
  background: var(--yellow-bg);
  color: var(--yellow);
}

/* --------------------------------------------------------------------------
   Stats Row (admin dashboard cards)
   -------------------------------------------------------------------------- */

.stats-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.stats-row .stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Status / Progress Page
   -------------------------------------------------------------------------- */

.progress-stepper {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 0 40px;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  flex: 1;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text-tertiary);
  position: relative;
  z-index: 1;
}

.step-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-top: 8px;
  text-align: center;
}

.step::after {
  content: '';
  position: absolute;
  top: 18px;
  left: calc(50% + 22px);
  right: calc(-50% + 22px);
  height: 2px;
  background: var(--border);
}

.step:last-child::after {
  display: none;
}

.step.completed .step-number {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.step.completed .step-label {
  color: var(--green);
}

.step.completed::after {
  background: var(--green);
}

.step.active .step-number {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.step.active .step-label {
  color: var(--accent);
  font-weight: 600;
}

.step.pending .step-number {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-tertiary);
}

.step.pending .step-label {
  color: var(--text-tertiary);
}

/* Pipeline steps (vertical list) */

.pipeline-steps {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}

.pipeline-step:last-child {
  border-bottom: none;
}

.pipeline-step .step-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.pipeline-step .step-icon.done {
  background: var(--green-bg);
  color: var(--green);
}

.pipeline-step .step-icon.active {
  background: var(--accent-light);
  color: var(--accent);
}

.pipeline-step .step-icon.pending {
  background: var(--bg);
  color: var(--text-tertiary);
}

.pipeline-step .step-icon.failed {
  background: var(--red-bg);
  color: var(--red);
}

.pipeline-step .step-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

.pipeline-step .step-time {
  font-size: 12px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Spinner */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Status banner */

.status-banner {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid #b8dfc6;
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.status-banner.error {
  background: var(--red-bg);
  color: var(--red);
  border-color: #f0c4be;
}

.status-banner.warning {
  background: var(--yellow-bg);
  color: var(--yellow);
  border-color: #f0dea0;
}

/* --------------------------------------------------------------------------
   Toast Notifications
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 380px;
  animation: toast-in 0.3s ease forwards;
}

.toast.toast-out {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(16px);
  }
}

/* --------------------------------------------------------------------------
   Invite URL
   -------------------------------------------------------------------------- */

.invite-url {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.invite-url code {
  flex: 1;
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.5;
}

.invite-url .btn {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  .top-bar {
    padding: 0 16px;
  }

  .h2h-grid {
    grid-template-columns: 1fr;
  }

  .insights-grid {
    grid-template-columns: 1fr;
  }

  .timeline-grid {
    grid-template-columns: 1fr;
  }

  .market-stats {
    grid-template-columns: 1fr 1fr;
  }

  .stats-row {
    flex-direction: column;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 600px;
  }

  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .progress-stepper {
    padding: 0 16px;
  }

  .step-label {
    font-size: 11px;
  }

  .step-number {
    width: 30px;
    height: 30px;
    font-size: 12px;
  }

  .step::after {
    top: 15px;
    left: calc(50% + 18px);
    right: calc(-50% + 18px);
  }

  .h2h-card,
  .insight-card,
  .timeline-col,
  .market-context,
  .methodology,
  .form-card {
    padding: 16px;
  }
}

/* --------------------------------------------------------------------------
   Pitch Summary (slide-ready competitive overview)
   -------------------------------------------------------------------------- */

.pitch-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 32px 48px;
}

.pitch-header {
  text-align: center;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.pitch-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.pitch-header .pitch-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

.pitch-market-bar {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 36px;
}

.pitch-market-stat {
  text-align: center;
  padding: 20px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 180px;
}

.pitch-market-stat .pitch-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.pitch-market-stat .pitch-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.pitch-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-tertiary);
  margin-bottom: 14px;
}

.pitch-landscape-note {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 14px;
  font-style: italic;
}

.pitch-check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.pitch-check-table th {
  text-align: center;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.pitch-check-table th:first-child {
  text-align: left;
}

.pitch-check-table th.subject-col {
  color: var(--accent);
}

.pitch-check-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  text-align: center;
  color: var(--text-secondary);
}

.pitch-check-table td:first-child {
  text-align: left;
  font-weight: 500;
  color: var(--text);
}

.pitch-check-table tr:last-child td {
  border-bottom: none;
}

.pitch-check-table .check-yes {
  color: var(--green);
  font-weight: 700;
}

.pitch-check-table .check-no {
  color: var(--text-tertiary);
}

.pitch-differentiators {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.pitch-differentiator {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.pitch-differentiator-opportunity {
  border-left-color: var(--accent);
}

.pitch-differentiator h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.pitch-differentiator p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 2x2 Positioning Map */

.pitch-map-container {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 36px;
}

.pitch-map-ylabel {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
}

.pitch-map-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pitch-map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  overflow: visible;
}

.pitch-map-quadrant {
  border: 0.5px dashed var(--border);
}

.pitch-map-xlabel {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  text-align: center;
}

.pitch-dot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.pitch-dot span {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pitch-dot-subject span {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(26, 86, 219, 0.3);
}

.pitch-dot-competitor span {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.pitch-footer {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-tertiary);
}

@media (max-width: 768px) {
  .pitch-container {
    padding: 24px 16px 32px;
  }
  .pitch-market-bar {
    flex-direction: column;
    align-items: center;
  }
  .pitch-market-stat {
    min-width: 100%;
  }
  .pitch-score-item .pitch-company-name {
    width: 100px;
    font-size: 12px;
  }
  .pitch-differentiators {
    grid-template-columns: 1fr;
  }
  .pitch-map {
    aspect-ratio: 4 / 3;
  }
}

@media print {
  .pitch-container {
    padding: 20px 0;
  }
  .pitch-market-stat,
  .pitch-differentiator,
  .pitch-check-table {
    break-inside: avoid;
    border: 1px solid #cccccc;
  }
}

/* --------------------------------------------------------------------------
   Corrections / Feedback
   -------------------------------------------------------------------------- */

.report-section {
  position: relative;
}

.correction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 12px;
}

.correction-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.correction-form-inline {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0 16px;
}

.correction-form-inline .form-label {
  margin-bottom: 4px;
}

.correction-form-inline textarea {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  resize: vertical;
  min-height: 60px;
  margin-bottom: 10px;
}

.correction-form-inline textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.correction-form-actions {
  display: flex;
  gap: 8px;
}

.correction-badge {
  background: var(--green-bg);
  border: 1px solid #b8dfc6;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 10px 0;
  font-size: 12px;
  line-height: 1.6;
}

.correction-badge-label {
  font-weight: 600;
  color: var(--green);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.correction-badge-claim {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.correction-badge-text {
  color: var(--text);
  font-weight: 500;
}

.correction-pending-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--yellow);
  background: var(--yellow-bg);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin-left: 12px;
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  *,
  *::before,
  *::after {
    box-shadow: none !important;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
    line-height: 1.5;
  }

  .top-bar,
  .btn,
  .no-print,
  .toast,
  .add-competitor-btn,
  .correction-btn,
  .correction-form-inline,
  .correction-pending-label {
    display: none !important;
  }

  body.has-top-bar {
    padding-top: 0;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .page-break-before {
    page-break-before: always;
  }

  a {
    color: #000000;
    text-decoration: none;
  }

  a[href]::after {
    content: none;
  }

  .scorecard-wrap,
  .h2h-card,
  .insight-card,
  .table-wrap,
  .market-context,
  .timeline-col,
  .methodology,
  .pipeline-steps,
  .form-card {
    border: 1px solid #cccccc;
    break-inside: avoid;
  }

  .score {
    border: 1px solid currentColor;
    background: transparent !important;
  }

  .score-high { color: #0d7a3f; }
  .score-mid  { color: #9a6700; }
  .score-low  { color: #c0392b; }

  .status-badge {
    border: 1px solid currentColor;
    background: transparent !important;
  }

  .aggression {
    border: 1px solid currentColor;
    background: transparent !important;
  }

  .h2h-winner {
    border: 1px solid currentColor;
    background: transparent !important;
  }

  .insight-card {
    border-left-width: 3px;
  }

  .action-num {
    border: 1px solid var(--accent);
    background: transparent;
  }

  .h2h-grid,
  .insights-grid,
  .timeline-grid {
    display: block;
  }

  .h2h-grid > *,
  .insights-grid > *,
  .timeline-grid > * {
    margin-bottom: 12px;
    break-inside: avoid;
  }

  .header h1 {
    font-size: 18pt;
  }

  .section-title {
    font-size: 9pt;
  }

  .footer {
    font-size: 9pt;
  }
}
