/* Audit Dashboard. Colours are tokens so light and dark themes swap in one place. */

:root {
  color-scheme: light;
  --ink: #16202a;
  --ink-2: #3b4652;
  --muted: #66717d;
  --line: #d9dee3;
  --line-2: #e9ecef;
  --bg: #f2f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --top: #1d2733;
  --top-ink: #ffffff;
  --top-muted: #a9b6c2;
  --accent: #1f5f99;
  --accent-hover: #174a78;
  --accent-soft: #e8f0f8;
  --ok: #1b6b37;
  --ok-bg: #e4f2e8;
  --ok-line: #b8dbc3;
  --warn: #7a5000;
  --warn-bg: #fdf3da;
  --warn-line: #eed49a;
  --bad: #a72a20;
  --bad-bg: #fce9e7;
  --bad-line: #f0c6c1;
  --info: #1f5f99;
  --info-bg: #e8f0f8;
  --info-line: #c4d8ec;
  /* Chart roles (validated palette: slot 1 blue, slot 2 orange; status colours for severity). */
  --chart-surface: #ffffff;
  --grid: #e6e5df;
  --baseline: #c3c2b7;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #9ec5f4;
  --sev-critical: #d03b3b;
  --sev-high: #ec835a;
  --sev-medium: #fab219;
  --sev-low: #98a3ae;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 32, 0.06);
  --shadow-hover: 0 2px 8px rgba(16, 24, 32, 0.12);
  --focus: 0 0 0 3px rgba(31, 95, 153, 0.28);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Nirmala UI", "Noto Sans Devanagari", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #eef1f4;
    --ink-2: #c9d1d9;
    --muted: #97a2ad;
    --line: #34404c;
    --line-2: #2a343e;
    --bg: #11171d;
    --surface: #1a2129;
    --surface-2: #202932;
    --top: #0b1015;
    --accent: #6aa8e6;
    --accent-hover: #8fc0f0;
    --accent-soft: #1d3246;
    --ok: #6fd08f;
    --ok-bg: #16301f;
    --ok-line: #2b5a3a;
    --warn: #f3c465;
    --warn-bg: #352a10;
    --warn-line: #6a5421;
    --bad: #ff8f84;
    --bad-bg: #3a1a18;
    --bad-line: #6e302b;
    --info: #8fc0f0;
    --info-bg: #1d3246;
    --info-line: #2f4f6e;
    --chart-surface: #1a2129;
    --grid: #2c2c2a;
    --baseline: #4a4a46;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #184f95;
    --sev-low: #6d7883;
    --shadow: none;
    --shadow-hover: 0 0 0 1px var(--line);
    --focus: 0 0 0 3px rgba(106, 168, 230, 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.no-scroll {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent-hover);
}

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0;
}

h1 {
  font-size: 23px;
  font-weight: 650;
}

h2 {
  font-size: 16px;
  font-weight: 650;
}

h3 {
  font-size: 15px;
  font-weight: 650;
}

p {
  margin: 0 0 10px;
}

code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 1px 5px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.js .nojs-only {
  display: none;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 13px; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.center { text-align: center; }
.ok-text { color: var(--ok); font-weight: 600; }
.warn-text { color: var(--warn); font-weight: 600; }
.bad-text { color: var(--bad); font-weight: 600; }
.lead { font-size: 16.5px; }
.h-sep { color: var(--muted); font-weight: 400; }
.ref { font-family: var(--mono); font-size: 13px; font-weight: 600; white-space: nowrap; }
.cat { font-weight: 600; margin-right: 4px; }
.cat::after { content: " \00b7"; color: var(--muted); font-weight: 400; }
.photo-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.empty { color: var(--muted); padding: 14px 0; margin: 0; }
.note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.demo-banner {
  background: #fff3c4;
  color: #5a4300;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 5px 16px;
}

/* ------------------------------------------------------------ Header */

.topbar {
  background: var(--top);
  color: var(--top-ink);
}

.topbar-inner,
.mainnav-inner,
.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 16px;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 56px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--top-ink);
  text-decoration: none;
  font-weight: 650;
  flex-shrink: 0;
}

.brand:hover {
  color: var(--top-ink);
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--top);
  border-radius: 6px;
  font-weight: 800;
}

.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name small {
  color: var(--top-muted);
  font-weight: 500;
  font-size: 12px;
}

.topsearch {
  flex: 1;
  max-width: 520px;
}

.topsearch input {
  width: 100%;
  height: 36px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
}

.topsearch input::placeholder {
  color: #9fb0bf;
}

.topsearch input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 0 3px rgba(106, 168, 230, 0.4);
}

.userbox {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  margin-left: auto;
}

.user-name {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  text-align: right;
}

.user-name small {
  color: var(--top-muted);
  font-weight: 500;
  font-size: 12px;
}

.user-name:hover {
  color: #fff;
}

.signout {
  margin: 0;
}

/* English | मराठी */
.lang-switch {
  display: inline-flex;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 16px;
  overflow: hidden;
  flex: none;
}

.lang-switch button {
  font: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 7px 10px;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: #d5dde3;
  cursor: pointer;
}

