:root {
  --ink: #1c2936;
  --muted: #687887;
  --page: #f4f7f5;
  --paper: #fffdfa;
  --white: #ffffff;
  --line: rgba(31, 48, 64, 0.12);
  --accent: #1f8d84;
  --accent-dark: #126761;
  --accent-soft: #e1f3f0;
  --amber: #c98924;
  --amber-soft: #fff5df;
  --danger: #b74d43;
  --danger-soft: #fff0ed;
  --success: #20794f;
  --success-soft: #e5f5ed;
  --shadow: 0 22px 60px rgba(45, 65, 82, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background:
    linear-gradient(120deg, rgba(31, 141, 132, 0.14), transparent 34%),
    linear-gradient(180deg, #fbfaf6 0%, var(--page) 58%, #f9f5ec 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(31, 141, 132, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 141, 132, 0.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 74%);
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

.topbar,
.shell,
.footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 22px 0 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.brand__mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 22px rgba(31, 141, 132, 0.22);
}

.shell {
  padding: 26px 0 28px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 22px;
  align-items: stretch;
}

.workspace__intro,
.risk-preview,
.status-panel,
.result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.9);
  box-shadow: var(--shadow);
}

.workspace__intro {
  padding: 34px 36px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 253, 248, 0.86)),
    linear-gradient(90deg, rgba(31, 141, 132, 0.12), rgba(201, 137, 36, 0.08));
}

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

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(36px, 4.8vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.12;
}

h3 {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
}

