:root {
  color-scheme: light;
  --bg: #f4f9fb;
  --panel: #ffffff;
  --text: #173044;
  --muted: #647887;
  --line: #d8e7ed;
  --line-strong: #b7d0da;
  --accent: #8bc53f;
  --accent-dark: #2293bf;
  --accent-soft: #edf8df;
  --brand-blue: #2293bf;
  --brand-blue-dark: #1e2f87;
  --brand-green: #8bc53f;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow: 0 12px 30px rgba(18, 76, 102, 0.1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(34, 147, 191, 0.08), transparent 220px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; transition: color 160ms ease, background 160ms ease; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--brand-blue-dark);
  font-weight: 800;
}
.brand img {
  display: block;
  width: auto;
  height: 40px;
  max-width: min(310px, 48vw);
  object-fit: contain;
}
.brand span {
  border-left: 1px solid var(--line-strong);
  padding-left: 12px;
  color: var(--brand-blue);
  white-space: nowrap;
}
.topbar nav { display: flex; align-items: center; gap: 16px; }
.topbar form { margin: 0; }
.shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 28px auto;
  animation: page-in 260ms ease both;
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
h1 { margin: 0; font-size: 28px; line-height: 1.2; }
h2 { margin: 0 0 14px; font-size: 18px; }
.muted { color: var(--muted); margin: 6px 0 0; }
.auth-panel, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.auth-panel {
  max-width: 460px;
  margin: 80px auto;
  border-top: 4px solid var(--brand-green);
}
.auth-logo {
  display: block;
  width: min(320px, 100%);
  max-height: 78px;
  object-fit: contain;
  object-position: center;
  margin: 0 auto 22px;
}
.login-panel .stack { margin-top: 22px; }
.login-panel .alert + .stack { margin-top: 14px; }
.account-context {
  display: grid;
  gap: 3px;
  margin: 14px 0 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}
.account-context span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.account-context strong {
  color: #263241;
  font-size: 15px;
  overflow-wrap: anywhere;
}
.stack, .lead-form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 600; color: #263241; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 4px rgba(34, 147, 191, 0.13);
}
.form-select {
  appearance: none;
  min-height: 42px;
  padding-right: 42px;
  background:
    linear-gradient(45deg, transparent 50%, #647887 50%) calc(100% - 19px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, #647887 50%, transparent 50%) calc(100% - 14px) 50% / 7px 7px no-repeat,
    #fff;
}
textarea { min-height: 110px; resize: vertical; }
button, .button-link, .button-muted {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 14px;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
button:hover, .button-link:hover {
  background: var(--brand-blue-dark);
  box-shadow: 0 8px 18px rgba(34, 147, 191, 0.2);
  text-decoration: none;
  transform: translateY(-1px);
}
button:active, .button-link:active, .button-muted:active { transform: translateY(0); }
.button-muted { background: #fff; color: var(--text); border-color: var(--line); }
.button-muted:hover {
  background: #f8fafc;
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.08);
}
.danger { background: var(--danger); }
.auth-links { display: grid; gap: 10px; margin-top: 18px; }
.alert { color: var(--danger); font-weight: 700; }
.alert-box {
  margin: 0 0 16px;
  border: 1px solid #f4b3ad;
  border-radius: 8px;
  padding: 12px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 800;
}
.alert-list {
  display: grid;
  gap: 4px;
  border: 1px solid #f4b3ad;
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--danger);
  font-weight: 700;
}
.alert-list p { margin: 0; }
.notice {
  padding: 12px;
  border: 1px solid #cbe8a6;
  background: #f4fbe9;
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(170px, 220px) minmax(180px, 230px) minmax(100px, 130px) auto auto auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}
.filters.is-loading {
  opacity: 0.78;
}
.filter-field {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.filter-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.filter-field select {
  appearance: none;
  padding-right: 38px;
  background:
    linear-gradient(45deg, transparent 50%, #64748b 50%) calc(100% - 18px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, #64748b 50%, transparent 50%) calc(100% - 13px) 50% / 6px 6px no-repeat,
    #fff;
}
.filter-field:has(select)::after {
  content: "";
  position: absolute;
  right: 34px;
  bottom: 8px;
  width: 1px;
  height: 24px;
  background: var(--line);
}
.filter-search { min-width: 260px; }
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: #263241;
  font-weight: 800;
  white-space: nowrap;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.filter-check:hover {
  border-color: var(--line-strong);
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.06);
}
.filter-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-blue);
}
.filter-check span { font-size: 14px; }
.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 300px);
  min-height: 260px;
  scrollbar-gutter: stable;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
