/* Rebel Leads screens. Ported from the clickable mock-up. Light only, on purpose: one look in every viewer. */
/* Layout: an operational tool. Top bar, left nav, a status board of lead cards; detail pages split into evidence (left) and decisions (right). */
:root {
  color-scheme: light;
  accent-color: var(--accent);
  --bg: #f3f6f6;
  --surface: #ffffff;
  --surface-2: #eaf0ef;
  --line: #d5dfde;
  --fg: #13201e;
  --muted: #586a67;
  --accent: #0a6b6b;
  --accent-fg: #ffffff;
  --accent-soft: #d8eeec;
  --signal: #a8620f;
  --signal-soft: #fbecd6;
  --up: #2c7a45;
  --up-soft: #dcf0e2;
  --down: #b03d36;
  --down-soft: #f8e0dd;
  --shadow: 0 1px 2px rgba(19, 32, 30, .06), 0 2px 8px rgba(19, 32, 30, .05);
  --overlay: rgba(10, 20, 19, .45);
  --font-ui: "Schibsted Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 var(--font-ui); }
a { color: var(--accent); }
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.25; }
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono, .num { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon { flex: none; }
.label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 6px; cursor: pointer; text-decoration: none; color: var(--fg); white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 3px 9px; font-size: .82rem; }
input[type="text"], input[type="number"], input[type="url"], select, textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 9px; min-width: 0; }
textarea { width: 100%; resize: vertical; font-family: var(--font-data); font-size: .82rem; line-height: 1.55; }

