/* Crew on the phone. Radar's sibling: ink borders, hard shadows and heavy type, on sky blue instead of yellow, so the
   two apps are told apart at a glance. Mobile first; checked at 390 px wide by scripts/shots.mjs. */
:root {
  --ink: #000; --paper: #fff; --sky: #B9E4FF; --blue: #1463FF; --green: #19C37D; --orange: #FF8A00; --red: #FF3B30;
  --yellow: #FFDA1F; --cream: #FFF5C2;
  --bg: var(--sky); --card: var(--paper); --mine: var(--cream); --text: #000; --text2: #33414D; --text3: #5F6E7A;
  --border: var(--ink); --shadow: var(--ink); --heading: var(--ink); --link: #0B4FE6; --field: var(--paper);
  --thumb: #D7DEE4;
  --display: "Arial Black", "Helvetica Neue", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --stroke: 2.5px; --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417; --card: #1F242B; --mine: #2E2A16; --text: #fff; --text2: #C2CDD6; --text3: #8E9BA6;
    --border: #000; --shadow: #000; --heading: var(--sky); --link: #8CC8FF; --field: #161A1F;
    --thumb: #2B323A;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 var(--body);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-wrap: anywhere;
}
body.noscroll { overflow: hidden; }
a { color: var(--link); }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.loading { padding: 40px 20px; text-align: center; color: var(--text3); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 6px 14px;
  border: var(--stroke) solid var(--border); border-radius: 10px; background: var(--card); color: var(--text);
  box-shadow: 3px 3px 0 var(--shadow); font-weight: 700; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }
.btn.primary { background: var(--ink); color: var(--sky); }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--sky); color: var(--ink); } }
.btn.go { background: var(--green); color: var(--ink); }
.btn.warn { background: var(--card); color: var(--red); }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 14px; }
.btn[disabled] { opacity: .55; cursor: default; }
.badge {
  display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff;
  font-size: 13px; line-height: 22px; text-align: center;
}

/* the top bar */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--bg); border-bottom: var(--stroke) solid var(--border);
}
.top h1 { flex: 1; min-width: 0; margin: 0; font: 900 24px/1.1 var(--display); color: var(--heading); letter-spacing: -.5px; }
.top h1.small { font-size: 18px; }
.top .back { flex: none; }
.topacts { display: flex; align-items: center; gap: 8px; flex: none; }
.bar {
  position: sticky; top: 0; z-index: 6; margin: 0; padding: 6px 16px; background: var(--orange); color: var(--ink);
  border-bottom: var(--stroke) solid var(--border); font-weight: 700; font-size: 14px;
}

main { max-width: 760px; margin: 0 auto; padding: 14px 16px 60px; }
h2 { margin: 22px 0 10px; font: 900 15px/1.2 var(--display); text-transform: uppercase; letter-spacing: .4px; color: var(--heading); }
h2 .count { color: var(--text3); }
.empty { margin: 8px 0; color: var(--text3); }

/* cards */
.card {
  background: var(--card); border: var(--stroke) solid var(--border); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--shadow); padding: 12px 14px;
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

/* who's on what */
.strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.actor { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--text); text-decoration: none; }
.actor .name { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-weight: 800; font-size: 17px; }
.actor .on { font-size: 14px; font-weight: 600; }
.actor .note { font-size: 14px; color: var(--text2); }
.actor .when { font-size: 13px; color: var(--text3); }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }

/* pills */
.pill {
  display: inline-block; padding: 1px 8px; border: 2px solid var(--border); border-radius: 999px;
  font-size: 12px; font-weight: 800; line-height: 18px; text-transform: uppercase; letter-spacing: .3px;
  background: var(--card); color: var(--text); white-space: nowrap;
}
.st-working { background: var(--green); color: var(--ink); }
.st-idle { background: #D7DEE4; color: var(--ink); }
.st-blocked { background: var(--red); color: #fff; }
.s-todo { background: #D7DEE4; color: var(--ink); }
.s-doing { background: var(--blue); color: #fff; }
.s-review { background: var(--orange); color: var(--ink); }
.s-blocked { background: var(--red); color: #fff; }
.s-done { background: var(--green); color: var(--ink); }
.new { background: var(--yellow); color: var(--ink); }
.pill.name { text-transform: none; letter-spacing: 0; font-size: 13px; }

/* the project filter */
.filter { display: flex; gap: 8px; margin: 18px 0 0; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.filter::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 4px 12px; border: 2px solid var(--border); border-radius: 999px; background: var(--card);
  color: var(--text); font-weight: 700; font-size: 14px;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--sky); }
@media (prefers-color-scheme: dark) { .chip[aria-pressed="true"] { background: var(--sky); color: var(--ink); } }

/* the task list */
.tasks { display: flex; flex-direction: column; gap: 10px; }
.task { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.task .text { flex: 1; min-width: 0; }
/* the task's newest picture, made small on the phone (app.js: THUMB_W and THUMB_H are its size inside the border) */
.thumb { flex: none; width: 84px; height: 56px; border: 2px solid var(--border); border-radius: 8px; background: var(--thumb); }
.thumb.none { display: none; }
.task .row1 { display: flex; align-items: baseline; gap: 8px; }
.task .title { flex: 1; min-width: 0; font-weight: 800; }
.ref { font: 700 13px var(--mono); color: var(--text3); flex: none; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 13px; color: var(--text3); }
.meta .who { color: var(--text2); font-weight: 700; }
.toggle { margin-top: 2px; }

/* a task */
.head h2.title { margin: 0 0 8px; font: 900 22px/1.2 var(--display); text-transform: none; letter-spacing: -.3px; }
.head .pills { display: flex; flex-wrap: wrap; gap: 6px; }
.brief { margin-top: 14px; }
.label { margin: 0 0 4px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--text3); }
.thread { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.post.mine { background: var(--mine); }
.post > header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.post > header b { font-size: 16px; }
.post > header time { margin-left: auto; font-size: 13px; color: var(--text3); white-space: nowrap; }
.post.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 5px var(--yellow), 4px 4px 0 var(--shadow); } to { box-shadow: 4px 4px 0 var(--shadow); } }
.event { margin: 0 4px; font-size: 14px; color: var(--text2); }
.event time { color: var(--text3); margin-left: 6px; font-size: 13px; }
.seen { margin: 8px 0 0; font-size: 13px; color: var(--text3); font-weight: 600; }
.about {
  display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 6px; padding: 2px 10px 2px 2px;
  border: 2px solid var(--border); border-radius: 999px; background: var(--card); font-size: 13px; font-weight: 700;
  color: var(--text); max-width: 100%;
}
.re {
  display: inline-flex; align-items: center; margin: 2px 0 6px; padding: 2px 10px; border: 2px solid var(--border);
  border-radius: 999px; background: var(--card); color: var(--text); font-size: 13px; font-weight: 700;
}
.linkbtn {
  flex: none; min-height: 30px; padding: 0 2px 0 6px; border: 0; background: none; color: var(--link);
  font-size: 14px; font-weight: 800;
}
.message > header .to { font-size: 14px; font-weight: 600; color: var(--text2); }
.chips { display: flex; flex-wrap: wrap; gap: 0 6px; }
a.re { text-decoration: none; }
.older { display: flex; margin: 0 auto 12px; }
.about img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; background: #D7DEE4; }
.about span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* markdown from the chats */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre { margin: 6px 0; }
.md ul { list-style-type: "– "; padding-left: 20px; }
.md ol { padding-left: 24px; }
.md h3, .md h4, .md h5, .md h6 { margin: 12px 0 4px; font-size: 16px; font-weight: 800; }
.md code { font: 14px var(--mono); background: rgba(127, 140, 150, .18); padding: 1px 4px; border-radius: 4px; }
.md pre { overflow-x: auto; padding: 8px 10px; background: rgba(127, 140, 150, .16); border-radius: 8px; }
.md pre code { background: none; padding: 0; font-size: 13px; }
.md blockquote { margin-left: 0; padding-left: 10px; border-left: 3px solid var(--text3); color: var(--text2); }
.md hr { border: 0; border-top: 2px solid var(--text3); }

/* files in a post */
.files { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.pics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pics.n1 { grid-template-columns: 1fr; }
.pic {
  display: block; padding: 0; border: 2px solid var(--border); border-radius: 8px; overflow: hidden;
  background: #D7DEE4; aspect-ratio: 4 / 3;
}
.pics.n1 .pic { aspect-ratio: auto; min-height: 120px; }
.pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pics.n1 .pic img { height: auto; max-height: 70vh; object-fit: contain; }
.more { align-self: flex-start; }
video { display: block; width: 100%; max-height: 70vh; border: 2px solid var(--border); border-radius: 8px; background: #000; }
.file {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--border); border-radius: 8px;
  background: var(--card); color: var(--text); text-decoration: none;
}
.file .fname { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file .fsize { font-size: 13px; color: var(--text3); white-space: nowrap; }
.file .get { font-size: 13px; font-weight: 800; color: var(--link); white-space: nowrap; }
.file.gone { opacity: .6; }
.file.gone .get { color: var(--text3); }

/* writing */
.composer { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
textarea, input.field {
  width: 100%; padding: 10px 12px; border: var(--stroke) solid var(--border); border-radius: 10px; background: var(--field);
  font-size: 16px; resize: vertical;
}
.composer .row { display: flex; align-items: center; gap: 10px; }
.replying { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 14px; font-weight: 700; color: var(--text2); }
.composer .note, .msg { flex: 1; min-width: 0; margin: 0; font-size: 14px; color: var(--text3); }
.msg.bad, .note.bad { color: var(--red); font-weight: 700; }

/* the picture viewer */
.viewer {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: #0B0D10; color: #fff;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.viewer .vtop { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.viewer .vname { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .vcount { color: #C2CDD6; font-size: 14px; white-space: nowrap; }
.viewer .stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.viewer .stage img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 26px; font-weight: 900;
}
.viewer .nav.prev { left: 6px; }
.viewer .nav.next { right: 6px; }
.viewer .vfoot { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.viewer textarea { background: #161A1F; color: #fff; border-color: #5F6E7A; min-height: 46px; }
.viewer .row { display: flex; align-items: center; gap: 10px; }
.viewer .msg { color: #C2CDD6; }
.viewer .btn { background: #1F242B; color: #fff; border-color: #5F6E7A; box-shadow: none; }
.viewer .btn.primary { background: var(--sky); color: var(--ink); border-color: var(--sky); }

/* machines */
.machine { display: flex; flex-direction: column; gap: 6px; }
.machine .line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code { font: 900 26px/1 var(--mono); letter-spacing: 2px; }
.machine .what { font-weight: 800; }
.machine .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.list { display: flex; flex-direction: column; gap: 10px; }
.help { font-size: 14px; color: var(--text2); }
.help code { font: 14px var(--mono); background: rgba(127, 140, 150, .18); padding: 1px 4px; border-radius: 4px; }

/* the PIN */
.pin { max-width: 360px; margin: 0 auto; padding: 18vh 20px 40px; text-align: center; }
.pin .logo { margin: 0 0 6px; font: 900 44px/1 var(--display); letter-spacing: -1px; color: var(--heading); }
.pin p { margin: 0 0 18px; color: var(--text2); }
.pin form { display: flex; flex-direction: column; gap: 12px; }
.pin input.field { text-align: center; font: 900 30px/1 var(--mono); letter-spacing: 10px; padding: 12px; }
.pin .msg { min-height: 21px; }

.error { margin-top: 16px; }
.error p { margin: 0 0 10px; }