.lang-switch button + button {
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.lang-switch button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.lang-switch button[aria-pressed="true"] {
  background: #fff;
  color: var(--top);
  font-weight: 700;
  cursor: default;
}

.lang-switch button:focus-visible {
  outline: 2px solid #6aa8e6;
  outline-offset: -2px;
}

.topbar .btn-link {
  color: #d5dde3;
}

.topbar .btn-link:hover {
  color: #fff;
}

.topbar-new {
  white-space: nowrap;
}

.mainnav {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.mainnav-inner {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.mainnav a {
  display: block;
  padding: 12px 12px 10px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.mainnav a:hover {
  color: var(--ink);
  border-bottom-color: var(--line);
}

.mainnav a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ------------------------------------------------------------ Page */

.page {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px 16px 40px;
}

.page-wide {
  max-width: 1440px;
}

.page-narrow {
  max-width: 800px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-sub {
  color: var(--muted);
  margin: 4px 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.crumbs {
  font-size: 13px;
  display: flex;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.panel > h2 {
  margin-bottom: 12px;
}

.panel-flush {
  padding: 0;
  overflow: hidden;
}

.panel-flush > .empty,
.panel-flush > .pager,
.panel-flush > .pager-count {
  padding-left: 20px;
  padding-right: 20px;
}

.panel-pad {
  padding: 16px 20px 8px;
  margin: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: -6px 0 12px;
}

.panel-action {
  border-left: 4px solid var(--accent);
}

.panel-alert {
  border-left: 4px solid var(--warn);
}

.panel-setup {
  border-left: 4px solid var(--info);
  background: var(--info-bg);
}

.is-provisional {
  border-left: 4px solid var(--warn);
}

.split {
  display: grid;
  gap: 18px;
  align-items: start;
}

@media (min-width: 960px) {
  .split {
    grid-template-columns: 1fr 1fr;
  }
  .split-wide {
    grid-template-columns: 3fr 2fr;
  }
}

.split > .panel {
  margin-bottom: 18px;
}

/* Issue page: on a phone the order is what was found, then the status buttons, then the details. */
.issue-grid {
  display: grid;
  gap: 0 18px;
  align-items: start;
}

@media (min-width: 960px) {
  .issue-grid {
    grid-template-columns: 3fr 2fr;
    grid-template-areas: "found status" "facts status";
  }
  .issue-found { grid-area: found; }
  .issue-facts { grid-area: facts; }
  .issue-status { grid-area: status; }
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 6px 0 10px;
}

.sub-title {
  margin: 16px 0 6px;
}

/* ------------------------------------------------------------ Notices, tags, severity */

.notice {
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.notice p:last-child,
.notice ul {
  margin-bottom: 0;
}

.notice ul {
  padding-left: 20px;
  margin-top: 4px;
}

.notice-ok { background: var(--ok-bg); border-color: var(--ok-line); border-left-color: var(--ok); }
.notice-error { background: var(--bad-bg); border-color: var(--bad-line); border-left-color: var(--bad); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); border-left-color: var(--warn); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
  border: 1px solid transparent;
}

.tag-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.tag-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.tag-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.tag-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.tag-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

.sev {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
  color: var(--ink-2);
}

.sev-icon {
  font-size: 11px;
  line-height: 1;
}

.sev-critical .sev-icon { color: var(--sev-critical); }
.sev-high .sev-icon { color: var(--sev-high); }
.sev-medium .sev-icon { color: var(--sev-medium); }
.sev-low .sev-icon { color: var(--sev-low); }
.sev-critical { color: var(--bad); }

/* ------------------------------------------------------------ Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  list-style: none;
}

.btn::-webkit-details-marker {
  display: none;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); color: #fff; }
.btn-small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-large { min-height: 46px; padding: 0 20px; font-size: 15.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.btn-danger-link { color: var(--bad); }

.is-busy {
  opacity: 0.7;
  cursor: progress;
}

.topbar .btn-primary {
  background: #2a78d6;
}

/* ------------------------------------------------------------ Forms */

.form label,
.fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 14px;
}

.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form input[type="number"],
.form input[type="password"],
.form input[type="date"],
.form input[type="search"],
.form select,
.form textarea,
.fld input,
.fld select,
.searchbig input {
  font: inherit;
  font-weight: 400;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 40px;
  padding: 7px 10px;
  width: 100%;
  max-width: 100%;
}

.form textarea {
  min-height: 70px;
  resize: vertical;
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.fld input:focus,
.fld select:focus,
.searchbig input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

.hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.field-note {
  color: var(--info);
  font-weight: 500;
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 0 16px;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .span-2 {
    grid-column: span 2;
  }
}

.form .check,
.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.check-block {
  align-self: end;
  flex-wrap: wrap;
}

.check input {
  width: 18px;
  height: 18px;
  margin: 0;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px 4px;
  margin: 0 0 14px;
}

legend {
  font-weight: 650;
  font-size: 14px;
  padding: 0 4px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: flex-end;
}

.form-inline label {
  margin-bottom: 0;
}

.inline-form {
  display: inline;
  margin: 0;
}

.upload-status {
  color: var(--muted);
  font-size: 13.5px;
}

.upload-status.is-error {
  color: var(--bad);
  font-weight: 600;
}

.severity-pick {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
}

@media (min-width: 720px) {
  .severity-pick {
    grid-template-columns: repeat(3, 1fr);
  }
}

.severity-pick legend {
  margin-bottom: 4px;
}

.form .sev-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  margin: 0;
  cursor: pointer;
  border-top: 3px solid var(--line);
}

.sev-option input {
  grid-row: span 2;
  margin-top: 3px;
}

.sev-option-name { font-weight: 650; }
.sev-option-help { font-weight: 400; font-size: 12.5px; color: var(--muted); }
.sev-option-critical { border-top-color: var(--sev-critical); }
.sev-option-high { border-top-color: var(--sev-high); }
.sev-option-medium { border-top-color: var(--sev-medium); }
.sev-option-low { border-top-color: var(--sev-low); }
.sev-option:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }

.action-fields {
  border-left: 3px solid var(--line);
  padding-left: 12px;
  margin-bottom: 8px;
}

/* ------------------------------------------------------------ Uploads */

.upload {
  margin-bottom: 12px;
}

.form .dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  margin-bottom: 10px;
}

.dropzone:hover {
  border-color: var(--accent);
}

.dropzone-title {
  font-weight: 650;
}

.dropzone-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}

.dropzone input[type="file"] {
  margin: 6px auto 0;
  font-size: 14px;
  max-width: 100%;
}

.upload-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.preview {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.preview img,
.preview-doc {
  display: block;
  width: 100%;
  height: 100px;
  object-fit: cover;
  background: var(--surface-2);
}

.preview-doc {
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--muted);
}

.form .preview label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  padding: 6px;
  margin: 0;
  overflow-wrap: anywhere;
}

.form .preview input {
  min-height: 32px;
  font-size: 13px;
  padding: 4px 6px;
}

/* ------------------------------------------------------------ Filters and chips */

.filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.filterbar-plain {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
}

.fld {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  min-width: 130px;
  flex: 0 1 180px;
}

.fld input,
.fld select {
  min-height: 36px;
  font-size: 14px;
  padding: 5px 8px;
}

.fld-date {
  flex-basis: 150px;
  min-width: 140px;
}

.fld-grow {
  flex: 1 1 200px;
}

.fld-check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  font-size: 14px;
  color: var(--ink);
  flex: 0 0 auto;
  min-width: 0;
}

.fld-actions {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.fld-inline {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.fld-inline input {
  width: 70px;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: -4px 0 14px;
}

.chips li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--info-line);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  font-size: 13px;
}

.chips a {
  text-decoration: none;
  font-weight: 700;
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
}

.chips a:hover {
  background: var(--surface);
  color: var(--bad);
}

.chips-static li {
  padding-right: 10px;
}

.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  padding: 8px 12px;
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs a:hover {
  color: var(--ink);
}

.tabs a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tabs-small a {
  font-size: 13px;
  padding: 6px 10px;
}

.list-tools {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13.5px;
}

.list-tools a {
  text-decoration: none;
}

.list-tools a.is-active {
  font-weight: 700;
  color: var(--ink);
}

.daynav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.daynav .fld {
  flex: 0 0 auto;
  min-width: 0;
}

/* ------------------------------------------------------------ Tables */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.table th,
.table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}

