/* The admin's Schedule — a week of planned shifts, day by day — and the
   Plan a shift form. Design: "Schedule page" and "Plan a shift" frames,
   approved 2026-10-19. */

:root {
  --schedule-ink: #1f2a37;
  --schedule-muted: #6b7280;
  --schedule-faint: #8b8f96;
  --schedule-line: #ece7df;
  --schedule-edge: #e2ddd5;
  --schedule-green: #2f7a4f;
  --schedule-red: #b91c1c;
  --schedule-amber: #a16207;
  --schedule-open-wash: #fadcdc;
  --schedule-open-dot: #e03e3e;
  --schedule-unplanned-wash: #f8ecd1;
  --schedule-unplanned-dot: #e0a526;
}

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

.schedule-page__back {
  margin-bottom: 1rem;
}

.schedule-page__header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
/* Side by side when there is room; the controls drop under the title when
   there is not, so the green button never runs off the screen. */
@media (min-width: 768px) {
  .schedule-page__header {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
  }
}

.schedule-page__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--schedule-ink);
}
@media (min-width: 768px) {
  .schedule-page__title { font-size: 2rem; }
}

.schedule-page__subtitle {
  margin-top: 0.25rem;
  color: var(--schedule-muted);
}

.schedule-page__controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .schedule-page__controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
}

/* The bar with the week and the planning buttons: it stays just under the
   app's header while the week scrolls under it. On a phone the week
   switcher takes the first line and Copy and Plan share the second. */
.schedule-toolbar {
  position: sticky;
  top: var(--app-header-h, 4rem);
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0 -0.5rem 1rem;
  padding: 0.5rem;
  background: var(--color-base-200, #f1ede6);
  border-bottom: 1px solid var(--schedule-edge);
}
/* In the bar the group and view choices sit on one line, as tall as the
   week switcher; on a phone that line scrolls sideways if it runs long. */
.schedule-toolbar .schedule-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.schedule-toolbar .schedule-groups,
.schedule-toolbar .schedule-views { margin-bottom: 0; }
.schedule-toolbar .schedule-groups__choice,
.schedule-toolbar .schedule-views__choice { min-height: 2.5rem; padding: 0 0.875rem; }
.schedule-toolbar .schedule-groups::after {
  content: "";
  align-self: stretch;
  width: 1px;
  margin-left: 0.25rem;
  background: var(--schedule-edge);
}
@media (min-width: 768px) {
  .schedule-toolbar .schedule-page__controls { justify-content: flex-end; margin-left: auto; }
  /* The week switcher keeps one width, so Plan a shift, its arrows and
     Today stay in the same place as the weeks change. */
  .schedule-toolbar .schedule-week__title { min-width: 14rem; text-align: center; }
}
@media (max-width: 767px) {
  .schedule-toolbar .schedule-choices {
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .schedule-toolbar .schedule-groups,
  .schedule-toolbar .schedule-views { flex-wrap: nowrap; }
  .schedule-toolbar .schedule-groups__choice,
  .schedule-toolbar .schedule-views__choice { min-height: 2.25rem; padding: 0 0.75rem; white-space: nowrap; font-size: 0.875rem; }
  .schedule-toolbar .schedule-page__controls { width: 100%; }
}
@media (max-width: 767px) {
  .schedule-toolbar .schedule-page__controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  /* On a phone the week takes the first line, above Copy and Plan. */
  .schedule-toolbar .schedule-week { grid-column: 1 / -1; order: -1; }
  /* Plan a shift keeps the right half. The left half is Copy last week in
     a week it can copy into, and Today in any other, so nothing but that
     one button changes from week to week. */
  .schedule-toolbar .schedule-page__plan { grid-column: 2; grid-row: 2; }
  .schedule-toolbar .schedule-page__copy-form,
  .schedule-toolbar .schedule-page__today { grid-column: 1; grid-row: 2; }
  .schedule-toolbar .schedule-page__controls:not(:has(.schedule-page__copy-form)) .schedule-page__today { display: inline-flex; }
}

/* The week switcher: ‹ Week of Oct 13 – 19 › in one bordered box. */
.schedule-week {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 2.5rem;
  background: #fff;
  border: 1px solid var(--schedule-edge);
  border-radius: 0.5rem;
}
.schedule-week__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 100%;
  color: var(--schedule-ink);
}
.schedule-week__arrow:hover { color: var(--schedule-green); }
.schedule-week__title {
  padding: 0 0.5rem;
  font-weight: 600;
  color: var(--schedule-ink);
  white-space: nowrap;
}

.schedule-page__today {
  background: #fff;
  border: 1px solid var(--schedule-edge);
  color: var(--schedule-ink);
}

/* On a phone: the title, then the week switcher, then the green button,
   each the full width. The Back link, the grey line and Today wait for a
   wider screen. */
@media (max-width: 767px) {
  .schedule-page__back,
  .schedule-page__subtitle,
  .schedule-page__today { display: none; }
  .schedule-page__back--lead { display: inline-flex; }
}

/* ---- The group choices ------------------------------------------- */

/* All DSPs | Clubhouse | ... and By day | By DSP | By client: the picked
   one is green. */
.schedule-groups,
.schedule-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.schedule-groups__choice,
.schedule-views__choice {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  background: #fff;
  border: 1px solid var(--schedule-edge);
  border-radius: 9999px;
  font-weight: 600;
  color: #4b5563;
}
.schedule-groups__choice:hover,
.schedule-views__choice:hover { border-color: var(--schedule-green); color: var(--schedule-green); }
.schedule-groups__choice[aria-current="page"],
.schedule-views__choice[aria-current="page"] {
  border-color: var(--schedule-green);
  background: #eaf4ee;
  color: var(--schedule-green);
}

/* ---- Who plans the group ------------------------------------------- */

/* "Lead: Morgan Diaz · Change leads", and the picker it opens. */
.schedule-leads {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--schedule-ink);
}
.schedule-leads__label { font-weight: 600; }
.schedule-leads__change { flex-basis: auto; }
.schedule-leads__change[open] { flex-basis: 100%; }
.schedule-leads__toggle {
  cursor: pointer;
  color: var(--schedule-green);
  font-weight: 600;
  list-style: none;
}
.schedule-leads__toggle::-webkit-details-marker { display: none; }
.schedule-leads__toggle:hover { text-decoration: underline; }
.schedule-leads__change[open] .schedule-leads__toggle { margin-bottom: 0.75rem; }
.schedule-leads__form {
  display: grid;
  gap: 0.625rem;
  max-width: 32rem;
  padding: 1rem;
  border: 1px solid var(--schedule-edge);
  border-radius: 0.75rem;
  background: #fff;
}
.schedule-leads__question { font-weight: 600; }
.schedule-leads__hint { font-size: 0.875rem; color: var(--schedule-muted); }
.schedule-leads__form .btn { justify-self: start; }

