/* Intelligence Hub / Competitors / Sources — deal-intelligence theme.
   Follows the site's light/dark setting (data-theme on <html>, set from the
   'rn-theme' localStorage key, same as every other page). */

/* ── Light (default) ─────────────────────────────────────────────────────── */
:root,
[data-theme="light"] {
  /* Uniform Intelligence Hub card height (single knob — nudge to taste).
     This is the full rendered height (cards use border-box). 254px matches a
     typical LinkedIn-post card. */
  --ih-card-h: 254px;
  --ih-bg-0: #f4f5fb;
  --ih-bg-1: #e9ebf6;
  --ih-card: #ffffff;
  --ih-card-hover: #f3f5fd;
  /* Panels that float over the page — menus, flyouts — cannot use --ih-card:
     it is translucent in dark mode, which is right for a card sitting on the
     canvas and wrong for an overlay you are meant to read. */
  --ih-overlay: #ffffff;
  --ih-line: #e3e6f1;
  --ih-line-strong: #cdd2e6;
  --ih-violet: var(--brand-600);
  --ih-violet-2: var(--brand-600);
  --ih-blue: #2563eb;
  --ih-cyan: #0284c7;
  /* Status colours alias the canonical --th-* set (theme.css); the literal
     fallbacks cover control-plane pages, which load only this stylesheet. */
  --ih-green: var(--th-success, #059669);
  --ih-red: var(--th-danger, #dc2626);
  --ih-amber: var(--th-warning, #d97706);
  --ih-strong: #0f172a;
  --ih-text: #1e293b;
  --ih-text-soft: #334155;
  --ih-muted: #64748b;
  --ih-faint: #94a3b8;
  --ih-input-bg: #ffffff;
  --ih-input-bg-soft: #eef1f9;
  --ih-surface: #f6f7fc;
  --ih-modal-bg: #ffffff;
  --ih-toast-bg: #ffffff;
  --ih-panel-bg: #ffffff;
}

/* ── Dark ────────────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --ih-bg-0: var(--brand-ink-0);
  --ih-bg-1: var(--brand-ink-1);
  --ih-card: rgba(15, 17, 38, 0.72);
  --ih-card-hover: rgba(22, 25, 52, 0.85);
  --ih-overlay: #14162e;
  --ih-line: rgba(148, 155, 220, 0.14);
  --ih-line-strong: rgba(148, 155, 220, 0.26);
  --ih-violet: var(--brand-600);
  --ih-violet-2: var(--brand-400);
  --ih-blue: #60a5fa;
  --ih-cyan: #38bdf8;
  --ih-green: var(--th-success, #34d399);
  --ih-red: var(--th-danger, #f87171);
  --ih-amber: var(--th-warning, #fbbf24);
  --ih-strong: #ffffff;
  --ih-text: #f1f2fb;
  --ih-text-soft: #c6cbe8;
  --ih-muted: #9aa0c3;
  --ih-faint: #6a7093;
  --ih-input-bg: rgba(8, 9, 20, 0.7);
  --ih-input-bg-soft: rgba(8, 9, 20, 0.55);
  --ih-surface: rgba(255, 255, 255, 0.03);
  --ih-modal-bg: #0e1022;
  --ih-toast-bg: #16193a;
  --ih-panel-bg: rgba(10, 12, 28, 0.96);
}

html, body { background: var(--ih-bg-0); }
body { margin: 0; }

/* The platform rail stays fixed on the left (56px); the hub is the flex-grow
   content inside .container and scrolls internally. padding-left clears the
   fixed rail without leaving the rest of the window unfilled. */
.intel-hub {
  flex: 1 1 auto;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  padding-left: 56px;
  padding-top: 52px;
  color: var(--ih-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Arial, sans-serif;
  background:
    radial-gradient(900px 600px at 80% 0%, color-mix(in srgb, var(--brand-600) 12%, transparent) 0%, transparent 55%),
    radial-gradient(700px 500px at 60% 100%, color-mix(in srgb, var(--brand-500) 8%, transparent) 0%, transparent 55%),
    linear-gradient(160deg, var(--ih-bg-0), var(--ih-bg-1) 70%);
  display: flex;
  flex-direction: column;
}

/* ─── header ─────────────────────────────────────────────────────────────── */
.ih-header {
  display: flex; align-items: flex-start; gap: 20px;
  padding: 26px 30px 0;
}
.ih-title-wrap { flex: 0 0 auto; }
.ih-title { display: flex; align-items: center; gap: 10px; font-size: 26px; font-weight: 800; margin: 0; color: var(--ih-strong); }
.ih-title .ih-spark { color: var(--ih-violet-2); }
.ih-subtitle { margin: 4px 0 0; font-size: 13.5px; color: var(--ih-muted); }

.ih-header-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.ih-search {
  position: relative; display: flex; align-items: center;
  background: var(--ih-input-bg); border: 1px solid var(--ih-line);
  border-radius: 11px; padding: 0 12px; height: 42px; min-width: 280px;
}
.ih-search svg { width: 17px; height: 17px; stroke: var(--ih-faint); fill: none; stroke-width: 2; }
.ih-search input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--ih-text); font-size: 14px; padding: 0 10px;
}
.ih-search input::placeholder { color: var(--ih-faint); }
.ih-search kbd {
  font-size: 11px; color: var(--ih-muted); background: color-mix(in srgb, var(--brand-600) 12%, transparent);
  border-radius: 6px; padding: 2px 6px; font-family: inherit;
}
.ih-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 42px; padding: 0 14px; border-radius: 11px;
  background: var(--ih-input-bg); border: 1px solid var(--ih-line);
  color: var(--ih-text); font-size: 13.5px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: border-color .15s, background .15s;
  /* .ih-btn is a class, not an element, so it is also used on <a> — without
     this the browser's default underline shows through on those. */
  text-decoration: none;
}
.ih-btn:hover { border-color: var(--ih-line-strong); background: var(--ih-card-hover); }
.ih-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.ih-btn--primary {
  background: linear-gradient(90deg, var(--brand-600), var(--brand-700));
  border: none; color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--brand-600) 30%, transparent);
}
/* .ih-btn:hover repaints the background, and it out-specifies the variant's
   own background — so a hover that only brightens leaves white label text on
   the pale hover fill. Every filled variant repaints its own fill on hover. */
