/* ===========================================================================
   RTI Wiki — Intelligence apps shared design system (Apple liquid-glass, 2026-05)
   Single source of truth for /intelligence/*.html visual layer.
   Loaded LAST so it overrides per-page inline styles.
   =========================================================================== */

:root {
  /* Tokens — kept identical to citizen-360 so all pages look like one product */
  --rti-ink: #172033;
  --rti-muted: #5f6b7a;
  --rti-line: #dce3ec;
  --rti-paper: #fbfcf8;
  --rti-surface: #ffffff;
  --rti-accent: #0b6b58;
  --rti-accent-2: #c94f28;
  --rti-soft: #eef7f2;
  --rti-shadow: 0 18px 48px rgba(28, 43, 66, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.6);
  --glass-bg-strong: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-blur: 18px;
  --rti-good: #16a34a;
  --rti-warn: #d97706;
  --rti-bad:  #dc2626;
}

/* ---------- Page chrome ---------- */
html, body {
  margin: 0; padding: 0;
  font: 16px/1.6 Inter, system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  color: var(--rti-ink);
  background: linear-gradient(135deg, #f0fbf6 0%, #fbfcf8 60%, #fff5f0 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body { min-height: 100vh; }
.wrap, .intel-page, main, .container, .content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 22px 80px;
}
.back-bar, .back {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-bottom: 14px; font-size: 14px;
}
.back-bar a, .back a {
  color: var(--rti-accent); font-weight: 600; text-decoration: none;
}
.back-bar a:hover, .back a:hover { text-decoration: underline; }

/* ---------- Hero card ---------- */
.hero, .hero-card, .intel-hero {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid rgba(11,107,88,.18);
  border-radius: 22px;
  padding: 32px 36px;
  box-shadow: var(--rti-shadow);
  margin-bottom: 22px;
  position: relative; overflow: hidden;
}
.hero::before, .hero-card::before, .intel-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent 55%);
  border-radius: inherit;
}
.hero > *, .hero-card > *, .intel-hero > * { position: relative; z-index: 1; }
.hero h1, .hero-card h1, .intel-hero h1 {
  margin: 0 0 8px;
  font: 800 32px/1.18 Inter, system-ui, sans-serif;
  letter-spacing: -0.022em;
  color: var(--rti-ink);
}
.hero p.lead, .hero-card p.lead, .intel-hero p.lead, .hero p:first-of-type {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--rti-muted);
  max-width: 820px;
}
.hero-kicker, .kicker {
  display: inline-block;
  background: var(--rti-soft);
  color: var(--rti-accent);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.55px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.hero-pill {
  display: inline-block;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--glass-border);
  color: var(--rti-ink);
  padding: 6px 14px;
  border-radius: 999px;
  font: 600 13.5px Inter, system-ui, sans-serif;
  margin-right: 6px; margin-top: 6px;
}

/* ---------- Section card ---------- */
.section, .card {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid rgba(11,107,88,.16);
  border-radius: 18px;
  padding: 24px 28px;
  margin: 14px 0;
  box-shadow: 0 14px 32px rgba(28,43,66,0.06);
  position: relative;
  overflow: hidden;
}
.section::before, .card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent 55%);
  border-radius: inherit;
}
.section > *, .card > * { position: relative; z-index: 1; }
.section h2, .card h2 {
  margin: 0 0 14px;
  font: 700 20px/1.3 Inter, system-ui, sans-serif;
  letter-spacing: -0.012em;
  color: var(--rti-ink);
  display: flex; align-items: center; gap: 10px;
}
.section h3, .card h3 {
  margin: 18px 0 10px;
  font: 700 16.5px/1.35 Inter, system-ui, sans-serif;
  color: var(--rti-ink);
}
.section p, .card p {
  margin: 0 0 12px;
  font-size: 15px; line-height: 1.65; color: var(--rti-ink);
}
.section ul, .section ol, .card ul, .card ol { padding-left: 20px; line-height: 1.7; }
.section li, .card li { margin: 4px 0; }
.section strong, .card strong { color: var(--rti-accent); font-weight: 700; }
.section code, .card code {
  background: rgba(11,107,88,0.08);
  padding: 1px 7px; border-radius: 5px;
  font: 0.92em ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--rti-accent);
}

