/* Shifty. The look follows Apple's Human Interface Guidelines: system type,
   semantic colours that adapt to light and dark, grouped lists, sheets, a
   sidebar on wide screens and a tab bar on narrow ones. Content first, chrome
   quiet. */

:root {
  color-scheme: light dark;

  --bg: #f2f2f7;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --label: #000000;
  /* 0.78 keeps grey text at 5:1 or better on the page, the sidebar, white and
     the grey tiles of the plan. WCAG AA asks for 4.5:1. */
  --secondary: rgba(60, 60, 67, 0.78);
  --tertiary: rgba(60, 60, 67, 0.36);
  --separator: rgba(60, 60, 67, 0.22);
  --fill: rgba(120, 120, 128, 0.14);
  --fill-strong: rgba(120, 120, 128, 0.24);
  --tint: #2f55d4;
  --tint-soft: rgba(47, 85, 212, 0.12);
  --on-tint: #ffffff;
  --red: #c4271b;
  --red-soft: rgba(215, 0, 21, 0.1);
  --orange: #a84a00;
  --orange-soft: rgba(255, 149, 0, 0.16);
  --green: #34c759;
  --material: rgba(246, 246, 250, 0.82);
  --scrim: rgba(0, 0, 0, 0.32);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.18);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --control: 36px;
  --side: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-raised: #2c2c2e;
    --label: #ffffff;
    --secondary: rgba(235, 235, 245, 0.66);
    --tertiary: rgba(235, 235, 245, 0.34);
    --separator: rgba(84, 84, 88, 0.7);
    --fill: rgba(120, 120, 128, 0.26);
    --fill-strong: rgba(120, 120, 128, 0.4);
    --tint: #8ea2ff;
    --tint-soft: rgba(142, 162, 255, 0.2);
    --on-tint: #0a0f2e;
    --red: #ff6f66;
    --red-soft: rgba(255, 69, 58, 0.2);
    --orange: #ffb04a;
    --orange-soft: rgba(255, 159, 10, 0.2);
    --green: #30d158;
    --material: rgba(28, 28, 30, 0.8);
    --scrim: rgba(0, 0, 0, 0.55);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}

@media (pointer: coarse) {
  :root {
    --control: 44px;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 1.0625rem/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: default;
  opacity: 0.38;
}

a {
  color: var(--tint);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--tint) 60%, transparent);
  outline-offset: 2px;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
}

.tint {
  color: var(--tint);
}

.secondary {
  color: var(--secondary);
}

.footnote {
  font-size: 0.8125rem;
  line-height: 1.38;
  color: var(--secondary);
}

.noscript {
  padding: 2rem;
}

/* ── Shell: sidebar, toolbar, content, tab bar ─────────────────────────── */

