/*
 * Safety tools: PPE Check, Emergency SOS, Near-miss, Haadsa Replay / Pressure Drill,
 * Safety Coach, notifications.
 */

/* ---------- PPE check ---------- */
.ppe-list { display: flex; flex-direction: column; gap: var(--space-3); }
.ppe-item { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.ppe-item__head { display: flex; align-items: center; gap: var(--space-3); }
.ppe-item__icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 13px; color: var(--tone-text); background: var(--tone-soft); }
.ppe-item__label { font-weight: var(--weight-semibold); font-size: var(--text-body-lg); }
.ppe-seg .segmented__opt { padding: 0 var(--space-2); }
.ppe-seg .segmented__opt[data-value="yes"].is-on { color: var(--color-success-text); }
.ppe-seg .segmented__opt[data-value="no"].is-on { color: var(--color-danger-text); }
.ppe-seg .segmented__opt[data-value="unsure"].is-on { color: var(--color-warning-text); }
.ppe-result { align-items: center; text-align: center; gap: var(--space-2); animation: sheet-in var(--dur-slow) var(--ease-spring) both; }
.ppe-result--ready { background: var(--color-success-soft); border-color: transparent; }
.ppe-result--missing { background: var(--color-danger-soft); border-color: transparent; }
.ppe-result--review { background: var(--color-warning-soft); border-color: transparent; }
.ppe-result__icon { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; color: var(--tone-text); background: var(--color-surface-solid); box-shadow: var(--shadow-sm); }
.ppe-result__title { margin: 0; font-size: var(--text-h2); font-weight: var(--weight-bold); }
.ppe-result__text { margin: 0; color: var(--color-text); max-width: 40ch; }

/* ---------- emergency SOS (red only for the emergency itself) ---------- */
.sos-head { display: flex; align-items: center; gap: var(--space-4); }
.sos-head__icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 20px; color: #fff; background: var(--gradient-danger); box-shadow: var(--shadow-danger); }
.sos-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.sos-type {
  display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3);
  min-height: 112px; padding: var(--space-4); border-radius: var(--radius-lg);
  text-align: left; cursor: pointer; color: var(--color-text);
  background: var(--color-surface-solid); border: 1.5px solid var(--color-danger-soft); box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.sos-type:hover { border-color: var(--color-danger); }
.sos-type:active { transform: scale(.97); }
.sos-type:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 72px; flex-direction: row; align-items: center; }
.sos-type__icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 15px; color: var(--color-danger-text); background: var(--color-danger-soft); }
.sos-type__label { font-size: var(--text-body-lg); font-weight: var(--weight-bold); }
.sos-facts { padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-surface-sunken); }
.sos-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding-top: var(--space-4); }
.sos-done .facts { align-self: stretch; text-align: left; }
.sos-done .btn { align-self: stretch; }
.sos-done__icon { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; color: var(--color-success-text); background: var(--color-success-soft); }
.sos-done__text { margin: 0; font-weight: var(--weight-semibold); max-width: 36ch; }

/* ---------- near-miss ---------- */
.nm-list { display: flex; flex-direction: column; gap: var(--space-3); }
.nm-card { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-md); background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.nm-card__head { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.nm-card__desc { margin: 0; }
.nm-card__meta { margin: 0; display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--color-text-secondary); }

