/* Door sheet design system. DESIGN.md is the plan this file follows. */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url('/fonts/archivo-latin.woff2') format('woff2');
}

:root {
  /* The six named colors */
  --canvas: #eef0f3;
  --surface: #ffffff;
  --ink: #1b1f26;
  --muted: #5e6775;
  --line: #dadee4;
  --highlighter: #ffe11a;

  /* Meaning only where it is needed */
  --go: #1e7b4b;
  --go-tint: #e6f3ec;
  --stop: #b8332a;
  --stop-tint: #fbecea;

  /* Steps of the six, not new colors */
  --hover: #f4f5f7;
  --press: #e6e9ed;
  --line-strong: #c3c9d1;
  --stage: #f6f7f9;
  --hl-wash: rgba(255, 225, 26, 0.34);
  --hl-edge: #c4a300;
  --ink-soft: rgba(27, 31, 38, 0.5);

  --shadow: 0 1px 2px rgba(27, 31, 38, 0.06), 0 10px 30px rgba(27, 31, 38, 0.12);
  --shadow-low: 0 1px 2px rgba(27, 31, 38, 0.08), 0 2px 8px rgba(27, 31, 38, 0.06);

  --r-float: 12px;
  --r-control: 8px;
  --r-pill: 999px;
  --r-frame: 14px;

  --nav-w: 248px;
  --rail-w: 72px;
  --dock-w: 360px;

  --t-fast: 120ms;
  --t: 160ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --font: 'Archivo', 'Helvetica Neue', Arial, sans-serif;

  /* Walk inks on the plan: steps of ink, never a new hue */
  --walk-ink: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --t-fast: 0ms;
    --t: 0ms;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 450;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-weight: 650;
  letter-spacing: -0.01em;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--r-control);
  background: var(--ink);
  color: var(--surface);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.hl {
  padding: 0 3px;
  margin: 0 -3px;
  border-radius: 2px;
  background: linear-gradient(176deg, transparent 46%, var(--highlighter) 46%, var(--highlighter) 94%, transparent 94%);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* App layout: navigation and the work frame. The rep view replaces both. */

body {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
}

body[data-nav='collapsed'] {
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
}

body[data-view='rep'] {
  display: block;
}

body[data-view='rep'] .nav,
body[data-view='rep'] .main {
  display: none;
}

body:not([data-view='rep']) .rep {
  display: none;
}

/* Navigation */

.nav {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 16px;
  overflow: hidden;
}

.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 40px;
  padding: 0 0 0 6px;
  margin-bottom: 18px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-control);
}

.mark {
  width: 30px;
  height: 30px;
  flex: none;
  color: var(--ink);
}

.wordmark-text {
  font-size: 17px;
  font-weight: 700;
  font-stretch: 118%;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.icon-button:hover {
  background: var(--hover);
  border-color: var(--line-strong);
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease);
}

.nav-item .icon {
  color: var(--muted);
}

.nav-item:hover {
  background: rgba(27, 31, 38, 0.05);
}

.nav-item[aria-current='page'] {
  background: var(--press);
  font-weight: 600;
}

.nav-item[aria-current='page'] .icon {
  color: var(--ink);
}

.nav-rule {
  height: 1px;
  margin: 12px 8px;
  background: var(--line);
}

.nav-foot {
  margin-top: auto;
  padding: 0 4px;
}

.role {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-control);
  background: rgba(27, 31, 38, 0.06);
}

.role-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #4a525e;
  font-size: 13px;
  font-weight: 550;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.role-item .icon {
  width: 16px;
  height: 16px;
}

.role-item:hover {
  color: var(--ink);
}

.role-item[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-low);
}

body[data-nav='collapsed'] .nav {
  padding-inline: 12px;
}

body[data-nav='collapsed'] .nav-head {
  flex-direction: column;
  height: auto;
  gap: 12px;
  padding: 0;
  margin-bottom: 18px;
}

body[data-nav='collapsed'] .wordmark-text,
body[data-nav='collapsed'] .nav-item span,
body[data-nav='collapsed'] .role-item span {
  display: none;
}

body[data-nav='collapsed'] .nav-item {
  justify-content: center;
  padding: 0;
}

body[data-nav='collapsed'] .role {
  flex-direction: column;
}

body[data-nav='collapsed'] .role-item {
  justify-content: center;
  padding: 0;
  width: 36px;
}

/* The work frame */

.main {
  min-width: 0;
  height: 100dvh;
  padding: 12px 12px 12px 0;
  outline: none;
}

.frame {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-frame);
  background: var(--surface);
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 12px 20px 12px 24px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.bar-title {
  min-width: 0;
}

.bar h1 {
  font-size: 20px;
  line-height: 24px;
}

.bar .meta {
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--hover);
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

.chip--hl {
  background: var(--highlighter);
}

.chip--go {
  background: var(--go-tint);
  color: var(--go);
}

.chip--stop {
  background: var(--stop-tint);
  color: var(--stop);
}

.bar-tools > * {
  flex: none;
}