.ih-btn--primary:hover {
  background: linear-gradient(90deg, var(--brand-600), var(--brand-700));
  color: #fff; filter: brightness(1.08);
}
.ih-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand-accent), var(--brand-600)); color: #fff;
  font-weight: 700; font-size: 15px; position: relative;
}
.ih-avatar::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #34d399; border: 2px solid var(--ih-bg-0);
}

/* ─── controls row (tabs + filters) ──────────────────────────────────────── */
.ih-controls {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 30px 4px;
}
.ih-tabs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: var(--ih-input-bg-soft); border: 1px solid var(--ih-line);
  border-radius: 12px; padding: 4px; }
.ih-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 9px; border: none; cursor: pointer;
  background: none; color: var(--ih-muted); font-size: 13.5px; font-weight: 600;
  transition: background .15s, color .15s;
}
.ih-tab:hover { color: var(--ih-text); }
.ih-tab.active { background: linear-gradient(90deg, var(--brand-600), var(--brand-700)); color: #fff; }
.ih-tab .ih-tab-count {
  font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand-600) 14%, transparent); color: var(--ih-muted);
}
.ih-tab.active .ih-tab-count { background: rgba(255,255,255,0.25); color: #fff; }

.ih-filters { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.ih-daterange { font-size: 12.5px; color: var(--ih-muted); text-align: right; line-height: 1.3; }
.ih-daterange strong { display: block; color: var(--ih-text); font-weight: 600; }
.ih-sources-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 10px;
  background: var(--ih-input-bg); border: 1px solid var(--ih-line);
  font-size: 13px; color: var(--ih-text); font-weight: 600;
}
.ih-sources-pill .ih-count-badge {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand-600) 18%, transparent); color: var(--ih-violet-2);
}

/* ─── body: grid + side panel ────────────────────────────────────────────── */
.ih-body { display: flex; gap: 0; flex: 1; min-height: 0; }
.ih-main { flex: 1; min-width: 0; padding: 16px 30px 40px; overflow: visible; }

