:root {
  --ink: #10241f;
  --muted: #5b6f68;
  --line: #d5e5dc;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --panel: #f3f8f5;
  --brand: #0d6b58;
  --brand-mid: #149277;
  --brand-deep: #084438;
  --accent: #e8910f;
  --accent-soft: #fff7eb;
  --accent-glow: rgba(232, 145, 15, 0.18);
  --danger: #b42318;
  --success: #0f7a45;
  --warning: #9a6700;
  --shadow: 0 16px 40px rgba(8, 48, 40, 0.08);
  --shadow-soft: 0 6px 18px rgba(8, 48, 40, 0.05);
  --radius: 16px;
  --font-display: "Sora", "Trebuchet MS", sans-serif;
  --font-body: "Figtree", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 70% 48% at 6% -8%, rgba(232, 145, 15, 0.12), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 0%, rgba(13, 107, 88, 0.12), transparent 50%),
    linear-gradient(180deg, #f7fbf9 0%, #eef6f2 55%, #f4f8f6 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(13, 107, 88, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 107, 88, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.5), transparent 78%);
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  width: 420px;
  height: 420px;
  right: -120px;
  bottom: -80px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 68%);
  pointer-events: none;
  z-index: 0;
  animation: drift 18s ease-in-out infinite alternate;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
  min-height: 100vh;
  transition: grid-template-columns 220ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  background:
    radial-gradient(ellipse 80% 46% at 0% 0%, rgba(232, 145, 15, 0.16), transparent 55%),
    linear-gradient(180deg, #06352c 0%, #0d6b58 58%, #0a5246 100%);
  color: #f4fffb;
  overflow: auto;
  animation: rise 420ms ease both;
  transition: padding 220ms ease;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  padding-bottom: 10px;
}

.sidebar-collapse {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: #f8fafc;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.sidebar-collapse:hover {
  background: rgba(255,255,255,.16);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 8px 6px;
  margin: 0;
  border-bottom: none;
  flex: 1;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(255,255,255,.22), rgba(255,255,255,.06)),
    rgba(232, 145, 15, 0.38);
  box-shadow: 0 0 0 1px rgba(255,255,255,.18), 0 8px 20px rgba(0,0,0,.18);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}

.brand-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-text small {
  color: rgba(244, 255, 251, 0.72);
  font-size: 0.78rem;
}

.nav-label {
  margin: 16px 10px 6px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 255, 251, 0.55);
}

.side-nav {
  display: grid;
  gap: 4px;
}

.side-nav a {
  color: rgba(244, 255, 251, 0.88);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.side-nav a:hover {
  background: rgba(255,255,255,.10);
  transform: translateX(2px);
}

.side-nav a.active {
  background: rgba(255,255,255,.14);
  box-shadow: inset 3px 0 0 var(--accent);
  transform: translateX(2px);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 14px 8px;
}

.app-shell.sidebar-collapsed .sidebar-top {
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
  padding: 4px;
}

.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-label {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-collapse {
  margin-top: 0;
}

.app-shell.sidebar-collapsed .side-nav a {
  font-size: 0;
  line-height: 0;
  padding: 10px 6px;
  text-align: center;
  transform: none;
}

.app-shell.sidebar-collapsed .side-nav a::before {
  content: attr(data-short);
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  color: rgba(244, 255, 251, 0.92);
}

.app-shell.sidebar-collapsed .side-nav a:hover,
.app-shell.sidebar-collapsed .side-nav a.active {
  transform: none;
}

.workspace {
  min-width: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px 8px;
  animation: rise 480ms ease both;
}

.topbar-copy {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
  background: linear-gradient(120deg, var(--ink) 40%, var(--brand-mid));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-toggle {
  display: none;
}

main {
  padding: 12px 28px 36px;
  max-width: none;
  width: 100%;
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  animation: rise 560ms ease both;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero,
.panel {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  width: 100%;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 200ms ease, transform 200ms ease, border-color 200ms ease;
}

.panel:hover {
  box-shadow: var(--shadow);
  border-color: rgba(13, 107, 88, 0.22);
}

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 12%, rgba(232, 145, 15, 0.30), transparent 42%),
    linear-gradient(135deg, #0d6b58 0%, #084438 100%);
  color: #f7fffb;
  border: none;
  box-shadow: var(--shadow);
}

.hero:hover {
  transform: none;
  border-color: transparent;
}

.hero h2,
.page-title h2,
main > h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.hero p,
.page-title p,
.map-hint {
  margin: 0;
  color: inherit;
  opacity: 0.9;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: #b8d0c6;
}

.card strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--brand);
  letter-spacing: -0.03em;
}

.card span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.page-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 14px;
}