.bar-tools > .picker {
  flex: 0 1 auto;
}

.picker {
  position: relative;
  min-width: 120px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  max-width: 380px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--shadow-low);
  font-size: 14px;
  font-weight: 550;
  transition: border-color var(--t-fast) var(--ease);
}

.picker:hover {
  border-color: var(--line-strong);
}

.picker:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.picker-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.picker .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.picker-select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 24px 0;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--stop-tint);
  color: var(--stop);
  font-weight: 500;
}

.alert .icon {
  margin-top: 1px;
}

/* Screens: one visible at a time, chosen by body[data-screen] */

.screen {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
}

body[data-screen='doors'] .screen[data-for~='doors'],
body[data-screen='storm'] .screen[data-for~='storm'],
body[data-screen='walks'] .screen[data-for~='walks'],
body[data-screen='handout'] .screen[data-for~='handout'],
body[data-screen='score'] .screen[data-for~='score'],
body[data-screen='daysheet'] .screen[data-for~='daysheet'] {
  display: flex;
}

body[data-screen='storm'] .screen [data-for='walks'],
body[data-screen='walks'] .screen [data-for='storm'] {
  display: none;
}

body[data-state='loading'] .screen--plan,
body[data-state='territory-invalid'] .screen--plan {
  opacity: 0.5;
  pointer-events: none;
}

body[data-state='territory-invalid'] .toolbar-row,
body[data-state='territory-invalid'] .table-wrap > table {
  display: none;
}

body[data-state='territory-invalid'] .empty p {
  color: var(--muted);
}

/* Buttons and fields */

.btn,
.tap:where(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  touch-action: manipulation;
}

/* Touch screens keep :hover after a tap, so the shade would sit on the next card. */
@media (hover: hover) {
  .btn:hover,
  .tap:where(button, a):hover {
    background: var(--hover);
    border-color: var(--line-strong);
  }
}

.btn:active,
.tap:where(button, a):active {
  background: var(--press);
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn--primary,
.btn--primary:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.btn--primary:hover {
  background: #2b313b;
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
}

.btn--small {
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.btn--lg {
  min-height: 48px;
  padding: 0 20px;
  font-size: 15px;
}

.btn--block {
  width: 100%;
}

.btn:disabled,
.tap:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  pointer-events: none;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span:first-child,
.label {
  font-size: 13px;
  font-weight: 550;
  line-height: 18px;
}

input[type='text'],
input[type='date'],
input:not([type]),
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(27, 31, 38, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: #8a929e;
}

textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.4;
}

input[readonly] {
  background: var(--hover);
  color: var(--muted);
  font-size: 13px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
}

.switch input {
  appearance: none;
  position: relative;
  width: 36px;
  height: 22px;
  min-height: 0;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  cursor: pointer;
  transition: background var(--t) var(--ease);
}

.switch input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(27, 31, 38, 0.25);
  transition: transform var(--t) var(--ease);
}

.switch input:checked {
  background: var(--ink);
}

.switch input:checked::after {
  transform: translateX(14px);
}

.switch input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--hover);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-low);
}

.segmented .n {
  color: var(--muted);
  font-weight: 500;
}

.segmented button[aria-pressed='true'] .n {
  color: var(--ink);
}

/* Cards and panels */

.card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-float);
  background: var(--surface);
}

.float .card,
.float .panel,
.float .map-card {
  border-color: transparent;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
}

.panel-head h2 {
  font-size: 17px;
  line-height: 22px;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 16px;
}

.panel-foot {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.status {
  color: var(--muted);
  font-size: 14px;
}

.error {
  color: var(--stop);
  font-size: 14px;
  font-weight: 500;
}

p.error:not(:empty) {
  padding: 10px 12px;
  border-radius: var(--r-control);
  background: var(--stop-tint);
}

.disclaimer {
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  max-width: 72ch;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
}

.empty h2 {
  color: var(--ink);
  font-size: 17px;
}

.empty p {
  max-width: 44ch;
}

/* Doors on file */

.screen--doors {
  flex-direction: column;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 24px;
  flex: none;
}

.filters {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-control);
  background: var(--hover);
}

.filters button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

.filters button:hover {
  color: var(--ink);
}

.filters button[aria-pressed='true'] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-low);
}

.filters b {
  font-weight: 650;
  color: var(--ink);
}

.filters b.zero {
  color: var(--muted);
}

.filters button[data-filter='kept'] b:not(.zero) {
  padding: 0 3px;
  border-radius: 3px;
  background: var(--highlighter);
}

.rule-slot:empty {
  display: none;
}

.table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  text-align: left;
  white-space: nowrap;
}

.table th:first-child,
.table td:first-child {
  padding-left: 24px;
}

.table th:last-child,
.table td:last-child {
  padding-right: 24px;
}

.table th.num,
.table td.num {
  text-align: right;
}

.table .sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  margin: 0 -6px;
  padding: 0 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-weight: inherit;
}

.table th.num .sort {
  flex-direction: row-reverse;
}

.table .sort:hover {
  background: var(--hover);
  color: var(--ink);
}

