/* P2R design system, deck standard v3, adapted for a phone-first app.
   Navy and white do the work. Yellow marks the one thing that matters.
   Gradient for emphasis only: one hero card per screen. */

:root {
  --navy: #0B1033;
  --yellow: #FFD000;
  --blue: #3B8BE0;
  --grey: #F4F6FB;
  --white: #FFFFFF;
  --line: #E3E7F0;
  --muted: #5B6178;
  --soft: #8A90A6;
  --accident: #F0506E;   /* module colour: Concerns */
  --nearmiss: #F59E0B;   /* module colour: Opportunities */
  --ok: #10B981;         /* module colour: Summary */
  --gradient: linear-gradient(150deg, #2453C9 0%, #16226B 55%, #0B1033 100%);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(11, 16, 51, .04), 0 8px 24px rgba(11, 16, 51, .06);
  --head: 'Arial Black', 'Arial Bold', Gadget, Arial, sans-serif;
  --body: Arial, 'Helvetica Neue', Helvetica, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--grey); color: var(--navy);
  font: 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 720px; }

/* ---------- top bar */
.topbar { padding: calc(14px + var(--safe-t)) 0 10px; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); }
.brand img { width: 28px; height: 28px; object-fit: contain; }
.brand span { font-size: 13px; letter-spacing: .14em; color: var(--muted); white-space: nowrap; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; background: var(--white); border-radius: 999px;
  padding: 7px 14px 7px 10px; font: 11px/1 var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--navy);
  box-shadow: var(--shadow); white-space: nowrap;
}
.pill img { width: 14px; height: 14px; object-fit: contain; }
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 700; color: var(--navy); padding: 8px 0; background: none; border: 0; cursor: pointer; }

/* ---------- headlines: one sentence, blue full stop, underline rule */
h1, h2, h3 { font-family: var(--head); font-weight: 900; margin: 0; letter-spacing: -.01em; }
h1 { font-size: clamp(28px, 6.4vw, 44px); line-height: 1.08; }
h2 { font-size: 20px; line-height: 1.2; }
h3 { font-size: 16px; }
.dot { color: var(--blue); }
.rule { display: flex; gap: 6px; margin: 14px 0 22px; align-items: center; }
.rule i { height: 3px; border-radius: 2px; background: var(--yellow); width: 56px; }
.rule i:nth-child(2) { background: var(--blue); width: 18px; }
.rule i:nth-child(3) { background: var(--blue); width: 4px; opacity: .5; }
.lede { color: var(--muted); margin: -8px 0 22px; max-width: 56ch; }
.eyebrow { font: 11px/1.2 var(--head); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* ---------- cards */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.hero {
  background: var(--gradient); color: var(--white); border-radius: var(--radius); padding: 22px; position: relative; overflow: hidden;
  box-shadow: 0 12px 32px rgba(22, 34, 107, .28);
}
.hero::after {
  content: ''; position: absolute; right: -40px; bottom: -50px; width: 260px; height: 260px;
  background: url(../img/phoenix-white.png) center/contain no-repeat; opacity: .07; pointer-events: none;
}
.hero .eyebrow { color: rgba(255, 255, 255, .72); }

/* ---------- home counters */
.counters { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.counter { padding: 4px 4px 2px; position: relative; z-index: 1; display: flex; flex-direction: column; }
.counter .eyebrow { min-height: 2.4em; }
.counter + .counter { border-left: 1px solid rgba(255, 255, 255, .16); padding-left: 20px; }
.counter .num { font: 900 clamp(64px, 19vw, 120px)/1 var(--head); letter-spacing: -.03em; margin: auto 0 6px; padding-top: 14px; font-variant-numeric: tabular-nums; }
.counter .num.hl { color: var(--yellow); }
.counter .sub { font-size: 13px; color: rgba(255, 255, 255, .78); }
.counter .tag { display: flex; align-items: flex-start; gap: 6px; }
.counter .tag img { width: 16px; height: 16px; flex: none; margin-top: -1px; }
.counter .flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { transform: scale(1.15); } 100% { transform: scale(1); } }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.action {
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--navy);
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px;
  border-bottom: 4px solid var(--c); transition: transform .15s ease, box-shadow .15s ease; min-height: 168px;
}
.action:active { transform: scale(.98); }
@media (hover: hover) { .action:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(11, 16, 51, .1); } }
.action .row { display: flex; justify-content: space-between; align-items: flex-start; }
.action img { width: 40px; height: 40px; object-fit: contain; }
.action .num { font: 900 14px var(--head); color: var(--soft); }
.action h2 { font-size: 22px; margin-top: auto; }
.action p { margin: 0; color: var(--muted); font-size: 14px; }
.action .go { font: 900 13px var(--head); color: var(--c); letter-spacing: .02em; }

