/* ============================================================================
   App stylesheet entry — Bootstrap 5.3 + Rogue design system load order
   ----------------------------------------------------------------------------
   TASK-017 / FEAT-012 cascade rule (Architecture Decision §4):
     1. vendor/bootstrap.min.css  — emitted FIRST by layouts/application.html.erb
        (Bootstrap defaults: resets, element typography, .container/.row/.col-*,
         unprefixed component primitives we DO NOT use directly in views).
     2. rogue_tokens.css          — element-level overrides + design tokens.
     3. rogue_components.css      — .rogue-* component classes (the design system).
     4. Bootstrap custom property remaps (below) — bind --bs-* to rogue tokens.

   Class-conflict triage (§3, Q2 Option A — prefix isolation):
     - Layout primitives in views use Bootstrap: .container, .row, .col-*.
     - Component primitives in views use rogue-*: .rogue-card, .rogue-btn,
       .rogue-table, .rogue-badge, .rogue-frame, .rogue-content, etc.
     - Naked .btn / .table / .card / .badge are FORBIDDEN in
       app/views/(every subtree)/*.html.erb (mailer views excluded — they're inline-styled).
     - The rogue-* prefix is the namespace boundary; cascade order ensures
       rogue's element-level rules (typography, focus ring, body background)
       win over Bootstrap's defaults.

   Spec contract: do not mutate rogue-badge --neutral / --success class strings
     (spec/system/gm_dashboard_spec.rb:63,65; spec/requests/dashboards_spec.rb:57).
   ============================================================================ */

@import url("/assets/rogue_tokens-8ccd6df6.css");
@import url("/assets/rogue_components-3faf9755.css");

/* ─── Bootstrap CSS custom property remaps ──────────────────────────────
   Bootstrap 5.3 reads these at render time. Pointing them at rogue tokens
   keeps Bootstrap's grid + spacing using rogue's brand identity without an
   SCSS recompile. */
:root {
  --bs-body-font-family: var(--font-sans);
  --bs-body-font-size: var(--fs-body);
  --bs-body-line-height: var(--lh-body);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--paper);
  --bs-border-color: var(--border);
  --bs-primary: var(--brand);
  --bs-primary-rgb: 30, 64, 175; /* matches --brand #1E40AF; kept literal for Bootstrap's rgb() utilities */
  --bs-link-color: var(--brand);
  --bs-link-hover-color: var(--brand-hover);
}

/* ─── Bootstrap layer scope overrides ───────────────────────────────────
   TASK-017/FEAT-012 Phase 2: shared/_frame uses .container-fluid as the
   outermost Bootstrap layout primitive but should not add Bootstrap's
   default 1.5rem gutter on top of the rogue-frame padding (rogue-frame
   already handles its own padding via rogue_components.css).
   Scope: only the rogue-frame variant of container-fluid; other Bootstrap
   containers keep their default gutters for future grid use. */
.rogue-frame.container-fluid {
  --bs-gutter-x: 0;
}

/* ============================================================================
   TASK-018 / FEAT-013 Phase 1 — Marketing Command Center dashboard chrome
   ----------------------------------------------------------------------------
   The dashboard surface uses Bootstrap 5.3 grid + rogue-* component vocabulary
   from FEAT-012. New rogue-dashboard__* classes scope sidebar/topbar/content.
   ============================================================================ */

