/* Neo-brutalist: thick black borders, hard offset shadows (no blur), a small
   set of saturated colors on cream, chunky display type over a clean body
   face, and buttons that physically "press" into their shadow. Body copy
   stays Inter and padding stays generous — per NN/g, the style's usual
   failure mode is sacrificing readability for attitude. */

:root {
  --paper: #fdf6e8;
  --paper-2: #fffdf7;
  --ink: #000000;
  --ink-soft: #46433d;
  --muted: #6d685e;

  --yellow: #ffd84d;
  --pink: #ff6b9d;
  --green: #9ef01a;
  --blue: #4d9bff;
  --lilac: #c9a7ff;
  --orange: #ff9f45;
  --danger: #ff4d4d;

  --border: 3px solid var(--ink);
  --border-thin: 2px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  --radius: 6px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
/* Backstop: the page itself must never scroll sideways, no matter what a
   descendant's intrinsic width does (see the #toc min-width note below). */
html, body { overflow-x: hidden; max-width: 100%; }
::selection { background: var(--yellow); color: var(--ink); }

body {
  background-color: var(--paper);
  /* faint dot grid — texture without competing with the content */
  background-image: radial-gradient(rgba(0,0,0,0.09) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--paper); border-left: var(--border-thin); }
::-webkit-scrollbar-thumb { background: var(--ink); border: 2px solid var(--paper); border-radius: 0; }

/* Shared press behaviour for every clickable slab. */
.pressable, .filter-btn, #lock-again, .composer button, #gate button#unlock,
.status-pill, .sheet-delete, .comment-actions button, .comment-edit-actions button {
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.pressable:active, .filter-btn:active, #lock-again:active, .composer button:active,
#gate button#unlock:active, .status-pill:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--ink) !important;
}

/* ---------------- Gate ---------------- */
#gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#gate .box {
  width: 100%;
  max-width: 400px;
  background: var(--paper-2);
  border: var(--border);
  border-radius: var(--radius);
  padding: 34px 30px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.logo-mark {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
  color: var(--ink);
  background: var(--yellow);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
#gate h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 6px;
}
#gate p { color: var(--muted); font-size: 14.5px; margin: 0 0 22px; }
#gate input, #gate select {
  width: 100%;
  padding: 13px 14px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font-size: 15px;
  font-family: var(--font-body);
  font-weight: 500;
  margin-bottom: 12px;
  outline: none;
  box-shadow: var(--shadow-sm);
}
#gate input:focus, #gate select:focus { box-shadow: var(--shadow); background: #fff; }
#gate input::placeholder { color: var(--muted); }
#gate button#unlock {
  width: 100%;
  padding: 14px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--yellow);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
#gate button#unlock:hover { background: #ffe480; }
.btn-arrow { font-size: 20px; line-height: 1; }
.error {
  color: var(--ink);
  background: var(--danger);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  min-height: 0;
  margin-top: 12px;
  padding: 0;
  border-radius: var(--radius);
}
.error:not(:empty) { padding: 8px 10px; border: var(--border-thin); box-shadow: var(--shadow-sm); }

/* ---------------- Topbar ---------------- */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--yellow);
  border-bottom: var(--border);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.4px;
}
.brand span {
  background: var(--ink);
  color: var(--yellow);
  padding: 1px 7px;
  border-radius: 4px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.sync-indicator {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--paper-2);
  border: var(--border-thin);
  flex-shrink: 0;
}
.sync-indicator.sync-ok { background: var(--green); }
.sync-indicator.sync-error { background: var(--danger); }
.user-picker {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--paper-2);
  border: var(--border-thin);
  border-radius: var(--radius);
  padding: 4px 11px;
  box-shadow: var(--shadow-sm);
}
.user-picker-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
#current-user-label { font-size: 14px; font-weight: 700; }
#lock-again {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper-2);
  border: var(--border-thin);
  padding: 7px 13px;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
#lock-again:hover { background: var(--pink); }