.review-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.review-delete-batch {
  margin: 0;
}

.review-delete-hint {
  margin: 0;
  max-width: 220px;
  font-size: 0.78rem;
}

.review-filters {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.review-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.review-filter select {
  min-width: 0;
  width: auto;
  max-width: 100%;
}

.review-filter select[name="batch_id"] {
  width: 240px;
  max-width: 240px;
}

.review-filter select[name="status"] {
  width: 120px !important;
  max-width: 120px !important;
  min-width: 120px !important;
}

.review-filter select[name="research_type"] {
  width: 160px !important;
  max-width: 160px !important;
  min-width: 140px !important;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0;
}

.sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(8px);
  padding: 8px 0;
}

button,
.button-link {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  border-color: #8fbfae;
  box-shadow: 0 6px 16px rgba(13, 107, 88, 0.12);
}

button.primary,
.primary,
.primary-link {
  background: linear-gradient(145deg, var(--brand-mid), var(--brand-deep));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(13, 107, 88, 0.28);
}

button.primary:hover,
.primary:hover,
.primary-link:hover {
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(13, 107, 88, 0.36);
}

button.danger {
  background: #fff1f0;
  color: var(--danger);
  border-color: #eab1ac;
}

.actions {
  display: flex;
  gap: 5px;
  align-items: flex-start;
}

.actions form { margin: 0; }

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: calc(100vh - 260px);
  max-height: calc(100dvh - 260px);
  min-height: 160px;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 12px;
  overscroll-behavior: contain;
}

/* Visible horizontal + vertical scrollbars (screen-sized viewport) */
.table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-wrap::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
  border: 2px solid #f1f5f9;
}

.table-wrap::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

.table-wrap {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #f1f5f9;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 100%;
}

table.table-compact {
  min-width: 100%;
}

th, td {
  padding: 11px 12px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: middle;
  font-size: 0.86rem;
  background: var(--surface-solid);
}

th {
  background: #f1f5f9;
  position: sticky;
  top: 0;
  z-index: 2;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

td.col-providers {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

td.col-actions,
th.col-actions {
  width: 150px;
  min-width: 150px;
  white-space: nowrap;
  text-align: right;
  position: sticky;
  right: 0;
  z-index: 3;
  box-shadow: -8px 0 12px rgba(15, 40, 32, 0.04);
}

th.col-actions {
  z-index: 4;
  background: #f1f5f9;
}

td.col-actions {
  background: var(--surface-solid);
}

td.col-actions .inline-action {
  display: inline;
  margin: 0;
}

td.col-actions .inline-action button {
  margin-left: 4px;
  vertical-align: middle;
}

.button-link-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  white-space: nowrap;
  line-height: 1.2;
}

/* Keep horizontal scrollbar always easy to reach/see on scrollable tables */
.table-wrap.has-h-scroll {
  overflow-x: auto;
  overflow-y: auto;
  padding-bottom: 2px;
}

.table-wrap.has-h-scroll::-webkit-scrollbar {
  height: 12px;
  width: 10px;
}

.table-wrap.has-h-scroll::-webkit-scrollbar-thumb {
  background: #64748b;
  border-radius: 999px;
  border: 2px solid #f1f5f9;
}

table.clickable-rows tbody tr.company-row {
  cursor: pointer;
  transition: background 140ms ease;
}

table.clickable-rows tbody tr.company-row:hover,
table.clickable-rows tbody tr.company-row:focus {
  background: #f8fafc;
  outline: none;
}

tr.clickable-row {
  cursor: pointer;
  transition: background 140ms ease;
}

tr.clickable-row:hover,
tr.clickable-row:focus {
  background: #f8fafc;
  outline: none;
}

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

.detail-grid > div {
  min-width: 0;
}

.detail-grid dt {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-grid dd {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  word-break: break-word;
}

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

.detail-pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.45;
}

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

th:has(.select-all),
td:has(.row-check) {
  width: 44px;
  text-align: center;
  vertical-align: middle;
}

.select-all,
.row-check {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(260px, 1fr));
}

