/* Ice Cream Roster — styles.
 *
 * Light theme, no browser-default controls: every input, select and button
 * is drawn by this file. Selects keep a dedicated arrow gutter of 3rem so the
 * chevron never sits on top of the text, focus is always visible, disabled
 * controls are clearly greyed, and the layout holds at 360px wide.
 */

/* ------------------------------------------------------------- tokens */

:root {
  --bg: #faf6f2;
  --surface: #ffffff;
  --surface-2: #f4efea;
  --ink: #241d1a;
  --ink-soft: #5f534c;
  --ink-faint: #8b7f77;
  --line: #e6ddd5;
  --line-strong: #d3c7bc;
  --accent: #b02a58;
  --accent-dark: #8d1f45;
  --accent-soft: #fdeef3;
  --mint: #1d7a68;
  --mint-soft: #e6f4f0;
  --warn: #9a5b00;
  --warn-soft: #fdf1de;
  --danger: #b3261e;
  --danger-soft: #fdeceb;
  --focus: #1d4ed8;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(36, 29, 26, .06), 0 8px 24px rgba(36, 29, 26, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ----------------------------------------------------------- baseline */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-wrap: break-word;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent-dark); }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

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

/* -------------------------------------------------------------- shell */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(36, 29, 26, .05);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 18px 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent-soft);
  font-size: 20px;
  flex: none;
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 1.08rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: var(--ink-faint); font-size: .78rem; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.stamp {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .74rem;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.save-state {
  font-size: .74rem;
  color: var(--mint);
  white-space: nowrap;
}
.save-state[data-state="error"] { color: var(--danger); }
.save-state[data-state="idle"] { color: var(--ink-faint); }
.footer-save { display: none; }

/* The sync state in the header. It is only shown when sync is on. */
.sync-state:empty { display: none; }
.sync-state {
  font-size: .74rem;
  color: var(--mint);
  white-space: nowrap;
}
.sync-state[data-state="in-sync"] { color: var(--mint); }
.sync-state[data-state="connecting"] { color: var(--ink-faint); }
.sync-state[data-state="pending"],
.sync-state[data-state="offline"],
.sync-state[data-state="signed-out"],
.sync-state[data-state="out-of-date"] { color: var(--warn); }
.sync-state[data-state="error"] { color: var(--danger); }

/* The banner that says this copy is out of date. */
.banner-warn {
  background: var(--warn-soft);
  border-color: #f0dcb8;
  border-left-color: var(--warn);
}
.banner-warn .row { width: 100%; }

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 18px 12px;
}

.app-nav a {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 550;
  white-space: nowrap;
}

.app-nav a:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: #f0cdd9; }
.app-nav a[aria-current="page"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 18px 40px;
}

.app-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 18px;
  color: var(--ink-faint);
  font-size: .78rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  align-items: center;
  justify-content: space-between;
}

