:root {
  --audit-primary: #2e717c;
  --audit-primary-dark: #244f57;
  --audit-primary-soft: #e4f2f4;
  --audit-ink: #2f2b3d;
  --audit-muted: #6f6b7d;
  --audit-page: #f7f7f9;
  --audit-border: #e6e6ea;
}

html,
body {
  min-height: 100%;
}

body {
  color: var(--audit-ink);
  background: var(--audit-page);
  font-family: "Public Sans", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--audit-primary); }
a:hover { color: var(--audit-primary-dark); }

.btn-primary {
  --bs-btn-bg: var(--audit-primary);
  --bs-btn-border-color: var(--audit-primary);
  --bs-btn-hover-bg: var(--audit-primary-dark);
  --bs-btn-hover-border-color: var(--audit-primary-dark);
  --bs-btn-active-bg: var(--audit-primary-dark);
  --bs-btn-active-border-color: var(--audit-primary-dark);
}

.btn:focus-visible,
.form-control:focus,
.form-check-input:focus,
.menu-link:focus-visible,
.dropdown-item:focus-visible {
  border-color: #62aab5;
  box-shadow: 0 0 0 .2rem rgba(46, 113, 124, .2);
  outline: 0;
}

.text-danger.field-validation-error {
  display: block;
  margin-top: .35rem;
  font-size: .8125rem;
}

.validation-summary-valid { display: none; }

.validation-summary-errors ul {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.brand-mark {
  display: inline-flex;
  width: 2.65rem;
  height: 2.65rem;
  flex: 0 0 2.65rem;
  align-items: center;
  justify-content: center;
  border-radius: .8rem;
  color: #fff;
  background: linear-gradient(145deg, #36a1b2, var(--audit-primary));
  box-shadow: 0 .35rem 1rem rgba(46, 113, 124, .24);
  font-size: 1.5rem;
}

.brand-mark-light {
  background: rgba(255, 255, 255, .14);
  box-shadow: none;
}

.app-brand {
  position: relative;
  padding: 1.5rem 1.25rem 1rem;
}

.viewer-menu-toggle {
  position: absolute;
  width: 1.75rem;
  height: 1.75rem;
  z-index: 2;
  border: 2px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  color: #fff;
  background: #285f68;
  box-shadow: 0 .2rem .55rem rgba(19, 55, 61, .3);
  inset-inline-end: -.875rem;
}

.viewer-menu-toggle:hover,
.viewer-menu-toggle:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, .2);
}

.app-brand-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #fff;
  text-decoration: none;
}

