/* SESHAT Intelligence — dark IBM Plex console (house design language).
   Plex renders where installed; system stacks stand in elsewhere.
   No external fonts: CSP forbids third-party origins. */

:root {
  --bg: #0b0d0f;
  --surface: #14171a;
  --border: #262b30;
  --text: #e9e4da;
  --text-dim: #9a948a;
  --accent: #c9a55c;      /* single muted intelligence accent */
  --ok: #7fa878;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.frame {
  max-width: 44rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 3rem;
}

.masthead { margin-bottom: 2.5rem; }

.wordmark {
  font-family: var(--mono);
  font-size: 1.35rem;
  letter-spacing: 0.28em;
  color: var(--text);
}

.wordmark .accent { color: var(--accent); }

.rule {
  height: 1px;
  background: var(--border);
  margin: 1.1rem 0 0.9rem;
}

.tagline {
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.25rem;
}

.card-title {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.kv {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  row-gap: 0.55rem;
  font-size: 0.9rem;
}

.kv dt { color: var(--text-dim); }
.kv dd { color: var(--text); }

.mono { font-family: var(--mono); font-size: 0.85rem; }

.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  margin-right: 0.5rem;
  vertical-align: 1px;
}

.dot.ok { background: var(--ok); }

.empty {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.colophon {
  margin-top: 2.5rem;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.colophon .sep { margin: 0 0.5rem; color: var(--border); }

/* --- Phase 1: nav, forms, listings --- */

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.wordmark.small { font-size: 1rem; letter-spacing: 0.22em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.plain { color: var(--text); }
a.plain .accent { color: var(--accent); }

.nav { display: flex; align-items: baseline; gap: 1.25rem; }
.nav a {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.nav a:hover { color: var(--text); }

.inline { display: inline; }

.linklike {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.linklike:hover { color: var(--text); }

.card.narrow { max-width: 26rem; margin-left: auto; margin-right: auto; }

label {
  display: block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0.9rem 0 0.3rem;
}

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.5rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

input:focus, textarea:focus, select:focus {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}

button[type="submit"] {
  margin-top: 1.1rem;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.5rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
button[type="submit"]:hover { background: var(--accent); color: var(--bg); }

.form-error {
  color: #c98a7a;
  font-size: 0.85rem;
  border: 1px solid #4a2f28;
  border-radius: 3px;
  padding: 0.5rem 0.7rem;
  margin-bottom: 0.6rem;
}

.small-note { margin-top: 1rem; font-size: 0.75rem; }

.listing {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.listing th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 0.75rem 0.4rem 0;
}
.listing td {
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 0.75rem 0.45rem 0;
}
.listing tr:last-child td { border-bottom: none; }

.case-heading { font-size: 1.05rem; margin-bottom: 0.8rem; }

/* --- Phase 2: evidence vault --- */

.tag {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1.2rem;
}

.preview {
  max-width: 100%;
  max-height: 26rem;
  display: block;
}

.button-link {
  display: inline-block;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.42rem 0.95rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}
.button-link:hover { background: var(--accent); color: var(--bg); text-decoration: none; }

.extracted {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.9rem 1rem;
  max-height: 32rem;
  overflow-y: auto;
}

/* File field: styled entirely in CSS — the strict CSP forbids scripts, so
   ::file-selector-button is how the native control joins the console. */
input[type="file"] {
  width: 100%;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 3px;
  padding: 1.1rem 1rem;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
}

input[type="file"]:hover {
  border-color: var(--accent);
  color: var(--text);
}

input[type="file"]:focus {
  outline: 1px solid var(--accent);
  outline-offset: 0;
}

input[type="file"]::file-selector-button {
  margin-right: 1rem;
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 0.42rem 0.95rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: var(--accent);
  color: var(--bg);
}

.field-hint {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 0.4rem;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

/* Paired fields sit side by side on a wide window, stack on a narrow one. */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 1.2rem;
}

@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
}

/* Vault listing thumbnails */
.thumb, .thumb-placeholder {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 3px;
  display: block;
}

.thumb { object-fit: cover; background: var(--bg); }

.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg);
}

.thumb-cell { width: 46px; padding-right: 0.9rem !important; }

/* Status badges: the word always carries the meaning, colour only reinforces */
.badge {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-ready { color: var(--ok); border-color: #3d4f3a; }
.badge-partial { color: var(--accent); border-color: #4a3f28; }
.badge-failed { color: #c98a7a; border-color: #4a2f28; }
.badge-pending, .badge-processing { color: var(--text-dim); }

/* --- Phase 3: incident intelligence --- */

.card.proposed { border-left: 3px solid var(--accent); }

.subhead {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 1rem 0 0.4rem;
}

.plainlist { margin-left: 1.1rem; font-size: 0.88rem; }
.plainlist li { margin-bottom: 0.3rem; }

.dim { color: var(--text-dim); }

.actions { white-space: nowrap; }
.actions form { margin-right: 0.4rem; }
.actions button[type="submit"] { margin-top: 0; padding: 0.25rem 0.7rem; }

button.secondary {
  color: var(--text-dim);
  border-color: var(--border);
}
button.secondary:hover { background: var(--border); color: var(--text); }

/* --- Phase 5: claim audits --- */

.claim-text {
  font-size: 1rem;
  line-height: 1.5;
  margin-bottom: 0.9rem;
  border-left: 2px solid var(--border);
  padding-left: 0.9rem;
}

.proposal {
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
  margin-top: 0.9rem;
}
.proposal:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

/* Status and relationship colors always accompany the word itself,
   never carry meaning alone. */
.status-supported, .rel-supports { color: var(--ok); }
.status-partially_supported, .rel-weakly_supports { color: #c9a55c; }
.status-contradicted, .rel-contradicts { color: #c98a7a; }
.status-indeterminate { color: #c98a7a; }
.status-unsupported { color: var(--text-dim); }
.status-unreviewed { color: var(--text-dim); }
.rel-contextualizes, .rel-does_not_resolve { color: var(--text-dim); }

/* --- Phase 6: timeline + contradictions --- */

.case-nav {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

.chrono { list-style: none; margin: 0; }

.chrono-item {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.chrono-item:last-child { border-bottom: none; }

.chrono-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text);
}
.chrono-date.approx { color: var(--text-dim); font-style: italic; }

.chrono-gap {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border);
}

.sev-critical { color: #c98a7a; }
.sev-material { color: #c9a55c; }
.sev-minor { color: var(--text-dim); }

@media (max-width: 640px) {
  .chrono-item { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* --- Phase 7: reports --- */

.report-para { font-size: 0.92rem; margin-bottom: 0.7rem; }

.cite {
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  white-space: nowrap;
}
a.cite:hover { color: var(--accent); }

.report-quote {
  border-left: 2px solid var(--border);
  margin: 0.4rem 0 0.9rem 0.6rem;
  padding-left: 0.9rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* --- Phase 9b: OCR citation crops --- */
.crop {
  max-width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  padding: 0.25rem;
  image-rendering: pixelated;
}

/* --- The review console: adjudicating machine readings --- */

/* The proposed reading is the object under adjudication, so it is the
   dominant element of its card — not another line of metadata. */
.reading {
  font-family: var(--mono);
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0.2rem 0 0.4rem;
  overflow-wrap: anywhere;
}
.reading-note { margin-top: -0.2rem; }

.review-tally { font-size: 0.75rem; margin-bottom: 0.9rem; }

/* Progressive disclosure without scripts: the strict CSP forbids JS, and
   <details> needs none. */
.disclosure { margin: 0.9rem 0; }
.disclosure summary {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  cursor: pointer;
}
.disclosure summary:hover,
.disclosure summary:focus { color: var(--text); }
.disclosure[open] {
  border-left: 2px solid var(--border);
  padding-left: 0.9rem;
}
.disclosure[open] summary { margin-bottom: 0.5rem; }

/* The Why? drawer: reconstructed provenance under a finding card. */
.why-section { margin: 0.6rem 0; }
.why-heading { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; }
.why-rows { list-style: none; margin: 0.2rem 0 0.4rem; padding-left: 0; }
.why-rows li { margin: 0.15rem 0; overflow-wrap: anywhere; }

.review-actions { margin-top: 1rem; }
.review-actions form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.8rem;
  align-items: baseline;
}
.review-actions label { margin: 0; }
.review-actions select { width: auto; }

.card-links { font-size: 0.75rem; }

/* The ⚡ Contradiction badge: a signal for review, never a verdict. The
   word carries the meaning; the accent only makes it hard to scroll past. */
.badge-conflict {
  display: inline-block;
  padding: 0.08rem 0.45rem;
  border: 1px solid #4a3f28;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.conflict-drawer summary { text-transform: none; letter-spacing: 0; }
.conflict-card {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.7rem 0.8rem;
  margin: 0.6rem 0;
  font-size: 0.8rem;
}
.conflict-head { font-size: 0.65rem; letter-spacing: 0.1em; }
.conflict-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.5rem 0;
}
@media (max-width: 34rem) { .conflict-pair { grid-template-columns: 1fr; } }
.conflict-side {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.5rem 0.6rem;
}
.conflict-side-label { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; }
.conflict-text { overflow-wrap: anywhere; }
.conflict-evidence { list-style: none; margin: 0.3rem 0 0; padding-left: 0; font-size: 0.72rem; }
.conflict-evidence li { margin: 0.12rem 0; overflow-wrap: anywhere; }
.conflict-reason { font-size: 0.78rem; }
.conflict-status-open { color: var(--accent); }
.conflict-status-explained, .conflict-status-resolved { color: var(--ok); }
.conflict-status-not_a_contradiction { color: var(--text-dim); }
