:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #65717e;
  --line: #d8e0e8;
  --panel: #ffffff;
  --page: #f4f7f8;
  --brand: #cf1f2a;
  --brand-dark: #9f1520;
  --brand-2: #245f9d;
  --ok: #217a45;
  --warn: #a56712;
  --bad: #a43d3d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

a {
  color: var(--brand-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topnav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-width: 138px;
}

.brand-link img {
  display: block;
  width: 138px;
  max-height: 42px;
  object-fit: contain;
}

.topnav a {
  color: var(--ink);
  font-weight: 700;
}

.topnav form {
  margin: 0;
}

.spacer {
  flex: 1;
}

.identity {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.page {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.hero {
  padding: 2rem 0 1rem;
}

.hero h1,
.login-copy h1,
.panel h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p,
.login-copy p {
  max-width: 720px;
  color: var(--muted);
  font-size: 1.05rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 3rem;
  align-items: center;
  min-height: calc(100vh - 4rem);
}

.login-logo {
  display: block;
  width: min(280px, 80vw);
  max-height: 92px;
  object-fit: contain;
  margin-bottom: 1.5rem;
}

.login-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 40px rgba(38, 54, 68, 0.08);
}

.login-card {
  display: grid;
  gap: 1rem;
  padding: 1.4rem;
}

.panel {
  padding: 1.25rem;
}

.compact {
  margin-bottom: 1rem;
}

.panel-heading {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.72rem 0.8rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 0.65rem 1rem;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.secondary,
.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary:hover,
.ghost:hover {
  background: #fff4f5;
  color: var(--brand-dark);
}

.danger {
  min-height: 2.2rem;
  border: 1px solid #efc6ca;
  background: #fff;
  color: var(--brand-dark);
  padding: 0.4rem 0.75rem;
}

.danger:hover {
  background: #fff0f2;
}

.ghost {
  min-height: 2.2rem;
  padding: 0.4rem 0.75rem;
}

.hint,
.empty,
small,
.muted-text {
  color: var(--muted);
}

.alert {
  border: 1px solid #e7b6b6;
  border-radius: 6px;
  padding: 0.7rem;
  background: #fff0f0;
  color: var(--bad);
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.metric {
  display: flex;
  min-height: 150px;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.2rem;
  background: #fff;
}

.metric.small {
  display: grid;
  align-content: center;
}

.metric strong {
  display: block;
  font-size: 2.4rem;
}

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

.ring {
  display: grid;
  flex: 0 0 86px;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--brand) calc(var(--value) * 1%), #e4eaef 0);
}

.ring span {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  font-weight: 900;
}

.grid {
  display: grid;
  gap: 1rem;
}

.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.framework-grid {
  display: grid;
  gap: 0.75rem;
}

.group-browser {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.group-card {
  display: grid;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
  background: #fff;
  color: var(--ink);
}

.group-card:hover,
.group-card.selected {
  border-color: rgba(207, 31, 42, 0.45);
  background: #fff8f9;
  text-decoration: none;
}

.group-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.control-admin-panel {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  background: #fbfcfd;
}

.control-admin-panel summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 900;
}

.control-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.9rem;
}

.control-form .wide,
.control-form button {
  grid-column: 1 / -1;
}

.spaced {
  margin-top: 0.8rem;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.user-card-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.user-card-header p {
  margin: 0;
  color: var(--muted);
}

.avatar {
  display: inline-grid;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
}

.nav-avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.avatar-img {
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.avatar.red {
  background: var(--brand);
}

.avatar.blue {
  background: #245f9d;
}

.avatar.green {
  background: #217a45;
}

.avatar.gold {
  background: #a56712;
}

.avatar.slate {
  background: #52616f;
}

.avatar.violet {
  background: #6d4eb3;
}

.checkbox-line {
  display: flex;
  grid-column: 1 / -1;
  gap: 0.55rem;
  align-items: center;
}

.checkbox-line input {
  width: auto;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.user-form h2,
.user-form button,
.user-form .wide {
  grid-column: 1 / -1;
}

.add-user {
  margin-top: 1rem;
}

.framework-card {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.framework-card.active {
  border-color: rgba(207, 31, 42, 0.35);
}

.framework-card.muted {
  opacity: 0.72;
}

.framework-card p {
  margin: 0;
  color: var(--muted);
}

.framework-card span,
.status,
.file-count {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.framework-card span {
  background: #fff0f2;
  color: var(--brand);
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.click-row {
  cursor: pointer;
}

.click-row:hover {
  background: #fff8f9;
}

.click-row td:first-child a {
  color: var(--ink);
}

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px auto;
  gap: 0.75rem;
  margin: 1rem 0;
}

.control-link {
  display: block;
  max-width: 420px;
  font-weight: 800;
}

.control-table td:nth-child(2) {
  max-width: 440px;
}

.file-count {
  background: #eaf0f5;
  color: var(--ink);
}

.status.pending {
  background: #eef2f5;
  color: #52616f;
}

.status.approved {
  background: #e5f3ea;
  color: var(--ok);
}

.status.needs_improvement {
  background: #fff2df;
  color: var(--warn);
}

.status.revision_required {
  background: #ffebeb;
  color: var(--bad);
}

.control-detail {
  display: grid;
  gap: 1rem;
}

.back {
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}

.hints {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.match-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 0.8rem;
}

.match-list {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.match-list li {
  display: grid;
  gap: 0.2rem;
}

.match-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.requirement-meta {
  margin: 0.8rem 0 1rem;
  border-left: 4px solid var(--brand);
  padding: 0.65rem 0.8rem;
  background: #fff8f9;
  color: var(--muted);
  font-size: 0.92rem;
}

.source-requirements {
  margin-top: 0.5rem;
}

.source-requirements summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 800;
}

.source-requirements p {
  margin-bottom: 0;
}

.evidence-item,
.review-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  background: #fbfcfd;
}

.evidence-item {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.delete-form {
  flex: 0 0 auto;
  margin: 0;
}

.evidence-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.mini {
  min-height: 2.2rem;
  padding: 0.4rem 0.75rem;
}

.evidence-item a {
  font-weight: 800;
}

.evidence-item small,
.review-item small {
  display: block;
  margin-top: 0.35rem;
}

.evidence-comment {
  margin: 0.55rem 0 0;
  border-left: 3px solid var(--brand);
  padding: 0.45rem 0.65rem;
  background: #fff8f9;
  color: var(--muted);
}

.preview-comment {
  max-width: 760px;
}

.review-item p {
  margin: 0.55rem 0;
}

.evidence-preview {
  display: grid;
  gap: 1rem;
}

.preview-heading {
  align-items: flex-start;
}

.preview-heading h1 {
  margin-top: 0.4rem;
  font-size: 1.35rem;
  line-height: 1.25;
}

.preview-frame {
  width: 100%;
  min-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.preview-image {
  display: block;
  width: min(100%, 980px);
  max-height: 75vh;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #fff;
}

.preview-text,
.preview-fallback,
.sheet-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 1rem;
}

.preview-text p {
  margin: 0 0 0.8rem;
  line-height: 1.55;
}

.table-scroll {
  overflow: auto;
}

.preview-table {
  min-width: 720px;
  font-size: 0.9rem;
}

.preview-table td {
  min-width: 120px;
  max-width: 260px;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .login-shell,
  .two,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .evidence-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .evidence-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topnav {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .spacer {
    display: none;
  }

  .identity {
    font-size: 0.84rem;
  }

  .brand-link {
    width: 100%;
  }

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

  th:nth-child(2),
  td:nth-child(2) {
    display: none;
  }
}