.shell {
  display: grid;
  grid-template-columns: 17rem minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 0.75rem 1rem;
  background: var(--material);
  border-right: 1px solid var(--separator);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.marmot {
  width: 2rem;
  height: 2rem;
  flex: none;
}

.steps {
  display: grid;
  gap: 2px;
}

.step {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0.6rem;
  border-radius: 9px;
  text-align: left;
}

.step .icon {
  color: var(--tint);
}

.step:hover {
  background: var(--fill);
}

.step.current {
  background: var(--tint);
  color: var(--on-tint);
}

.step.current .icon,
.step.current .step-status {
  color: inherit;
}

.step.current .step-status {
  opacity: 0.86;
}

.step-text {
  display: grid;
  min-width: 0;
}

.step-title {
  font-weight: 600;
}

.step-status {
  font-size: 0.8125rem;
  color: var(--secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-foot {
  margin-top: auto;
  padding: 0 0.5rem;
  display: grid;
  gap: 0.5rem;
}

.save-state {
  font-size: 0.8125rem;
  color: var(--secondary);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.8125rem;
}

.links {
  align-items: center;
}

/* The one spot of colour outside the tint: coffee is yellow everywhere. */
.link-coffee {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0 0.8rem 0 0.65rem;
  border-radius: 999px;
  background: #ffdd00;
  color: #1c1c1e;
  font-weight: 600;
}

.link-coffee:hover {
  text-decoration: none;
  background: #f5d400;
}

.link-coffee .icon {
  width: 1.05rem;
  height: 1.05rem;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.toolbar h1 {
  flex: 1;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.toolbar-actions .button {
  margin-left: 0.35rem;
}

.content {
  width: 100%;
  max-width: 46rem;
  padding: 0.5rem clamp(1rem, 4vw, 2rem) 4rem;
}

.content:has(.roster-controls) {
  max-width: none;
}

.tabbar {
  display: none;
}

/* ── Controls ──────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--control);
  padding: 0 0.95rem;
  border-radius: 10px;
  background: var(--tint);
  color: var(--on-tint);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
}

.button .icon {
  width: 1.1rem;
  height: 1.1rem;
}

.button.gray {
  background: var(--fill);
  color: var(--tint);
}

.button.plain {
  background: none;
  color: var(--tint);
  font-weight: 400;
  font-size: 1.0625rem;
  padding: 0 0.5rem;
}

.button.plain.strong {
  font-weight: 600;
}

.button.destructive,
.icon-button.destructive {
  color: var(--red);
}

.button:not(:disabled):active,
.icon-button:not(:disabled):active {
  opacity: 0.6;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: var(--control);
  height: var(--control);
  flex: none;
  border-radius: 9px;
  color: var(--tint);
}

.icon-button:not(:disabled):hover {
  background: var(--fill);
}

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.stepper output {
  min-width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--secondary);
  white-space: nowrap;
}

.stepper button {
  width: calc(var(--control) + 6px);
  height: calc(var(--control) - 4px);
  background: var(--fill);
  font-size: 1.25rem;
  line-height: 1;
}

.stepper button:first-of-type {
  border-radius: 8px 0 0 8px;
  order: 2;
  margin-right: -0.55rem;
}

.stepper button:last-of-type {
  border-radius: 0 8px 8px 0;
  order: 3;
  border-left: 1px solid var(--separator);
}

.switch {
  flex: none;
  width: 51px;
  height: 31px;
  padding: 2px;
  border-radius: 999px;
  background: var(--fill-strong);
  transition: background-color 0.2s;
}

.switch span {
  display: block;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}

.switch[aria-checked="true"] {
  background: var(--green);
}

.switch[aria-checked="true"] span {
  transform: translateX(20px);
}

/* A row with more choices than the screen is wide scrolls inside itself,
   without a bar: the page must never become wider than the screen. */
.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--fill);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented button {
  flex: none;
}

.segmented button {
  min-height: calc(var(--control) - 6px);
  padding: 0 0.85rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

.segmented button.on {
  background: var(--surface-raised);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14);
  font-weight: 600;
}

.days {
  width: 100%;
  max-width: 21rem;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.day {
  aspect-ratio: 1;
  max-width: 2.75rem;
  width: 100%;
  border-radius: 50%;
  background: var(--fill);
  font-size: 0.9375rem;
  font-weight: 500;
}

.day.on {
  background: var(--tint);
  color: var(--on-tint);
  font-weight: 600;
}

/* ── Grouped lists ─────────────────────────────────────────────────────── */

.group {
  margin-top: 1.6rem;
}

.group > h2 {
  margin: 0 var(--side) 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--secondary);
}

.group > .footnote {
  margin: 0.45rem var(--side) 0;
}

.rows {
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.row {
  position: relative;
  width: 100%;
  min-height: 2.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem var(--side);
  text-align: left;
}

.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--side);
  right: 0;
  height: 1px;
  background: var(--separator);
  transform: scaleY(0.5);
  transform-origin: top;
}

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

.row-button > .icon:last-child {
  width: 0.9rem;
  height: 0.9rem;
  color: var(--tertiary);
}

.row-icon {
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
  border-radius: 7px;
}

.row-icon.tint {
  background: var(--tint);
  color: var(--on-tint);
}

.row-icon .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.row-text {
  flex: 1;
  min-width: 0;
  display: grid;
}

.row-text strong {
  font-weight: 500;
}

.row-text small {
  font-size: 0.8125rem;
  color: var(--secondary);
}

.row-value {
  font-size: 0.9375rem;
  color: var(--secondary);
  text-align: right;
}

.field > label,
.field > span:first-child {
  flex: 0 1 auto;
}

.field > input,
.field > select {
  flex: 1 1 8rem;
  min-width: 0;
  min-height: 2rem;
  border: 0;
  background: none;
  text-align: right;
  color: var(--label);
}

.field > input:first-child {
  text-align: left;
}

.field > input::placeholder {
  color: var(--tertiary);
}

.field > input:focus-visible,
.field > select:focus-visible {
  outline: none;
}

.field:focus-within {
  box-shadow: inset 3px 0 0 var(--tint);
}

.field > select {
  appearance: none;
  color: var(--tint);
  text-align-last: right;
}

.field > .stepper,
.field > .switch {
  margin-left: auto;
}

.unfit small {
  color: var(--orange);
}

.always {
  margin: 0 var(--side);
  display: grid;
  gap: 0.3rem;
  color: var(--secondary);
  font-size: 0.9375rem;
  list-style: disc;
  padding-left: 1.1rem;
}

/* ── Messages ──────────────────────────────────────────────────────────── */

.banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.5rem 0 0;
  padding: 0.7rem 0.6rem 0.7rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
}

.banner p {
  flex: 1;
  padding-top: 0.05rem;
}

.banner .icon-button {
  margin: -0.4rem -0.2rem;
  color: inherit;
}

.banner.error {
  background: var(--red-soft);
  color: var(--red);
}

.banner.warning {
  background: var(--orange-soft);
  color: var(--orange);
}

.issues {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.issue {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  font-size: 0.9375rem;
  color: var(--orange);
}

.issue.error {
  color: var(--red);
}

.issue .icon {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.1rem;
}

.empty {
  max-width: 26rem;
  margin: clamp(2rem, 12vh, 7rem) auto 0;
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  text-align: center;
}

.empty .marmot {
  width: 4.5rem;
  height: 4.5rem;
}

/* The pack is wider than tall; its height sets the size. */
.empty .marmot-pack {
  width: auto;
  height: 5rem;
}

.empty h2 {
  font-size: 1.375rem;
  font-weight: 700;
}

.empty p {
  color: var(--secondary);
}

.empty .button,
.empty .button-row {
  margin-top: 0.6rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.spacer {
  flex: 1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.next {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
}

.next .icon {
  width: 0.9rem;
  height: 0.9rem;
}

/* ── Welcome ───────────────────────────────────────────────────────────── */

.welcome {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem var(--side);
}

.welcome-card {
  width: 100%;
  max-width: 27rem;
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  text-align: center;
}

.welcome-card .marmot {
  width: auto;
  height: 6.5rem;
}

.welcome-card h1 {
  font-size: 2.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lead {
  color: var(--secondary);
  max-width: 24rem;
}

.welcome-card .rows,
.welcome-card .banner {
  width: 100%;
  margin-top: 0.6rem;
}

.welcome-card .row {
  min-height: 3.75rem;
}

.welcome-card .links {
  justify-content: center;
  margin-top: 0.4rem;
}

/* ── Roster ────────────────────────────────────────────────────────────── */

.roster-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
}

.roster-controls > * {
  min-width: 0;
}

/* The weeks of a long plan: the months, and under them the weeks of the
   month that is shown. */
.week-nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  max-width: 100%;
}

.print-title {
  display: none;
}

.board {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.board-day {
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.7rem var(--side) 0.2rem;
}

.board-day h3 {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--secondary);
}

.weekday {
  font-weight: 700;
  color: var(--label);
}

.closed {
  padding: 0.6rem 0 0.7rem;
  color: var(--tertiary);
  font-size: 0.9375rem;
}

.board-shift {
  display: grid;
  grid-template-columns: minmax(0, 9.5rem) minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: start;
  padding: 0.6rem 0;
}

.board-shift + .board-shift {
  border-top: 1px solid color-mix(in srgb, var(--separator) 55%, transparent);
}

.shift-name {
  font-weight: 600;
  font-size: 0.9375rem;
  grid-column: 1;
}

.shift-time {
  grid-column: 1;
  font-size: 0.8125rem;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

.places {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.place {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: calc(var(--control) - 4px);
  max-width: 100%;
  padding: 0 0.65rem;
  border-radius: 8px;
  background: var(--fill);
  font-size: 0.9375rem;
}

/* The name takes the room, so that the signs after it stand together. */
.place span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place:hover {
  background: var(--fill-strong);
}

.place .icon {
  width: 0.85rem;
  height: 0.85rem;
  color: var(--secondary);
}

.place.open {
  background: var(--orange-soft);
  color: var(--orange);
  font-weight: 600;
}

.place.broken {
  background: var(--red-soft);
  color: var(--red);
}

.place.broken .icon {
  color: inherit;
}

/* Room for one more person in a shift that has the people it needs: a quiet
   plus after the names. */
.place.more {
  min-width: 2.25rem;
  justify-content: center;
  padding: 0 0.5rem;
  border: 1px dashed var(--tertiary);
  background: none;
  color: var(--secondary);
}

.place.more:hover {
  background: var(--fill);
}

.place.more .icon {
  color: inherit;
}

.roster-note,
.team-note {
  margin-top: 1rem;
  max-width: 40rem;
}

.table-scroll {
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface);
}

/* While more of the table lies to the right, the page script marks the frame
   and its edge carries a shadow. Screens that hide their scroll bars give no
   other hint that Saturday and Sunday are there. */
.table-frame {
  position: relative;
  margin-top: 1rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.table-frame::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 2.5rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  background: linear-gradient(to right, transparent, color-mix(in srgb, var(--label) 22%, transparent));
}

.table-frame[data-more]::after {
  opacity: 1;
}

/* Cells keep their own lines (no collapsing): the line under a sticky cell
   would otherwise drop out at some scroll positions. Seven days of equal
   width: on a laptop the whole week is in view, and a long shift name takes a
   second line instead of pushing Sunday off the page. */
.people-table {
  width: 100%;
  min-width: 58.5rem;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9375rem;
}

.people-table th:first-child {
  width: 11rem;
}

/* On a phone the names take less of the screen, and the days keep a width in
   which a shift's name and time can be read. */
@media (max-width: 54rem) {
  .people-table {
    min-width: 54rem;
  }

  .people-table th:first-child {
    width: 9.75rem;
  }
}

/* Whole pixels for every height in the table. With fractions, the lines under
   the sticky name column end up a pixel away from the lines beside them. */
.people-table th,
.people-table td {
  padding: 0.5rem 0.7rem;
  line-height: 1.25rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, var(--separator) 60%, transparent);
}

.people-table thead th {
  white-space: nowrap;
}

.people-table tbody tr:last-child > * {
  border-bottom: 0;
}

.people-table thead th {
  font-weight: 400;
  color: var(--secondary);
}

/* The names stay in place while the days scroll. A fine line on their right
   edge shows that the days pass underneath them. */
.people-table tbody th,
.people-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 color-mix(in srgb, var(--separator) 60%, transparent);
  font-weight: 600;
}

.people-table tbody th span,
.people-table tbody th small {
  display: block;
}

.people-table tbody th small {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 400;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

/* Hours over the target, or clearly under it: said in words with an arrow,
   and in colour. */
.people-table tbody th small.off-target {
  color: var(--orange);
  font-weight: 600;
}

/* How far ahead or behind somebody is over the weeks: quieter than the week
   itself, which stands above it. */
.people-table tbody th small.balance {
  font-style: italic;
}

/* ── A month at a glance ───────────────────────────────────────────────── */

/* A row per person and a narrow column per day. On a laptop the whole month
   is in view; on a phone the days keep a width a finger can hit and the
   table scrolls inside its frame. */
.month-table {
  width: 100%;
  min-width: 56rem;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8125rem;
}

@media (pointer: coarse) {
  .month-table {
    min-width: 76rem;
  }
}

.month-table th:first-child {
  width: 8rem;
}

.month-table th,
.month-table td {
  padding: 0.3rem 0;
  text-align: center;
  vertical-align: middle;
  border-bottom: 1px solid color-mix(in srgb, var(--separator) 60%, transparent);
}

.month-table tbody tr:last-child > * {
  border-bottom: 0;
}

.month-table thead th {
  font-weight: 400;
  color: var(--secondary);
}

.month-table tbody th,
.month-table thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  padding: 0.3rem 0.7rem;
  background: var(--surface);
  box-shadow: 1px 0 0 color-mix(in srgb, var(--separator) 60%, transparent);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Weekends carry a light band, so that the weeks can be told apart, and a
   fine line marks each Monday. A day on which the business is closed is
   darker. */
.month-table .weekend {
  background: color-mix(in srgb, var(--fill) 55%, transparent);
}

.month-table .week-start {
  border-left: 1px solid color-mix(in srgb, var(--separator) 60%, transparent);
}

.month-table .shut {
  background: var(--fill);
}

.month-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0.1rem 0;
  border-radius: 6px;
  line-height: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.month-day small {
  font-size: 0.6875rem;
}

.month-day span {
  font-weight: 600;
  color: var(--label);
}

.month-table .weekend .month-day span {
  color: var(--secondary);
}

.month-day:hover {
  background: var(--fill);
}

/* A duty: the short name of its shift. */
.code {
  display: block;
  min-width: 1.5rem;
  max-width: calc(100% - 4px);
  margin: 0 auto;
  padding: 0 0.15rem;
  border-radius: 5px;
  background: var(--fill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5rem;
  overflow: hidden;
  white-space: nowrap;
}

.code + .code {
  margin-top: 2px;
}

.code:hover {
  background: color-mix(in srgb, var(--tint) 18%, var(--fill));
}

.code.pinned {
  box-shadow: inset 0 -2px 0 var(--tint);
}

.code.broken,
.code.open {
  background: color-mix(in srgb, var(--orange) 16%, transparent);
  color: var(--orange);
}

.month-table .away {
  color: var(--secondary);
}

.month-legend {
  margin-top: 0.8rem;
}

.month-legend span {
  display: inline-block;
  margin-right: 1.1rem;
  white-space: nowrap;
}

/* A duty in the table by person is the same control as a place in the view
   by day: a tap opens the sheet that says who can take it over. */
.duty {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  min-height: var(--control);
  padding: 0.25rem 0.5rem;
  border-radius: 8px;
  background: var(--fill);
  text-align: left;
}

/* The controls bring their own inset, so the cells around them need less. */
.people-table td {
  padding-left: 0.3rem;
  padding-right: 0.3rem;
}

.duty + .duty {
  margin-top: 0.375rem;
}

.duty:hover {
  background: var(--fill-strong);
}

.duty-text {
  display: grid;
}

.duty-text {
  flex: 1;
  min-width: 0;
}

.duty strong {
  font-weight: 500;
  overflow-wrap: break-word;
  hyphens: auto;
}

.duty strong .icon {
  display: inline-block;
  margin-left: 0.3rem;
  vertical-align: -0.05rem;
}

.duty small {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

.duty small.short {
  color: var(--orange);
}

.duty .icon {
  flex: none;
  width: 0.85rem;
  height: 0.85rem;
  color: var(--secondary);
}

.duty.broken {
  background: var(--red-soft);
  color: var(--red);
}

.duty.broken small,
.duty.broken .icon {
  color: inherit;
}

/* What nobody has yet: the first row of the table, and a number on each week
   that still has such places. */
.duty.open {
  background: var(--orange-soft);
  color: var(--orange);
}

.duty.open strong {
  font-weight: 600;
}

.duty.open small {
  color: inherit;
}

.duty .times {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Room for more, in the table by person: a last row of quiet controls. The
   border takes its pixel from the padding, so the rows keep their height. */
.duty.more {
  padding: calc(0.25rem - 1px) calc(0.5rem - 1px);
  border: 1px dashed var(--tertiary);
  background: none;
  color: var(--secondary);
}

.duty.more:hover {
  background: var(--fill);
}

.duty.more strong,
.duty.more .times {
  font-weight: 400;
}

.people-table .more-row th span {
  color: var(--secondary);
  font-weight: 500;
}

/* Room in a person's day: they could take one more shift here without
   breaking a rule. The same quiet plus as in the view by day; in the colour
   of open places when it would fill one. */
.duty-add {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--control);
  height: var(--control);
  border: 1px dashed var(--tertiary);
  border-radius: 8px;
  color: var(--secondary);
}

.duty + .duty-add {
  margin-top: 0.375rem;
}

.duty-add:hover {
  background: var(--fill);
}

.duty-add .icon {
  width: 0.85rem;
  height: 0.85rem;
}

.duty-add.open {
  border-color: var(--orange);
  color: var(--orange);
}

.duty-add.open:hover {
  background: var(--orange-soft);
}

.people-table .open-row th span {
  color: var(--orange);
}

.segmented .open-count {
  display: inline-block;
  min-width: 1.2rem;
  margin-left: 0.4rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── Sheets ────────────────────────────────────────────────────────────── */

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  animation: fade 0.2s ease-out;
}

.sheet {
  position: absolute;
  top: 6vh;
  left: 50%;
  width: min(34rem, calc(100% - 2rem));
  max-height: 88vh;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  .sheet {
    background: var(--surface);
  }

  .sheet .rows {
    background: var(--surface-raised);
  }
}

.sheet-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--separator) 60%, transparent);
}

.sheet-bar h2 {
  font-size: 1.0625rem;
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}

.sheet-bar > :first-child {
  justify-self: start;
}

.sheet-bar > :last-child {
  justify-self: end;
}

.sheet-body {
  overflow-y: auto;
  padding: 0.25rem var(--side) calc(1.75rem + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.sheet-body > .group:first-of-type {
  margin-top: 1rem;
}

.sheet-lead {
  margin: 0.9rem var(--side) 0;
  color: var(--secondary);
  font-size: 0.9375rem;
}

.sheet-body > .footnote {
  margin: 1.2rem var(--side) 0;
}

.sheet-foot {
  margin-top: 1.6rem;
  display: flex;
  justify-content: center;
}

@keyframes rise {
  from {
    transform: translate(-50%, 24px);
    opacity: 0;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ── Narrow screens: tab bar instead of sidebar, sheets from the bottom ── */

@media (max-width: 54rem) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    display: none;
  }

  .toolbar h1 {
    font-size: 1.5rem;
  }

  .toolbar-actions .button span {
    display: none;
  }

  .toolbar-actions .button {
    padding: 0;
    width: var(--control);
  }

  .roster-actions .spacer {
    display: none;
  }

  .roster-actions .button {
    padding: 0 0.7rem;
  }

  .content {
    padding-bottom: calc(6rem + env(safe-area-inset-bottom));
  }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 0.3rem 0.25rem calc(0.25rem + env(safe-area-inset-bottom));
    background: var(--material);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--separator);
  }

  .tab {
    display: grid;
    justify-items: center;
    gap: 0.1rem;
    min-height: 3rem;
    padding: 0.2rem 0;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--secondary);
  }

  .tab .icon {
    width: 1.55rem;
    height: 1.55rem;
  }

  .tab.current {
    color: var(--tint);
  }

  .sheet {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 94dvh;
    transform: none;
    border-radius: 14px 14px 0 0;
    animation-name: rise-narrow;
  }

  @keyframes rise-narrow {
    from {
      transform: translateY(40%);
      opacity: 0.6;
    }
  }
}

/* ── Wide screens: the week as seven columns ───────────────────────────── */

@media (min-width: 70rem) {
  .board {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: start;
  }

  .board-day {
    padding: 0.7rem 0.7rem 0.3rem;
  }

  .board-shift {
    grid-template-columns: minmax(0, 1fr);
  }

  .places {
    grid-column: 1;
    grid-row: auto;
    flex-direction: column;
    margin-top: 0.4rem;
  }

  .place {
    width: 100%;
    justify-content: space-between;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ── Paper ─────────────────────────────────────────────────────────────── */

@page {
  size: A4 landscape;
  margin: 12mm;
}

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --label: #000;
    --secondary: #333;
    --fill: transparent;
    --separator: #999;
  }

  .sidebar,
  .toolbar,
  .tabbar,
  .actions,
  .roster-controls,
  .next,
  .issues,
  .banner,
  .roster-note,
  .notice-layer,
  .sheet-layer {
    display: none !important;
  }

  .table-frame::after {
    display: none;
  }

  .people-table {
    min-width: 0;
  }

  .shell {
    display: block;
  }

  .content {
    max-width: none;
    padding: 0;
  }

  .print-title {
    display: block;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
  }

  .board {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    font-size: 0.75rem;
  }

  .board-day {
    border: 1px solid #999;
    border-radius: 6px;
    padding: 0.35rem;
    break-inside: avoid;
  }

  .board-shift {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.3rem 0;
  }

  .places {
    grid-column: 1;
    grid-row: auto;
    flex-direction: column;
    gap: 0;
  }

  .place {
    min-height: 0;
    padding: 0;
    font-size: 0.75rem;
    color: #000;
    background: none;
  }

  .place .icon {
    display: none;
  }

  .table-scroll {
    overflow: visible;
  }

  .people-table {
    font-size: 0.75rem;
  }

  .duty,
  .duty.open {
    min-height: 0;
    padding: 0;
    background: none;
  }

  .duty {
    color: #000;
  }

  .duty .icon {
    display: none;
  }

  /* A printed plan says who works and what is missing, not what else
     would be possible. */
  .place.more,
  .more-row,
  .duty-add,
  .people-table tbody th small.room {
    display: none;
  }
}

/* ── Feedback, language, about ──────────────────────────────────────────── */

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2rem;
  padding: 0;
  color: var(--tint);
  font-size: inherit;
}

.link-button:hover {
  text-decoration: underline;
}

.flag {
  width: 0.95rem;
  height: 0.95rem;
  flex: none;
}

select.language {
  min-height: 2rem;
  padding: 0 0.2rem;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--tint);
  font-size: inherit;
}