/* A week ahead: not published to its DSPs yet (amber), or published (a
   quiet green line). Under it, a group with a lead that publishes apart. */
.schedule-release {
  margin: 0 0 1rem;
  padding: 0.875rem 1.25rem;
  border: 1px solid #ecd9a8;
  border-radius: 0.75rem;
  background: #fffaf0;
  color: var(--schedule-ink);
  font-size: 0.9375rem;
}
.schedule-release--shared {
  border-color: #cfe5d6;
  background: #f1f8f3;
}
.schedule-release__apart {
  margin: -0.5rem 0 1rem;
  color: var(--schedule-muted);
  font-size: 0.875rem;
}
.schedule-release__apart a { color: var(--schedule-green); font-weight: 600; text-decoration: underline; }

/* Under the schedule, where planning a week ends: Start this week over and
   Publish. On a phone the buttons stack, each the full width. */
.schedule-publish {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin: 1rem 0 0;
  padding: 1rem 1.25rem;
  border: 1px solid #ecd9a8;
  border-radius: 0.75rem;
  background: #fffaf0;
  color: var(--schedule-ink);
  font-size: 0.9375rem;
}
.schedule-publish__text { margin: 0; flex: 1 1 20rem; }
.schedule-publish__buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.schedule-publish form { margin: 0; }
.schedule-publish__over { color: var(--schedule-ink); }
@media (max-width: 30rem) {
  .schedule-publish__buttons { flex-direction: column-reverse; width: 100%; }
  .schedule-publish form, .schedule-publish__button, .schedule-publish__over { width: 100%; }
}
/* Once the week is published: a calm green box where Publish was. */
.schedule-publish--done {
  border-color: #cfe5d6;
  background: #f1f8f3;
}
.schedule-publish--done strong { color: var(--schedule-green); }
/* Room under it, so the round chat button never covers Publish. */
@media (max-width: 63.99rem) {
  .schedule-publish { margin-bottom: 4.5rem; }
}
/* A Schedule button while its work runs: greyed out, so a second press
   can't start it again, with words that say what it is doing. */
