@import "tailwindcss";

:root {
  --page: #070b14;
  --panel: #101827;
  --panel-soft: #151f31;
  --field: #0b1320;
  --line: #2a3a55;
  --line-soft: #1c2a41;
  --text: #f7f4ef;
  --muted: #94a2b9;
  --muted-strong: #bbc5d5;
  --accent: #ff9b54;
  --accent-2: #ff6f3c;
  --cyan: #63d3ff;
  --danger: #ff6b7a;
  --warning: #ffd36b;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 4%, rgb(255 123 67 / 0.14), transparent 26rem),
    radial-gradient(circle at 92% 72%, rgb(81 192 255 / 0.12), transparent 30rem),
    linear-gradient(180deg, #070b14 0%, #0a1020 100%);
  font-family: var(--font-geist-sans), Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  color: #251006;
  background: var(--accent);
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 51px;
  height: 51px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 0.12);
  border-radius: 14px;
  color: #271006;
  background: linear-gradient(145deg, #ffc078, #ff7146);
  box-shadow: 0 12px 30px rgb(255 111 60 / 0.26);
  font-size: 23px;
  font-weight: 900;
}

.brand-copy {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.brand h1 span {
  color: var(--accent);
}

.brand p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.header-statuses {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.status-pill,
.mode-pill,
.preset,
.confidence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}

.status-pill {
  padding: 8px 13px;
  color: var(--muted-strong);
  background: rgb(16 26 43 / 0.8);
  font-size: 0.76rem;
  font-weight: 650;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 10px currentColor;
}

.status-pill.connected {
  color: var(--cyan);
}

.status-pill.connected .status-dot {
  background: var(--cyan);
}

.status-pill.disconnected {
  color: #ffd36b;
}

.main-stack {
  display: grid;
  gap: 2px;
  margin-top: 32px;
}

.panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgb(17 26 43 / 0.97), rgb(10 17 30 / 0.97));
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.18);
}

.search-panel {
  padding: clamp(24px, 4vw, 38px);
  border-radius: 22px;
}

.results-panel {
  padding: clamp(22px, 4vw, 38px);
  border-radius: 22px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.heading-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.heading-icon {
  color: var(--accent);
  font-size: 1.15rem;
}

.panel-heading h2 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  letter-spacing: -0.025em;
}

.mode-pill {
  padding: 8px 13px;
  color: #ffc28b;
  background: rgb(255 139 78 / 0.1);
  font-size: 0.78rem;
  font-weight: 700;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.field {
  display: grid;
  gap: 9px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: #e6eaf1;
  font-size: 0.8rem;
  font-weight: 700;
}

.field label span {
  color: var(--muted);
  font-weight: 450;
}

.field label .required {
  color: var(--danger);
}

.input-wrap {
  position: relative;
}

.input-icon {
  position: absolute;
  top: 50%;
  left: 15px;
  color: #71819a;
  transform: translateY(-50%);
  pointer-events: none;
}

.field input,
.field select,
.table-filter input {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  color: var(--text);
  background: var(--field);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input,
.field select {
  height: 50px;
  padding: 0 15px 0 43px;
}

.field input::placeholder,
.table-filter input::placeholder {
  color: #68768d;
}

.field input:hover,
.field select:hover,
.table-filter input:hover {
  border-color: #49617f;
}

.field input:focus,
.field select:focus,
.table-filter input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 4px rgb(255 123 67 / 0.1);
}

.search-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 28px;
}

.presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
}

