/* tasks/app/app.css — mobile-first, dark like the site. Brand colours from
   website/content/site-config.json branding: red #dc2626, burgundy #7f1d1d,
   accent #374151, navy #111827. No webfont: the key rides in the URL and a
   third-party font request would carry it in a Referer. */
:root {
  --red: #dc2626;
  --burgundy: #7f1d1d;
  --accent: #374151;
  --navy: #111827;
  --bg: #0b0b0d;
  --panel: #16171b;
  --panel2: #22242b;
  --line: #2c2d35;
  --fg: #f4f4f5;
  --muted: #9ca3af;
  --green: #16a34a;
  --amber: #f59e0b;
  --radius: 12px;
  --tabs: 64px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.app { min-height: 100vh; padding-bottom: calc(var(--tabs) + 16px + env(safe-area-inset-bottom)); }
.app.bare { padding-bottom: 24px; }
.boot, .empty { color: var(--muted); text-align: center; padding: 40px 16px; }

/* header + tabs */
.top {
  position: sticky; top: 0; z-index: 5;
  background: rgba(11, 11, 13, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  display: flex; align-items: center; gap: 10px;
}
.top .brand { font-weight: 700; letter-spacing: .02em; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .brand b { color: var(--red); }
.iconbtn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--burgundy); color: #fff; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
}
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  background: var(--panel); border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--tabs) + env(safe-area-inset-bottom));
}
.tabs a { flex: 1; text-align: center; padding: 8px 4px 6px; font-size: 11px; color: var(--muted); }
.tabs a.active { color: var(--fg); }
.tabs a .ico { display: block; font-size: 20px; line-height: 26px; }
.tabs a.add { color: #fff; }
.tabs a.add .ico {
  display: inline-flex; width: 38px; height: 38px; border-radius: 50%; background: var(--red);
  align-items: center; justify-content: center; margin: -6px 0 2px; font-size: 24px;
}
.banner { background: var(--burgundy); color: #fff; padding: 8px 16px; font-size: 14px; text-align: center; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs) + 20px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 10; max-width: 90vw;
  background: #fff; color: #000; padding: 10px 16px; border-radius: 999px; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
}

/* layout */
main { padding: 16px; max-width: 720px; margin: 0 auto; }
h1 { font-size: 22px; line-height: 1.25; margin: 4px 0 14px; }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 22px 0 10px; }
p { margin: 0 0 12px; }
.meta { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row .fixed { flex: none; }
.right { text-align: right; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* cards */
.card {
  display: block; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
}
.card.high { border-left: 3px solid var(--red); }
.card.done .card-title { color: var(--muted); }
.card-title { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel2); color: var(--muted); white-space: nowrap; }
.chip.over { background: rgba(220, 38, 38, .22); color: #fca5a5; }
.chip.soon { background: rgba(245, 158, 11, .18); color: #fcd34d; }
.chip.doing { background: rgba(22, 163, 74, .2); color: #86efac; }
.chip.high { background: rgba(220, 38, 38, .28); color: #fecaca; }
.chip.private { background: rgba(127, 29, 29, .55); color: #fecaca; }
.chip.role { background: var(--accent); color: #fff; }
.chip.off { background: transparent; border: 1px solid var(--line); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: 2px; }
.card .head { display: block; }
.chip.progress { background: rgba(22, 163, 74, .18); color: #bbf7d0; }
.chip.progress.complete { background: rgba(22, 163, 74, .4); color: #fff; }
.chip.parent { background: transparent; border: 1px solid var(--line); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.cat { background: color-mix(in srgb, var(--c) 22%, transparent); color: #fff; }
.chip.cat::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }
@supports not (background: color-mix(in srgb, red 20%, transparent)) { .chip.cat { background: var(--panel2); } }

/* category filter row */
.filters { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; margin: 0 -16px 4px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { display: none; }
.filters button { flex: none; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 13px; min-height: 34px; }
.filters button.on { background: var(--fg); color: #000; border-color: var(--fg); font-weight: 600; }
.filters button.cat.on { background: var(--c); border-color: var(--c); color: #fff; }

/* category management */
.catrow { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.catrow:last-child { border-bottom: 0; }
.catrow .swatch { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.catrow .name { flex: 1; min-width: 0; }
.catrow .count { color: var(--muted); font-size: 13px; }
.catrow form { display: flex; flex: 1; gap: 8px; }

/* subtasks: nested rows under a parent card, and the list on the task screen */
.subs { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 4px; }
.sub { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; }
.sub + .sub { border-top: 1px solid rgba(44, 45, 53, .6); }
.sub .box {
  flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 7px;
  border: 2px solid var(--muted); background: transparent; color: #fff; font-size: 15px; line-height: 20px; padding: 0;
}
.sub .box.on { background: var(--green); border-color: var(--green); }
.sub .text { flex: 1; min-width: 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.sub.done .text { color: var(--muted); text-decoration: line-through; }
.sub .side { flex: none; display: flex; gap: 6px; align-items: center; }
.sub .who { font-size: 11px; font-weight: 700; background: var(--burgundy); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.sub .when { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sub .when.over { color: #fca5a5; }
.partof { display: inline-block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.partof b { color: var(--fg); font-weight: 500; }
.quick { display: flex; gap: 8px; margin-top: 10px; }
.quick input { flex: 1; min-width: 0; }
.quick button { flex: none; }
.group-head { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; }
.group-head button.name {
  flex: 1; text-align: left; background: none; border: 0; padding: 0;
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600;
}
.group-head button.name .n { color: var(--fg); }
.group-head .count { color: var(--muted); font-size: 12px; }
.group-head a.plus { color: var(--muted); font-size: 18px; line-height: 1; padding: 4px 8px; }

/* forms and buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--fg); font-weight: 500;
}
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }
.btn.danger { color: #fca5a5; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.on { border-color: var(--red); background: rgba(220, 38, 38, .18); }
.field { margin-bottom: 14px; }
.field > label, .label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
}
input[type=date] { -webkit-appearance: none; appearance: none; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(220, 38, 38, .6); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.check .hint { display: block; font-size: 13px; color: var(--muted); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; min-height: 44px; border: 0; background: transparent; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.active { background: var(--panel2); color: var(--fg); font-weight: 600; }
.seg button.active.doing { background: rgba(22, 163, 74, .25); color: #bbf7d0; }
.seg button.active.done { background: rgba(22, 163, 74, .45); color: #fff; }
.link-box {
  overflow-wrap: anywhere; background: var(--panel); border: 1px dashed var(--line);
  padding: 10px 12px; border-radius: 10px; font-size: 13px; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.details { white-space: pre-wrap; overflow-wrap: anywhere; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }

/* thread */
.thread { margin-top: 20px; }
.msg { padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .who { font-size: 12px; color: var(--muted); margin-bottom: 4px; white-space: normal; }
.msg.system { background: transparent; border: 0; color: var(--muted); font-size: 13px; padding: 2px 12px; }
.msg.mine { border-color: rgba(220, 38, 38, .35); }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.composer textarea { min-height: 44px; max-height: 160px; }

/* people */
.person { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
.person .name { font-weight: 600; }
.person.off { opacity: .6; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.big-icon { width: 96px; height: 96px; border-radius: 22px; display: block; margin: 0 auto 16px; }
@media (min-width: 720px) {
  .tabs { max-width: 720px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