.table .sort .icon {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: transform var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}

.table th[aria-sort] {
  color: var(--ink);
}

.table th[aria-sort] .sort .icon {
  opacity: 1;
}

.table th[aria-sort='descending'] .sort .icon {
  transform: rotate(180deg);
}

.table td {
  height: 56px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--t-fast) var(--ease);
}

.table tbody tr:hover {
  background: var(--hover);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.address {
  font-size: 16px;
  font-weight: 600;
  font-stretch: 90%;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.table .sub {
  display: none;
  color: var(--muted);
  font-size: 13px;
}

.table .unknown {
  color: var(--muted);
}

.table tr.skipped .address {
  color: var(--muted);
  font-weight: 550;
}

.status-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  white-space: nowrap;
}

.status-cell::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--line-strong);
}

.status-cell[data-kind='kept']::before {
  background: var(--highlighter);
  box-shadow: 0 0 0 1.5px var(--ink);
}

.status-cell[data-kind='revisit']::before {
  background: var(--surface);
  box-shadow: 0 0 0 1.5px var(--ink);
}

.status-cell[data-kind='skipped'] {
  color: var(--muted);
  white-space: normal;
}

.status-cell[data-kind='outside'] {
  color: var(--muted);
}

.status-cell[data-kind='outside']::before {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}

.screen-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--line);
  flex: none;
}

.screen-foot .meta {
  max-width: 48ch;
}

.screen-foot .disclaimer {
  text-align: right;
}

/* The plan screens: storm area and walks */

.screen--plan {
  position: relative;
  display: none;
  background-color: var(--surface);
  background-image: radial-gradient(circle at 1px 1px, rgba(27, 31, 38, 0.07) 1px, transparent 0);
  background-size: 24px 24px;
}

body[data-screen='storm'] .screen.screen--plan[data-for],
body[data-screen='walks'] .screen.screen--plan[data-for] {
  display: grid;
  grid-template-columns: 16px var(--dock-w) minmax(0, 1fr) 16px;
  grid-template-rows: 16px minmax(0, 1fr) auto 16px;
}

.stage {
  position: relative;
  grid-column: 3 / 5;
  grid-row: 1 / 5;
  min-width: 0;
  min-height: 0;
}

.stage > #mount-map {
  position: absolute;
  inset: 0;
}

.float--left {
  grid-column: 2;
  grid-row: 2 / 4;
  min-height: 0;
  overflow: auto;
  z-index: 2;
  align-self: start;
  max-height: 100%;
  border-radius: var(--r-float);
  scrollbar-width: thin;
}

.float--right {
  display: none;
}

.float--bottom {
  grid-column: 3;
  grid-row: 3;
  justify-self: center;
  z-index: 3;
  max-width: calc(100% - 32px);
  min-width: 0;
}

.draft {
  display: none;
}

/* Floating toolbar in the reference style */

.pillbar {
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 6px;
  border-radius: var(--r-float);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.pillbar-sep {
  width: 1px;
  margin: 8px 4px;
  background: var(--line);
}

.pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 76px;
  min-height: 56px;
  padding: 6px 12px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease);
}

.pill:hover {
  background: var(--hover);
}

.pill[aria-pressed='true'] {
  background: var(--ink);
  color: var(--surface);
}

.pill:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.pill .icon {
  width: 20px;
  height: 20px;
}

.pillbar-group {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
}

.pill-count {
  display: inline-grid;
  place-items: center;
  align-self: center;
  min-width: 56px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

.keyhint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 auto 8px;
  padding: 8px 14px;
  width: max-content;
  max-width: 100%;
  border-radius: var(--r-float);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: 13px;
}

.keyhint span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}

/* Storm area panel (area.js) */

.area-panel .panel-head {
  padding-bottom: 4px;
}

.area-panel .panel-body {
  gap: 14px;
}

.area-summary {
  font-size: 15px;
  font-weight: 550;
  line-height: 21px;
}

.area-storm {
  align-self: stretch;
  padding: 10px 12px;
  border-left: 3px solid var(--highlighter);
  border-radius: 0 var(--r-control) var(--r-control) 0;
  background: var(--hover);
  font-size: 13px;
  line-height: 18px;
}



.area-homes,
.area-hint,
.area-loading,
.area-draw-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

.area-panel .area-disclaimer {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
}

.field-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.field-row .field {
  flex: 1 1 auto;
}

.field-row .btn {
  flex: none;
}

.area-paste {
  min-height: 76px;
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

/* Walks panel (turfs.js) */

.turfs .panel-body {
  gap: 10px;
}

.turfs .status {
  color: var(--ink);
  font-size: 15px;
  font-weight: 550;
}

.turfs[data-state='empty'] .status,
.turfs .status:only-child {
  color: var(--muted);
  font-weight: 450;
}

.walk-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px 8px;
}

.walk-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  text-align: left;
  transition: background var(--t-fast) var(--ease);
}

.walk-pick:hover {
  background: var(--hover);
}

.walk[data-selected='true'] .walk-pick {
  background: var(--press);
}

