:root {
  color-scheme: light;
  --ink: #172539;
  --muted: #68778a;
  --line: #e2e8ef;
  --surface: #ffffff;
  --canvas: #f3f6f9;
  --navy: #101b2c;
  --blue: #2865db;
  --blue-dark: #1d51bb;
  --green: #13795b;
  --green-soft: #e5f5ee;
  --amber: #996519;
  --amber-soft: #fff3dc;
  --red: #b83c45;
  --shadow: 0 14px 40px rgba(27, 46, 71, 0.06);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  height: 74px;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  background: var(--navy);
}

.brand {
  display: inline-flex;
  align-items: center;
  color: #fff;
  text-decoration: none;
  font-family: Manrope, sans-serif;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #c3cedd;
  font-size: 13px;
}

.logout-error {
  color: #ffabb0;
  font-size: 11px;
}

main {
  width: min(1180px, calc(100% - 48px));
  min-height: calc(100vh - 132px);
  margin: 0 auto;
  padding: 54px 0 72px;
}

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

h1,
h2 {
  font-family: Manrope, "DM Sans", sans-serif;
  letter-spacing: -0.035em;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  line-height: 1.3;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: center;
  gap: 70px;
  max-width: 1020px;
  min-height: 510px;
  margin: 0 auto;
}

.intro {
  max-width: 530px;
}

.intro h1 {
  max-width: 490px;
  color: var(--navy);
  font-size: clamp(40px, 5vw, 56px);
}

