/* The equipment register, its calendar, labels and the plan's equipment card.
   Colours as the old register's, so the crews see the pills they know. */

.equip-view-switch { display: inline-flex; gap: .25rem; }
.equip-view-tab[aria-pressed="true"] { background: var(--header); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .15); }
.equip-card.calendar-view .equip-list-only { display: none; }
.equip-message.tone-ok { color: #166534; font-weight: 600; }
.equip-message.tone-warn { color: var(--warning-text); font-weight: 600; }
.equip-message.tone-error { color: var(--danger); font-weight: 600; }
.equip-table { min-width: 52rem; }
.equip-row.is-retired > td { color: var(--muted); background: #f8fafc; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.equip-pills { display: inline-flex; flex-wrap: wrap; gap: .25rem; }
.equip-pill {
  display: inline-block;
  padding: .12rem .5rem;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.equip-pill.status-in_store { background: #dcfce7; color: #14532d; }
.equip-pill.status-checked_out { background: #dbeafe; color: #1e3a8a; }
.equip-pill.status-deployed { background: #fef3c7; color: #78350f; }
.equip-pill.status-packed { background: #ede9fe; color: #4c1d95; }
.equip-pill.status-retired { background: #e2e8f0; color: #475569; }
.equip-pill.status-out-of-service { background: #fee2e2; color: #7f1d1d; }
.equip-pill.status-calibration { background: #fef3c7; color: #92400e; }
.equip-pill.status-unavailable { background: #fee2e2; color: #b91c1c; }

.equip-calibration { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.equip-cal-chip { padding: .1rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.equip-cal-chip.tone-due-soon { background: #facc15; color: #422006; }
.equip-cal-chip.tone-due-urgent { background: #ea580c; color: #fff; }
.equip-cal-chip.tone-overdue { background: var(--danger); color: #fff; }
.equip-cal-text.tone-overdue { color: var(--danger); font-weight: 700; }
.equip-cal-text.tone-due-urgent { color: #c2410c; }
.equip-cal-text.tone-due-soon { color: #a16207; }
.equip-cal-text.tone-none { color: var(--muted); }
.equip-last { display: inline-flex; flex-direction: column; }
.equip-last-by { font-size: .8rem; }

/* Details, the editor, the movement cards. */
.app-dialog.equip-details-dialog, .app-dialog.equip-editor-dialog { width: min(96vw, 760px); }
.equip-facts { margin: .6rem 0; }
.equip-movement { margin: .6rem 0; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: .75rem; background: #f8fafc; }
.equip-movement h3 { margin-bottom: .4rem; }
.equip-history { max-height: 40vh; overflow-y: auto; }
.equip-requires { margin: .2rem 0 .6rem; padding-left: 1.2rem; }
.equip-notes { white-space: pre-wrap; margin: .2rem 0 .6rem; }
.equip-requires-field { border: 1px solid var(--border); border-radius: .75rem; padding: .6rem .75rem; margin: .6rem 0; }
.equip-require-row { display: grid; grid-template-columns: minmax(10rem, 3fr) minmax(5rem, 1fr) minmax(5rem, 1fr) auto; gap: .5rem; align-items: end; margin-top: .5rem; }
.equip-require-row .field-hint { grid-column: 1 / -1; }

/* The availability calendar: kit down the side, dates across. */
.equip-cal-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem; margin-top: .75rem; }
.equip-cal-controls .form-field { min-width: 9rem; }
.equip-cal-key { display: flex; flex-wrap: wrap; gap: .4rem 1rem; margin-top: .6rem; font-size: .82rem; color: var(--label); }
.equip-cal-key-item { display: inline-flex; align-items: center; gap: .35rem; }
.equip-cal-swatch { width: 1rem; height: .8rem; border: 1px solid var(--border); border-radius: .2rem; display: inline-block; position: relative; }
.equip-cal { border-collapse: separate; border-spacing: 0; font-size: .78rem; }
.equip-cal th, .equip-cal td { border-right: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.equip-cal-month { background: var(--header); text-align: left; padding: .3rem .4rem; font-size: .72rem; text-transform: uppercase; color: var(--label); }
.equip-cal-corner { background: var(--header); text-align: left; padding: .4rem .6rem; position: sticky; left: 0; z-index: 3; }
.equip-cal-day { min-width: 1.9rem; padding: .2rem 0; background: #f8fafc; font-weight: 600; color: var(--label); }
.equip-cal-day span { display: block; text-align: center; line-height: 1.15; }
.equip-cal-day.is-weekend { background: #eef2f7; }
.equip-cal-day.is-today { background: #0f172a; color: #fff; }
.equip-cal-item { position: sticky; left: 0; z-index: 2; background: #fff; text-align: left; padding: .3rem .6rem; min-width: 11rem; max-width: 15rem; }
.equip-cal-item-btn { min-height: 0; padding: 0; background: none; color: var(--text); font-weight: 800; }
.equip-cal-desc { display: block; font-weight: 400; color: var(--muted); font-size: .72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equip-cal-item .equip-pill { margin-top: .15rem; }
.equip-cal-cell { position: relative; height: 2.6rem; min-width: 1.9rem; padding: 0; overflow: visible; }
.equip-cal-cell.is-free, .equip-cal-swatch.is-free { background: #fff; }
.equip-cal-cell.is-free.is-weekend { background: #f8fafc; }
.equip-cal-cell.is-booked, .equip-cal-swatch.is-booked { background: #d8dee7; }
.equip-cal-cell.is-openended, .equip-cal-swatch.is-openended { background: #fed7aa; }
.equip-cal-cell.is-clash { background: repeating-linear-gradient(45deg, #fecaca 0 5px, #fca5a5 5px 10px); }
.equip-cal-cell.is-retired, .equip-cal-swatch.is-retired { background: repeating-linear-gradient(45deg, #eef2f7 0 4px, #e2e8f0 4px 8px); }
.equip-cal-cell.is-uncalibrated::after, .equip-cal-swatch.is-uncalibrated::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(220, 38, 38, .16);
  border-top: 3px solid var(--danger);
  pointer-events: none;
}
.equip-cal-cell.is-today { box-shadow: inset 2px 0 0 #0f172a; }
.equip-cal-run {
  position: absolute;
  left: 2px;
  top: 3px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: 14rem;
  padding: .1rem .35rem;
  border-radius: .35rem;
  background: #cbd5e1;
  color: #0f172a;
  white-space: nowrap;
  pointer-events: none;
}
.equip-cal-run span { color: #475569; font-size: .7rem; }
.equip-cal-run.is-clash { background: #b91c1c; color: #fff; }
.equip-cal-run.is-clash span { color: #fff; }

/* Labels: a grid of QR labels, three sizes. */
.equip-label-preview { max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: .75rem; padding: .5rem; background: #f8fafc; }
.equip-label-sheet { display: grid; gap: 2mm; grid-template-columns: repeat(auto-fill, minmax(52mm, 1fr)); }
.equip-label-sheet.size-small { grid-template-columns: repeat(auto-fill, minmax(38mm, 1fr)); }
.equip-label-sheet.size-large { grid-template-columns: repeat(auto-fill, minmax(70mm, 1fr)); }
.equip-label { display: flex; gap: 2mm; align-items: center; padding: 2mm; border: 1px dashed #94a3b8; background: #fff; break-inside: avoid; color: #000; }
.equip-label-qr svg { display: block; width: 20mm; height: 20mm; }
.size-small .equip-label-qr svg { width: 15mm; height: 15mm; }
.size-large .equip-label-qr svg { width: 28mm; height: 28mm; }
.equip-label-text { display: flex; flex-direction: column; min-width: 0; font-size: 6.5pt; line-height: 1.2; }
.size-small .equip-label-text { font-size: 5.5pt; }
.size-large .equip-label-text { font-size: 8pt; }
.equip-label-id { font-family: var(--mono); font-size: 10pt; }
.size-small .equip-label-id { font-size: 8pt; }
.size-large .equip-label-id { font-size: 13pt; }
.equip-label-failed { color: var(--danger); font-weight: 700; }

/* The plan's equipment card: stages, then the kit. */
.stage-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .5rem; margin: .75rem 0; }
.stage-button { flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; }
.stage-button span { font-size: .8rem; font-weight: 500; }
.stage-button.is-next { background: var(--accent); color: #fff; }
.kit-card-list { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.kit-card-item {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr auto auto auto;
  align-items: center;
  gap: .25rem .75rem;
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: #f8fafc;
}
.kit-card-id { min-height: 0; padding: 0; background: none; color: var(--text); font-weight: 800; justify-content: flex-start; }
.kit-card-id:disabled { opacity: 1; }
.kit-card-item .small-note { margin: 0; }
.kit-card-warning { grid-column: 1 / -1; color: var(--danger); font-size: .85rem; font-weight: 600; }
.kit-card-remove { min-height: 32px; padding: .25rem .6rem; }

/* The picker. */
.app-dialog.kit-picker-dialog { width: min(96vw, 820px); }
.kit-needs { margin-bottom: .6rem; }
.kit-needs-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.kit-need {
  display: grid;
  grid-template-columns: 1.2rem auto 1fr auto;
  gap: .5rem;
  align-items: baseline;
  width: 100%;
  min-height: 0;
  margin-top: .3rem;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 400;
  text-align: left;
}
.kit-need.is-met { background: #f0fdf4; border-color: #86efac; }
.kit-need.is-active { box-shadow: inset 0 0 0 2px var(--switch); }
.kit-notes .small-note { margin: .25rem 0 0; }
.kit-override { padding: .5rem .7rem; border-radius: .7rem; background: var(--warning-bg); border: 1px solid var(--warning-border); }
.kit-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .6rem; max-height: 50vh; overflow-y: auto; }
.kit-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: .6rem;
  align-items: start;
  padding: .5rem .65rem;
  border: 1px solid var(--border);
  border-radius: .7rem;
  background: #fff;
  font-size: .95rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
}
.kit-row input { margin-top: .2rem; width: 1.2rem; height: 1.2rem; }
.kit-row-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.kit-row-main .small-note { margin: 0; }
.kit-row-line { font-size: .85rem; color: var(--warning-text); }
.kit-row-pills { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; }
.kit-row.is-picked { border-color: #86efac; background: #f0fdf4; }
.kit-row.is-blocked { border-style: dashed; color: var(--muted); cursor: default; }
.kit-row.is-uncalibrated { border-left: 4px solid #b45309; }
.kit-row.is-override { border-color: #f59e0b; background: #fffbeb; }

/* The stage scanner. */
.app-dialog.stage-dialog { width: min(96vw, 640px); }
.stage-camera .qr-frame { max-height: 38vh; }
.scanner-status.tone-ok { color: #166534; font-weight: 600; }
.scanner-status.tone-warn { color: var(--warning-text); font-weight: 600; }
.scanner-status.tone-error { color: var(--danger); font-weight: 600; }
.stage-manual-banner { margin: .4rem 0; padding: .45rem .65rem; border-radius: .6rem; background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning-text); font-weight: 600; }
.stage-progress { width: 100%; height: .6rem; }
.stage-list { list-style: none; margin: .4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; max-height: 32vh; overflow-y: auto; }
.stage-item, .stage-tap {
  display: grid;
  grid-template-columns: 1.3rem auto 1fr;
  gap: .5rem;
  align-items: baseline;
  padding: .4rem .6rem;
  border: 1px solid var(--border);
  border-radius: .6rem;
  background: #fff;
}
.stage-tap { width: 100%; min-height: 0; color: var(--text); font-weight: 400; text-align: left; margin: -.4rem -.6rem; width: calc(100% + 1.2rem); border: 0; background: none; }
.stage-item .small-note { margin: 0; }
.stage-item.is-done { background: #f0fdf4; border-color: #86efac; }
.stage-item.is-blocked { background: #fffbeb; border-color: #fcd34d; }
.stage-mark { font-weight: 800; }
.stage-finished { text-align: center; }
.stage-finished-mark { margin: .5rem 0 0; font-size: 2.5rem; color: #166534; }

@media (max-width: 640px) {
  .kit-card-item { grid-template-columns: 1fr auto; }
  .kit-card-item .small-note, .kit-card-seen { grid-column: 1 / -1; }
}
