:root {
  --bg: #f5f4f1;
  --paper: #ffffff;
  --panel: #ffffff;
  --panel-border: rgba(107, 114, 128, 0.18);
  --text: #1f2937;
  --muted: #6b7280;
  --brand-red: #ba4a43;
  --brand-red-deep: #5a0f14;
  --brand-gold: #f0c45b;
  --brand-black: #171717;
  --brand-white: #ffffff;
  --accent: #5a0f14;
  --accent-deep: #5a0f14;
  --good: #1f8f5f;
  --warning: #d28a1f;
  --bad: #c7483c;
  --surface-dark: #5a0f14;
  --surface-dark-soft: #7d1d23;
  --shadow: 0 16px 36px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  color: var(--text);
  background: #ffffff;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(186, 74, 67, 0.12), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f4f4f5 100%);
}

.auth-card {
  width: min(520px, 100%);
  padding: 28px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.auth-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
  margin-bottom: 24px;
}

.auth-eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
}

.auth-title {
  margin: 0 0 10px;
  max-width: none;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.auth-copy,
.login-status {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.auth-subform {
  margin-top: 14px;
}

.link-button {
  padding: 0;
  background: transparent;
  color: var(--accent);
  border: 0;
  box-shadow: none;
  text-align: left;
}

.link-button:hover {
  filter: none;
  text-decoration: underline;
}

body.auth-locked .page-shell {
  display: none;
}

body.authenticated .auth-screen {
  display: none;
}

.page-shell {
  width: min(1160px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 32px;
}

.top-shell {
  padding: 20px 24px 24px;
  border: 1px solid var(--panel-border);
  border-radius: 28px;
  background: #ffffff;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.brand-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

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

.user-menu {
  position: relative;
}

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

.brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-wordmark {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1;
}

.brand-web {
  color: var(--brand-black);
}

.brand-designs {
  color: var(--brand-black);
  opacity: 0.92;
}

.brand-product {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-product-static {
  display: none;
}

.user-menu-button {
  min-height: 38px;
  padding: 9px 14px;
  border-radius: 12px;
  background: #ffffff;
  color: var(--accent);
  border: 1px solid rgba(107, 114, 128, 0.22);
  box-shadow: none;
}

.user-menu-button:hover {
  background: #fafafa;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
  z-index: 20;
}

.user-menu-item {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  border: 1px solid rgba(107, 114, 128, 0.14);
  box-shadow: none;
  text-align: left;
}

.user-menu-item:hover {
  background: #fafafa;
}

.logout-button {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--accent);
  border: 1px solid rgba(107, 114, 128, 0.22);
  box-shadow: none;
}

.logout-button:hover {
  background: #fafafa;
}

.hero {
  display: grid;
  grid-template-columns: 1.55fr 0.7fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 12px;
  max-width: 16ch;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--accent);
}

.hero-copy {
  max-width: 62ch;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.65;
}

.hero-copy-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 6px 0;
  text-align: left;
}

.overall-score-card,
.panel,
.quick-win,
.finding-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.overall-score-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 0;
  width: 100%;
  max-width: 220px;
  justify-self: end;
  border-radius: 18px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #c24d45 0%, #ba4a43 100%);
  box-shadow: 0 14px 28px rgba(186, 74, 67, 0.18);
}

.overall-score-card span {
  color: rgba(255, 255, 255, 0.64);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
}

.overall-score-card strong {
  margin-top: 2px;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  color: var(--brand-white);
  font-variant-numeric: tabular-nums;
  line-height: 0.96;
}

.score-card-note {
  margin-top: 6px;
  max-width: 18ch;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  font-size: 0.72rem;
  line-height: 1.15;
}

.score-cascade {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 8px;
  opacity: 0.95;
}

.cascade-node {
  display: block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.cascade-node-top {
  width: 6px;
  height: 6px;
}

.cascade-stem {
  width: 1px;
  height: 18px;
  margin: 4px 0;
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.72) 0,
    rgba(255, 255, 255, 0.72) 38%,
    transparent 38%,
    transparent 100%
  );
  background-size: 1px 7px;
  background-repeat: repeat-y;
}

.cascade-node-mid {
  width: 8px;
  height: 8px;
  background: var(--brand-gold);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

.cascade-branches {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  width: 100%;
  margin-top: 8px;
}

.cascade-branch {
  position: relative;
  display: block;
  height: 20px;
}

.cascade-branch::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 50%;
  width: 1px;
  height: 14px;
  transform: translateX(-50%);
  background-image: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.64) 0,
    rgba(255, 255, 255, 0.64) 38%,
    transparent 38%,
    transparent 100%
  );
  background-size: 1px 7px;
  background-repeat: repeat-y;
}

.cascade-branch::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 5px;
  height: 5px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
}

.share-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
}

.share-tools-outside {
  max-width: 220px;
  margin: 10px 0 18px auto;
}

.email-share-inline {
  max-width: 420px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.share-button {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(107, 114, 128, 0.22);
  border-radius: 10px;
  background: #ffffff;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.share-button:hover {
  background: #f8f8f8;
}

.share-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  background: #f3f4f6;
}

.empty-message {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  padding: 4px 0;
}

