:root {
  color-scheme: light;
  --ink: #10203f;
  --muted: #65718a;
  --line: #d9e1f2;
  --panel: #ffffff;
  --surface: #f5f8ff;
  --surface-strong: #eaf1ff;
  --brand: #0057c8;
  --brand-dark: #071a45;
  --accent: #d61287;
  --accent-soft: #fde8f5;
  --cyan: #2aa8de;
  --yellow: #f8d20b;
  --danger: #bd2e59;
  --ok: #187b68;
  --shadow: 0 18px 45px rgba(7, 26, 69, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfdff 0%, var(--surface) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.auth-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: linear-gradient(140deg, var(--brand-dark), #0b3f91 58%, #121b48);
}

.auth-card {
  display: grid;
  gap: 20px;
  width: min(100%, 460px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.22);
}

.auth-logo {
  width: 240px;
  height: auto;
}

.auth-card h1 {
  font-size: 28px;
}

.auth-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: var(--surface);
}

.auth-mode-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 800;
  background: transparent;
}

.auth-mode-switch button.active {
  color: #fff;
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(0, 87, 200, 0.18);
}

.auth-panel {
  display: grid;
  gap: 14px;
}

.auth-copy,
.auth-note {
  margin-bottom: 0;
  color: var(--muted);
}

.auth-note {
  font-size: 13px;
}

.google-signin {
  min-height: 44px;
}

.email-fallback {
  display: grid;
  gap: 14px;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  color: #f7fbf8;
  background: #071a45;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

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

.brand-name {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.primary-action,
.secondary-button,
.ghost-button,
.filter-button,
.status-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 750;
}

.primary-action {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(214, 18, 135, 0.24);
}

.primary-action.compact {
  min-width: 120px;
}

.secondary-button {
  color: #f7fbf8;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(0, 87, 200, 0.16);
}

.ghost-button {
  color: var(--brand-dark);
  border-color: var(--line);
  background: #fff;
}

.ghost-button.danger {
  color: var(--danger);
}

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

.project-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

.project-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.project-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 62px;
  color: #f7fbf8;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  background: rgba(255, 255, 255, 0.08);
}

.project-item.active {
  border-color: var(--cyan);
  background: rgba(42, 168, 222, 0.16);
}

.project-item strong,
.project-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-item span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
}

.workspace {
  min-width: 0;
  padding: 26px;
}

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

.topbar-title {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar-logo {
  width: 176px;
  height: auto;
  max-height: 56px;
  object-fit: contain;
}

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
}

.user-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--brand);
  font-size: 12px;
  font-weight: 850;
}

.user-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.user-meta {
  min-width: 0;
}

.user-meta strong,
.user-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta strong {
  font-size: 12px;
}

.user-meta span {
  color: var(--muted);
  font-size: 11px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 4px;
  font-size: 21px;
}

h3 {
  margin-bottom: 12px;
  font-size: 16px;
}

