/* Chill Flow · Ollie palette, with the schedule kept as a working surface. */
:root {
  --cream: #f7f4eb;
  --surface: #fffef9;
  --deep: #304c3d;
  --deeper: #243c30;
  --sage: #91a084;
  --ollie: #ad7449;
  --ink: #2c3b31;
  --ink2: #586456;
  --ink3: #64705f;
  --linen: #edf0e5;
  --line: #d5dacc;
  --line2: #e4e7dc;
  --surface-hover: #eef2e7;
  --focus: #304c3d;
  --ff: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Shared shell: color and emphasis only; navigation dimensions stay unchanged. */
body {
  background-color: var(--cream);
}

.sidebar {
  background: #eaeedf;
}

.sb-head .t {
  color: var(--deep);
  font-weight: 750;
}

.nav a {
  font-weight: 550;
}

.nav a.on {
  background: var(--deep);
  color: var(--surface);
  font-weight: 650;
}

.topbar {
  background: var(--cream);
}

/* An unboxed title and Ollie are the brand signature. */
.content[data-route="schedule"] .op-head {
  padding: 0;
  margin-bottom: 18px;
  border: 0;
  background: transparent;
}

.op-schedule-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
}

.op-heading-copy {
  min-width: 0;
}

.op-heading-copy h3 {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 720;
  letter-spacing: -.6px;
  line-height: 1.3;
  color: var(--deep);
}

.op-heading-copy p {
  margin: 0;
  color: var(--ink2);
  font-size: 14px;
  line-height: 1.65;
}

.op-brand-ollie {
  display: block;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  object-fit: contain;
}

/* Date navigation has one continuous rhythm and a quiet view switch. */
.content[data-route="schedule"] .op-head .op-toolbar {
  margin: 12px 0 0;
  gap: 8px;
  align-items: center;
}

.content[data-route="schedule"] .op-head .op-toolbar label {
  margin-left: 6px;
  font-size: 13px;
  color: var(--ink2);
}

.content[data-route="schedule"] #opPrev,
.content[data-route="schedule"] #opNext {
  width: 44px;
  padding: 8px;
  font-size: 20px;
  line-height: 1;
  color: var(--deep);
}

.content[data-route="schedule"] #opAnchor {
  width: 162px;
  min-height: 44px;
  background: var(--surface);
  border-color: var(--line);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.op-view-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  margin-left: auto;
  border-radius: 10px;
  background: #e8ecdf;
}

.content[data-route="schedule"] .op-view-switch .pill {
  min-width: 50px;
  min-height: 44px;
  padding: 8px 13px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink2);
  font-weight: 600;
}

.content[data-route="schedule"] .op-view-switch .pill.on {
  background: var(--surface);
  color: var(--deep);
  box-shadow: 0 1px 3px #304c3d12;
}

/* Context and actions sit beside the table instead of becoming another card. */
#opScheduleBody .op-schedule-intro {
  padding: 0;
  margin-bottom: 16px;
  background: transparent;
  border: 0;
}

#opScheduleBody .op-schedule-intro .op-title {
  gap: 12px 20px;
  align-items: center;
}

#opScheduleBody .op-schedule-intro h3 {
  margin: 0 0 5px;
  font-size: 20px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

#opScheduleBody .op-schedule-intro .cd {
  font-size: 14px;
}

#opScheduleBody .op-simple-actions {
  gap: 8px;
}

#opScheduleBody .op-simple-actions > .pill,
#opScheduleBody .op-more > summary {
  color: var(--deep);
  font-weight: 600;
}

#opScheduleBody .op-more-content {
  box-shadow: 0 12px 36px #304c3d1f;
}

#opScheduleBody .op-unfinished {
  padding: 12px 14px;
  border: 1px solid #d9c8ab;
  border-radius: 10px;
  background: #faf1df;
  color: #6b512f;
}

#opScheduleBody .op-saved {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 0;
  color: var(--deep);
  font-size: 14px;
}

/* A compact week header keeps the seven-day grid close to its context. */
#opScheduleBody .op-week {
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.op-week-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 0 2px 12px;
}

.op-week-heading h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.op-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--ink2);
}

