:root {
  --navy: #102a43;
  --navy-deep: #081b2d;
  --blue: #1769e0;
  --blue-dark: #0d53bd;
  --blue-pale: #eaf2ff;
  --ink: #172133;
  --muted: #65758b;
  --line: #dce3ec;
  --surface: #ffffff;
  --background: #f3f6fa;
  --success: #157347;
  --success-bg: #e7f6ee;
  --danger: #b42318;
  --danger-bg: #feeceb;
  --warning: #946200;
  --warning-bg: #fff4d7;
  --shadow: 0 14px 38px rgba(26, 46, 75, .08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--background);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--background);
  font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

a {
  color: inherit;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 10px max(24px, calc((100vw - 1240px) / 2));
  border-bottom: 1px solid rgba(220, 227, 236, .85);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #0d4fae, #2680f5);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.2;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-menu form {
  margin: 0;
}

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

.page-shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 60px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 7px;
  color: var(--navy);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

h2 {
  margin-bottom: 0;
  color: var(--navy);
  font-size: 20px;
  line-height: 1.25;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
}

.system-state {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px currentColor;
  opacity: .75;
}

.system-state.is-ready {
  color: var(--success);
}

.system-state.is-warning {
  color: var(--warning);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 8px 25px rgba(26, 46, 75, .04);
}

