/*
 * One layout, laptop first and usable on a phone (James's answer 6): the card
 * head is a grid that collapses to two lines under 40rem, and nothing else
 * changes. No breakpoint switches screens, because there is only one screen.
 */

:root {
  --ink: #16181d;
  --muted: #5c6470;
  --line: #dfe3e9;
  --paper: #ffffff;
  --ground: #f6f7f9;
  --accent: #1f5eff;
  --warm: #8a4b00;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9ecf1;
    --muted: #a2abb8;
    --line: #2c313a;
    --paper: #171a1f;
    --ground: #0f1216;
    --accent: #7aa2ff;
    --warm: #f0b26b;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.5rem 1rem 4rem;
  background: var(--ground);
  color: var(--ink);
  font:
    16px/1.5 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

main {
  max-width: 60rem;
  margin: 0 auto;
}

h1 {
  font-size: 1.5rem;
  margin: 0;
}

h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 0.95rem;
  margin: 1.5rem 0 0.5rem;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.top nav {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.search {
  flex: 1 1 18rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--paper);
  color: inherit;
  font: inherit;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  overflow: hidden;
}

.card.open {
  border-color: var(--accent);
}

.card .head {
  display: grid;
  grid-template-columns: minmax(7rem, 12rem) 1fr auto 2.5rem;
  gap: 0.75rem;
  align-items: baseline;
  width: 100%;
  padding: 0.75rem 1rem;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.card .company {
  font-weight: 600;
}

.card .role {
  color: var(--muted);
}

.card .comp {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card .score {
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 600;
}

@media (max-width: 40rem) {
  .card .head {
    grid-template-columns: 1fr auto;
  }

  .card .role {
    grid-column: 1 / -1;
    order: 3;
  }
}

.detail {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--line);
}

.detail p {
  margin: 0.75rem 0;
}

.detail .notes {
  color: var(--muted);
  white-space: pre-wrap;
}

.detail .blocked,
.detail .geo {
  color: var(--warm);
}

.evidence {
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  background: var(--ground);
  border-radius: 0.5rem;
}

.evidence dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.evidence dd {
  margin: 0.15rem 0 0.75rem;
}

.evidence dd:last-child {
  margin-bottom: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.actions .soon {
  font-size: 0.8rem;
  color: var(--muted);
}

/*
 * The decision panel sits OUTSIDE the card list — the reason a revert needs and
 * the blocker an edit sets are text fields, and a text field inside a list that
 * redraws loses its caret. A sheet at the foot of the screen also puts it where
 * a thumb is on the phone James reads this on.
 */
.decide {
  position: fixed;
  inset: auto 0 0;
  z-index: 10;
  width: min(34rem, 100%);
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem 0.6rem 0 0;
  background: var(--paper);
  color: inherit;
  box-shadow: 0 -0.5rem 2rem rgb(0 0 0 / 25%);
}

.decide h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
}

.decide form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.decide label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.decide label span {
  font-size: 0.8rem;
  color: var(--muted);
}

.decide input,
.decide select,
.decide textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--ground);
  color: inherit;
  font: inherit;
}

button {
  font: inherit;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--paper);
  color: inherit;
  cursor: pointer;
}

button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

a {
  color: var(--accent);
}

.empty,
.loading {
  color: var(--muted);
}

.error {
  color: #b3261e;
}

.sign-in {
  max-width: 22rem;
  margin: 4rem auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sign-in label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sign-in input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--paper);
  color: inherit;
  font: inherit;
}

.funnel,
.runs,
.group ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.funnel li,
.runs li,
.group li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.funnel .count,
.runs .count {
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}

.key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
}

.meta,
.reason {
  color: var(--muted);
}
