:root {
  --bg: #eef2f0;
  --surface: #ffffff;
  --surface-2: #f7f9f6;
  --ink: #18201f;
  --muted: #63706d;
  --line: #d9e1dc;
  --line-strong: #c2cec8;
  --graphite: #202927;
  --green: #15915a;
  --green-soft: #e1f5ea;
  --lime: #95c94a;
  --amber: #d99a19;
  --amber-soft: #fff2cf;
  --orange: #f46f22;
  --red: #c94536;
  --red-soft: #fde5e2;
  --blue: #246c91;
  --blue-soft: #deeff7;
  --shadow: 0 18px 48px rgba(30, 45, 40, 0.11);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(120deg, rgba(36, 108, 145, 0.09), transparent 35%),
    linear-gradient(300deg, rgba(244, 111, 34, 0.08), transparent 32%),
    var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

h1 {
  max-width: 100%;
  margin-bottom: 8px;
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.02;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 44px);
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.18;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.app-frame {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(217, 225, 220, 0.9);
  padding: 12px 24px;
  background: rgba(238, 242, 240, 0.9);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.brand-mark {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 7px);
  gap: 3px;
  align-items: end;
  width: 38px;
  height: 38px;
  padding: 9px;
  border-radius: 8px;
  background: var(--graphite);
}

.brand-mark span {
  display: block;
  width: 7px;
  border-radius: 999px;
  background: var(--green);
}

.brand-mark span:nth-child(1) {
  height: 12px;
}

.brand-mark span:nth-child(2) {
  height: 19px;
  background: var(--amber);
}

.brand-mark span:nth-child(3) {
  height: 15px;
  background: var(--orange);
}

.export-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.export-bar button,
.primary-action,
.ghost-action {
  min-height: 42px;
  border-radius: 7px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
}

.export-bar button {
  min-width: 72px;
  border: 1px solid var(--line-strong);
  padding: 9px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
}

.export-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.export-bar button:hover:enabled,
.primary-action:hover,
.ghost-action:hover {
  transform: translateY(-1px);
}

.workspace {
  display: grid;
  gap: 14px;
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px 24px 24px;
}

.hero-strip,
.scan-panel,
.territory-card,
.market-card,
.report-card,
.score-grid.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 16px;
  align-items: center;
  padding: 18px;
  overflow: hidden;
}

.hero-strip > *,
.scan-panel > *,
.market-board > *,
.content-grid > * {
  min-width: 0;
}

.hero-copy p {
  max-width: 920px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.eyebrow,
.section-label,
.placeholder-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-proof {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background:
    linear-gradient(135deg, rgba(21, 145, 90, 0.12), transparent 44%),
    var(--surface-2);
}

.hero-proof span,
.hero-proof small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.hero-proof strong {
  font-size: 26px;
  line-height: 1;
}

.scan-panel {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 0.8fr 1fr;
  gap: 12px;
  align-items: end;
  padding: 14px;
}

label,
.competitor-fields {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: #344440;
  font-size: 12px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fbfcfb;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(36, 108, 145, 0.12);
}

.market-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 8px;
}

.competitor-fields {
  grid-column: span 2;
  grid-template-columns: 120px repeat(3, minmax(0, 1fr));
  align-items: end;
}

.competitor-fields span {
  padding-bottom: 14px;
}

.notes-field {
  grid-column: span 3;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  grid-column: 1 / -1;
  justify-self: end;
  min-width: min(100%, 360px);
}

.primary-action {
  border: 0;
  padding: 11px 16px;
  color: #fff;
  background: var(--graphite);
  box-shadow: 0 10px 24px rgba(24, 32, 31, 0.2);
}

.ghost-action {
  border: 1px solid var(--line-strong);
  padding: 10px 13px;
  color: var(--ink);
  background: #fff;
}

.market-board {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.75fr);
  gap: 18px;
  align-items: stretch;
}

.territory-card,
.market-card,
.report-card {
  min-width: 0;
  padding: 18px;
}

.territory-card {
  display: grid;
  gap: 14px;
}

.market-sidebar {
  display: grid;
  gap: 18px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.card-header.compact {
  margin-bottom: 12px;
}

.summary-score {
  display: grid;
  place-items: center;
  width: 128px;
  min-width: 128px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 249, 246, 0.95)),
    var(--surface-2);
}

.summary-score span {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}