.walk-name {
  font-size: 15px;
  font-weight: 600;
}

.walk[data-selected='true'] .walk-name {
  padding: 0 3px;
  margin: 0 -3px;
  border-radius: 3px;
  background: var(--highlighter);
  display: inline;
}

.walk-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.walk-revisit {
  color: var(--ink);
  font-weight: 550;
}

.walk-check {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  color: transparent;
  font-size: 12px;
  font-weight: 700;
}

.walk[data-selected='true'] .walk-check {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.skip-counts {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  padding: 12px;
  border-radius: var(--r-control);
  background: var(--hover);
  font-size: 14px;
}

.skip-counts dd {
  text-align: right;
  font-weight: 600;
}

/* Stops of the selected walk: the second view of the walks stage */

.walk-view {
  display: none;
}

body[data-screen='walks'] .walk-view {
  display: inline-flex;
}

.walk-view .icon {
  width: 16px;
  height: 16px;
}

.stops {
  position: absolute;
  inset: 16px 0 16px 16px;
  z-index: 4;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-color: transparent;
  box-shadow: var(--shadow);
}

body[data-screen='walks'][data-stage='stops'] .stops {
  display: flex;
}

body[data-screen='walks'][data-stage='stops'] #mount-map {
  visibility: hidden;
}

.stops-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.stops-head h2 {
  font-size: 17px;
}

.stops-head .meta {
  margin-top: 2px;
}

.stops-body {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
}

.stops .table td {
  height: 52px;
}

.stops .table .chip {
  height: 22px;
  margin-top: 4px;
  padding: 0 8px;
  font-size: 12px;
}

.order {
  width: 72px;
  color: var(--muted);
}

.stop-n {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--hover);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
}

tbody tr:first-child .stop-n {
  background: var(--highlighter);
}

/* Loading rows */

.skeleton td {
  height: 56px;
}

.skeleton .skel {
  display: block;
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--press);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.45;
  }
}

.table-wrap .empty {
  min-height: 320px;
  align-content: center;
}

/* Pages: hand out, scoreboard, day sheet */

.screen--page {
  position: relative;
  overflow: auto;
}

.handoff {
  position: relative;
}

.page {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px;
}

.page--narrow {
  max-width: 720px;
}

.page--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.page-side {
  position: sticky;
  top: 0;
}

/* Hand out (handoff.js, manager desk) */

.handoff {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.handoff > h2 {
  display: none;
}

.handoff > .status {
  color: var(--ink);
  font-size: 15px;
  font-weight: 550;
}

.handoff > .disclaimer {
  order: 10;
}

.handoff[data-state='empty'] > .status,
.handoff[data-state='loading'] > .status:empty {
  display: none;
}

.handoff .assign-list .empty {
  padding: 40px 24px;
}

.send-card:has([data-kind='export']:empty) {
  display: none;
}

.send-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.handoff > .error:not([hidden]) {
  padding: 10px 12px;
  border-radius: var(--r-control);
  background: var(--stop-tint);
}

.handoff [data-kind='manager'] {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.desk-card {
  border: 1px solid var(--line);
  border-radius: var(--r-float);
  background: var(--surface);
  overflow: hidden;
}

.desk-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.desk-card-head h2 {
  font-size: 17px;
}

.desk-card-head .meta {
  margin-top: 2px;
}

.desk-card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
}

.desk-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--hover);
}

.desk-card-foot .meta {
  max-width: 52ch;
}

.assign {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px 96px minmax(180px, 240px);
  align-items: center;
  column-gap: 16px;
}

.assign-head {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 550;
}

.assign-row {
  min-height: 64px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  transition: background var(--t-fast) var(--ease);
}

.assign-row:last-child {
  border-bottom: 0;
}

.assign-row:hover {
  background: var(--hover);
}

.assign-row .walk-name {
  display: block;
}

.assign-row .meta {
  margin-top: 2px;
}

.assign .num {
  text-align: right;
  font-weight: 550;
}

.assign-row input {
  min-height: 40px;
}

.sheet-list {
  display: flex;
  flex-direction: column;
}

.sheet-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.sheet-item:last-child {
  border-bottom: 0;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--press);
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  text-transform: uppercase;
}

.sheet-item .who {
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.sheet-item .actions {
  justify-content: flex-end;
}

.sheet-item .linkbox {
  grid-column: 2 / -1;
}

.linkbox {
  display: flex;
  gap: 8px;
  align-items: center;
}

.linkbox input {
  min-height: 36px;
  font-size: 12px;
}

.import-grid {
  display: grid;
  gap: 12px;
}

/* Solicitor rules (rulecard.js) */

#mount-rulecard > .paper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-float);
  background: var(--surface);
}

#mount-rulecard > .paper > h2 {
  font-size: 17px;
  font-weight: 650;
  font-stretch: 100%;
}

#mount-rulecard .facts {
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
}

#mount-rulecard [data-city] {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

#mount-rulecard [data-city] > .error {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-control);
  background: #fff6cc;
  color: #4a3b00;
  font-size: 13px;
  line-height: 18px;
}

