:root {
  color-scheme: dark;
  --bg: #11130f;
  --panel: #171a15;
  --panel-2: #1d211a;
  --line: #30362a;
  --line-bright: #49523d;
  --text: #f2f0e8;
  --muted: #999f90;
  --acid: #c8ff66;
  --acid-soft: rgba(200, 255, 102, 0.12);
  --orange: #ff9f52;
  --yellow: #e7d34f;
  --blue: #72b7ff;
  --red: #ff6f68;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% -10%, rgba(200, 255, 102, 0.11), transparent 32rem),
    linear-gradient(180deg, #10120e 0%, var(--bg) 100%);
  color: var(--text);
}

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

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(560px, 100%);
  padding: clamp(30px, 6vw, 58px);
  background: linear-gradient(155deg, rgba(29, 33, 26, 0.98), rgba(20, 23, 18, 0.98));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin-bottom: 34px;
  border: 1px solid var(--acid);
  border-radius: 16px;
  color: var(--acid);
  font: 800 17px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 30px var(--acid-soft);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--acid);
  font: 700 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.auth-copy {
  margin: 18px 0 34px;
  color: var(--muted);
  line-height: 1.6;
}

label {
  display: block;
  margin-bottom: 9px;
  color: #c9cdbf;
  font-size: 13px;
  font-weight: 650;
}

.password-row { display: flex; gap: 10px; }

.password-row input {
  min-width: 0;
  flex: 1;
  padding: 13px 15px;
  color: var(--text);
  background: #0e100d;
  border: 1px solid var(--line-bright);
  border-radius: 10px;
  outline: none;
}

.password-row input:focus { border-color: var(--acid); box-shadow: 0 0 0 3px var(--acid-soft); }

.primary-button, .secondary-button, .icon-button, .file-button, .view-tab {
  border-radius: 9px;
  font-weight: 750;
  transition: 150ms ease;
}

.primary-button {
  padding: 0 20px;
  color: #13160f;
  background: var(--acid);
  border: 1px solid var(--acid);
}

.primary-button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.form-error { min-height: 20px; margin: 12px 0 0; color: var(--red); font-size: 13px; }

.app-shell { width: min(1800px, 100%); margin: 0 auto; padding: 28px clamp(16px, 3vw, 48px) 22px; }

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 { font-size: clamp(26px, 3vw, 38px); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 12px rgba(200, 255, 102, 0.5); }
.save-status.saving .status-dot { background: var(--yellow); box-shadow: none; animation: pulse 1s infinite; }
.save-status.error .status-dot { background: var(--red); box-shadow: none; }

@keyframes pulse { 50% { opacity: 0.35; } }

.secondary-button, .icon-button {
  min-height: 39px;
  padding: 0 14px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line-bright);
}

.secondary-button:hover, .icon-button:hover { border-color: var(--acid); color: var(--acid); }

.intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 2px 18px;
}

.intro p { margin: 0; color: var(--muted); font-size: 14px; }
.intro .intro-title { margin-bottom: 5px; color: var(--text); font-weight: 750; font-size: 15px; }
.legend { display: flex; gap: 7px; }

.severity {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 99px;
  font: 750 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.severity.high { color: var(--orange); background: rgba(255, 159, 82, 0.12); }
.severity.medium { color: var(--yellow); background: rgba(231, 211, 79, 0.12); }
.severity.low { color: var(--blue); background: rgba(114, 183, 255, 0.12); }

.table-card {
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 1467px; border-collapse: collapse; table-layout: fixed; }
th, td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }

th {
  padding: 13px 12px;
  color: #aeb4a5;
  background: #141712;
  font: 700 10px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.11em;
  text-align: left;
  text-transform: uppercase;
}

th:nth-child(1) { width: 120px; }
th:nth-child(2) { width: 190px; }
th:nth-child(3) { width: 360px; }
th:nth-child(4) { width: 115px; }
th:nth-child(5) { width: 150px; }
th:nth-child(6) { width: 290px; }
th:nth-child(7) { width: 160px; text-align: center; }
th:nth-child(8) { width: 82px; text-align: center; }

td { padding: 0; background: var(--panel); }
tbody tr:hover td { background: #1a1e18; }

.editable {
  width: 100%;
  min-height: 54px;
  margin: 0;
  padding: 14px 12px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: none;
  line-height: 1.45;
  resize: vertical;
}

textarea.editable { display: block; min-height: 74px; }
.editable:focus { background: var(--acid-soft); box-shadow: inset 0 0 0 1px var(--acid); }
.editable.unsaved { box-shadow: inset 3px 0 0 var(--yellow); }
.editable.save-error { box-shadow: inset 3px 0 0 var(--red); }
select.editable { appearance: none; cursor: pointer; font: 750 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

.file-cell { height: 74px; padding: 10px; text-align: center; vertical-align: middle; }
.file-actions { display: flex; gap: 6px; }
.file-button {
  width: 100%;
  min-height: 34px;
  color: var(--acid);
  background: var(--acid-soft);
  border: 1px solid rgba(200, 255, 102, 0.28);
  font-size: 11px;
  letter-spacing: 0.03em;
}
.file-actions .file-button { width: auto; flex: 1; padding: 0 9px; }
.file-button.secondary { color: #c4c9bb; background: transparent; border-color: var(--line-bright); }
.file-button.secondary:hover { color: var(--acid); border-color: var(--acid); }
.file-button:hover { border-color: var(--acid); }
.file-button:disabled { cursor: not-allowed; color: #686e62; background: transparent; border-color: var(--line); }

.empty-state { padding: 70px 20px; color: var(--muted); text-align: center; }

.report-dialog {
  width: min(1180px, calc(100vw - 32px));
  height: min(92vh, 980px);
  max-width: none;
  max-height: none;
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line-bright);
  border-radius: 18px;
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.72);
}

.report-dialog::backdrop { background: rgba(4, 5, 3, 0.82); backdrop-filter: blur(5px); }
.report-shell { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr); }

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px 20px;
  border-bottom: 1px solid var(--line);
}