.field > select.language {
  font-size: 1rem;
}

.only-narrow {
  display: none;
}

@media (max-width: 54rem) {
  .only-narrow {
    display: inline-flex;
  }
}

/* A question with room to answer: the label sits above the text. */
.field.tall {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem var(--side);
}

.field.tall > label {
  font-weight: 600;
}

.field.tall > textarea {
  width: 100%;
  min-height: 7rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--label);
  font: inherit;
  line-height: 1.4;
  resize: vertical;
}

.field.tall > textarea:focus-visible {
  outline: none;
}

.row.prose {
  display: block;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  line-height: 1.4;
}

.empty.in-sheet {
  margin: 2rem auto 3rem;
}

.made-in {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.25rem 0 1.5rem;
  color: var(--secondary);
  font-size: 0.8125rem;
}

.made-in .version {
  margin-left: 0.6rem;
  color: var(--tertiary);
}

a.row-button {
  color: inherit;
}

a.row-button:hover {
  text-decoration: none;
}

@media print {
  .only-narrow,
  .links {
    display: none;
  }
}

/* ── Name and way home ──────────────────────────────────────────────────── */

.wordmark {
  display: block;
  width: auto;
  height: 2.1rem;
  overflow: visible;
}

button.brand {
  width: 100%;
  border-radius: 10px;
  color: var(--label);
  text-align: left;
}

