/* Shared components for the phone app and the web dashboard. Spec sections 2 and 5. */

.i { width: 20px; height: 20px; flex: none; }

/* ---------- buttons (the motion layer adds hover step and press) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-4); border-radius: 10px; border: 1px solid transparent;
  font-size: 14.5px; font-weight: 700; line-height: 1.2; text-decoration: none; text-align: center;
  background: #fff; color: var(--text); border-color: var(--line-input);
}
.btn--primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--secondary { background: #fff; border-color: var(--line-input); color: var(--navy); }
.btn--danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn--danger:hover { background: color-mix(in oklab, var(--red) 86%, #000); }
.btn--danger-line { background: #fff; border: 2px solid var(--red); color: var(--red); }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 13.5px; }
.btn--lg { min-height: 56px; border-radius: 14px; font-size: 16px; }
.btn--cta { width: 100%; min-height: 64px; border-radius: 16px; font-size: 19px; font-weight: 800; }
.btn--block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--navy); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--line-input); border-color: var(--line-input); color: var(--text-off); pointer-events: none; }
.btn .i { width: 18px; height: 18px; }
.btn.is-busy { pointer-events: none; opacity: .85; }
.link { color: var(--blue); font-weight: 600; text-decoration: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; }

/* ---------- severity chip: colour + shape + word, always ---------- */
.sev {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; line-height: 1.3; white-space: nowrap;
}
.sev svg { width: 11px; height: 11px; flex: none; fill: currentColor; }
.sev--low { background: var(--sev-low); color: #fff; }
.sev--medium { background: var(--yellow); color: var(--text); }
.sev--high { background: var(--orange); color: var(--text); }
.sev--critical { background: var(--red); color: #fff; }
.sev--lg { padding: 4px 10px; font-size: 12.5px; }

/* ---------- pill chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--surface); color: var(--text-strong); font-size: 12px; font-weight: 600; line-height: 1.35; white-space: nowrap;
}
.chip .i { width: 13px; height: 13px; }
.chip--warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip--ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip--danger { background: var(--danger-bg); color: var(--red); }
.chip--info { background: var(--blue-tint); color: var(--navy); }
.chip--navy { background: var(--navy); color: #fff; }
.chip--magenta { background: var(--magenta-ink); color: #fff; }
.chip--wrap { white-space: normal; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--blue-tint); color: var(--navy); font-size: 11.5px; font-weight: 700; }

/* ---------- status dots (neutral on purpose) ---------- */
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; }
.dot--open { background: var(--navy); color: #fff; }
.dot--progress { background: #fff; border: 2px solid var(--blue); background: linear-gradient(90deg, var(--blue) 50%, #fff 50%); }
.dot--closed { background: var(--green); color: #fff; }

/* ---------- panels and linked cards ---------- */
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; }
.panel--m { border-radius: var(--r-card-m); }
.card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); color: inherit; text-decoration: none; }
.panel__title { font-size: 15px; font-weight: 700; color: var(--navy); }
.panel__sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ---------- strips: warning, info, danger ---------- */
.strip { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-card); border: 1px solid; font-size: 14px; line-height: 1.45; }
.strip .i { margin-top: 1px; }
.strip--warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.strip--info { background: var(--blue-tint); border-color: var(--sky-light); color: var(--navy); }
.strip--grey { background: var(--surface); border-color: var(--line-input); color: var(--text-strong); }
.strip--danger { background: var(--danger-bg); border-color: var(--red); color: var(--red); }
.strip--ok { background: var(--ok-bg); border-color: #9bd0b4; color: var(--ok-ink); }
.strip small, .helper { display: block; font-size: 12.5px; color: var(--text-2); }
.strip small { color: inherit; opacity: .9; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field label, .label { font-size: 14px; font-weight: 600; color: var(--text-strong); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--line-input); border-radius: 10px; background: #fff; font-size: 16px;
}
.field textarea { padding: 12px 14px; min-height: 96px; resize: vertical; line-height: 1.5; }
.field__error { font-size: 13px; color: var(--red); font-weight: 600; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--red); }
.form-status { font-size: 13.5px; min-height: 20px; color: var(--text-2); }
.form-status.is-error { color: var(--red); font-weight: 600; }

/* ---------- choice tile ---------- */
.tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  background: #fff; border: 2px solid var(--line-input); border-radius: var(--r-card-m); padding: 14px 10px; min-height: 64px; cursor: pointer;
}
.tile[aria-checked="true"], .tile[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-tint); box-shadow: inset 0 0 0 1px var(--blue); }