.ih-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.ih-body.panel-open .ih-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }

/* ─── card ───────────────────────────────────────────────────────────────── */
.ih-card {
  background: var(--ih-card); border: 1px solid var(--ih-line);
  border-radius: 15px; padding: 15px 16px; cursor: pointer;
  transition: border-color .15s, transform .08s, background .15s;
  display: flex; flex-direction: column; gap: 11px;
  /* uniform height across cards; border-box so --ih-card-h is the real height */
  height: var(--ih-card-h); box-sizing: border-box; overflow: hidden;
}
.ih-card:hover { border-color: var(--ih-line-strong); background: var(--ih-card-hover); }
.ih-card.selected { border-color: var(--ih-violet); box-shadow: 0 0 0 1px var(--ih-violet); }

.ih-card-top { display: flex; align-items: center; gap: 10px; }
.ih-src {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; background: #fff; border: 1px solid var(--ih-line);
}
/* Brand glyphs (from source-glyphs.js) sized to fill the avatar tile. */
.ih-src .src-glyph { width: 100%; height: 100%; background: transparent; border: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px; }
.ih-src .src-glyph--logo svg { width: 18px; height: 18px; display: block; }
.ih-src .src-glyph--letter { font-weight: 800; font-size: 14px; }

/* Competitor-led header: company name + "via <platform>" subtitle. */
.ih-card-who { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.ih-card-company { font-size: 14.5px; font-weight: 700; color: var(--ih-strong);
  line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ih-card-via { font-size: 11.5px; color: var(--ih-faint); line-height: 1.2; }
.ih-src-label { font-size: 13px; font-weight: 600; color: var(--ih-text); }
.ih-card-time { margin-left: auto; font-size: 12px; color: var(--ih-faint); white-space: nowrap; align-self: flex-start; }

/* The item's own headline is now the SECONDARY line, under the competitor. */
.ih-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; margin: 0; color: var(--ih-text);
  /* Clamp to 2 lines via max-height (reliable for a flex child, unlike
     -webkit-line-clamp which mis-sizes here); never shrink. */
  max-height: 2.6em; overflow: hidden; flex: 0 0 auto; }
.ih-card-summary { font-size: 13px; line-height: 1.5; color: var(--ih-muted); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1 1 auto; min-height: 0; }   /* absorbs slack so the footer never clips */
.ih-card-metric {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  font-size: 12.5px; font-weight: 700; color: var(--th-success-ink);
  background: color-mix(in srgb, var(--th-success) 12%, transparent);
  border-radius: 8px; padding: 5px 10px;
  flex: 0 0 auto;
}

.ih-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 0 0 auto; }
.ih-chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--brand-600) 12%, transparent); color: var(--ih-muted); white-space: nowrap;
}
.ih-chip--impact-high { background: color-mix(in srgb, var(--brand-500) 20%, transparent); color: var(--ih-violet-2); }
.ih-chip--impact-medium { background: rgba(59,130,246,0.18); color: var(--ih-blue); }
.ih-chip--impact-low { background: color-mix(in srgb, var(--brand-600) 10%, transparent); color: var(--ih-muted); }
.ih-chip--confidence { background: color-mix(in srgb, var(--th-success) 16%, transparent); color: var(--th-success-ink); }
.ih-chip--risk { background: color-mix(in srgb, var(--th-danger) 14%, transparent); color: var(--th-danger-ink); }
.ih-chip--weakness { background: color-mix(in srgb, var(--th-warning) 16%, transparent); color: var(--th-warning-ink); }
.ih-chip--opportunity { background: color-mix(in srgb, var(--th-success) 16%, transparent); color: var(--th-success-ink); }
.ih-chip--reaction { background: rgba(2,132,199,0.16); color: var(--ih-cyan); }
/* "+N similar" — corroboration, not a signal attribute, so it reads as neutral
   metadata rather than competing with the impact/confidence chips beside it. */
.ih-chip--dupe { background: color-mix(in srgb, var(--brand-600) 14%, transparent); color: var(--ih-muted); font-weight: 600; }