button.brand:hover .marmot,
.home-button:hover .marmot {
  transform: rotate(8deg) scale(1.06);
}

.brand .marmot,
.home-button .marmot {
  transition: transform 0.18s ease;
}

.brand .wordmark {
  height: 1.9rem;
  margin-top: 0.2rem;
}

.welcome-card h1 .wordmark {
  height: 4.6rem;
  margin: 0.2rem auto 0;
}

.home-button {
  flex: none;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  margin-left: -0.4rem;
  padding: 0;
  border-radius: 10px;
}

/* On phones the bar holds the marmot and the actions, and the title gets a
   line of its own beneath: as wide as it needs to be in any language. */
@media (max-width: 36rem) {
  .toolbar {
    flex-wrap: wrap;
    gap: 0 0.25rem;
  }

  .toolbar h1 {
    order: 3;
    flex: 1 0 100%;
    overflow-wrap: anywhere;
  }

  .toolbar-actions {
    margin-left: auto;
    gap: 0;
  }
}

/* Closed days and shortened shifts in the roster */
.closed-note {
  margin: 0.15rem 0 0.35rem;
  color: var(--orange);
  font-size: 0.875rem;
  font-weight: 600;
}

.shift-time.short {
  color: var(--orange);
}

.shift-time .break {
  display: block;
  color: var(--tertiary);
}