.metric-card span,
.metric-card small {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.metric-card strong {
  display: block;
  margin: 8px 0 5px;
  overflow: hidden;
  color: var(--navy);
  font-size: clamp(23px, 2.5vw, 30px);
  line-height: 1.1;
  text-overflow: ellipsis;
}

.metric-card small {
  color: #8491a3;
  font-size: 11px;
}

.metric-card.metric-accent {
  border-color: #cddfff;
  background: linear-gradient(145deg, #f8fbff, #edf4ff);
}

.metric-card.metric-accent strong {
  color: var(--blue-dark);
}

.workspace-grid,
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 21px 23px;
  border-bottom: 1px solid var(--line);
}

.panel-heading .eyebrow {
  margin-bottom: 5px;
}

.step-badge,
.optional {
  display: inline-block;
  border-radius: 999px;
  background: var(--blue-pale);
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.step-badge {
  padding: 5px 8px;
}

.optional {
  margin-left: 5px;
  padding: 3px 6px;
}

.upload-panel form {
  padding: 22px 23px 24px;
}

label {
  display: block;
  margin: 0 0 7px;
  color: #2b3b50;
  font-size: 13px;
  font-weight: 750;
}

.file-field {
  margin-bottom: 19px;
}

.file-field input[type="file"] {
  width: 100%;
  padding: 11px;
  border: 1px dashed #b9c6d7;
  border-radius: 11px;
  background: #f9fbfd;
  color: var(--muted);
}

.file-field input[type="file"]::file-selector-button {
  margin-right: 11px;
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  color: var(--navy);
  background: #e7edf5;
  font-weight: 700;
  cursor: pointer;
}

.file-field small {
  display: block;
  margin-top: 6px;
  color: #8491a3;
  font-size: 11px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.button-primary {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(23, 105, 224, .18);
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button:disabled {
  cursor: wait;
  opacity: .72;
}

.button-secondary {
  border-color: var(--line);
  color: var(--navy);
  background: #f8fafc;
}

.button-quiet {
  min-height: 34px;
  border-color: var(--line);
  color: var(--muted);
  background: #fff;
}

.button-wide {
  width: 100%;
}

.audit-progress {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid #cddfff;
  border-radius: 12px;
  background: #f6f9ff;
}

.audit-progress[hidden] {
  display: none;
}

.audit-progress-heading,
.audit-progress-heading div {
  display: flex;
  align-items: center;
}

.audit-progress-heading {
  justify-content: space-between;
  gap: 16px;
}

.audit-progress-heading div {
  min-width: 0;
  gap: 8px;
}

.audit-progress-heading strong {
  color: var(--navy);
  font-size: 13px;
}

.audit-progress-heading [data-audit-elapsed] {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.audit-progress-state {
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.audit-progress-track {
  position: relative;
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce8fb;
}

.audit-progress-bar {
  position: absolute;
  inset: 0 auto 0 -36%;
  width: 36%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4a91ee, var(--blue), #4a91ee);
  animation: audit-progress-slide 1.25s ease-in-out infinite;
}

.audit-progress p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.upload-panel form.is-submitting .file-field input {
  pointer-events: none;
  opacity: .65;
}

@keyframes audit-progress-slide {
  0% {
    left: -36%;
  }

  100% {
    left: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .audit-progress-bar {
    left: 0;
    width: 100%;
    animation: none;
  }
}

.config-list,
.detail-list {
  margin: 0;
  padding: 7px 23px;
}

.config-list div,
.detail-list div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid #edf1f6;
}

.config-list div:last-child,
.detail-list div:last-child {
  border-bottom: 0;
}

.config-list dt,
.detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.config-list dd,
.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
}

.text-ready {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.panel-note {
  margin: 0 23px 21px;
  padding: 12px;
  border-radius: 10px;
  color: var(--muted);
  background: #f4f7fa;
  font-size: 11px;
}

.history-panel {
  box-shadow: none;
}

.history-heading {
  min-height: 82px;
}

.filter-form select {
  padding: 8px 31px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
}

.filter-form {
  display: flex;
  align-items: center;
  gap: 7px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid #e8edf3;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #758397;
  background: #f8fafc;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

td {
  font-size: 12px;
}

tbody tr:hover {
  background: #fbfcfe;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td small {
  display: block;
  max-width: 250px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.issue-value {
  color: var(--danger);
  font-weight: 700;
}

.issue-value.issue-resolved {
  color: var(--muted);
}

.credit-value {
  color: var(--success);
  font-weight: 800;
}

.audit-link {
  color: var(--blue-dark);
  font-weight: 800;
  text-decoration: none;
}

.audit-link:hover {
  text-decoration: underline;
}

.status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .035em;
}

.status-pass {
  color: var(--success);
  background: var(--success-bg);
}

.status-fail {
  color: var(--danger);
  background: var(--danger-bg);
}

.status-review {
  color: var(--warning);
  background: var(--warning-bg);
}

.status-not-checked {
  color: #566478;
  background: #eaf0f5;
}

.status-resolved {
  color: var(--success);
  background: var(--success-bg);
}

.status-open {
  color: var(--warning);
  background: var(--warning-bg);
}

.status-large {
  padding: 8px 12px;
  font-size: 12px;
}

.empty-state {
  padding: 45px 20px;
  text-align: center;
}

.empty-state strong {
  color: var(--navy);
}

.empty-state p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.flash-stack {
  position: fixed;
  z-index: 50;
  top: 84px;
  right: 18px;
  width: min(400px, calc(100% - 36px));
}

.flash {
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 12px;
}

.flash-error {
  border-color: #f6c7c3;
  color: var(--danger);
  background: #fff7f6;
}

.flash-success {
  border-color: #bde3ce;
  color: var(--success);
  background: #f4fcf7;
}

.flash-info {
  border-color: #cbdcff;
  color: var(--blue-dark);
  background: #f5f8ff;
}

.login-page {
  color: #fff;
  background: var(--navy-deep);
}

.login-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(420px, .85fr);
}

.login-intro,
.login-panel {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(38px, 6vw, 80px);
}

.login-intro {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 18%, rgba(47, 131, 245, .38), transparent 33%),
    radial-gradient(circle at 80% 85%, rgba(27, 97, 190, .3), transparent 34%),
    linear-gradient(145deg, #0b2540, #0f3c70);
}

.login-intro::after {
  position: absolute;
  right: -160px;
  bottom: -210px;
  width: 480px;
  height: 480px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
  box-shadow:
    0 0 0 55px rgba(255, 255, 255, .025),
    0 0 0 120px rgba(255, 255, 255, .02);
  content: "";
}

.brand-light {
  color: #fff;
}

.brand-light small {
  color: rgba(255, 255, 255, .65);
}

.login-intro .eyebrow {
  color: #91c1ff;
}

.login-intro h1 {
  max-width: 700px;
  color: #fff;
  font-size: clamp(38px, 5.4vw, 68px);
  line-height: 1.02;
}

.login-copy {
  max-width: 570px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, .72);
  font-size: 17px;
}

.login-footnote {
  position: relative;
  z-index: 2;
  margin-bottom: 0;
  color: rgba(255, 255, 255, .52);
  font-size: 11px;
}

.login-panel {
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: #fff;
}

.login-form {
  width: min(400px, 100%);
}

.login-form h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.login-form .muted {
  margin-bottom: 28px;
}

.login-form label {
  margin-top: 16px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  outline: none;
}

.login-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, .12);
}

.login-form .button {
  margin-top: 24px;
}

.configuration-warning {
  margin: 24px 0 0;
  padding: 14px;
  border: 1px solid #efcc84;
  border-radius: 10px;
  color: #7a5100;
  background: #fff8e8;
  font-size: 13px;
}

.detail-shell {
  max-width: 1120px;
}

.back-link {
  display: inline-block;
  margin-bottom: 22px;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.detail-heading {
  align-items: center;
}

.heading-statuses {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.detail-metrics {
  margin-bottom: 18px;
}

.detail-grid {
  grid-template-columns: 1fr 1fr;
}

.follow-up-grid {
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr);
}

.resolution-summary {
  display: grid;
  margin: 0;
  padding: 8px 23px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.resolution-summary div {
  min-width: 0;
  padding: 13px 12px 13px 0;
}

.resolution-summary dt {
  color: var(--muted);
  font-size: 11px;
}

.resolution-summary dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--navy);
  font-size: 12px;
  font-weight: 750;
}

.resolution-summary .resolution-note {
  grid-column: 1 / -1;
  padding-top: 3px;
}

.resolution-form {
  padding: 20px 23px 22px;
  border-top: 1px solid var(--line);
}

.resolution-fields {
  display: grid;
  grid-template-columns: minmax(160px, .55fr) minmax(0, 1.45fr);
  gap: 16px;
}

.money-input {
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #fff;
}

.money-input:focus-within,
.resolution-form textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 105, 224, .12);
}

.money-input span {
  padding-left: 11px;
  color: var(--muted);
}

.money-input input {
  width: 100%;
  min-width: 0;
  padding: 10px 11px 10px 5px;
  border: 0;
  outline: none;
}

.resolution-form textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  outline: none;
}

.resolution-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.reopen-form {
  padding: 0 23px 22px;
  text-align: right;
}

.resolution-empty {
  padding: 28px 23px;
}

.resolution-empty strong {
  color: var(--navy);
}

.resolution-empty p,
.danger-panel-body p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.danger-panel {
  border-color: #f0cfcc;
  box-shadow: none;
}

.danger-eyebrow {
  color: var(--danger);
}

.danger-panel-body {
  padding: 20px 23px 23px;
}

.danger-panel-body p {
  margin-top: 0;
}

.danger-panel-body form {
  margin-top: 18px;
}

.button-danger {
  border-color: #f0b9b4;
  color: var(--danger);
  background: #fff7f6;
}

.button-danger:hover {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.report-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 22px 23px 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .resolution-fields,
  .resolution-summary {
    grid-template-columns: 1fr;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-intro {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: 64px;
    padding: 9px 15px;
  }

  .brand small,
  .user-label {
    display: none;
  }

  .page-shell {
    width: min(100% - 24px, 1240px);
    padding-top: 28px;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .history-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-form,
  .filter-form select {
    width: 100%;
  }

  .login-panel {
    padding: 28px 22px;
  }
}