@media print {
  .auth-screen,
  .brand-bar,
  .audit-form,
  .run-status,
  .share-tools {
    display: none;
  }

  body {
    background: #ffffff;
  }

  .page-shell {
    width: 100%;
    padding: 0;
  }

  .top-shell,
  .panel,
  .stat-block {
    box-shadow: none;
  }
}

.analysis-zone {
  padding: 0;
  position: relative;
}

.page-intro-panel {
  margin-bottom: 18px;
}

.page-intro-copy {
  max-width: 64ch;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
  margin-bottom: 18px;
  color: var(--brand-white);
}

.stat-block {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, #7a828d 0%, #6b7280 100%);
  box-shadow: 0 12px 24px rgba(107, 114, 128, 0.14);
}

.stat-block strong {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 700;
  color: var(--brand-white);
}

.stat-block span {
  color: rgba(255, 255, 255, 0.74);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.panel {
  border-radius: 22px;
  padding: 22px;
  color: var(--text);
  background: var(--panel);
}

.panel-wide {
  grid-column: 1 / -1;
}

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

.panel-header h2 {
  margin-bottom: 0;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.panel-note {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-block {
  margin-bottom: 24px;
}

.settings-block:last-child {
  margin-bottom: 0;
}

.settings-header {
  margin-bottom: 14px;
}

.audit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  max-width: 760px;
}

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

.field-group {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.field-group span {
  font-size: 0.9rem;
}

.field-group input,
.field-group select,
.toolbar-input,
.toolbar-select {
  width: 100%;
  border: 1px solid rgba(107, 114, 128, 0.24);
  border-radius: 14px;
  padding: 15px 18px;
  background: var(--paper);
  color: var(--text);
  font: inherit;
}

.field-group input:focus,
.field-group select:focus,
.toolbar-input:focus,
.toolbar-select:focus {
  outline: 2px solid rgba(90, 15, 20, 0.18);
  outline-offset: 2px;
}

.panel-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px;
  gap: 10px;
  width: min(100%, 420px);
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.email-settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  font-weight: 700;
}

.checkbox-field input {
  width: auto;
}

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

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(107, 114, 128, 0.18);
  border-radius: 14px;
}

.user-meta {
  display: grid;
  gap: 4px;
}

.user-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 15px 22px;
  background: linear-gradient(135deg, #c24d45 0%, #ba4a43 100%);
  color: var(--brand-white);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.03);
}

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

.run-status {
  margin-top: 12px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
  text-align: left;
}

.score-list,
.measurement-signals,
.findings-grid,
.quick-win-grid {
  display: grid;
  gap: 14px;
}

.recent-audit-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.measurement-item {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid rgba(107, 114, 128, 0.18);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(248, 249, 251, 1) 100%);
}

.measurement-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.measurement-meta strong {
  font-size: 0.98rem;
}

.measurement-detail {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.score-row {
  display: grid;
  grid-template-columns: 160px 1fr 64px;
  gap: 12px;
  align-items: center;
  opacity: 0;
  transform: translateY(10px);
  animation: rise-in 520ms ease forwards;
  animation-delay: var(--row-delay, 0ms);
}

.score-label {
  font-weight: 700;
  font-size: 0.96rem;
}

.score-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.16);
}

.score-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.score-value {
  text-align: right;
  font-weight: 700;
  color: var(--accent);
}

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

.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.bullet-list li + li {
  margin-top: 10px;
}

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

.quick-win {
  border-radius: 20px;
  padding: 18px;
  border-top: 4px solid rgba(186, 74, 67, 0.92);
  opacity: 0;
  transform: translateY(14px);
  animation: rise-in 560ms ease forwards;
  animation-delay: var(--card-delay, 0ms);
}

.quick-win h3,
.finding-card h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
}

.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: capitalize;
}

.pill.low,
.pill.good {
  background: rgba(31, 143, 95, 0.14);
  color: var(--good);
}

.pill.medium,
.pill.warning {
  background: rgba(210, 138, 31, 0.14);
  color: var(--warning);
}

.pill.high,
.pill.bad {
  background: rgba(199, 72, 60, 0.14);
  color: var(--bad);
}

.finding-card {
  border-radius: 20px;
  padding: 18px;
  border-left: 4px solid rgba(186, 74, 67, 0.92);
  opacity: 0;
  transform: translateY(14px);
  animation: rise-in 560ms ease forwards;
  animation-delay: var(--card-delay, 0ms);
}

.finding-card p {
  color: var(--muted);
  line-height: 1.5;
}

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

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .score-row,
  .quick-win,
  .finding-card {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .score-fill {
    transition: none;
  }
}

@media (max-width: 900px) {
  .hero,
  .content-grid,
  .signal-columns,
  .quick-win-grid,
  .stats-strip {
    grid-template-columns: 1fr;
  }

  .audit-form,
  .audit-form-row,
  .panel-toolbar,
  .user-form,
  .email-settings-form,
  .email-share-inline {
    grid-template-columns: 1fr;
  }

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

  .score-value {
    text-align: left;
  }

  .overall-score-card {
    max-width: none;
    justify-self: stretch;
  }

  .top-shell {
    padding: 18px;
  }

  .page-shell {
    width: min(1160px, calc(100% - 16px));
  }

  .brand-bar,
  .brand-actions,
  .auth-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-menu {
    width: 100%;
  }

  .user-menu-dropdown {
    left: 0;
    right: auto;
    width: min(260px, 100%);
  }

  .user-row,
  .user-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