/* ---------- Forms ---------- */
.field, label.field, .form-row {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 14px;
}
.field > label, label > span:first-child, .form-row > label {
  font: 600 13px Inter; color: var(--rti-ink);
}
input[type="text"], input[type="number"], input[type="email"], input[type="tel"],
input[type="url"], input[type="search"], input[type="date"], input:not([type]),
select, textarea {
  width: 100%; max-width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--rti-line);
  border-radius: 11px;
  font: 15px Inter, system-ui, sans-serif;
  background: rgba(255,255,255,0.85);
  color: var(--rti-ink);
  transition: border-color .12s, box-shadow .12s, background .12s;
  box-sizing: border-box;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  background: #fff;
  border-color: var(--rti-accent);
  box-shadow: 0 0 0 3px rgba(11,107,88,.16);
}
textarea { min-height: 120px; resize: vertical; font-family: inherit; }

/* hero search row */
.row, .search-row {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 16px;
}
.row > input, .search-row > input {
  flex: 1; min-width: 240px;
  padding: 14px 18px;
  font: 700 17px Inter, system-ui, sans-serif;
  letter-spacing: 0.04em;
}

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 20px;
  font: 600 14.5px Inter, system-ui, sans-serif;
  border: none; border-radius: 11px;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, background .12s, border-color .12s, color .12s;
  text-decoration: none; line-height: 1.2;
  background: rgba(255,255,255,0.85); color: var(--rti-ink);
  border: 1.5px solid var(--rti-line);
}
button:hover:not(:disabled), .btn:hover:not(:disabled) {
  border-color: var(--rti-accent); color: var(--rti-accent);
}
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary, button.primary, button#go, button.run {
  background: linear-gradient(135deg, var(--rti-accent), #094d40);
  color: #fff !important;
  border: none;
  box-shadow: 0 8px 22px rgba(11,107,88,0.24);
}
.btn-primary:hover:not(:disabled), button.primary:hover:not(:disabled),
button#go:hover:not(:disabled), button.run:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(11,107,88,0.34);
  color: #fff !important;
}
.btn-ghost, button.ghost {
  background: rgba(255,255,255,0.7);
  border: 1.5px solid var(--rti-line);
  color: var(--rti-ink);
}
.btn-danger {
  background: var(--rti-bad); color: #fff !important; border: none;
  box-shadow: 0 8px 22px rgba(220,38,38,0.22);
}
.btn-warn {
  background: var(--rti-accent-2); color: #fff !important; border: none;
  box-shadow: 0 8px 22px rgba(201,79,40,0.22);
}

.actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 16px;
}

/* ---------- KPI / fact grid ---------- */
.kpi-grid, .fact-grid, .stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.kpi, .fact, .stat {
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(11,107,88,0.12);
  border-radius: 13px;
  padding: 14px 16px;
  transition: transform .12s, border-color .12s;
}
.kpi:hover, .fact:hover, .stat:hover {
  transform: translateY(-1px);
  border-color: var(--rti-accent);
}
.kpi .label, .fact .label, .fact .l, .stat .label, .kpi-label, .stat-label {
  display: block;
  font: 700 11px Inter, system-ui, sans-serif;
  text-transform: uppercase;
  color: var(--rti-accent);
  letter-spacing: 0.55px;
  margin-bottom: 4px;
}
.kpi .value, .fact .value, .fact .v, .stat .value, .kpi-value, .stat-value {
  font: 700 18px Inter, system-ui, sans-serif;
  color: var(--rti-ink);
  line-height: 1.3;
}

