/* Record workspace: stage path, one next step, and tabs on the pickup record.
   This file is also shipped on its own to the live site, so every colour has a fallback. */

.record-workspace .record-path-box {
  padding: 14px 20px 16px;
  border-bottom: 1px solid var(--line, #d9dfdd);
  background: #fff;
}

.record-workspace .record-path {
  display: flex;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.record-workspace .record-path li {
  flex: 1 1 0;
  min-width: 0;
  height: 34px;
  padding: 0 10px 0 16px;
  overflow: hidden;
  background: #edf2f4;
  color: var(--muted, #5f7080);
  font-size: 12px;
  font-weight: 700;
  line-height: 34px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%, 11px 50%);
}

.record-workspace .record-path li:first-child {
  padding-left: 10px;
  border-radius: 17px 0 0 17px;
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%);
}

.record-workspace .record-path li:last-child {
  border-radius: 0 17px 17px 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 11px 50%);
}

.record-workspace .record-path li.done {
  background: var(--teal-soft, #e7f5f2);
  color: var(--teal-dark, #006b6d);
}

.record-workspace .record-path li.done::before {
  content: "\2713\00a0";
}

.record-workspace .record-path li.current {
  background: var(--teal, #007f80);
  color: #fff;
}

.record-workspace .record-next {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #b9e0dc;
  border-radius: 8px;
  background: var(--teal-soft, #e7f5f2);
}

.record-workspace .record-next > div {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.record-workspace .record-next strong {
  color: var(--text, #17314a);
  font-size: 15px;
  line-height: 1.3;
}

.record-workspace .record-next span {
  color: var(--muted, #5f7080);
  font-size: 13px;
  line-height: 1.4;
}

.record-workspace .record-next button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: var(--teal, #007f80);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.record-workspace .record-next button:hover:not(:disabled) {
  background: var(--teal-dark, #006b6d);
}

.record-workspace .record-next button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* The numbered stage boxes are replaced by the path above. */
.record-workspace .workflow-tracker {
  display: none;
}

/* Tabs on tablet and desktop. Phones keep their existing tab bar. */
@media (min-width: 721px) {
  .record-workspace .mobile-detail-tabs {
    display: flex;
    gap: 2px;
    padding: 0 20px;
    border-bottom: 1px solid var(--line, #d9dfdd);
    background: #fff;
  }

  .record-workspace .mobile-detail-tabs button {
    min-height: 44px;
    padding: 0 14px;
    border: 0;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--muted, #5f7080);
    font-size: 14px;
    font-weight: 700;
  }

  .record-workspace .mobile-detail-tabs button:hover {
    color: var(--text, #17314a);
  }

  .record-workspace .mobile-detail-tabs button.active {
    border-bottom-color: var(--teal, #007f80);
    color: var(--teal-dark, #006b6d);
  }

  .record-workspace .mobile-tab-panel {
    display: none;
  }

  .record-workspace .mobile-tab-panel.active {
    display: block;
  }
}

/* Phones: only the current stage shows its name, so five stages always fit. */
@media (max-width: 720px) {
  .record-workspace .record-path-box {
    padding: 12px;
  }

  .record-workspace .record-path li:not(.current) {
    flex: 0 1 46px;
    padding: 0;
    font-size: 0;
  }

  .record-workspace .record-path li.done::before {
    content: "\2713";
    font-size: 13px;
  }

  .record-workspace .record-next {
    flex-direction: column;
    align-items: stretch;
  }

  .record-workspace .record-next button {
    min-height: 44px;
  }
}

/* Edit pickup opens on the right instead of as a centre pop-up (desktop only). */
@media (min-width: 1051px) {
  .modal-backdrop:has(> form.editor),
  html[data-theme="dark"] .modal-backdrop:has(> form.editor) {
    grid-template-rows: minmax(0, 1fr);
    place-items: stretch end;
    padding: var(--editor-dock-top, 12px) var(--editor-dock-right, 12px) 12px 12px;
    background: rgba(23, 49, 74, 0.06);
  }

  .modal-backdrop:has(> form.editor) > .editor {
    width: min(var(--editor-dock-width, 680px), 100%);
    max-height: none;
    min-height: 0;
    border-radius: 8px;
    box-shadow: -18px 0 48px rgba(23, 49, 74, 0.14);
  }

  .modal-backdrop:has(> form.editor) > .editor > .panel-head {
    position: sticky;
    top: 0;
    z-index: 2;
  }
}

/* Dark theme */
html[data-theme="dark"] .record-workspace .record-path-box,
html[data-theme="dark"] .record-workspace .mobile-detail-tabs {
  background: transparent;
}

html[data-theme="dark"] .record-workspace .record-path li {
  background: rgba(255, 255, 255, 0.08);
  color: #b8c4d0;
}

html[data-theme="dark"] .record-workspace .record-path li.done {
  background: rgba(0, 168, 168, 0.22);
  color: #8fe3df;
}

html[data-theme="dark"] .record-workspace .record-path li.current {
  background: #00a8a8;
  color: #04121c;
}

html[data-theme="dark"] .record-workspace .record-next {
  border-color: rgba(0, 168, 168, 0.4);
  background: rgba(0, 168, 168, 0.12);
}

html[data-theme="dark"] .record-workspace .record-next strong {
  color: #f2f6f9;
}

html[data-theme="dark"] .record-workspace .record-next span {
  color: #b8c4d0;
}

@media (min-width: 721px) {
  html[data-theme="dark"] .record-workspace .mobile-detail-tabs button {
    color: #b8c4d0;
  }

  html[data-theme="dark"] .record-workspace .mobile-detail-tabs button.active {
    color: #8fe3df;
    border-bottom-color: #00a8a8;
  }
}

/* Events form on desktop: stop fields overlapping in the narrow Event details panel. */
@media (min-width: 1051px) {
  .events-layout { grid-template-columns: minmax(0, 1.2fr) minmax(400px, 1fr); }
  .event-form { grid-template-columns: minmax(0, 1fr); }
  .event-two, .event-checks { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .event-two { align-items: start; }
  .event-items-section .panel-head.slim,
  .event-photo-section .panel-head.compact-head { align-items: flex-start; gap: 12px; }
  .event-items-section .panel-head.slim > div,
  .event-photo-section .panel-head.compact-head > div { min-width: 0; }
  .event-items-section .panel-head.slim .secondary,
  .event-photo-section .panel-head.compact-head .secondary { flex: 0 0 auto; white-space: nowrap; }
  .event-form label.photo-upload { display: inline-flex; gap: 6px; }
  .item-row.event-item-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(84px, auto) auto; }
  .item-row.event-item-row input:first-child { grid-column: 1 / -1; min-width: 0; }
  .item-row.event-item-row .danger { grid-column: auto; width: auto; white-space: nowrap; }
  .item-row.event-item-row .item-unit-note { grid-column: 1 / -1; }
}

/* Laptop-width windows: keep the top bar inside the page. */
@media (min-width: 1051px) and (max-width: 1320px) {
  .operations-bar { grid-template-columns: minmax(180px, 1fr) auto; }
  .user-pill > div { display: none; }
}