.rogue-dashboard { background: var(--paper, #FFFFFF); }

.rogue-dashboard__shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.rogue-dashboard__sidebar {
  width: 220px;
  min-width: 220px;
  background: #F8FAFC;
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}
@media (max-width: 767px) {
  .rogue-dashboard__sidebar { display: none; }
}

.rogue-dashboard__brand {
  padding: 0 16px 16px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.rogue-dashboard__brand-mark {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #1E40AF;
  border-radius: 2px;
}
.rogue-dashboard__brand-name { font-weight: 700; color: #0F172A; }
.rogue-dashboard__brand-sub {
  font-size: 11px;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.rogue-dashboard__nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.rogue-dashboard__nav-section { padding: 8px 0; }
.rogue-dashboard__nav-heading {
  font-size: 11px;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 16px;
  margin: 0 0 4px;
}
.rogue-dashboard__nav-list { list-style: none; margin: 0; padding: 0; }
.rogue-dashboard__nav-link {
  display: block;
  padding: 8px 16px;
  font-size: 14px;
  color: #334155;
  text-decoration: none;
  border-left: 2px solid transparent;
}
.rogue-dashboard__nav-link:hover { background: #EEF2F7; color: #0F172A; }
.rogue-dashboard__nav-link[data-active="true"] {
  background: #EFF6FF;
  color: #1E40AF;
  border-left-color: #1E40AF;
  font-weight: 500;
}
.rogue-dashboard__sidebar-footer { border-top: 1px solid #E2E8F0; padding-top: 8px; }
.rogue-dashboard__nav-link--footer { font-weight: 500; }

.rogue-dashboard__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.rogue-dashboard__topbar {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.rogue-dashboard__topbar-titles { min-width: 0; }
.rogue-dashboard__topbar-title { margin: 0; font-size: 18px; font-weight: 600; color: #0F172A; }
.rogue-dashboard__topbar-sub { margin: 2px 0 0; font-size: 13px; color: #64748B; }
.rogue-dashboard__topbar-filter { flex-shrink: 0; }

.rogue-dashboard__content { padding: 24px; }

.rogue-dashboard__kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.rogue-dashboard__grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}
.rogue-dashboard__grid--2col { grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .rogue-dashboard__grid--2col { grid-template-columns: 1fr 1fr; }
}

.rogue-card--kpi { padding: 14px 16px; border-radius: 6px; }
.rogue-card--kpi-positive { border-left: 3px solid #15803D; }
.rogue-card--kpi-negative { border-left: 3px solid #B91C1C; }
.rogue-card--kpi-warning  { border-left: 3px solid #B45309; }
.rogue-card--kpi-info     { border-left: 3px solid #1E40AF; }
.rogue-card__kpi-label {
  font-size: 11px;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 6px;
  font-weight: 500;
}
.rogue-card__kpi-value {
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  color: #0F172A;
  margin: 0;
}
.rogue-card__kpi-value--sm { font-size: 18px; }
.rogue-card__kpi-delta { margin: 8px 0 0; font-size: 12px; color: #64748B; }

.rogue-card--chart { padding: 16px; }
.rogue-card__chart-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.rogue-card__chart-title { font-size: 14px; font-weight: 600; margin: 0; color: #0F172A; }
.rogue-card__chart-body { position: relative; }
.rogue-chart { position: relative; width: 100%; }
.rogue-chart canvas { width: 100% !important; max-height: 100%; }

.rogue-table--dense th, .rogue-table--dense td { padding: 6px 8px; font-size: 13px; }

.rogue-badge--grade {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
}
.rogue-badge--grade-s        { background: #DCFCE7; color: #15803D; }
.rogue-badge--grade-a-plus   { background: #DCFCE7; color: #166534; }
.rogue-badge--grade-a        { background: #DBEAFE; color: #1E40AF; }
.rogue-badge--grade-b-plus   { background: #DBEAFE; color: #1D4ED8; }
.rogue-badge--grade-b        { background: #FEF3C7; color: #92400E; }
.rogue-badge--grade-b-       { background: #FEF3C7; color: #92400E; }
.rogue-badge--grade-c-plus   { background: #FEE2E2; color: #991B1B; }
.rogue-badge--grade-c        { background: #FEE2E2; color: #991B1B; }
.rogue-badge--grade-d        { background: #F1F5F9; color: #475569; }
.rogue-badge--grade-pending  { background: #F1F5F9; color: #94A3B8; }

.rogue-dashboard__traffic-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.rogue-dashboard__traffic-sources { list-style: none; margin: 0; padding: 0; }
.rogue-dashboard__traffic-sources li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid #E2E8F0;
  font-size: 13px;
}
.rogue-dashboard__traffic-sources li:last-child { border-bottom: 0; }
.rogue-dashboard__traffic-channel { font-weight: 500; color: #0F172A; }
.rogue-dashboard__traffic-sessions { color: #334155; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.rogue-dashboard__traffic-pct { color: #64748B; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; min-width: 36px; text-align: right; }

.rogue-dashboard__feed { list-style: none; margin: 0; padding: 0; }
.rogue-dashboard__feed-item {
  padding: 8px 12px;
  border-left: 2px solid #E2E8F0;
  margin-bottom: 6px;
  font-size: 13px;
}
.rogue-dashboard__feed-item--positive { border-left-color: #15803D; }
.rogue-dashboard__feed-item--negative { border-left-color: #B91C1C; }
.rogue-dashboard__feed-item--warning  { border-left-color: #B45309; }

.rogue-empty--inline { padding: 24px 12px; text-align: center; }