/* ---------- misc ---------- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--blue); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; color: var(--text-2); padding: 32px 16px; }
.empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
mark.worker-words { background: var(--highlight); color: inherit; padding: 0 2px; border-radius: 3px; }
.muted { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: var(--s-3); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 8px); z-index: 90; max-width: min(92vw, 420px);
  background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0;
  transition: opacity .15s var(--ease), transform .15s var(--ease); pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--red); }

/* dialog */
dialog.sheet { border: 0; padding: 0; border-radius: 20px; max-width: min(92vw, 420px); width: 100%; box-shadow: 0 12px 40px rgba(16, 24, 40, .25); }
dialog.sheet::backdrop { background: rgba(12, 31, 79, .55); }
.sheet__body { padding: 24px; display: grid; gap: 14px; }
.sheet__title { font-size: 20px; font-weight: 800; color: var(--navy); }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .toast { transition: none; }
}

/* ---------- Plant X map (shared/plantmap.js, merge) ----------
   Hatched zones are hazardous areas. Heat shading uses the same blue scale as the zone x shift grid. */
.plantmap { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; touch-action: manipulation; font-family: var(--font); }
.pm-zone { stroke: #98A2B3; stroke-width: 1; vector-effect: non-scaling-stroke; transition: fill 160ms var(--ease); }
.pm-zone.is-safe { fill: #FFFFFF; }
.pm-zone.is-hazard { fill: url(#pm-hatch); }
.pm-hatch-bg { fill: #FFFFFF; }
.pm-hatch-line { stroke: #F9A800; stroke-width: 2; stroke-opacity: 0.5; }
.pm-zone[data-zone] { cursor: pointer; }
.pm-zone[data-zone]:hover { stroke: var(--blue); stroke-width: 2; }
.pm-zone[data-zone]:focus-visible { outline: none; stroke: var(--navy); stroke-width: 3; }
.pm-heat-0 { fill: #F9FAFB; background: #F9FAFB; }
.pm-heat-1 { fill: #EAF1FB; background: #EAF1FB; }
.pm-heat-2 { fill: #B5CFF0; background: #B5CFF0; }
.pm-heat-3 { fill: #5B93D6; background: #5B93D6; }
.pm-heat-4 { fill: #1D5FB5; background: #1D5FB5; }
.pm-heat-5 { fill: #0C1F4F; background: #0C1F4F; }
.pm-road { stroke: #E4E7EC; fill: none; stroke-linecap: square; pointer-events: none; }
.pm-rack { stroke: #D0D5DD; fill: none; stroke-dasharray: 3 3; pointer-events: none; }
.pm-bldg { fill: #EAECF0; stroke: #98A2B3; stroke-width: 0.6; pointer-events: none; opacity: 0.85; }
.pm-ap rect { fill: var(--green); pointer-events: none; }
.pm-fence { fill: none; stroke: var(--text-strong); stroke-width: 2.5; pointer-events: none; }
.pm-sel { fill: var(--blue); fill-opacity: 0.16; stroke: var(--blue); stroke-width: 5; pointer-events: none; }
.pm-eq { fill: var(--text-2); }
.pm-label text { font-size: 11.5px; font-weight: 700; fill: var(--text-strong); paint-order: stroke; stroke: #fff; stroke-width: 3px; pointer-events: none; }
.pm-label .pm-label__n { font-size: 10.5px; font-weight: 600; fill: var(--text-2); }
.pm-label.on-dark text { fill: #fff; stroke: var(--navy); }
.pm-label.on-dark .pm-label__n { fill: var(--on-navy); }
.pm-pin { stroke: #fff; stroke-width: 2; }
.pm-pin--open { fill: var(--navy); }
.pm-pin--progress { fill: var(--blue); }
.pm-pin--closed { fill: var(--green); }
.pm-pin__mark { font-size: 10px; font-weight: 800; fill: #fff; pointer-events: none; }
a:hover > .pm-pin, a:focus-visible > .pm-pin { stroke: var(--yellow); stroke-width: 3; }
.pm-gps__ring { fill: var(--blue); fill-opacity: 0.12; stroke: var(--blue); stroke-width: 2; stroke-dasharray: 5 5; pointer-events: none; }
.pm-gps__dot { fill: var(--navy); stroke: #fff; stroke-width: 3; pointer-events: none; }
.pm-legend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin: 8px 0 0; }
.pm-legend i { width: 22px; height: 12px; border-radius: 3px; border: 1px solid var(--line); }
.pm-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin: 8px 2px 0; }
.pm-key span { display: inline-flex; align-items: center; gap: 6px; }
.pm-key i { width: 16px; height: 12px; border: 1px solid #98A2B3; border-radius: 2px; background: #fff; }
.pm-key i.is-hazard { background: repeating-linear-gradient(45deg, #fff 0 3px, rgba(249, 168, 0, .55) 3px 5px); }