#mount-rulecard [data-city] h3 {
  font-size: 15px;
  font-weight: 650;
  font-stretch: 100%;
}

#mount-rulecard [data-city] .facts {
  color: var(--ink);
}

#mount-rulecard [data-city] ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 4px;
}

#mount-rulecard [data-city] li {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--stop-tint);
  color: var(--stop);
  font-size: 12px;
  font-weight: 550;
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

#mount-rulecard a.tap {
  display: inline-flex;
  justify-content: flex-start;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 550;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

#mount-rulecard > .paper > .facts:last-child {
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

/* Day sheet (export.js) */

.export {
  overflow: hidden;
}

.export-art {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--hover);
  color: var(--ink);
}

.export-art .icon {
  width: 26px;
  height: 26px;
}

.export-body {
  display: grid;
  justify-items: start;
  gap: 14px;
  padding: 24px;
}

.export-body h2 {
  font-size: 20px;
}

.export-status {
  font-size: 15px;
}

.export-note {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--highlighter);
  font-size: 13px;
  font-weight: 550;
}

.export-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: var(--hover);
}

/* Rep view */

.rep {
  min-height: 100dvh;
  background: var(--canvas);
}

.rep-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 16px;
  background: var(--canvas);
}

.rep-bar .mark {
  width: 28px;
  height: 28px;
}

.rep-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 560px;
  margin: 0 auto;
  padding: 4px 16px 32px;
}

.rep-empty {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 48px 24px 40px;
  border-radius: var(--r-float);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.rep-empty-art {
  width: 56px;
  height: 56px;
  padding: 12px;
  border-radius: 16px;
  background: var(--highlighter);
  color: var(--ink);
}

.rep-empty h2 {
  font-size: 20px;
}

.rep-empty p {
  max-width: 34ch;
  color: var(--muted);
}

.rep-empty .btn {
  margin-top: 8px;
}

body[data-sheet='open'] .rep-empty {
  display: none;
}

body:not([data-sheet='open']) #mount-knock {
  display: none;
}

/* The handoff section inside the rep view */

.rep .handoff[data-mode='manager'] {
  display: none;
}

.rep .handoff {
  gap: 12px;
}

.rep .handoff > .status {
  display: none;
}

.rep .handoff [data-kind='rep'] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rep .paper {
  border-radius: var(--r-float);
  background: var(--surface);
  box-shadow: var(--shadow-low);
  overflow: hidden;
  counter-reset: stop;
}

.rep .paper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.rep .paper-head h2 {
  font-size: 15px;
}

.rep .paper .stop {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 2px 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  counter-increment: stop;
}

.rep .paper .stop:last-child {
  border-bottom: 0;
}

.rep .paper .stop::before {
  content: counter(stop);
  grid-row: 1 / 3;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  background: var(--hover);
  font-size: 12px;
  font-weight: 650;
}

.rep .paper .address {
  font-size: 16px !important;
}

.rep .paper .facts {
  color: var(--muted);
  font-size: 13px;
}

.rep [data-kind='send-log'] {
  display: none;
}

.rep [data-kind='export-note'] {
  color: var(--muted);
  font-size: 13px;
}

.rep [data-kind='export'] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rep [data-kind='export']:empty {
  display: none;
}

.rep .back-desk {
  display: none;
}

.rep .handoff > .disclaimer {
  display: none;
}

/* Phone and narrow screens */

@media (max-width: 1180px) {
  .page--split {
    grid-template-columns: minmax(0, 1fr);
  }
  .page-side {
    position: static;
  }
}

@media (max-width: 960px) {
  :root {
    --dock-w: 320px;
  }
  .assign {
    grid-template-columns: minmax(0, 1fr) 72px minmax(140px, 200px);
  }
  .assign .col-length {
    display: none;
  }
}

