.subtabs .subtab.svc-cal-open,
.subtabs .subtab.svc-cal-open.active {
  background: #ee5a22;
  color: #fff;
  font-weight: 800;
}

.svc-cal-view-btn {
  width: 100%;
  margin: 6px 0 12px;
  background: #ee5a22;
  color: #fff;
  font-weight: 800;
}

.svc-cal-summary h3 {
  margin: 12px 0 4px;
  font-size: 0.95rem;
  color: #0b2748;
}

.svc-cal-summary ul {
  margin: 0;
  padding-left: 18px;
}

.svc-cal-summary li {
  margin: 3px 0;
}

body.svc-cal-lock {
  overflow: hidden;
}

.svc-cal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: #f4efe8;
  display: flex;
  flex-direction: column;
  color: #0b2748;
}

.svc-cal-head {
  background: linear-gradient(90deg, #0b2748, #123a6b 70%, #ee5a22);
  color: #fff;
  padding: 10px 12px calc(10px + env(safe-area-inset-top, 0px));
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  gap: 10px;
}

.svc-cal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #fff;
  text-align: center;
  flex: 1;
}

.svc-cal-year {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.svc-cal-year button,
.svc-cal-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 10px;
  min-height: 38px;
  padding: 0 12px;
  font-weight: 800;
}

.svc-cal-year button {
  font-size: 1.4rem;
  line-height: 1;
  width: 42px;
  padding: 0;
}

.svc-cal-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 40px;
  -webkit-overflow-scrolling: touch;
}

.svc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.svc-legend .lg::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: -1px;
}

