/* TGG Family Office Reporting Console
   Finance-grade, minimal, light-default with optional dark mode.
   Restrained color: traffic light tones reserved for health signals. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --accent: #0b3a82;
  --accent-2: #2453b0;
  --green: #15803d;
  --green-bg: #dcfce7;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 1px 1px rgba(15,23,42,.04);
}
[data-theme="dark"] {
  --bg: #0b1220;
  --panel: #111a2c;
  --ink: #e2e8f0;
  --ink-2: #94a3b8;
  --ink-3: #64748b;
  --line: #1e293b;
  --line-2: #334155;
  --accent: #6ea8ff;
  --accent-2: #93b8ff;
  --green: #4ade80;
  --green-bg: #14361f;
  --amber: #fbbf24;
  --amber-bg: #3a2a08;
  --red: #f87171;
  --red-bg: #3a1414;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.45; }

.banner { padding: 6px 16px; background: var(--amber-bg); color: var(--amber);
  font-weight: 600; text-align: center; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.banner.hidden { display: none; }

.topbar { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 36px; height: 36px; border-radius: 6px; background: var(--accent);
  color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; letter-spacing: .04em; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--ink-2); }

.nav { display: flex; gap: 4px; }
.nav-btn { background: transparent; border: 1px solid transparent; padding: 6px 12px;
  border-radius: 6px; color: var(--ink-2); cursor: pointer; font-size: 13px; font-weight: 500; }
.nav-btn:hover { background: var(--line); color: var(--ink); }
.nav-btn.active { background: var(--accent); color: #fff; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
#period-select, #audit-action-filter, #audit-entity-filter, .filters input, .filters button, .filters select {
  font-size: 13px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink); }
#theme-toggle { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--ink); cursor: pointer; font-size: 14px; }

main { padding: 16px 24px 80px; }
.screen { display: none; }
.screen.active { display: block; }
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.panel.hidden { display: none; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--ink); }
.muted { color: var(--ink-2); font-size: 12px; }

.link-btn { background: transparent; border: 1px solid var(--line-2); border-radius: 6px;
  padding: 4px 10px; color: var(--ink-2); cursor: pointer; font-size: 12px; }
.link-btn:hover { background: var(--line); color: var(--ink); }

.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tile { padding: 12px; border-radius: 8px; background: var(--bg); }
.tile .num { font-family: var(--mono); font-size: 22px; font-weight: 600; }
.tile .label { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }
.tile.green .num { color: var(--green); }
.tile.amber .num { color: var(--amber); }
.tile.red .num { color: var(--red); }

.commentary { padding: 8px 4px; }
.commentary .row { padding: 8px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 160px 1fr; gap: 12px; }
.commentary .row:last-child { border-bottom: none; }
.commentary .lbl { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.commentary .val { font-size: 14px; }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--panel); }
table.data td.num, table.data th.num { text-align: right; font-family: var(--mono); }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--line); }
table.data tbody tr.selected { background: var(--line); }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.gray { background: var(--line); color: var(--ink-2); }

.delta { font-family: var(--mono); font-size: 12px; }
.delta.up { color: var(--green); }
.delta.down { color: var(--red); }
.delta.flat { color: var(--ink-3); }

.ed-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .ed-body { grid-template-columns: 1fr; } }
.ed-card { padding: 12px; border-radius: 8px; background: var(--bg); }
.ed-card h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
.ed-card .row2 { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); }
.ed-card .row2:last-child { border-bottom: none; }
.ed-card .k { color: var(--ink-2); font-size: 13px; }
.ed-card .v { font-family: var(--mono); }
.ed-card .d { font-family: var(--mono); font-size: 12px; }

.list-item { padding: 10px 8px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.list-item:last-child { border-bottom: none; }
.list-item .meta { color: var(--ink-2); font-size: 12px; }

.filters { display: flex; gap: 8px; align-items: center; }

.footer { padding: 14px 24px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink-3); background: var(--panel); }

.empty { padding: 18px; color: var(--ink-3); text-align: center; font-size: 13px; }

code, .mono { font-family: var(--mono); }

/* ---------- Inbox ---------- */
.nav-badge {
  display: inline-block;
  min-width: 20px;
  padding: 2px 6px;
  margin-left: 6px;
  border-radius: 10px;
  background: var(--red, #d64545);
  color: white;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  vertical-align: middle;
}
.nav-badge.hidden { display: none; }

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.inbox-body {
  flex: 1;
  min-width: 0;
}
.inbox-body strong { display: block; margin-bottom: 4px; }
.inbox-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border, #d0d0d0);
  background: var(--surface, #fff);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover:not(:disabled) { background: var(--hover, #f5f5f5); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-approve {
  background: var(--green-bg, #dcfce7);
  border-color: var(--green, #16a34a);
  color: var(--green-fg, #15803d);
}
.btn-approve:hover:not(:disabled) { background: #bbf7d0; }
.btn-dismiss {
  background: var(--surface, #fff);
  color: var(--muted, #6b7280);
}
