:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2330;
  --muted: #6b7482;
  --accent: #0d9488;
  --line: #e3e6eb;
  --danger: #c0392b;
  --warn: #d97706;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171c;
    --card: #1e232b;
    --text: #e8ebf0;
    --muted: #8b95a4;
    --accent: #2dd4bf;
    --line: #2c333e;
    --danger: #e0604f;
    --warn: #fbbf24;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
main { max-width: 760px; margin: 0 auto; padding: 12px 14px; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); font-weight: normal; }
.warn { color: var(--warn); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 17px; color: var(--accent); }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a { padding: 6px 12px; border-radius: 8px; font-size: 15px; }
.topbar nav a.on { background: var(--accent); color: #fff; }
.topbar nav a.quiet { color: var(--muted); }
.whoami {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: var(--pc); color: #fff; font-size: 11px; font-weight: 700;
}

/* forms */
.page-title { margin: 10px 4px; font-size: 20px; }
.sectionhead {
  margin: 24px 4px 8px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
}
.sectionhead .muted { text-transform: none; letter-spacing: 0; font-size: 12px; }
.crumb { margin: 8px 4px; font-size: 13px; color: var(--muted); }
.crumb a { color: var(--accent); }
.stoform { display: flex; flex-direction: column; gap: 10px; }
.addbox {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; margin: 10px 0 4px;
}
label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; }
input, select, textarea {
  font: inherit; font-weight: normal;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); width: 100%;
}
textarea { resize: vertical; }
button {
  font: inherit; font-weight: 600;
  background: var(--accent); color: #fff; border: 0;
  padding: 12px; border-radius: 10px; cursor: pointer;
}
button:active { opacity: .8; }
button[disabled] { opacity: .4; cursor: default; }
button.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.addrow { display: flex; gap: 8px; align-items: center; }
.addrow input, .addrow select { flex: 1; min-width: 0; }
.addrow button { flex: none; padding: 11px 16px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--card); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-size: 14px;
}
.chip.mini { font-size: 13px; padding: 6px 12px; }
.chip.sel {
  background: var(--pc, var(--accent)); border-color: var(--pc, var(--accent));
  color: #fff; font-weight: 600;
}
.chip.danger-chip { color: var(--danger); border-color: var(--danger); }
.actbtns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.inlineform { display: inline-flex; flex: none; }
.xbtn {
  background: transparent; color: var(--muted); border: 0;
  font-size: 18px; padding: 2px 7px; line-height: 1;
}
.danger-form { margin-top: 10px; }
.error { color: var(--danger); margin: 0; }
.empty { text-align: center; color: var(--muted); margin-top: 60px; line-height: 1.6; }
.noneyet { margin: 4px 2px; font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; margin: 12px 4px; line-height: 1.5; }
.quietlink { color: var(--muted); font-size: 13px; }
.banner {
  background: var(--accent); color: #fff; border-radius: 10px;
  padding: 10px 14px; font-size: 14px; margin: 10px 0;
}
.editbox, .weeknotes, .stepedit { margin: 14px 0; }
.editbox > summary, .weeknotes > summary, .stepedit > summary {
  cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 4px;
}
.stepedit { margin: 0 0 10px 34px; }

/* login */
.login-box { max-width: 340px; margin: 16vh auto 0; text-align: center; }
.login-box h1 { color: var(--accent); }
.login-box form { display: flex; flex-direction: column; gap: 12px; }

/* week navigation and summary */
.weeknav {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 0 4px;
}
.weeknav .arrow { font-size: 26px; padding: 0 16px; color: var(--accent); }
.weektitle { text-align: center; }
.weektitle h2 { font-size: 17px; margin: 0; }
.weekbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 8px 2px 12px;
}
.weekbar .muted { font-size: 13px; }
.meterwrap {
  display: inline-flex; align-items: center; gap: 8px;
  flex: 1; max-width: 220px; min-width: 120px;
}
.meterwrap.wide { max-width: none; margin: 6px 0 2px; }
.daymeter {
  flex: 1; height: 6px; border-radius: 999px; background: var(--line);
  overflow: hidden;
}
.daymeter span {
  display: block; height: 100%; border-radius: 999px; background: var(--accent);
}
.meterwrap .pct { font-size: 12px; color: var(--muted); font-weight: 600; }
.whofilter { margin: 0 0 12px; }