/* Shell */
.app { display: grid; grid-template-columns: 210px 1fr; grid-template-rows: auto 1fr; min-height: 100%; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.02rem; text-decoration: none; color: var(--fg); }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px; font-size: .74rem; font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.venture-switch { display: flex; align-items: center; gap: 6px; }
.usermenu { position: relative; }
.usermenu-panel { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; min-width: 230px; display: grid; gap: 2px; z-index: 20; }
.usermenu-panel .who { padding: 8px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.usermenu-panel button { text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.usermenu-panel button:hover { background: var(--surface-2); }
.avatar { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: .7rem; font-weight: 700; color: #fff; flex: none; }
.avatar.agent { background: var(--fg); color: var(--bg); }
.nav { padding: 14px 10px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--fg); }
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .sep { height: 1px; background: var(--line); margin: 10px 4px; }
.main { padding: 20px 24px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head p { color: var(--muted); max-width: 70ch; margin-top: 4px; }

/* Board */
.filters { display: grid; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type="text"] { flex: 1 1 200px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; min-height: 24px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: .8rem; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0 6px; font-size: 1rem; line-height: 1; }
.board-wrap { overflow-x: auto; padding-bottom: 8px; }
/* Five equal columns fit at 1400px. Below about 1100px the board scrolls sideways. */
.board { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; align-items: start; min-width: 0; }
.col { background: var(--surface-2); border-radius: var(--r); padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 4px; }
.col.quiet .card { opacity: .78; }
.col-empty { color: var(--muted); font-size: .82rem; padding: 10px 4px; }
.card { display: flex; flex-direction: column; gap: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 11px; text-decoration: none; color: var(--fg); box-shadow: var(--shadow); }
.card:hover { border-color: var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* Every card has the same rows: client on one line, a title of at most three lines, a summary of two, then the footer. */
.card .client { font-size: .78rem; color: var(--muted); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card h3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .why1 { font-size: .82rem; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-weight: 500; white-space: nowrap; }
.badge.deadline { background: var(--signal-soft); color: var(--signal); }
.badge.dup { background: var(--down-soft); color: var(--down); }
.card-foot { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--muted); min-height: 22px; }
.card-foot .card-meta { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.tally { display: inline-flex; gap: 8px; font-family: var(--font-data); font-size: .76rem; }
.tally .u { color: var(--up); } .tally .d { color: var(--down); }
.tally > span { display: inline-flex; align-items: center; gap: 3px; }
.tally .icon, .voters .icon { width: 14px; height: 14px; }
.prio { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 6px; border-radius: 6px; font-family: var(--font-data); font-weight: 500; font-size: .82rem; flex: none; }
.prio.hi { background: var(--accent); color: var(--accent-fg); }
.prio.mid { background: var(--accent-soft); color: var(--accent); }
.prio.lo { background: var(--surface-2); color: var(--muted); }

/* Lead detail */
.crumb { font-size: .84rem; margin-bottom: 10px; display: inline-block; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.lead-head { display: grid; gap: 8px; }
.lead-head .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .84rem; align-items: center; }
.why { line-height: 1.6; max-width: 72ch; }
.learn { margin-top: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; font-size: .84rem; color: var(--muted); }
.quote { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; display: grid; gap: 4px; }
.quote blockquote { margin: 0; font-size: .92rem; line-height: 1.55; }
.quote .src { font-size: .78rem; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.child { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.child.suggested { border: 1px dashed var(--muted); background: var(--surface); }
.child-top { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; min-width: 0; }
.row-actions select { flex: 1 1 200px; max-width: 100%; }
.banner { padding: 12px 14px; border-radius: var(--r); display: grid; gap: 8px; }
.banner.dup { background: var(--down-soft); }
.banner.done { background: var(--up-soft); }
.banner.also { background: var(--surface-2); }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 10px; align-items: center; }
.vote-row { display: flex; gap: 8px; align-items: center; }
.vote { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-family: var(--font-data); }
.vote:hover { border-color: var(--muted); }
.vote.up:hover { color: var(--up); } .vote.down:hover { color: var(--down); }
.vote.on .icon path { fill: currentColor; }
.vote.up.on { background: var(--up-soft); border-color: var(--up); color: var(--up); }
.vote.down.on { background: var(--down-soft); border-color: var(--down); color: var(--down); }
.voters { display: grid; gap: 4px; margin-top: 10px; font-size: .82rem; }
.voters div { display: flex; gap: 6px; align-items: center; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding: 10px; background: var(--down-soft); border-radius: 6px; }
.people { display: grid; gap: 8px; }
.people div { display: flex; gap: 8px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 16px 1fr; gap: 10px; position: relative; padding-bottom: 12px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; margin-left: 1px; background: var(--line); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.dot.found { background: var(--muted); } .dot.up { background: var(--up); } .dot.down { background: var(--down); }
.dot.link { background: var(--signal); } .dot.project { background: var(--fg); }
.timeline .when { font-size: .75rem; color: var(--muted); }
.comment { display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form input { flex: 1; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; padding: 16px; z-index: 30; }
.modal { background: var(--surface); border-radius: 10px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 20px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 12px; align-items: center; }
.checks { display: grid; gap: 8px; }
.checks label { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.result { display: grid; gap: 8px; }
.result div { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: 6px; }

/* Settings, tables */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .86rem; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
tr.sel td { background: var(--accent-soft); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
/* The members table has a control in every row, so its cells line up on the middle. */
table.members td { vertical-align: middle; }
.member-form { max-width: 620px; }
.member-form input[type="email"] { padding: 6px 9px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 16px; align-items: start; }
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
.switch input:disabled:checked + span { background: var(--muted); }
.note { padding: 10px 12px; border-radius: 6px; background: var(--surface-2); color: var(--muted); font-size: .84rem; max-width: 80ch; }
.lock { display: inline-flex; vertical-align: -1px; color: var(--muted); }
.avatars { display: flex; gap: 3px; margin-top: 4px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.check-grid label { position: relative; display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; cursor: pointer; font-size: .84rem; }
.check-grid input { position: absolute; opacity: 0; }
.check-grid label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-grid label:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.prefs { display: grid; gap: 16px; max-width: 760px; }
.prefs .panel { display: grid; gap: 12px; }

/* Digest */
.digest { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.mail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.mail-head { padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 2px; font-size: .84rem; }
.mail-body { padding: 18px; display: grid; gap: 14px; }
.mail-item { display: grid; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.mail-item:last-child { border-bottom: 0; padding-bottom: 0; }
.teams { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #5b5fc7; border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.teams-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }

/* Agent */
.tools { display: grid; gap: 0; }
.tool { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tool:last-child { border-bottom: 0; }
.tool code { font-family: var(--font-data); font-size: .8rem; color: var(--accent); word-break: break-word; }
pre.code { margin: 0; padding: 12px 14px; background: var(--surface-2); border-radius: 6px; font: .78rem/1.6 var(--font-data); overflow-x: auto; white-space: pre; }

/* Sign-in */
.signin { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.signin-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; display: grid; gap: 18px; box-shadow: var(--shadow); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 9px 16px; border-radius: 8px; font-size: .88rem; z-index: 40; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

@media (max-width: 1000px) {
  .detail, .digest, .split { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px; }
  .nav .sep { display: none; }
  .nav a { white-space: nowrap; }
  .main { padding: 16px 16px 40px; }
  .form-grid, .tool, .kv { grid-template-columns: 1fr; }
  .topbar .pill.sample { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.brand-mark { display: inline-flex; color: var(--accent); }
.brand-sep { display: none; }

/* Additions for the prototype */
input[type="email"], input[type="password"] { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 8px 10px; min-width: 0; width: 100%; }
.signin-form { display: grid; gap: 10px; }
.signin-form label { font-weight: 500; }
.signin-form .btn { justify-content: center; padding: 9px 12px; }
.signin-error { padding: 8px 10px; border-radius: 6px; background: var(--down-soft); color: var(--down); font-size: .86rem; }
.demo-accounts { display: grid; gap: 6px; padding: 12px; background: var(--surface-2); border-radius: 8px; }
.demo-accounts div { display: grid; grid-template-columns: minmax(0, 190px) 1fr; gap: 10px; align-items: center; font-size: .84rem; }
.demo-accounts .btn { justify-self: start; margin-left: -9px; }
.demo-accounts .btn:hover { background: var(--surface); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.endpoint { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.endpoint code { font-family: var(--font-data); font-size: .86rem; padding: 6px 10px; background: var(--surface-2); border-radius: 6px; word-break: break-all; }
.tool-group { margin-top: 14px; }
.dev summary { cursor: pointer; font-size: 1.05rem; font-weight: 600; }
.dev h3 { margin: 18px 0 8px; }
@media (max-width: 760px) {
  .demo-accounts div { grid-template-columns: 1fr; gap: 0; }
  .signin-card { padding: 20px; }
  .usermenu-panel { right: auto; left: 0; max-width: calc(100vw - 32px); }
}
