/* CRM layer on the Industry tokens (ds.css). Tokens only — no new hexes. */
* { box-sizing: border-box; }
body { margin: 0; background: var(--color-bg); color: var(--color-text); font-family: var(--font-body); font-size: 15px; line-height: 1.45; }
a { color: var(--color-accent-700); }
h1, h2 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); text-transform: uppercase; letter-spacing: 0.04em; }
h1 { font-size: 28px; margin: var(--space-6) 0 var(--space-2); }
h2 { font-size: 18px; margin: var(--space-8) 0 var(--space-3); }
.muted { color: var(--color-neutral-600); }
.bad { color: var(--color-neutral-900); border-left: 3px solid var(--color-accent-700); padding-left: var(--space-3); }
.count { color: var(--color-neutral-600); font-weight: 400; }

.bar { color: var(--color-text); display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-6); padding: var(--space-4) 16px; border-bottom: 1px solid var(--color-divider); background: var(--color-surface); position: sticky; top: 0; z-index: 2; }
.brand { font-family: var(--font-heading); letter-spacing: 0.2em; font-weight: 600; }
.brand em { font-style: normal; color: var(--color-accent-700); }
#nav { display: flex; gap: var(--space-6); flex-wrap: wrap; }
#nav a { text-decoration: none; text-transform: uppercase; font-size: 13px; letter-spacing: 0.12em; color: var(--color-neutral-700); padding-bottom: 2px; }
#nav a.on { color: var(--color-text); border-bottom: 2px solid var(--color-accent); }
.who { margin-left: auto; font-size: 13px; color: var(--color-neutral-700); display: flex; gap: var(--space-3); align-items: center; }

main { max-width: 1200px; margin: 0 auto; padding: 0 16px 64px; }
.center { max-width: 420px; margin: 12vh auto; text-align: center; }

table { width: 100%; border-collapse: collapse; margin-top: var(--space-4); font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-neutral-700); border-bottom: 1px solid var(--color-divider); padding: var(--space-2) var(--space-3); }
td { overflow-wrap: anywhere; border-bottom: 1px solid var(--color-divider); padding: var(--space-3); vertical-align: top; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.due { color: var(--color-accent-800); font-weight: 500; }

button, input, select, textarea { font: inherit; font-size: 14px; color: inherit; }
button { border: 1px solid var(--color-neutral-400); background: var(--color-bg); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-4); cursor: pointer; }
button.primary { background: var(--color-accent-700); border-color: var(--color-accent-700); color: var(--color-neutral-100); }
input, select, textarea { border: 1px solid var(--color-neutral-400); background: var(--color-neutral-100); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); min-width: 0; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }

.row, form.inline { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: flex-start; margin: var(--space-4) 0; }
form.inline textarea { flex: 1 1 280px; }
form.inline input[name=full_name], form.inline input[name=title] { flex: 1 1 220px; }
form.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4) var(--space-6); margin: var(--space-6) 0; }
form.grid label { display: flex; flex-direction: column; gap: var(--space-1); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-neutral-700); }
form.grid label input, form.grid label select, form.grid label textarea { text-transform: none; letter-spacing: 0; color: var(--color-text); font-size: 14px; }
form.grid .actions { grid-column: 1 / -1; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
.col { background: var(--color-surface); border-radius: var(--radius-md); padding: var(--space-3); min-height: 120px; }
.col h2 { margin: 0 0 var(--space-3); font-size: 15px; }
.card { overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; background: var(--color-neutral-100); border: 1px solid var(--color-divider); border-radius: var(--radius-sm); padding: var(--space-3); margin-bottom: var(--space-2); text-decoration: none; color: inherit; font-size: 13px; }

.timeline { list-style: none; padding: 0; }
.timeline li { border-left: 2px solid var(--color-neutral-300); padding: 0 0 var(--space-4) var(--space-4); }
.timeline .when { font-variant-numeric: tabular-nums; margin-right: var(--space-3); }
.timeline .kind { font-weight: 500; margin-right: var(--space-3); }
.timeline p { margin: var(--space-1) 0 0; white-space: pre-wrap; }
.intake dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-6); }
.intake dt { text-transform: capitalize; color: var(--color-neutral-700); }
.intake dd { margin: 0; }

.flash { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--color-neutral-900); color: var(--color-neutral-100); padding: var(--space-3) var(--space-6); border-radius: var(--radius-md); margin: 0; z-index: 5; }
.flash.bad { background: var(--color-accent-800); }

@media (max-width: 640px) {
  table, thead, tbody, tr, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--color-divider); padding: var(--space-3) 0; }
  td { border: 0; padding: 2px 0; }
  td.num { text-align: left; }
}

/* ---------------------------------------------------- relationship colours
   Map/status palette (migration 0006). Same values as REL_COLOR in app.js. */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; border: 1px solid rgba(0,0,0,.35); flex: none; }