.emergency {
  display: flex; gap: 12px; align-items: center; margin-top: 14px; padding: 14px 18px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; color: var(--muted);
}
.emergency b { color: var(--navy); }
.emergency .ico { flex: none; width: 34px; height: 34px; border-radius: 50%; background: #FDE8EC; color: var(--accident); display: grid; place-items: center; font: 900 14px var(--head); }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 26px 0 calc(26px + var(--safe-b)); color: var(--soft); font-size: 12px; }
.foot a { color: var(--soft); text-decoration: none; font-weight: 700; }
.foot a:hover { color: var(--navy); }

/* ---------- forms */
.form-head { display: flex; gap: 14px; align-items: center; margin-top: 4px; }
.form-head img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.section { margin-bottom: 14px; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.section-title .n { font: 900 14px var(--head); color: var(--c, var(--blue)); }
.section-note { color: var(--muted); font-size: 14px; margin: -8px 0 14px; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field > .label { display: block; font-weight: 700; margin-bottom: 7px; }
.field .req { color: var(--accident); margin-left: 2px; }
.field .hint { color: var(--muted); font-size: 13px; margin: -3px 0 8px; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--white); border-radius: 12px; padding: 13px 14px;
  font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
select.input { background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%230B1033' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") right 14px center no-repeat; padding-right: 38px; }
textarea.input { min-height: 104px; resize: vertical; }
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(59, 139, 224, .15); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two .field { margin-bottom: 18px; }

.choices { display: grid; gap: 8px; }
.choices.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px;
  min-height: 48px; font-size: 15px; transition: border-color .15s, background .15s; cursor: pointer;
}
.choice span::before {
  content: ''; flex: none; width: 18px; height: 18px; border: 2px solid #C5CAD8; border-radius: 50%; background: var(--white);
  transition: all .15s;
}
.choice input[type=checkbox] + span::before { border-radius: 5px; }
.choice input:checked + span { border-color: var(--navy); background: #F7F8FC; font-weight: 700; }
.choice input:checked + span::before { border-color: var(--navy); background: var(--navy); box-shadow: inset 0 0 0 3px var(--white); }
.choice input[type=checkbox]:checked + span::before { box-shadow: none; background: var(--navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='10' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' stroke='white' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center no-repeat; }
.choice input:focus-visible + span { box-shadow: 0 0 0 4px rgba(59, 139, 224, .2); }
.yesno { grid-template-columns: 1fr 1fr; }

.field.invalid .input, .field.invalid .choice span { border-color: var(--accident); }
.field .err { color: #C42848; font-size: 13px; font-weight: 700; margin-top: 6px; }

/* evidence */
.drop {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.drop label {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 1.5px dashed #C5CAD8; border-radius: 14px; padding: 18px 10px; cursor: pointer; font-weight: 700; font-size: 14px;
  transition: border-color .15s, background .15s; min-height: 92px;
}
.drop label:hover { border-color: var(--blue); background: #F7FAFE; }
.drop label small { font-weight: 400; color: var(--muted); font-size: 12px; }
.drop svg { width: 26px; height: 26px; color: var(--blue); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--grey); border: 1px solid var(--line); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }
.thumb .file { display: grid; place-items: center; height: 100%; padding: 8px; text-align: center; font-size: 11px; color: var(--muted); word-break: break-all; }
.thumb button {
  position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(11, 16, 51, .78); color: var(--white); font-size: 16px; line-height: 1; display: grid; place-items: center;
}

.submitbar {
  position: sticky; bottom: 0; z-index: 5; padding: 14px 0 calc(14px + var(--safe-b));
  background: linear-gradient(to top, var(--grey) 70%, rgba(244, 246, 251, 0));
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; text-decoration: none;
  border-radius: 14px; padding: 15px 22px; font: 900 16px var(--head); letter-spacing: .01em; transition: transform .1s, opacity .15s, background .15s;
  background: var(--navy); color: var(--white); min-height: 52px;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; cursor: progress; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--white); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.danger { background: #FDE8EC; color: #C42848; }
.btn.small { min-height: 40px; padding: 9px 14px; font-size: 13px; border-radius: 11px; }
.progress { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--blue); width: 0; transition: width .2s; }
.form-error { background: #FDE8EC; color: #9E1F3A; border-radius: 12px; padding: 12px 14px; font-size: 14px; font-weight: 700; margin-bottom: 10px; }

/* done */
.done { text-align: center; padding: 34px 22px; }
.done .tick { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); }
.done .ref { display: inline-block; margin: 14px 0 6px; background: var(--yellow); color: var(--navy); font: 900 18px var(--head); padding: 8px 16px; border-radius: 999px; letter-spacing: .04em; }
.done p { color: rgba(255, 255, 255, .8); max-width: 44ch; margin: 10px auto 0; }

/* ---------- admin */
.login { max-width: 420px; margin: 8vh auto 0; }
.demo-note { background: #FFF8D6; border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; flex-direction: column; min-height: 150px; }
.kpi .big { font: 900 44px/1 var(--head); margin-top: auto; padding-top: 18px; font-variant-numeric: tabular-nums; }
.kpi .cmp { font-size: 13px; color: var(--muted); margin-top: 8px; }
.hero.kpi .big { color: var(--yellow); }
.hero.kpi .cmp { color: rgba(255, 255, 255, .78); }

.tabs { display: flex; gap: 6px; background: var(--white); border-radius: 14px; padding: 5px; box-shadow: var(--shadow); width: max-content; max-width: 100%; overflow-x: auto; margin-bottom: 16px; }
.tabs button { border: 0; background: none; padding: 9px 16px; border-radius: 10px; font-weight: 700; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tabs button.on { background: var(--navy); color: var(--white); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: center; }
.filters .input { width: auto; padding: 10px 12px; min-width: 0; }
.filters .search { flex: 1 1 220px; }
.filters select.input { flex: 0 1 180px; }

.list { display: grid; gap: 10px; }
.item {
  display: grid; grid-template-columns: 6px 1fr auto; gap: 14px; align-items: center; background: var(--white); border-radius: 14px;
  box-shadow: var(--shadow); padding: 14px 16px 14px 0; text-decoration: none; color: var(--navy); overflow: hidden;
}
.item .bar { align-self: stretch; background: var(--c); border-radius: 0 4px 4px 0; }
.item .t { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.item .m { font-size: 13px; color: var(--muted); margin-top: 3px; }
.item .r { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.badge { display: inline-block; font: 900 11px/1 var(--head); letter-spacing: .06em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; white-space: nowrap; background: var(--grey); color: var(--navy); }
.badge.New { background: var(--yellow); }
.badge.Investigating { background: #E4EFFC; color: #1D5FAE; }
.badge.Action { background: #FDE8EC; color: #B4233F; }
.badge.Closed { background: #E3F7EF; color: #0B7A55; }
.badge.type { background: none; padding: 0; color: var(--c); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

.detail { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.dl { display: grid; grid-template-columns: 200px 1fr; gap: 10px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.gallery a { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--grey); border: 1px solid var(--line); }
.gallery img, .gallery video { width: 100%; height: 100%; object-fit: cover; }
.gallery .file { display: grid; place-items: center; height: 100%; padding: 10px; text-align: center; font-size: 12px; color: var(--navy); word-break: break-all; text-decoration: none; }
.notes { display: grid; gap: 10px; margin-bottom: 12px; }
.note { background: var(--grey); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.note small { display: block; color: var(--muted); margin-bottom: 3px; font-size: 12px; }
.sticky { position: sticky; top: 16px; }
.stack { display: grid; gap: 14px; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--navy); color: var(--white);
  padding: 12px 18px; border-radius: 12px; font-weight: 700; font-size: 14px; z-index: 50; box-shadow: 0 12px 32px rgba(11, 16, 51, .3);
  animation: up .25s ease-out;
}
@keyframes up { from { transform: translate(-50%, 12px); opacity: 0; } }
.offline { background: var(--yellow); color: var(--navy); text-align: center; font-weight: 700; font-size: 13px; padding: 8px 16px; }

.lightbox { position: fixed; inset: 0; background: rgba(11, 16, 51, .92); z-index: 60; display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-height: 90dvh; border-radius: 10px; }

@media (max-width: 860px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .detail { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 560px) {
  .actions { grid-template-columns: 1fr; }
  .action { min-height: 0; flex-direction: row; align-items: center; gap: 14px; padding: 18px; }
  .action .row { flex-direction: column; gap: 8px; align-items: center; }
  .action .num { display: none; }
  .action h2 { margin: 0 0 4px; font-size: 19px; }
  .action .go { display: none; }
  .counter + .counter { padding-left: 16px; }
  .two { grid-template-columns: 1fr; gap: 0; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 10px; }
  .kpi { min-height: 120px; }
  .kpi .big { font-size: 36px; }
  .brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
