:root {
  --background: #f4f7fa;
  --foreground: #17212b;
  --card: #ffffff;
  --muted: #eef2f6;
  --muted-foreground: #647180;
  --border: #d7e0e7;
  --card-foreground: #17212b;
  --primary: #000000;
  --primary-foreground: #ffffff;
  --input: #cbd5df;
  --ring: #000000;
  --green: #15803d;
  --amber: #b45309;
  --red: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--foreground);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select { font: inherit; }
button:not(:disabled), select { cursor: pointer; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; min-height: 3.75rem; padding: .75rem 1.5rem; border-bottom: 1px solid var(--border); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.brand, .top-actions, .company-identity, .company-meta, .legend { display: flex; align-items: center; }
.brand { gap: .65rem; font-weight: 700; }
.brand-mark { display: grid; width: 1.8rem; height: 1.8rem; place-items: center; }
.brand-mark img { display: block; width: 1.65rem; height: 1.65rem; }
.section-label { margin-left: .25rem; padding-left: .9rem; border-left: 1px solid var(--border); color: var(--muted-foreground); font-size: .82rem; font-weight: 550; }
.top-actions { gap: .6rem; }
.button { display: inline-flex; height: 2rem; align-items: center; justify-content: center; gap: .5rem; border: 1px solid var(--border); border-radius: .375rem; padding: 0 .625rem; font-size: .75rem; font-weight: 500; transition: color 150ms ease, background-color 150ms ease; }
.button.primary { border-color: var(--primary); color: white; background: var(--primary); }
.button.secondary { color: var(--foreground); background: white; }
.button:hover { background: var(--muted); }
.button:disabled { cursor: not-allowed; opacity: .45; }
.action-icon { width: 1rem; height: 1rem; object-fit: contain; }

.access-error { max-width: 760px; margin: 0 auto; padding: 6rem 2rem; }
.access-error-card { border: 1px solid var(--border); border-radius: .8rem; padding: 2.25rem; background: var(--card); box-shadow: 0 8px 30px rgba(23,33,43,.08); }
.access-error-card h1 { margin-top: .45rem; }
.access-error-card p:last-child { margin: 0; color: var(--muted-foreground); line-height: 1.55; }

main { max-width: 1520px; margin: 0 auto; padding: 1.5rem 1.5rem 5rem; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.eyebrow, .filter-label { color: var(--muted-foreground); font-size: .65rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
h1 { max-width: 760px; margin: .4rem 0 .25rem; font-size: 1.125rem; font-weight: 600; line-height: 1.75rem; letter-spacing: 0; }
.lede { margin: 0; color: var(--muted-foreground); font-size: .875rem; line-height: 1.25rem; }

.workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.filters { position: sticky; top: 5rem; border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; color: var(--card-foreground); background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.search-label { display: block; margin-bottom: .35rem; color: var(--muted-foreground); font-size: .7rem; font-weight: 650; }
.search { width: 100%; height: 2.25rem; border: 1px solid var(--input); border-radius: .375rem; padding: 0 .75rem; color: var(--foreground); background: var(--background); font-size: .875rem; outline: none; }
.search:focus { border-color: #64748b; box-shadow: 0 0 0 3px rgba(100,116,139,.12); }
.filter-group { margin-top: 1.2rem; }
.filter-label { margin: 0 0 .45rem .35rem; }
.check { display: flex; gap: .5rem; padding: .375rem .25rem; color: #526170; font-size: .75rem; }
.count-check { align-items: center; justify-content: space-between; border-radius: .4rem; }
.count-check:hover { background: var(--muted); }
.count-check > span:first-child { display: flex; align-items: center; gap: .35rem; }
.filter-count { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }

.results { min-width: 0; }
.results-header { display: flex; justify-content: space-between; padding: .2rem .1rem .65rem; font-size: .76rem; font-weight: 650; }
.muted { color: var(--muted-foreground); font-weight: 450; }
.legend { gap: .9rem; color: var(--muted-foreground); font-size: .7rem; font-weight: 500; }
.company-list { display: grid; gap: .8rem; }
.company-card { overflow: hidden; border: 1px solid var(--border); border-radius: .75rem; color: var(--card-foreground); background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.company-header { display: flex; align-items: center; justify-content: space-between; min-height: 4.25rem; padding: .7rem .9rem; }
.company-identity { min-width: 0; gap: .7rem; }
.company-icon { display: grid; flex: 0 0 auto; width: 2.15rem; height: 2.15rem; place-items: center; border: 1px solid var(--border); border-radius: .45rem; color: #475569; background: white; font-size: .72rem; font-weight: 750; }
.company-header h2 { margin: 0; font-size: .875rem; font-weight: 600; line-height: 1.25rem; }
.domain { display: block; margin-top: .14rem; color: var(--muted-foreground); font-size: .69rem; text-decoration: none; }
.domain:hover { text-decoration: underline; }
.company-meta { gap: .35rem; }
.pill { display: inline-flex; align-items: center; min-height: 1.5rem; border: 1px solid var(--border); border-radius: 999px; padding: .125rem .5rem; color: var(--muted-foreground); background: var(--muted); font-size: .75rem; font-weight: 500; white-space: nowrap; }
.provider-rosters { display: flex; align-items: center; gap: .45rem; min-height: 2.2rem; padding: .4rem .9rem; border-top: 1px solid var(--border); background: #fbfcfd; color: var(--muted-foreground); font-size: .68rem; }
.provider-rosters-label { margin-right: .15rem; font-size: .62rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.provider-roster { border-left: 1px solid var(--border); padding-left: .55rem; white-space: nowrap; }
.provider-roster strong { color: #4c5967; }
.contact-table-wrap { overflow-x: auto; }
.contact-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.contact-table th { height: 2.5rem; border-bottom: 1px solid var(--border); padding: 0 .75rem; color: var(--muted-foreground); font-size: .7rem; font-weight: 650; letter-spacing: .04em; text-align: left; text-transform: uppercase; vertical-align: middle; }
.contact-table th:first-child { width: 22%; }
.contact-table th:nth-child(2) { width: 31%; }
.contact-table th:nth-child(3) { width: 27%; }
.contact-table th:nth-child(4) { width: 20%; }
.contact-table td { border-bottom: 1px solid var(--border); padding: .65rem .75rem; vertical-align: middle; font-size: .82rem; line-height: 1.3; overflow-wrap: break-word; }
.contact-table tbody tr:last-child td { border-bottom: 0; }
.contact-table tbody tr:hover { background: color-mix(in srgb, var(--muted) 58%, transparent); }
.contact-table .available-row { color: #596675; background: #f8fafc; }
.contact-table .available-row td { border-bottom-color: #e4e9ee; }
.contact-table .first-available-row td { border-top: 1px dashed #aeb9c4; }
.contact-table .available-row .contact-name { color: #4f5d6b; font-weight: 550; }
.contact-table .available-row .contact-email { color: #7a8794; }
.contact-name { display: block; color: var(--foreground); font-weight: 650; text-decoration: none; }
.contact-name:hover { text-decoration: underline; }
.role-title { display: block; line-height: 1.35; }
.contact-email { color: var(--muted-foreground); font-size: .75rem; text-decoration: none; overflow-wrap: anywhere; }
.contact-email:hover { color: var(--foreground); text-decoration: underline; }
.stage-detail { display: block; margin-top: .2rem; color: var(--muted-foreground); font-size: .75rem; line-height: 1.25; }
.stage { display: inline-flex; align-items: center; min-height: 1.5rem; border: 1px solid var(--border); border-radius: 999px; padding: .125rem .5rem; font-size: .75rem; font-weight: 500; }
.stage-primary { color: #253241; background: #e7edf2; }
.stage-secondary { border: 1px solid #c5ced7; color: #667381; background: transparent; }
.empty-state { border: 1px dashed var(--border); border-radius: .7rem; padding: 3rem; color: var(--muted-foreground); background: white; text-align: center; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: 1fr; }
  .filters { position: static; display: grid; grid-template-columns: minmax(180px,1fr) 1fr 1fr; gap: .8rem; }
  .filter-group { margin-top: 0; }
}

@media (max-width: 680px) {
  .topbar { height: auto; align-items: flex-start; gap: .8rem; padding: .75rem 1rem; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  main { padding: 1.25rem 1rem 4rem; }
  .intro { align-items: stretch; flex-direction: column; }
  .filters { display: block; }
  .filter-group { margin-top: 1rem; }
  .company-header { align-items: flex-start; flex-direction: column; gap: .65rem; }
  .contact-table { min-width: 850px; }
}