[data-results-panel] {
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}
[data-results-panel].is-loading {
  opacity: 0.58;
  filter: saturate(0.88);
  transform: translateY(3px);
}
[data-results-panel].has-refreshed {
  animation: results-in 220ms ease both;
}
table { width: 100%; border-collapse: collapse; table-layout: auto; }
.companies-table { width: max-content; min-width: 1480px; }
th, td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}
.companies-table th:nth-child(1), .companies-table td:nth-child(1) { min-width: 104px; }
.companies-table th:nth-child(2), .companies-table td:nth-child(2) { min-width: 190px; }
.companies-table th:nth-child(3), .companies-table td:nth-child(3) { min-width: 190px; }
.companies-table th:nth-child(4), .companies-table td:nth-child(4) { min-width: 210px; }
.companies-table th:nth-child(5), .companies-table td:nth-child(5) { min-width: 210px; }
.companies-table th:nth-child(6), .companies-table td:nth-child(6) { min-width: 150px; }
.companies-table th:nth-child(7), .companies-table td:nth-child(7) { min-width: 150px; }
.companies-table th:nth-child(8), .companies-table td:nth-child(8) { min-width: 170px; }
.companies-table th:nth-child(9), .companies-table td:nth-child(9) { min-width: 130px; }
.companies-table th:nth-child(10), .companies-table td:nth-child(10) { min-width: 180px; }
.companies-table th:nth-child(11), .companies-table td:nth-child(11) { min-width: 95px; }
.companies-table th:nth-child(12), .companies-table td:nth-child(12) { min-width: 210px; }
.companies-table th:nth-child(13), .companies-table td:nth-child(13) { min-width: 170px; }
.companies-table th:nth-child(14), .companies-table td:nth-child(14) { min-width: 80px; }
th {
  position: sticky;
  top: 0;
  background: #edf7fb;
  color: var(--brand-blue-dark);
  font-weight: 800;
  white-space: nowrap;
  z-index: 1;
  box-shadow: 0 1px 0 var(--line);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}
.pagination span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
tbody tr { transition: background 140ms ease; }
tbody tr:hover { background: #fbfdfb; }
.empty { text-align: center; color: var(--muted); padding: 28px; }
.lead-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
}
.product-details { display: grid; gap: 16px; padding: 22px; border: 1px solid #cfe5ed; border-radius: 12px; background: linear-gradient(135deg, #f7fcfe, #f9fdf3); }
.product-details-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.product-details-heading h2 { margin: 0; color: var(--brand-blue-dark); }
.product-details-heading p { max-width: 380px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; text-align: right; }
.eyebrow { color: var(--brand-blue); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.product-details-fields { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(310px, 0.9fr); gap: 14px; align-items: stretch; }
.product-name-field, .strength-picker { min-width: 0; border: 1px solid #d4e7ed; border-radius: 12px; background: rgba(255, 255, 255, 0.78); }
.product-name-field { align-content: start; padding: 16px 18px; }
.product-name-field > span { color: #263241; font-weight: 700; }
.product-name-field input { margin-top: 5px; }
.strength-picker { display: grid; align-self: start; min-height: 0; gap: 6px; padding: 16px 18px; color: #263241; font-weight: 700; }
.strength-picker input { margin-top: 5px; }
.strength-picker small { margin-top: 6px; color: var(--muted); font-size: 13px; font-weight: 400; }
.strength-badge { display: inline-flex; align-items: baseline; gap: 1px; border: 1px solid currentColor; border-radius: 999px; padding: 3px 8px; font-weight: 800; }
.strength-badge span { opacity: 0.72; font-size: 12px; }
.strength-level-1 { background: #ffebe8; color: #b63228; }
.strength-level-2 { background: #fff2dd; color: #a9590b; }
.strength-level-3 { background: #e6f4fb; color: #217bbd; }
.strength-level-4 { background: #eaf8e7; color: #318552; }
.strength-level-5 { background: #e2f7f1; color: #21836f; }
.wide, .form-actions { grid-column: 1 / -1; }
.form-actions, .row-actions { display: flex; gap: 10px; align-items: center; }
.inline { display: flex; gap: 8px; align-items: center; }
.panel { margin-top: 18px; }
.owner-name, .owner-email { display: block; }
.owner-name { font-weight: 800; color: #263241; }
.owner-email { margin-top: 2px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.password-rules {
  display: grid;
  gap: 8px;
  margin: -2px 0 2px;
  padding: 0;
  list-style: none;
}
.password-rules li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  transition: color 160ms ease, transform 160ms ease;
}
.password-rules li::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.password-rules li.is-met { color: var(--accent-dark); transform: translateX(2px); }
.password-rules li.is-met::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.password-rules li.is-missing::before { background: #fff; }
code {
  background: #eef2f7;
  border-radius: 4px;
  padding: 2px 4px;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes results-in {
  from { opacity: 0.82; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .topbar nav { gap: 10px; }
  .brand { gap: 8px; }
  .brand img { height: 34px; max-width: 54vw; }
  .brand span { display: none; }
  .page-head { align-items: stretch; flex-direction: column; }
  .filters, .lead-form { grid-template-columns: 1fr; }
  .product-details-fields { grid-template-columns: 1fr; }
  .product-details-heading { align-items: start; flex-direction: column; gap: 6px; }
  .product-details-heading p { max-width: none; text-align: left; }
  .filter-search { min-width: 0; }
  .wide, .form-actions { grid-column: auto; }
  .shell { width: min(100vw - 20px, 1380px); margin-top: 18px; }
  .auth-panel { margin: 32px auto; padding: 20px; }
  h1 { font-size: 24px; }
  .table-actions { align-items: stretch; flex-direction: column; }
  .table-actions button, .export-actions { width: 100%; }
  .export-actions { flex-direction: column; }
  .pagination { justify-content: space-between; }
  .table-wrap { max-height: calc(100vh - 360px); }
}

@media (min-width: 821px) and (max-width: 1100px) {
  .filters {
    grid-template-columns: minmax(280px, 1fr) minmax(170px, 1fr) minmax(180px, 1fr);
  }
  .filters button,
  .filters .button-muted {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