.form-grid label,
.location-field,
.map-search-controls > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.86rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: 2fr repeat(6, 1fr) auto;
  gap: 8px;
}

.filter-grid.all-data-filters {
  grid-template-columns: 1.6fr 1fr 1fr 140px auto;
}

.all-data-import {
  gap: 10px;
}

.all-data-import input[type="file"] {
  max-width: 420px;
  position: relative;
  z-index: 2;
  pointer-events: auto;
  cursor: pointer;
}

.all-data-export-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.all-data-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.all-data-export-actions .primary {
  min-height: 30px;
  padding: 5px 10px;
  font-size: 0.8rem;
}

.all-data-export-hint {
  font-size: 0.75rem;
  flex: 1 1 220px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0 14px;
}

.pager-bottom {
  margin-top: 14px;
}

.pager-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pager-links a,
.pager-current,
.pager-gap {
  min-width: 36px;
  text-align: center;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.86rem;
}

.pager-links a:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}

.pager-current {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pager-gap {
  border: none;
  background: transparent;
  min-width: auto;
  padding: 7px 2px;
}

.app-page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(248, 250, 252, 0.88);
  backdrop-filter: blur(3px);
}

.app-page-loader p {
  margin: 0;
  font-weight: 600;
  color: var(--brand-deep);
}

.app-page-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(13, 107, 88, 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: app-page-spin 0.8s linear infinite;
}

body.app-is-loading main {
  pointer-events: none;
}

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

.all-data-panel {
  position: relative;
  min-height: 220px;
}

.table-loader {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(2px);
  border-radius: inherit;
}

.table-loader p {
  margin: 0;
  font-weight: 600;
  color: var(--brand-deep);
}

.table-wrap.is-loading > table {
  opacity: 0.45;
  pointer-events: none;
}

.all-data-panel.is-loading .table-wrap {
  opacity: 0.45;
  pointer-events: none;
}

.all-data-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(248, 250, 252, 0.82);
  backdrop-filter: blur(2px);
  border-radius: 12px;
}

.all-data-loading p {
  margin: 0;
  font-weight: 600;
  color: var(--brand-deep);
}

.all-data-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(13, 107, 88, 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: app-page-spin 0.8s linear infinite;
}

.pager-btn {
  min-width: 36px;
  text-align: center;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}

.pager-btn:hover {
  border-color: var(--brand);
  color: var(--brand-deep);
}

.hidden {
  display: none !important;
}

.import-progress {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
}

.import-progress-bar-bg {
  height: 12px;
  background: rgba(13, 107, 88, 0.10);
  border-radius: 999px;
  overflow: hidden;
}

.import-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 200ms ease;
}

input, textarea, select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(13, 107, 88, 0.22);
  border-color: var(--brand);
}

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

.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.provider-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.provider-card:hover {
  border-color: #8fbfae;
  transform: translateY(-1px);
}

.provider-card span {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 14px;
  font-weight: 600;
}

