:root {
  --bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #eef3ee;
  --ink: #17201b;
  --muted: #627066;
  --line: #d6ded5;
  --accent: #1d6f5f;
  --accent-dark: #12493f;
  --warn: #b7602a;
  --bad: #a94442;
  --good: #237a4f;
  --focus: #0f8b8d;
  --shadow: 0 12px 34px rgba(29, 45, 38, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

body.auth-active .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

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

button,
.button-like {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  min-height: 36px;
  padding: 0 12px;
  text-decoration: none;
}

button:hover,
.button-like:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

button.secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  justify-content: center;
  width: 100%;
}

button.secondary-inline {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

button.secondary-inline:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.auth-screen {
  align-items: center;
  background: rgba(244, 246, 243, 0.94);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 20;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 420px;
  padding: 22px;
  width: 100%;
}

.auth-card h1 {
  margin-bottom: 18px;
}

.auth-card button {
  justify-content: center;
  width: 100%;
}

.form-error {
  color: var(--bad);
  font-size: 0.86rem;
  font-weight: 800;
  margin: 10px 0 0;
}

button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.button-like:focus-visible {
  outline: 3px solid rgba(15, 139, 141, 0.25);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 auto 14px;
  max-width: 1760px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  line-height: 1.1;
  margin-bottom: 0;
}

h2 {
  font-size: 0.98rem;
  line-height: 1.2;
  margin-bottom: 12px;
}

h3 {
  font-size: 1rem;
  line-height: 1.25;
  margin-bottom: 10px;
}

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

.topbar-actions button,
.topbar-actions .button-like {
  align-items: center;
  display: inline-flex;
  font-size: 1rem;
  font-weight: 700;
  height: 46px;
  justify-content: center;
  line-height: 1;
  margin: 0;
  min-height: 46px;
  padding: 0 14px;
  white-space: nowrap;
}

#importJson {
  display: none;
}

.summary-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin: 0 auto 14px;
  max-width: 1760px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
}

.metric span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  font-size: 1.7rem;
  line-height: 1.1;
  margin-top: 2px;
}

.workspace {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(250px, 300px) minmax(360px, 1.05fr) minmax(390px, 0.95fr);
  margin: 0 auto;
  max-width: 1760px;
}

.sidebar,
.criteria-pane,
.detail-pane {
  min-width: 0;
}

.panel,
.criteria-pane,
.detail-pane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  margin-bottom: 10px;
  padding: 14px;
}

.panel-note {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin: -2px 0 10px;
  padding: 8px 9px;
}

.is-hidden {
  display: none !important;
}

label {
  color: var(--muted);
  display: block;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 10px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  margin-top: 5px;
  min-height: 36px;
  padding: 7px 9px;
  width: 100%;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.checkbox-row {
  align-items: center;
  color: var(--ink);
  display: flex;
  gap: 8px;
  font-weight: 700;
}

.checkbox-row input {
  flex: 0 0 auto;
  margin: 0;
  min-height: auto;
  width: 16px;
}

.check-list {
  display: grid;
  gap: 8px;
}

.user-line,
.status-row {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.user-line span,
.status-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.user-line strong,
.status-row strong {
  font-size: 0.82rem;
}

.audit-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.audit-list-item {
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  display: grid;
  justify-items: start;
  min-height: auto;
  padding: 9px;
  text-align: left;
}

.audit-list-item:hover,
.audit-list-item.active {
  background: var(--surface-soft);
  border-color: #bfd3ca;
}

.audit-list-item strong {
  font-size: 0.86rem;
}

.audit-list-item span,
.audit-list-item small {
  color: var(--muted);
  font-size: 0.76rem;
}

.check-list label {
  margin: 0;
}

.criteria-pane,
.detail-pane {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 172px);
  overflow: hidden;
}

.pane-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 66px;
  padding: 14px 16px;
}

.pane-header h2 {
  margin-bottom: 3px;
}

#listMeta {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0;
}

.criteria-list {
  overflow: auto;
  padding: 8px;
}