.summary-score small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.report-subtitle,
.empty-copy {
  color: var(--muted);
  line-height: 1.55;
}

.territory-map {
  min-height: 500px;
}

.empty-map {
  display: grid;
  gap: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
}

.empty-map p {
  margin: 0;
}

.empty-map-surface {
  min-height: 330px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 77%, rgba(201, 69, 54, 0.34), rgba(244, 111, 34, 0.22) 17%, transparent 32%),
    linear-gradient(27deg, transparent 0 47%, rgba(36, 108, 145, 0.14) 47% 49%, transparent 49%),
    linear-gradient(130deg, transparent 0 58%, rgba(24, 32, 31, 0.09) 58% 60%, transparent 60%),
    radial-gradient(circle, rgba(21, 145, 90, 0.22) 0 7px, transparent 8px) center / 38px 38px,
    linear-gradient(0deg, rgba(21, 145, 90, 0.12), rgba(255, 255, 255, 0.3)),
    #edf2ea;
}

.territory-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 290px);
  gap: 16px;
  align-items: stretch;
}

.map-surface {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 458px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(27deg, transparent 0 47%, rgba(36, 108, 145, 0.14) 47% 49%, transparent 49%),
    linear-gradient(130deg, transparent 0 58%, rgba(24, 32, 31, 0.09) 58% 60%, transparent 60%),
    linear-gradient(0deg, rgba(21, 145, 90, 0.18), rgba(255, 255, 255, 0.3)),
    #edf2ea;
}

.map-surface::before,
.map-surface::after {
  position: absolute;
  inset: auto;
  content: "";
  border-radius: 999px;
  pointer-events: none;
}

.map-surface::before {
  width: 36%;
  height: 22%;
  left: 4%;
  bottom: 8%;
  background: radial-gradient(circle, rgba(201, 69, 54, 0.5), rgba(244, 111, 34, 0.35) 35%, transparent 70%);
  filter: blur(4px);
}

.map-surface::after {
  width: 62%;
  height: 62%;
  background: radial-gradient(circle, rgba(21, 145, 90, 0.12), transparent 70%);
}

.territory-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(13, minmax(17px, 1fr));
  gap: 6px;
  width: min(570px, 100%);
  max-width: 96%;
  padding: 22px;
}

.rank-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 6px 12px rgba(24, 32, 31, 0.15);
}

.rank-cell.empty {
  visibility: hidden;
}

.rank-cell.win {
  background: #088f4f;
}

.rank-cell.near {
  color: #22340f;
  background: #a4d646;
}

.rank-cell.watch {
  color: #3f2a00;
  background: #ffd55d;
}

.rank-cell.losing {
  background: var(--orange);
}

.rank-cell.critical {
  background: var(--red);
}

