:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #171b1f;
  --panel-2: #1d2329;
  --line: #2b333b;
  --text: #eef2f5;
  --muted: #9da9b5;
  --accent: #f6c85f;
  --accent-2: #f6c85f;
  --danger: #ef6f6c;
  --critical: #e95678;
  --high: #f77f45;
  --medium: #f6c85f;
  --low: #6fbf73;
  --info: #7aa2f7;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button,
.file-button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover,
.file-button:hover,
.finding-item:hover,
.evidence-item:hover {
  border-color: var(--accent);
}

button.danger {
  color: #ffd7d5;
  border-color: rgba(239, 111, 108, .45);
}

.topbar {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #13171a;
  position: sticky;
  top: 0;
  z-index: 5;
}

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

.mark {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  display: block;
  flex: 0 0 auto;
}

.mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p,
.editor-head p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

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

.file-button {
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.file-button.small {
  min-height: 30px;
  font-size: 12px;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: calc(100vh - 74px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--panel);
  min-height: 100%;
}

.side-section {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.side-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.side-head h2,
.editor h2 {
  font-size: 15px;
}

.side-head span {
  color: var(--muted);
  font-size: 12px;
}

.finding-list,
.evidence-list {
  display: grid;
  gap: 8px;
}

.finding-item,
.evidence-item {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #14181c;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
}

.finding-item.active {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel-2) 72%, var(--panel));
}

.finding-item.active.severity-card-critical {
  border-color: color-mix(in srgb, var(--critical) 46%, var(--line));
  background: color-mix(in srgb, var(--critical) 10%, var(--panel));
}

.finding-item.active.severity-card-high {
  border-color: color-mix(in srgb, var(--high) 46%, var(--line));
  background: color-mix(in srgb, var(--high) 10%, var(--panel));
}

.finding-item.active.severity-card-medium {
  border-color: color-mix(in srgb, var(--medium) 46%, var(--line));
  background: color-mix(in srgb, var(--medium) 10%, var(--panel));
}

.finding-item.active.severity-card-low {
  border-color: color-mix(in srgb, var(--low) 46%, var(--line));
  background: #172523;
}

.finding-item.active.severity-card-informational {
  border-color: color-mix(in srgb, var(--info) 46%, var(--line));
  background: color-mix(in srgb, var(--info) 10%, var(--panel));
}

.finding-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.finding-title,
.evidence-title {
  display: block;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.finding-sub,
.evidence-sub {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.severity {
  font-size: 11px;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 2px 7px;
  flex: 0 0 auto;
}

.severity.critical { color: var(--critical); }
.severity.high { color: var(--high); }
.severity.medium { color: var(--medium); }
.severity.low { color: var(--low); }
.severity.informational { color: var(--info); }

.workspace {
  padding: 18px;
  display: grid;
  gap: 18px;
  align-content: start;
}

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

.report-grid {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.report-grid label:nth-child(4),
.report-grid label:nth-child(5),
.finding-form > label {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0f1316;
  color: var(--text);
  border-radius: 6px;
  padding: 10px;
  outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

.editor {
  min-height: 340px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 28px;
  background: #121619;
}

.empty-state p {
  color: var(--muted);
  margin-top: 8px;
}

.finding-form {
  display: grid;
  gap: 12px;
}

.screenshots {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111519;
  padding: 12px;
}

.screenshots-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.screenshots h3 {
  margin: 0;
  font-size: 14px;
}

.screenshots p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.screenshot-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.screenshot-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #0d1114;
}

.screenshot-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  display: block;
  background: #080a0c;
}

.screenshot-card figcaption {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  color: var(--muted);
  font-size: 12px;
}

.screenshot-card figcaption span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screenshot-card figcaption button {
  min-height: 28px;
  padding: 0 8px;
}

.empty-inline {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--accent);
  color: #051413;
  padding: 10px 12px;
  border-radius: 6px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 920px) {
  .topbar,
  .layout,
  .report-grid,
  .field-grid {
    display: block;
  }

  .brand,
  .top-actions,
  .workspace,
  .report-grid,
  .field-grid {
    margin-top: 12px;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  label,
  .finding-form {
    margin-top: 12px;
  }
}