.op-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.op-legend > span::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 1px solid #9aaf87;
  border-radius: 3px;
  background: #dbe7cd;
}

.op-legend > .rest::before {
  border-color: #cbcfc4;
  background: #f0f0e9;
}

.op-legend > .leave::before {
  border-color: #d5b590;
  background: #f5e7d4;
}

#opScheduleBody .op-week-scroll {
  border: 1px solid var(--line2);
  border-radius: 10px;
}

#opScheduleBody .op-grid {
  min-width: 600px;
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}

#opScheduleBody .op-grid th,
#opScheduleBody .op-grid td {
  padding: 6px;
  border-bottom-color: var(--line2);
}

#opScheduleBody .op-grid th:first-child {
  width: 96px;
  padding-left: 12px;
  vertical-align: middle;
}

#opScheduleBody .op-grid thead th,
#opScheduleBody .op-grid thead th:first-child {
  padding-top: 8px;
  padding-bottom: 8px;
  background: #f0f2e9;
  color: var(--ink2);
  text-align: center;
}

#opScheduleBody .op-grid thead th:first-child {
  text-align: left;
}

#opScheduleBody .op-grid tbody th:first-child {
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 650;
}

#opScheduleBody .op-grid tbody th small {
  margin-top: 4px;
  color: var(--ink3);
  font-size: 11px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

#opScheduleBody .op-grid tbody tr:hover td {
  background: #f7f8f1;
}

.op-date-weekday {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.op-date-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 30px;
  margin-top: 3px;
  padding: 2px 5px;
  border-radius: 7px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

#opScheduleBody .op-grid thead th.is-today {
  background: #e7ecdd;
}

.is-today .op-date-number {
  background: var(--deep);
  color: var(--surface);
}

/* Every kind has text as well as color; the cell itself remains the edit target. */
#opScheduleBody .op-cell {
  display: block;
  min-height: 76px;
  padding: 9px 7px;
  background: #f5f5ef;
  border: 1px solid #dce0d3;
  border-radius: 8px;
  color: var(--ink);
  text-align: center;
  transition: border-color .14s, background-color .14s;
}

#opScheduleBody .op-cell.work,
#opScheduleBody .op-day-row.work {
  background: #eaf0e2;
  border-color: #c8d6ba;
  color: #304c3d;
}

#opScheduleBody .op-cell.rest,
#opScheduleBody .op-day-row.rest {
  background: #f3f3ed;
  border-color: #e0e2d8;
  color: #586456;
}

#opScheduleBody .op-cell.leave,
#opScheduleBody .op-day-row.leave {
  background: #faf0df;
  border-color: #e3cdaa;
  color: #75552f;
}

#opScheduleBody .op-cell.unassigned,
#opScheduleBody .op-day-row.unassigned {
  background: var(--surface);
  border-style: dashed;
  color: var(--ink3);
}

/* Empty arrangements need a clear touch target, without a full shift's height. */
#opScheduleBody .op-cell.unassigned {
  min-height: 52px;
}

#opScheduleBody .op-cell.is-changed,
#opScheduleBody .op-day-row.is-changed {
  border-color: var(--deep);
  box-shadow: inset 0 0 0 1px var(--deep);
}

#opScheduleBody .op-cell:not(:disabled):hover,
#opScheduleBody .op-day-row:not(:disabled):hover {
  border-color: var(--deep);
  box-shadow: inset 0 0 0 1px var(--deep);
}

#opScheduleBody .op-cell:focus-visible,
#opScheduleBody .op-day-row:focus-visible {
  outline: 3px solid var(--deep);
  outline-offset: 2px;
}

.op-shift-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.op-shift-item + .op-shift-item {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #304c3d26;
}

.op-shift-kind {
  font-size: 12px;
  font-weight: 550;
  line-height: 1.4;
}

.op-shift-time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 14px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.op-shift-time b {
  font-weight: 650;
  white-space: nowrap;
}

.op-shift-time i {
  font-style: normal;
  font-size: 11px;
  opacity: .7;
}