.schedule-page__copy[disabled], .schedule-publish .btn[disabled] {
  opacity: 0.6;
  cursor: progress;
}

/* What the repeat sign on a shift means, under the week. */
.schedule-legend {
  margin: 0.75rem 0 0;
  color: var(--schedule-muted);
  font-size: 0.875rem;
}
.schedule-legend__sign { font-weight: 600; color: var(--schedule-ink); }

/* Copy last week, beside Plan a shift: white with a border, like Today. */
.schedule-page__copy-form { margin: 0; }
.schedule-page__copy {
  width: 100%;
  background: #fff;
  border: 1px solid var(--schedule-edge);
  color: var(--schedule-ink);
}
@media (min-width: 768px) {
  .schedule-page__copy { width: auto; }
}

/* ---- Days off waiting for an answer -------------------------------- */

/* One row per request: who and when on the left, Approve / Say no on the
   right; on a phone the buttons drop under the words. */
.schedule-time-offs {
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid #ecd9a8;
  border-radius: 0.75rem;
  background: #fffaf0;
  color: var(--schedule-ink);
}
.schedule-time-offs__title { margin: 0 0 0.5rem; font-size: 1rem; font-weight: 600; }
.schedule-time-offs__list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.schedule-time-off {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid #f1e6c8;
}
.schedule-time-off:first-child { border-top: 0; padding-top: 0.25rem; }
.schedule-time-off__about { flex: 1 1 18rem; min-width: 0; }
.schedule-time-off__who { margin: 0; font-size: 0.9375rem; }
.schedule-time-off__short {
  display: inline-block;
  margin-left: 0.375rem;
  padding: 0.0625rem 0.5rem;
  border-radius: 999px;
  background: #fde8c8;
  color: #8a4b08;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.schedule-time-off__note,
.schedule-time-off__shifts { margin: 0.25rem 0 0; font-size: 0.875rem; color: var(--schedule-muted); }
.schedule-time-off__answer { display: flex; flex-wrap: wrap; gap: 0.5rem; flex-shrink: 0; }
.schedule-call-out__group { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.5rem; font-size: 0.875rem; }

/* ---- The week's card ----------------------------------------------- */

/* The card's own width, not the window's, picks the layout: the sidebar takes
   room on a laptop, so the card can be narrow on a wide window. */
.schedule-card {
  container: schedule / inline-size;
  background: #fff;
  border: 1px solid var(--schedule-edge);
  border-radius: 0.75rem;
  padding: 0 1.5rem 1.5rem;
}

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--schedule-ink);
}
.schedule-table th {
  text-align: left;
}
.schedule-table th,
.schedule-table td {
  vertical-align: middle;
}
.schedule-table thead th {
  padding: 1.25rem 1.5rem 0.875rem 0;
  border-bottom: 1px solid var(--schedule-line);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--schedule-faint);
}
.schedule-table thead th:last-child { padding-right: 0; }
.schedule-table th.schedule-table__status { text-align: right; }

/* Each day's heading: 36px above, 12px below. */
.schedule-day__heading th {
  padding: 2.25rem 0 0.75rem;
}
.schedule-day__heading h2 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--schedule-ink);
}
.schedule-day__count {
  margin-left: 0.5rem;
  font-weight: 400;
  color: var(--schedule-muted);
}
.schedule-day__weekday--narrow { display: none; }

.schedule-day__empty td {
  padding: 0.5rem 0 0.75rem;
  color: var(--schedule-faint);
}

/* A row of the day. The time, type, planned, status and pencil columns take
   only the room they need; the client and the DSP share the rest. */