.flash.success { background: #e4f7ec; color: var(--success); }
.flash.error { background: #ffe2df; color: #8a1c12; }
.flash.warning { background: #fff1c9; color: var(--warning); }

.status {
  padding: 3px 8px;
  border-radius: 8px;
  background: #e2e8f0;
  font-size: 0.78rem;
}

.status.pending,
.status.captured { background: #fff0c2; }
.status.research-manual-research { background: #d7e8ff; }
.status.research-batch-run { background: #e8e0ff; }
.status.research-capture { background: #dff4f1; }
.status.approved,
.status.transferred { background: #d9f5df; }
.status.rejected { background: #ffe0dc; }
.status.status-valid { background: #d9f5df; color: #166534; }
.status.status-invalid { background: #ffe0dc; color: #991b1b; }

.email-status { padding: 2px 8px; border-radius: 8px; font-size: 0.78rem; }
.email-status.is-valid { background: #d9f5df; color: #166534; }
.email-status.is-invalid { background: #ffe0dc; color: #991b1b; }
.email-status.is-unverified { background: #f1f5f9; color: #64748b; }
.email-status.is-none { background: #f1f5f9; color: #94a3b8; }
.email-status.is-other { background: #fff0c2; color: #92400e; }

.empty {
  text-align: center;
  padding: 28px;
  color: var(--muted);
}

.mini-form {
  display: grid;
  gap: 6px;
  min-width: 330px;
}

.map-search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 14px;
  margin: 18px 0 8px;
}

.map-search-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.location-row,
.radius-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.location-row input { flex: 1; }
.radius-row input[type=range] { flex: 1; }
.radius-row input[type=number] { width: 88px; }

#search-map {
  min-height: 360px;
  height: 440px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #e2e8f0;
}

.map-hint {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  font-weight: 500;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.section-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.search-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.hero-btn-light {
  background: #fff !important;
  color: #084438 !important;
  border-color: #fff !important;
}

.hero-btn-ghost {
  background: transparent !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.35) !important;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); opacity: 0.7; }
  to { transform: translate(-40px, -28px) scale(1.08); opacity: 1; }
}

@media (max-width: 1100px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    z-index: 20;
    transform: translateX(-105%);
    transition: transform 200ms ease;
  }
  .sidebar.open { transform: translateX(0); }
  .app-shell.sidebar-collapsed .brand-text,
  .app-shell.sidebar-collapsed .nav-label {
    display: grid;
  }
  .app-shell.sidebar-collapsed .side-nav a {
    font-size: 0.92rem;
    line-height: 1.45;
    padding: 10px 12px;
    text-align: left;
  }
  .app-shell.sidebar-collapsed .side-nav a::before {
    content: none;
  }
  .sidebar-collapse { display: none; }
  .nav-toggle { display: inline-flex; }
  .topbar, main { padding-left: 18px; padding-right: 18px; }
  .table-wrap {
    max-height: calc(100vh - 320px);
    max-height: calc(100dvh - 320px);
    min-height: 140px;
  }
  table {
    min-width: 720px;
    width: max-content;
  }
  table.table-compact {
    min-width: 720px;
  }
  th, td {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
  .form-grid,
  .form-grid.two,
  .filter-grid,
  .map-search-panel {
    grid-template-columns: 1fr;
  }
  .page-title {
    align-items: stretch;
    flex-direction: column;
  }
  #search-map { height: 320px; }
}

@media (max-width: 700px) {
  .table-wrap {
    max-height: calc(100dvh - 300px);
  }
  table,
  table.table-compact {
    min-width: 680px;
    width: max-content;
  }
  th {
    font-size: 0.7rem;
    letter-spacing: 0.02em;
  }
  td.col-actions,
  th.col-actions {
    width: 72px;
    min-width: 72px;
  }
  td.col-providers {
    max-width: 140px;
  }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(13, 107, 88, 0.08);
  color: var(--brand-deep);
  font-size: 0.92rem;
  font-weight: 600;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(420px, 100%);
  position: relative;
  z-index: 1;
  animation: rise 420ms ease both;
}

.auth-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(10px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--brand-deep);
}

.auth-brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.auth-panel h1 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.7rem;
  letter-spacing: -0.03em;
}

.auth-copy {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--brand-deep);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 48px;
}

button.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  line-height: 0;
  flex: none;
}

button.password-toggle:hover {
  background: rgba(13, 107, 88, 0.08);
  color: var(--brand-deep);
  transform: translateY(-50%);
}

button.password-toggle:focus-visible {
  outline: 2px solid rgba(13, 107, 88, 0.28);
  outline-offset: 1px;
}

button.password-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  display: block;
  flex-shrink: 0;
}

button.password-toggle .icon-hide {
  display: none;
}

button.password-toggle.is-visible .icon-show {
  display: none;
}

button.password-toggle.is-visible .icon-hide {
  display: inline;
}

.auth-form > button,
.auth-form button.primary {
  margin-top: 4px;
  width: 100%;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(10, 30, 24, 0.45);
  overflow: auto;
}

.modal-backdrop.is-open {
  display: grid;
}

.modal-panel {
  width: min(860px, 100%);
  max-height: min(92vh, 960px);
  overflow: auto;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  margin: auto;
}

.modal-head,
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-foot {
  border-bottom: 0;
  border-top: 1px solid var(--line);
  align-items: center;
  flex-wrap: wrap;
}

.modal-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.modal-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.modal-body {
  padding: 16px 18px;
  display: grid;
  gap: 12px;
}

.modal-body .hint,
.modal-foot .hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.manual-fields {
  display: grid;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

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

.manual-fields label,
.manual-field-grid label {
  display: grid;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.manual-fields input,
.manual-fields textarea,
.manual-field-grid input {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

@media (max-width: 700px) {
  .manual-field-grid {
    grid-template-columns: 1fr;
  }
}

.linkedin-run-form label {
  display: block;
  margin-bottom: 10px;
}

.linkedin-run-form textarea {
  width: 100%;
  min-height: 120px;
}

.linkedin-run-form code {
  font-size: 0.85em;
}

.linkedin-advanced {
  margin: 8px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.02);
}

.linkedin-advanced.is-open {
  display: block;
}

.linkedin-advanced h4 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.linkedin-advanced summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 8px;
}

.linkedin-advanced textarea {
  min-height: 90px;
}

.linkedin-run-form .check-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-weight: 500;
}

.linkedin-run-form .check-inline input {
  width: auto;
  margin: 0;
}

.mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0;
  cursor: pointer;
}

.mode-tab input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-tab span {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  font-size: 0.92rem;
}

.mode-tab input:checked + span {
  border-color: var(--accent, #1f6feb);
  background: rgba(31, 111, 235, 0.08);
  color: var(--accent, #1f6feb);
}

.email-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.email-status.is-valid {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}

.email-status.is-invalid {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}

.email-status.is-unverified,
.email-status.is-other {
  background: rgba(202, 138, 4, 0.14);
  color: #a16207;
}

.email-status.is-none {
  background: rgba(0, 0, 0, 0.06);
  color: #64748b;
}

.src-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}

.src-badge.src-verified {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.src-badge.src-pending {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.28);
}

.detail-grid dd.is-pending,
.review-fields-grid dd.is-pending {
  background: rgba(217, 119, 6, 0.08);
  border-radius: 6px;
  padding: 4px 8px;
}

.status-chip-pending {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}

table.is-pending-table {
  outline: 1px solid rgba(217, 119, 6, 0.35);
  border-radius: 8px;
}

.save-as-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
}

.save-as-name input {
  min-width: 220px;
  max-width: 280px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-weight: 500;
}

.enrich-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #475569;
  white-space: nowrap;
}

.enrich-toggle input {
  margin: 0;
}

#review-table tr.group-head td {
  background: rgba(37, 99, 235, 0.06);
  border-top: 2px solid rgba(37, 99, 235, 0.18);
  font-size: 0.92rem;
  padding-top: 10px;
  padding-bottom: 10px;
}

#review-table tr.group-head a {
  text-decoration: none;
}

#review-table tr.group-head:hover td {
  background: rgba(37, 99, 235, 0.1);
  cursor: pointer;
}

#review-table tr.field-row .field-indent {
  opacity: 0.5;
  margin-right: 4px;
}

#review-table td.proposal-detail {
  font-size: 0.86rem;
  padding-left: 14px;
}

