/* ---- reports: PM screens ---------------------------------------------------
   Reports inbox (tabs, job filter, one row per report), the report view
   (sections, photo grid, review, original paste), the Reports nav badge,
   flash banners, and the Site reports timeline on the job page. */

/* top bar: unreviewed count on the Reports item (the shell's one spark) */
.nav-badge {
  margin-left: 2px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--ibs-teal); color: var(--on-teal); font-size: 11.5px; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* flash messages after a review (warnings use .banner-warn; see MESSAGE_TAGS in tracker/settings.py) */
.banner-success { background: var(--ibs-indigo-soft); border-color: var(--ibs-indigo-line); color: var(--ibs-indigo-ink); }
.banner-error { background: var(--act-bg); border-color: var(--act-line); color: var(--act); }
.banner { overflow-wrap: anywhere; }
.banner a { color: inherit; font-weight: 600; }

/* inbox */
.inbox { max-width: 1040px; display: grid; gap: 0; }
.inbox-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.inbox-tabs { margin: 0; border-bottom: 0; }
.inbox-tabs .tab { min-height: 44px; }
.inbox-filter { display: flex; gap: 8px; align-items: center; padding-bottom: 8px; min-width: 0; flex: 0 1 380px; }
.inbox-filter select { flex: 1 1 auto; min-width: 0; min-height: 44px; font-size: 16px; padding: 0 10px; cursor: pointer; }
.inbox-filter .btn { margin: 0; flex: none; }
.inbox-empty { margin: 0; max-width: none; }
.inbox-empty p + p { margin-top: 8px; }
.inbox-list { list-style: none; margin: 0; padding: 0; }
.inbox-row {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px;
  padding: 14px 20px; border-top: 1px solid var(--line); transition: background-color 120ms;
}
.inbox-card { overflow: hidden; }
.inbox-row:first-child { border-top: 0; }
.inbox-row:hover, .inbox-row:focus-within { background: var(--row-hover); }
.inbox-head { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; overflow-wrap: anywhere; }
.inbox-head .chip { margin: 0; }
.inbox-link { color: var(--ink); text-decoration: none; font-weight: 550; }
.inbox-link .code { margin-right: 4px; }
.inbox-link::after { content: ""; position: absolute; inset: 0; } /* the whole row opens the report */
.inbox-link:hover { color: var(--ibs-indigo); }
.inbox-link:focus-visible { outline: none; }
.inbox-row:has(.inbox-link:focus-visible) { outline: 2px solid var(--ibs-indigo); outline-offset: -2px; }
.inbox-meta { margin: 0; display: flex; flex-wrap: wrap; gap: 0 14px; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.inbox-when { color: var(--ink); font-weight: 500; }
.inbox-work { list-style: none; margin: 4px 0 0; padding: 0 0 0 12px; border-left: 2px solid var(--line); color: var(--ink-2); font-size: 13.5px; display: grid; gap: 2px; }
.inbox-work li { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-work .inbox-more { color: var(--ink-3); font-size: 12.5px; }
.inbox-nil { color: var(--ink-3); }
@media (min-width: 1024px) {
  .inbox-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 28px; align-items: start; }
  .inbox-head, .inbox-meta { grid-column: 1; }
  .inbox-work { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
}
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); }
.pager .btn { margin: 0; min-width: 96px; }
.pager-where { color: var(--ink-3); font-size: 13px; font-variant-numeric: tabular-nums; }

