:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1d2330; --muted: #6a7282; --line: #e3e6eb;
  --accent: #2f5bd3; --accent-ink: #fff; --ok: #1f8a4c; --warn: #b26a00; --bad: #c0392b;
  --ok-bg: #e5f5ec; --warn-bg: #fff3dc; --bad-bg: #fdeaea; --info-bg: #eaf0fd;
  --bar: #2f5bd3; --bar2: #9db3ec;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 15px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12px; }
.hidden { display: none !important; }

/* Top bar: company name and product on the left, the signed-in user on the right. */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 18px; padding: 12px 20px;
  background: #18202f; color: #fff; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 17px; letter-spacing: .01em; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand .product { font-weight: 500; font-size: 13px; color: #9aa3b5; padding-left: 10px; border-left: 1px solid #3a4560; }
.topbar .muted { color: #9aa3b5; }
/* Menu bar: its own row under the top bar; stays in view while scrolling. */
.menubar { display: flex; gap: 2px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; overflow-x: auto; scrollbar-width: thin; }
.menubar a { color: var(--muted); padding: 11px 12px 9px; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.menubar a:hover { color: var(--ink); text-decoration: none; background: var(--bg); }
.menubar a.active { color: var(--accent); border-bottom-color: var(--accent); }
.actas { font-size: 12px; color: #c9d1e2; display: flex; gap: 6px; align-items: center; }
.actas select { padding: 4px; }
.actas a { color: #c9d1e2; }
.auth-card { max-width: 420px; margin: 40px auto; }
.auth-card form { display: flex; flex-direction: column; gap: 10px; }
.auth-card label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
/* Honeypot field on the public enquiry form: invisible to people, often filled in by bots. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.subnav a { padding: 5px 11px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; }
.subnav a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.subnav a:hover { text-decoration: none; border-color: var(--accent); }
.opp { border-left: 4px solid var(--line); padding: 8px 10px; margin: 8px 0; background: #fafbfc; border-radius: 6px; font-size: 12px; }
.opp.strong { border-left-color: var(--ok); } .opp.possible { border-left-color: var(--warn); } .opp.weak { border-left-color: var(--bad); }
.opp ul { margin: 4px 0; padding-left: 16px; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 8px; }
.flow-row { display: grid; grid-template-columns: 220px 1fr 130px; gap: 8px; align-items: center; margin: 5px 0; font-size: 12px; }
.flow-row .meter { height: 14px; margin: 0; }
.flow-note { margin: -4px 0 4px 228px; }
.secret { font: 600 16px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .08em; word-break: break-all; }
.banner { background: var(--warn-bg); border-bottom: 1px solid #f0d9a8; padding: 8px 20px; font-size: 13px; }

main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi .v { font-size: 22px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 12px; }
.kpi.est .v::after { content: " est."; font-size: 11px; color: var(--warn); font-weight: 600; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; } tr.click:hover td { background: #f8f9fc; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; background: var(--info-bg); color: var(--accent); margin: 1px 2px 1px 0; white-space: nowrap; }
.badge.sample { background: #fff0c9; color: #8a5a00; border: 1px solid #f2d27a; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.grey { background: #eef0f3; color: var(--muted); }

button, .btn { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); border-color: #efc4bf; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.sm { padding: 3px 8px; font-size: 12px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
input, select, textarea { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); max-width: 100%; }
textarea { width: 100%; min-height: 90px; }
form.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
form.grid-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
form.grid-form label.wide { grid-column: 1 / -1; }
form.grid-form label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }

.score { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 50%; font-weight: 700; border: 3px solid; }
.score.hi { border-color: var(--ok); color: var(--ok); } .score.mid { border-color: var(--warn); color: var(--warn); } .score.lo { border-color: var(--bad); color: var(--bad); }
.match { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fff; }
.match-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.match-head .who { flex: 1; min-width: 200px; }
.comps { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 10px; }
.comp { border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 12px; }
.comp .t { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 4px; }
.comp ul { margin: 2px 0; padding-left: 16px; }
.s { color: var(--ok); } .g { color: var(--bad); } .u { color: var(--muted); }
.meter { height: 6px; background: #eef0f3; border-radius: 3px; overflow: hidden; margin: 4px 0; }
.meter > i { display: block; height: 100%; background: var(--bar); }

.bars .bar-row { display: grid; grid-template-columns: 150px 1fr 70px; gap: 8px; align-items: center; margin: 4px 0; font-size: 12px; }
.bars .track { background: #eef0f3; height: 14px; border-radius: 3px; overflow: hidden; display: flex; }
.bars .track i { display: block; height: 100%; background: var(--bar); }
.bars .track i.b2 { background: var(--bar2); }
.bars .bar-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #eceff4; border-radius: 10px; padding: 8px; min-height: 120px; }
.col h2 { font-size: 13px; display: flex; justify-content: space-between; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; cursor: pointer; font-size: 12px; }
.card:hover { border-color: var(--accent); }
.card .n { font-weight: 600; font-size: 13px; }

.list { margin: 0; padding: 0; list-style: none; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.list li:last-child { border-bottom: 0; }
.callout { background: var(--info-bg); border-radius: 8px; padding: 10px 12px; font-size: 12px; margin: 8px 0; }
.callout.warn { background: var(--warn-bg); }
.callout.bad { background: var(--bad-bg); }
pre.msg { white-space: pre-wrap; background: #f8f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 13px/1.5 system-ui, sans-serif; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
dl.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

.modal { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 10; }
.modal-card { background: #fff; border-radius: 12px; padding: 20px; width: min(980px, 100%); position: relative; }
.modal-card .close { position: absolute; right: 12px; top: 10px; border: 0; font-size: 22px; background: none; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #18202f; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 20; max-width: 90vw; }
.toast.err { background: var(--bad); }

@media (max-width: 640px) {
  main { padding: 12px 16px; }
  .bars .bar-row { grid-template-columns: 100px 1fr 50px; }
  dl.kv { grid-template-columns: 1fr; }
  .flow-row { grid-template-columns: 1fr auto; }
  .flow-row .meter, .flow-row .flow-money { grid-column: 1 / -1; grid-row: 2; }
  .flow-note { margin: -2px 0 6px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
}