@media (prefers-reduced-motion: reduce) {
  .brand .marmot,
  .home-button .marmot {
    transition: none;
  }
}

/* ── Suggested messages ─────────────────────────────────────────────────── */

.row.message {
  display: block;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
  line-height: 1.45;
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}

/* ── Backdrop ───────────────────────────────────────────────────────────── */
/* Silvery blue everywhere. The start page carries a fine pattern of small
   peaks; the plan itself stays plain, because planning is focus work. */

:root {
  --bg: #eceff4;
}

.welcome {
  background-color: #e3e8ef;
  background-image: url("/muster-hell.svg"), linear-gradient(180deg, #edf1f6 0%, #dbe2ec 100%);
  background-size: 44px 44px, auto;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0d12;
  }

  .welcome {
    background-color: #10141c;
    background-image: url("/muster-dunkel.svg"), linear-gradient(180deg, #151a24 0%, #0c0f15 100%);
  }
}

@media print {
  :root {
    --bg: #ffffff;
  }
}

/* Answers to a message, and the count on the button that leads to them */
.button .count {
  min-width: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--tint);
  color: var(--on-tint);
  font-size: 0.8125rem;
  line-height: 1.35rem;
  text-align: center;
}

.answers .row-text {
  color: var(--secondary);
}

.button.destructive {
  color: var(--red);
}