/* ---------- Chips / pills / badges ---------- */
.chip, .pill, .tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(11,107,88,0.07);
  color: var(--rti-ink);
  padding: 4px 12px;
  border-radius: 999px;
  font: 600 13px Inter, system-ui, sans-serif;
  line-height: 1.4;
  margin: 2px 4px 2px 0;
}
.chip.accent, .pill.accent { background: var(--rti-soft); color: var(--rti-accent); }
.chip.warn, .pill.warn { background: rgba(217,119,6,0.12); color: #92400e; }
.chip.bad, .pill.bad { background: rgba(220,38,38,0.10); color: #991b1b; }
.chip.good, .pill.good { background: rgba(22,163,74,0.10); color: #065f46; }
.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font: 700 11px Inter, system-ui, sans-serif;
  letter-spacing: 0.55px;
  text-transform: uppercase;
}
.badge.good { background: #d1fae5; color: #065f46; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.bad  { background: #fee2e2; color: #991b1b; }

/* ---------- Notes / alert boxes ---------- */
.note, .alert, .info-box, .help-box {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(11,107,88,0.14);
  border-left: 4px solid var(--rti-accent);
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
  font-size: 14.5px;
  line-height: 1.6;
}
.note.warn, .alert.warn, .warn-box {
  border-left-color: var(--rti-warn);
  background: rgba(254,243,199,0.55);
}
.note.bad, .alert.bad, .error-box {
  border-left-color: var(--rti-bad);
  background: rgba(254,226,226,0.55);
  color: #991b1b;
}
.note strong, .alert strong { color: var(--rti-accent); }

/* ---------- Cards grid ---------- */
.card-grid, .feature-grid, .results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin: 14px 0;
}
.feature-card {
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(11,107,88,0.12);
  border-radius: 14px;
  padding: 18px 20px;
  transition: transform .12s, border-color .12s, box-shadow .15s;
}
.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--rti-accent);
  box-shadow: 0 16px 32px rgba(11,107,88,0.14);
}
.feature-card h3 { margin: 0 0 6px; font: 700 16px Inter; color: var(--rti-ink); }
.feature-card p { margin: 0; font-size: 14px; color: var(--rti-muted); line-height: 1.5; }
.feature-icon { color: var(--rti-accent); margin-bottom: 8px; display: inline-block; }

/* ---------- Tables ---------- */
table {
  width: 100%; border-collapse: collapse;
  background: rgba(255,255,255,0.85);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(28,43,66,0.05);
  font-size: 14.5px;
}
th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(11,107,88,0.08);
}
th {
  background: rgba(238,247,242,0.85);
  font: 700 12.5px Inter, system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--rti-accent);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(238,247,242,0.45); }

/* ---------- Loading / spinner ---------- */
.loading, .spinner {
  text-align: center;
  font-size: 15px;
  color: var(--rti-muted);
  padding: 36px 20px;
  line-height: 1.5;
}
.loading::after, .spinner::after {
  content: "";
  display: inline-block;
  width: 14px; height: 14px;
  margin-left: 10px;
  border: 2px solid rgba(11,107,88,0.18);
  border-top-color: var(--rti-accent);
  border-radius: 50%;
  animation: rti-spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes rti-spin { to { transform: rotate(360deg); } }

/* ---------- Code / preformatted ---------- */
pre {
  background: #fff;
  border: 1px solid rgba(11,107,88,0.10);
  border-radius: 10px;
  padding: 14px 16px;
  font: 13px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--rti-ink);
  max-height: 460px;
}

/* ---------- Ad slot polish ---------- */
.ad-slot, .citizen-ad, .rti-ad-slot {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px dashed var(--rti-line);
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  margin: 18px 0;
}
.ad-slot .ad-label, .rti-ad-label {
  display: block;
  font: 700 10.5px Inter;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}