/* -------------------------------------------------------------- pieces */

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-head p { margin: 0; color: var(--ink-soft); font-size: .92rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card + .card { margin-top: 12px; }

.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-title { display: flex; flex-direction: column; min-width: 0; }
.card-title h3 { margin: 0; }
.card-title p { margin: 2px 0 0; color: var(--ink-faint); font-size: .84rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 12px;
}

.grid > * { min-width: 0; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-tight { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.spacer { flex: 1 1 auto; }

.muted { color: var(--ink-faint); }
.soft { color: var(--ink-soft); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.badge-accent { background: var(--accent-soft); color: var(--accent-dark); border-color: #f2d3dd; }
.badge-mint { background: var(--mint-soft); color: var(--mint); border-color: #c8e6de; }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb8; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c6; }

.banner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-soft);
  border: 1px solid #f2d3dd;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.banner p { margin: 0; font-size: .9rem; }
.banner strong { display: block; }

.note {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .85rem;
  color: var(--ink-soft);
}

dl.kv {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 4px 14px;
  margin: 0;
  font-size: .88rem;
}

dl.kv dt { color: var(--ink-faint); }
dl.kv dd { margin: 0; }

.list-reset { list-style: none; margin: 0; padding: 0; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.field > label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: .76rem; color: var(--ink-faint); }
.field .error-text { font-size: .78rem; color: var(--danger); font-weight: 600; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 14px;
}

input[type="text"], input[type="number"], input[type="time"], input[type="date"],
input[type="search"], input[type="email"], input[type="password"], input[type="url"],
select, textarea {
  width: 100%;
  max-width: 100%;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  min-height: 42px;
  transition: border-color .12s ease, box-shadow .12s ease;
}

textarea { min-height: 78px; resize: vertical; }

input::placeholder, textarea::placeholder { color: #a89c94; }

input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) {
  border-color: #b9a99c;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 42, 88, .16);
  outline: none;
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--surface-2);
  color: var(--ink-faint);
  border-color: var(--line);
  cursor: not-allowed;
  -webkit-text-fill-color: var(--ink-faint);
  opacity: .85;
}

input[type="number"] { font-variant-numeric: tabular-nums; }

/* Selects draw their own chevron and keep a 3rem gutter for it, so the text
 * never runs under the arrow. */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 3rem;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%235f534c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 12px 8px;
  cursor: pointer;
}

select:disabled { cursor: not-allowed; }

input[type="checkbox"], input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .88rem;
  padding: 8px 12px 8px 10px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}

.checkbox:has(input:checked) {
  background: var(--accent-soft);
  border-color: #f0cdd9;
  color: var(--accent-dark);
  font-weight: 600;
}

.checkbox input:disabled { cursor: not-allowed; }

.field-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.field-row .field { flex: 1 1 150px; margin-bottom: 0; }

/* ------------------------------------------------------------ buttons */

button, .btn {
  font: inherit;
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  min-height: 40px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}

button:hover:not(:disabled), .btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: #b9a99c;
}

button:active:not(:disabled) { transform: translateY(1px); }

button:disabled, .btn:disabled {
  background: var(--surface-2);
  color: var(--ink-faint);
  border-color: var(--line);
  cursor: not-allowed;
  opacity: .9;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-danger { color: var(--danger); border-color: #e8bdb9; background: var(--surface); }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line); }

.btn-small { padding: 6px 10px; min-height: 34px; font-size: .8rem; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent-dark);
  text-decoration: underline;
  padding: 2px 4px;
  min-height: 0;
  font-weight: 600;
}

/* A shop or a person name reads as a heading but opens the form, so the
 * whole card is a way in. */
.name-button {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 6px 0;
  min-height: 34px;
  text-align: left;
  cursor: pointer;
}

.name-button:hover { color: var(--accent-dark); border-bottom-color: var(--line-strong); background: none; }
.name-button:active { transform: none; }

/* -------------------------------------------------------------- table */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table { border-collapse: collapse; width: 100%; font-size: .86rem; }

th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th { background: var(--surface-2); color: var(--ink-soft); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
td.wrap, th.wrap { white-space: normal; min-width: 180px; }

/* -------------------------------------------------------------- toast */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #2a211d;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: .87rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  /* The toast lies over the board: only its button takes the pointer, the
   * message itself must not swallow a click on the shift behind it. */
  pointer-events: none;
  animation: toast-in .18s ease-out;
}

.toast[data-tone="error"] { background: #7a1d18; }
.toast[data-tone="warn"] { background: #6f4200; }
.toast .toast-action {
  margin-left: auto;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .45);
  color: #fff;
  min-height: 34px;
  padding: 6px 12px;
  font-size: .8rem;
  pointer-events: auto;
}
.toast .toast-action:hover { background: rgba(255, 255, 255, .16); }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 29, 26, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 70;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .28);
  width: min(480px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 18px;
}

.modal h3 { margin-top: 0; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ---------------------------------------------------------- week grid */

/* The controls above the board. */
.week-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.week-field { flex: 0 1 240px; margin-bottom: 0; }
.week-field select { min-width: 0; }

.week-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.week-label { white-space: nowrap; font-size: .92rem; }

.totals-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--mint);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.total-value { font-size: 1.16rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.total-label { font-size: .76rem; color: var(--ink-faint); }
.total-warn { border-left-color: var(--warn); }
.total-warn .total-value { color: var(--warn); }

/* The warnings panel. */
.warnings-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.warnings-panel h2 { font-size: 1.05rem; margin: 0; }
.warnings-panel .card-title p { margin: 2px 0 0; color: var(--ink-faint); font-size: .84rem; }
.warnings-ok { border-left: 4px solid var(--mint); }

.warning-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; max-height: 420px; overflow-y: auto; }

.warning {
  border: 1px solid var(--line);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface-2);
}

.warning-soft { border-left-color: var(--ink-faint); }
.warning-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.warning-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}

