/* Sleuth — light, monochrome + single accent. No gradients, no emoji chrome. */
:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e6e8ec;
  --ink: #1a1d23;
  --ink-soft: #5b616e;
  --muted: #9aa0ab;
  --accent: #4f46e5;
  --accent-soft: #eef0fe;
  --ok: #1f9d63;
  --warn: #c2410c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 18, 23, .04), 0 4px 16px rgba(16, 18, 23, .04);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }

/* --- top bar --- */
.topbar {
  height: 52px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.brand span { font-weight: 650; letter-spacing: -.01em; }
.brand em { color: var(--muted); font-style: normal; font-size: 12px; }
.brand svg { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.badge {
  font-size: 12px; color: var(--accent); background: var(--accent-soft);
  padding: 3px 9px; border-radius: 999px; font-weight: 550;
}

/* --- layout --- */
.layout {
  display: grid; grid-template-columns: 320px 1fr 360px; gap: 14px;
  padding: 14px; height: calc(100vh - 52px); overflow: hidden;
}
.col { min-height: 0; display: flex; flex-direction: column; gap: 14px; overflow: auto; }
.col-center { overflow: hidden; }

/* --- cards --- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); }

/* --- forms --- */
form { display: flex; flex-direction: column; gap: 11px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-soft); }
.row { display: flex; gap: 10px; }
.grow { flex: 1; }
input, select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* --- buttons --- */
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid transparent; }
.primary { background: var(--accent); color: #fff; padding: 9px 14px; font-weight: 550; }
.primary:hover { background: #4338ca; }
.primary:disabled { background: #c7c9d4; cursor: not-allowed; }
.ghost { background: transparent; border-color: var(--border); color: var(--ink-soft); padding: 6px 11px; }
.ghost:hover { background: var(--bg); }

/* --- investigation list --- */
.inv-list, .audit-list, .src-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.inv-list li { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.inv-list li:hover { border-color: var(--accent); }
.inv-list li.active { border-color: var(--accent); background: var(--accent-soft); }
.inv-list .i-title { font-weight: 550; }
.inv-list .i-meta { font-size: 12px; color: var(--muted); }

/* --- graph --- */
.col-center .graph-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; box-shadow: var(--shadow);
}
.graph-title { font-weight: 550; }
.graph-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.counter { font-size: 12px; color: var(--ink-soft); background: var(--bg); padding: 4px 9px; border-radius: 6px; }
.graph-canvas {
  flex: 1; margin: 14px 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); min-height: 0;
}
.graph-hint { font-size: 12px; }

/* --- tabs / report --- */
.tabs { display: flex; gap: 4px; }
.tab { background: transparent; border: 1px solid var(--border); color: var(--ink-soft); padding: 7px 14px; }
.tab.active { background: var(--surface); color: var(--accent); border-color: var(--accent); font-weight: 550; }
.tab-pane { display: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); flex: 1; overflow: auto; }
.tab-pane.active { display: block; }

.report-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--bg); border-radius: 8px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.entity-block { border-top: 1px solid var(--border); padding: 11px 0; }
.entity-block h4 { margin: 0 0 3px; }
.entity-block .etype { font-size: 11px; color: var(--muted); text-transform: uppercase; }
.fact { font-size: 12.5px; color: var(--ink-soft); padding: 3px 0; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.chip.verified { background: #e7f6ee; color: var(--ok); }

.audit-list li { font-size: 12px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; }
.audit-list .a-event { font-weight: 550; color: var(--accent); }

/* --- guardrails drawer --- */
.drawer {
  position: fixed; top: 0; right: 0; width: 380px; height: 100vh; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(16,18,23,.08);
  padding: 18px; overflow: auto; z-index: 20;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer h2 { margin: 0; font-size: 15px; }
.drawer h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-soft); margin: 18px 0 8px; }
.drawer ul { padding-left: 18px; margin: 0; }
.drawer #red-lines li { color: var(--warn); margin-bottom: 5px; }
.src-list { padding-left: 0 !important; }
.src-list li { list-style: none; display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.src-list .cat { color: var(--muted); font-size: 11px; }

.primary.wide { width: 100%; margin-bottom: 12px; }
.src-link { text-decoration: none; color: var(--accent); font-size: 12px; }

.red-flags { border: 1px solid #f3c9b3; background: #fdf3ee; border-radius: 8px; padding: 11px 13px; margin-bottom: 14px; }
.red-flags h4 { margin: 0 0 7px; color: var(--warn); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.red-flags .flag { font-size: 13px; padding: 2px 0; }

.media-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.media-gallery img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); }

.narrative { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; }
.narrative p { margin: 0 0 8px; }
.narrative h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-soft); }
.narrative ul { margin: 0; padding-left: 18px; }
.narrative li { font-size: 13px; margin-bottom: 3px; }

.muted { color: var(--muted); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; height: auto; overflow: auto; }
  .graph-canvas { height: 380px; }
}

/* Phone / Telegram Mini App width */
@media (max-width: 640px) {
  .topbar { padding: 0 12px; }
  .brand em { display: none; }
  .layout { padding: 10px; gap: 10px; }
  .card, .tab-pane { padding: 13px; }
  .graph-canvas { height: 300px; }
  .drawer { width: 100%; }
  .graph-controls { width: 100%; }
  .graph-controls button { flex: 1; }        /* full-width, easy tap targets */
  .primary, .ghost, .tab { padding: 10px 14px; }
  .counter { font-size: 11px; }
  .media-gallery img { width: 64px; height: 64px; }
}