/* ── The size that is included ───────────────────────────────────────────
   Where a control would make the plan larger than the free version or the
   key allows, one quiet line stands in its place, with the way to the key. */
.limit {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.15rem 0.75rem;
  color: var(--secondary);
  font-size: 0.9375rem;
  line-height: 1.35;
}

.actions > .limit {
  padding: 0.55rem 0.95rem;
  border-radius: var(--radius);
  background: var(--surface);
}

.limit .button.plain {
  margin: -0.2rem 0;
  padding-left: 0;
  padding-right: 0;
  font-size: inherit;
}

.empty .actions {
  justify-content: center;
  text-align: left;
}

.row.prose.caution {
  color: var(--orange);
}

.banner .button.plain {
  margin: -0.3rem 0;
  color: inherit;
  font-size: inherit;
  font-weight: 600;
  white-space: nowrap;
}

/* ── A notice with a way back ──────────────────────────────────────────────
   After something was removed, one line at the foot of the page says so and
   offers to take it back. It lies above sheets, because some things are
   removed inside one. */
.notice-layer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.25rem;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 0 var(--side);
  pointer-events: none;
}

.notice {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  min-height: 2.75rem;
  padding: 0.25rem 0.5rem 0.25rem 1.1rem;
  border-radius: 999px;
  background: #1c1c1e;
  color: #ffffff;
  box-shadow: var(--shadow);
  font-size: 0.9375rem;
  animation: notice-in 0.22s ease-out;
}

.notice .button.plain {
  min-height: 2.25rem;
  padding: 0 0.6rem;
  color: #a9b8ff;
  font-size: inherit;
}

@keyframes notice-in {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
}

@media (prefers-color-scheme: dark) {
  .notice {
    background: #f2f2f7;
    color: #000000;
  }

  .notice .button.plain {
    color: #2f55d4;
  }
}

@media (max-width: 54rem) {
  .notice-layer {
    bottom: calc(4.75rem + env(safe-area-inset-bottom));
  }

  /* What a sheet offers as well can step aside where the row is short. */
  .wide-only {
    display: none;
  }

  /* On a phone the bar is two lines high. Nearly opaque, so that what
     scrolls underneath does not show through the title. */
  .toolbar {
    background: color-mix(in srgb, var(--bg) 94%, transparent);
  }
}

/* ── What is wrong with a field ─────────────────────────────────────────── */
.row.field-problem {
  min-height: 0;
  align-items: flex-start;
  gap: 0.45rem;
  padding-top: 0.15rem;
  padding-bottom: 0.6rem;
  color: var(--red);
  font-size: 0.875rem;
  line-height: 1.35;
}

/* It belongs to the field above: no line between the two. */
.row.field-problem::before {
  display: none;
}

.row.field-problem .icon {
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
}

