/* Tradewalk on the web. Concrete grey and slate ink; surveyor's flagging pink marks what needs attention and
   where you are, cut like a strip of tape. One family, Archivo: wide for headings, as on job-site signs. */

:root {
  --concrete: #e9ecea;
  --panel: #ffffff;
  --ink: #1f2b30;
  --ink-soft: #5b676b;
  --rule: #cbd2cf;
  --flag: #e0357a;
  --flag-ink: #ffffff;
  --flag-soft: #fbe3ee;
  --work: #b45309;
  --good: #15803d;
  --watch: #1d4ed8;
  --next: #7c3aed;
  --danger: #b42318;
  --wide: 118;
  --radius: 6px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --concrete: #161c1f;
    --panel: #1f272b;
    --ink: #e8ecea;
    --ink-soft: #9aa6a9;
    --rule: #34403f;
    --flag: #f0559a;
    --flag-soft: #3a1f2c;
    --work: #f59e0b;
    --good: #34d399;
    --watch: #7aa2ff;
    --next: #b79cff;
    --danger: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--concrete);
  color: var(--ink);
  font: 400 16px/1.55 Archivo, system-ui, sans-serif;
  font-variation-settings: 'wdth' 100;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--flag); outline-offset: 2px; }
.loading { padding: 40px 16px; color: var(--ink-soft); }

h1, h2, h3 { font-variation-settings: 'wdth' var(--wide); letter-spacing: -0.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; }
h2 { font-size: 21px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 12px; max-width: 68ch; }
.soft { color: var(--ink-soft); }
.small { font-size: 14px; }

/* ---------- The shell: a rail of places, the page beside it ---------- */

.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.rail {
  background: var(--panel);
  border-right: 1px solid var(--rule);
  padding: 22px 0;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.mark {
  font-variation-settings: 'wdth' 125; font-weight: 800; font-size: 22px; letter-spacing: -0.02em;
  text-decoration: none; padding: 0 22px;
}
.company { padding: 0 22px; }
.company select, .company .name { width: 100%; font: inherit; font-weight: 600; }
.company .role { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.nav { display: flex; flex-direction: column; }
.nav a {
  text-decoration: none; padding: 9px 22px; font-weight: 500; position: relative;
}
.nav a:hover { background: var(--concrete); }
/* Where you are: a strip of flagging tape tied to the rail. */
.nav a[aria-current="page"] { font-weight: 700; }
.nav a[aria-current="page"]::before {
  content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 10px; background: var(--flag);
  clip-path: polygon(0 0, 100% 0, 60% 50%, 100% 100%, 0 100%);
}
.who { margin-top: auto; padding: 0 22px; font-size: 14px; color: var(--ink-soft); display: grid; gap: 4px; }
.who a, .who button { color: var(--ink-soft); justify-self: start; }

.main { padding: 36px clamp(16px, 4vw, 48px) 80px; min-width: 0; }
.page { max-width: 920px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head .sub { margin-top: 6px; color: var(--ink-soft); }
.back { display: inline-block; margin-bottom: 14px; color: var(--ink-soft); text-decoration: none; font-size: 15px; }
.back:hover { color: var(--ink); }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 16px;
    padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--rule);
  }
  .mark, .company, .who { padding: 0; }
  .company { flex: 1; min-width: 160px; }
  .nav { flex-direction: row; flex-wrap: wrap; width: 100%; gap: 4px; }
  .nav a { padding: 6px 12px 6px 18px; border-radius: var(--radius); }
  .nav a[aria-current="page"]::before { top: 6px; bottom: 6px; width: 8px; }
  .who { margin: 0; width: 100%; grid-auto-flow: column; justify-content: start; gap: 14px; }
  .main { padding-top: 24px; }
}

/* ---------- Controls ---------- */

