:root {
  color-scheme: dark;
  --bg: #061012;
  --bg-deep: #03090b;
  --surface: #0b181a;
  --surface-2: #0e1d20;
  --line: rgba(112, 169, 170, .2);
  --text: #f4f7f7;
  --muted: #89999d;
  --cyan: #24d8cf;
  --cyan-2: #67e3e7;
  --green: #38d790;
  --yellow: #f0c95d;
  --red: #ff7c71;
  --radius: 18px;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef7f7;
  --bg-deep: #f9fcfc;
  --surface: #ffffff;
  --surface-2: #edf8f7;
  --line: rgba(23, 77, 78, .18);
  --text: #10292c;
  --muted: #526a6e;
  --cyan: #008f87;
  --cyan-2: #057f82;
  --green: #087944;
  --yellow: #8a6500;
  --red: #bd342d;
}
html[data-theme="light"] .topbar { background: rgba(249, 252, 252, .93); box-shadow: 0 8px 30px rgba(18, 72, 73, .06); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 73% 8%, rgba(0, 204, 180, .09), transparent 31rem),
    linear-gradient(180deg, var(--bg-deep), var(--bg));
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}
button, input { font: inherit; }
a { color: inherit; }

.topbar {
  height: 70px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 64px);
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(3, 9, 11, .86);
  backdrop-filter: blur(16px);
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-button { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px; font-size: 13px; font-weight: 700; cursor: pointer; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 11px; color: #071014; font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--cyan-2));
  box-shadow: 0 0 24px rgba(36, 216, 207, .16);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--cyan); font-size: 11px; margin-top: 3px; }
.site-link {
  text-decoration: none; color: var(--text); font-size: 14px; font-weight: 700;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px;
}

main { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.search-shell { padding: 76px 0 58px; max-width: 890px; }
.eyebrow {
  display: inline-flex; border: 1px solid rgba(36, 216, 207, .24);
  background: rgba(36, 216, 207, .09); border-radius: 999px;
  color: var(--cyan); padding: 8px 13px; font-weight: 800; font-size: 12px;
  letter-spacing: .035em;
}
h1 { font-size: clamp(38px, 6vw, 66px); line-height: 1.04; letter-spacing: -.045em; margin: 24px 0 19px; font-weight: 900; }
h1 span { color: var(--cyan); }
.lead { color: var(--muted); max-width: 760px; font-size: 17px; line-height: 1.65; margin: 0 0 31px; }
form { max-width: 850px; }
form label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.input-wrap { position: relative; }
input {
  width: 100%; height: 60px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 0 52px 0 18px;
  font-size: 18px; outline: none; transition: .2s ease;
}
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(36, 216, 207, .11); }
input.invalid { border-color: var(--red); box-shadow: 0 0 0 4px rgba(255, 124, 113, .08); }
.clear-button { position: absolute; right: 11px; top: 10px; width: 40px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 24px; cursor: pointer; }
.primary-button {
  height: 60px; border: 0; border-radius: 12px; padding: 0 26px;
  color: #061012; font-weight: 800; cursor: pointer;
  background: linear-gradient(90deg, #00ccb4, #5ce1e6);
  box-shadow: 0 8px 28px rgba(36, 216, 207, .18); transition: .2s ease;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 34px rgba(36, 216, 207, .27); }
.primary-button:disabled { opacity: .65; cursor: wait; transform: none; }
.primary-button span { margin-left: 10px; }
.form-meta { min-height: 25px; display: flex; justify-content: space-between; gap: 16px; color: #63777b; font-size: 12px; padding: 9px 2px 0; }
#form-status.error { color: var(--red); }
#form-status.success { color: var(--green); }
#form-status a { color: inherit; font-weight: 700; }
.privacy-note { display: inline-flex; gap: 8px; align-items: center; margin-top: 18px; color: var(--muted); font-size: 13px; }
.privacy-note span { color: var(--cyan); }

.empty-state { text-align: center; padding: 55px 20px 100px; border-top: 1px solid var(--line); }
.empty-state h2 { margin: 22px 0 8px; font-size: 20px; }
.empty-state p { color: var(--muted); margin: 0; font-size: 14px; }
.empty-orbit { margin: 0 auto; width: 96px; height: 96px; border-radius: 50%; border: 1px solid rgba(36, 216, 207, .25); display: grid; place-items: center; position: relative; }
.empty-orbit::after { content: ""; position: absolute; inset: 12px; border: 1px dashed rgba(36, 216, 207, .28); border-radius: 50%; }
.empty-orbit span { color: var(--cyan); font-weight: 900; font-size: 17px; }

.result-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; padding-bottom: 72px; align-items: start; }
.sidebar { position: sticky; top: 94px; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 18px 50px rgba(0,0,0,.1); }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { text-decoration: none; color: var(--muted); padding: 11px 12px; border-radius: 9px; font-size: 13px; font-weight: 650; display: flex; justify-content: space-between; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--cyan); background: rgba(36, 216, 207, .08); }
.sidebar nav span { min-width: 22px; height: 20px; display: grid; place-items: center; border-radius: 99px; color: var(--bg); background: var(--yellow); font-size: 11px; }
.sidebar-actions { display: grid; gap: 8px; border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.sidebar-actions button { text-align: left; border: 1px solid var(--line); background: transparent; color: #697b7e; border-radius: 9px; padding: 10px 12px; font-size: 12px; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.card { scroll-margin-top: 95px; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: linear-gradient(145deg, color-mix(in srgb, var(--surface) 96%, var(--cyan) 4%), var(--surface)); box-shadow: 0 14px 38px rgba(0, 0, 0, .09); min-width: 0; transition: border-color .2s, box-shadow .2s, transform .2s; }
.card.is-active { border-color: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 13%, transparent), 0 18px 52px rgba(0, 0, 0, .14); transform: translateY(-2px); }
.card.wide { grid-column: 1 / -1; }
#details { grid-row: span 2; }
.company-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.company-top h2 { font-size: clamp(24px, 4vw, 38px); letter-spacing: -.035em; margin: 8px 0; line-height: 1.12; }
.company-full { color: var(--muted); font-size: 12px; line-height: 1.5; max-width: 720px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.good { color: var(--green); background: rgba(56, 215, 144, .1); }
.status.warn { color: var(--yellow); background: rgba(240, 201, 93, .1); }
.status.bad { color: var(--red); background: rgba(255, 124, 113, .1); }
.requisites { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.requisite { background: color-mix(in srgb, var(--surface) 96%, var(--cyan) 4%); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; font-size: 12px; color: var(--muted); }
.requisite strong { color: var(--text); margin-left: 5px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.section-head h3, .card > h3 { margin: 0; font-size: 17px; }
.section-kicker { color: var(--muted); font-size: 12px; }
.risk-summary { display: flex; align-items: center; gap: 16px; margin-bottom: 17px; }
.risk-number { font-size: 38px; font-weight: 900; color: var(--yellow); }
.risk-summary strong, .risk-summary small { display: block; }
.risk-summary small { color: var(--muted); margin-top: 4px; }
.risk-list { display: grid; gap: 9px; }
.risk-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 12px; border-radius: 11px; background: rgba(255, 124, 113, .055); border: 1px solid rgba(255, 124, 113, .13); }
.risk-item.ok { background: rgba(56, 215, 144, .045); border-color: rgba(56, 215, 144, .12); }
.risk-icon { color: var(--red); }
.risk-item.ok .risk-icon { color: var(--green); }
.risk-item strong { display: block; font-size: 13px; }
.risk-item small { color: var(--muted); line-height: 1.5; }
.data-list { display: grid; gap: 0; margin-top: 14px; }
.data-row { display: grid; grid-template-columns: minmax(110px, .65fr) 1fr; gap: 14px; padding: 11px 0; border-top: 1px solid rgba(112,169,170,.13); font-size: 13px; line-height: 1.5; }
.data-row:first-child { border-top: 0; }
.data-label { color: var(--muted); }
.person { padding: 13px 0; border-top: 1px solid rgba(112,169,170,.13); }
.person:first-of-type { border-top: 0; }
.person strong { display: block; font-size: 14px; }
.person small { color: var(--muted); line-height: 1.5; }
.tag-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.tag { padding: 7px 9px; border-radius: 8px; background: rgba(36,216,207,.07); color: var(--cyan-2); border: 1px solid rgba(36,216,207,.13); font-size: 11px; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.show-more { margin-top: 12px; color: var(--cyan); background: none; border: 0; padding: 0; font-size: 12px; cursor: pointer; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.metric { padding: 15px; border-radius: 12px; border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 96%, var(--cyan) 4%); }
.metric span, .metric strong, .metric small { display: block; }
.metric span { color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.metric strong { font-size: 18px; overflow-wrap: anywhere; }
.metric small { color: var(--muted); font-size: 10px; margin-top: 5px; }
.trend.up { color: var(--green); font-weight: 800; }
.trend.down { color: var(--red); font-weight: 800; }
.trend.flat { color: var(--muted); }
.record-list { display: grid; gap: 8px; margin-top: 14px; }
.record { padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--surface) 97%, var(--cyan) 3%); }
.record-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.record strong { font-size: 13px; line-height: 1.45; }
.record small { display: block; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.record a { color: var(--cyan); text-decoration: none; }
.company-links { display: grid; gap: 8px; margin-top: 14px; }
.company-link { padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; }
.company-link strong, .company-link small { display: block; }
.company-link strong { font-size: 13px; }
.company-link small { color: var(--muted); margin-top: 4px; font-size: 11px; }
.timeline { border-left: 1px solid var(--line); margin: 16px 0 0 7px; padding-left: 20px; display: grid; gap: 17px; }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -25px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cyan) 14%, transparent); }
.timeline-item strong { font-size: 13px; display: block; }
.timeline-item small { color: var(--muted); display: block; margin-top: 4px; line-height: 1.45; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; padding: 13px 16px; border-radius: 11px; color: var(--text); background: var(--surface); border: 1px solid var(--cyan); box-shadow: 0 18px 55px rgba(0,0,0,.25); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; font-size: 13px; }
.toast.show { opacity: 1; transform: translateY(0); }
.sidebar-actions button { cursor: pointer; color: var(--text); }
.sidebar-actions button.active { color: var(--green); border-color: var(--green); }
.watchlist-wrap { position: relative; }
.watchlist-button { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); background: var(--surface); cursor: pointer; font: inherit; font-size: 12px; font-weight: 750; white-space: nowrap; }
.watchlist-button span { display: inline-grid; min-width: 20px; height: 20px; place-items: center; margin-left: 4px; border-radius: 99px; color: var(--bg); background: var(--cyan); font-size: 11px; }
.watchlist-panel { position: absolute; z-index: 40; right: 0; top: calc(100% + 9px); width: min(360px, calc(100vw - 28px)); padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 22px 65px rgba(0,0,0,.28); }
.watchlist-head { display: grid; gap: 3px; padding: 7px 8px 10px; border-bottom: 1px solid var(--line); }
.watchlist-head strong { font-size: 13px; }.watchlist-head small { color: var(--muted); font-size: 10px; }
.watchlist-item { display: grid; grid-template-columns: minmax(0,1fr) 32px; gap: 5px; align-items: center; border-bottom: 1px solid var(--line); }
.watchlist-item:last-child { border-bottom: 0; }
.watchlist-open, .watchlist-remove { border: 0; color: var(--text); background: transparent; cursor: pointer; }
.watchlist-open { min-width: 0; padding: 11px 8px; text-align: left; }
.watchlist-open strong, .watchlist-open small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.watchlist-open strong { font-size: 12px; }.watchlist-open small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.watchlist-open:hover strong { color: var(--cyan); }
.watchlist-remove { width: 30px; height: 30px; border-radius: 8px; color: var(--muted); font-size: 18px; }
.watchlist-remove:hover { color: var(--red); background: rgba(255,124,113,.09); }
.watchlist-empty { margin: 0; padding: 18px 8px; color: var(--muted); text-align: center; font-size: 12px; }
.collapse-toggle { position: absolute; right: 16px; top: 14px; z-index: 2; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); color: var(--text); background: var(--surface); cursor: pointer; font-size: 18px; font-weight: 800; }
.card { position: relative; padding-right: 56px; }
.card.collapsed { min-height: 64px; padding-top: 21px; padding-bottom: 18px; }
.card.collapsed > :not(.collapse-toggle) { display: none !important; }
.card.collapsed::before { content: attr(data-title); display: block; color: var(--text); font-size: 16px; font-weight: 800; padding-right: 42px; }
.verdict { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.verdict > strong { font-size: 52px; color: var(--cyan); letter-spacing: -.05em; }
.verdict > strong small { font-size: 16px; color: var(--muted); }
.verdict b { font-size: 17px; }

footer { border-top: 1px solid var(--line); padding: 26px 20px 34px; text-align: center; color: var(--muted); }
footer p { font-size: 13px; margin: 0 0 8px; }
footer a { color: var(--cyan); font-weight: 700; }
footer small { display: block; font-size: 11px; line-height: 1.5; }

@media (max-width: 840px) {
  .result-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; overflow-x: auto; }
  .sidebar nav { display: flex; min-width: max-content; }
  .sidebar-actions { display: flex; min-width: max-content; }
  .sidebar-actions button { text-align: center; }
}
@media (max-width: 650px) {
  .topbar { padding: 0 16px; }
  .brand small { display: none; }
  .site-link { font-size: 12px; padding: 9px 10px; }
  .theme-button { width: 42px; overflow: hidden; white-space: nowrap; padding: 9px 11px; }
  main { width: min(100% - 28px, 1180px); }
  .search-shell { padding: 50px 0 42px; }
  h1 { font-size: 38px; }
  .lead { font-size: 15px; }
  .search-row { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .form-meta { display: block; }
  #form-status { display: block; margin-top: 5px; }
  .content-grid { grid-template-columns: 1fr; }
  .card.wide { grid-column: auto; }
  #details { grid-row: auto; }
  .company-top { display: block; }
  .status { margin-top: 12px; }
  .data-row { grid-template-columns: 1fr; gap: 3px; }
  .verdict { align-items: flex-start; }
}

@media (max-width: 720px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media print {
  :root, html[data-theme="light"] { color-scheme: light; --bg: #fff; --bg-deep: #fff; --surface: #fff; --text: #111; --muted: #444; --line: #ccc; --cyan: #087f78; }
  body { background: #fff; }
  .topbar, .search-shell, .sidebar, .empty-state, .toast { display: none !important; }
  main { width: 100%; }
  .result-layout { display: block; padding: 0; }
  .content-grid { display: block; }
  .card { break-inside: avoid; box-shadow: none; margin-bottom: 12px; }
  footer { border-top: 1px solid #ccc; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