#review-table .pv-field {
  color: #1e293b;
}

#review-table .pv-field::after {
  content: ":";
  margin-right: 4px;
}

#review-table .pv-current {
  color: #94a3b8;
  text-decoration: line-through;
}

#review-table .pv-arrow {
  color: #64748b;
  margin: 0 4px;
}

#review-table .pv-proposed {
  color: #15803d;
  font-weight: 600;
}

#review-table .pv-approved {
  color: #1d4ed8;
  font-weight: 500;
}

#review-table .pv-meta {
  color: #64748b;
  margin-left: 8px;
  white-space: nowrap;
}

#review-table tr.company-row:hover td {
  background: rgba(37, 99, 235, 0.05);
  cursor: pointer;
}

#review-table tr.company-row.is-active td {
  background: rgba(37, 99, 235, 0.1);
}

#review-table .group-sub {
  font-size: 0.75rem;
}

.search-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: calc(100dvh - 120px);
}

.search-page .search-run-panel {
  flex: 0 0 auto;
  margin-bottom: 8px;
}

.search-run-details {
  border: none;
}

.search-run-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  list-style: none;
  cursor: pointer;
  padding: 4px 2px 12px;
  margin: 0 0 4px;
  border-bottom: 1px solid var(--line);
}

.search-run-details > summary::-webkit-details-marker {
  display: none;
}