.table thead th {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table tfoot th {
  border-top: 2px solid var(--line);
  border-bottom: none;
}

.table .num {
  text-align: right;
  white-space: nowrap;
}

.table td.wrap {
  min-width: 260px;
}

.table-compact th,
.table-compact td {
  padding: 6px 10px;
}

.table tbody tr:hover {
  background: var(--surface-2);
}

.rowlink {
  cursor: pointer;
}

.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--sev-medium); }
.row-muted { opacity: 0.6; }
.row-selected { background: var(--accent-soft); }

.table .group-row th {
  background: var(--surface-2);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.perm-table td:first-child {
  min-width: 280px;
}

.pager,
.pager-count {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 0;
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
}

/* Coverage matrix: one row per location, one column per audit type. */

.matrix th,
.matrix td {
  text-align: center;
  padding: 6px;
  min-width: 96px;
}

.matrix thead th a {
  color: inherit;
}

.matrix tbody th {
  text-align: left;
  white-space: nowrap;
  font-weight: 600;
}

.mx-empty {
  color: var(--line);
}

.mx-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 4px;
  padding: 4px 6px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 650;
  border: 1px solid transparent;
  margin: 1px 0;
}

.mx-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
}

.mx-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.mx-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.mx-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.mx-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.mx-cell:hover { filter: brightness(0.97); box-shadow: var(--shadow-hover); }

/* ------------------------------------------------------------ KPI cards */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpis-3 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.kpis-4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.kpis-6 { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }

.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  min-width: 0;
}

a.kpi:hover {
  box-shadow: var(--shadow-hover);
  color: var(--ink);
  border-color: var(--muted);
}

a.kpi:hover .kpi-label {
  color: var(--accent);
  text-decoration: underline;
}