.schedule-row > td {
  padding: 0.875rem 1.5rem 0.875rem 0;
  border-bottom: 1px solid var(--schedule-line);
  font-size: 0.9375rem;
}
.schedule-row > td:last-child { padding-right: 0; }
.schedule-row__time,
.schedule-row__type,
.schedule-row__planned,
.schedule-row__status,
.schedule-row__edit { width: 1%; white-space: nowrap; }
.schedule-row__time { color: var(--schedule-muted); }
.schedule-row__client { font-weight: 600; }
.schedule-row__dsp { color: #4b5563; }
.schedule-row__planned { font-weight: 600; font-variant-numeric: tabular-nums; }
.schedule-row__planned--none { color: var(--schedule-muted); }
.schedule-row__status { text-align: right; }
.schedule-row__edit { text-align: right; }
.schedule-time--narrow { display: none; }

.schedule-row__pencil {
  display: inline-flex;
  color: #9ca3af;
}
.schedule-row__pencil svg { width: 1.125rem; height: 1.125rem; }
.schedule-row__pencil:hover { color: var(--schedule-ink); }

/* An open shift (no DSP yet) is washed red with a red dot before the
   client; a clock-in nobody planned is washed amber with an amber dot. They
   are the two rows the office is looking for. */
.schedule-row--open > td { background: var(--schedule-open-wash); border-bottom-color: transparent; }
.schedule-row--not-planned > td { background: var(--schedule-unplanned-wash); border-bottom-color: transparent; }
.schedule-row--open > td:first-child,
.schedule-row--not-planned > td:first-child { border-radius: 0.5rem 0 0 0.5rem; padding-left: 0.75rem; }
.schedule-row--open > td:last-child,
.schedule-row--not-planned > td:last-child { border-radius: 0 0.5rem 0.5rem 0; padding-right: 0.75rem; }
.schedule-row--open .schedule-row__client::before,
.schedule-row--not-planned .schedule-row__client::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.625rem;
  border-radius: 9999px;
  vertical-align: middle;
  background: var(--schedule-open-dot);
}
.schedule-row--not-planned .schedule-row__client::before { background: var(--schedule-unplanned-dot); }

.schedule-row__no-dsp {
  display: none;
  color: var(--schedule-red);
  font-weight: 600;
}
.schedule-row__picker { min-width: 14rem; }
.schedule-row__assign { display: inline; }

/* Status words, in the dashboard's colours. */
.schedule-status { font-weight: 600; }
.schedule-status--done,
.schedule-status--planned,
.schedule-status--not-covered,
.schedule-status--starts-today { font-weight: 400; color: var(--schedule-muted); }
.schedule-status--in-progress { color: var(--schedule-green); }
.schedule-status--ended-early,
.schedule-status--note-missing,
.schedule-status--late,
.schedule-status--not-planned,
.schedule-status--cover-asked { color: var(--schedule-amber); }
.schedule-status--never-clocked-in { color: var(--schedule-red); }

.schedule-table tr[hidden] { display: none !important; }

/* "Show earlier days (Mon – Wed)": the days already over this week wait,
   folded, above today. */
.schedule-table tbody[hidden] { display: none !important; }
.schedule-earlier td {
  padding: 1rem 0 0.25rem;
  text-align: center;
}
.schedule-earlier__toggle {
  font-weight: 600;
  color: var(--schedule-green);
  cursor: pointer;
  padding: 0.5rem 1rem;
  border: 1px dashed currentColor;
  border-radius: 999px;
}
.schedule-earlier__toggle:hover { text-decoration: underline; }

/* ---- A card too narrow for the table ------------------------------- */

/* Each shift becomes a block of its own: no column headings, and the
   planned column waits for a wider card. On a medium card the time sits on
   the left over two lines, the client over the DSP in the middle, and the
   status over the type on the right. */
@container schedule (max-width: 63.99rem) {
  .schedule-table thead { display: none; }
  .schedule-table tbody,
  .schedule-table tr,
  .schedule-table th,
  .schedule-table td { display: block; }

  .schedule-table .schedule-row {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr) auto 1.5rem;
    grid-template-areas:
      "time client status edit"
      "time dsp    type   edit";
    column-gap: 1rem;
    row-gap: 0.25rem;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--schedule-line);
  }
  .schedule-table .schedule-row > td {
    width: auto;
    padding: 0;
    border-bottom: 0;
    border-radius: 0;
    background: none;
  }
  .schedule-row__time { grid-area: time; white-space: normal; }
  .schedule-row__client { grid-area: client; }
  .schedule-row__dsp { grid-area: dsp; }
  .schedule-row__type { grid-area: type; justify-self: end; }
  .schedule-row__status { grid-area: status; justify-self: end; }
  .schedule-row__edit { grid-area: edit; }
  .schedule-table .schedule-row__planned { display: none; }

  .schedule-table .schedule-row--open,
  .schedule-table .schedule-row--not-planned {
    margin: 0.25rem 0;
    padding: 0.75rem;
    border-bottom: 0;
    border-radius: 0.5rem;
  }
  .schedule-table .schedule-row--open { background: var(--schedule-open-wash); }
  .schedule-table .schedule-row--not-planned { background: var(--schedule-unplanned-wash); }

  .schedule-row__no-dsp { display: block; }
  .schedule-row__picker { width: 100%; min-width: 0; margin-top: 0.375rem; }
}