button, .button {
  font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  padding: 8px 14px; border-radius: var(--radius); text-decoration: none; display: inline-block;
}
button:hover, .button:hover { border-color: var(--ink-soft); }
button.primary, .button.primary { background: var(--ink); color: var(--panel); border-color: var(--ink); }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; padding: 0; font-weight: 500; text-decoration: underline; color: inherit; }
button:disabled { opacity: .5; cursor: default; }
input, select {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: var(--radius); padding: 9px 11px; min-width: 0;
}
input:focus-visible, select:focus-visible { outline-offset: 0; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
label .hint { font-weight: 400; color: var(--ink-soft); font-size: 14px; }
.form { display: grid; gap: 16px; max-width: 460px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > input { flex: 1; }
.choice { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.choice input { margin-top: 5px; }
.choice span small { display: block; color: var(--ink-soft); font-weight: 400; font-size: 14px; }
.error { color: var(--danger); font-weight: 600; }
.done { color: var(--good); font-weight: 600; }

/* ---------- The flag: a notched strip of tape for what needs attention ---------- */

.flag {
  display: inline-block; background: var(--flag); color: var(--flag-ink);
  font-size: 13px; font-weight: 700; padding: 2px 16px 2px 9px; white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%);
}
.flag.quiet { background: var(--ink-soft); }

.status { font-size: 13px; font-weight: 700; white-space: nowrap; }
.status::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.s-needs_work { color: var(--work); } .s-monitor { color: var(--watch); } .s-ok, .s-done { color: var(--good); }
.s-in_progress { color: var(--watch); } .s-next { color: var(--next); }

/* ---------- Ledgers: lists of projects, reports, people ---------- */

.ledger { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); }
.ledger + h2 { margin-top: 36px; }
h2 + .ledger { margin-top: 12px; }
.line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 18px; align-items: center;
  padding: 14px 18px; border-top: 1px solid var(--rule); text-decoration: none;
}
.line:first-child { border-top: 0; }
a.line:hover { background: color-mix(in srgb, var(--concrete) 55%, var(--panel)); }
.line .what { font-weight: 700; font-size: 17px; }
.line .about { color: var(--ink-soft); font-size: 14px; }
.line .end { display: flex; gap: 14px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.line .count { color: var(--ink-soft); font-size: 14px; text-align: right; }
.empty { padding: 26px 18px; color: var(--ink-soft); }
.empty strong { color: var(--ink); display: block; margin-bottom: 4px; }

/* ---------- Sign-in: the one big moment ---------- */

.gate { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.gate .pitch { padding: clamp(28px, 6vw, 80px); display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.gate .pitch .mark { padding: 0; }
.gate .slogan {
  font-variation-settings: 'wdth' 125; font-weight: 800; font-size: clamp(40px, 6vw, 92px);
  line-height: .95; letter-spacing: -0.03em;
}
/* Each line of the second sentence is its own strip of flagging tape. */
.gate .slogan .tape {
  display: table; white-space: nowrap; background: var(--flag); color: var(--flag-ink); padding: .02em .34em .06em .12em; margin: .08em 0 0 -.12em;
  clip-path: polygon(0 4%, 100% 0, calc(100% - .24em) 50%, 100% 100%, 0 96%);
}
.gate .pitch p { font-size: 18px; max-width: 40ch; }
.gate .side { background: var(--panel); border-left: 1px solid var(--rule); padding: clamp(28px, 6vw, 80px); display: flex; align-items: center; }
.gate .side .form { width: 100%; }
@media (max-width: 860px) {
  .gate { grid-template-columns: 1fr; }
  .gate .side { border-left: 0; border-top: 1px solid var(--rule); }
}

/* ---------- A report, read ---------- */

.report .summary { font-size: 18px; max-width: 64ch; margin: 18px 0 8px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--ink-soft); font-size: 14px; margin-top: 10px; }
.facts b { color: var(--ink); font-weight: 600; }
.share {
  margin: 22px 0 8px; padding: 16px 18px; background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--radius); display: grid; gap: 10px;
}
.share .url { font-weight: 600; word-break: break-all; }
.section-name { margin: 38px 0 12px; font-size: 19px; }
.item { background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; }
.item h3 { margin: 6px 0 6px; }
.item .detail { margin: 0; max-width: 68ch; }
.item .next { margin: 10px 0 0; }
.item .seen { margin: 8px 0 0; color: var(--ink-soft); font-style: italic; }
.item .photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-top: 12px; }
.item .photos img { border-radius: 4px; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; background: var(--concrete); }
.edit-note { margin-top: 28px; color: var(--ink-soft); font-size: 14px; }

/* ---------- Tables: the team, every company ---------- */

.table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--rule); vertical-align: middle; }
.table th { font-size: 14px; color: var(--ink-soft); font-weight: 600; border-top: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .person b { display: block; }
.scroll { overflow-x: auto; }
.block { margin-top: 36px; }
.block > h2 { margin-bottom: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--panel);
  padding: 10px 16px; border-radius: var(--radius); font-weight: 600; z-index: 10;
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  @keyframes rise { from { transform: translate(-50%, 8px); opacity: 0; } }
}

.lead { margin-top: 24px; }
.spaced { margin-top: 16px; }
.choices { border: 0; padding: 0; margin: 0; display: grid; gap: 12px; }
.choices legend { font-weight: 600; margin-bottom: 10px; padding: 0; }
