/* The team workspace page. Calm, dense and readable; light and dark follow the device. */
:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #1b1f24; --muted: #5d6673; --line: #dfe3e8; --soft: #eef1f4;
  --accent: #2458d6; --accent-ink: #ffffff; --ok: #1f7a4a; --warn: #a15c00; --bad: #b3261e; --new: #2458d6;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 10px; --nav-w: 210px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --panel: #191d23; --ink: #e6e9ee; --muted: #9aa3ae; --line: #2b313a; --soft: #222831;
    --accent: #7aa2ff; --accent-ink: #0d1420; --ok: #5cc68d; --warn: #e3a14a; --bad: #ff7b72; --new: #7aa2ff; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, "Segoe UI", -apple-system, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 8px; }
h3 { font-size: 14px; margin: 12px 0 6px; }
code, pre { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 16px; }
.hidden { display: none !important; }

/* ---- header and nav ---- */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 8px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); white-space: nowrap; font-size: 15px; }
.brand span { color: var(--muted); font-weight: 500; }
.search { flex: 1; max-width: 460px; margin-left: auto; }
.search input { width: 100%; }
.who { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.menu-btn { display: none; background: none; border: 0; padding: 6px; width: 34px; height: 34px; cursor: pointer; }
.menu-btn span { display: block; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px; }
.shell { display: flex; min-height: calc(100vh - 51px); }
.nav { width: var(--nav-w); flex: none; padding: 12px 10px 40px; border-right: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 51px; height: calc(100vh - 51px); overflow-y: auto; }
.nav h4 { margin: 14px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav a { display: block; padding: 5px 8px; border-radius: 6px; color: var(--ink); font-size: 13.5px; }
.nav a:hover { background: var(--soft); text-decoration: none; }
.nav a.on { background: var(--soft); box-shadow: inset 2px 0 0 var(--accent); font-weight: 600; }
.scrim { display: none; }
main { flex: 1; min-width: 0; padding: 18px 22px 60px; outline: none; }
@media (max-width: 820px) {
  .menu-btn { display: block; }
  .who { display: none; }
  .brand span { display: none; }
  .nav { position: fixed; left: -270px; top: 51px; bottom: 0; height: auto; z-index: 25;
    transition: left .18s ease; box-shadow: 4px 0 18px rgba(0,0,0,.18); width: 250px; }
  body.nav-open .nav { left: 0; }
  body.nav-open .scrim { display: block; position: fixed; inset: 51px 0 0 0; background: rgba(0,0,0,.3); z-index: 20; }
  main { padding: 14px 16px 60px; }
}

/* ---- controls ---- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=search], input[type=email], input[type=url], input[type=date], input[type=number], select, textarea {
  background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; min-height: 34px; max-width: 100%; }
textarea { width: 100%; min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
button, .btn { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 11px; min-height: 32px; cursor: pointer; font-size: 13px; color: var(--ink); white-space: nowrap; }
button:hover, .btn:hover { background: var(--soft); text-decoration: none; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--bad); }
button.link { background: none; border: 0; padding: 0 2px; min-height: 0; color: var(--accent); }
button.tiny { min-height: 24px; padding: 1px 7px; font-size: 12px; }
button:disabled { opacity: .55; cursor: default; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }

/* ---- page parts ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 14px; margin-bottom: 14px; }
.page-head .titles { flex: 1; min-width: 220px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; max-width: 70ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.card > h2:first-child { display: flex; align-items: baseline; gap: 8px; }
.card > h2 .count { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.grid .card { margin-bottom: 0; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, 1fr); gap: 12px; align-items: start; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search] { flex: 1; min-width: 180px; max-width: 360px; }
.note { border-radius: 8px; padding: 8px 11px; margin: 6px 0; font-size: 13px; background: var(--soft); color: var(--muted); }
.note.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); }
.note.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.note.ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.empty { color: var(--muted); font-size: 13px; padding: 4px 0; }

/* lists of items */
.items { list-style: none; margin: 0; padding: 0; }
.items > li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.items > li:last-child { border-bottom: 0; }
.items .main-col { flex: 1; min-width: 0; }
.items .t { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.items a.t:hover { color: var(--accent); }
.items .sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; overflow-wrap: anywhere; }
.items .side { flex: none; text-align: right; color: var(--muted); font-size: 12px; white-space: nowrap; }
.items li.new { box-shadow: inset 3px 0 0 var(--new); padding-left: 8px; }
.list-card { padding: 4px 14px; }
.badge { display: inline-block; padding: 0 7px; border-radius: 4px; font-size: 11.5px; line-height: 18px; background: var(--soft); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.badge.accent { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.tag { display: inline-block; font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; margin: 0 3px 2px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-size: 12.5px; cursor: pointer; min-height: 28px; }
.chip.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }

/* forms */
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.form .f { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.form .f.wide { grid-column: 1 / -1; }
.form .f > span { font-size: 12px; color: var(--muted); font-weight: 600; }
.form .f > span .req { color: var(--bad); }
.form .f input, .form .f select { width: 100%; }
.form .actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form .err { color: var(--bad); font-size: 13px; }

/* detail fields */
.fields { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 0; }
.fields > .k, .fields > .v { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.fields > .k { color: var(--muted); font-size: 12.5px; font-weight: 600; padding-right: 14px; }
.fields > .v { min-width: 0; overflow-wrap: anywhere; }
.fields .v .edit-btn { margin-left: 6px; opacity: .6; }
.fields .v:hover .edit-btn { opacity: 1; }
.fields .v .editor { display: flex; flex-direction: column; gap: 6px; }
.fields .v .editor input:not([type=checkbox]), .fields .v .editor select { width: 100%; }
@media (max-width: 560px) {
  .fields { grid-template-columns: 1fr; }
  .fields > .k { border-bottom: 0; padding-bottom: 0; }
}
.title-edit { display: flex; gap: 8px; align-items: center; }
.title-edit input { flex: 1; font-size: 18px; font-weight: 600; }
.meta-line { color: var(--muted); font-size: 12.5px; }

/* Markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 22px; }
.md pre { background: var(--soft); padding: 8px 10px; border-radius: 7px; overflow-x: auto; }
.md code { background: var(--soft); padding: 0 4px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 8px; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); }
.md h3, .md h4, .md h5, .md h6 { margin: 10px 0 4px; }
mark { background: color-mix(in srgb, #ffcc00 40%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }

/* comments */
.comments { list-style: none; margin: 0 0 10px; padding: 0; }
.comments li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comments .by { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.comments .by b { color: var(--ink); }

/* picker results */
.picker { position: relative; }
.picker .results { list-style: none; margin: 4px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); max-height: 260px; overflow-y: auto; }
.picker .results li button { width: 100%; justify-content: flex-start; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; white-space: normal; display: block; }
.picker .results li:last-child button { border-bottom: 0; }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: start; scroll-snap-type: x proximity; }
.col { background: var(--soft); border-radius: var(--radius); padding: 8px; min-height: 120px; scroll-snap-align: start; }
.col.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.col h3 { margin: 2px 4px 8px; font-size: 12.5px; text-transform: capitalize; display: flex; justify-content: space-between; }
.col h3 .count { color: var(--muted); font-weight: 500; }
.bcard { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; margin-bottom: 7px; cursor: grab; }
.bcard.dragging { opacity: .5; }
.bcard a.t { font-weight: 600; color: var(--ink); display: block; overflow-wrap: anywhere; }
.bcard .sub { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.bcard select { width: 100%; min-height: 28px; padding: 2px 6px; font-size: 12.5px; }

/* uploads */
.drop-zone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px 16px; text-align: center; background: var(--panel); cursor: pointer; transition: border-color .12s, background .12s; }
.drop-zone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.drop-zone strong { display: block; font-size: 15px; margin-bottom: 4px; }
.uploads { list-style: none; padding: 0; margin: 10px 0 0; }
.uploads li { display: flex; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }
.uploads .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { width: 120px; height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; flex: none; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .1s; }
.uploads li.done .bar > i { background: var(--ok); }
.uploads li.failed .bar > i { background: var(--bad); }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 4px 0 10px 18px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline > li::before { content: ""; position: absolute; left: -6px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--accent); }
.timeline .when { color: var(--muted); font-size: 12px; }
.timeline .promise { margin-top: 4px; font-size: 13px; }
.timeline .promise.done { color: var(--muted); text-decoration: line-through; }

/* ask */
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.bubble { max-width: 860px; border-radius: 12px; padding: 10px 13px; border: 1px solid var(--line); background: var(--panel); }
.bubble.user { align-self: flex-end; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.bubble .sources { margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.bubble .sources a { margin-right: 10px; }
.ask-box { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; background: var(--bg); padding: 8px 0; }
.ask-box textarea { min-height: 54px; }

/* feed */
details.abstract { margin-top: 4px; }
details.abstract summary { cursor: pointer; color: var(--accent); font-size: 12.5px; }
details.abstract .md { margin-top: 4px; font-size: 13px; }
.why { font-size: 13px; margin-top: 3px; }

/* pills: single choice (enum), toggles (multi), and small read-only ones in lists */
.pills { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { display: inline-flex; align-items: center; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 999px; padding: 2px 10px; min-height: 28px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.pill:hover { background: var(--soft); }
.pill.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); font-weight: 600; }
.pills.multi .pill.on::before { content: "✓"; margin-right: 4px; }
.pill.sm { min-height: 0; padding: 0 7px; font-size: 11.5px; line-height: 18px; cursor: default; color: var(--muted); }
.pill.sm.on { color: var(--accent); font-weight: 500; }
.pill-list { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: 1px; }
@media (max-width: 560px) { .pill { min-height: 32px; padding: 3px 11px; } }

/* names in order (authors) */
.names { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 4px 6px; background: var(--panel); }
.names input { border: 0 !important; outline: none; min-height: 26px; flex: 1; min-width: 140px; padding: 2px 4px; background: transparent; }
.chips-in { display: contents; }
.chip-name { display: inline-flex; align-items: center; gap: 2px; background: var(--soft); border-radius: 999px; padding: 1px 4px 1px 10px; font-size: 13px; }
.chip-name .x { border: 0; background: none; min-height: 22px; padding: 0 6px; color: var(--muted); font-size: 15px; }

/* checklists inside Markdown */
.md ul.tasks { list-style: none; padding-left: 4px; }
.md li.task { display: flex; gap: 7px; align-items: flex-start; }
.md li.task input { margin-top: 4px; flex: none; width: 16px; height: 16px; }
.md li.task input:not(:disabled) { cursor: pointer; }
.limit-line { font-weight: 600; margin: -2px 0 8px; padding: 6px 10px; border-radius: 7px; background: color-mix(in srgb, var(--accent) 9%, transparent); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 8px 14px;
  border-radius: 8px; display: none; z-index: 50; max-width: calc(100vw - 32px); font-size: 13px; }
.toast.show { display: block; }
.toast.bad { background: var(--bad); color: #fff; }

/* The access-code page (login.html, crew.skycruncher.io) */
body.code-login { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.code-login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.code-login-card h1 { font-size: 18px; margin: 0 0 6px; }
.code-login-card form { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.code-login-card input { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink); }
.code-login-card button { font: inherit; padding: 9px 10px; border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.code-login-msg { min-height: 1.5em; margin: 4px 0 0; color: var(--muted); }