/* the day board */
.daycard {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 13px; margin-bottom: 10px;
}
.daycard.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.daycard.is-past { opacity: .72; }
.daycard h2 {
  margin: 0 0 8px; font-size: 14px;
  display: flex; align-items: baseline; gap: 8px;
}
.daycard h2 .dayname { font-weight: 700; }
.daycard h2 .daydate { color: var(--muted); font-weight: normal; font-size: 13px; }
.daycard h2 .pill {
  background: var(--accent); color: #fff; font-size: 11px;
  padding: 2px 8px; border-radius: 999px; font-weight: 600;
}
.daycard h2 .daytot { margin-left: auto; color: var(--muted); font-size: 12px; }

.lane { border-left: 3px solid var(--pc); padding-left: 9px; margin-bottom: 12px; }
.lane:last-child { margin-bottom: 0; }
.lanehead { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--pc); color: #fff; font-size: 10px; font-weight: 700;
}
.avatar.big { width: 34px; height: 34px; font-size: 13px; }
.lanename { font-size: 13px; font-weight: 600; }
.lanemin { margin-left: auto; font-size: 12px; color: var(--muted); }

/* one step, wherever it appears */
.steprow { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; }
.steprow + .steprow { border-top: 1px solid var(--line); }
.steprow.full { padding: 9px 0 4px; }
.tick {
  width: 24px; height: 24px; border-radius: 50%; flex: none; padding: 0;
  border: 2px solid var(--line); background: var(--card); color: #fff;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.steprow.done .tick { background: var(--accent); border-color: var(--accent); }
.steprow.done .stepmain .title { text-decoration: line-through; color: var(--muted); }
.stepmain { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.stepmain .title { font-weight: 600; font-size: 15px; }
.stepmain .sub { font-size: 12px; color: var(--muted); }
.dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 7px; vertical-align: middle;
}
.stepmeta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stepbtns { display: flex; flex: none; gap: 0; }
.steptools {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin: 0 0 6px 34px;
}
.steptools select, .steptools input { width: auto; flex: 1 1 30%; min-width: 108px;
  font-size: 13px; padding: 6px 8px; }
.daypick, .whopick {
  width: auto; flex: none; font-size: 12px; padding: 6px 8px;
  max-width: 124px; background: var(--bg);
}
.minidate { font-size: 13px; padding: 6px 8px; }

/* badges */
.pri, .est, .due, .status, .who, .donetext, .whenbadge, .trackbadge {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
}
.est { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.pri { color: #fff; }
.pri-urgent { background: #ef4444; }
.pri-high { background: var(--warn); }
.pri-normal { background: var(--muted); }
.pri-low { background: var(--muted); opacity: .7; }
.chip.pri-chip { color: var(--text); background: var(--card); }
.chip.pri-chip.sel { color: #fff; }
.chip.pri-urgent.sel { background: #ef4444; border-color: #ef4444; }
.chip.pri-high.sel { background: var(--warn); border-color: var(--warn); }
.chip.pri-normal.sel, .chip.pri-low.sel {
  background: var(--muted); border-color: var(--muted);
}
.due, .whenbadge { background: var(--bg); color: var(--muted); }
.due.soon, .whenbadge.soon { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--text); }
.due.today, .whenbadge.today { background: var(--warn); color: #fff; }
.due.overdue, .whenbadge.overdue { background: var(--danger); color: #fff; }
.status { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.status.st-active { color: var(--accent); border-color: var(--accent); }
.status.st-blocked { color: var(--danger); border-color: var(--danger); }
.status.st-done { color: var(--muted); }
.who { background: var(--pc); color: #fff; }
.donetext { font-size: 12px; color: var(--muted); padding: 0; }

/* backlog and leftovers */
.backlog, .stranded {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 11px 13px; margin: 14px 0;
}
.stranded { border-color: var(--danger); }
.backlog h3, .stranded h3 {
  margin: 0 0 8px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  display: flex; align-items: baseline; gap: 8px;
}
.stranded h3 { color: var(--danger); }
.backlog h3 .muted { text-transform: none; letter-spacing: 0; font-size: 12px; }
.weekactions { display: flex; gap: 8px; margin-bottom: 10px; }
.weekactions form { flex: 1; }
.weekactions button { width: 100%; padding: 10px; }

/* projects */
.postit {
  --pc: var(--accent);
  background: color-mix(in srgb, var(--pc) 9%, var(--card));
  border: 1px solid color-mix(in srgb, var(--pc) 32%, var(--line));
  border-top: 4px solid var(--pc);
  border-radius: 14px; padding: 12px 14px; margin: 14px 0;
}
.postit.archived { opacity: .6; }
.postit-head { display: flex; align-items: flex-start; gap: 10px; }
.postit-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.postit-title .title { font-weight: 700; font-size: 16px; }
.postit-title a.title { color: var(--pc); }
.postit-title .aim { font-size: 13px; color: var(--muted); }
.postit-title .sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.trackbadge { background: var(--pc); color: #fff; }
.postit .chiprow { margin-top: 10px; }
.postit .chip.sel { background: var(--pc); border-color: var(--pc); }
.stagerow { margin-top: 10px; }
.stagerow select { background: var(--card); font-size: 13px; padding: 8px 10px; }
.stagedots { display: flex; gap: 3px; flex: none; padding-top: 5px; }
.dotstage {
  width: 7px; height: 7px; border-radius: 50%;
  background: color-mix(in srgb, var(--pc) 22%, var(--line));
}
.dotstage.on { background: var(--pc); }

.expcard {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 13px; margin-bottom: 8px;
}
.expcard.done { opacity: .62; }
.expmain { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.expmain .title { font-weight: 600; font-size: 15px; }
.expmain .sub { font-size: 13px; color: var(--muted); }

/* people */
.personcard {
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--pc);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
}
.personhead { display: flex; align-items: center; gap: 10px; }
.persontitle { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.persontitle .title { font-weight: 700; font-size: 16px; }
.persontitle .sub { font-size: 12px; color: var(--muted); }
.feedrow { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.feedurl { font-size: 12px; font-family: ui-monospace, SFMono-Regular, monospace; }
.personcard .addrow { margin-top: 8px; }

@media (max-width: 430px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  .topbar .brand { display: none; }
  .topbar nav { gap: 2px; width: 100%; }
  .topbar nav a { padding: 6px 8px; font-size: 14px; }
  .steptools select, .steptools input { flex: 1 1 100%; }
}

/* the printable week sheet */
.printsheet { font-size: 14px; }
.printhead h1 { font-size: 20px; margin: 0 0 4px; }
.printhead p { margin: 4px 0 14px; font-size: 13px; }
.printhead .noprint { display: flex; align-items: center; gap: 14px; }
.printday { border-top: 2px solid var(--text); padding: 8px 0 12px; }
.printday h2 { font-size: 15px; margin: 0 0 6px; }
.printlane { margin: 0 0 10px 0; }
.printlane h3 { font-size: 13px; margin: 0 0 4px; }
.printrow { display: flex; align-items: flex-start; gap: 8px; padding: 3px 0; }
.printrow .box {
  width: 15px; height: 15px; border: 1px solid var(--text); border-radius: 3px;
  flex: none; margin-top: 2px; font-size: 11px; line-height: 13px;
  text-align: center;
}
.printmain { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.printmain .title { font-weight: 600; }
.printmain .sub { font-size: 11px; color: var(--muted); }
.printest { flex: none; font-size: 11px; color: var(--muted); }
.printrow.done .title { text-decoration: line-through; color: var(--muted); }
.printnotes { border-top: 2px solid var(--text); padding-top: 8px; }
.printnotes h2 { font-size: 15px; margin: 0 0 4px; }
.printnotes p { white-space: pre-wrap; font-size: 13px; }

@media print {
  :root {
    --bg: #fff; --card: #fff; --text: #000; --muted: #555; --line: #999;
  }
  body { padding: 0; background: #fff; }
  main { max-width: none; padding: 0; }
  .noprint { display: none !important; }
  .printday { break-inside: avoid; }
}
