:root {
  --ink: #102132;
  --muted: #667789;
  --line: #dfe7ec;
  --line-soft: #edf2f5;
  --paper: #ffffff;
  --canvas: #f4f7f8;
  --navy: #0b1f33;
  --navy-2: #173b5b;
  --blue: #1a67b2;
  --blue-soft: #e9f3fc;
  --green: #14866d;
  --green-soft: #e7f5f1;
  --amber: #bf6b14;
  --amber-soft: #fff1df;
  --red: #c73f3a;
  --red-soft: #fdecea;
  --shadow: 0 12px 32px rgba(14, 36, 55, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  transform: translateY(-150%);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--navy);
}
.skip-link:focus { transform: translateY(0); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  padding: 14px clamp(20px, 4vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #fff;
  background: rgba(11, 31, 51, .97);
  border-bottom: 1px solid rgba(255,255,255,.09);
  backdrop-filter: blur(12px);
}

.brand, .topbar-actions { display: flex; align-items: center; }
.brand { gap: 11px; }
.brand-mark {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #fff;
}
.brand-mark svg { width: 27px; height: 27px; }
.brand-mark svg path:first-child { fill: var(--navy); stroke: none; }
.brand-mark svg path:last-child { fill: none; stroke: var(--navy); stroke-width: 2; }
.brand strong { display: block; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .92rem; letter-spacing: -.01em; }
.brand small { display: block; margin-top: 2px; color: #9fb4c7; font-size: .71rem; letter-spacing: .08em; text-transform: uppercase; }
.topbar-actions { gap: 10px; }

.private-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-right: 6px;
  color: #bad0df;
  font-size: .82rem;
  font-weight: 600;
}
.lock-dot { width: 7px; height: 7px; border-radius: 50%; background: #52d5ad; box-shadow: 0 0 0 4px rgba(82,213,173,.12); }

.button {
  min-height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.button-primary { color: #fff; background: var(--blue); box-shadow: 0 7px 18px rgba(26,103,178,.22); }
.button-primary:hover { background: #145b9c; }
.button-ghost { color: #e8f1f7; background: transparent; border-color: rgba(255,255,255,.2); }
.button-ghost:hover { background: rgba(255,255,255,.07); }
.button-filter { min-height: 47px; padding-inline: 22px; color: #fff; background: var(--navy); }

main { width: min(1420px, 100%); margin: 0 auto; padding: 28px clamp(20px, 4vw, 64px) 20px; }

.report-hero, .content-section {
  margin-bottom: 22px;
  padding: clamp(24px, 3vw, 38px);
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.report-heading { display: flex; justify-content: space-between; gap: 30px; align-items: flex-start; }
.report-heading > .button { flex: 0 0 auto; }
.eyebrow, .section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--blue);
  font-size: .73rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
h1, h2, h3 { margin: 0; font-family: Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: -.035em; }
h1 { margin-top: 9px; font-size: clamp(1.8rem, 3vw, 2.65rem); line-height: 1.08; }
.report-heading p { margin: 9px 0 0; color: var(--muted); }

.filter-bar {
  margin-top: 28px;
  padding: 13px;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: #f5f8fa;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.week-stepper { min-height: 47px; display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.icon-button, .current-week { border: 0; background: transparent; cursor: pointer; }
.icon-button { width: 42px; display: grid; place-items: center; }
.icon-button:hover { background: var(--blue-soft); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.current-week { padding: 0 13px; border-inline: 1px solid var(--line); color: var(--blue); font-size: .8rem; font-weight: 700; white-space: nowrap; }
.field { min-width: 150px; display: grid; gap: 5px; }
.field-grow { flex: 1; }
.field span { margin-left: 3px; color: var(--muted); font-size: .69rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .compact-select select {
  width: 100%;
  min-height: 47px;
  padding: 0 38px 0 12px;
  color: var(--ink);
  background-color: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
}
.field input { padding-right: 10px; }
.field input:focus, .field select:focus, .compact-select select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,103,178,.12); }

.summary-grid { margin-top: 18px; display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 13px; }
.summary-card {
  min-height: 145px;
  padding: 21px;
  display: flex;
  align-items: flex-start;
  gap: 15px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.summary-primary { justify-content: space-between; color: #fff; background: linear-gradient(135deg, #0b1f33 0%, #173d5d 100%); border: 0; }
.card-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: .76rem; font-weight: 700; letter-spacing: .03em; }
.summary-primary .card-label { color: #b8cad8; }
.metric { display: block; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: 2.15rem; line-height: 1; letter-spacing: -.06em; }
.metric-small { font-size: 1.85rem; }
.metric-note { display: block; margin-top: 10px; color: var(--muted); font-size: .74rem; line-height: 1.35; }
.summary-primary .metric-note { color: #b8cad8; }
.card-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; }
.card-icon svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-good { color: var(--green); background: var(--green-soft); }
.icon-missed { color: var(--red); background: var(--red-soft); }
.icon-issue { color: var(--amber); background: var(--amber-soft); }
.donut { --pct: 0; width: 89px; height: 89px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: conic-gradient(#58d5b0 calc(var(--pct) * 1%), rgba(255,255,255,.13) 0); position: relative; }
.donut::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: #173a58; }
.donut span { position: relative; z-index: 1; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .93rem; font-weight: 800; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2 { margin-top: 7px; font-size: clamp(1.25rem, 2vw, 1.65rem); }
.section-heading p { margin: 7px 0 0; color: var(--muted); font-size: .88rem; }
.legend { display: flex; align-items: center; gap: 17px; color: var(--muted); font-size: .75rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.good { background: var(--green); }
.legend-dot.issue { background: var(--amber); }
.legend-dot.missed { background: var(--red); }

.location-list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.location-entry { display: grid; grid-template-columns: minmax(0, 1fr) 112px; align-items: center; border-bottom: 1px solid var(--line-soft); }
.location-entry:last-child { border-bottom: 0; }
.location-entry > .photo-cell { padding: 10px 14px 10px 0; }
.location-row {
  width: 100%;
  min-height: 92px;
  padding: 17px 20px;
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(130px, 1.4fr) 64px 90px 12px;
  gap: 12px;
  align-items: center;
  border: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.location-row:last-child { border-bottom: 0; }
.location-row:hover { background: #f8fbfd; }
.location-name strong { display: block; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .94rem; }
.location-name span { display: block; margin-top: 4px; color: var(--muted); font-size: .73rem; }
.location-name .completion-stamp { margin-top: 7px; color: var(--ink); font-size: .8rem; font-weight: 700; line-height: 1.35; }
.progress-wrap { display: grid; gap: 8px; }
.progress-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .74rem; }
.progress-meta strong { color: var(--ink); }
.progress-track { height: 8px; border-radius: 99px; background: #e8eef2; overflow: hidden; }
.progress-fill { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.progress-fill.warn { background: var(--amber); }
.progress-fill.alert { background: var(--red); }
.row-stat { text-align: center; }
.row-stat span { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; }
.row-stat strong { display: block; margin-top: 5px; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .98rem; }
.row-stat strong.alert { color: var(--red); }
.status-chip { display: inline-flex; align-items: center; justify-content: center; min-width: 86px; padding: 7px 9px; border-radius: 999px; font-size: .69rem; font-weight: 800; }
.status-chip.good { color: var(--green); background: var(--green-soft); }
.status-chip.review { color: var(--amber); background: var(--amber-soft); }
.status-chip.alert { color: var(--red); background: var(--red-soft); }
.row-chevron { color: #8a9aaa; font-size: 1.25rem; }

.section-kicker-alert { color: var(--red); }
.compact-select select { min-width: 170px; min-height: 40px; font-size: .8rem; }
.attention-list { display: grid; gap: 10px; }
.attention-item {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 42px minmax(190px, 1fr) minmax(210px, 1.25fr) minmax(170px, 1.6fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 12px;
  background: #fff;
}
.attention-item.issue { border-left-color: var(--amber); }
.attention-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: var(--red); background: var(--red-soft); }
.attention-item.issue .attention-icon { color: var(--amber); background: var(--amber-soft); }
.attention-icon svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attention-main strong, .attention-checkpoint strong { display: block; font-size: .85rem; }
.attention-main span, .attention-checkpoint span, .attention-note { display: block; margin-top: 3px; color: var(--muted); font-size: .73rem; line-height: 1.4; }
.attention-note { margin: 0; }
.attention-item .status-chip { min-width: 74px; }
.inline-link { color: var(--blue); font-weight: 700; text-decoration: none; }
.inline-link:hover { text-decoration: underline; }
.photo-cell { min-width: 0; }
.photo-hint { margin: -6px 0 18px; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.photo-empty { display: block; color: var(--muted); font-size: .875rem; line-height: 1.4; }
.photo-thumbnail { display: grid; width: 100%; max-width: 180px; min-height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #f5f8fa; color: var(--blue); cursor: zoom-in; text-align: center; }
.photo-thumbnail img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-thumbnail img[hidden] { display: none; }
.photo-thumbnail > span { padding: 5px 4px; font-size: .875rem; line-height: 1.3; font-weight: 700; }
.photo-thumbnail:focus-visible, .photo-nav-button:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.photo-unavailable { min-height: 88px; align-items: center; }
.attention-photo { grid-column: 2 / -1; }
.detail-photo-slot { grid-column: 2 / -1; }
.detail-dialog.photo-dialog { width: min(1040px, calc(100vw - 32px)); }
.photo-stage { display: grid; place-items: center; min-height: 220px; background: #edf2f5; border-radius: 12px; overflow: hidden; }
.photo-stage img { display: block; max-width: 100%; width: 100%; height: min(62vh, 680px); object-fit: contain; }
.photo-stage img[hidden], .photo-stage p[hidden], .photo-navigation[hidden] { display: none; }
.photo-stage p { margin: 0; padding: 24px; font-size: 1rem; line-height: 1.5; text-align: center; }
.photo-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 18px; font-size: .875rem; }
.photo-navigation { display: flex; align-items: center; gap: 12px; }
.photo-nav-button { border-color: var(--line); background: #f5f8fa; font-size: .875rem; }
.photo-nav-button:disabled { opacity: .5; cursor: default; transform: none; }

.empty-state { padding: 44px 20px; display: grid; place-items: center; gap: 7px; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: 14px; }
.empty-state[hidden] { display: none; }
.empty-state strong { color: var(--ink); }
.empty-check { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-weight: 800; }

footer { width: min(1420px, 100%); margin: 0 auto; padding: 6px clamp(20px, 4vw, 64px) 34px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: .72rem; }
footer button { border: 0; padding: 6px 0; color: var(--blue); background: none; font-weight: 700; cursor: pointer; }

.detail-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; color: var(--ink); border: 0; border-radius: 20px; box-shadow: 0 30px 90px rgba(5,22,37,.3); }
.detail-dialog::backdrop { background: rgba(7, 25, 41, .63); backdrop-filter: blur(4px); }
.dialog-shell { position: relative; padding: 30px; }
.dialog-close { position: absolute; right: 16px; top: 14px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--muted); background: #f1f5f7; font-size: 1.3rem; cursor: pointer; }
.dialog-shell h2 { margin-top: 8px; padding-right: 40px; }
.dialog-shell > p { color: var(--muted); line-height: 1.6; }
.dialog-summary { margin: 22px 0; padding: 15px 17px; display: flex; gap: 24px; background: #f5f8fa; border-radius: 12px; }
.dialog-summary span { color: var(--muted); font-size: .73rem; }
.dialog-summary strong { display: block; margin-top: 4px; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.detail-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.detail-line { padding: 12px 14px; display: grid; grid-template-columns: 110px 1fr auto; gap: 15px; align-items: center; border-bottom: 1px solid var(--line-soft); }
.detail-line:last-child { border-bottom: 0; }
.detail-line time, .detail-line span { color: var(--muted); font-size: .76rem; }
.detail-photo-slot .photo-empty, .detail-photo-slot .photo-thumbnail > span { font-size: .875rem; }
.detail-photo-slot .photo-thumbnail > span { color: var(--blue); }
.detail-line strong { font-size: .8rem; }
.detail-line small { display: inline-block; margin-top: 4px; color: var(--amber); font-size: .72rem; line-height: 1.4; }
.mapping-grid { margin: 22px 0; display: grid; grid-template-columns: 150px 1fr; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.mapping-grid code, .mapping-grid span { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); }
.mapping-grid code { color: var(--blue); background: #f5f8fa; font-weight: 700; }
.mapping-grid span { color: var(--muted); font-size: .8rem; }
.mapping-grid > :nth-last-child(-n+2) { border-bottom: 0; }
.dialog-note code { color: var(--blue); font-weight: 700; }
.dialog-action { margin-top: 4px; }

.toast { position: fixed; right: 22px; bottom: 22px; z-index: 80; transform: translateY(150%); padding: 12px 16px; color: #fff; background: var(--navy); border-radius: 10px; box-shadow: var(--shadow); font-size: .82rem; font-weight: 700; opacity: 0; transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 1080px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-bar { flex-wrap: wrap; }
  .week-stepper { flex: 1; }
  .location-row { grid-template-columns: minmax(165px, 1fr) minmax(100px, 1fr) 56px 86px; gap: 10px; }
  .row-chevron { display: none; }
  .attention-item { grid-template-columns: 42px 1fr 1fr auto; }
  .attention-note { grid-column: 2 / 4; }
}

@media (max-width: 760px) {
  main { padding: 18px 12px; }
  .report-hero, .content-section { padding: 20px 16px; border-radius: 17px; }
  .report-heading, .section-heading { display: grid; gap: 14px; }
  .report-heading > .button { width: 100%; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .week-stepper, .field-grow, .button-filter { grid-column: 1 / -1; }
  .field { min-width: 0; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card { min-height: 115px; }
  .legend { flex-wrap: wrap; gap: 10px 14px; }
  .location-list { border: 0; overflow: visible; display: grid; gap: 10px; }
  .location-entry { grid-template-columns: minmax(0, 1fr) 88px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .location-entry:last-child { border-bottom: 1px solid var(--line); }
  .location-entry > .photo-cell { padding-right: 10px; }
  .location-row { min-height: 0; padding: 16px 10px; grid-template-columns: minmax(0, 1fr); gap: 12px; border: 0; }
  .photo-toolbar { align-items: flex-start; flex-direction: column; }
  .progress-wrap { grid-column: 1 / -1; }
  .row-stat { text-align: left; }
  .row-chevron { display: none; }
  .attention-item { grid-template-columns: 38px 1fr auto; gap: 12px; }
  .attention-checkpoint, .attention-note { grid-column: 2 / -1; }
  .attention-item .status-chip { grid-column: 3; grid-row: 1; }
  footer { padding-inline: 18px; }
  .dialog-shell { padding: 26px 20px; }
  .dialog-summary { flex-wrap: wrap; gap: 14px 22px; }
  .detail-line { grid-template-columns: 90px 1fr; }
  .detail-line .status-chip { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
