:root {
  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --secondary: #d97706;
  --text-main: #111827;
  --text-muted: #4b5563;
  --bg: #f8fafc;
  --bg-light: #f3f4f6;
  --line: #e5e7eb;
  --card: #ffffff;
  --blue-soft: #eff6ff;
  --amber-soft: #fef3c7;
  --green-soft: #ecfdf5;
  --green: #047857;
  --red-soft: #fef2f2;
  --red: #b91c1c;
  --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.10), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, sans-serif;
  color: var(--text-main);
  background: var(--bg);
  line-height: 1.6;
}

*:focus {
  outline: 4px solid var(--secondary);
  outline-offset: 2px;
}

button,
input {
  font: inherit;
}

button {
  min-height: 56px;
  cursor: pointer;
}

.topbar {
  background: #1f2937;
  color: #fff;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
}

.topbar-inner,
.header-inner,
.page,
.footer-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.header-inner {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: inherit;
  text-decoration: none;
}

.brand-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 18px rgba(30, 64, 175, 0.22);
  font-size: 26px;
  font-weight: 800;
}

.brand-title {
  margin: 0;
  color: var(--primary);
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
}

.brand-subtitle {
  display: block;
  margin-top: 6px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  padding: 12px 18px;
  border-radius: 16px;
  color: var(--primary);
  background: var(--bg-light);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
}

.page {
  padding: 38px 0 54px;
}

.checker {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 28px;
  align-items: stretch;
  margin-bottom: 28px;
}

.intro,
.form,
.state-panel,
.panel,
.summary {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.intro {
  padding: 32px;
  border-top: 6px solid var(--primary);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--secondary);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--primary-dark);
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
}

.lead {
  margin: 18px 0 0;
  color: var(--text-muted);
  font-size: 20px;
}

.form {
  padding: 32px;
}

.form label {
  display: block;
  margin-bottom: 10px;
  font-size: 18px;
  font-weight: 800;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

input {
  width: 100%;
  min-height: 56px;
  border: 2px solid #d1d5db;
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--text-main);
  background: #fff;
  font-size: 20px;
  font-weight: 700;
}

input::placeholder {
  color: #9ca3af;
  font-weight: 500;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0 24px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  box-shadow: 0 10px 18px rgba(30, 64, 175, 0.22);
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  background: #94a3b8;
  cursor: wait;
  box-shadow: none;
}

.hint,
.muted {
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.state-panel {
  padding: 28px;
  margin-bottom: 28px;
}

.empty {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
}

.empty strong {
  color: var(--primary-dark);
  font-size: 20px;
}

.error {
  border-color: #fecaca;
  background: var(--red-soft);
  color: var(--red);
}

.loading {
  border-color: #bfdbfe;
  background: var(--blue-soft);
  color: var(--primary-dark);
}

.hidden {
  display: none;
}

.summary {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  padding: 28px;
  margin-bottom: 22px;
  border-top: 6px solid var(--primary);
}

h2 {
  margin: 0;
  color: var(--primary-dark);
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.15;
}

#company-full-name {
  margin: 10px 0 0;
  color: var(--text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.closed {
  color: var(--red);
  background: var(--red-soft);
}

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

.panel {
  padding: 24px;
}

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

.panel h3 {
  margin: 0 0 16px;
  color: var(--primary-dark);
  font-size: 22px;
}

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

.panel-title-row span {
  color: var(--text-muted);
  font-weight: 800;
}

.details {
  display: grid;
  gap: 13px;
  margin: 0;
}

.details div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.details div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

dt {
  color: var(--text-muted);
  font-weight: 700;
}

dd {
  margin: 0;
  font-weight: 800;
}

.okved {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
}

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

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

.metric {
  min-height: 90px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-light);
}

.metric span {
  display: block;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--primary-dark);
  font-size: 20px;
  line-height: 1.2;
}

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

.compact-item {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.compact-item strong {
  display: block;
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

.compact-item span {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
}

.risk-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 56px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.risk-marker {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--green);
}

.risk-item.active {
  border-color: #fecaca;
  background: var(--red-soft);
}

.risk-item.active .risk-marker {
  background: var(--red);
}

.risk-item strong {
  display: block;
}

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

.footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 24px 0 30px;
}

.footer p {
  margin: 0;
}

.footer a {
  color: var(--primary);
  font-weight: 800;
}

.disclaimer {
  margin-top: 6px !important;
  color: var(--text-muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .topbar-inner,
  .header-inner,
  .checker,
  .summary,
  .grid,
  .risk-list {
    grid-template-columns: 1fr;
  }

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

  .topbar-inner,
  .header-inner,
  .summary {
    display: grid;
  }

  .header-badge {
    width: max-content;
  }

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

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

@media (max-width: 520px) {
  .topbar {
    font-size: 14px;
  }

  .brand-icon {
    width: 50px;
    height: 50px;
  }

  .brand-title {
    font-size: 24px;
  }

  .brand-subtitle {
    font-size: 11px;
  }

  .intro,
  .form,
  .state-panel,
  .summary,
  .panel {
    padding: 20px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }
}