.op-shift-meta {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.op-shift-empty {
  display: inline-block;
  font-size: 13px;
  line-height: 1.5;
}

/* Keep the existing fixed positioning: on phones it already clears the tab bar. */
#opScheduleBody .op-save-bar {
  border-top-color: #bdcbb2;
  background: var(--surface);
  box-shadow: 0 -6px 24px #304c3d0d;
}

#opScheduleBody .op-save-state {
  color: var(--ink);
  font-size: 14px;
}

#opScheduleBody .op-save-actions .pill {
  min-height: 48px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 650;
}

#opScheduleBody #opSave {
  min-width: 150px;
  background: var(--deep);
  border-color: var(--deep);
  color: var(--surface);
}

#opScheduleBody #opSave:hover:not(:disabled) {
  background: var(--deeper);
}

#opScheduleBody .op-calendar-details {
  border-color: var(--line2);
  background: transparent;
}

#opScheduleBody .op-calendar-details > summary {
  font-size: 13px;
}

#opScheduleBody .op-checks {
  padding: 18px 2px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

#opScheduleBody .op-checks h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--ink);
}

#opScheduleBody .op-checks .cd {
  margin: 0;
  font-size: 13px;
}

/* Editing a shift is a short form, with optional fields kept in their disclosure. */
#modal:has(#ocKind) .mbox {
  max-width: 560px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

#modal:has(#ocKind) .mhead {
  min-height: 66px;
  padding: 14px 24px;
  color: var(--deep);
  font-size: 19px;
  font-weight: 650;
}

#modal:has(#ocKind) .mbody {
  padding: 18px 24px;
}

#modal:has(#ocKind) .op-field {
  margin: 0 0 18px;
  gap: 8px;
  font-size: 14px;
  color: var(--ink);
}

#modal:has(#ocKind) .op-field input,
#modal:has(#ocKind) .op-field select,
#modal:has(#ocKind) .op-field textarea {
  min-height: 48px;
  font-size: 16px;
  background: #fff;
  border-color: #c8d0be;
}

#modal:has(#ocKind) .op-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

#modal:has(#ocKind) .op-cell-settings {
  margin-top: 0;
  padding-top: 4px;
  border-top-color: var(--line2);
}

#modal:has(#ocKind) .op-cell-settings summary {
  color: var(--ink2);
  font-size: 14px;
  line-height: 1.6;
}

#modal:has(#ocKind) .op-hint {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.65;
}

#modal:has(#ocKind) .mfoot {
  padding: 14px 24px;
  background: #f2f4eb;
}

#modal:has(#ocKind) .mfoot .pill,
#modal:has(#ocKind) .mfoot .btn {
  min-height: 48px;
  padding: 10px 22px;
  font-size: 15px;
}

/* Portrait tablets retain all seven dates without shrinking touch targets. */
@media (min-width: 768px) and (max-width: 1100px) {
  .content[data-route="schedule"] {
    padding: 22px 18px 40px;
  }

  #opScheduleBody .op-week {
    padding: 12px;
  }

  #opScheduleBody .op-grid th:first-child {
    width: 86px;
    padding-left: 8px;
  }

  #opScheduleBody .op-grid th,
  #opScheduleBody .op-grid td {
    padding: 5px;
  }

  #opScheduleBody .op-cell {
    padding: 8px 4px;
  }

  #opScheduleBody .op-cell .op-shift-time {
    font-size: 13px;
  }

  #opScheduleBody .op-cell .op-shift-meta {
    font-size: 11px;
  }
}

@media (min-width: 768px) and (max-width: 900px) {
  #opScheduleBody .op-cell {
    min-height: 92px;
  }

  #opScheduleBody .op-cell .op-shift-time {
    flex-direction: column;
    gap: 0;
    font-size: 14px;
    line-height: 1.5;
  }

  #opScheduleBody .op-cell .op-shift-time i {
    display: none;
  }

  #opScheduleBody .op-cell .op-shift-time b:last-child::before {
    content: "– ";
    font-size: 11px;
    font-weight: 400;
  }
}

