/* ============================================================
   AG Insights — M&A Target Intelligence (Phase 1: Identify)
   Design system: style-app.md v2.0 · components: guide-dashboard-components.md
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Sora:wght@300;400;500;600;700&display=swap');

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

html, body { background: #F0F2F5; min-height: 100%; }
body {
  font-family: 'Sora', sans-serif;
  color: #1C2833;
  line-height: 1.65;
  font-size: 0.95rem;
  padding-bottom: 60px;
  -webkit-font-smoothing: antialiased;
}

/* ── Header (matches the AG Insights CI demo hero) ─────────── */
.header {
  background: linear-gradient(135deg, #000000 0%, #1a1445 50%, #211951 100%);
  text-align: center;
  padding: 1.8rem 3rem 2.6rem;
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(74,144,226,0.06) 0%, transparent 60%);
  pointer-events: none;
}
.header-logo { display: block; height: 72px; width: auto; margin: 0 auto 0.6rem; position: relative; }
.header .subtitle {
  color: rgba(255,255,255,0.85); font-size: 1.2rem; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 0;
  position: relative; letter-spacing: 0.02em; max-width: 780px; margin: 0 auto 0.5rem; flex-wrap: wrap;
}
.header .subtitle span { display: flex; align-items: center; }
.header .subtitle span::before { content: "\00B7"; margin: 0 0.6rem; opacity: 0.4; }
.header .subtitle span:first-child::before { display: none; }
.header .subtitle span:empty { display: none; }
.home-btn {
  display: inline-flex; align-items: center; gap: 6px;
  position: absolute; top: 1.5rem; left: 2rem;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: rgba(255,255,255,0.6);
  font-family: 'Sora', sans-serif; font-size: 0.8rem; font-weight: 500;
  text-decoration: none; padding: 0 12px; height: 36px; transition: all 0.2s ease;
}
.home-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }
.home-btn svg { flex-shrink: 0; }

/* ── Container ─────────────────────────────────────────────── */
.container { max-width: 1500px; margin: 0 auto; padding: 0 20px; }