/* Keyword vs meaning search toggle. */
.ih-mode {
  display: inline-flex; border: 1px solid var(--ih-line); border-radius: 8px;
  overflow: hidden; background: var(--ih-surface); flex: none;
}
.ih-mode-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; padding: 7px 12px;
  color: var(--ih-muted); white-space: nowrap;
}
.ih-mode-btn:hover { color: var(--ih-text); }
.ih-mode-btn.active {
  background: color-mix(in srgb, var(--brand-600) 22%, transparent);
  color: var(--ih-violet-2);
}
.ih-notice {
  margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; font-size: 12.5px;
  background: color-mix(in srgb, var(--th-warning) 14%, transparent); color: var(--th-warning-ink);
}

/* "full article" chip — the item has retrieved text, not just a teaser. */
.ih-chip--article { background: color-mix(in srgb, var(--th-success) 16%, transparent); color: var(--th-success-ink); font-weight: 600; }

/* Extracted intelligence (detail panel) — our summary of a source article,
   never the article. No collapse/expand here on purpose: this is a few
   sentences by design, and a "show more" control would imply there is a full
   copy behind it. */
.ih-article { font-size: 13px; line-height: 1.65; color: var(--ih-text); }
.ih-article p { margin: 0 0 10px; }
.ih-article-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ih-faint); margin-bottom: 8px; }
.ih-article-meta a { color: var(--ih-violet-2); text-decoration: none; }

/* The one short quotation we keep. Attribution is inside the blockquote rather
   than nearby, so a quote can never be rendered without its source. */
.ih-excerpt {
  margin: 0 0 12px; padding: 10px 14px;
  border-left: 3px solid var(--ih-violet-2);
  background: rgba(139,92,246,0.07);
  font-size: 13px; line-height: 1.6; font-style: italic; color: var(--ih-text);
}
.ih-excerpt cite { display: block; margin-top: 6px;
  font-style: normal; font-size: 11.5px; color: var(--ih-faint); }
.ih-excerpt cite a { color: var(--ih-violet-2); text-decoration: none; }

/* Extracted facts. Facts are not protected expression — this is the half of
   the article we are entitled to keep, so it gets the prominence. */
.ih-facts { margin: 0 0 10px; padding-left: 18px;
  font-size: 12.5px; line-height: 1.6; color: var(--ih-text); }
.ih-facts li { margin-bottom: 4px; }
.ih-facts-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.ih-article-note { margin: 4px 0 0; font-size: 11px; line-height: 1.5;
  color: var(--ih-faint); }
.ih-article-note a { color: var(--ih-violet-2); text-decoration: none; }

/* Other outlets that filed the same story (detail panel). */
.ih-dupe-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--ih-line); font-size: 12.5px;
}
.ih-dupe-item:last-child { border-bottom: 0; }
.ih-dupe-item .d-label { color: var(--ih-text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ih-dupe-item .d-time { color: var(--ih-faint); font-size: 11.5px; white-space: nowrap; }
.ih-dupe-item .d-open { color: var(--ih-muted); display: inline-flex; }
.ih-dupe-item .d-open svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

.ih-card-foot {
  display: flex; align-items: center; gap: 16px;
  padding-top: 10px; border-top: 1px solid var(--ih-line);
  font-size: 12px; color: var(--ih-faint);
  margin-top: auto;   /* pin to the bottom (cards with no summary still align) */
}
.ih-card-foot .ih-stat { display: inline-flex; align-items: center; gap: 5px; }
.ih-card-foot svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.ih-bookmark { margin-left: auto; background: none; border: none; cursor: pointer; color: var(--ih-faint); padding: 2px; display: inline-flex; }
.ih-bookmark.on { color: var(--ih-violet); }
.ih-bookmark.on svg { fill: currentColor; }

/* loading + empty */
.ih-sentinel { height: 40px; }
.ih-loading, .ih-empty {
  grid-column: 1 / -1; text-align: center; color: var(--ih-muted);
  padding: 40px 0; font-size: 14px;
}
.ih-skel {
  background: var(--ih-card); border: 1px solid var(--ih-line); border-radius: 15px;
  height: var(--ih-card-h); box-sizing: border-box; position: relative; overflow: hidden;
}
.ih-skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--brand-600) 6%, transparent), transparent);
  /* Shares the keyframes defined in styles.css — one shimmer, not two. */
  transform: translateX(-100%); animation: rn-shimmer 1.3s infinite;
}
@media (prefers-reduced-motion: reduce) { .ih-skel::after { animation: none; } }