.intro-copy {
  max-width: 450px;
  margin: 22px 0 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.eyebrow {
  margin-bottom: 10px;
  color: #74849a;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.intro-note {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #53647a;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #35a67c;
  box-shadow: 0 0 0 4px #dff3ea;
}

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

.login-panel {
  padding: 34px;
}

.report-access-panel {
  width: min(480px, 100%);
  margin: 20px auto;
  padding: 30px;
}

.report-access-panel h1 {
  margin-bottom: 8px;
  font-size: 30px;
}

.report-access-panel .muted {
  margin-bottom: 22px;
}

.report-access-panel input {
  margin: 7px 0 16px;
}

.report-access-panel .button {
  margin-top: 3px;
}

.text-link {
  display: block;
  margin: 14px auto 0;
  border: 0;
  padding: 4px;
  color: var(--blue);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.panel-heading {
  margin-bottom: 28px;
}

.panel-heading .eyebrow {
  margin-bottom: 7px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #35465b;
  font-size: 12px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #d6dee8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 43px;
  padding: 10px 12px;
}

textarea {
  min-height: 100px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #6f9bed;
  box-shadow: 0 0 0 3px rgba(40, 101, 219, 0.12);
}

.login-panel input {
  margin-bottom: 19px;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

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

.button-primary {
  color: #fff;
  background: var(--blue);
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button-secondary {
  border-color: #d7e2f5;
  color: var(--blue);
  background: #f6f9ff;
}

.button-secondary:hover {
  background: #edf3ff;
}

.button-quiet {
  border-color: #334258;
  color: #cfdae8;
  background: transparent;
}

.button-quiet:hover {
  border-color: #6d82a1;
  background: rgba(255, 255, 255, 0.06);
}

.full-width {
  width: 100%;
}

.login-panel .button {
  margin-top: 3px;
}

.message {
  min-height: 18px;
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.5;
}

.error-message {
  color: var(--red);
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.welcome-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 28px;
}

.welcome-row h1 {
  margin-bottom: 6px;
  font-size: 32px;
}

.welcome-row .muted {
  margin-bottom: 0;
}

.tier-badge {
  margin-bottom: 4px;
  border-radius: 999px;
  padding: 8px 12px;
  color: #586a7d;
  background: #e7edf4;
  font-size: 11px;
  font-weight: 700;
}

.tier-badge.paid {
  color: var(--green);
  background: var(--green-soft);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 18px 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-label {
  color: #78889b;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.metric-card strong {
  margin: 8px 0 3px;
  color: var(--navy);
  font-family: Manrope, sans-serif;
  font-size: 29px;
  letter-spacing: -0.04em;
}

.metric-detail {
  color: #8491a0;
  font-size: 10px;
}

.metric-card-alert strong {
  color: #b83c45;
}

.admin-panel {
  margin-bottom: 24px;
  padding: 26px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading .eyebrow {
  margin-bottom: 7px;
}

.subtle,
.form-help {
  color: #8390a0;
  font-size: 11px;
}

.organization-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  align-items: end;
  gap: 12px;
}

.organization-form label {
  margin-bottom: 0;
}

.organization-form input {
  display: block;
  margin-top: 7px;
  font-size: 12px;
}

.organization-form .button {
  margin-bottom: 0;
}

.form-help {
  margin: 10px 0 0;
}

.organization-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.report-admin {
  margin-top: 26px;
  border-top: 1px solid #e8edf2;
  padding-top: 22px;
}

.report-admin > .muted {
  margin-bottom: 15px;
}

.report-generation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.report-generation-form label {
  grid-column: 1 / -1;
  margin-bottom: -5px;
}

.report-generation-form input {
  font-size: 11px;
}

.report-client-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.report-client-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 1.1fr);
  align-items: center;
  gap: 16px;
  border-top: 1px solid #edf0f4;
  padding: 13px 0;
}

.report-client-info {
  min-width: 0;
}

.report-client-info strong,
.report-client-info span {
  display: block;
}

.report-client-info strong {
  color: #28394e;
  font-size: 12px;
}

.report-client-info span {
  margin-top: 5px;
  overflow: hidden;
  color: #8592a2;
  font-size: 10px;
  text-overflow: ellipsis;
}

.report-client-controls {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.report-client-access {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.report-client-access label {
  grid-column: 1 / -1;
  margin: 0;
  color: #728196;
  font-size: 10px;
}

.report-client-access input {
  min-height: 34px;
  font-size: 10px;
}

.report-client-access .button,
.report-client-controls > .button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 10px;
}

.organization-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid #edf0f4;
  padding-top: 11px;
}

.organization-row strong {
  font-size: 12px;
}

.org-access {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.content-grid {
  display: grid;
  grid-template-columns: 0.88fr 1.12fr;
  gap: 22px;
}

.upload-panel,
.scans-panel,
.findings-panel {
  padding: 26px;
}

.icon-bubble {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--blue);
  background: #edf3ff;
  font-size: 18px;
}

.upload-panel > .muted {
  margin: -4px 0 20px;
}

.upload-panel form > label:not(.file-picker) {
  margin-bottom: 14px;
}

.file-picker {
  min-height: 146px;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  border: 1px dashed #b6c4d6;
  border-radius: 10px;
  background: #f9fbfd;
  cursor: pointer;
  text-align: center;
}

.file-picker:hover {
  border-color: #75a0eb;
  background: #f5f8ff;
}

.file-picker strong {
  margin-top: 6px;
  color: #35465b;
  font-size: 12px;
}

.file-picker span:last-of-type {
  color: #8693a3;
  font-size: 10px;
  font-weight: 400;
}

.file-icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--blue);
  background: #e9f0ff;
  font-size: 18px;
}

.file-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.selected-file {
  min-height: 15px;
  margin: 9px 0 11px;
  overflow: hidden;
  color: #79879a;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.format-details {
  margin-top: 15px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.format-details summary {
  color: #53647a;
  cursor: pointer;
  font-weight: 600;
}

.format-details p {
  margin: 8px 0 0;
}

code {
  border-radius: 4px;
  padding: 1px 4px;
  color: #3d5c8c;
  background: #f0f4fa;
}

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

.scan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid #e8edf2;
  border-radius: 10px;
  padding: 13px 14px;
}

.scan-main {
  min-width: 0;
  cursor: pointer;
}

.scan-main strong {
  display: block;
  overflow: hidden;
  color: #28394e;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-main span {
  display: block;
  margin-top: 5px;
  color: #8592a2;
  font-size: 10px;
}

.scan-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scan-actions .button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 10px;
}