/* ---- The week on a phone ------------------------------------------- */

@media (max-width: 639px) {
  .schedule-card { padding: 0 1rem 1rem; }
}

/* Client and the pencil on the first line, then the time, the DSP, and the
   type pill left with the status right. */
@container schedule (max-width: 35.99rem) {
  .schedule-day__heading th { padding: 1.5rem 0 0.5rem; }
  .schedule-day__heading h2 { font-size: 0.8125rem; }
  .schedule-day__weekday--wide { display: none; }
  .schedule-day__weekday--narrow { display: inline; }

  .schedule-table .schedule-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "client edit"
      "time time"
      "dsp dsp"
      "type status";
    border-bottom: 0;
  }
  .schedule-row__type { justify-self: start; margin-top: 0.25rem; }
  .schedule-row__status { margin-top: 0.25rem; font-size: 0.875rem; white-space: normal; text-align: right; }
  .schedule-time--wide { display: none; }
  .schedule-time--narrow { display: inline; }

}

/* ---- By day | By DSP | By client ----------------------------------- */

/* The group choices on the left, the way to show the week on the right;
   the second drops under the first when they don't fit side by side. */
.schedule-choices {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  column-gap: 1.5rem;
}

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

/* A row for each person, a column for each day. The name column is fixed
   and the days share the rest evenly, so the grid never runs wider than
   its card. */
.schedule-grid {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  color: var(--schedule-ink);
}
.schedule-grid th,
.schedule-grid td {
  text-align: left;
  vertical-align: top;
}
.schedule-grid thead th {
  padding: 1.25rem 0.375rem 0.75rem;
  border-bottom: 1px solid var(--schedule-line);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--schedule-faint);
}
.schedule-grid thead th:first-child { padding-left: 0; }
.schedule-grid__who { width: 11rem; }
.schedule-grid__weekday { margin-right: 0.25rem; }
.schedule-grid__date--today { color: var(--schedule-green); }
.schedule-grid__date--today .schedule-grid__day {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0 0.375rem;
  border-radius: 9999px;
  background: var(--schedule-green);
  color: #fff;
  text-align: center;
}

.schedule-grid__row > th,
.schedule-grid__row > td {
  padding: 0.625rem 0.375rem;
  border-bottom: 1px solid var(--schedule-line);
}
.schedule-grid__row > th { padding-left: 0; padding-right: 1rem; }
.schedule-grid__row--open > th,
.schedule-grid__row--open > td { background: var(--schedule-open-wash); }
.schedule-grid__row--open > th { padding-left: 0.75rem; }
/* A DSP's own row on their Team week. */
.schedule-grid__row--yours .schedule-grid__name { color: var(--schedule-green); }

.schedule-grid__name {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.schedule-grid__count,
.schedule-grid__free {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--schedule-muted);
}
.schedule-grid__free { color: var(--schedule-faint); }

/* The day's name in front of a day's shifts, for the phone's cards. */
.schedule-grid__cell-day { display: none; }