/* ---------- Footer ---------- */
.foot, footer.tool-footer {
  margin-top: 32px;
  padding: 22px 26px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--rti-line);
  border-radius: 14px;
  font-size: 14px;
  color: var(--rti-muted);
  line-height: 1.7;
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .wrap, .intel-page, main, .container, .content { padding: 22px 16px 60px; }
  .hero, .hero-card, .intel-hero { padding: 24px 22px; }
  .hero h1, .hero-card h1 { font-size: 26px; }
  .section, .card { padding: 20px 18px; }
  .row, .search-row { flex-direction: column; }
  .row > input, .search-row > input { width: 100%; }
  button, .btn { width: 100%; justify-content: center; }
  .actions { flex-direction: column; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; }
  .back, .back-bar, .actions, button, .btn, .ad-slot, .citizen-ad, .hero-pill { display: none !important; }
  .hero, .hero-card, .section, .card { box-shadow: none; border: 1px solid #ccc; background: #fff !important; }
}

/* Remove obvious legacy uglies */
button.btn[style*="background:#0B63CE"], button.btn[style*="background: #0B63CE"] {
  background: linear-gradient(135deg, var(--rti-accent), #094d40) !important;
}

/* ---------- Additional intel-page primitives (header, crumb, lede, main, err) ---------- */
.header, .intel-header {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-bottom: 1px solid rgba(11,107,88,.14);
  padding: 22px 0;
  margin-bottom: 18px;
}
.header-in, .intel-header > .container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 22px;
}
.header h1, .intel-header h1 {
  margin: 6px 0 6px;
  font: 800 28px/1.2 Inter, system-ui, sans-serif;
  letter-spacing: -0.018em;
  color: var(--rti-ink);
}
.crumb {
  font: 600 13px Inter, system-ui, sans-serif;
  color: var(--rti-muted);
  letter-spacing: 0.2px;
  margin-bottom: 6px;
}
.crumb a {
  color: var(--rti-accent);
  text-decoration: none;
}
.crumb a:hover { text-decoration: underline; }

.lede, .lead, p.lede, .intro {
  font: 500 16px/1.6 Inter, system-ui, sans-serif;
  color: var(--rti-muted);
  margin: 0 0 4px;
  max-width: 820px;
}

.main, main, .container.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4px 22px 80px;
}

.err, .error {
  background: rgba(254,226,226,0.85);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--rti-bad);
  border-radius: 10px;
  padding: 12px 16px;
  color: #991b1b;
  font-size: 14.5px;
  line-height: 1.5;
  margin: 12px 0;
}

.help, p.help {
  color: var(--rti-muted);
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0 0 14px;
}

.sub, .sub-text {
  color: var(--rti-muted);
  font-size: 13.5px;
  margin-top: 4px;
}

.stat-row {
  display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0;
}
.stat-row .stat { flex: 1 1 200px; }

.tabs {
  display: flex; gap: 8px; margin: 14px 0; flex-wrap: wrap;
  padding: 6px;
  background: rgba(248,250,252,0.85);
  border-radius: 14px;
  border: 1px solid rgba(11,107,88,0.10);
}
.tab {
  padding: 9px 16px;
  font: 600 13.5px Inter, system-ui, sans-serif;
  color: var(--rti-muted);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all .12s;
}
.tab:hover:not(.active) { color: var(--rti-accent); background: rgba(11,107,88,.06); }
.tab.active {
  background: var(--rti-accent);
  color: #fff;
  box-shadow: 0 4px 12px rgba(11,107,88,.22);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.timeline {
  border-left: 3px solid var(--rti-accent);
  padding: 4px 0 4px 22px;
  margin: 14px 0;
}
.timeline-item {
  position: relative;
  padding: 8px 0 14px;
}
.timeline-item::before {
  content: "";
  position: absolute; left: -29px; top: 14px;
  width: 11px; height: 11px;
  background: var(--rti-accent);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--rti-accent);
}

/* Tighter card spacing inside .main */
.main .card, main .card, .container .card {
  margin: 14px 0;
}

/* Polish for select native arrow */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%230b6b58' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px 7px;
  padding-right: 36px;
}

/* Force-strip any old solid blue button colors that crept in via inline styles */
[style*="background:#0B63CE"], [style*="background: #0B63CE"],
[style*="background:#1a73e8"], [style*="background: #1a73e8"] {
  background: linear-gradient(135deg, var(--rti-accent), #094d40) !important;
  color: #fff !important;
}