.empty-state {
  border: 1px dashed #dce4ec;
  border-radius: 10px;
  padding: 28px 16px;
  color: #8491a1;
  font-size: 12px;
  text-align: center;
}

.findings-panel {
  margin-top: 22px;
}

.findings-panel > .muted {
  margin: -7px 0 17px;
}

.finding-list {
  display: grid;
  gap: 11px;
}

.finding-card {
  border: 1px solid #e6ebf1;
  border-radius: 10px;
  padding: 15px;
}

.finding-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.finding-top strong {
  font-family: Manrope, sans-serif;
  font-size: 13px;
}

.finding-meta {
  margin-top: 5px;
  color: #7a8798;
  font-size: 10px;
}

.severity {
  border-radius: 999px;
  padding: 5px 8px;
  color: #657487;
  background: #edf1f5;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.severity.critical,
.severity.high {
  color: #ab3e45;
  background: #fcebed;
}

.severity.medium {
  color: #966319;
  background: #fff3dc;
}

.severity.low,
.severity.info {
  color: #27765c;
  background: #e7f5ee;
}

.draft-notice {
  margin: 11px 0 0;
  border-left: 3px solid #e4ad43;
  padding: 8px 10px;
  color: #715522;
  background: #fff9ee;
  font-size: 10px;
  line-height: 1.5;
}

.recommendation {
  margin: 12px 0 7px;
  color: #435368;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.source-link {
  color: var(--blue);
  font-size: 10px;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.review-form {
  display: grid;
  gap: 9px;
  margin-top: 13px;
}

.review-form label {
  margin-bottom: -4px;
  color: #67768a;
  font-size: 10px;
}

.review-form input {
  min-height: 37px;
  font-size: 11px;
}

.review-form textarea {
  min-height: 82px;
  font-size: 11px;
}

.review-form .button {
  justify-self: start;
}

.review-state {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
}

footer {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid #e3e9ef;
  padding: 0 max(28px, calc((100vw - 1180px) / 2));
  color: #8793a2;
  background: #f7f9fb;
  font-size: 10px;
}

footer span:first-child {
  color: #5e6d80;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .login-layout {
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 32px;
  }

  .organization-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  main {
    width: min(100% - 32px, 520px);
    padding: 34px 0 48px;
  }

  .topbar {
    height: 66px;
    padding: 0 16px;
  }

  .brand {
    font-size: 14px;
  }

  .account-bar {
    gap: 8px;
    font-size: 10px;
  }

  .logout-error {
    max-width: 90px;
    font-size: 9px;
  }

  .account-bar .button {
    min-height: 34px;
    padding: 6px 9px;
  }

  .login-layout {
    grid-template-columns: 1fr;
    gap: 30px;
    min-height: auto;
  }

  .intro h1 {
    font-size: 39px;
  }

  .intro-copy {
    margin: 14px 0 18px;
    font-size: 14px;
  }

  .login-panel {
    padding: 24px;
  }

  .welcome-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .welcome-row h1 {
    font-size: 28px;
  }

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

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

  .metric-card {
    min-height: 104px;
  }

  .admin-panel,
  .upload-panel,
  .scans-panel,
  .findings-panel {
    padding: 20px;
  }

  .organization-form {
    grid-template-columns: 1fr;
  }

  .report-generation-form {
    grid-template-columns: 1fr;
  }

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

  .report-client-controls {
    justify-items: stretch;
  }

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

  .subtle {
    max-width: 120px;
    text-align: right;
  }

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

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

  footer {
    padding: 0 16px;
    font-size: 9px;
  }
}