.warning-tag-hard { background: var(--danger-soft); border-color: #f3c9c6; color: var(--danger); }
.warning-where { font-size: .78rem; color: var(--ink-faint); }
.warning-message { margin: 6px 0 0; font-size: .88rem; }
.warning-suggestion { margin: 4px 0 0; font-size: .84rem; color: var(--ink-soft); }
.warning .row { margin-top: 8px; }

/* The board itself: a real table, so a screen reader can say which day and
 * which role every cell belongs to. */
.week-wrap { overflow-x: auto; }

.week-table { width: 100%; min-width: 780px; table-layout: fixed; }
.week-table th, .week-table td { white-space: normal; vertical-align: top; padding: 6px; }

.week-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  border-bottom: 2px solid var(--line-strong);
  text-align: left;
  font-size: .72rem;
}

.week-table .role-head, .week-table .role-cell { width: 132px; }
.week-table .role-cell {
  background: var(--surface-2);
  font-weight: 650;
  font-size: .82rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
  border-right: 1px solid var(--line);
}

.week-table .total-head, .week-table .row-total { width: 72px; text-align: right; }
.week-table .row-total { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink-soft); }
.day-head { display: table-cell; }
.day-name { display: block; font-weight: 700; color: var(--ink); }
.day-date { display: block; font-weight: 500; color: var(--ink-faint); text-transform: none; letter-spacing: 0; }

.day-cell { min-width: 96px; }
.day-cell[data-drop-over="true"] {
  outline: 3px dashed var(--accent);
  outline-offset: -3px;
  background: var(--accent-soft);
}