.kpi-ok { border-left-color: var(--ok); }
.kpi-warn { border-left-color: var(--sev-medium); }
.kpi-bad { border-left-color: var(--bad); }

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.kpi-value {
  font-size: 27px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.kpi-bad .kpi-value { color: var(--bad); }

.kpi-sub {
  font-size: 12.5px;
  color: var(--ink-2);
}

.kpi-note {
  font-size: 11.5px;
  color: var(--warn);
  font-weight: 600;
}

.delta { font-weight: 600; }
.delta-good { color: var(--ok); }
.delta-bad { color: var(--bad); }
.delta-flat { color: var(--muted); font-weight: 500; }

.brief {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
  font-size: 15.5px;
  box-shadow: var(--shadow);
}

.brief p {
  margin: 0 0 6px;
}

.brief p:last-child {
  margin: 0;
}

/* ------------------------------------------------------------ Dashboard */

.dash-grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

@media (min-width: 1100px) {
  .dash-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
  }
  .dash-side {
    position: sticky;
    top: 12px;
  }
}

.attention h2 {
  margin-bottom: 10px;
}

.att-section {
  border-top: 1px solid var(--line-2);
  padding-top: 10px;
  margin-top: 10px;
}

.att-section h3 {
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.att-section h3 a {
  color: var(--ink);
}

.count {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.att-list,
.att-small {
  list-style: none;
  padding: 0;
  margin: 0;
}

.att-list li {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line-2);
  font-size: 13.5px;
}

.att-list li:last-child {
  border-bottom: none;
}

.att-list a {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.att-list a:hover strong {
  text-decoration: underline;
}

.att-desc {
  color: var(--ink-2);
}

.att-meta {
  color: var(--muted);
  font-size: 12.5px;
}

.att-small li {
  padding: 4px 0;
  font-size: 13.5px;
}

.all-clear {
  display: flex;
  gap: 8px;
  align-items: center;
}

.setup-steps li {
  margin-bottom: 4px;
}

.setup-steps li.is-done a {
  color: var(--muted);
  text-decoration: line-through;
}

/* ------------------------------------------------------------ Charts */

.chart {
  margin: 0;
}

.chart-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.chart-row {
  display: grid;
  gap: 24px;
}

@media (min-width: 900px) {
  .chart-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.chart-grid-2 {
  display: grid;
  gap: 0 18px;
}

@media (min-width: 960px) {
  .chart-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.chart-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 0;
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.chart-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.key {
  display: inline-block;
}

.key-box {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.key-line {
  width: 14px;
  height: 2px;
  border-radius: 1px;
}

.chart-plot {
  position: relative;
  margin: 20px 0 0 36px;
}

.chart-grid {
  position: absolute;
  inset: 0;
}

.gridline {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--grid);
}

.gridline.baseline {
  border-top-color: var(--baseline);
}

.gridline span {
  position: absolute;
  left: -36px;
  width: 31px;
  top: -8px;
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
}

.cols {
  position: absolute;
  inset: 0;
  display: flex;
}

.col {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  text-decoration: none;
  color: inherit;
  outline-offset: -2px;
}

.col:hover,
.col:focus-visible {
  background: rgba(127, 127, 127, 0.07);
}

.col-bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 100%;
  width: 60%;
  max-width: 24px;
}

.col-bars.n2 {
  max-width: 50px;
}

.col-bars.n3 {
  max-width: 76px;
}

.bar {
  flex: 1;
  max-width: 24px;
  border-radius: 4px 4px 0 0;
  min-height: 0;
}

.stack {
  width: 100%;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}

.stack .seg {
  min-height: 2px;
  flex-basis: 0;
}

.col-cap {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
  transform: translateY(-3px);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.chart-xlabels {
  display: flex;
  margin: 4px 0 0 36px;
}

.chart-xlabels span {
  flex: 1;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 1px;
}

.chart-xlabels small {
  display: block;
  font-size: 10.5px;
}

.s1 { background: var(--series-1); }
.s2 { background: var(--series-2); }
.s3 { background: var(--series-3); }
.sv-critical { background: var(--sev-critical); }
.sv-high { background: var(--sev-high); }
.sv-medium { background: var(--sev-medium); }
.sv-low { background: var(--sev-low); }

.chart-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.line {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.line.s1 { stroke: var(--series-1); background: none; }
.line.s2 { stroke: var(--series-2); background: none; }

.chart-dots {
  position: absolute;
  inset: 0;
}

.dot {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: 0 0 -6px -6px;
  border-radius: 50%;
  border: 2px solid var(--chart-surface);
  display: block;
}

.dot::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.dot:hover,
.dot:focus-visible {
  transform: scale(1.35);
}

.end-label {
  position: absolute;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink);
  transform: translate(8px, 50%);
  margin-bottom: 0;
  white-space: nowrap;
  pointer-events: none;
  background: var(--chart-surface);
  padding: 0 2px;
  border-radius: 2px;
}

.target-line {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px dashed var(--muted);
}

.target-line span {
  position: absolute;
  left: 4px;
  top: -15px;
  font-size: 10.5px;
  color: var(--muted);
  background: var(--chart-surface);
  padding-left: 4px;
}

.hbars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hbar-row {
  display: grid;
  grid-template-columns: minmax(90px, 34%) 1fr auto;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  padding: 2px 4px;
  border-radius: 4px;
}

.hbar-row:hover,
.hbar-row:focus-visible {
  background: var(--surface-2);
}

.hbar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbar-track {
  height: 14px;
  display: block;
}

.hbar-fill {
  height: 100%;
  display: flex;
  gap: 2px;
  border-radius: 0 4px 4px 0;
  overflow: hidden;
  min-width: 3px;
}

.hbar-fill .seg {
  flex-basis: 0;
  min-width: 2px;
}

.hbar-value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.hbar-value small {
  font-weight: 500;
  color: var(--muted);
  margin-left: 6px;
}

.chart-table {
  margin-top: 8px;
  font-size: 13px;
}

.chart-table summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
}

.chart-table .table {
  font-size: 13px;
  margin-top: 6px;
}

.meter {
  display: inline-block;
  width: 60px;
  height: 7px;
  border-radius: 4px;
  background: var(--line-2);
  vertical-align: middle;
  overflow: hidden;
  margin-right: 4px;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.meter-good span { background: var(--ok); }
.meter-warn span { background: var(--sev-medium); }
.meter-bad span { background: var(--bad); }
.meter-none span { background: var(--muted); }

.acc {
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.acc-good { color: var(--ok); }
.acc-warn { color: var(--warn); }
.acc-bad { color: var(--bad); }

.sev-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.sev-tile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 10px;
  text-decoration: none;
  color: var(--ink);
}

.sev-tile strong {
  font-size: 18px;
}

.sev-tile:hover {
  box-shadow: var(--shadow-hover);
}

.tooltip {
  position: absolute;
  z-index: 50;
  background: var(--top);
  color: #fff;
  font-size: 12.5px;
  line-height: 1.4;
  padding: 7px 10px;
  border-radius: 6px;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.tooltip-title {
  color: #b8c6d3;
  font-size: 11.5px;
}

.tooltip div:nth-child(2) {
  font-weight: 700;
}

/* ------------------------------------------------------------ Accuracy */

.acc-hero {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

@media (min-width: 900px) {
  .acc-hero {
    grid-template-columns: 280px 1fr;
  }
}

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.hero-good { border-top-color: var(--ok); }
.hero-warn { border-top-color: var(--sev-medium); }
.hero-bad { border-top-color: var(--bad); }

.hero-label {
  font-weight: 600;
  color: var(--muted);
}

.hero-value {
  font-size: 52px;
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.hero-bad .hero-value { color: var(--bad); }
.hero-good .hero-value { color: var(--ok); }

.hero-sub {
  color: var(--ink-2);
  font-size: 14px;
}

/* ------------------------------------------------------------ Facts */

.facts {
  margin: 0;
  display: grid;
  gap: 0;
}

.facts > div {
  display: grid;
  grid-template-columns: minmax(130px, 38%) 1fr;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-2);
}

.facts > div:last-child {
  border-bottom: none;
}

.facts dt {
  color: var(--muted);
  font-size: 13.5px;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.facts-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.facts-grid > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: none;
  padding: 0;
}

.facts-grid dd {
  font-weight: 650;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.facts-grid .facts-span {
  grid-column: 1 / -1;
}

.facts-grid .facts-span dd {
  font-weight: 400;
  font-size: 14px;
}

.results-summary {
  margin-bottom: 14px;
  background: var(--surface-2);
}

.facts-wide > div {
  grid-template-columns: minmax(140px, 22%) 1fr;
}

.formula-table label {
  display: block;
  font-weight: 400;
  margin: 0;
  cursor: pointer;
}

.formula-table code {
  margin-left: 4px;
}

.facts-report > div {
  grid-template-columns: minmax(200px, 30%) 1fr;
}

/* ------------------------------------------------------------ Findings and issues */

.fcards {
  display: grid;
  gap: 12px;
}

@media (min-width: 960px) {
  .fcards {
    grid-template-columns: 1fr 1fr;
  }
}

.fcard {
  border: 1px solid var(--line);
  border-left: 4px solid var(--sev-low);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--surface);
  min-width: 0;
}

.fcard-critical { border-left-color: var(--sev-critical); }
.fcard-high { border-left-color: var(--sev-high); }
.fcard-medium { border-left-color: var(--sev-medium); }

.fcard header {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.fcard h3 {
  font-size: 15px;
  margin-bottom: 4px;
}

.fcard h3 a {
  color: var(--ink);
  text-decoration: none;
}

.fcard h3 a:hover {
  text-decoration: underline;
}

.fcard p {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.fcard-impact {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.fcard-meta {
  color: var(--muted);
  font-size: 13px;
}

.fcard-links {
  font-size: 13px;
  margin: 6px 0 0;
}

.actions-mini {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  font-size: 13px;
}

.actions-mini .ca-done { color: var(--ok); }
.actions-mini .ca-cancelled { color: var(--muted); text-decoration: line-through; }

.strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.strip img,
.strip-doc,
.strip-more {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface-2);
  text-decoration: none;
}

.ca-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.ca {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}

.ca-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 320px;
}

.ca-main .tag {
  align-self: flex-start;
}

.status-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

details.action > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
}

details.action > summary::-webkit-details-marker {
  display: none;
}

.action-form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 8px;
  background: var(--surface-2);
}

.action-danger {
  margin-top: 10px;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.review-actions details.action[open] {
  flex-basis: 100%;
}

.add-block {
  margin-top: 14px;
}

.add-block > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
}

.add-block > summary::-webkit-details-marker {
  display: none;
}

.add-block[open] > summary {
  margin-bottom: 12px;
}

.add-block > form {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface-2);
}

.add-lines {
  display: flex;
  flex-direction: column;
}

.steps-mini {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.steps-mini li::before {
  content: "\25cb  ";
  color: var(--muted);
}

.steps-mini li.is-done::before {
  content: "\2713  ";
  color: var(--ok);
  font-weight: 700;
}

.remarks {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
}

.remarks li {
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.remarks p {
  margin: 0 0 2px;
}

.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13.5px;
}

.timeline li {
  display: grid;
  grid-template-columns: 150px 150px 1fr;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-2);
}

.timeline time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tl-who {
  font-weight: 600;
}

.tl-status {
  color: var(--info);
  font-weight: 600;
}

.tl-detail {
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------ Galleries */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 12px;
}

.thumb {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
}

.thumb-img {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}

.thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-doc {
  display: grid;
  place-items: center;
  align-content: center;
  text-decoration: none;
  font-weight: 700;
  color: var(--muted);
  font-size: 20px;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}

.thumb-doc small {
  font-size: 11.5px;
  font-weight: 500;
  padding: 0 8px;
  overflow-wrap: anywhere;
  text-align: center;
}

.thumb figcaption {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12.5px;
}

.thumb-for {
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--info);
}

.thumb-for-resolution { color: var(--ok); }
.thumb-for-finding { color: var(--bad); }

.thumb-caption {
  font-size: 13.5px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.thumb-context {
  color: var(--ink-2);
}

.thumb-meta {
  color: var(--muted);
  font-size: 11.5px;
}

.gallery-group h3 {
  margin: 4px 0 10px;
}

.gallery-group + .gallery-group {
  border-top: 1px solid var(--line-2);
  padding-top: 12px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 12, 16, 0.92);
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
}

.lightbox figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-height: 100vh;
  padding: 40px 0 20px;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  background: #222;
}

.lightbox figcaption {
  color: #e8edf2;
  font-size: 14px;
  text-align: center;
  max-width: 800px;
  padding: 0 12px;
}

.lightbox button {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 26px;
  cursor: pointer;
  justify-self: center;
}

.lightbox .lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.lb-open {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #cfe0f0;
  font-size: 13px;
}

/* ------------------------------------------------------------ Reports */

.report-cards {
  display: grid;
  gap: 14px;
}

@media (min-width: 900px) {
  .report-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.report-card {
  margin: 0;
}

.report {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 26px;
}

.report-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.report-org {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 4px;
}

.report-section {
  margin-bottom: 22px;
  break-inside: auto;
}

.report-section h2 {
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.report-charts {
  display: grid;
  gap: 24px;
}

@media (min-width: 900px) {
  .report-charts {
    grid-template-columns: 1fr 1fr;
  }
}

.report-foot {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.table-report td {
  font-size: 13px;
}

/* ------------------------------------------------------------ Search, inbox, sign-in */

.searchbig {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.searchbig input {
  flex: 1;
  min-height: 46px;
  font-size: 16px;
}

.examples {
  columns: 2 260px;
  padding-left: 18px;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.result-list li {
  padding: 7px 0;
  border-bottom: 1px solid var(--line-2);
}

.interpretation h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.inbox {
  list-style: none;
  padding: 0;
  margin: 0;
}

.inbox-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}

.inbox-media img {
  width: 140px;
  height: 140px;
  object-fit: cover;
  border-radius: 4px;
}

.inbox-from {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: baseline;
}

.signin {
  max-width: 400px;
  margin: 40px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.signin h1 {
  margin-bottom: 4px;
}

.signin .form {
  margin-top: 18px;
}

.plain-list {
  padding-left: 18px;
  margin: 0;
}

.plain-list li {
  margin-bottom: 6px;
}

.footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  gap: 18px;
  padding-top: 12px;
  padding-bottom: 12px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------ Small screens */

@media (max-width: 760px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 8px 12px;
  }
  .topsearch {
    order: 3;
    flex-basis: 100%;
    max-width: none;
  }
  .brand-name small,
  .user-name small {
    display: none;
  }
  .page {
    padding-top: 16px;
  }
  h1 {
    font-size: 20px;
  }
  .panel {
    padding: 14px;
  }
  .kpi-value {
    font-size: 23px;
  }
  .kpis-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .kpis-3 .kpi {
    padding: 8px 10px;
  }
  .fld {
    flex: 1 1 140px;
  }
  .timeline li {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .sev-tiles {
    grid-template-columns: 1fr 1fr;
  }
  .inbox-item {
    grid-template-columns: 1fr;
  }
  .facts > div {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .table th,
  .table td {
    padding: 8px;
  }
  .hero-value {
    font-size: 42px;
  }
}

/* ------------------------------------------------------------ Print (and Save as PDF) */

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f5f6f7;
    --ink: #000;
    --chart-surface: #fff;
  }
  body {
    font-size: 11pt;
    background: #fff;
  }
  .topbar,
  .mainnav,
  .footer,
  .filterbar,
  .page-actions,
  .no-print,
  .daynav,
  .tabs,
  .list-tools,
  .add-block,
  details.action,
  .pager,
  form.form,
  .demo-banner,
  .chart-table summary,
  .btn,
  .upload-form {
    display: none !important;
  }
  .page {
    max-width: none;
    padding: 0;
  }
  .panel,
  .kpi,
  .brief,
  .report {
    box-shadow: none;
    break-inside: avoid;
  }
  .report {
    border: none;
    padding: 0;
  }
  .dash-grid {
    display: block;
  }
  .table-wrap {
    overflow: visible;
  }
  .table {
    font-size: 9pt;
  }
  .table thead {
    display: table-header-group;
  }
  .table tr {
    break-inside: avoid;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
  .kpis {
    grid-template-columns: repeat(4, 1fr);
  }
  .gallery {
    grid-template-columns: repeat(4, 1fr);
  }
  .s1, .s2, .s3, .sv-critical, .sv-high, .sv-medium, .sv-low, .meter span, .tag, .mx-cell, .dot {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ------------------------------------------------------------ Simple screens: auditor and store manager */

.flow {
  max-width: 560px;
  margin: 0 auto;
}

.flow h1 {
  font-size: 24px;
  margin-bottom: 6px;
}

.flow-step {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 4px;
}

.flow-h2 {
  font-size: 17px;
  margin: 26px 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepnum {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
}

.flow-form {
  margin-top: 14px;
}

.flow-extra {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 12px;
}

.flow-extra label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.flow-extra label.check {
  flex-direction: row;
  font-weight: 500;
}

.flow-extra select {
  font: inherit;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.flow-date {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.flow-date input {
  font: inherit;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}

.flow-label {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 6px;
}

.store-search {
  width: 100%;
  min-height: 48px;
  font: inherit;
  font-size: 16px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  margin: 6px 0 10px;
}

.picks {
  display: grid;
  gap: 8px;
}

.pick {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  font: inherit;
  font-size: 16px;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.pick span {
  color: var(--muted);
  font-size: 14px;
}

.pick:hover,
.pick:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 92px;
  padding: 12px 14px;
  margin: 0;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}

.tile input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.tile-symbol {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 17px;
}

.tile-name {
  font-size: 15px;
  line-height: 1.25;
  padding-right: 24px;
}

.tile::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
}

.tile:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tile:has(input:checked) .tile-symbol {
  background: var(--accent);
  color: #fff;
}

.tile:has(input:checked)::after {
  content: "\2713";
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-size: 13px;
}

.tile:focus-within {
  box-shadow: var(--focus);
}

.area-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.area-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 16px;
}

.area-symbol {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 15px;
}

.numrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form .numbox {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}

.form .numbox input {
  min-height: 52px;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

details.more {
  margin: 2px 0 8px;
}

details.more > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 14px;
  margin-bottom: 8px;
}

.hint-line {
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  margin: 6px 0 0;
}

.hint-ok { background: var(--ok-bg); color: var(--ok); }
.hint-warn { background: var(--warn-bg); color: var(--warn); }
.hint-bad { background: var(--bad-bg); color: var(--bad); }

.autosave-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 1.4em;
  margin: 0;
}

.autosave-status.is-error {
  color: var(--bad);
  font-weight: 600;
}

.pcards {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

@media (min-width: 960px) {
  .pcards-wide {
    grid-template-columns: 1fr 1fr;
  }
}

.pcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--sev-low);
  border-radius: 0;
  padding: 12px 14px;
}

.pcard-critical { border-left-color: var(--sev-critical); }
.pcard-high,
.pcard-medium { border-left-color: var(--sev-medium); }

.pcard-upcoming {
  border-style: dashed;
  border-left-style: solid;
  background: var(--surface-2);
}

.pcard-top {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.pcard-amount {
  margin-left: auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pcard-text {
  font-size: 15.5px;
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.pcard-meta {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0 0 4px;
}

.pcard-links {
  font-size: 13.5px;
  margin: 6px 0 0;
}

.btn-dashed {
  border-style: dashed;
  border-width: 2px;
  color: var(--accent);
}

.add-problem {
  margin: 4px 0 12px;
}

.add-problem > summary {
  list-style: none;
  cursor: pointer;
}

.add-problem > summary::-webkit-details-marker {
  display: none;
}

.add-problem[open] > summary.btn {
  display: none;
}

.problem-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

fieldset.choice {
  border: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

fieldset.choice legend {
  font-weight: 600;
  font-size: 14px;
  padding: 0;
  margin-bottom: 6px;
}

fieldset.choice-wrap {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.form .choice-btn {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 50px;
  padding: 6px 8px;
  margin: 0;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
}

.choice-btn input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.choice-btn:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.choice-critical:has(input:checked) {
  border-color: var(--bad);
  background: var(--bad-bg);
  color: var(--bad);
}

.choice-high:has(input:checked) {
  border-color: var(--warn);
  background: var(--warn-bg);
  color: var(--warn);
}

.choice-btn:focus-within {
  box-shadow: var(--focus);
}

.form .dropzone-simple {
  padding: 18px 14px;
  border-width: 2px;
}

.upload-simple .dropzone-title {
  font-size: 16px;
}

.finish {
  margin: 26px 0 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.finish-note {
  color: var(--muted);
  font-size: 14px;
}

.flow-done {
  text-align: center;
  padding-top: 20px;
}

.done-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ok-bg);
  color: var(--ok);
  font-size: 38px;
  font-weight: 700;
}

.flow-done .btn {
  margin: 14px 0;
}

.start-visit {
  margin: 14px 0 6px;
  min-height: 60px;
  font-size: 17px;
}

.visit-cards {
  display: grid;
  gap: 10px;
}

.visit-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--ink);
}

.visit-card span {
  color: var(--muted);
  font-size: 14px;
}

.visit-card-warn {
  border-left-color: var(--sev-medium);
}

.visit-card .visit-card-go {
  color: var(--accent);
  font-weight: 600;
  margin-top: 4px;
}

.visit-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.visit-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}

.visit-list a {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

.visit-list .muted {
  font-size: 13.5px;
}

.verify-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 8px;
}

.verify-buttons details[open] {
  flex-basis: 100%;
}

.fix-it {
  margin-top: 10px;
}

.fix-it > summary {
  list-style: none;
  cursor: pointer;
}

.fix-it > summary::-webkit-details-marker {
  display: none;
}

/* ------------------------------------------------------------ Visit report and the register */

.hno {
  display: inline-block;
  min-width: 18px;
  margin-right: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.facts-pdf > div {
  grid-template-columns: minmax(200px, 34%) 1fr;
}

.res {
  font-weight: 650;
}

.res-ok { color: var(--ok); }
.res-warn { color: var(--warn); }
.res-bad { color: var(--bad); }
.res-muted { color: var(--muted); }

.remark-line {
  margin: 0 0 4px;
}

.register-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding-top: 0;
}

.register-tools .tabs {
  margin: 0;
  border-bottom: none;
}

.register-filter {
  flex-basis: 100%;
}

.register-filter[open] > summary {
  margin-bottom: 8px;
}

.register-wrap {
  border-top: 1px solid var(--line);
}

.register {
  font-size: 13.5px;
}

.register th,
.register td {
  padding: 8px 10px;
}

.register thead th {
  white-space: normal;
  min-width: 76px;
  vertical-align: bottom;
  line-height: 1.25;
}

.register th,
.register td {
  padding: 7px 8px;
}

@media (min-width: 1500px) {
  .register-panel {
    width: calc(100vw - 48px);
    margin-left: calc(50% - 50vw + 24px);
  }
}

.register .sticky-end {
  position: sticky;
  right: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: inset 1px 0 0 var(--line);
  min-width: 118px;
}

.register thead .sticky-end {
  background: var(--surface-2);
  z-index: 2;
}

.register tbody tr:hover .sticky-end {
  background: var(--surface-2);
}

.register .register-groups th {
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  border-bottom: 1px solid var(--line-2);
  padding-top: 6px;
  padding-bottom: 4px;
}

.register .grp-areas,
.register .area-col {
  background: var(--accent-soft);
}

.register .area-col {
  min-width: 96px;
}

.register .sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  min-width: 140px;
  box-shadow: inset -1px 0 0 var(--line);
}

.register thead .sticky-col {
  background: var(--surface-2);
  z-index: 2;
}

.register tbody tr:hover .sticky-col {
  background: var(--surface-2);
}

.area-cell {
  min-width: 96px;
}

.rc {
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  padding: 4px 7px;
  font-weight: 650;
  font-size: 12.5px;
  line-height: 1.3;
  border: 1px solid transparent;
}

.rc small {
  font-weight: 500;
  font-size: 11.5px;
}

.rc-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.rc-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.rc-bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.rc-muted { background: var(--surface-2); color: var(--muted); border-color: var(--line); }

.rc-none {
  color: var(--line);
  padding-left: 7px;
}

.wrap-cell {
  min-width: 150px;
  max-width: 220px;
}

.attention-strip h2 {
  margin: 0;
}

.att-rows {
  list-style: none;
  padding: 0;
  margin: 0;
}

.att-rows li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 14px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 14px;
}

.att-rows li:last-child {
  border-bottom: none;
}

.att-rows a {
  text-decoration: none;
  color: var(--ink);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex: 1 1 380px;
}

.att-rows a:hover span {
  text-decoration: underline;
}

.more-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 4px 0 10px;
  font-size: 14.5px;
}

.more-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.more-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
}

.more-tile span {
  color: var(--muted);
  font-size: 14px;
}

.more-tile:hover {
  border-color: var(--accent);
}

@media (max-width: 760px) {
  .tiles {
    grid-template-columns: 1fr 1fr;
  }
  .facts-pdf > div {
    grid-template-columns: 1fr;
  }
  .register .sticky-col {
    min-width: 110px;
  }
}

@media print {
  .register .sticky-col {
    position: static;
  }
  .register-tools,
  .more-links,
  .attention-strip {
    display: none !important;
  }
}
