/* Live Intel Feed — standalone /daily-briefing/intel-feed/ page.
 * Reads ai-feed/data/learning/events_timeline.json. Signal-first sorted
 * by default. CSS here is page-scoped — class prefix `if-`. */

.if-intro { line-height: 1.55; max-width: 60rem; }

/* Stat bar — surging / hot / fresh / total / contracts / wrong-clone counts */
.if-statbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: .65rem;
  margin: .25rem 0 1rem;
}
.if-stat {
  background: var(--bg-secondary, #111);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: .7rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  position: relative;
  overflow: hidden;
}
.if-stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent, #6366f1);
}
.if-stat-num {
  font-size: 1.55rem; font-weight: 700; line-height: 1;
  font-feature-settings: "tnum"; color: #e5e7eb;
}
.if-stat-lbl {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-secondary, #94a3b8); margin-top: .2rem;
}
.if-stat-surging::before { background: #f97316; }
.if-stat-hot::before     { background: #ef4444; }
.if-stat-fresh::before   { background: #22d3ee; }
.if-stat-attest::before  { background: #a78bfa; }
.if-stat-warn::before    { background: #fbbf24; }

/* Controls */
.if-controls {
  display: flex; flex-wrap: wrap; gap: .65rem; align-items: center;
  margin-bottom: 1rem;
}
.if-controls label {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; color: var(--text-secondary, #94a3b8);
}
.if-controls select, .if-controls input[type="search"] {
  background: var(--bg-secondary, #111);
  color: #e5e7eb;
  border: 1px solid var(--border, #333);
  border-radius: 5px;
  padding: .35rem .55rem;
  font: inherit; font-size: .82rem;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}
.if-controls input[type="search"] { min-width: 12rem; }
.if-tag-toggle { cursor: pointer; }
.if-tag-toggle input { margin: 0 .25rem 0 0; }
.if-shown {
  margin-left: auto;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .72rem;
  color: var(--text-secondary, #94a3b8);
}

/* Event grid — single-column row list */
.if-grid {
  display: flex; flex-direction: column; gap: .55rem;
  contain: layout;
}
.if-row {
  display: grid;
  grid-template-columns: 5.5rem auto 1fr auto;
  gap: .65rem;
  align-items: center;
  padding: .65rem .85rem;
  background: var(--bg-secondary, #111);
  border: 1px solid var(--border, #333);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color .12s ease, transform .08s ease, background .12s ease;
  min-width: 0;
}
.if-row:hover { border-color: #475569; background: #131a26; }
.if-row:active { transform: translateY(1px); }
.if-row-time {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .7rem; color: var(--text-secondary, #94a3b8);
  white-space: nowrap;
}
.if-row-tk {
  display: inline-flex; align-items: center;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .82rem; font-weight: 600;
  padding: .15rem .45rem;
  border-radius: 4px;
  background: rgba(96, 165, 250, .13); color: #bfdbfe;
  white-space: nowrap;
}
.if-row-headline {
  min-width: 0;
  font-size: .87rem; line-height: 1.4;
  color: #e5e7eb;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.if-row-meta {
  display: inline-flex; gap: .35rem; align-items: center;
  flex-wrap: nowrap; white-space: nowrap;
}
.if-tag {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .65rem; font-weight: 600;
  padding: .12rem .38rem; border-radius: 3px;
  letter-spacing: .03em;
}
.if-tag-cat {
  background: rgba(148, 163, 184, .15); color: #cbd5e1;
}
.if-tag-scout {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .68rem;
  color: #a78bfa;
  text-decoration: none;
}
.if-tag-scout:hover { color: #c4b5fd; text-decoration: underline; }
.if-tag-tier-confirmed { background: rgba(74, 222, 128, .15); color: #86efac; }
.if-tag-tier-early     { background: rgba(251, 191, 36, .12); color: #fcd34d; }
.if-tag-surging { background: rgba(249, 115, 22, .15); color: #fdba74; }
.if-tag-hot     { background: rgba(239, 68, 68, .15);  color: #fca5a5; }
.if-tag-fresh   { background: rgba(34, 211, 238, .15); color: #67e8f9; }
.if-tag-warn    { background: rgba(251, 191, 36, .15); color: #fde047; }
.if-tag-contract { background: rgba(167, 139, 250, .14); color: #c4b5fd; }

/* Compact mobile reflow — 2 rows: time+ticker+meta on row 1, headline on row 2 */
@media (max-width: 720px) {
  .if-row {
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto auto;
    row-gap: .35rem;
  }
  .if-row-headline {
    grid-column: 1 / -1; white-space: normal;
  }
}

/* Drawer */
.if-bd {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 50; display: none;
}
.if-bd.open { display: block; }
.if-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100%);
  background: var(--bg-secondary, #111);
  border-left: 1px solid var(--border, #333);
  z-index: 51;
  transform: translateX(100%);
  transition: transform .18s ease;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.if-drawer.open { transform: translateX(0); }
.if-d-head {
  display: flex; align-items: center; gap: .6rem;
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border, #333);
}
.if-d-tk {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 1.05rem; font-weight: 600; color: #bfdbfe;
}
.if-d-proj { color: var(--text-secondary, #94a3b8); font-size: .85rem; }
.if-d-close {
  margin-left: auto; background: transparent; border: 0;
  color: var(--text-secondary, #94a3b8); font-size: 1.6rem;
  cursor: pointer; line-height: 1; padding: 0 .25rem;
}
.if-d-close:hover { color: #e5e7eb; }
.if-d-body {
  padding: 1rem 1.1rem 1.4rem;
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 1rem;
}
.if-d-section h4 {
  margin: 0 0 .35rem;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-secondary, #94a3b8);
}
.if-d-quote {
  margin: 0; padding: .7rem .85rem;
  border-left: 2px solid rgba(167, 139, 250, .4);
  background: rgba(15, 23, 42, .35);
  color: #cbd5e1;
  font-size: .88rem; line-height: 1.55;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}
.if-d-meta-grid {
  display: grid; grid-template-columns: max-content 1fr;
  gap: .25rem .75rem; align-items: baseline;
  font-size: .82rem;
}
.if-d-meta-k {
  color: var(--text-secondary, #94a3b8);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .75rem;
}
.if-d-meta-v { color: #e5e7eb; overflow-wrap: anywhere; }
.if-d-meta-v a {
  color: #c4b5fd; text-decoration: none;
}
.if-d-meta-v a:hover { text-decoration: underline; }
.if-d-tags { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Loading + empty */
.if-empty {
  text-align: center; padding: 2.5rem 1rem;
  color: var(--text-secondary, #94a3b8);
  background: var(--bg-secondary, #111);
  border: 1px dashed var(--border, #333);
  border-radius: 8px;
}
.if-meta {
  margin: .85rem 0 0;
  color: var(--text-secondary, #94a3b8);
  font-size: .76rem;
  text-align: center;
}
.if-load-more {
  display: block; margin: 1rem auto 0;
  background: var(--bg-secondary, #111);
  color: #e5e7eb;
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  padding: .5rem 1.2rem;
  font: inherit; font-size: .85rem;
  cursor: pointer;
}
.if-load-more:hover { border-color: #475569; }

/* Health tile — operator's 3am view. Renders ai-feed/data/learning/
 * health_snapshot.json. Single colored summary chip + collapsible per-
 * output table + cost line. */
.if-health {
  margin: 0 0 1rem;
  background: var(--bg-secondary, #111);
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  padding: .8rem 1rem;
  position: relative;
  overflow: hidden;
}
.if-health::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: #4ade80;
}
.if-health[data-status="warn"]::before    { background: #fbbf24; }
.if-health[data-status="stale"]::before   { background: #f87171; }
.if-health[data-status="missing"]::before { background: #ef4444; }
.if-health[data-status="unknown"]::before { background: #94a3b8; }
.if-health-head {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
}
.if-health-status {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .82rem; font-weight: 600;
  padding: .2rem .5rem; border-radius: 4px;
  background: rgba(74, 222, 128, .14); color: #86efac;
  letter-spacing: .04em;
}
.if-health[data-status="warn"]    .if-health-status { background: rgba(251, 191, 36, .14); color: #fde047; }
.if-health[data-status="stale"]   .if-health-status { background: rgba(248, 113, 113, .14); color: #fca5a5; }
.if-health[data-status="missing"] .if-health-status { background: rgba(239, 68, 68, .18);  color: #fca5a5; }
.if-health[data-status="unknown"] .if-health-status { background: rgba(148, 163, 184, .14); color: #cbd5e1; }
.if-health-summary {
  font-size: .82rem; color: var(--text-secondary, #94a3b8);
  flex: 1; min-width: 16rem;
}
.if-health-summary strong { color: #e5e7eb; font-weight: 600; }
.if-health-cost {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .76rem; color: #fcd34d;
  white-space: nowrap;
}
.if-health-toggle {
  background: transparent; border: 0;
  color: var(--text-secondary, #94a3b8);
  font: inherit; font-size: .76rem;
  cursor: pointer; padding: .2rem .5rem;
  border-radius: 4px;
}
.if-health-toggle:hover { color: #e5e7eb; background: rgba(148,163,184,.08); }
.if-health-detail {
  margin-top: .7rem; padding-top: .7rem;
  border-top: 1px solid var(--border, #333);
  display: none;
  font-size: .78rem;
}
.if-health.open .if-health-detail { display: block; }
.if-health-grid {
  display: grid; grid-template-columns: 9rem 1fr auto auto;
  gap: .25rem .75rem; align-items: baseline;
}
.if-health-grid > div {
  padding: .12rem 0;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: .76rem;
}
.if-health-name { color: #e5e7eb; }
.if-health-age  { color: var(--text-secondary, #94a3b8); text-align: right; }
.if-health-rows { color: var(--text-secondary, #94a3b8); text-align: right; min-width: 5rem; }
.if-health-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: .35rem;
  background: #4ade80; vertical-align: middle;
}
.if-health-dot[data-s="warn"]    { background: #fbbf24; }
.if-health-dot[data-s="stale"]   { background: #f87171; }
.if-health-dot[data-s="missing"] { background: #ef4444; }
.if-health-dot[data-s="unknown"] { background: #94a3b8; }

@media (max-width: 720px) {
  .if-health-grid { grid-template-columns: 1fr auto; }
  .if-health-rows { display: none; }
}