.svc-legend .service::before { background: #ee5a22; }
.svc-legend .inspection::before { background: #1f6fd1; }
.svc-legend .completed::before { background: #b9b2a8; }
.svc-legend .today::before { background: #fff; border: 2px solid #0b2748; }

.svc-cal-hint {
  margin: 6px 0;
  font-size: 0.85rem;
  color: #5d5650;
}

.svc-cal-upcoming {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.svc-up {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  background: #fff;
  color: #0b2748;
  border: 1px solid #e0d4c4;
  border-left: 5px solid #ee5a22;
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 0;
}

.svc-up.inspection { border-left-color: #1f6fd1; }
.svc-up.now { background: #fdecea; border-color: #c62828; border-left-color: #c62828; }
.svc-up span { font-size: 0.8rem; font-weight: 600; }

.svc-months {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.svc-month {
  background: #fff;
  border: 1px solid #e0d4c4;
  border-radius: 14px;
  padding: 10px;
  scroll-margin-top: 10px;
}

.svc-month h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.svc-week,
.svc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.svc-week span {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #8a8178;
}

.svc-day {
  position: relative;
  aspect-ratio: 1;
  min-height: 0;
  padding: 0;
  border-radius: 9px;
  border: 1px solid #ece3d7;
  background: #faf7f2;
  color: #0b2748;
  font-weight: 700;
  font-size: 0.85rem;
}

.svc-day.blank {
  border: 0;
  background: transparent;
}

.svc-day.past {
  color: #b5ada3;
  background: #f6f2ec;
}

.svc-day.today {
  border: 2px solid #0b2748;
  background: #fff;
}

.svc-day.booked {
  background: #ee5a22;
  border-color: #ee5a22;
  color: #fff;
}

.svc-day.booked.inspection {
  background: #1f6fd1;
  border-color: #1f6fd1;
}

.svc-day.booked.mixed {
  background: linear-gradient(135deg, #ee5a22 50%, #1f6fd1 50%);
}

.svc-day.completed {
  background: #ddd7cf;
  color: #5d5650;
}

.svc-day i {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  background: #0b2748;
  color: #fff;
  font-style: normal;
  font-size: 0.65rem;
  line-height: 17px;
}

.svc-sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 3100;
  background: rgba(11, 39, 72, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.svc-sheet {
  background: #fff;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
}

.svc-sheet header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.svc-sheet h3 {
  margin: 0;
  font-size: 1.05rem;
}

.svc-sheet-x {
  width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 1.5rem;
  background: #f4efe8;
  color: #0b2748;
  border-radius: 999px;
}

.svc-booked-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.svc-booked {
  border: 1px solid #e0d4c4;
  border-left: 5px solid #ee5a22;
  border-radius: 10px;
  padding: 8px 10px;
}

.svc-booked.inspection { border-left-color: #1f6fd1; }
.svc-booked.completed { border-left-color: #b9b2a8; opacity: 0.8; }
.svc-booked p { margin: 0 0 4px; }

.svc-booked-actions {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.svc-booked.clocked {
  border: 2px solid #6a2bb8;
  border-left: 6px solid #6a2bb8;
  background: #f4edff;
  box-shadow: 0 0 0 3px rgba(106, 43, 184, 0.15);
}

.svc-booked.clocked p:nth-child(2) {
  color: #4a1d86;
  font-weight: 800;
}

.svc-upload {
  background: #ee5a22;
  color: #fff;
  font-weight: 800;
}

.svc-docs-wrap {
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(8, 20, 38, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.svc-docs {
  background: #fff;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 14px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  text-align: left;
}

.svc-docs header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.svc-docs h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #0b2748;
}

.svc-docs-machine {
  margin: 0 0 8px;
  color: #4a1d86;
}

.svc-docs-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 8px 0;
}

.svc-docs .svc-docs-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0;
  border-radius: 12px;
  background: #0b2748;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.svc-docs .svc-docs-btn.alt {
  background: #f4efe8;
  color: #0b2748;
  border: 1px solid #e0d4c4;
}

.svc-docs-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}

.svc-docs-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid #efe6da;
  font-size: 0.85rem;
}

.svc-docs-list li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.svc-docs-list li button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.svc-docs .svc-note {
  display: block;
  margin: 8px 0;
}

.svc-docs .svc-note input {
  width: 100%;
}

.svc-docs .svc-book {
  width: 100%;
}

.svc-docs-ok {
  margin: 6px 0;
  color: #1b8a3a;
  font-weight: 800;
}

.brake-upload-btn {
  width: 100%;
  margin-top: 8px;
  background: #ee5a22;
  color: #fff;
  font-weight: 800;
}

.brake-pick {
  cursor: pointer;
}

.brake-pop-machine {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 6px;
  border: 1px solid #e0d4c4;
  border-radius: 12px;
  background: #fbf8f4;
}

.brake-pop-machine img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
}

.brake-pop-machine strong {
  font-size: 1.15rem;
  color: #0b2748;
}

.brake-pop-machine p {
  margin: 2px 0 0;
}

.brake-pop-step {
  margin: 12px 0 4px;
  font-weight: 800;
  color: #0b2748;
}

.brake-pop-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid #e0d4c4;
  border-radius: 10px;
}

.brake-pop-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.brake-pop-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.85rem;
}

.brake-pop .result-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.brake-pop input[type="date"] {
  width: 100%;
  min-height: 46px;
}

.svc-complete {
  width: 100%;
  min-height: 56px;
  background: #1b8a3a;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 800;
}

.svc-add h4 {
  margin: 4px 0;
}

.svc-machine-list {
  display: flex;
  flex-direction: column;
  border: 1px solid #e0d4c4;
  border-radius: 12px;
  max-height: 42vh;
  overflow-y: auto;
}

.svc-cal-overlay .svc-machine {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  text-align: left;
  margin: 0;
}

.svc-machine {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #efe6da;
  cursor: pointer;
}

.svc-machine:last-child {
  border-bottom: 0;
}

.svc-machine:has(input:checked) {
  background: #fff1e9;
}

.svc-machine input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  accent-color: #ee5a22;
  flex: 0 0 auto;
}

.svc-machine-main {
  flex: 1;
}

.svc-machine-main small {
  color: #6b6259;
}

.svc-machine-read {
  text-align: right;
  font-weight: 800;
  white-space: nowrap;
}

.svc-left {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #4b5b70;
}

.svc-due {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
}

.svc-due.overdue { color: #c62828; }
.svc-due.soon { color: #d97706; }

.svc-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.svc-type label {
  display: block;
}

.svc-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.svc-type span {
  display: block;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid #e0d4c4;
  font-weight: 800;
}

.svc-type input:checked + span {
  border-color: #ee5a22;
  background: #fff1e9;
}

.svc-type label:last-child input:checked + span {
  border-color: #1f6fd1;
  background: #e8f1fc;
}

.svc-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 700;
  margin-bottom: 8px;
}

.svc-book {
  width: 100%;
  background: #ee5a22;
  color: #fff;
  font-weight: 800;
}

/* Supervisor PM Schedule (weekly recurring brake / service / inspection) */
.pm-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  margin: 4px 0 10px;
}

.pm-legend .lg::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  margin-right: 5px;
  vertical-align: -1px;
}

.pm-legend .brake::before,
.pm-chip.brake,
.pm-existing-card.brake,
.pm-type.brake span {
  background: #ff69b4;
}

.pm-legend .brake::before { background: #ff69b4; }
.pm-legend .service::before { background: #ee5a22; }
.pm-legend .inspection::before { background: #1f6fd1; }

.pm-view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 10px;
}

.pm-view-tab {
  min-height: 40px;
  border: 1px solid #cfc4b6;
  border-radius: 10px;
  background: #fff;
  color: #0b2748;
  font-weight: 800;
}

.pm-view-tab.active {
  background: #0b2748;
  border-color: #0b2748;
  color: #fff;
}

.pm-week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.pm-month-wrap {
  background: #fff;
  border: 1px solid #e0d4c4;
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 12px;
}

.pm-month-weekdays,
.pm-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.pm-month-weekdays {
  margin-bottom: 4px;
}

.pm-month-weekdays span {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #5d5650;
}

.pm-month-cell {
  min-height: 72px;
  padding: 4px;
  border: 1px solid #ebe3d8;
  border-radius: 10px;
  background: #faf7f2;
  color: #0b2748;
  text-align: left;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pm-month-cell.blank {
  border: 0;
  background: transparent;
  min-height: 0;
}

.pm-month-cell.today {
  border-color: #0b2748;
  box-shadow: inset 0 0 0 2px #0b2748;
  background: #fff;
}

.pm-month-cell.has-sched {
  background: #fff;
}

.pm-month-cell > strong {
  font-size: 0.85rem;
}

.pm-month-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.pm-month-dots i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 800;
  color: #fff;
}

.pm-month-dots i.brake { background: #ff69b4; color: #4a0a2a; }
.pm-month-dots i.service { background: #ee5a22; }
.pm-month-dots i.inspection { background: #1f6fd1; }

.pm-month-names {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.pm-month-name {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-month-name.brake { color: #c2185b; }
.pm-month-name.service { color: #c2410c; }
.pm-month-name.inspection { color: #1f6fd1; }

.pm-month-more {
  font-size: 0.62rem;
  color: #5d5650;
  font-weight: 700;
}

@media (max-width: 720px) {
  .pm-month-cell {
    min-height: 58px;
  }
  .pm-month-names {
    display: none;
  }
}

.pm-week-nav > button {
  width: 42px;
  min-height: 42px;
  font-size: 1.4rem;
  font-weight: 800;
  background: #0b2748;
  color: #fff;
  border: 0;
  border-radius: 10px;
}

.pm-week-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.pm-week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  .pm-week-grid {
    grid-template-columns: 1fr;
  }
}

.pm-day {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-height: 110px;
  padding: 8px;
  border: 1px solid #e0d4c4;
  border-radius: 12px;
  background: #fff;
  color: #0b2748;
  text-align: left;
  font: inherit;
}

.pm-day.today {
  border-color: #0b2748;
  box-shadow: inset 0 0 0 2px #0b2748;
}

.pm-day header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
}

.pm-day header strong {
  font-size: 0.95rem;
}

.pm-day header span {
  font-size: 0.75rem;
  color: #5d5650;
}

.pm-day-chips {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pm-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 6px;
  border-radius: 8px;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.2;
}

.pm-chip.service { background: #ee5a22; }
.pm-chip.inspection { background: #1f6fd1; }
.pm-chip.brake { background: #ff69b4; color: #4a0a2a; }
.pm-chip em { font-style: normal; opacity: 0.9; font-weight: 600; }

.pm-empty {
  font-size: 0.75rem;
  color: #8a8178;
}

.pm-sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 3100;
  background: rgba(11, 39, 72, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.pm-sheet {
  width: min(640px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #f4efe8;
  border-radius: 16px 16px 12px 12px;
  padding: 12px 12px 20px;
  color: #0b2748;
  -webkit-overflow-scrolling: touch;
}

.pm-sheet > header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.pm-sheet > header h3 {
  flex: 1;
  margin: 0;
  font-size: 1.05rem;
}

.pm-existing {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.pm-existing h4,
.pm-add-form h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.pm-existing-card {
  background: #fff;
  border: 1px solid #e0d4c4;
  border-left: 6px solid #ee5a22;
  border-radius: 12px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pm-existing-card.brake { border-left-color: #ff69b4; }
.pm-existing-card.inspection { border-left-color: #1f6fd1; }
.pm-existing-card.service { border-left-color: #ee5a22; }

.pm-existing-card > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pm-existing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.pm-move {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
}

.pm-type-picks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 8px 0 10px;
}

.pm-type {
  display: block;
}

.pm-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pm-type span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 4px;
  border-radius: 10px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  border: 3px solid transparent;
}

.pm-type.brake span { background: #ff69b4; color: #4a0a2a; }
.pm-type.service span { background: #ee5a22; }
.pm-type.inspection span { background: #1f6fd1; }

.pm-type input:checked + span {
  border-color: #0b2748;
  box-shadow: 0 0 0 1px #0b2748;
}

.pm-machine-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
  margin-bottom: 10px;
  padding-right: 2px;
}

.pm-machine {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #e0d4c4;
  border-radius: 10px;
}

.pm-machine input {
  grid-row: 1 / span 2;
}

.pm-machine-main {
  font-size: 0.92rem;
}

.pm-machine-main small {
  color: #5d5650;
  font-weight: 600;
}

.pm-machine-meta {
  grid-column: 2;
  font-size: 0.75rem;
  color: #5d5650;
}

.pm-machine.pm-no-brake .pm-machine-meta {
  color: #8a8178;
}

.pm-save {
  width: 100%;
  min-height: 46px;
  background: #0b2748;
  color: #fff;
  font-weight: 800;
  border: 0;
  border-radius: 10px;
}

@media (max-width: 520px) {
  .pm-type-picks {
    grid-template-columns: 1fr;
  }
}
