/* styles.css — Dureuil Family Brain mini app (v1.5, data-driven).
   Rebuilt to match gen-data.py's data.json contract + auth.js gate DOM. */

:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --line: #2a2f3a;
  --txt: #e8eaed;
  --muted: #9aa2b1;
  --accent: #5b8cff;
  --accent-2: #7c5cff;
  --ok: #35c46b;
  --warn: #f0b429;
  --danger: #ff5c5c;
  --chip: #232833;
  --radius: 14px;
  --gap: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--txt);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.45;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }

/* ---- PIN gate ---- */
#gate {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #1b2130 0%, #0f1115 60%);
  padding: 24px; text-align: center;
}
#gate .lock { font-size: 44px; margin-bottom: 8px; }
#gate h1 { font-size: 20px; margin: 4px 0; }
#gate-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; max-width: 280px; }
#gate-pin {
  width: 180px; text-align: center; letter-spacing: 8px; font-size: 22px;
  padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--txt); outline: none;
}
#gate-btn {
  margin-top: 14px; padding: 12px 28px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff; font-size: 16px; font-weight: 600;
}

/* ---- shell ---- */
header {
  position: sticky; top: 0; z-index: 10;
  background: rgba(15,17,21,.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); padding: 14px 16px 8px;
}
header h1 { font-size: 18px; margin: 0 0 2px; }
header .meta { font-size: 11px; color: var(--muted); }
.build-badge {
  display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 8px;
  margin-left: 6px; vertical-align: middle;
}
.build-badge.full { background: rgba(53,196,107,.15); color: var(--ok); }
.build-badge.redacted { background: rgba(240,180,41,.15); color: var(--warn); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; background: var(--chip); border: 1px solid var(--line);
  color: var(--txt); padding: 7px 13px; border-radius: 20px; font-size: 13px; white-space: nowrap;
}

/* ---- tab bar ---- */
nav.tabs {
  position: sticky; bottom: 0; z-index: 10; display: flex;
  background: rgba(15,17,21,.95); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
nav.tabs button {
  flex: 1; background: none; border: none; color: var(--muted);
  padding: 9px 0 7px; font-size: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
nav.tabs button .ic { font-size: 19px; }
nav.tabs button.active { color: var(--accent); }

main { padding: var(--gap); padding-bottom: 80px; }
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- cards ---- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; margin-bottom: var(--gap);
}
.card h2 { font-size: 15px; margin: 0 0 8px; display: flex; align-items: center; gap: 7px; }
.card .sub { color: var(--muted); font-size: 12px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 4px 8px; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px; position: relative; min-height: 74px;
}
.tile .emoji { font-size: 22px; }
.tile .t { font-weight: 600; margin-top: 4px; font-size: 14px; }
.tile .s { color: var(--muted); font-size: 12px; }
.tile .dot { position: absolute; top: 11px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tile .label { font-size: 10px; color: var(--warn); margin-top: 6px; display: block; }

/* ---- deals ---- */
.deal { border-left: 3px solid var(--accent); }
.deal.hot { border-left-color: var(--danger); }
.deal.warm { border-left-color: var(--warn); }
.badge {
  display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 8px;
  background: var(--panel-2); color: var(--muted); margin-left: 6px;
}
.badge.status { background: rgba(91,140,255,.15); color: var(--accent); }
.kv { font-size: 12px; color: var(--muted); margin: 2px 0; }
.kv b { color: var(--txt); font-weight: 600; }
details.more { margin-top: 6px; }
details.more summary { color: var(--accent); font-size: 12px; cursor: pointer; }
details.more .detail { white-space: pre-wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---- deadlines ---- */
.dl { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dl:last-child { border-bottom: none; }
.dl .date { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--txt); width: 74px; }
.dl .body { flex: 1; }
.dl .dtitle { font-size: 13.5px; }
.dl .chipsrc { font-size: 10px; margin-top: 2px; }
.src-ok { color: var(--ok); }
.src-unverified { color: var(--warn); font-weight: 600; }
.domain-tag { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; padding: 1px 5px; border-radius: 6px; background: var(--panel-2); color: var(--muted); margin-left: 5px; }
.domain-tag.legal { color: var(--accent-2); }
.domain-tag.health { color: var(--ok); }

/* ---- people ---- */
.person { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: none; }
.avatar { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.heat-hot { box-shadow: 0 0 0 2px var(--danger); }
.heat-warm { box-shadow: 0 0 0 2px var(--warn); }
.person .pn { font-size: 14px; font-weight: 600; }
.person .pr { font-size: 12px; color: var(--muted); }
.revive-flag { font-size: 10px; color: var(--warn); }

/* ---- approvals ---- */
.approval { border-left: 3px solid var(--warn); }
.approval .cmd { font-family: ui-monospace, Menlo, monospace; font-size: 11px; background: var(--panel-2); padding: 6px 8px; border-radius: 8px; margin-top: 6px; color: var(--muted); word-break: break-all; }

/* ---- legal ---- */
.legal-label, .review-label { font-size: 11px; color: var(--warn); background: rgba(240,180,41,.1); border: 1px solid rgba(240,180,41,.25); padding: 6px 9px; border-radius: 10px; margin-bottom: 10px; }
.timeline-item { display: flex; gap: 8px; padding: 5px 0; font-size: 12.5px; }
.timeline-item .td { color: var(--muted); flex: 0 0 78px; font-variant-numeric: tabular-nums; }
.risk { color: var(--danger); font-size: 12.5px; margin: 3px 0; }
.question { color: var(--accent); font-size: 12.5px; margin: 3px 0; }

/* ---- brief / markdown ---- */
.md h1, .md h2, .md h3 { font-size: 15px; margin: 12px 0 6px; }
.md ul { padding-left: 18px; margin: 6px 0; }
.md li { margin: 3px 0; }
.md p { margin: 6px 0; }
.md code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* ---- memory ---- */
.mem-file { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mem-file .mdate { color: var(--muted); font-size: 11px; }

.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 26px 10px; }

/* ---- places ---- */
.city-bar { padding: 2px 0 6px; }
.cat-bar { padding: 0 0 10px; }
.chip-on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.map-wrap {
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; margin-bottom: var(--gap); position: relative;
}
#places-map { height: 44vh; min-height: 260px; width: 100%; background: var(--panel-2); z-index: 1; }
.leaflet-container { font-family: inherit; }
.place-card { border-left: 3px solid var(--accent-2); }
.place-tags { margin: 4px 0 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.ptag {
  font-size: 10px; padding: 2px 8px; border-radius: 10px;
  background: var(--chip); border: 1px solid var(--line); color: var(--muted);
}
.place-row .date { width: 28px; font-size: 16px; }
.place-card .chip { margin-top: 8px; }