.step-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.step-tab {
  min-width: max-content;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 12px 13px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.step-tab.active {
  color: var(--brand-dark);
  border-bottom-color: var(--accent);
}

.content-grid {
  display: grid;
}

.panel {
  display: none;
  min-height: 620px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.active {
  display: block;
}

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

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 12px;
  color: var(--brand-dark);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

.form-grid,
.metric-grid {
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #243756;
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(42, 168, 222, 0.18);
  border-color: var(--brand);
}

.full-field {
  margin-top: 14px;
}

.spacing-top {
  margin-top: 16px;
}

.compact-heading {
  margin-bottom: 0;
}

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

.metadata-box,
.upload-zone,
.observation-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfdff;
}

.metadata-box dl {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 10px;
  margin: 0;
  font-size: 13px;
}

.metadata-box dt {
  color: var(--muted);
  font-weight: 800;
}

.metadata-box dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.upload-zone {
  display: grid;
  gap: 14px;
}

.upload-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.file-input input {
  padding: 8px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.evidence-card,
.finding-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.evidence-card {
  overflow: hidden;
}

.evidence-preview {
  display: grid;
  height: 138px;
  place-items: center;
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 13px;
  font-weight: 800;
}

.evidence-preview img,
.evidence-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.evidence-body {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.evidence-body strong {
  overflow-wrap: anywhere;
}

.evidence-meta {
  color: var(--muted);
  font-size: 12px;
}

.card-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.link-button {
  border: 0;
  padding: 0;
  color: var(--brand);
  background: transparent;
  font-weight: 800;
}

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

.score-card {
  display: grid;
  gap: 4px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.score-card strong {
  font-size: 23px;
}

.score-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.observation-sections {
  display: grid;
  gap: 14px;
}

.metric-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 12px;
}

.metric-grid.six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

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

.insight-upload-card {
  display: grid;
  gap: 10px;
  align-content: start;
  min-height: 136px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.insight-upload-card.large {
  min-height: 260px;
}

.insight-upload-card strong,
.insight-upload-card span {
  display: block;
}

.insight-upload-card strong {
  margin-bottom: 4px;
}

.insight-upload-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.competitor-grid,
.report-workbench {
  display: grid;
  gap: 14px;
}

.competitor-control-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

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

.competitor-heading h3 {
  margin-bottom: 0;
}

.finding-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.filter-button {
  color: var(--muted);
  border-color: var(--line);
  background: #fff;
}

.filter-button.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.findings-list {
  display: grid;
  gap: 12px;
}

.finding-card {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.finding-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.finding-title {
  display: grid;
  gap: 6px;
}

.finding-title strong {
  font-size: 16px;
}

.finding-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.finding-status {
  display: inline-flex;
  align-items: center;
  height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
  text-transform: capitalize;
}

.finding-status.approved {
  color: #fff;
  background: var(--ok);
}

.finding-status.rejected {
  color: #fff;
  background: var(--danger);
}

.finding-status.draft {
  color: #5b2349;
  background: var(--accent-soft);
}

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

.finding-edit-grid .wide {
  grid-column: 1 / -1;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-button {
  min-height: 34px;
  color: var(--brand-dark);
  border-color: var(--line);
  background: #fff;
}

.status-button.approve {
  color: #fff;
  background: var(--ok);
}

.status-button.reject {
  color: #fff;
  background: var(--danger);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 26, 69, 0.48);
}

.team-modal {
  display: grid;
  gap: 16px;
  width: min(100%, 760px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: var(--shadow);
}

.team-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 150px max-content;
  gap: 12px;
  align-items: end;
}

.backend-access-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.access-requests {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading-row h3 {
  margin: 0;
}

.section-heading-row span {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  font-weight: 800;
  background: var(--brand);
}

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

.team-member {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px max-content;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.team-member strong,
.team-member span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.team-member small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.access-request {
  grid-template-columns: minmax(0, 1fr) 120px max-content;
}

.request-actions {
  display: flex;
  gap: 8px;
}

.secondary-button.compact,
.ghost-button.compact {
  min-height: 34px;
  padding: 0 10px;
}

.report-preview {
  max-width: 920px;
  margin: 0 auto;
  color: var(--ink);
  background: #fff;
}

.report-dashboard {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.report-readiness {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

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

.readiness-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.readiness-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--brand), var(--accent));
}

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

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

.report-summary-card,
.report-digest-card {
  display: grid;
  gap: 8px;
  min-height: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.report-summary-card span,
.report-digest-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-summary-card strong {
  font-size: 26px;
  line-height: 1;
}

.report-summary-card p,
.report-digest-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.report-digest-card ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 13px;
}

.report-cover {
  display: grid;
  gap: 8px;
  min-height: 190px;
  border-bottom: 4px solid var(--accent);
  padding: 34px 0 26px;
}

.report-logo {
  width: 220px;
  height: auto;
  margin-bottom: 12px;
}

.report-placeholder {
  display: grid;
  place-items: start;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
}

.report-placeholder p {
  max-width: 700px;
  margin-bottom: 0;
  color: var(--muted);
}

.report-cover h2 {
  max-width: 680px;
  font-size: 34px;
  line-height: 1.12;
}

.report-section {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.report-section.lead-section {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 18px;
}

.report-callout {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.report-section h3 {
  color: var(--brand-dark);
  font-size: 19px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

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

.report-table th {
  background: var(--surface-strong);
}

.report-list {
  display: grid;
  gap: 14px;
  padding-left: 0;
  list-style: none;
}

.report-list li {
  border-left: 4px solid var(--cyan);
  padding-left: 12px;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 250px minmax(0, 1fr);
  }

  .score-strip,
  .metric-grid,
  .metric-grid.six,
  .insight-upload-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell,
  .form-grid.two,
  .split-row,
  .report-readiness,
  .report-summary-grid,
  .report-digest-grid,
  .report-section.lead-section,
  .upload-controls,
  .finding-edit-grid,
  .insight-upload-grid,
  .insight-upload-grid.two,
  .team-form,
  .backend-access-form,
  .team-member {
    grid-template-columns: 1fr;
  }

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

  .workspace {
    padding: 18px;
  }

  .topbar,
  .topbar-title,
  .panel-heading,
  .finding-head {
    flex-direction: column;
  }

  .topbar-logo {
    width: 150px;
  }

  .score-strip,
  .metric-grid,
  .metric-grid.six,
  .insight-upload-grid,
  .report-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 24px;
  }

  .panel {
    padding: 16px;
  }

  .score-strip,
  .metric-grid,
  .metric-grid.six,
  .insight-upload-grid,
  .report-summary-grid,
  .report-digest-grid {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar,
  .topbar,
  .step-tabs,
  .no-print,
  .panel:not(.report-panel) {
    display: none !important;
  }

  .app-shell,
  .workspace {
    display: block;
    padding: 0;
  }

  .panel,
  .report-panel {
    display: block !important;
    min-height: 0;
    border: 0;
    box-shadow: none;
  }

  .report-preview {
    max-width: none;
  }

  .report-section {
    break-inside: avoid;
  }
}