/* A shift: its hours, then the other person, then a word if it needs a look. */
.schedule-grid__shift {
  display: block;
  margin-bottom: 0.375rem;
  padding: 0.375rem 0.5rem;
  border-left: 3px solid var(--schedule-green);
  border-radius: 0.375rem;
  background: #eef5f0;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--schedule-ink);
}
.schedule-grid__shift:last-child { margin-bottom: 0; }
a.schedule-grid__shift:hover { background: #e1efe6; }
a.schedule-grid__shift:focus-visible { outline: 2px solid var(--schedule-green); outline-offset: 2px; }
.schedule-grid__time {
  display: block;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.schedule-grid__with {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.schedule-grid__shift .schedule-status {
  display: block;
  font-size: 0.75rem;
}
.schedule-status--open { color: var(--schedule-red); }

.schedule-grid__shift--open,
.schedule-grid__shift--not-covered,
.schedule-grid__shift--never-clocked-in {
  border-left-color: var(--schedule-open-dot);
  background: var(--schedule-open-wash);
}
a.schedule-grid__shift--open:hover,
a.schedule-grid__shift--not-covered:hover,
a.schedule-grid__shift--never-clocked-in:hover { background: #f5cccc; }
.schedule-grid__shift--cover-asked,
.schedule-grid__shift--late,
.schedule-grid__shift--not-planned {
  border-left-color: var(--schedule-unplanned-dot);
  background: var(--schedule-unplanned-wash);
}
a.schedule-grid__shift--cover-asked:hover,
a.schedule-grid__shift--late:hover { background: #f3e2bd; }
.schedule-grid__row--open .schedule-grid__shift { background: #fff; }

/* A day the DSP asked to have off. */
.schedule-grid__off {
  display: block;
  margin-bottom: 0.375rem;
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  background: repeating-linear-gradient(135deg, #f1efeb 0 6px, #e9e6e0 6px 12px);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #4b5563;
}
.schedule-grid__off:last-child { margin-bottom: 0; }

/* What else the office should know about a DSP's day: asked off (amber),
   doesn't usually work (grey, and the whole day greyed), or the hours they
   usually work (quiet). */
.schedule-grid__note {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--schedule-muted);
}
.schedule-grid__note--asked { color: var(--schedule-amber); }
.schedule-grid__note--usual { font-weight: 500; color: var(--schedule-faint); }
.schedule-grid__cell--away { background: repeating-linear-gradient(135deg, #f6f4f0 0 6px, #efece6 6px 12px); }
.schedule-grid__cell--away .schedule-grid__plan { background: transparent; }

/* + on an empty day still ahead: plan a shift for this person, this day. */
.schedule-grid__plan {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border: 1px dashed var(--schedule-edge);
  border-radius: 0.375rem;
  font-size: 1.25rem;
  color: var(--schedule-faint);
}
.schedule-grid__plan:hover,
.schedule-grid__plan:focus-visible {
  border-color: var(--schedule-green);
  color: var(--schedule-green);
}

.schedule-grid__nobody {
  padding: 1.5rem 0;
  color: var(--schedule-faint);
}

/* A medium card: a narrower name column and tighter shifts, so each day
   keeps its room. */
@container schedule (max-width: 63.99rem) {
  .schedule-grid__who { width: 7rem; }
  .schedule-grid__row > td { padding: 0.5rem 0.1875rem; }
  .schedule-grid thead th { padding-left: 0.1875rem; padding-right: 0.1875rem; }
  .schedule-grid__shift { padding: 0.25rem 0.375rem; font-size: 0.75rem; }
  .schedule-grid__shift .schedule-status { font-size: 0.6875rem; }
}

/* A phone: each person is a card listing only the days they are on. The
   green Plan a shift button above stays the way to plan one. */
@container schedule (max-width: 39.99rem) {
  .schedule-grid,
  .schedule-grid tbody,
  .schedule-grid tr,
  .schedule-grid th,
  .schedule-grid td { display: block; width: auto; }
  .schedule-grid thead { display: none; }

  .schedule-grid__row { padding: 1rem 0; border-bottom: 1px solid var(--schedule-line); }
  .schedule-grid__row > th,
  .schedule-grid__row > td { padding: 0; border-bottom: 0; background: none; }
  .schedule-grid__row--open {
    margin-top: 1rem;
    padding: 0.75rem;
    border-bottom: 0;
    border-radius: 0.5rem;
    background: var(--schedule-open-wash);
  }
  .schedule-grid__row--open > th,
  .schedule-grid__row--open > td { padding: 0; background: none; }

  .schedule-grid__cell { margin-top: 0.625rem; }
  .schedule-grid .schedule-grid__cell--empty { display: none; }
  .schedule-grid__cell-day {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--schedule-muted);
  }
  .schedule-grid__shift { font-size: 0.875rem; }
}

/* ---- Plan a shift / Edit shift ------------------------------------- */

.plan-shift-page__heading { margin-bottom: 1.5rem; }
.plan-shift-page__back {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-weight: 600;
  color: var(--schedule-green);
}
.plan-shift-page__title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--schedule-ink);
}
@media (min-width: 768px) {
  .plan-shift-page__title { font-size: 2rem; }
}
.plan-shift-page__subtitle {
  margin-top: 0.25rem;
  color: var(--schedule-muted);
}

/* A 640px white card, left-aligned. */
.plan-shift-card {
  max-width: 40rem;
  background: #fff;
  border: 1px solid var(--schedule-edge);
  border-radius: 0.75rem;
  padding: 1.5rem;
}
@media (min-width: 768px) {
  .plan-shift-card { padding: 2rem; }
}

.plan-shift { display: flex; flex-direction: column; gap: 1.25rem; }
.plan-shift__field { display: flex; flex-direction: column; }
.plan-shift__label {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--schedule-ink);
}
.plan-shift__hint {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--schedule-faint);
}

/* Date | Start | End on one row; Date, then Start | End, on a phone. */
.plan-shift__when {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.plan-shift__field--date { grid-column: 1 / -1; }
@media (min-width: 640px) {
  .plan-shift__when { grid-template-columns: 1fr 1fr 1fr; }
  .plan-shift__field--date { grid-column: auto; }
}

/* The session type as three pills; the chosen one is green. */
.plan-shift__types { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.plan-shift__type {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--schedule-edge);
  border-radius: 9999px;
  font-weight: 600;
  color: #4b5563;
  cursor: pointer;
}
.plan-shift__type:has(:checked) {
  border-color: var(--schedule-green);
  background: #eaf4ee;
  color: var(--schedule-green);
}
.plan-shift__type:has(:focus-visible) { outline: 2px solid var(--schedule-green); outline-offset: 2px; }
.plan-shift__hours {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--schedule-faint);
}
.plan-shift__hours:empty { display: none; }
.plan-shift__length .plan-shift__hours { color: var(--schedule-ink); font-weight: 600; }
.plan-shift__bar {
  height: 0.5rem;
  margin-top: 0.375rem;
  overflow: hidden;
  background: #e7e2d9;
  border-radius: 999px;
}
.plan-shift__bar-fill {
  display: block;
  height: 100%;
  background: var(--schedule-green);
  border-radius: 999px;
}
.plan-shift__bar--over .plan-shift__bar-fill { background: #b42318; }
.plan-shift__limit {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--schedule-faint);
}
.plan-shift__length:has(.plan-shift__bar--over) .plan-shift__limit { color: #b42318; font-weight: 600; }

.plan-shift__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--schedule-edge);
}
.plan-shift__delete {
  margin-right: auto;
  font-weight: 600;
  color: var(--schedule-red);
  cursor: pointer;
}
.plan-shift__delete:hover { text-decoration: underline; }

/* On a phone the green button fills the width, with Cancel centred under it
   and the delete under that. */
@media (max-width: 639px) {
  .plan-shift-page__subtitle-lead { display: none; }
  .plan-shift__hint { display: none; }
  .plan-shift__actions { flex-direction: column-reverse; align-items: stretch; gap: 0.5rem; }
  .plan-shift__save { width: 100%; }
  .plan-shift__cancel { width: 100%; }
  .plan-shift__delete { margin: 0.5rem auto 0; }
}

/* ---- Repeat every week ------------------------------------------- */

/* The last day only matters for a shift that repeats. */
.plan-shift__repeat-until { display: none; margin-top: 0.75rem; }
.plan-shift__repeat:has(input[value="weekly"]:checked) .plan-shift__repeat-until { display: block; }
.plan-shift__repeats {
  margin-top: 1rem;
  font-size: 0.9375rem;
  color: var(--schedule-muted);
}
.plan-shift__stop-repeat-form { margin-top: 1rem; }
.plan-shift__stop-repeat {
  min-height: 2.75rem;
  font-weight: 600;
  color: var(--schedule-amber);
}
.plan-shift__stop-repeat:hover { text-decoration: underline; }

/* A shift that comes from a repeat, on the week grid. */
.schedule-grid__weekly {
  margin-left: 0.25rem;
  font-weight: 400;
  color: var(--schedule-muted);
}

/* ---- Who is free, in the shift form's DSP list --------------------- */

/* Each name: a coloured dot, the name, and a few words. Green is free,
   amber is outside their usual hours or asked off, red is busy or off. */
.dsp-standing {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dsp-standing__dot {
  display: inline-block;
  flex: none;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 999px;
  background: var(--schedule-faint);
}
.dsp-standing__name { flex: 1 1 auto; min-width: 0; }
.dsp-standing__words {
  flex: none;
  font-size: 0.8125rem;
  color: var(--schedule-muted);
}
.dsp-standing--free .dsp-standing__dot, .dsp-standing__dot.dsp-standing--free { background: var(--schedule-green); }
.dsp-standing--outside .dsp-standing__dot, .dsp-standing--asked .dsp-standing__dot,
.dsp-standing__dot.dsp-standing--outside { background: #d4a017; }
.dsp-standing--busy .dsp-standing__dot, .dsp-standing--off .dsp-standing__dot,
.dsp-standing__dot.dsp-standing--busy { background: var(--schedule-red); }
.dsp-standing--busy .dsp-standing__words, .dsp-standing--off .dsp-standing__words { color: var(--schedule-red); }
.dsp-standing__key { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.dsp-standing__key[hidden] { display: none; }


/* ---- Moving a shift by dragging it --------------------------------- */

/* Only where a mouse can drag: a computer or a tablet with a pointer. */
.schedule-grid__drag-hint {
  display: none;
  margin: 0 0 0.75rem;
  font-size: 0.875rem;
  color: var(--schedule-muted);
}
@media (hover: hover) and (pointer: fine) and (min-width: 768px) {
  .schedule-grid__drag-hint { display: block; }
  .schedule-grid__shift[draggable="true"] { cursor: grab; }
}
/* While a shift is dragged it fades, the days it can land on show a dashed
   green edge, and the day under it fills light green. */
.schedule-grid__shift--dragging { opacity: 0.45; }
.schedule-grid--dragging td[data-date] { outline: 1px dashed #b9d8c5; outline-offset: -3px; }
.schedule-grid--dragging td.schedule-grid__cell--drop { background: #eaf4ee; outline: 2px dashed var(--schedule-green); }
/* Sent: it waits, faded, until the page comes back. */
.schedule-grid__shift--moving { opacity: 0.45; pointer-events: none; }


/* ---- Overlaps ------------------------------------------------------- */

/* A shift planned on top of another: a light red wash, a red edge, and the
   word Overlaps, on the grid and in the day list. */
.schedule-grid__shift--overlap,
a.schedule-grid__shift--overlap {
  background: #fde8e8;
  border-left-color: var(--schedule-red);
}
a.schedule-grid__shift--overlap:hover { background: #fbd5d5; }
.schedule-row--overlap { background: #fdf0f0; }
.schedule-overlap {
  display: inline-block;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--schedule-red);
}
.schedule-row--overlap .schedule-overlap { display: block; }
/* Publish waits: what to fix, in a short list. */
.schedule-publish__overlaps ul { margin: 0.375rem 0 0; padding-left: 1.25rem; list-style: disc; }
.schedule-publish__overlaps li { margin-top: 0.25rem; }
.schedule-publish__button[disabled] { opacity: 0.5; cursor: not-allowed; }


/* On the Schedule a note (Moved, Copied, Heads up) never gets in the way:
   a click or a dropped shift goes through it to the bar or the day under
   it, and only its × closes it. */
body:has(.schedule-toolbar) #flash_messages { pointer-events: none; }
body:has(.schedule-toolbar) #flash_messages .flash-message button { pointer-events: auto; }

/* The client called out of this shift: where the call-out pay stands, or
   a short form for the office to add it. */
.plan-shift-call-out {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--schedule-line, #e5e7eb);
}
.plan-shift-call-out__title { font-weight: 600; cursor: default; }
summary.plan-shift-call-out__title { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; }
.plan-shift-call-out__status, .plan-shift-call-out__note, .plan-shift-call-out__help { margin-top: 0.375rem; font-size: 0.9375rem; color: var(--schedule-muted); }
.plan-shift-call-out__form { display: grid; gap: 0.75rem; margin-top: 0.5rem; }
.plan-shift-call-out__form label { display: grid; gap: 0.25rem; font-size: 0.875rem; }
.plan-shift-call-out__remove { margin-top: 0.5rem; min-height: 2.75rem; }