@media (max-width: 760px) {
  body,
  body[data-nav='collapsed'] {
    display: block;
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .nav {
    position: fixed;
    inset: auto 8px calc(8px + env(safe-area-inset-bottom)) 8px;
    z-index: 20;
    height: auto;
    padding: 6px;
    border-radius: var(--r-float);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .nav-head,
  .nav-foot,
  .nav-rule {
    display: none;
  }

  .nav-list {
    flex-direction: row;
    justify-content: space-between;
    gap: 2px;
  }

  .nav-list li {
    flex: 1 1 0;
    min-width: 0;
  }

  .nav-item,
  body[data-nav='collapsed'] .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    height: 56px;
    padding: 0 2px;
    font-size: 11px;
    font-weight: 550;
    text-align: center;
  }

  .nav-item span,
  body[data-nav='collapsed'] .nav-item span {
    display: none;
  }

  .nav-item::after {
    content: attr(data-short);
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-item[aria-current='page'] {
    background: var(--ink);
    color: var(--surface);
  }

  .nav-item[aria-current='page'] .icon {
    color: var(--surface);
  }

  .main {
    height: auto;
    min-height: calc(100dvh - 76px);
    padding: 0;
  }

  .frame {
    height: auto;
    min-height: calc(100dvh - 84px);
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .bar {
    flex-wrap: wrap;
    gap: 10px;
    min-height: 0;
    padding: 12px 16px;
    background: var(--surface);
  }

  .bar-title {
    flex: 1 1 100%;
  }

  .bar h1 {
    font-size: 22px;
    line-height: 28px;
  }

  .bar .meta {
    white-space: normal;
  }

  .bar-tools {
    flex: 1 1 100%;
    flex-wrap: wrap;
  }

  .picker {
    max-width: 100%;
    flex: 1 1 auto;
  }

  .walk-view {
    order: 2;
  }

  .alert {
    margin: 12px 16px 0;
  }

  .toolbar-row {
    padding: 12px 16px;
  }

  .filters {
    width: 100%;
  }

  .filters button {
    flex: 1 1 auto;
    justify-content: center;
    padding: 0 8px;
  }

  .table-wrap {
    overflow: visible;
  }

  .table .col-city,
  .table .col-year,
  .table .col-roof {
    display: none;
  }

  .table .sub {
    display: block;
  }

  .table th {
    top: 0;
  }

  .table th:first-child,
  .table td:first-child {
    padding-left: 16px;
  }

  .table th:last-child,
  .table td:last-child {
    padding-right: 16px;
  }

  .table td {
    height: 64px;
  }

  .status-cell {
    white-space: normal;
  }

  .screen-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px 16px 20px;
  }

  .screen-foot .disclaimer {
    text-align: left;
  }

  body[data-screen='storm'] .screen.screen--plan[data-for],
  body[data-screen='walks'] .screen.screen--plan[data-for] {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
  }

  .stage {
    order: 2;
    height: 62vh;
    min-height: 320px;
  }

  .float--left {
    order: 1;
    max-height: none;
    overflow: visible;
  }

  .float--bottom {
    order: 3;
    max-width: 100%;
    width: 100%;
  }

  .float .card,
  .float .panel,
  .float .map-card {
    box-shadow: var(--shadow-low);
  }

  .pillbar {
    justify-content: space-between;
    overflow-x: auto;
  }

  .pill {
    min-width: 0;
    flex: 1 1 0;
    padding: 6px 4px;
    font-size: 12px;
    line-height: 14px;
    white-space: normal;
    text-align: center;
  }

  .pillbar-group {
    flex: 3 1 auto;
  }

  .pill-count {
    min-width: 0;
    padding: 0 6px;
    font-size: 12px;
  }

  .keyhint {
    display: none;
  }

  .stops {
    position: static;
    order: 4;
  }

  body[data-screen='walks'][data-stage='stops'] .stage {
    height: auto;
    min-height: 0;
  }

  body[data-screen='walks'][data-stage='stops'] #mount-map {
    display: none;
  }

  .page {
    padding: 16px;
  }

  .assign {
    grid-template-columns: minmax(0, 1fr) 64px;
    row-gap: 10px;
  }

  .assign-head {
    display: none;
  }

  .assign-row input {
    grid-column: 1 / -1;
    min-height: 48px;
  }

  .assign .col-revisit {
    display: none;
  }

  .sheet-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .sheet-item .actions {
    grid-column: 1 / -1;
    justify-content: stretch;
  }

  .sheet-item .actions > * {
    flex: 1 1 auto;
  }

  .desk-card-foot .btn {
    width: 100%;
  }

  .btn,
  .tap:where(button, a) {
    min-height: 44px;
  }
}

@media (pointer: coarse) {
  .btn,
  .tap:where(button, a) {
    min-height: 48px;
  }
  .btn--small {
    min-height: 40px;
  }
}

/* More rows in a long door file */

.table tr.more-row td {
  height: 64px;
  text-align: center;
}

.table tr.more-row:hover {
  background: transparent;
}

.more-row .meta {
  margin-right: 12px;
}

/* Reserve the space that fills in when the door file arrives, so nothing jumps */

.filters {
  min-height: 38px;
}

.filters:empty {
  min-width: 240px;
}

#territory-meta {
  min-height: 16px;
}

@media (max-width: 760px) {
  #territory-meta {
    min-height: 32px;
  }

  .filters:empty {
    min-width: 100%;
  }
}

/* Rep: what each door on the walk got */

.rep .paper .stop {
  position: relative;
}

.rep .paper .stop[data-outcome] .address {
  color: var(--muted);
}

.rep .paper .stop[data-outcome]::before {
  content: '\2713';
  background: var(--ink);
  color: var(--surface);
}

.rep .paper .stop[data-next='true']::before {
  background: var(--highlighter);
}

.stop-tag {
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--hover);
  font-size: 12px;
  font-weight: 600;
}

.stop[data-next='true'] .stop-tag {
  background: var(--highlighter);
}

.stop[data-outcome='inspection_booked'] .stop-tag {
  background: var(--go-tint);
  color: var(--go);
}

.stop[data-outcome='do_not_knock'] .stop-tag {
  background: var(--stop-tint);
  color: var(--stop);
}