.rank-cell.center {
  outline: 3px solid rgba(24, 32, 31, 0.22);
  outline-offset: 2px;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.map-legend span,
.mini-chip,
.status-pill {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.map-legend span {
  border: 1px solid var(--line);
  background: #fff;
}

.territory-insights {
  display: grid;
  gap: 10px;
}

.territory-insights h4 {
  margin: 0;
  font-size: 14px;
  text-transform: uppercase;
}

.insight-row,
.pulse-metric {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.insight-row span,
.pulse-metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-row strong,
.pulse-metric strong {
  font-size: 22px;
  line-height: 1.1;
}

.insight-row p,
.pulse-metric p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.pulse-grid,
.quick-read {
  display: grid;
  gap: 10px;
}

.quick-read-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.quick-read-item b {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: #fff;
  background: var(--graphite);
  font-size: 12px;
}

.quick-read-item strong {
  display: block;
  margin-bottom: 4px;
}

.quick-read-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.score-card {
  display: grid;
  gap: 12px;
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(30, 45, 40, 0.08);
}

.score-card strong {
  min-height: 38px;
  font-size: 14px;
  line-height: 1.25;
}

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

.score-number {
  font-size: 32px;
  font-weight: 800;
}

.score-status {
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.score-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee9;
}

.score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.score-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tone-strong .score-status,
.status-pill.strong {
  color: #12643e;
  background: var(--green-soft);
}

.tone-strong .score-bar span {
  background: var(--green);
}

.tone-moderate .score-status,
.status-pill.moderate {
  color: #744f00;
  background: var(--amber-soft);
}

.tone-moderate .score-bar span {
  background: var(--amber);
}

.tone-weak .score-status,
.status-pill.weak {
  color: #8b231b;
  background: var(--red-soft);
}

.tone-weak .score-bar span {
  background: var(--red);
}

.status-pill.neutral {
  color: #31566a;
  background: var(--blue-soft);
}

.score-grid.empty-state {
  grid-template-columns: 1fr;
  padding: 26px;
}

.score-grid.empty-state h3 {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.32;
}

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

.report-card.wide {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  color: #3e514d;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

td:first-child,
th:first-child {
  position: sticky;
  left: 0;
  max-width: 210px;
  background: #fff;
}

.website-cell {
  display: grid;
  gap: 4px;
}

.website-cell strong {
  word-break: break-word;
}

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

.metric-chip {
  display: inline-flex;
  min-width: 46px;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 8px;
  font-weight: 800;
}

.list-stack,
.checklist,
.link-plan,
.readiness-list,
.roadmap {
  display: grid;
  gap: 10px;
}

.topic-item,
.signal-item,
.link-item,
.readiness-item,
.roadmap-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.topic-item {
  display: grid;
  gap: 8px;
  padding: 13px;
}

.topic-row,
.signal-item,
.readiness-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.topic-row strong,
.signal-item strong,
.readiness-item strong {
  line-height: 1.3;
}

.topic-item p,
.signal-item p,
.readiness-item p,
.link-item p,
.roadmap-task p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
}

.dot.high {
  background: var(--red);
}

.dot.medium {
  background: var(--amber);
}

.dot.low {
  background: var(--green);
}

.topic-meta,
.link-meta,
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-chip {
  border: 1px solid var(--line);
  color: #3d4f4b;
  background: #fff;
}

.signal-item,
.readiness-item {
  padding: 12px;
}

.check-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.check-icon.pass {
  background: var(--green);
}

.check-icon.warn {
  background: var(--amber);
}

.check-icon.fail {
  background: var(--red);
}

.link-item {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.link-path {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-weight: 800;
}

.link-path span {
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--surface-2);
}

.link-path b {
  color: var(--blue);
}

.roadmap-group {
  overflow: hidden;
}

.roadmap-group > h4 {
  margin: 0;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 14px;
  text-transform: uppercase;
}

.roadmap-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.roadmap-task:last-child {
  border-bottom: 0;
}

.priority-score {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 8px;
  color: #fff;
  background: var(--graphite);
  font-weight: 800;
}

.empty-copy {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.62);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(440px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  background: var(--graphite);
  box-shadow: var(--shadow);
}

@media (max-width: 1180px) {
  .scan-panel,
  .market-board,
  .territory-shell,
  .hero-strip {
    grid-template-columns: 1fr;
  }

  .competitor-fields,
  .notes-field {
    grid-column: auto;
  }

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

@media (max-width: 820px) {
  .topbar,
  .workspace {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .export-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .export-bar button {
    min-width: 0;
    padding-inline: 8px;
  }

  h1 {
    font-size: 30px;
  }

  .hero-strip,
  .scan-panel,
  .territory-card,
  .market-card,
  .report-card {
    padding: 14px;
  }

  .market-fields,
  .competitor-fields,
  .form-actions,
  .content-grid,
  .score-grid,
  .roadmap-task {
    grid-template-columns: 1fr;
  }

  .form-actions {
    justify-self: stretch;
    min-width: 100%;
  }

  .card-header {
    flex-direction: column;
  }

  .competitor-fields span {
    padding-bottom: 0;
  }

  .summary-score {
    width: 100%;
    min-width: 0;
    aspect-ratio: auto;
    min-height: 96px;
  }

  .territory-map {
    min-height: auto;
  }

  .map-surface {
    min-height: 360px;
  }

  .territory-grid {
    gap: 4px;
    padding: 12px;
  }

  .rank-cell {
    font-size: 9px;
  }

  .report-card.wide {
    grid-column: auto;
  }

  .priority-score {
    width: 100%;
    height: 44px;
  }
}

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

  .topbar,
  .scan-panel {
    display: none;
  }

  .workspace,
  .market-board,
  .content-grid,
  .score-grid,
  .territory-shell {
    display: block;
  }

  .hero-strip,
  .territory-card,
  .market-card,
  .report-card,
  .score-card {
    margin-bottom: 16px;
    box-shadow: none;
  }
}