.criterion-row {
  background: #fff;
  border: 1px solid transparent;
  border-radius: 7px;
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(78px, 0.16fr) minmax(0, 1fr) minmax(88px, 0.22fr);
  margin-bottom: 6px;
  min-height: 64px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.criterion-row:hover,
.criterion-row.active {
  background: var(--surface-soft);
  border-color: #bfd3ca;
}

.criterion-id {
  font-weight: 900;
}

.criterion-title {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.criterion-area,
.criterion-requirement {
  color: var(--muted);
  font-size: 0.78rem;
}

.criterion-requirement {
  margin-top: 3px;
}

.badge-stack {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 900;
  justify-content: center;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.badge.essential {
  background: #d9ebe4;
  color: #0f513f;
}

.badge.optional {
  background: #f3e5d8;
  color: #7a3c15;
}

.badge.excluded {
  background: #ecefed;
  color: #5f6863;
}

.badge.ok {
  background: #d8eee0;
  color: var(--good);
}

.badge.partial {
  background: #f7eadb;
  color: var(--warn);
}

.badge.fail {
  background: #f3dcdc;
  color: var(--bad);
}

.badge.neutral {
  background: #e7ece9;
  color: var(--muted);
}

.detail-content {
  overflow: auto;
  padding: 16px;
}

.detail-empty {
  color: var(--muted);
  padding: 32px 16px;
}

.detail-heading {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.detail-heading h2 {
  font-size: 1.35rem;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.meta-line {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.83rem;
  gap: 8px;
  margin: 0;
}

.assessment-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.assessment-grid .wide {
  grid-column: 1 / -1;
}

.computed-result {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 78px;
  padding: 10px;
}

.computed-result.ok {
  background: #edf8f1;
  border-color: #a7d7b7;
}

.computed-result.partial {
  background: #fff3e4;
  border-color: #dfb27c;
}

.computed-result.fail {
  background: #fdecec;
  border-color: #dfa3a3;
}

.computed-result.neutral {
  background: #eef3ee;
  border-color: var(--line);
}

.computed-result span,
.computed-result small {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
}

.computed-result strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1.2;
  margin: 5px 0;
}

.computed-result.ok strong {
  color: var(--good);
}

.computed-result.partial strong {
  color: var(--warn);
}

.computed-result.fail strong {
  color: var(--bad);
}

.computed-result.neutral strong {
  color: var(--muted);
}

.assessment-card {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 16px;
  padding: 14px;
}

.assessment-card h3 {
  margin-bottom: 8px;
}

.assessment-card h4 {
  font-size: 0.82rem;
  margin: 12px 0 6px;
}

.assessment-card p {
  margin-bottom: 0;
}

.assessment-split {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.assessment-list li {
  margin-bottom: 5px;
}

.ai-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: -4px 0 16px;
}

.ai-actions span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.ai-actions button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.recommended-evidence {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 10px;
}

.info-section {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.info-section p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.info-section .empty-value {
  color: var(--muted);
}

.source-note {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 14px;
  padding: 10px;
}

.area-bars {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.area-bar {
  display: grid;
  gap: 4px;
}

.area-bar span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.track {
  background: #e4ebe5;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.fill {
  background: var(--accent);
  height: 100%;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  }

  .detail-pane {
    grid-column: 1 / -1;
    min-height: 540px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .summary-grid,
  .workspace,
  .assessment-grid,
  .assessment-split {
    grid-template-columns: 1fr;
  }

  .criteria-pane,
  .detail-pane {
    min-height: 480px;
  }

  .criterion-row {
    grid-template-columns: 1fr;
  }

  .badge-stack {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media print {
  body {
    background: #fff;
  }

  .sidebar,
  .criteria-pane,
  .topbar-actions {
    display: none;
  }

  .app-shell {
    padding: 0;
  }

  .topbar,
  .summary-grid,
  .workspace {
    max-width: none;
  }

  .workspace {
    display: block;
  }

  .detail-pane,
  .metric {
    box-shadow: none;
  }
}