.day-total { font-size: .78rem; }
.day-total-hours { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.day-total-cost { display: block; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.day-total-gap { display: block; color: var(--warn); font-weight: 650; }
.week-table tfoot td, .week-table tfoot th { border-top: 2px solid var(--line-strong); background: var(--surface-2); }

/* A shift card on the board. */
.shift-card {
  background: var(--accent-soft);
  border: 1px solid #f2d3dd;
  border-left: 3px solid var(--accent);
  border-radius: 7px;
  padding: 6px 7px;
  margin-bottom: 5px;
  font-size: .78rem;
  cursor: grab;
  touch-action: pan-y;
}

.shift-card:last-child { margin-bottom: 0; }
.shift-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.shift-card.shift-closing { border-left-color: var(--mint); background: var(--mint-soft); border-color: #c8e6de; }
.shift-card.shift-has-warning { border-style: dashed; border-left-style: solid; }
.shift-card.is-dragging { opacity: .3; cursor: grabbing; }

.shift-top { display: flex; gap: 6px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.shift-time { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.shift-hours { color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }

.shift-person {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px dotted var(--line-strong);
  border-radius: 0;
  padding: 3px 0;
  min-height: 0;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.shift-person:hover { background: none; color: var(--accent-dark); border-bottom-color: var(--accent); }
.shift-person-empty { color: var(--ink-faint); font-weight: 600; border-bottom: 0; }

.shift-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.flag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}

.flag-close { background: var(--mint-soft); border-color: #c8e6de; color: var(--mint); }
.flag-pin { background: var(--surface-2); }
.flag-warn { background: var(--danger-soft); border-color: #f3c9c6; color: var(--danger); }
.flag-note { background: var(--warn-soft); border-color: #f0dcb8; color: var(--warn); }

.shift-actions { display: flex; gap: 4px; margin-top: 5px; }
.shift-actions .btn-small { padding: 3px 7px; min-height: 28px; font-size: .72rem; }

/* A slot nobody is on yet. */
.shift-card-gap {
  background: repeating-linear-gradient(135deg, var(--warn-soft), var(--warn-soft) 6px, #fff 6px, #fff 12px);
  border: 1px dashed var(--warn);
  border-left: 3px solid var(--warn);
  cursor: default;
}

/* The card that follows the pointer. */
.drag-ghost {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  margin: 0;
  opacity: .95;
  transform: rotate(-1.5deg);
  box-shadow: 0 12px 30px rgba(36, 29, 26, .25);
  cursor: grabbing;
}

body.is-dragging-a-card { cursor: grabbing; }
body.is-dragging-a-card .shift-card { cursor: grabbing; }

/* --------------------------------------------------------- the drawer */

/* The drawer sits beside the board and does not take the screen away: the
 * manager can read what a person has been given and go straight on working.
 * A click outside it puts it away. */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(36, 29, 26, .16);
  display: flex;
  justify-content: flex-end;
  z-index: 65;
  pointer-events: none;
}

.drawer {
  width: min(420px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(36, 29, 26, .18);
  padding: 16px;
  pointer-events: auto;
}

.drawer-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.drawer-title { font-size: 1.2rem; margin: 0; }
.drawer-block { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.drawer-heading { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); margin-bottom: 6px; }
.drawer-list { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.drawer-split { justify-content: space-between; gap: 12px; }

/* --------------------------------------------------------- the overview */

/* A cell with a figure and a small note under it. */
.ov-stack { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.ov-shop { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.ov-cov { width: 186px; }
.ov-table { font-size: .82rem; }
.ov-table th, .ov-table td { padding: 8px 9px; }
.ov-people .badge { font-size: .72rem; padding: 2px 8px; }
.ov-shop-head { white-space: normal; min-width: 88px; }
.ov-next { white-space: nowrap; }

/* The cover of the week, one small bar per day. */
.cov-bars { display: flex; gap: 3px; align-items: flex-end; }
.cov-day { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 21px; }
.cov-bar {
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  overflow: hidden;
}
.cov-fill { display: block; width: 100%; background: var(--mint); border-radius: 4px 4px 0 0; }
.cov-short .cov-bar { background: var(--warn-soft); border-color: #f0dcb8; }
.cov-short .cov-fill { background: var(--warn); }
.cov-closed .cov-bar {
  background: repeating-linear-gradient(45deg,
    var(--surface-2), var(--surface-2) 3px, #ece4dc 3px, #ece4dc 6px);
}
.cov-closed .cov-fill { display: none; }
.cov-label {
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.cov-closed .cov-label { color: var(--line-strong); }

/* The slots nobody is on yet. */
.cover-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 2px;
}
.cover-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 12px;
}
.cover-group-head {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  margin-bottom: 8px;
}
.cover-slots { display: flex; flex-wrap: wrap; gap: 6px; }
.cover-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  min-height: 34px;
  font-size: .8rem;
  border: 1px dashed var(--warn);
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--ink);
  cursor: pointer;
}
.cover-slot:hover { background: #f9e6c6; border-style: solid; }
.cover-slot-role { font-weight: 650; }
.cover-slot-time { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.cover-slot-hours { color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.total-peak { border-left-color: var(--accent); }
.total-peak .total-value { color: var(--accent-dark); }

/* --------------------------------------------------------- responsive */

@media (max-width: 880px) {
  /* The seven columns do not fit on a phone: each role becomes a block with
   * its days one under the other, and the day is named on every cell. The
   * table keeps its headers, so a screen reader still knows what a cell is. */
  .week-table, .week-table thead, .week-table tbody, .week-table tfoot,
  .week-table tr, .week-table th, .week-table td {
    display: block;
    width: auto;
    min-width: 0;
  }

  .week-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .week-table tbody tr, .week-table tfoot tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--surface);
  }

  .week-table tbody th, .week-table tfoot th {
    font-size: .95rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    padding: 2px 0 6px;
    margin-bottom: 6px;
  }

  .week-table td {
    border: 0;
    padding: 4px 0;
    white-space: normal;
  }

  .week-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-faint);
  }

  .week-table .row-total, .week-table tfoot .row-total {
    text-align: left;
    border-top: 1px solid var(--line);
    padding-top: 6px;
    font-weight: 650;
  }

  .week-table .row-total::before { content: 'Week total'; }

  .day-cell { min-width: 0; }
  .shift-card { padding: 8px 9px; }
  .shift-person { min-height: 34px; }
  .shift-actions .btn-small { min-height: 34px; padding: 5px 10px; }
}

@media (max-width: 560px) {
  .header-top { padding: 10px 12px 6px; }
  .app-nav { padding: 0 12px 10px; }
  main { padding: 16px 12px 32px; }
  .footer-inner { padding: 0 2px; }
  .card { padding: 13px; }
  h1 { font-size: 1.25rem; }
  .brand-text small { display: none; }
  .header-top .save-state { display: none; }
  .footer-save { display: inline; }
  dl.kv { grid-template-columns: 1fr; gap: 1px 0; }
  dl.kv dd { margin-bottom: 6px; }
  .week-toolbar { gap: 10px; }
  .week-field { flex: 1 1 100%; }
  /* On a phone the drawer is a sheet over the bottom of the board. It still
   * does not take the screen away: a tap outside puts it away. */
  .drawer-backdrop {
    background: rgba(36, 29, 26, .28);
    align-items: flex-end;
  }
  .drawer {
    width: 100%;
    height: auto;
    max-height: 88vh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: var(--radius) var(--radius) 0 0;
    margin-top: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* A finger needs a bigger target than a mouse. */
@media (pointer: coarse) {
  input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; }
  .checkbox { min-height: 44px; padding: 9px 14px 9px 12px; }
  .btn-link { min-height: 40px; padding: 8px 4px; }
}

@media (forced-colors: active) {
  select { appearance: auto; background-image: none; padding-right: 11px; }
  button, .btn, .card, .badge { border: 1px solid CanvasText; }
  .shift-card, .banner { border: 1px solid CanvasText; }
  .shift-card.shift-has-warning, .shift-card-gap { border-style: dashed; }
  .flag, .warning-tag, .total { border: 1px solid CanvasText; }
  .warning { border: 1px solid CanvasText; }
  .day-cell[data-drop-over="true"] { outline: 3px dashed CanvasText; }
  .drawer { border-left: 1px solid CanvasText; }
}

/* ------------------------------------------------------------- publish */

/* A row of the publish screen: what the file is, and the button that makes
 * it. On a phone the two stack. */
.file-row,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.file-row:first-child,
.link-row:first-child { border-top: 0; padding-top: 0; }

.file-what,
.link-what {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 220px;
}

.file-what span,
.link-what span { color: var(--ink-faint); font-size: .82rem; }

/* The link that was made: the address, the buttons, and the warning when it
 * is too long to send. */
.made-link {
  flex: 1 1 100%;
  margin-top: 4px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.link-field {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  word-break: break-all;
}

.made-link .field { margin-bottom: 8px; }

/* ---------------------------------------------------------- staff page */

.staff-body { background: var(--bg); }

#staff-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 12px 40px;
}

.staff-header,
.staff-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.staff-header { margin-bottom: 12px; }
.staff-card { margin-bottom: 12px; }

.staff-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.staff-heading h1 { margin: 0 0 4px; font-size: 1.35rem; }
.staff-week { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.staff-stamp { margin: 4px 0 0; color: var(--ink-faint); font-size: .82rem; }

.staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lang-button {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 8px 12px;
  min-height: 42px;
}

.lang-button.is-current { background: var(--accent); color: #fff; }

.staff-card h2 { margin: 0 0 10px; font-size: 1.05rem; }
.staff-card h3 { margin: 0 0 4px; }

.next-shift { border-left: 4px solid var(--accent); }
.next-when { margin: 0; font-weight: 600; }
.next-what { margin: 2px 0 0; font-size: 1.05rem; }
.next-where { margin: 2px 0 0; color: var(--ink-soft); }
.next-hours { margin: 4px 0 0; font-size: .85rem; }

.shift-list { display: flex; flex-direction: column; gap: 14px; }

.shift-day {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.shift-day:first-child { border-top: 0; padding-top: 0; }

.shift-date {
  margin: 0 0 6px;
  font-size: .95rem;
  color: var(--ink-soft);
}

.shift-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
}

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

.shift-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 104px;
}

.shift-what {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.shift-role { color: var(--ink-soft); }
.shift-meta { color: var(--ink-faint); font-size: .85rem; }

.shift-note {
  flex: 1 1 100%;
  color: var(--ink-soft);
  font-size: .85rem;
}

.staff-total {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.shop-block {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.shop-block:first-of-type { border-top: 0; padding-top: 0; }
.shop-name { margin: 0; font-size: 1rem; }

.shop-address,
.shop-hours,
.shop-notes { margin: 2px 0 0; font-size: .9rem; color: var(--ink-soft); }

.shop-address-label { color: var(--ink-faint); font-size: .82rem; }

.staff-footer {
  padding: 4px;
  color: var(--ink-faint);
  font-size: .8rem;
}

.staff-footer p { margin: 0 0 4px; }
.problem h1 { margin-top: 0; }

@media (max-width: 560px) {
  .file-row, .link-row { align-items: flex-start; }
  .shift-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .shift-time { min-width: 0; }
  .staff-header, .staff-card { padding: 13px; }
}

/* The staff page prints on one sheet: the buttons go, the week stays. */
@media print {
  body.staff-body { background: #fff; }
  #staff-view { max-width: none; padding: 0; }
  .staff-actions { display: none; }
  .staff-header, .staff-card {
    box-shadow: none;
    break-inside: avoid;
  }
  .staff-header { border-bottom: 2px solid var(--ink); border-radius: 0; }
  .staff-card { border-radius: 0; }
  .staff-footer { color: #55504c; }
}