.app-brand-link:hover { color: #fff; }

.app-brand-text {
  color: #fff !important;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.sidebar-profile {
  margin: .5rem 1.25rem 1.25rem;
  padding: 1.25rem .75rem;
  border-top: 1px solid rgba(255, 255, 255, .1);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.profile-avatar {
  width: 3rem;
  height: 3rem;
  color: #fff !important;
  background: rgba(255, 255, 255, .14) !important;
  font-weight: 700;
}

.profile-name {
  display: block;
  max-width: 13rem;
  margin-top: .65rem;
  overflow: hidden;
  color: #fff;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-role {
  margin-top: .15rem;
  color: #b9dce1;
  font-size: .75rem;
}

.menu-header-text { color: rgba(255, 255, 255, .55); }

@media (min-width: 1200px) {
  html.layout-menu-collapsed[data-viewer-menu="true"] .layout-menu {
    overflow: visible;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .app-brand {
    display: flex;
    justify-content: center;
    padding: 1.25rem .75rem 1rem;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .app-brand-link {
    width: 100%;
    justify-content: center;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .app-brand-text,
  html.layout-menu-collapsed[data-viewer-menu="true"] .profile-name,
  html.layout-menu-collapsed[data-viewer-menu="true"] .profile-role,
  html.layout-menu-collapsed[data-viewer-menu="true"] .viewer-menu-label {
    display: none !important;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .sidebar-profile {
    margin: .5rem .55rem 1rem;
    padding: 1rem 0;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .menu-header {
    width: auto !important;
    min-height: 1px;
    height: 1px;
    margin: .8rem 1rem;
    padding: 0 !important;
    background: rgba(255, 255, 255, .14);
    text-indent: 0;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .menu-header::before,
  html.layout-menu-collapsed[data-viewer-menu="true"] .menu-header-text {
    display: none !important;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .menu-inner > .menu-item > .menu-link {
    width: auto;
    min-width: 0;
    justify-content: center;
    margin: .35rem .55rem;
    padding: .75rem 0 !important;
    border-radius: .7rem;
    overflow: hidden;
  }

  html.layout-menu-collapsed[data-viewer-menu="true"] .menu-inner > .menu-item > .menu-link .menu-icon {
    flex: 0 0 auto;
    margin: 0 !important;
    font-size: 1.35rem;
  }
}

.viewer-menu-tooltip .tooltip-inner {
  padding: .45rem .65rem;
  font-size: .75rem;
  font-weight: 600;
}

.content-wrapper {
  min-height: 100vh;
  padding: 0;
}

.container-p-y {
  padding-top: 2rem !important;
  padding-bottom: 2rem !important;
}

.content-footer {
  color: var(--audit-muted);
  font-size: .8125rem;
}

.footer-context {
  display: inline-flex;
  align-items: center;
}

.mobile-menu-btn {
  position: fixed;
  inset: .85rem auto auto .85rem;
  z-index: 1090;
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--audit-border);
  border-radius: .75rem;
  background: #fff;
  box-shadow: 0 .25rem .75rem rgba(47, 43, 61, .12);
}

.mobile-hamburger-lines {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.mobile-hamburger-lines span {
  display: block;
  width: 1.25rem;
  height: 2px;
  border-radius: 1rem;
  background: var(--audit-primary);
}

.layout-overlay { border: 0; }
.page-heading { margin-bottom: 1.5rem; }

.page-heading h1 {
  margin-bottom: .35rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -.025em;
}

.page-heading p {
  margin: 0;
  color: var(--audit-muted);
}

.content-card {
  border: 0;
  box-shadow: 0 .25rem 1.125rem rgba(47, 43, 61, .08);
}

.public-layout {
  margin: 0;
  background:
    radial-gradient(circle at 15% 18%, rgba(54, 161, 178, .18), transparent 32rem),
    linear-gradient(135deg, #f4fafb 0%, #f7f7f9 45%, #eef4f5 100%);
}

.public-shell {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
}

.public-brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.public-brand strong,
.public-brand small { display: block; }

.public-brand strong {
  font-size: 1.2rem;
  letter-spacing: -.02em;
}

.public-brand small {
  margin-top: .1rem;
  color: var(--audit-muted);
  font-size: .75rem;
}

.public-content {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  padding: 1rem clamp(1rem, 4vw, 3rem) 3rem;
}

.public-footer {
  padding: 1.25rem;
  color: var(--audit-muted);
  font-size: .75rem;
  text-align: center;
}

.auth-card,
.message-card {
  width: min(100%, 28rem);
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 1rem 3rem rgba(47, 43, 61, .12);
}

.auth-card .card-body,
.message-card .card-body { padding: clamp(1.5rem, 5vw, 2.5rem); }

.auth-eyebrow {
  color: var(--audit-primary);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.auth-card h1,
.message-card h1 {
  margin: .45rem 0 .5rem;
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -.025em;
}

.auth-copy,
.message-copy { color: var(--audit-muted); }

.password-toggle {
  border-color: var(--bs-border-color);
  color: var(--audit-muted);
}

.message-icon {
  display: inline-flex;
  width: 3.5rem;
  height: 3.5rem;
  align-items: center;
  justify-content: center;
  margin-bottom: .75rem;
  border-radius: 50%;
  color: var(--audit-primary);
  background: var(--audit-primary-soft);
  font-size: 1.75rem;
}

.security-note {
  display: flex;
  gap: .6rem;
  margin-top: 1.25rem;
  padding: .8rem 1rem;
  border-radius: .6rem;
  color: #46646a;
  background: var(--audit-primary-soft);
  font-size: .8125rem;
}

.report-time-badge,
.result-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  color: var(--audit-primary-dark);
  background: var(--audit-primary-soft);
  font-size: .75rem;
  font-weight: 700;
}

.report-time-badge { padding: .55rem .8rem; }

.report-filter-card .form-label {
  color: var(--audit-ink);
  font-size: .8125rem;
  font-weight: 600;
}

.report-state {
  display: flex;
  min-height: 10rem;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  color: var(--audit-muted);
  text-align: left;
}

.report-state > i {
  color: var(--audit-primary);
  font-size: 2rem;
}

.report-state strong,
.report-state span { display: block; }

.report-state strong {
  margin-bottom: .2rem;
  color: var(--audit-ink);
  font-size: 1rem;
}

.report-state-error > i { color: #d63939; }

.report-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--audit-border);
}

.report-results-header span:not(.badge) {
  color: var(--audit-muted);
  font-size: .8125rem;
}

.report-table { min-width: 82rem; }

.report-table th {
  color: var(--audit-muted);
  background: #f8f8fa;
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.report-table th,
.report-table td {
  padding: .85rem 1rem;
  vertical-align: middle;
}

.report-table td {
  max-width: 15rem;
  overflow-wrap: anywhere;
}

.report-summary {
  min-width: 16rem;
  color: var(--audit-muted);
  font-size: .8125rem;
}

.result-badge {
  max-width: 12rem;
  padding: .3rem .55rem;
  overflow-wrap: anywhere;
}

.result-badge-large {
  padding: .55rem .85rem;
  font-size: .8125rem;
}

.report-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--audit-border);
}

.report-pagination .page-link.active {
  border-color: var(--audit-primary);
  color: #fff;
  background: var(--audit-primary);
}

.detail-back-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .65rem;
  font-size: .8125rem;
  font-weight: 600;
  text-decoration: none;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem 2rem;
}

.detail-grid-single { grid-template-columns: 1fr; }

.detail-field { min-width: 0; }

.detail-label,
.detail-value { display: block; }

.detail-label,
.evidence-label {
  margin-bottom: .3rem;
  color: var(--audit-muted);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.detail-value {
  overflow-wrap: anywhere;
  color: var(--audit-ink);
}

.evidence-stack {
  display: grid;
  gap: 1.25rem;
}

.evidence-label { margin-bottom: .5rem; }

.evidence-panel {
  max-height: 24rem;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  border: 1px solid var(--audit-border);
  border-radius: .6rem;
  color: #384144;
  background: #f8fafb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .8125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.user-table { min-width: 48rem; }

.user-table th {
  color: var(--audit-muted);
  background: #f8f8fa;
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.user-table th,
.user-table td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
}

.user-status {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .8125rem;
  font-weight: 600;
}

.user-status span {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
}

.user-status-active { color: #247a51; }
.user-status-active span { background: #2fb171; }
.user-status-inactive { color: var(--audit-muted); }
.user-status-inactive span { background: #a8a5af; }

.user-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  white-space: nowrap;
}

.user-actions form { margin: 0; }

.report-table tbody tr:not(.detail-row) {
  cursor: pointer;
}

.report-table tbody tr:not(.detail-row):hover {
  background: #f8f8fa;
}

.report-table tr.detail-row > td {
  max-width: none;
  padding: 0;
  background: #f6f6f9;
  border-top: 2px solid var(--audit-primary);
}

.detail-panel {
  position: sticky;
  left: 0;
  width: 100vw;
  max-width: calc(100vw - 4rem);
  padding: 1.5rem;
}

.detail-panel-header {
  margin-bottom: 1rem;
}

.detail-panel-loading {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100vw;
  max-width: calc(100vw - 4rem);
  padding: 1.5rem;
  color: var(--audit-muted);
  font-size: .875rem;
}

select[data-filter-select][aria-busy="true"] {
  opacity: .6;
  pointer-events: none;
}

@media (max-width: 1199.98px) {
  html .layout-page .content-wrapper > main.container-p-y {
    padding-top: 5rem !important;
  }
}

@media (max-width: 575.98px) {
  .public-brand { justify-content: center; }
  .public-content { align-items: flex-start; }
  .auth-card .card-body,
  .message-card .card-body { padding: 1.35rem; }
  .footer-context { width: 100%; }
  .report-state {
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1.5rem;
  }
  .report-pagination { padding: 1rem; }
  .report-pagination .pagination { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