.rep .paper .stop .address,
.rep .paper .stop .facts {
  padding-right: 96px;
}

.rep [data-kind='log-link'] {
  display: none;
}

/* Toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 10px 10px 16px;
  border-radius: var(--r-float);
  background: var(--ink);
  color: var(--surface);
  box-shadow: var(--shadow);
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 500;
}

.toast {
  width: max-content;
}

.toast p {
  flex: 1 1 220px;
  min-width: 0;
}

.toast .btn {
  border-color: rgba(255, 255, 255, 0.25);
  background: transparent;
  color: var(--surface);
}

.toast .btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.toast-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--surface);
}

.toast-close .icon {
  width: 16px;
  height: 16px;
}

input[aria-invalid='true'] {
  border-color: var(--stop);
  box-shadow: 0 0 0 3px var(--stop-tint);
}

/* Solicitor rules: sources as plain links */

#mount-rulecard a.tap {
  min-height: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

#mount-rulecard a.tap:hover {
  background: none;
  text-decoration-color: var(--ink);
}

@media (max-width: 760px) {
  .toast {
    width: calc(100vw - 32px);
    flex-wrap: wrap;
    bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .stage {
    height: auto;
    min-height: 0;
    aspect-ratio: 4 / 3.25;
  }
}

.net-chip {
  margin-left: auto;
  background: var(--ink);
  color: var(--surface);
}

@media (max-width: 420px) {
  .net-chip {
    position: fixed;
    left: 50%;
    top: 64px;
    z-index: 6;
    transform: translateX(-50%);
  }
}

/* Solicitor rules: the essentials first, the rest on demand */

.rule-more {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rule-more > summary {
  align-self: flex-start;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: var(--r-control);
  background: var(--hover);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.rule-more > summary::-webkit-details-marker {
  display: none;
}

.rule-more > summary::after {
  content: ' +';
}

.rule-more[open] > summary::after {
  content: ' \2212';
}

.rule-more[open] {
  gap: 8px;
}

.screen--page #mount-rulecard > .paper > .facts:last-child {
  display: none;
}

/* Rep sheet opened from a texted link: no desk switch */

body[data-from-link='true'] .rep-bar .role {
  display: none;
}

@media (max-width: 760px) {
  body[data-screen='walks'] .float--left {
    max-height: 46vh;
    overflow: auto;
  }

  body[data-screen='walks'][data-stage='stops'] .stage {
    aspect-ratio: auto;
    height: auto;
  }

  /* Scoreboard rows become cards */
  .board-table-wrap {
    border: 0;
    background: transparent;
    overflow: visible;
  }

  .board-table,
  .board-table tbody,
  .board-table tr,
  .board-table td {
    display: block;
  }

  .board-table thead {
    display: none;
  }

  .board-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2px 12px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-float);
    background: var(--surface);
  }

  .board-table tr.totals td {
    background: none;
  }

  .board-table tr.totals {
    background: var(--hover);
  }

  .board-table td {
    height: auto;
    padding: 4px 0 !important;
    border: 0;
    text-align: left !important;
    font-weight: 650;
  }

  .board-table td.board-rep {
    grid-column: 1 / -1;
    min-width: 0;
    padding-bottom: 6px !important;
  }

  .board-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 550;
  }
}

/* Door table columns keep their width across filters */

#doors {
  table-layout: fixed;
}

#doors th[data-sort='address'] { width: 36%; }
#doors th.col-city { width: 16%; }
#doors th.col-year { width: 10%; }
#doors th.col-roof { width: 17%; }
#doors th.col-status { width: 21%; }

@media (max-width: 760px) {
  #doors th[data-sort='address'] { width: 62%; }
  #doors th.col-status { width: 38%; }
}

/* Solicitor rules: each warning sits under its city */

#mount-rulecard [data-city] > h3 {
  order: 1;
}

#mount-rulecard [data-city] > .error {
  order: 2;
}

#mount-rulecard [data-city] > :not(h3):not(.error) {
  order: 3;
}

#mount-rulecard [data-city=''] > .error {
  display: block;
}

#mount-rulecard [data-city=''] > .error::before {
  content: 'Doors with no city on file. ';
  font-weight: 650;
}

/* Toast close */

.toast-close {
  width: auto;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
}

/* Phone tab labels wrap rather than clip */

@media (max-width: 760px) {
  .nav-item::after {
    white-space: normal;
    line-height: 12px;
    text-align: center;
  }

  body[data-screen='walks'] .stage {
    order: 0;
  }

  body[data-screen='walks'] .float--left {
    max-height: none;
    overflow: visible;
  }

  .map-plan {
    --label-boost: 2.2;
  }

  .map-card {
    bottom: 64px !important;
    right: 12px !important;
  }
}

/* One message per refusal */

.handoff[data-state='error'] > .status {
  display: none;
}

/* Side panels read as floating cards on the plan */

.float--left {
  padding: 4px 10px 18px;
  margin: -4px -10px 0;
}

.float .panel {
  border-color: var(--line);
}