.s-hard_no { background: #e5484d; } .s-no_response { background: #f59e0b; } .s-untouched { background: #f5d90a; }
.s-talking { background: #30a46c; } .s-relationship { background: #3e8ef7; } .s-closing { background: #8e4ec6; } .s-onboarding { background: #ff5fb0; } .s-none { background: #8b8d98; }
.rel { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.small { font-size: 13px; }

/* --------------------------------------------------------------- dark map */
.darkmap { background: #0b0d0e; }
.darkmap .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.35); }
.darkmap .leaflet-control-attribution { background: rgba(11,13,14,.75); color: #a9adb1; }
.darkmap .leaflet-control-attribution a { color: #c9d7e6; }
.darkmap .leaflet-bar a { background: #1a1d1f; color: #e6e8ea; border-color: #2b2f33; }
.darkmap .leaflet-popup-content-wrapper, .darkmap .leaflet-popup-tip { background: #16191b; color: #e6e8ea; }
.darkmap .leaflet-popup-content a, .darkmap .leaflet-tooltip a { color: #8fc1ff; }
.darkmap .leaflet-tooltip { background: #16191b; color: #e6e8ea; border-color: #2b2f33; }
.pin { background: none; border: 0; }
.pin svg { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.pop { display: flex; flex-direction: column; gap: 4px; min-width: 180px; font-family: var(--font-body); }
.pop-people { list-style: none; padding: 0; margin: 4px 0 0; }
.pop-people li { display: flex; align-items: center; gap: 6px; }

body.mapmode { background: #0b0d0e; color: #e6e8ea; }
body.mapmode main { max-width: none; }
body.mapmode h1, body.mapmode .count, body.mapmode .muted { color: #e6e8ea; }
body.mapmode .muted { color: #a9adb1; }
body.mapmode a { color: #8fc1ff; }
.maphead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
#bigmap { height: calc(100vh - 230px); min-height: 380px; border-radius: var(--radius-md); border: 1px solid #2b2f33; }
.legend { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-3) 0; }
.legend-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.legend-row { align-items: center; }
.legend-name { width: 52px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #8b8d98; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid #2b2f33; border-radius: 999px;
        font: inherit; font-size: 13px; background: #1c2023; color: #e6e8ea; cursor: pointer; user-select: none;
        transition: opacity .12s, background .12s, border-color .12s; }
.chip:hover { border-color: #4a5056; }
.chip:focus-visible { outline: 2px solid #3e8ef7; outline-offset: 2px; }
.chip[aria-pressed="false"] { background: transparent; border-style: dashed; color: #6f757b; }
.chip[aria-pressed="false"] > :first-child { filter: grayscale(1); opacity: .35; }
.chip-n { font-size: 11px; color: #8b8d98; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="false"] .chip-n { opacity: .6; }
.chip-all { font: inherit; font-size: 12px; background: none; border: 0; color: #7fb2ff; cursor: pointer; text-decoration: underline; padding: 4px 6px; }
.chip-all[hidden] { display: none; }
.minimap { height: 260px; border-radius: var(--radius-md); border: 1px solid var(--color-divider); margin-top: var(--space-3); }
.location { grid-column: 1 / -1; }
.location .row { align-items: flex-end; margin: 0; }
.location label { max-width: 180px; }

/* ---------------------------------------------------------------- journal
   Side panel in the manner of Google Workspace's: full height, right edge,
   header with a close button. The paper is the history clippings' newsprint
   (#ddd8c9, era 2 in assets/history.js); the text is plain black. Entries are
   separated by a bold line and space alone: no cards, no rules, no boxes. */
.journal { position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 1000;
  background: #ddd8c9; color: #1d1f20; overflow-y: auto; box-shadow: -8px 0 24px rgba(0,0,0,.18);
  font-family: var(--font-body); padding: 0 28px 48px; }
.j-head { position: sticky; top: 0; background: #ddd8c9; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 0 12px; }
.j-eyebrow { margin: 0; font-family: var(--font-heading); font-style: italic; font-weight: 400; font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: #474238; }
.j-title { margin: 4px 0 0; font-size: 22px; letter-spacing: .03em; color: #1d1f20; }
.j-close { background: none; border: 0; font-size: 28px; line-height: 1; color: #1d1f20; padding: 0 4px; cursor: pointer; }
.j-compose { display: flex; flex-direction: column; gap: 10px; padding: 8px 0 26px; }
.j-swatches { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.j-swatch { background: none; border: 0; padding: 2px 0; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #1d1f20; cursor: pointer; }
.j-swatch[aria-checked="true"] { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.j-note { background: transparent; border: 0; border-bottom: 1px solid #1d1f20; border-radius: 0; padding: 6px 0; font: inherit; font-size: 15px; line-height: 1.55; color: #1d1f20; resize: vertical; }
.j-note:focus-visible { outline: none; border-bottom-width: 2px; }
.j-note::placeholder { color: #5d584c; }
.j-post { align-self: flex-start; background: #1d1f20; color: #ddd8c9; border: 0; border-radius: 2px; padding: 7px 14px; cursor: pointer; }
.j-entries { padding-top: 4px; }
.j-entry-head { font-family: var(--font-body); font-size: 14px; font-weight: 700; text-transform: none; letter-spacing: 0; line-height: 1.5; margin: 26px 0 6px; color: #1d1f20; }
.j-entry-head a { color: #1d1f20; }
.j-change { display: inline-flex; align-items: center; gap: 4px; }
.j-detail { font-weight: 400; font-style: italic; }
.j-text { margin: 0; font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: #1d1f20; }
.j-quiet { color: #474238; font-style: italic; }
.statusline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.journal-open { font-size: 13px; }
form.inline input.grow { flex: 2 1 260px; }
body.mapmode .journal-open { background: #16191b; color: #e6e8ea; border-color: #2b2f33; }