.preset {
  padding: 6px 11px;
  color: #aab6c9;
  background: #172338;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.preset:hover {
  border-color: var(--accent-2);
  color: #fff1e4;
  transform: translateY(-1px);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 250px;
  min-height: 50px;
  padding: 13px 22px;
  border: 0;
  border-radius: 13px;
  color: #2c1106;
  background: linear-gradient(100deg, #ffb568, #ff7845 68%, #ff9f62);
  box-shadow: 0 13px 32px rgb(255 105 58 / 0.24);
  font-weight: 800;
  transition: transform 160ms ease, filter 160ms ease;
}

.primary-button:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: translateY(-2px);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.spinner {
  width: 17px;
  height: 17px;
  margin-right: 9px;
  border: 2px solid rgb(44 17 6 / 0.25);
  border-top-color: #2c1106;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 20px;
  padding: 13px 15px;
  border: 1px solid rgb(245 196 81 / 0.25);
  border-radius: 12px;
  color: #f0cd7c;
  background: rgb(245 196 81 / 0.06);
  font-size: 0.82rem;
  line-height: 1.55;
}

.notice.error {
  border-color: rgb(255 111 117 / 0.25);
  color: #ff9ba0;
  background: rgb(255 111 117 / 0.06);
}

.notice a,
.site-footer a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-intro h2 {
  margin: 0;
}

.result-intro p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line-soft);
}

.table-filter {
  position: relative;
  flex: 1 1 220px;
  max-width: 300px;
}

.table-filter input {
  height: 42px;
  padding: 0 14px 0 39px;
  font-size: 0.8rem;
}

.toolbar-button,
.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #3c4c68;
  border-radius: 9px;
  color: #e8edf6;
  background: #19253a;
  font-size: 0.78rem;
  font-weight: 700;
  transition: border-color 150ms ease, background 150ms ease;
}

.toolbar-button:hover,
.copy-button:hover {
  border-color: #ff8a50;
  background: #263149;
}

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

.results-table {
  width: 100%;
  min-width: 870px;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table th {
  padding: 16px 18px;
  color: #ffc28e;
  background: rgb(48 31 34 / 0.78);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.results-table th:nth-child(1) { width: 6%; }
.results-table th:nth-child(2) { width: 24%; }
.results-table th:nth-child(3) { width: 24%; }
.results-table th:nth-child(4) { width: 35%; }
.results-table th:nth-child(5) { width: 11%; }

.results-table td {
  padding: 18px;
  border-bottom: 1px solid #1c2a41;
  color: #aab5c7;
  font-size: 0.82rem;
  line-height: 1.45;
  vertical-align: middle;
}

.results-table tr:last-child td {
  border-bottom: 0;
}

.results-table tbody tr {
  transition: background 150ms ease;
}

.results-table tbody tr:hover {
  background: rgb(55 68 96 / 0.3);
}

.company-name {
  color: #f3f5fa;
  font-weight: 750;
}

.duns-cell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.duns-number {
  display: inline-flex;
  padding: 7px 10px;
  border: 1px solid #dc6d38;
  border-radius: 8px;
  color: #ffad70;
  background: rgb(255 126 65 / 0.08);
  font-family: var(--font-geist-mono), monospace;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.mini-copy {
  min-height: 33px;
  padding: 0 10px;
  color: #abb7ca;
  font-size: 0.72rem;
}

.confidence {
  padding: 4px 8px;
  color: #8edfff;
  background: rgb(99 211 255 / 0.07);
  font-size: 0.68rem;
}

.empty-state {
  padding: 42px 20px 24px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: #e7ebf3;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 16px;
  border: 1px solid #a75a35;
  border-radius: 11px;
  color: #fff0e4;
  background: #342019;
  box-shadow: 0 18px 50px rgb(0 0 0 / 0.4);
  font-size: 0.82rem;
  animation: toast-in 200ms ease-out;
}

.site-footer {
  margin-top: 20px;
  color: #73829a;
  font-size: 0.72rem;
  line-height: 1.55;
  text-align: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 28px, 1180px);
    padding-top: 18px;
  }

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

  .header-statuses {
    justify-content: flex-start;
  }

  .search-form {
    grid-template-columns: 1fr;
  }

  .field.full {
    grid-column: auto;
  }

  .search-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .brand-mark {
    width: 45px;
    height: 45px;
  }

  .brand p {
    line-height: 1.45;
  }

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

  .search-panel,
  .results-panel {
    padding: 20px 16px;
  }

  .results-toolbar > * {
    max-width: none;
    flex: 1 1 100%;
  }
}

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