.search-run-details > summary::before {
  content: "?";
  display: inline-block;
  margin-right: 8px;
  color: var(--brand);
  font-weight: 700;
  transition: transform 140ms ease;
}

.search-run-details[open] > summary::before {
  transform: rotate(90deg);
}

.search-run-summary-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.search-results-form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.search-results-form .toolbar {
  flex: 0 0 auto;
}

.search-results-count {
  margin-left: auto;
  font-size: 0.82rem;
}

.search-results-table {
  flex: 1 1 auto;
  min-height: 360px;
  max-height: calc(100dvh - 240px);
}

.search-results-table td.wrap-cell {
  max-width: 240px;
  min-width: 120px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  vertical-align: top;
  line-height: 1.35;
}

.search-results-table th {
  white-space: nowrap;
}

.search-results-table th.col-select {
  white-space: nowrap;
  min-width: 72px;
}

.search-results-table th.col-select span {
  margin-left: 4px;
  font-weight: 600;
}

.people-cell {
  white-space: pre-line;
}

@media (max-width: 900px) {
  .search-results-table {
    min-height: 280px;
    max-height: calc(100dvh - 280px);
  }

  .search-results-count {
    margin-left: 0;
    width: 100%;
  }
}

#review-table td.wrap-cell,
#review-table td.about-cell {
  max-width: 260px;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  color: #475569;
  vertical-align: top;
}

#review-table .pv-proposed {
  color: #15803d;
  font-weight: 600;
}

button:disabled,
button.ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

#review-table tbody tr {
  cursor: pointer;
}

#review-table tbody tr.is-active {
  background: rgba(13, 107, 88, 0.08);
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  vertical-align: middle;
}

.badge-lead {
  background: rgba(13, 107, 88, 0.12);
  color: #0f5c4c;
}

/* ---- Company profile professional layout ---- */
.profile-subline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.status-chip,
.rating-chip {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 999px;
  background: rgba(13, 107, 88, 0.08);
  color: var(--muted);
}

.rating-chip {
  background: rgba(214, 158, 46, 0.16);
  color: #8a6d1b;
}

.callout-missing {
  border-left: 3px solid #d69e2e;
}

.completeness-bar {
  position: relative;
  margin-top: 10px;
  height: 18px;
  width: min(420px, 100%);
  background: rgba(13, 107, 88, 0.10);
  border-radius: 999px;
  overflow: hidden;
}

.completeness-fill {
  height: 100%;
  background: linear-gradient(90deg, #0d6b58, #e8910f);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.completeness-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #084438;
}

.inline-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.inline-tool input[type="number"] {
  width: 64px;
  padding: 4px 8px;
}

.link-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.link-chip {
  display: inline-block;
  max-width: 100%;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  background: rgba(13, 107, 88, 0.08);
  color: #0f5c4c;
  border: 1px solid rgba(13, 107, 88, 0.15);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.link-chip:hover {
  background: rgba(13, 107, 88, 0.16);
}

.link-chip.is-static {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