/* ---------- notifications bell (app bar) ---------- */
.appbar__bell { position: relative; }
.appbar__bell-dot { position: absolute; top: 8px; right: 9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: var(--weight-bold); color: #fff; background: var(--color-danger); box-shadow: 0 0 0 2px var(--color-surface-solid); }
.sos-done .sheet__title { color: var(--color-text); }

/* ---------- Haadsa Replay / Pressure Drill ---------- */
.replay-scene {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--space-4);
  padding: var(--space-5); border-radius: var(--radius-xl); color: #fff;
  background: radial-gradient(circle at 80% 0%, rgba(99, 102, 241, 0.55), transparent 55%), radial-gradient(circle at 0% 100%, rgba(20, 184, 166, 0.35), transparent 50%), #0D1420;
  box-shadow: var(--shadow-lg);
}
.replay-scene__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.replay-scene__head .eyebrow { margin: 0; color: rgba(255, 255, 255, 0.75); }
.replay-scene .chip--glass { color: #fff; background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.18); }
.replay-scene__prompt { margin: 0; font-size: var(--text-h3); font-weight: var(--weight-semibold); line-height: 1.4; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; }
.timeline__item { position: relative; flex: 1; display: flex; align-items: center; }
.timeline__item:not(:last-child)::after { content: ""; flex: 1; height: 2px; margin: 0 var(--space-2); border-radius: 2px; background: rgba(255, 255, 255, 0.22); }
.timeline__item:last-child { flex: 0; }
.timeline__dot { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; font-size: var(--text-xs); font-weight: var(--weight-bold); color: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.14); }
.timeline__item.is-current .timeline__dot { color: #fff; background: var(--color-primary-2); box-shadow: 0 0 0 5px rgba(99, 102, 241, 0.3); }
.timeline__item.is-safe .timeline__dot { color: #fff; background: var(--color-success); }
.timeline__item.is-unsafe .timeline__dot { color: #fff; background: var(--color-danger); }
.result .timeline__dot, .screen--replay > .page > .timeline .timeline__dot { color: var(--color-text-secondary); background: var(--color-surface-sunken); }
.page > .timeline .timeline__item:not(:last-child)::after { background: var(--color-border-strong); }
.page > .timeline .timeline__item.is-safe .timeline__dot { color: #fff; background: var(--color-success); }
.page > .timeline .timeline__item.is-unsafe .timeline__dot { color: #fff; background: var(--color-danger); }
.replay-ask { margin: 0; font-size: var(--text-h2); font-weight: var(--weight-bold); letter-spacing: var(--tracking-tight); }
.drill-clock { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); color: var(--color-warning-text); background: var(--color-warning-soft); font-weight: var(--weight-bold); font-size: var(--text-sm); }
.drill-clock__bar { height: 8px; border-radius: var(--radius-pill); background: rgba(0, 0, 0, 0.06); overflow: hidden; }
.drill-clock__fill { display: block; height: 100%; border-radius: inherit; background: var(--color-warning); transition: width 250ms linear; }
.consequence { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-lg); animation: sheet-in var(--dur-slow) var(--ease-spring) both; }
.consequence--safe { background: var(--color-success-soft); }
.consequence--unsafe { background: var(--color-danger-soft); }
.consequence__title { margin: 0; display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-h3); font-weight: var(--weight-bold); }
.consequence--safe .consequence__title { color: var(--color-success-text); }
.consequence--unsafe .consequence__title { color: var(--color-danger-text); }
.consequence__safe { margin: 0; display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); color: var(--color-success-text); }
.consequence__why { margin: 0; }

/* ---------- Safety Coach ---------- */
.coach-head { display: flex; align-items: center; gap: var(--space-4); }
.coach-head__icon { width: 56px; height: 56px; border-radius: 18px; }
.chat { display: flex; flex-direction: column; gap: var(--space-3); min-height: 120px; }
.msg { max-width: 92%; animation: sheet-in var(--dur) var(--ease) both; }
.msg--you { align-self: flex-end; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg) var(--radius-lg) var(--radius-xs) var(--radius-lg); color: #fff; background: var(--gradient-primary); font-weight: var(--weight-medium); }
.msg--bot { align-self: flex-start; display: flex; gap: var(--space-2); align-items: flex-start; }
.msg__avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 10px; color: #fff; background: var(--gradient-brand); }
.msg__body { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-radius: var(--radius-xs) var(--radius-lg) var(--radius-lg) var(--radius-lg); background: var(--color-surface-solid); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.msg__text { margin: 0; }
.msg-card { display: flex; flex-direction: column; gap: 4px; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--color-surface-sunken); }
.msg-card__q { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.msg-card__safe { margin: 0; display: flex; align-items: center; gap: 6px; font-weight: var(--weight-bold); color: var(--color-success-text); }
.msg-card__why { margin: 0; font-size: var(--text-sm); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chips--scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips--scroll::-webkit-scrollbar { display: none; }
.chip-btn { min-height: 44px; cursor: pointer; font: inherit; font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.chat-dock { position: sticky; bottom: calc(var(--space-3) + var(--safe-bottom)); z-index: 5; display: flex; flex-direction: column; gap: var(--space-2); }
.chat-input {
  display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2);
  border-radius: var(--radius-pill); background: var(--color-surface-glass);
  -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  border: 1px solid var(--color-glass-border); box-shadow: var(--shadow-lg);
}
.chat-input__field { flex: 1; min-width: 0; min-height: 44px; padding: 0 var(--space-4); border: 0; background: transparent; font: inherit; color: var(--color-text); }
.chat-input__field:focus { outline: none; }
.chat-input:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 4px var(--color-primary-soft), var(--shadow-lg); }
.chat-input__send { color: #fff; background: var(--gradient-primary); }
.chat-input__send:hover { background: var(--gradient-primary); }