/* ── KPI strip ─────────────────────────────────────────────── */
.exec-summary {
  max-width: 1500px; margin: 0 auto; padding: 0 20px;
  transform: translateY(-1.5rem); margin-bottom: 0.2rem;
  position: relative; z-index: 10;
}
.exec-summary-inner {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  background: #DDE2E6; border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.06);
}
.exec-stat { background: #fff; padding: 1.2rem 1rem; text-align: center; transition: background 0.2s ease; }
.exec-stat:hover { background: #FAFBFC; }
.exec-stat-number { font-family: 'Instrument Serif', serif; font-size: 2.1rem; font-weight: 400; color: #1C2833; line-height: 1.1; margin-bottom: 0.15rem; }
.exec-stat-number.accent { color: #2E5BA8; }
.exec-stat-number.green  { color: #1E8449; }
.exec-stat-number.teal   { color: #0E9F8E; }
.exec-stat-number.amber  { color: #B7770A; }
.exec-stat-label { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: #85929E; }

/* ── Section panels ────────────────────────────────────────── */
.section {
  background: #fff; border-radius: 8px; padding: 28px 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08); margin-bottom: 22px;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.section-title { font-family: 'Instrument Serif', serif; font-size: 1.4rem; font-weight: 400; color: #1C2833; margin-bottom: 6px; }

/* ── Filter bar ────────────────────────────────────────────── */
.filter-bar { display: flex; gap: 0.9rem; align-items: center; margin-bottom: 1.3rem; flex-wrap: wrap; }
.filter-bar input[type="text"] {
  flex: 1; min-width: 220px; padding: 0.7rem 1.05rem; border: 1px solid #E4E8EB; border-radius: 8px;
  font-family: 'Sora', sans-serif; font-size: 0.85rem; color: #1C2833; background: #fff; transition: all 0.2s ease;
}
.filter-bar input::placeholder { color: #A0AAB4; }
.filter-bar input:focus, .filter-bar select:focus { outline: none; border-color: #4A90E2; box-shadow: 0 0 0 3px rgba(74,144,226,0.08); }
.filter-controls { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.filter-bar select {
  padding: 0.7rem 2.4rem 0.7rem 1rem; border: 1px solid #E4E8EB; border-radius: 8px;
  font-family: 'Sora', sans-serif; font-size: 0.85rem; color: #1C2833; cursor: pointer; transition: all 0.2s ease;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235D6D7E' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") no-repeat right 1rem center;
  -webkit-appearance: none; appearance: none;
}
.result-count { color: #85929E; font-size: 0.8rem; font-weight: 500; margin-bottom: 0.9rem; }

/* ── Stage rail (Identify → Assess → Benchmark stepper) ─────── */
.stage-section { padding-bottom: 24px; }
.stage-rail { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.stage-step { flex: 1; min-width: 200px; padding: 14px 16px; border-radius: 10px; background: #F4F6F8; border: 1px solid #E4E8EB; transition: all 0.2s ease; }
.stage-step.current { background: linear-gradient(135deg, #211951 0%, #3a2f7e 70%, #4A3FA0 130%); border-color: transparent; box-shadow: 0 6px 20px rgba(33,25,81,0.28); color: #fff; }
.stage-step .s-top { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.stage-step .s-n { font-family: 'Instrument Serif', serif; font-size: 1.3rem; line-height: 1; color: #C7CDD6; }
.stage-step.current .s-n { color: rgba(255,255,255,0.45); }
.stage-step .s-label { font-size: 1rem; font-weight: 700; color: #1C2833; }
.stage-step.current .s-label { color: #fff; }
.stage-step .s-verb { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #0E9F8E; margin-bottom: 4px; }
.stage-step.current .s-verb { color: #15F5BA; }
.stage-step .s-desc { font-size: 0.8rem; color: #5D6D7E; line-height: 1.4; }
.stage-step.current .s-desc { color: rgba(255,255,255,0.82); }
.stage-step .s-here { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #15F5BA; margin-top: 6px; }
.stage-arrow { align-self: center; color: #C7CDD6; font-size: 1.3rem; padding: 0 6px; flex-shrink: 0; }
.stage-output { margin-top: 14px; font-size: 0.85rem; color: #1C2833; background: #F4F6F8; border-left: 3px solid #15F5BA; border-radius: 6px; padding: 10px 14px; }
.stage-output strong { color: #0E9F8E; }
@media (max-width: 760px) { .stage-arrow { display: none; } .stage-step { min-width: 100%; margin-bottom: 8px; } }

/* ── Target grid + cards ───────────────────────────────────── */
.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.target-card {
  background: #fff; border-radius: 12px; padding: 18px 20px 16px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.06);
  border: 1px solid #E4E8EB; transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden;
}
.target-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent, #4A90E2); }
.target-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,0.14); }
.card-rank { position: absolute; top: 14px; right: 16px; font-family: 'Instrument Serif', serif; font-size: 1.4rem; color: #C7CDD6; line-height: 1; }
.card-head { display: flex; flex-direction: column; gap: 4px; padding-right: 30px; }
.card-name { font-size: 1.05rem; font-weight: 600; color: #1C2833; line-height: 1.25; }
.card-name .prefund { color: #B7770A; font-size: 0.85rem; }
.card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tier-badge { font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.15rem 0.5rem; border-radius: 5px; }
.tier-1 { color: #2E5BA8; background: rgba(46,91,168,0.1); }
.tier-2 { color: #0E9F8E; background: rgba(14,159,142,0.12); }
.tier-3 { color: #8257C7; background: rgba(130,87,199,0.12); }
.card-country { font-size: 0.74rem; color: #85929E; }

/* score block in card */
.card-score-row { display: flex; align-items: center; gap: 12px; }
.card-score-num { font-family: 'Instrument Serif', serif; font-size: 2.1rem; line-height: 1; }
.card-score-meta { display: flex; flex-direction: column; gap: 2px; }
.card-score-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.07em; color: #85929E; font-weight: 600; }
.card-score-band { font-size: 0.78rem; font-weight: 500; }

/* essence chips */
.essence-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.echip {
  font-size: 0.68rem; font-weight: 600; padding: 0.18rem 0.5rem; border-radius: 20px;
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
}
.echip .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.echip.yes     { color: #1E8449; background: rgba(30,132,73,0.09); }
.echip.yes .dot{ background: #1E8449; }
.echip.partial { color: #B7770A; background: rgba(183,119,10,0.09); }
.echip.partial .dot{ background: #E5A100; }
.echip.no      { color: #98A0AA; background: rgba(160,170,180,0.10); }
.echip.no .dot { background: #B4BBC4; }
.echip.prefund { color: #fff; background: linear-gradient(135deg,#B7770A,#E5A100); }
.echip.prefund .dot { background: #fff; }

/* revenue + band badge */
.band-badge { font-size: 0.72rem; font-weight: 600; padding: 0.18rem 0.55rem; border-radius: 5px; }
.band-in           { color: #1E8449; background: rgba(30,132,73,0.1); }
.band-marginal_high, .band-marginal_low { color: #B7770A; background: rgba(183,119,10,0.1); }
.band-clear_high, .band-clear_low { color: #C0392B; background: rgba(192,57,43,0.1); }
.band-unknown      { color: #85929E; background: rgba(133,146,158,0.12); }
.card-rev { font-size: 0.8rem; color: #5D6D7E; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-rev .figure { font-weight: 600; color: #1C2833; }

/* ── Score badge / bar (pattern-scoring.md) ────────────────── */
.score-very-high { color: #1E8449; } .score-high { color: #28B463; }
.score-moderate { color: #B7770A; } .score-low { color: #D97218; } .score-very-low { color: #C0392B; }
.score-bar-track { flex: 1; height: 7px; background: #E4E8EB; border-radius: 4px; overflow: hidden; min-width: 80px; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s ease; }

/* ── Modal / detail ────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(10,8,30,0.6); z-index: 1001; align-items: flex-start; justify-content: center; padding: 2rem; overflow-y: auto; }
.modal-overlay.active { display: flex; }
.modal-panel { background: #fff; border-radius: 16px; max-width: 880px; width: 100%; box-shadow: 0 24px 80px rgba(0,0,0,0.3); margin: auto 0; overflow: hidden; }
.modal-hero { background: linear-gradient(135deg, #211951 0%, #2d2270 70%, #4A3FA0 140%); color: #fff; padding: 26px 32px; position: relative; }
.modal-hero h2 { font-family: 'Instrument Serif', serif; font-size: 1.8rem; font-weight: 400; line-height: 1.1; margin-bottom: 6px; }
.modal-hero .sub { color: rgba(255,255,255,0.78); font-size: 0.85rem; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.modal-hero .modal-close { position: absolute; top: 18px; right: 22px; background: none; border: none; font-size: 1.7rem; color: rgba(255,255,255,0.7); cursor: pointer; line-height: 1; }
.modal-hero .modal-close:hover { color: #fff; }
.modal-hero-score { position: absolute; top: 22px; right: 60px; text-align: right; }
.modal-hero-score .num { font-family: 'Instrument Serif', serif; font-size: 2.6rem; line-height: 1; color: #15F5BA; }
.modal-hero-score .lbl { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: rgba(255,255,255,0.7); }
.modal-body { padding: 26px 32px; max-height: 64vh; overflow-y: auto; }
.modal-section { margin-bottom: 1.6rem; }
.modal-section h3 { font-family: 'Sora', sans-serif; font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #5D6D7E; margin-bottom: 0.8rem; padding-bottom: 0.4rem; border-bottom: 1px solid #E4E8EB; }

/* essence breakdown rows */
.ess-row { display: grid; grid-template-columns: 180px 64px 1fr; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid #F0F2F4; }
.ess-row:last-child { border-bottom: none; }
.ess-dim { font-weight: 600; font-size: 0.85rem; color: #1C2833; }
.ess-dim small { display: block; color: #A0AAB4; font-weight: 500; font-size: 0.7rem; }
.verdict-pill { font-size: 0.7rem; font-weight: 700; padding: 0.16rem 0.5rem; border-radius: 20px; text-align: center; white-space: nowrap; height: fit-content; }
.verdict-Yes { color: #1E8449; background: rgba(30,132,73,0.1); }
.verdict-Partial { color: #B7770A; background: rgba(183,119,10,0.1); }
.verdict-No { color: #98A0AA; background: rgba(160,170,180,0.12); }
.ess-evidence { font-size: 0.8rem; color: #5D6D7E; font-style: italic; }
.ess-evidence a { color: #4A90E2; text-decoration: none; font-style: normal; font-weight: 600; font-size: 0.72rem; white-space: nowrap; }
.ess-evidence a:hover { text-decoration: underline; }

/* profile grid */
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1.5rem; }
.pfield { display: flex; flex-direction: column; gap: 1px; padding: 4px 0; }
.pfield .lbl { font-size: 0.7rem; color: #85929E; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.pfield .val { font-size: 0.9rem; color: #1C2833; }
.pfield .val a { color: #4A90E2; text-decoration: none; } .pfield .val a:hover { text-decoration: underline; }
.callout-box { background: #F4F6F8; border: 1px solid #E4E8EB; border-left: 3px solid #4A90E2; border-radius: 6px; padding: 12px 14px; font-size: 0.88rem; color: #1C2833; margin-bottom: 10px; }
.callout-box .lbl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: #5D6D7E; font-weight: 700; margin-bottom: 3px; }

/* leadership chips */
.lead-list { display: flex; flex-direction: column; gap: 6px; }
.lead-item { font-size: 0.85rem; } .lead-item .role { color: #85929E; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.lead-item a { color: #4A90E2; text-decoration: none; font-size: 0.78rem; } .lead-item a:hover { text-decoration: underline; }

/* evidence trail (Data Explorer) */
.ev-group { margin-bottom: 10px; }
.ev-group > summary { cursor: pointer; font-weight: 600; font-size: 0.82rem; color: #2E5BA8; padding: 6px 0; list-style: none; }
.ev-group > summary::-webkit-details-marker { display: none; }
.ev-group > summary::before { content: '▸ '; color: #A0AAB4; }
.ev-group[open] > summary::before { content: '▾ '; }
.ev-item { padding: 8px 0 8px 14px; border-bottom: 1px solid #F4F6F8; }
.ev-item .ev-field { font-size: 0.74rem; font-weight: 600; color: #1C2833; display: flex; align-items: center; gap: 8px; }
.ev-item .ev-val { font-size: 0.82rem; color: #1C2833; margin: 2px 0; }
.ev-item .ev-quote { font-size: 0.76rem; color: #85929E; font-style: italic; }
.ev-item .ev-src { font-size: 0.72rem; }
.ev-item .ev-src a { color: #4A90E2; text-decoration: none; } .ev-item .ev-src a:hover { text-decoration: underline; }
.tier-pill { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.08rem 0.4rem; border-radius: 4px; }
.tier-verified { color: #1E8449; background: rgba(30,132,73,0.1); }
.tier-reliable { color: #2E5BA8; background: rgba(46,91,168,0.1); }
.tier-indicative { color: #B7770A; background: rgba(183,119,10,0.1); }
.tier-null, .tier-undefined { color: #98A0AA; background: rgba(160,170,180,0.12); }

.empty-state { text-align: center; padding: 3rem 1rem; color: #A0AAB4; font-style: italic; grid-column: 1 / -1; }

/* ── Footer ────────────────────────────────────────────────── */
.footer { position: fixed; bottom: 0; left: 0; right: 0; background: #000; display: flex; align-items: center; justify-content: center; padding: 9px 20px; box-shadow: 0 -3px 15px rgba(0,0,0,0.3); z-index: 1000; }
.footer-version { position: absolute; right: 20px; font-size: 0.7rem; color: #6B7280; }
.footer-logo { max-height: 26px; width: auto; }
.footer-note { position: absolute; left: 20px; font-size: 0.7rem; color: #6B7280; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .exec-summary-inner { grid-template-columns: repeat(3, 1fr); }
  .ess-row { grid-template-columns: 1fr; gap: 4px; }
}
@media (max-width: 600px) {
  .app-title { font-size: 1.9rem; }
  .exec-summary { transform: none; }
  .exec-summary-inner { grid-template-columns: repeat(2, 1fr); }
  .target-grid { grid-template-columns: 1fr; }
  .modal-overlay { padding: 0; } .modal-panel { border-radius: 0; min-height: 100vh; }
  .pgrid { grid-template-columns: 1fr; }
  .footer-note { display: none; }
}