/* report view */
.report-detail .banner { margin: 0; }
.read-lines { margin: 0; padding: 0 0 0 18px; display: grid; gap: 6px; }
.read-lines li { overflow-wrap: anywhere; line-height: 1.5; }
.read-lines li::marker { color: var(--ink-3); }
.chip-moved-read { margin: 0 0 0 4px; background: var(--surface); border-color: var(--line-2); color: var(--ink-3); vertical-align: 1px; }
.photo-grid { list-style: none; margin: 0; padding: 0 20px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.photo-grid li { display: grid; gap: 4px; min-width: 0; }
.photo-grid a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo-grid img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 200ms var(--ease-out); }
.photo-grid a:hover img { transform: scale(1.03); }
.photo-grid a:focus-visible { outline: 2px solid var(--ibs-indigo); outline-offset: 2px; }
.photo-cap { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.review-form { display: grid; gap: 14px; justify-items: start; }
.review-form .field { width: 100%; }
.review-note { min-height: 5.5em; resize: vertical; line-height: 1.45; overflow-wrap: anywhere; }
.field-opt { font-weight: 400; color: var(--ink-3); }
.review-done { margin: 0; color: var(--ink-2); }
.review-card .form-error { margin: 0; }
.raw-paste summary {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-height: 44px;
  padding: 16px 20px; cursor: pointer; list-style: none;
}
.raw-paste summary::-webkit-details-marker { display: none; }
.raw-paste summary::before {
  content: ""; align-self: center; width: 7px; height: 7px; margin-right: 2px;
  border-right: 1.75px solid var(--ibs-indigo); border-bottom: 1.75px solid var(--ibs-indigo);
  transform: rotate(-45deg); transition: transform 160ms var(--ease-out);
}
.raw-paste[open] summary::before { transform: rotate(45deg); }
.raw-paste summary:focus-visible { outline: 2px solid var(--ibs-indigo); outline-offset: -2px; border-radius: var(--radius); }
.raw-paste pre {
  margin: 0 20px 20px; padding: 12px 14px; max-height: 480px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ink);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

/* job page: Site reports timeline (a rail with one mark per report; filled = reviewed) */
.job-reports { margin-top: 16px; }
.report-timeline { list-style: none; margin: 0; padding: 0 0 8px; }
.tl-report {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px;
  min-height: 48px; padding: 8px 20px 8px 48px; border-top: 1px solid var(--line);
  transition: background-color 120ms;
}
.tl-report:hover, .tl-report:focus-within { background: var(--row-hover); }
.tl-report::before { content: ""; position: absolute; left: 27px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-report:first-child::before { top: 50%; }
.tl-report:last-child::before { bottom: 50%; }
.tl-report:only-child::before { display: none; }
.tl-report::after {
  content: ""; position: absolute; left: 22px; top: 50%; width: 12px; height: 12px; margin-top: -6px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--line-field);
}
.tl-report:has(.chip-reviewed)::after { background: var(--act-done); border-color: var(--act-done); }
.tl-report-link { font-weight: 550; text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.tl-report-link::before { content: ""; position: absolute; inset: 0; z-index: 1; }
.tl-report-link:hover { color: var(--ibs-indigo); }
.tl-report-link:focus-visible { outline: none; }
.tl-report:has(.tl-report-link:focus-visible) { outline: 2px solid var(--ibs-indigo); outline-offset: -2px; }
.tl-report-meta { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.tl-report-chips { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tl-report-chips .chip { margin: 0; }

@media (max-width: 900px) {
  .inbox-row { padding: 14px 16px; }
  .pager { padding: 12px 16px; }
  .photo-grid { padding: 0 16px 16px; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
  .raw-paste summary { padding: 14px 16px; }
  .raw-paste pre { margin: 0 16px 16px; }
  .tl-report { padding: 8px 16px 8px 44px; }
  .tl-report::before { left: 23px; }
  .tl-report::after { left: 18px; }
  .tl-report-chips { margin-left: 0; flex-basis: 100%; }
}
@media (max-width: 600px) {
  .inbox-bar { flex-direction: column; align-items: stretch; border-bottom: 0; }
  .inbox-tabs { border-bottom: 1px solid var(--line); }
  .inbox-filter { flex-basis: auto; padding-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .segment span, .line, .file-pick, .inbox-row, .tl-report, .photo-grid img, .raw-paste summary::before { transition: none; }
  .photo-grid a:hover img { transform: none; }
  .line.is-arriving { animation: none; }
}

/* ---- motion ---------------------------------------------------------------
   Focal moment (first visit in a browser session, .motion-first): the
   Philippine coastline draws, the land fills, then jobs land on it, most
   urgent last, and Needs action pins pulse. Lists arrive as lists: KPI tiles
   and Needs action rows cascade, meters fill to their value.
   Every visit (.motion-ready): list <-> pin linking, timeline dots and
   overdue gaps drawing to today, Projects rows rippling in after a filter,
   and cross-page view transitions with a persistent top bar.
   All content is visible without JS; motion classes are added by dashboard.js. */

@keyframes pin-land { from { opacity: 0; transform: translateY(-16px) scale(0.5); } to { opacity: 1; transform: none; } }
@keyframes pin-pulse { 0% { opacity: 0.75; transform: scale(1); } 100% { opacity: 0; transform: scale(2.9); } }
@keyframes gap-draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fill-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pop-in { from { opacity: 0; transform: translate(-2px, -2px) scale(0.2); } to { opacity: 1; transform: translate(-2px, -2px) scale(1); } }
@keyframes spine-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spine-sweep { from { transform: translateX(-120%); } to { transform: translateX(520%); } }
@keyframes tag-in { from { opacity: 0; transform: translateY(8px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes land-fill { from { fill-opacity: 0; } to { fill-opacity: 1; } }

/* pins: base delay waits for the coastline on first visit */
.motion-ready .job-pin .dot { animation: pin-land 560ms var(--ease-out) both; animation-delay: calc(var(--pin-base, 0ms) + var(--d, 0ms)); }
.motion-ready .job-pin.tier-act .ring { animation: pin-pulse 1.6s var(--ease-out) 3; animation-delay: calc(var(--pin-base, 0ms) + var(--d, 0ms) + 520ms); }
.job-pin.tier-act.is-linked .ring { animation: pin-pulse 1.2s var(--ease-out) infinite; }
.motion-first .map { --pin-base: 1050ms; }

/* coastline draw (paths get their dash length from dashboard.js) */
.motion-first .map .coast { transition: stroke-dashoffset 1100ms cubic-bezier(0.65, 0, 0.35, 1); }
.motion-first .map .coast.is-drawn { animation: land-fill 500ms ease-out 750ms both, coast-settle 600ms ease-out 900ms both; }
@keyframes coast-settle { from { stroke: var(--ibs-indigo); stroke-width: 1.5px; } to { stroke: var(--map-coast); stroke-width: 1px; } }
.motion-first .map .coast:not(.is-drawn) { fill-opacity: 0; }

/* lists arrive as lists (first visit) */
.motion-first .spine-seg { animation: spine-grow 720ms var(--ease-out) both; animation-delay: calc(var(--k, 0) * 90ms); }
.motion-first .spine::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 22%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: spine-sweep 1100ms ease-in-out 760ms both;
}
.motion-first .rail-row { animation: rise-in 480ms var(--ease-out) both; animation-delay: calc(260ms + min(var(--i, 0), 14) * 40ms); }
.meter span { transform-origin: left center; }
.motion-first .rail-row .meter span { animation: fill-in 800ms var(--ease-out) both; animation-delay: calc(420ms + min(var(--i, 0), 14) * 40ms); }

/* timeline: dots pop in by row, then the overdue gaps draw towards today */

/* projects: rows ripple in (capped), bars fill */

/* the timeline card rises into view when it is first scrolled to (class set by dashboard.js) */

/* cross-page continuity: the shell stays, the page slides softly, the nav pill travels */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.nav a[aria-current="page"] { view-transition-name: nav-active; }
.pagehead { view-transition-name: pagehead; }
::view-transition-group(nav-active) { animation-duration: 320ms; animation-timing-function: var(--ease-out); }
/* The sub-tab and filter-tab markers travel too, here and on procurement's pages (Smoother INOVUS pick 2, the owner,
   2026-11-05). */
.subbar a[aria-current="page"] { view-transition-name: sub-active; }
.tab[aria-current="page"] { view-transition-name: tab-active; }
::view-transition-group(sub-active), ::view-transition-group(tab-active) { animation-duration: 300ms; animation-timing-function: var(--ease-out); }
::view-transition-old(root) { animation: 160ms ease-in both vt-out; }
::view-transition-new(root) { animation: 320ms var(--ease-out) both vt-in; }
::view-transition-old(pagehead) { animation: 140ms ease-in both vt-fade-out; }
::view-transition-new(pagehead) { animation: 300ms var(--ease-out) both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes vt-fade-out { to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .tab, .nav a, .job-pin .dot, .job-pin, .rail-row, .twin summary::before { transition: none; }
  .motion-ready .job-pin .dot, .motion-ready .job-pin.tier-act .ring, .job-pin.tier-act.is-linked .ring, .motion-first .prov-fade,
  .motion-first .spine-seg, .motion-first .spine::after, .motion-first .rail-row, .motion-first .rail-row .meter span { animation: none; }
  .job-pin.is-linked .dot { transform: none; box-shadow: 0 0 0 3px var(--ink); }
  @view-transition { navigation: none; }
}

/* ---- responsive ------------------------------------------------------- */

@media (max-width: 1240px) {
  .stage, .stage.room { height: auto; min-height: 0; overflow: visible; border: 0; background: none; display: grid; gap: 12px; }
  .content:has(.room) { padding: 16px; }
  .f-title { min-width: 0; }
  .stage .map { position: relative; inset: auto; height: 480px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; order: 1; }
  .float { position: static; }
  .f-title { order: 0; } .f-key { order: 2; } .f-rail { order: 3; width: auto; max-height: 520px; }
  .stage .leaflet-top.leaflet-left { top: 0; margin-left: 0; }
  .stage .leaflet-top.leaflet-right { right: 0; }
}

@media (max-width: 900px) {
  .topbar { height: 56px; padding: 0 12px; gap: 4px; }
  .brand { padding: 0 6px 0 4px; }
  .brand-name, .top-data, .top-name { display: none; }
  .nav a { padding: 8px 10px; }
  .top-end { gap: 8px; }
  .raise-pr-btn span { display: none; }
  .raise-pr-btn { width: 36px; padding: 0; justify-content: center; }
  .avatar { width: 28px; height: 28px; }
  .pagehead { padding: 18px 16px 14px; }
  h1 { font-size: 22px; }
  .content { padding: 16px 16px 8px; }
  .foot { padding: 8px 16px 24px; }
  .stage .map { height: 400px; }
  .f-key { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .spine { margin-bottom: 18px; }
  .card-head { padding: 14px 16px 10px; }
  .card-foot, .twin { margin-left: 16px; margin-right: 16px; }

}
@media (max-width: 1024px) {
  .tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }
  .tab { padding: 9px 10px 10px; }
  /* projects register as compact rows */
}
@media (max-width: 640px) {
  /* A phone (the owner, 2026-11-01: "fix the ui bug in phone"): the brand and the buttons on the first row, the tabs on
     a row of their own under them, with their words, swiped sideways when they do not fit; the current tab's sub-tabs
     dock under both. */
  .topbar { --bar-h: 100px; height: auto; flex-wrap: wrap; row-gap: 0; }
  .brand, .top-end { height: 56px; }
  .brand { align-items: center; }
  .nav { order: 3; flex: 1 0 100%; height: 44px; margin: 0 -12px; padding: 0 12px; }
  .nav a { padding: 6px 10px; }
  .nav a .icon { display: none; }
  .subbar { top: 100px; }
  .r-counts { grid-template-columns: repeat(2, auto); justify-content: start; gap: 6px 28px; }  /* the dashboard's counts */
}
/* A long top bar (one bar per role, the owner, 2026-10-22: six to eight entries) stays on one line on a laptop, as
   procurement's does (frontend/src/app/TopBar.tsx): below 1440px the brand's and the person's names give way, below
   1280px the icons. The entries' words always stay (the owner, 2026-10-23: icons alone confuse someone new). */
/* A tab with sub-tabs sits in a group of its own (2026-11-01), so entries are counted whatever wraps them. Below 1280px
   Chat, Raise a PR and Ask keep their icons only, as procurement's do. */
@media (max-width: 1439px) {
  .topbar:has(.nav > :nth-child(6)) .brand-name, .topbar:has(.nav > :nth-child(6)) .top-name { display: none; }
}
/* Seven entries (the Dashboard first, Elijah 2026-11-14) keep their line too: their icons give way below 1680px. */
@media (min-width: 1280px) and (max-width: 1679px) {
  .nav:has(> :nth-child(7)) a .icon { display: none; }
}
@media (min-width: 641px) and (max-width: 1279px) {
  .nav:has(> :nth-child(6)) a .icon { display: none; }
  .nav:has(> :nth-child(6)) > a, .nav:has(> :nth-child(6)) > .nav-group > a { padding: 8px 10px; }
  .topbar:has(.nav > :nth-child(6)) .top-end :is(.raise-pr-btn, .ask-btn) { width: 36px; padding: 0; justify-content: center; }
  .topbar:has(.nav > :nth-child(6)) .top-end :is(.raise-pr-btn, .ask-btn) > :not(.icon) { display: none; }
}

/* daily report without the paste (2026-10-03): manpower rows, notes, marks */
.manpower-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.report-notes-text { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