/* ── Rows that can be ticked ────────────────────────────────────────────── */
.check-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  border: 1.5px solid var(--tertiary);
  color: var(--on-tint);
}

.check-mark.on {
  border-color: var(--tint);
  background: var(--tint);
}

.check-mark .icon {
  width: 0.95rem;
  height: 0.95rem;
}

/* ── Caution ────────────────────────────────────────────────────────────── */
.row-icon.caution {
  background: var(--orange-soft);
  color: var(--orange);
}

.row-text small.caution {
  color: var(--orange);
  font-weight: 600;
}

.row.caution {
  align-items: flex-start;
  color: var(--orange);
  font-size: 0.9375rem;
  line-height: 1.4;
}

.row.caution .icon {
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.15rem;
}

/* An issue about one day of the roster leads to its week. */
.issue-link {
  color: inherit;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  text-underline-offset: 0.15em;
}

.issue-link:hover {
  text-decoration-color: currentColor;
}

/* ── Unsaved changes on a phone ─────────────────────────────────────────────
   There the save button is an icon and the sidebar with the state is gone:
   a dot on the button says that there is something to save. */
@media (max-width: 54rem) {
  .toolbar-actions .button.unsaved {
    position: relative;
  }

  .toolbar-actions .button.unsaved::after {
    content: "";
    position: absolute;
    top: -3px;
    right: -3px;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: #ff9f0a;
    box-shadow: 0 0 0 2px var(--bg);
  }
}

/* A hint is quieter than a warning. */
.issue.info {
  color: var(--secondary);
}

/* ── A wish for certain shifts, staff by weekday ────────────────────────── */
/* A small heading inside a group, above the rows it belongs to. */
.row.sublabel {
  min-height: 0;
  padding-top: 0.75rem;
  padding-bottom: 0.3rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--secondary);
}

/* The weekday whose number of people differs from the others. */
.field > span.differs {
  font-weight: 600;
}

/* ── A colour for each shift ────────────────────────────────────────────────
   Eight colours tell shifts apart at a glance, the same on the screen and on
   paper (internal/engine/legend.go: change both together). Each has a light
   ground that the usual type stands on, and a strong tone for the small bar
   beside it. None of them is orange or red: those say that a place is open
   or against a rule, and a colour means one thing only. Nothing is said by
   colour alone: the name of the shift, or its short name, always stands
   there too. */