.report-header h2 { max-width: 900px; margin: 0; font-size: clamp(21px, 3vw, 30px); line-height: 1.2; letter-spacing: -0.025em; }
.report-filename { margin: 8px 0 0; color: var(--muted); font: 600 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }

.report-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 16px 9px 22px;
  background: #141712;
  border-bottom: 1px solid var(--line);
}

.view-switcher { display: flex; gap: 4px; padding: 3px; background: #0e100d; border: 1px solid var(--line); border-radius: 10px; }
.view-tab { min-height: 32px; padding: 0 13px; color: var(--muted); background: transparent; border: 0; }
.view-tab.active { color: #12150e; background: var(--acid); }
.report-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.report-status { min-width: 90px; color: var(--muted); font-size: 12px; text-align: right; }
.report-status.error { color: var(--red); }
.report-save { min-height: 39px; }
.report-save:disabled { cursor: not-allowed; opacity: 0.42; transform: none; }

.report-content { min-height: 0; overflow: hidden; }
.markdown-viewer, .report-editor { width: 100%; height: 100%; overflow: auto; }

.markdown-viewer {
  padding: clamp(24px, 5vw, 58px) clamp(22px, 7vw, 84px) 70px;
  color: #dfe3d7;
  font-size: 15px;
  line-height: 1.72;
}

.markdown-viewer > :first-child { margin-top: 0; }
.markdown-viewer h1, .markdown-viewer h2, .markdown-viewer h3, .markdown-viewer h4, .markdown-viewer h5, .markdown-viewer h6 { color: var(--text); line-height: 1.25; letter-spacing: -0.02em; }
.markdown-viewer h1 { margin: 0 0 30px; padding-bottom: 16px; border-bottom: 1px solid var(--line); font-size: 34px; }
.markdown-viewer h2 { margin: 42px 0 16px; font-size: 25px; }
.markdown-viewer h3 { margin: 32px 0 12px; font-size: 19px; }
.markdown-viewer h4, .markdown-viewer h5, .markdown-viewer h6 { margin: 26px 0 10px; font-size: 16px; }
.markdown-viewer p { margin: 0 0 18px; }
.markdown-viewer ul, .markdown-viewer ol { margin: 0 0 20px; padding-left: 28px; }
.markdown-viewer li { margin: 7px 0; }
.markdown-viewer a { color: var(--acid); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown-viewer code { padding: 0.15em 0.36em; color: #e8ffc2; background: #0d0f0c; border: 1px solid #293021; border-radius: 5px; font: 0.88em/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.markdown-viewer pre { position: relative; margin: 22px 0; padding: 19px 20px; overflow-x: auto; background: #0d0f0c; border: 1px solid #293021; border-radius: 11px; }
.markdown-viewer pre code { padding: 0; color: #d9e8ca; background: transparent; border: 0; white-space: pre; }
.markdown-viewer pre code[data-language]::before { content: attr(data-language); display: block; margin-bottom: 11px; color: #78816f; font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.11em; text-transform: uppercase; }
.markdown-viewer blockquote { margin: 22px 0; padding: 13px 18px; color: #bcc3b2; background: rgba(200, 255, 102, 0.06); border-left: 3px solid var(--acid); }
.markdown-viewer blockquote > :last-child { margin-bottom: 0; }
.markdown-viewer hr { margin: 36px 0; border: 0; border-top: 1px solid var(--line); }
.markdown-table-scroll { margin: 22px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.markdown-viewer table { width: 100%; min-width: 520px; table-layout: auto; }
.markdown-viewer th { width: auto; padding: 11px 13px; text-align: left; }
.markdown-viewer td { padding: 11px 13px; color: #d5dacd; background: #151814; }

.report-editor {
  display: block;
  padding: 24px 26px 60px;
  color: #e5eadf;
  background: #0d0f0c;
  border: 0;
  outline: none;
  resize: none;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}
.report-editor:focus { box-shadow: inset 0 0 0 1px var(--acid); }

footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 4px 0;
  color: #777d70;
  font: 600 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 15px;
  color: #14170f;
  background: var(--acid);
  border-radius: 9px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 180ms ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 760px) {
  .password-row { flex-direction: column; }
  .primary-button { min-height: 46px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { justify-content: flex-start; }
  .intro { align-items: flex-start; flex-direction: column; }
  .legend { display: none; }
  footer { flex-direction: column; }
  .report-dialog { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
  .report-header { padding: 18px 16px 15px; }
  .report-toolbar { align-items: stretch; flex-direction: column; padding: 10px 14px; }
  .report-actions { justify-content: stretch; flex-wrap: wrap; }
  .report-actions button { flex: 1; }
  .report-status { order: 3; width: 100%; min-width: 0; text-align: left; }
  .markdown-viewer { padding: 25px 18px 60px; }
  .report-editor { padding: 18px 16px 50px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