/* ─── side panel ─────────────────────────────────────────────────────────── */
.ih-panel {
  width: 0; flex: 0 0 0; overflow: hidden;
  background: var(--ih-panel-bg);
  border-left: 1px solid var(--ih-line);
  transition: width .2s ease, flex-basis .2s ease;
  position: sticky; top: 0; align-self: stretch; max-height: 100vh;
}
.ih-body.panel-open .ih-panel { width: 430px; flex: 0 0 430px; }
.ih-panel-inner { width: 430px; height: 100vh; overflow-y: auto; padding: 22px 24px 40px; }
.ih-panel-inner::-webkit-scrollbar { width: 8px; }
.ih-panel-inner::-webkit-scrollbar-thumb { background: var(--ih-line-strong); border-radius: 8px; }

.ih-panel-kicker { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ih-panel-kicker .k-text { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ih-violet-2); }
.ih-panel-close { background: none; border: none; cursor: pointer; color: var(--ih-muted); padding: 4px; display: inline-flex; }
.ih-panel-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.ih-panel-srcline { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ih-panel-srcline .ih-src { width: 26px; height: 26px; font-size: 13px; }
.ih-panel-srcline .p-badges { margin-left: auto; display: flex; gap: 6px; }

.ih-panel-title { font-size: 21px; font-weight: 800; line-height: 1.25; color: var(--ih-strong); margin: 0 0 16px; }

.ih-panel-actions { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.ih-panel-actions .ih-btn { height: 38px; font-size: 13px; }
.ih-pa-more { width: 38px; justify-content: center; padding: 0; }

.ih-panel-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--ih-line); margin-bottom: 18px; }
.ih-panel-tab {
  background: none; border: none; cursor: pointer; padding: 9px 4px; margin-right: 16px;
  color: var(--ih-muted); font-size: 13.5px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ih-panel-tab.active { color: var(--ih-strong); border-bottom-color: var(--ih-violet); }

.ih-panel-section { margin-bottom: 22px; }
.ih-panel-section h4 { font-size: 12.5px; font-weight: 700; color: var(--ih-text); margin: 0 0 10px; }
.ih-panel-section p { font-size: 13.5px; line-height: 1.55; color: var(--ih-text-soft); margin: 0; }

.ih-evidence-item {
  display: flex; align-items: center; gap: 11px;
  background: var(--ih-surface); border: 1px solid var(--ih-line);
  border-radius: 11px; padding: 11px 13px; margin-bottom: 8px;
}
.ih-evidence-item .e-body { flex: 1; min-width: 0; }
.ih-evidence-item .e-label { font-size: 13px; font-weight: 600; color: var(--ih-text); display: block; }
.ih-evidence-item .e-meta { font-size: 11.5px; color: var(--ih-faint); }
.ih-evidence-item a.e-open { color: var(--ih-muted); display: inline-flex; }
.ih-evidence-item a.e-open svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }

.ih-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ih-subcard { background: var(--ih-surface); border: 1px solid var(--ih-line); border-radius: 13px; padding: 14px; }
.ih-subcard h4 { margin: 0 0 12px; }
.ih-acct { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.ih-acct .a-avatar { width: 22px; height: 22px; border-radius: 6px; background: color-mix(in srgb, var(--brand-600) 22%, transparent); color: var(--ih-violet-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: 0 0 auto; }
.ih-acct .a-name { font-size: 12.5px; font-weight: 600; color: var(--ih-text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ih-acct .a-note { font-size: 10.5px; color: var(--ih-faint); }
.ih-fit { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.ih-fit-high { background: color-mix(in srgb, var(--th-success) 16%, transparent); color: var(--th-success-ink); }
.ih-fit-medium { background: color-mix(in srgb, var(--th-warning) 16%, transparent); color: var(--th-warning-ink); }
.ih-fit-low { background: color-mix(in srgb, var(--brand-600) 10%, transparent); color: var(--ih-muted); }

.ih-impact-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; margin-bottom: 11px; }
.ih-impact-row .i-label { color: var(--ih-muted); display: inline-flex; align-items: center; gap: 7px; }
.ih-impact-row svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.ih-impact-val { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.ih-impact-val.high { color: var(--ih-red); }
.ih-impact-val.medium { color: var(--ih-amber); }
.ih-impact-val.low { color: var(--ih-green); }

.ih-suggest {
  display: flex; align-items: center; gap: 11px;
  background: var(--ih-surface); border: 1px solid var(--ih-line);
  border-radius: 11px; padding: 11px 13px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .15s;
}
.ih-suggest:hover { border-color: var(--ih-line-strong); }
.ih-suggest .s-icon { width: 26px; height: 26px; border-radius: 7px; background: color-mix(in srgb, var(--brand-600) 18%, transparent); color: var(--ih-violet-2); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; font-size: 13px; }
.ih-suggest .s-body { flex: 1; min-width: 0; }
.ih-suggest .s-label { font-size: 13px; font-weight: 600; color: var(--ih-text); display: block; }
.ih-suggest .s-detail { font-size: 11.5px; color: var(--ih-faint); }
.ih-suggest .s-arrow { color: var(--ih-faint); }
.ih-suggest .s-arrow svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ─── modal (create / edit) ──────────────────────────────────────────────── */
.ih-modal-overlay {
  position: fixed; inset: 0; background: rgba(3,4,12,0.55); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 2000; padding: 24px;
}
.ih-modal-overlay.open { display: flex; }
.ih-modal {
  width: 560px; max-width: 100%; max-height: 90vh; overflow-y: auto;
  background: var(--ih-modal-bg); border: 1px solid var(--ih-line-strong); border-radius: 16px;
  padding: 24px 26px; box-shadow: 0 30px 80px rgba(2,3,10,0.45); color: var(--ih-text);
}
.ih-modal h3 { margin: 0 0 18px; font-size: 19px; font-weight: 800; color: var(--ih-strong); }
.ih-field { margin-bottom: 14px; }
.ih-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ih-muted); margin-bottom: 6px; }
.ih-field input, .ih-field textarea, .ih-field select {
  width: 100%; box-sizing: border-box; background: var(--ih-input-bg);
  border: 1px solid var(--ih-line); border-radius: 10px; padding: 10px 12px;
  color: var(--ih-text); font-size: 13.5px; font-family: inherit;
}
.ih-field textarea { resize: vertical; min-height: 70px; }
.ih-field input:focus, .ih-field textarea:focus, .ih-field select:focus {
  outline: none; border-color: var(--ih-violet); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-600) 18%, transparent);
}
.ih-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ih-modal-foot { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.ih-modal-foot .spacer { flex: 1; }
.ih-modal-err { color: var(--ih-red); font-size: 12.5px; margin-right: auto; }
.ih-btn--danger { background: color-mix(in srgb, var(--th-danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--th-danger) 35%, transparent);
  color: var(--th-danger-ink); }
.ih-btn--danger:hover {
  background: color-mix(in srgb, var(--th-danger) 18%, transparent);
  border-color: color-mix(in srgb, var(--th-danger) 45%, transparent);
  color: var(--th-danger-ink);
}
.ih-btn--ghost { background: none; }

/* toast */
.ih-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ih-toast-bg); border: 1px solid var(--ih-line-strong); color: var(--ih-text);
  padding: 12px 20px; border-radius: 11px; font-size: 13.5px; z-index: 3000;
  opacity: 0; transition: opacity .2s, transform .2s; box-shadow: 0 12px 30px rgba(2,3,10,0.25);
}
.ih-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1100px) {
  .ih-body.panel-open .ih-panel { position: fixed; right: 0; top: 0; z-index: 1500; width: 430px; flex-basis: 430px; box-shadow: -20px 0 60px rgba(0,0,0,0.35); }
  .ih-two-col { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .ih-panel-inner, .ih-body.panel-open .ih-panel { width: 100vw; flex-basis: 100vw; }
  .ih-panel-inner { width: 100vw; }
}