/* The toast sits clear of the work it reports on */

@media (min-width: 761px) {
  .toast {
    left: auto;
    right: 28px;
    top: 84px;
    bottom: auto;
    transform: none;
  }
}

/* The rep has sent: Send log steps back */

.rep:has(.send-card [data-kind='export']:not(:empty)) .knock .knock-send {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  min-height: 48px;
}

/* Day sheet preview */

.export-preview {
  width: 100%;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}

.export-preview .table td {
  height: 44px;
}

.export-preview .table th:first-child,
.export-preview .table td:first-child {
  padding-left: 14px;
}

.export-preview .table th:last-child,
.export-preview .table td:last-child {
  padding-right: 14px;
}

.page--narrow {
  max-width: 880px;
}

/* Solicitor rules: label and value on one line */

#mount-rulecard .rule-line b {
  color: var(--muted);
  font-weight: 550;
}

#mount-rulecard .rule-sources > summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

@media (max-width: 760px) {
  body[data-screen='storm'] .stage {
    order: 0;
  }

  body[data-screen='storm'] .float--bottom {
    order: 1;
  }

  body[data-screen='storm'] .float--left {
    order: 2;
  }
}

/* Shop rule: a floating card off the doors toolbar */

.rule-pop {
  position: relative;
}

.rule-pop > summary {
  list-style: none;
  cursor: pointer;
}

.rule-pop > summary::-webkit-details-marker {
  display: none;
}

.rule-pop[open] > summary {
  border-color: var(--ink);
}

.rule-card {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: min(70vh, 640px);
  overflow: auto;
  box-sizing: border-box;
  padding: 16px;
  border-radius: var(--r-float);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.rule-card .screen-panel > h2,
.rule-card #screen-counts,
.rule-card .screen-disclaimer {
  display: none;
}

.rule-card form {
  display: grid;
  gap: 12px;
}

.rule-card fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.rule-card legend {
  padding: 0 0 8px;
  font-size: 13px;
  font-weight: 550;
}

.rule-card .screen-materials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.rule-card .screen-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font-size: 14px;
  font-weight: 450;
  white-space: normal;
  text-align: left;
  cursor: pointer;
}

.rule-card .screen-check:has(input:checked) {
  border-color: var(--ink);
  background: var(--hover);
}

.rule-card .screen-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--ink);
}

.rule-card .screen-years,
.rule-card .screen-cooloff {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 550;
}

.rule-card .screen-years label,
.rule-card .screen-cooloff label {
  flex: 1 1 auto;
}

.rule-card #screen-years,
.rule-card #screen-cooloff {
  width: 80px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  font: inherit;
  font-size: 15px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rule-card .screen-hint,
.rule-card .screen-uses {
  margin: -6px 0 0;
  font-size: 12px;
  line-height: 16px;
  color: var(--muted);
}

.rule-card .screen-error {
  margin: 0 0 8px;
  color: var(--stop);
  font-size: 13px;
}

.rule-card #screen-status:empty {
  display: none;
}

.rule-card #screen-action {
  justify-self: end;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

@media (max-width: 760px) {
  .rule-card {
    position: fixed;
    top: auto;
    right: 16px;
    left: 16px;
    bottom: 88px;
    width: auto;
  }
}

.rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rule-head h2 {
  margin: 0;
  font-size: 17px;
  line-height: 22px;
  font-weight: 650;
}

.rule-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.rule-close:hover {
  background: var(--hover);
}

.rule-lede {
  margin: 2px 0 14px;
  font-size: 13px;
  color: var(--muted);
}

.rule-card #screen-uses {
  display: none;
}

@media (max-width: 760px) {
  .rule-pop[open]::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(27, 31, 38, 0.32);
  }

  .rule-card {
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 82vh;
    border-radius: var(--r-float) var(--r-float) 0 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 60;
  }
}

/* Undo and Close appear once there is a corner to act on */
.area-undo:disabled,
.area-close:disabled {
  display: none;
}

/* Once sheets exist, the next step is sending each rep their link */
.sheet-item [data-kind='copy'] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.page-main:has(.sheet-item) .desk-card-head .btn--primary:not(:disabled) {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

/* The link is copied or shared, never read; keep it for Copy without showing it */
.sheet-item .linkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.board-doubt.chip--stop {
  background: #fff6cc;
  color: #4a3b00;
}

/* Apply rule stays in reach while the card scrolls */
.rule-card #screen-action {
  position: sticky;
  bottom: 0;
  box-shadow: 0 -12px 12px -4px var(--surface);
}

.board-figure {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.board-unit {
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
}

.rule-card {
  max-height: min(calc(100vh - 140px), 760px);
}

.rule-card #screen-action {
  box-shadow: 0 0 0 10px var(--surface), 0 -14px 10px 0 var(--surface);
}

.desk-restore > summary {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  list-style-position: inside;
}

.desk-restore:not([open]) {
  background: var(--surface);
}

.save-alert {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--stop-tint);
  color: var(--stop);
  font-size: 14px;
  font-weight: 550;
}