.c0 { --shift: #dce6ff; --shift-ink: #2f55d4; }
.c1 { --shift: #d3f0d9; --shift-ink: #1f7a3a; }
.c2 { --shift: #fbdce8; --shift-ink: #b3266a; }
.c3 { --shift: #caeeee; --shift-ink: #0a7479; }
.c4 { --shift: #e8ddfa; --shift-ink: #7340c2; }
.c5 { --shift: #e5edc0; --shift-ink: #5f6f12; }
.c6 { --shift: #dce1ea; --shift-ink: #4a5a75; }
.c7 { --shift: #efe3d0; --shift-ink: #7a5b2e; }

/* On a dark screen the grounds are dark and the type on them light. Paper is
   never dark, so this is for screens only. */
@media screen and (prefers-color-scheme: dark) {
  .c0 { --shift: #26346b; --shift-ink: #8ea2ff; }
  .c1 { --shift: #1c4a2b; --shift-ink: #5fd17d; }
  .c2 { --shift: #5a2440; --shift-ink: #ff8fbd; }
  .c3 { --shift: #164a4d; --shift-ink: #5fd3d6; }
  .c4 { --shift: #40306b; --shift-ink: #c0a1ff; }
  .c5 { --shift: #3f4716; --shift-ink: #c6d76a; }
  .c6 { --shift: #353d4d; --shift-ink: #aab6cf; }
  .c7 { --shift: #4d3c24; --shift-ink: #dcb98a; }
}

/* A duty in the plan by person is a tile in the colour of its shift, with
   the bar of the strong tone at its edge: the same tile as on paper. */
.duty.tinted,
.code.tinted {
  background: var(--shift, var(--fill));
}

/* The bar takes its room from both sides of the tile, so that the name of a
   shift has the width it had before and breaks where it did. */
.duty.tinted {
  position: relative;
  padding-left: 0.7rem;
  padding-right: 0.3rem;
}

.duty.tinted::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 3px;
  border-radius: 2px;
  background: var(--shift-ink);
}

.duty.tinted:hover,
.code.tinted:hover {
  background: color-mix(in srgb, var(--shift-ink, var(--tint)) 14%, var(--shift, var(--fill)));
}

/* On a coloured ground the quiet type is a shade darker, so that the time of
   a shift keeps its contrast. */
.duty.tinted small {
  color: color-mix(in srgb, var(--label) 72%, var(--shift, var(--fill)));
}

/* In the plan by day the people of a shift keep their quiet tiles, where
   orange and red say what needs attention. The shift itself carries its
   colour: a bar beside its name and time. */
.shift-head {
  position: relative;
  grid-column: 1;
  padding-left: 0.7rem;
}

.shift-head::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2rem;
  bottom: 0.2rem;
  width: 4px;
  border-radius: 2px;
  background: var(--shift-ink, var(--tertiary));
}

/* The list of shifts shows each with its short name on its colour: where a
   shift is made is where its colour is first seen. */
.shift-key {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 2.1rem;
  height: 1.9rem;
  padding: 0 0.35rem;
  border-radius: 7px;
  background: var(--shift);
  box-shadow: inset 3px 0 0 var(--shift-ink);
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.month-legend .code {
  display: inline-block;
  min-width: 1.6rem;
  margin: 0 0.3rem 0 0;
  padding: 0 0.3rem;
  text-align: center;
  vertical-align: baseline;
  color: var(--label);
}

.month-legend span {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.3rem;
}

.month-legend span > strong:not(.code) {
  margin-right: 0.3rem;
}

/* ── On the way to paper ────────────────────────────────────────────────────
   The sheet that leads to the PDF shows the page as it will be printed. On a
   wide screen the page stands on the left and what can be chosen on the
   right, as in a print dialog; on a phone the page comes first and stays in
   view while the choices scroll beneath it. */

.sheet {
  --sheet-bg: var(--bg);
}

@media (prefers-color-scheme: dark) {
  .sheet {
    --sheet-bg: var(--surface);
  }
}

/* One column that is as wide as the sheet and no wider, whatever stands in
   it: a long word in another language must not push the sheet off a phone. */
.export {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem 1.5rem;
  margin-top: 0.75rem;
}

/* The page: white whatever the colours of the screen, because paper is. */
.paper {
  display: block;
  width: 100%;
  aspect-ratio: 841.89 / 595.28;
  border-radius: 5px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.1), 0 10px 28px rgba(0, 0, 0, 0.14);
  transition: opacity 0.2s;
}

/* While another picture is on its way the page steps back a little, but only
   once the wait is long enough to notice. */
.export-preview.loading .paper {
  opacity: 0.55;
  transition-delay: 0.25s;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  color: var(--secondary);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.pager span {
  min-width: 7.5rem;
  text-align: center;
}

.export-options > .group {
  margin-top: 1.15rem;
}

/* A kind of page is chosen by its picture. */
.layouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.layout {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.1rem;
  padding: 0.65rem 0.3rem 0.6rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--separator) 55%, transparent);
  text-align: center;
  line-height: 1.25;
}

.layout:hover {
  background: color-mix(in srgb, var(--tint) 5%, var(--surface));
}

.layout.on {
  box-shadow: inset 0 0 0 2px var(--tint);
}

.layout strong {
  margin-top: 0.35rem;
  font-size: 0.875rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.layout.on strong {
  color: var(--tint);
}

.layout small {
  font-size: 0.75rem;
  color: var(--secondary);
}

.layout-picture {
  width: 4rem;
  height: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

@media (prefers-color-scheme: dark) {
  .sheet .layout {
    background: var(--surface-raised);
  }
}

/* The last step of a plan ends on one true line: whether it is complete.
   Then the one thing most people came for, and the table beside it. */
.export-actions {
  margin-top: 1.25rem;
}

.export-status {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0 var(--side);
  color: var(--orange);
  font-size: 0.9375rem;
  line-height: 1.35;
}

.export-status span {
  color: var(--secondary);
}

.export-status strong {
  color: var(--orange);
  font-weight: 600;
}

.export-status .icon {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.05rem;
}

.export-status.complete {
  color: #1f8a3d;
}

.export-status.complete strong {
  color: var(--label);
}

@media (prefers-color-scheme: dark) {
  .export-status.complete {
    color: var(--green);
  }
}

/* The two stand side by side where they fit. Where the words of a language
   are too long for that, the PDF moves above the table: it comes first. */
.export-actions .button-row {
  margin-top: 0.8rem;
  flex-wrap: wrap-reverse;
}

.export-actions .button {
  flex: 1 1 auto;
  min-height: calc(var(--control) + 6px);
  min-width: 0;
}

.export-actions .button[data-format="pdf"] {
  flex-grow: 3;
}

.export-actions .button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 54.0625rem) {
  .sheet.wide {
    width: min(63rem, calc(100% - 2rem));
  }

  .export {
    grid-template-columns: minmax(0, 1.4fr) minmax(19.5rem, 1fr);
    align-items: start;
  }

  .export-preview {
    position: sticky;
    top: 0.75rem;
    padding-top: 0.9rem;
  }
}

/* On a phone the page stays in view while the choices scroll, and the way
   to the PDF stays at the thumb. A very short screen has no room for both. */
@media (max-width: 54rem) {
  /* The bar reaches down through the room the sheet keeps free at its foot. */
  .export-actions {
    position: sticky;
    bottom: calc(-1.75rem - env(safe-area-inset-bottom));
    z-index: 2;
    margin: 1rem calc(-1 * var(--side)) calc(-1.75rem - env(safe-area-inset-bottom));
    padding: 0.7rem var(--side) calc(0.9rem + env(safe-area-inset-bottom));
    background: var(--sheet-bg);
    box-shadow: 0 -1px 0 color-mix(in srgb, var(--separator) 60%, transparent);
  }

  .export-status {
    margin: 0;
  }
}

@media (max-width: 54rem) and (min-height: 44rem) {
  .export-preview {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 calc(-1 * var(--side));
    padding: 0.75rem var(--side) 0.6rem;
    background: var(--sheet-bg);
  }
}

/* Whoever prints the page itself instead of making the PDF gets the colours
   of the shifts as well: a browser leaves grounds out of a print unless told
   that they carry meaning. */
@media print {
  .duty.tinted,
  .duty.tinted::before,
  .code.tinted,
  .shift-head::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .duty.tinted {
    padding: 0.15rem 0.3rem 0.15rem 0.65rem;
    background: var(--shift);
  }

  .duty.tinted small {
    color: #333;
  }
}

/* Under the links of the start page, where this Shifty has them: the pages
   about prices, terms and privacy. Quieter than the links above. */
.welcome-card .page-links {
  margin-top: -0.3rem;
}

.page-links a {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  color: var(--secondary);
}
