/* ProcIntel Internal Intelligence Review — restrained, institutional styling.
   No external fonts/CDNs: everything here is self-contained and works fully offline. */

:root {
  --ink: #1b2230;
  --ink-muted: #5b6470;
  --border: #d9dce1;
  --bg: #f6f6f4;
  --panel: #ffffff;
  --header-bg: #1b2432;
  --header-fg: #eef0f3;
  --accent: #33475b;
  --warn-bg: #fbeeee;
  --warn-border: #c65b5b;

  --band-critical: #7a2020;
  --band-high: #8a5a12;
  --band-medium: #33475b;
  --band-watch: #5b6470;
  --fictional: #8a5a12;
  --real: #2f5d43;

  /* Brand accent — used sparingly (PRI score, key badges), never as a
     wholesale redesign of the restrained institutional palette above. */
  --gold: #a8843c;
  --gold-dark: #7d6329;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
}

.site-header {
  background: var(--header-bg);
  color: var(--header-fg);
  padding: 14px 28px 0;
  border-bottom: 2px solid var(--gold);
}
.header-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding-bottom: 12px; }
.brand-block { display: flex; align-items: baseline; gap: 12px; }
.brand { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }
.tagline { font-size: 12px; color: var(--gold); font-style: italic; }
.header-sub { font-size: 11px; color: #b7bfca; padding-bottom: 10px; }

.main-nav { display: flex; gap: 18px; }
.main-nav a {
  color: #dfe4ea;
  text-decoration: none;
  font-size: 13px;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover { color: #fff; border-bottom-color: var(--gold); }

.content { max-width: 1200px; margin: 0 auto; padding: 24px 28px 60px; }

.flash-messages { margin-bottom: 18px; }
.flash-message {
  background: #fbf6ea;
  border: 1px solid var(--gold);
  color: var(--gold-dark);
  border-radius: 3px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 8px;
}

.site-footer {
  text-align: center;
  font-size: 11px;
  color: var(--ink-muted);
  padding: 18px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* Summary bar */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px 16px;
}
.stat-card-warn { border-color: var(--warn-border); background: var(--warn-bg); }
.stat-value { font-size: 26px; font-weight: 600; color: var(--ink); }
.stat-label { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.stat-note { font-size: 10px; color: var(--ink-muted); font-style: italic; margin-top: 4px; }

/* Filter bar */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.filter-group label { color: var(--ink-muted); }
.filter-search { flex: 1 1 220px; }
.filter-group input[type="text"],
.filter-group input[type="date"],
.filter-group select {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--panel);
  color: var(--ink);
  min-width: 130px;
}
.filter-checkbox { flex-direction: row; align-items: center; gap: 6px; }
.filter-checkbox label { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.filter-actions { flex-direction: row; gap: 10px; align-items: center; }

button, .review-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 3px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}
button:hover { opacity: 0.9; }
.clear-link { font-size: 12px; color: var(--ink-muted); text-decoration: none; border-bottom: 1px dotted var(--ink-muted); }

/* Table */
.items-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
}
.items-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  background: #fbfbfa;
}
.items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.items-table tr:hover td { background: #fafafa; }
.items-table a { color: var(--accent); text-decoration: none; }
.items-table a:hover { text-decoration: underline; }
.headline-cell { max-width: 340px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--ink-muted); }
.empty-row { text-align: center; color: var(--ink-muted); padding: 30px; }
.result-count { font-size: 12px; color: var(--ink-muted); margin-top: 10px; }

.fictional-row td { background: #fdf8ee; font-style: italic; }

/* Badges */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 2px;
  color: #fff;
}
.badge-critical { background: var(--band-critical); }
.badge-high { background: var(--band-high); }
.badge-medium { background: var(--band-medium); }
.badge-watch { background: var(--band-watch); }
.badge-fictional { background: var(--fictional); }
.badge-real { background: var(--real); }
.score-value { font-size: 11px; color: var(--ink-muted); margin-left: 4px; }

/* Item detail */
.back-link { display: inline-block; margin-bottom: 16px; font-size: 13px; color: var(--accent); text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.fictional-banner {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: var(--band-critical);
  font-weight: 600;
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 3px;
  margin-bottom: 16px;
}

.item-detail {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 24px 28px;
}
.item-detail h1 { font-size: 20px; margin: 0 0 18px; }
.item-detail h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-muted); margin: 24px 0 8px; }

.detail-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  row-gap: 8px;
  column-gap: 12px;
  font-size: 13px;
}
.detail-grid dt { color: var(--ink-muted); }
.detail-grid dd { margin: 0; word-break: break-word; }

.summary-text { font-size: 14px; line-height: 1.6; }

.notice-box {
  background: #fdf8ee;
  border: 1px solid #e0c896;
  border-radius: 3px;
  padding: 10px 14px;
  font-size: 13px;
  margin: 14px 0;
}

.related-list { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.related-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }

.review-form { display: flex; flex-direction: column; gap: 8px; max-width: 480px; }
.review-form label { font-size: 12px; color: var(--ink-muted); }
.review-form select, .review-form textarea {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
}
.review-form button { align-self: flex-start; margin-top: 4px; }

/* --- Relevance Gate (raw item detail) --- */
.gate-box {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 13px;
}
.gate-box.gate-pass { border-left: 4px solid var(--real); }
.gate-box.gate-fail { border-left: 4px solid var(--ink-muted); }
.gate-indicator-list { list-style: none; padding: 0; margin: 8px 0 0; font-size: 12px; color: var(--ink-muted); }
.gate-indicator-list li { padding: 2px 0; }
.gate-override-note { font-size: 12px; color: var(--gold-dark); margin-top: 8px; }

/* --- Intelligence area --- */
.pri-score { color: var(--gold-dark); font-weight: 700; }

.evidence-meter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 10px 0 18px;
}
.evidence-meter-grid .stat-card { padding: 10px 12px; }
.evidence-meter-grid .stat-value { font-size: 18px; }

.assessment-section {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px 18px;
  margin-bottom: 16px;
}
.assessment-section h2 { margin-top: 0; }
.source-facts-section { border-left: 4px solid var(--accent); }
.procintel-assessment-section { border-left: 4px solid var(--gold); }

.contributing-factors { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
.contributing-factors .factor-tag {
  display: inline-block;
  background: #eef1f4;
  border-radius: 2px;
  padding: 1px 6px;
  margin: 2px 3px 2px 0;
}

.history-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
.history-table th, .history-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); }

.edit-form textarea, .edit-form input, .edit-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px;
  font-family: inherit;
  font-size: 13px;
  margin-bottom: 10px;
}
.edit-form label { font-size: 12px; color: var(--ink-muted); display: block; margin-bottom: 3px; }
.field-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

@media (max-width: 900px) {
  .summary-bar { grid-template-columns: repeat(2, 1fr); }
  .field-row { grid-template-columns: 1fr; }
}