/* Phones use the existing day list; date selection and primary actions stay large. */
@media (max-width: 767px) {
  .content[data-route="schedule"] {
    padding: 20px 16px calc(100px + env(safe-area-inset-bottom));
  }

  .content[data-route="schedule"] .op-head {
    margin-bottom: 18px;
    padding-bottom: 0;
  }

  .op-schedule-heading {
    gap: 12px;
    min-height: 68px;
  }

  .op-heading-copy h3 {
    margin-bottom: 5px;
    font-size: 26px;
  }

  .op-heading-copy p {
    font-size: 13px;
  }

  .op-brand-ollie {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
  }

  .content[data-route="schedule"] .op-head .op-toolbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
    margin-top: 18px;
  }

  .content[data-route="schedule"] .op-head .op-toolbar > label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .content[data-route="schedule"] #opAnchor {
    width: 100%;
    min-width: 0;
    text-align: center;
  }

  .op-view-switch {
    grid-column: 1 / -1;
    justify-self: start;
    margin-left: 0;
    margin-top: 2px;
  }

  .content[data-route="schedule"] .op-view-switch .pill {
    min-width: 56px;
  }

  #opScheduleBody .op-schedule-intro {
    margin-bottom: 16px;
  }

  #opScheduleBody .op-schedule-intro .op-title {
    gap: 10px;
  }

  #opScheduleBody .op-schedule-intro .op-title > div:first-child {
    flex: 1 1 100%;
  }

  #opScheduleBody .op-schedule-intro h3 {
    font-size: 19px;
  }

  #opScheduleBody .op-schedule-intro .cd {
    font-size: 13px;
  }

  #opScheduleBody .op-simple-actions {
    margin-left: 0;
  }

  #opScheduleBody .op-week {
    padding: 14px;
    border-radius: 12px;
  }

  .op-week-heading {
    gap: 8px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--line2);
  }

  .op-week-heading h3 {
    font-size: 14px;
  }

  .op-legend {
    gap: 9px;
    font-size: 11px;
  }

  #opScheduleBody .op-day-list section {
    padding: 16px 0 14px;
  }

  #opScheduleBody .op-day-list section:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  #opScheduleBody .op-day-list h4 {
    margin: 0 0 9px;
    font-size: 14px;
    color: var(--ink2);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  #opScheduleBody .op-day-row {
    gap: 12px;
    min-height: 68px;
    padding: 11px 12px;
    margin: 7px 0;
    border-radius: 9px;
    color: var(--ink);
  }

  #opScheduleBody .op-day-row > b {
    min-width: 0;
    flex: 1;
    font-size: 15px;
    font-weight: 650;
    overflow-wrap: anywhere;
  }

  .op-day-shifts {
    display: flex;
    flex: 0 1 64%;
    flex-direction: column;
    min-width: 0;
  }

  .op-day-shifts .op-shift-item {
    align-items: flex-end;
    gap: 3px;
  }

  .op-day-shifts .op-shift-time {
    flex-direction: row;
    gap: 4px;
    font-size: 16px;
  }

  .op-day-shifts .op-shift-time i {
    display: inline;
  }

  .op-day-shifts .op-shift-kind {
    font-size: 12px;
  }

  .op-day-shifts .op-shift-meta {
    font-size: 12px;
  }

  #opScheduleBody .op-save-state {
    font-size: 13px;
  }

  #opScheduleBody .op-save-actions .pill {
    padding: 10px 12px;
    font-size: 15px;
  }

  #opScheduleBody #opSave {
    min-width: 0;
  }

  #modal:has(#ocKind) .mhead,
  #modal:has(#ocKind) .mbody,
  #modal:has(#ocKind) .mfoot {
    padding-left: 18px;
    padding-right: 18px;
  }

  #modal:has(#ocKind) .mhead {
    font-size: 18px;
  }

  #modal:has(#ocKind) .op-form-grid {
    gap: 10px;
  }

  #modal:has(#ocKind) .mfoot .pill,
  #modal:has(#ocKind) .mfoot .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  #opScheduleBody .op-cell,
  #opScheduleBody .op-day-row {
    transition: none;
  }
}

@media print {
  .op-brand-ollie,
  .op-view-switch,
  #opScheduleBody .op-simple-actions,
  #opScheduleBody .op-save-bar {
    display: none !important;
  }

  #opScheduleBody .op-week {
    padding: 0;
    border: 0;
    break-inside: avoid;
  }
}
