/* JAZ Outreach portal. Self-hosted, no framework. Desktop-first tool that still works on a phone. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5b6573;
  --line: #d9dee5;
  --brand: #1f4e79;
  --brand-dark: #163a5a;
  --accent: #e07b00;
  --danger: #b3261e;
  --ok: #1e7b34;
  --focus: #2a7de1;
  --row-signed: #d6f0dc;
  --row-closed: #e8eaed;
  --row-overdue: #f9d9d6;
  --row-demo: #d7e6f7;
  --row-due: #fbf1c2;
  --row-stale: #fde2c4;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
h3 { font-size: .95rem; margin: 1rem 0 .35rem; }
h1 small, h2 small { font-weight: 400; font-size: .8em; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--brand); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
ul.plain { list-style: none; padding: 0; margin: 0 0 .5rem; }
ul.plain li { padding: .15rem 0; }

/* Top bar */
.topbar {
  background: var(--brand); color: #fff; display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem; min-height: 52px; flex-wrap: wrap;
}
.brand a { color: #fff; text-decoration: none; font-weight: 700; letter-spacing: .02em; }
.nav { display: flex; align-items: center; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a { color: #e8eef5; text-decoration: none; padding: .55rem .7rem; border-radius: var(--radius); }
.nav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.nav-sep { width: 1px; height: 1.4rem; background: rgba(255,255,255,.3); margin: 0 .4rem; }
.nav-spacer { flex: 1; }
.who { color: #e8eef5; font-size: .9rem; }
.nav .link { background: none; border: 0; color: #e8eef5; cursor: pointer; padding: .55rem .7rem; font: inherit; }
.nav .link:hover { text-decoration: underline; color: #fff; }
.nav-toggle { display: none; margin-left: auto; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.5); padding: .4rem .7rem; border-radius: var(--radius); font: inherit; }

.page { padding: 1.25rem 1rem 3rem; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.inline { display: inline-flex; gap: .35rem; align-items: center; }

/* Cards, columns */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.stack > * + * { margin-top: .75rem; }
form.stack > * + * { margin-top: .6rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .9rem; }
.grid-2 .span-2 { grid-column: span 2; }

/* Flash */
.flash { padding: .65rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.flash-success { background: #e3f4e6; border-color: #9fd3a8; color: #14532d; }
.flash-error { background: #fbe5e3; border-color: #efaaa4; color: #7a1a13; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
label small { font-weight: 400; }
label.check { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; margin: 0; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"],
input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%; padding: .45rem .55rem; border: 1px solid #9aa3ad; border-radius: var(--radius);
  background: #fff; color: var(--text); font: inherit; min-height: 2.4rem;
}
textarea { resize: vertical; }
input.narrow { width: 5rem; }
.req { color: var(--danger); }
.btn {
  display: inline-block; padding: .45rem .9rem; border-radius: var(--radius); border: 1px solid var(--brand);
  background: #fff; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  min-height: 2.4rem; line-height: 1.4;
}
.btn:hover { background: #eef3f8; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-quiet { border-color: var(--line); color: var(--text); }
.btn-quiet:hover { background: #f0f2f5; }
.btn-sm { padding: .25rem .6rem; min-height: 1.9rem; font-size: .85rem; font-weight: 500; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.filters input[type="search"], .filters input[type="text"], .filters input[type="email"] { width: auto; min-width: 14rem; flex: 1 1 14rem; }
.filters select, .filters input[type="date"], .filters input[type="number"] { width: auto; }
.filters label { margin: 0; }
.filters .export { margin-left: auto; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.link-box { border-color: var(--accent); background: #fff8ef; }

/* Tabs */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
.tabs a { padding: .45rem .7rem; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--text); border-color: var(--brand); font-weight: 600; }
.tabs small { color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f7f8fa; font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.table th a { color: var(--text); text-decoration: none; }
.table th a:hover { text-decoration: underline; }
.table.compact th, .table.compact td { padding: .35rem .5rem; }
.table td.num { text-align: right; }
.nowrap { white-space: nowrap; }
.wrap { min-width: 14rem; max-width: 26rem; }
tr.row-signed td { background: var(--row-signed); }
tr.row-closed td { background: var(--row-closed); color: var(--muted); }
tr.row-overdue td { background: var(--row-overdue); }
tr.row-demo td { background: var(--row-demo); }
tr.row-due td { background: var(--row-due); }
tr.row-stale td { background: var(--row-stale); }
.legend { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 .5rem; }
.sw { padding: .1rem .5rem; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); }
.sw.row-signed { background: var(--row-signed); } .sw.row-overdue { background: var(--row-overdue); }
.sw.row-demo { background: var(--row-demo); } .sw.row-due { background: var(--row-due); } .sw.row-stale { background: var(--row-stale); }

/* Chips */
.score { display: inline-block; min-width: 2.2rem; text-align: center; padding: .1rem .4rem; border-radius: 999px; background: #e3e8ee; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-lg { font-size: .8em; vertical-align: middle; }
.score:empty { display: none; }
.prob { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.prob-hot { background: #fbd5d0; color: #7a1a13; }
.prob-medium { background: #fbeec2; color: #6b4d00; }
.prob-cold { background: #dbe7f5; color: #163a5a; }
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 4px; font-size: .78rem; font-weight: 600; background: #e3e8ee; color: var(--text); vertical-align: middle; }
.badge-overdue { background: #fbd5d0; color: #7a1a13; }
.badge-today { background: #fbeec2; color: #6b4d00; }
.badge-closed { background: #e8eaed; color: var(--muted); }
.badge-flag { background: #fde2c4; color: #7a3d00; }
.badge-open { background: #fde2c4; color: #7a3d00; }
.badge-resolved { background: #d6f0dc; color: #14532d; }
.badge-dismissed { background: #e8eaed; color: var(--muted); }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tile:hover { border-color: var(--brand); }
.tile-n { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.tile-l { color: var(--muted); font-size: .85rem; }
.tile-alert { border-left: 5px solid var(--danger); }
.tile-warn { border-left: 5px solid var(--accent); }

/* Prospect page */
.pinned { background: #fff8ef; border: 1px solid #f3cf9a; border-radius: var(--radius); padding: .6rem .9rem; margin-bottom: 1rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.facts dt { font-weight: 600; color: var(--muted); font-size: .85rem; padding-top: .1rem; }
.facts dd { margin: 0; }
.call-block .tel { font-size: 1.35rem; font-weight: 700; text-decoration: none; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: .25rem 0 .6rem .8rem; margin-bottom: .4rem; }
.tl-head { display: flex; gap: .6rem; flex-wrap: wrap; align-items: baseline; }
.said { font-style: italic; margin: .2rem 0; }
details.card > summary { cursor: pointer; display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; color: var(--muted); }
details[open].card > summary::before { content: "▾"; }
details.card > summary h2 { margin: 0; }
details.card[open] > summary { margin-bottom: .75rem; }
.research[data-old] .facts { color: var(--muted); }
.stale-tag { color: var(--danger); font-weight: 600; }

/* Auth pages */
body.bare { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; margin: 0; }
.brand-title { color: var(--brand); font-size: 1.2rem; margin-bottom: 1rem; }

/* Responsive */
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 .span-2 { grid-column: auto; }
}
@media (max-width: 720px) {
  .nav-toggle { display: inline-block; }
  .nav { display: none; flex-direction: column; align-items: stretch; width: 100%; padding-bottom: .5rem; }
  .nav.open { display: flex; }
  .nav-sep { display: none; }
  .nav a, .nav .link { padding: .7rem .5rem; }
  .filters .export { margin-left: 0; }
  .facts { grid-template-columns: 1fr; gap: 0 0; }
  .facts dt { margin-top: .4rem; }
}