.lead {
  max-width: 620px;
  margin: 18px 0 26px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.search {
  max-width: 620px;
  padding: 16px;
  border: 1px solid rgba(31, 141, 132, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.search label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.search__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 10px;
}

input {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid rgba(31, 48, 64, 0.16);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  background: #ffffff;
}

input::placeholder {
  color: #9ba6af;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 141, 132, 0.16);
}

button {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
}

button:hover {
  background: linear-gradient(180deg, #25a096, var(--accent-dark));
}

.button-secondary {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(31, 141, 132, 0.24);
  color: var(--accent-dark);
  background: var(--accent-soft);
}

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

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

.risk-preview {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.76);
}

.score-card,
.checklist {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.score-card {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
}

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

.score-card strong {
  display: block;
  margin-top: 16px;
  font-size: 28px;
  line-height: 1.08;
}

.score-card p {
  margin: 16px 0 14px;
  color: var(--muted);
  line-height: 1.5;
}

.score-reasons {
  display: grid;
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.score-reasons li {
  position: relative;
  padding-left: 18px;
  color: #435466;
  font-size: 14px;
  line-height: 1.35;
}

.score-reasons li::before {
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.score-reasons[data-level="high"] li::before {
  background: var(--danger);
}

.score-reasons[data-level="medium"] li::before {
  background: var(--amber);
}

.score-reasons[data-level="low"] li::before {
  background: var(--success);
}

.score-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf0;
}

.score-meter span {
  display: block;
  width: 33%;
  height: 100%;
  border-radius: inherit;
  background: var(--muted);
  transition: width 0.25s ease, background 0.25s ease;
}

.score-meter[data-level="loading"] span {
  width: 58%;
  background: var(--accent);
}

.score-meter[data-level="low"] span {
  width: 33%;
  background: var(--success);
}

.score-meter[data-level="medium"] span {
  width: 66%;
  background: var(--amber);
}

.score-meter[data-level="high"] span {
  width: 100%;
  background: var(--danger);
}

.checklist {
  padding: 22px;
}

.checklist__title,
.next-steps__title {
  margin: 0 0 14px;
  color: var(--ink);
  font-weight: 800;
}

.checklist ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  position: relative;
  padding-left: 26px;
  color: var(--muted);
  line-height: 1.35;
}

.checklist li::before {
  position: absolute;
  left: 0;
  top: 1px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-dark);
  content: "✓";
  font-size: 12px;
  font-weight: 900;
  background: var(--accent-soft);
}

.status-panel {
  margin-top: 18px;
  padding: 16px 18px;
  color: var(--muted);
}

.status-panel[data-type="loading"] {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.status-panel[data-type="error"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(183, 77, 67, 0.22);
}

.status-panel[data-type="success"] {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(32, 121, 79, 0.22);
}

.result {
  margin-top: 18px;
  overflow: hidden;
  background: var(--paper);
}

.summary {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(31, 141, 132, 0.08), transparent 54%),
    var(--white);
}

.summary__text {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.summary__actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

.badge {
  max-width: 280px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 141, 132, 0.22);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  background: var(--accent-soft);
}

.company-head {
  padding: 28px;
  border-top: 1px solid var(--line);
}

.company-head h3 {
  max-width: 900px;
  font-size: 25px;
  font-weight: 700;
}

.company-head p {
  max-width: 860px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.reliability-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 28px 18px;
}

.reliability-panel article {
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(31, 141, 132, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(225, 243, 240, 0.72), rgba(255, 255, 255, 0.86));
}

.reliability-panel span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.reliability-panel strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
}

.mini-meter {
  height: 8px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce8e5;
}

.mini-meter span {
  display: block;
  height: 100%;
  margin: 0;
  border-radius: inherit;
  background: var(--accent);
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail {
  min-height: 142px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.detail:last-child {
  border-right: 0;
}

.detail span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.detail strong {
  display: block;
  overflow-wrap: anywhere;
  color: #263646;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.42;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 28px 0;
}

.insight {
  min-height: 96px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.insight span,
.facts dt {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.insight strong,
.facts dd {
  display: block;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.42;
}

.data-columns {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  padding: 18px 28px 0;
}

.market-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
  padding: 18px 28px 0;
}

.market-grid > article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.finance-table {
  display: grid;
  gap: 10px;
}

.finance-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(244, 247, 245, 0.62);
}

.finance-row strong {
  color: var(--accent-dark);
  font-size: 16px;
  font-weight: 700;
}

.finance-row span {
  overflow-wrap: anywhere;
  color: #39495a;
  font-size: 14px;
  font-weight: 650;
}

.data-columns > article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.section-title {
  margin-bottom: 16px;
}

.facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-list + .compact-list {
  margin-top: 16px;
}

.compact-list__title {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.compact-list span {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
  color: #344557;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  background: rgba(244, 247, 245, 0.62);
}

.compact-list--secondary span {
  border-color: rgba(31, 141, 132, 0.18);
  color: var(--accent-dark);
  font-weight: 650;
  background: var(--accent-soft);
}

.ai-panel {
  margin: 18px 28px 0;
  padding: 26px;
  border: 1px solid rgba(31, 141, 132, 0.26);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(225, 243, 240, 0.92), rgba(255, 255, 255, 0.96)),
    var(--white);
  box-shadow: 0 18px 50px rgba(31, 141, 132, 0.1);
}

.ai-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-panel__source {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid rgba(31, 141, 132, 0.16);
  border-radius: 999px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.78);
}

.ai-panel__source[data-source="deepseek"] {
  color: #ffffff;
  background: var(--accent);
}

.ai-panel__comment {
  max-width: 920px;
  margin: 14px 0 20px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.45;
}

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

.ai-panel__grid > div {
  padding: 18px;
  border: 1px solid rgba(31, 48, 64, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.ai-panel__title {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
}

.ai-panel ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: var(--ink);
  line-height: 1.42;
  list-style: none;
}

.ai-panel li {
  position: relative;
  padding: 11px 12px 11px 36px;
  border: 1px solid rgba(31, 48, 64, 0.08);
  border-radius: 8px;
  color: #314151;
  font-size: 15px;
  font-weight: 700;
  background: #fbfcfb;
}

.ai-panel li::before {
  position: absolute;
  left: 12px;
  top: 15px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  content: "";
  background: var(--amber);
}

#ai-next-steps li::before {
  background: var(--accent);
}

.ai-panel__disclaimer {
  margin: 16px 0 0;
  color: rgba(28, 41, 54, 0.66);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.risk-block {
  padding: 28px;
}

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

.risk-block__header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

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

.risk {
  min-height: 86px;
  padding: 16px;
  border: 1px solid rgba(183, 77, 67, 0.22);
  border-radius: 8px;
  background: var(--danger-soft);
}

.risk--clear {
  grid-column: 1 / -1;
  min-height: auto;
  border-color: rgba(32, 121, 79, 0.22);
  color: var(--success);
  background: var(--success-soft);
}

.risk strong,
.risk span {
  display: block;
}

.risk strong {
  margin-bottom: 8px;
  color: var(--ink);
  font-weight: 700;
}

.risk span {
  color: var(--muted);
  font-size: 14px;
}

.next-steps {
  padding: 0 28px 28px;
}

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

.next-steps__grid span {
  padding: 14px;
  border: 1px solid rgba(201, 137, 36, 0.22);
  border-radius: 8px;
  color: #6f4b13;
  font-size: 14px;
  font-weight: 650;
  background: var(--amber-soft);
}

.footer {
  padding: 18px 0 32px;
  color: rgba(28, 41, 54, 0.58);
  font-size: 12px;
  line-height: 1.5;
}

.footer p {
  margin: 4px 0;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .risk-preview {
    grid-template-columns: 1fr 1fr;
  }

  .details-grid,
  .reliability-panel,
  .insight-grid,
  .data-columns,
  .market-grid,
  .ai-panel__grid,
  .next-steps__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail:nth-child(2) {
    border-right: 0;
  }

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

@media (max-width: 700px) {
  .topbar,
  .shell,
  .footer {
    width: min(100% - 28px, 1180px);
  }

  .topbar {
    padding-top: 16px;
  }

  .workspace__intro {
    padding: 24px;
  }

  h1 {
    font-size: 40px;
  }

  .search__row,
  .risk-preview,
  .details-grid,
  .reliability-panel,
  .insight-grid,
  .data-columns,
  .market-grid,
  .ai-panel__grid,
  .risks,
  .next-steps__grid {
    grid-template-columns: 1fr;
  }

  .facts div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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

  .ai-panel {
    margin-right: 18px;
    margin-left: 18px;
  }

  .ai-panel__header {
    display: block;
  }

  .ai-panel__source {
    display: inline-block;
    margin-top: 12px;
  }

  .summary {
    display: block;
  }

  .summary__actions {
    align-items: flex-start;
    margin-top: 18px;
  }

  .detail {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .detail:last-child {
    border-bottom: 0;
  }

  .risk-block__header {
    display: block;
  }

  .risk-block__header span {
    display: inline-block;
    margin-top: 10px;
  }
}
