@font-face {
  font-family: "BDO Grotesk";
  src: url("assets/fonts/BDOGrotesk-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "BDO Grotesk";
  src: url("assets/fonts/BDOGrotesk-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "BDO Grotesk";
  src: url("assets/fonts/BDOGrotesk-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "BDO Grotesk";
  src: url("assets/fonts/BDOGrotesk-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #F7F6F5;
  --surface: #ffffff;
  --surface-soft: #F7F6F5;
  --ink: #000000;
  --muted: #6f747a;
  --line: #d9d9d9;
  --brand-gray: #F7F6F5;
  --brand-yellow: #FFC965;
  --brand-magenta: #9C0069;
  --brand-gradient: linear-gradient(90deg, #FFC965 0%, #9C0069 100%);
  --brand-gradient-soft: linear-gradient(90deg, rgba(255, 201, 101, 0.2) 0%, rgba(156, 0, 105, 0.16) 100%);
  --verified: #000000;
  --verified-soft: #eeeeee;
  --medium: #8d5d00;
  --medium-soft: #fff2d3;
  --high: #8a005d;
  --high-soft: #fde6f4;
  --low: #3c444a;
  --low-soft: #eceeef;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --radius: 8px;
  font-family: "BDO Grotesk", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
}

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

button,
.file-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 8px 12px;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: inherit;
  text-decoration: none;
}

.button-link.primary {
  border-color: #000000;
  background: #000000;
  color: #ffffff;
  font-weight: 700;
}

button:hover,
.file-button:hover {
  border-color: #000000;
  background: var(--brand-gray);
}

button:active {
  transform: translateY(1px);
}

.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
  font-weight: 700;
}

.primary:hover {
  border-color: var(--brand-magenta);
  background: var(--brand-gradient);
}

.ghost {
  background: transparent;
}

.danger {
  border-color: var(--high);
  color: var(--high);
}

.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.85rem;
}

.icon-button {
  width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px;
  background: #000000;
  border-right: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 86px;
  height: 48px;
  border-radius: 0;
  object-fit: contain;
  box-shadow: none;
}

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

.brand strong {
  font-size: 1.03rem;
  font-weight: 900;
}

.brand span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.project-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.project-panel label {
  display: grid;
  gap: 6px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.project-panel select {
  width: 100%;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: #000000;
  color: #ffffff;
  padding: 6px 8px;
}

.project-meta {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.8rem;
  line-height: 1.35;
}

.nav-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-color: transparent;
  background: transparent;
  text-align: left;
  color: rgba(255, 255, 255, 0.72);
}

.nav-list button.active {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: none;
}

.nav-count {
  display: inline-grid;
  min-width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
}

.nav-list button.active .nav-count {
  background: var(--brand-gradient);
  color: #000000;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sidebar-footer button,
.sidebar-footer .file-button {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.sidebar-footer button:hover,
.sidebar-footer .file-button:hover {
  background: #ffffff;
  color: #000000;
}

.sidebar-footer .file-button {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  text-align: center;
}

.file-button input {
  display: none;
}

.workspace {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 38px) 44px;
}

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

.topbar h1 {
  margin: 4px 0 0;
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 900;
}

.eyebrow {
  margin: 0;
  color: var(--brand-magenta);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.toggle input {
  accent-color: var(--brand-magenta);
}

.notice {
  padding: 12px 14px;
  border: 1px solid var(--brand-yellow);
  border-radius: var(--radius);
  background: var(--medium-soft);
  color: #5a3a00;
  margin-bottom: 16px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section {
  margin-top: 22px;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-header h2,
.panel h2,
.panel h3,
.card h3 {
  margin: 0;
  letter-spacing: 0;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

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

.panel h2,
.panel h3,
.section-header h2,
.card h3 {
  font-weight: 900;
}

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

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

.card.soft {
  background: var(--surface-soft);
}

.metric {
  min-height: 114px;
  display: grid;
  align-content: space-between;
}

.metric strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.metric span,
.muted {
  color: var(--muted);
}

.metric p,
.card p,
.panel p {
  margin: 6px 0 0;
  overflow-wrap: break-word;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 18px;
  align-items: stretch;
}

.hero-panel .panel {
  min-height: 260px;
}

.flow-art {
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--brand-gray);
  padding: 16px;
}

.dashboard-logo-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.dashboard-logo-row img {
  width: min(170px, 42vw);
  height: 82px;
  object-fit: contain;
  object-position: left center;
}

.dashboard-logo-row span {
  font-size: clamp(1.35rem, 2.4vw, 2.45rem);
  line-height: 1;
  font-weight: 900;
  white-space: nowrap;
}

.dashboard-logo-row strong {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.status-row,
.phase-row,
.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.space-between {
  justify-content: space-between;
}

.stack {
  display: grid;
  gap: 10px;
}

.stack.loose {
  gap: 16px;
}

.phase-list {
  display: grid;
  gap: 10px;
}

.phase-row {
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.phase-row:last-child {
  border-bottom: 0;
}

.progress {
  width: 150px;
  height: 8px;
  border-radius: 999px;
  background: #e5e5e5;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--brand-gradient);
}

.badge,
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.badge.high,
.severity-high {
  background: var(--high-soft);
  color: var(--high);
}

.badge.medium,
.severity-medium {
  background: var(--medium-soft);
  color: var(--medium);
}

.badge.low,
.severity-low {
  background: var(--low-soft);
  color: var(--low);
}

.badge.info,
.severity-informational {
  background: #e8ecee;
  color: #4e5b62;
}

.badge.verified {
  background: var(--verified-soft);
  color: var(--verified);
}

.badge.asserted {
  background: var(--brand-gradient-soft);
  color: var(--brand-magenta);
}

.tag {
  background: var(--brand-gray);
  color: #536065;
  font-weight: 700;
}

.area-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.area-toggle {
  display: grid;
  gap: 8px;
  min-height: 110px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.area-toggle strong {
  font-size: 0.92rem;
  line-height: 1.18;
}

.area-toggle span {
  color: var(--muted);
  font-size: 0.78rem;
}

.area-toggle input {
  justify-self: start;
  accent-color: var(--brand-magenta);
}

.area-toggle.off {
  opacity: 0.62;
  background: #eeeeee;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 0.76rem;
  color: #4f5b61;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
}

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

.template-list,
.export-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.template-list button,
.export-tabs button {
  min-height: 34px;
}

.template-list button.active,
.export-tabs button.active {
  background: #000000;
  border-color: #000000;
  color: white;
}

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

.question-list li {
  margin: 7px 0;
}

.finding-list,
.kanban {
  display: grid;
  gap: 12px;
}

.kanban {
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  align-items: start;
}

.kanban-column {
  display: grid;
  gap: 10px;
  min-height: 220px;
  border: 1px dashed #cfc6b9;
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.42);
}

.kanban-column h3 {
  font-size: 0.95rem;
}

.finding-card {
  display: grid;
  gap: 10px;
}

.finding-card header {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.finding-card h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.finding-card footer {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  background: var(--brand-gray);
  color: #4b565c;
  font-size: 0.78rem;
  text-transform: uppercase;
}

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

#exportOutput.export-output {
  width: 100%;
  height: calc(100vh - 280px);
  min-height: 680px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.45;
  white-space: pre;
  resize: vertical;
}

#view-exports .panel {
  min-height: calc(100vh - 130px);
}

#view-exports .field.section {
  margin-bottom: 0;
}

.ingest-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(156, 0, 105, 0.24);
  border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(255, 201, 101, 0.16), rgba(156, 0, 105, 0.08));
}

.ingest-progress p {
  margin: 4px 0 0;
  color: var(--muted);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(22, 28, 31, 0.16);
  border-top-color: var(--accent-strong);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.draft-edit-card {
  background: rgba(247, 246, 245, 0.72);
}

.draft-inline-editor {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.draft-inline-editor .section-header {
  margin-bottom: 12px;
}

.selected-draft {
  border-color: rgba(156, 0, 105, 0.42);
  box-shadow: inset 4px 0 0 var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 28, 31, 0.44);
}

.modal {
  width: min(780px, 100%);
  max-height: min(860px, calc(100vh - 40px));
  overflow: auto;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 26px 80px rgba(22, 28, 31, 0.34);
}

.modal header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.modal h2 {
  margin: 0;
  font-size: 1.18rem;
}

.modal #modalBody {
  padding: 16px;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.44);
}

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

  .hero-panel,
  .grid.three,
  .kanban {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

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

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

  .grid.two,
  .grid.four,
  .area-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px 14px 34px;
  }

  .dashboard-logo-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard-logo-row span {
    white-space: normal;
  }
}