/* ---------------- Layout ---------------- */
#layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 32px;
  padding: 0 24px;
}
#toc {
  position: sticky;
  top: 78px;
  align-self: start;
  padding-top: 32px;
  max-height: calc(100vh - 92px);
  overflow-y: auto;
  /* Grid items default to min-width:auto, which sizes the track to fit a
     max-content child (.toc-list below) instead of the fraction it was
     given — on mobile that child is a wide horizontal chip strip, and
     without this the whole page grid stretches to match it and scrolls
     sideways. min-width:0 lets #toc (and its own overflow-x) do the job. */
  min-width: 0;
}
.toc-list { display: flex; flex-direction: column; gap: 9px; }
.toc-list a {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 12px;
  background: var(--paper-2);
  border: var(--border-thin);
  border-radius: var(--radius);
  line-height: 1.25;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.toc-list a:hover { background: var(--yellow); transform: translate(-1px, -1px); box-shadow: var(--shadow-sm); }
.toc-list a.is-current { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.toc-emoji { font-size: 16px; flex-shrink: 0; }

#content .wrap { padding: 32px 0 110px; min-width: 0; }

/* ---------------- Page intro ---------------- */
.page-intro {
  background: var(--paper-2);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 30px;
}
.page-intro h1 {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.15;
  margin: 0 0 8px;
  font-weight: 700;
  letter-spacing: -1px;
}
.page-intro > p { font-size: 15.5px; color: var(--ink-soft); margin: 0 0 20px; max-width: 62ch; }

.overall-progress { margin-bottom: 18px; }
.overall-bar {
  height: 22px;
  background: var(--paper);
  border: var(--border-thin);
  border-radius: var(--radius);
  overflow: hidden;
}
.overall-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
  border-right: 2px solid var(--ink);
  transition: width 0.35s ease;
}
.overall-legend {
  margin-top: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}

.filters { display: flex; flex-wrap: wrap; gap: 9px; }
.filter-btn {
  background: var(--paper-2);
  border: var(--border-thin);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 15px;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.filter-btn:hover { background: var(--lilac); }
.filter-btn.is-active { background: var(--ink); color: var(--paper); }

/* ---------------- Sections ---------------- */
.section {
  margin-bottom: 30px;
  background: var(--paper-2);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: 92px;
  overflow: hidden;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 18px 22px;
  border-bottom: var(--border);
  background: var(--yellow);
}
/* Each section gets its own header colour so they're tellable apart at a glance. */
.section:nth-of-type(1) .section-header { background: var(--yellow); }
.section:nth-of-type(2) .section-header { background: var(--pink); }
.section:nth-of-type(3) .section-header { background: var(--green); }
.section:nth-of-type(4) .section-header { background: var(--lilac); }
.section:nth-of-type(5) .section-header { background: var(--orange); }

.section-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.section-emoji {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-2);
  border: var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.section h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.2;
}
.section-blurb { font-size: 14px; color: var(--ink); opacity: 0.75; margin: 3px 0 0; max-width: 52ch; }
.section-progress {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  background: var(--paper-2);
  border: var(--border-thin);
  padding: 7px 13px;
  border-radius: var(--radius);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.section-body { padding: 6px 22px 22px; }
.subsection { margin-top: 26px; }
.subsection:first-child { margin-top: 20px; }
.section h3 {
  font-family: var(--font-display);
  font-size: 16.5px;
  margin: 0 0 6px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: inline-block;
  border-bottom: 3px solid var(--yellow);
  padding-bottom: 1px;
}
.subsection-note { font-size: 14px; color: var(--muted); margin: 0 0 10px; }

/* ---------------- Typography ---------------- */
code {
  background: var(--yellow);
  border: var(--border-thin);
  padding: 0 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
strong { font-weight: 700; }
a { color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 2px; }
.md-list-item { font-size: 14.5px; margin: 5px 0; color: var(--muted); padding-left: 4px; }

/* ---------------- Todo item ---------------- */
.todo-list { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.todo-item {
  background: var(--paper);
  border: var(--border-thin);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.todo-item:hover {
  background: var(--paper-2);
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow);
}
.todo-item-row { display: flex; align-items: flex-start; gap: 12px; }
.todo-item-text { flex: 1; font-size: 15px; line-height: 1.5; padding-top: 4px; min-width: 0; }
.thread { cursor: default; }

.status-pill {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 8px 12px;
  border: var(--border-thin);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
.status-not-started { background: var(--paper-2); }
.status-in-progress { background: var(--yellow); }
.status-done { background: var(--green); }
.status-done + .todo-item-text { text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.55; }

.comment-toggle {
  flex-shrink: 0;
  background: var(--paper-2);
  border: var(--border-thin);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 11px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease;
}
.comment-toggle:hover { background: var(--blue); }
.comment-count { font-weight: 700; }

/* ---------------- Thread / comments ---------------- */
.thread {
  margin-top: 14px;
  padding-top: 14px;
  border-top: var(--border-thin);
}
.thread-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }

.comment { display: flex; gap: 11px; }
.avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: var(--border-thin);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.comment-body {
  flex: 1;
  min-width: 0;
  background: var(--paper-2);
  border: var(--border-thin);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.comment-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.comment-author { font-size: 14px; font-weight: 700; }
.comment-time { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.comment-text { font-size: 14.5px; margin-top: 3px; word-wrap: break-word; }
.mention {
  background: var(--blue);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 0 4px;
  font-weight: 700;
}
.comment-actions { display: flex; gap: 8px; margin-top: 8px; }
.comment-actions button {
  background: var(--paper);
  border: var(--border-thin);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  cursor: pointer;
  padding: 4px 9px;
}
.comment-actions button:hover { background: var(--yellow); }
.comment-actions .danger-btn:hover { background: var(--danger); }

.comment-edit { margin-top: 6px; }
.comment-edit textarea {
  width: 100%;
  resize: none;
  overflow: hidden;
  background: #fff;
  border: var(--border-thin);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 9px 11px;
  outline: none;
  box-shadow: var(--shadow-sm);
}
.comment-edit-actions { display: flex; gap: 8px; margin-top: 7px; }
.comment-edit-actions button {
  background: var(--green);
  border: var(--border-thin);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 5px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.comment-edit-actions .ghost-btn { background: var(--paper); }

.comment-replies {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 11px;
  padding-left: 14px;
  border-left: var(--border-thin);
}

.composer { position: relative; display: flex; gap: 10px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  resize: none;
  background: #fff;
  border: var(--border-thin);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  padding: 11px 12px;
  outline: none;
  min-height: 44px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.composer textarea:focus { box-shadow: var(--shadow); }
.composer button {
  flex-shrink: 0;
  background: var(--green);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--radius);
  padding: 11px 20px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.composer button:hover { background: #b4f542; }

.mention-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: var(--paper-2);
  border: var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 5px;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  z-index: 5;
}
.mention-option {
  background: none;
  border: none;
  color: var(--ink);
  text-align: left;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 4px;
  cursor: pointer;
}
.mention-option:hover { background: var(--blue); }

/* ---------------- Tracking tables ---------------- */
.tracker-table {
  margin: 16px 0 4px;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--paper-2);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.tracker-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: var(--border);
  background: var(--blue);
}
.tracker-table-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tracker-table-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  background: var(--paper-2);
  border: var(--border-thin);
  border-radius: 4px;
  padding: 2px 8px;
}
.tracker-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.sheet {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-family: var(--font-body);
}
table.sheet th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 9px 11px;
  border-bottom: var(--border-thin);
  background: var(--paper);
  white-space: nowrap;
}
table.sheet td {
  padding: 0;
  border-bottom: 1.5px solid rgba(0,0,0,0.14);
  border-right: 1.5px solid rgba(0,0,0,0.14);
  vertical-align: middle;
}
table.sheet td:last-child { border-right: none; }
table.sheet tr:last-child td { border-bottom: none; }
table.sheet input[type="text"], table.sheet select {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  padding: 11px;
  outline: none;
}
table.sheet input[type="text"]::placeholder { color: var(--muted); opacity: 0.6; }
table.sheet input[type="text"]:focus, table.sheet select:focus {
  background: var(--yellow);
  box-shadow: inset 0 0 0 2px var(--ink);
}
table.sheet select { cursor: pointer; font-weight: 600; }
table.sheet select[data-filled="to-contact"] { color: var(--muted); }
table.sheet select[data-filled="contacted"],
table.sheet select[data-filled="talking"],
table.sheet select[data-filled="meeting-set"] { background: var(--yellow); }
table.sheet select[data-filled="confirmed"],
table.sheet select[data-filled="video-done"],
table.sheet select[data-filled="onboarded"],
table.sheet select[data-filled="met"] { background: var(--green); }
table.sheet select[data-filled="passed"] { color: var(--muted); text-decoration: line-through; }

.sheet-added-by-col {
  width: 90px;
  padding: 0 11px !important;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}
.sheet-actions-col { width: 42px; text-align: center; }
.sheet-delete {
  background: var(--paper);
  border: var(--border-thin);
  border-radius: 4px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  opacity: 0;
}
table.sheet tr:hover .sheet-delete { opacity: 1; }
.sheet-delete:hover { background: var(--danger); }
.sheet-delete:focus { opacity: 1; }

.sheet-new-row { background: repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(0,0,0,0.03) 8px, rgba(0,0,0,0.03) 16px); }
.sheet-new-hint { font-size: 18px; font-weight: 700; opacity: 0.4; }

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
  /* minmax(0, 1fr), not a bare 1fr: without the explicit 0 floor, a track's
     min sizing function defaults to auto (content-based), so any deeply
     nested nowrap/overflow-x row anywhere in either grid child (the mobile
     TOC strip, the filter chips, a tracking table...) can blow the whole
     column out past the viewport. Same reasoning as the desktop rule above,
     just as one column instead of two. */
  #layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }

  /* Sidebar becomes a horizontal, sticky, scrollable strip of chips. */
  #toc {
    position: sticky;
    top: 61px;
    z-index: 15;
    padding: 12px 16px;
    margin: 0;
    max-height: none;
    background: var(--paper);
    border-bottom: var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .toc-list { flex-direction: row; gap: 9px; width: max-content; }
  .toc-list a { flex-shrink: 0; box-shadow: var(--shadow-sm); }

  #content .wrap { padding: 20px 16px 90px; }
  .page-intro { padding: 20px; }
  .page-intro h1 { font-size: 26px; }
  .section-header { padding: 15px 16px; }
  .section-body { padding: 4px 16px 18px; }
  .section-emoji { width: 40px; height: 40px; font-size: 20px; }
  .section h2 { font-size: 17.5px; }
  .section-blurb { max-width: none; }
}

@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .topbar-inner { padding: 10px 14px; gap: 8px; }
  .brand { font-size: 16px; }
  .topbar-right { gap: 8px; }
  .user-picker-label { display: none; }
  .user-picker { padding: 4px 9px; }
  #lock-again { padding: 6px 10px; font-size: 10.5px; }

  #gate { padding: 16px; }
  #gate .box { padding: 28px 20px; }
  #gate h1 { font-size: 22px; }

  .page-intro h1 { font-size: 23px; }
  .section-header { gap: 10px; }
  .section-progress { font-size: 11px; padding: 5px 10px; }

  /* Filter row scrolls sideways rather than wrapping to three cramped lines. */
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
    margin: 0 -20px;
    padding-left: 20px;
    padding-right: 20px;
  }
  .filter-btn { flex-shrink: 0; }

  .todo-item { padding: 13px 12px; }
  .todo-item-row { flex-wrap: wrap; gap: 9px; }
  .todo-item-text { flex-basis: 100%; order: 1; }
  .status-pill { order: 2; }
  .comment-toggle { order: 3; margin-left: auto; }
  .status-done + .todo-item-text { text-decoration: line-through; }

  .comment-replies { padding-left: 10px; }
  .composer { flex-wrap: wrap; }
  .composer textarea { flex-basis: 100%; }
  .composer button { flex-basis: 100%; padding: 13px; }
  .mention-menu { left: 0; right: 0; }

  /* Let the sheet reach the card edges so more columns fit on screen. */
  .tracker-table { margin-left: -16px; margin-right: -16px; border-radius: 0; border-left: none; border-right: none; }
  table.sheet { min-width: 660px; }
  table.sheet input[type="text"], table.sheet select { font-size: 15px; padding: 12px 11px; }
  .sheet-delete { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}
