:root {
  --primary: #71378d;
  --primary-dark: #3e1753;
  --accent: #71378d;
  --background: #050319;
  --surface: #ffffff;
  --foreground: #ffffff;
  --muted: #d7cce0;
  --border: #d9d9d9;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(8, 145, 178, 0.12);
  color-scheme: light;
  font-family: "Jost", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--foreground);
  background: var(--background);
}

body.admin-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 20%, rgba(113, 55, 141, .42), transparent 34%),
    linear-gradient(135deg, rgba(5, 3, 25, .96), rgba(62, 23, 83, .84));
}

a { color: inherit; }

button, input, select, textarea {
  font: inherit;
}

.admin-link,
button {
  min-height: 44px;
  border: 1px solid #111;
  border-radius: 30px;
  background: var(--primary);
  color: #fff;
  padding: 0 22px;
  cursor: pointer;
  font-weight: 600;
}

button:hover { background: var(--primary-dark); }
button:disabled { cursor: not-allowed; opacity: .65; }
button.secondary { background: #e8f1f6; color: var(--foreground); }
button.danger { background: var(--danger); }

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero {
  position: relative;
  min-height: 500px;
  padding: 150px 20px 80px;
  background:
    radial-gradient(circle at 82% 28%, rgba(113, 55, 141, .42), transparent 28%),
    radial-gradient(circle at 22% 62%, rgba(255, 255, 255, .09), transparent 24%),
    linear-gradient(135deg, #12071f 0%, #050319 58%, #1c0b2d 100%);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  gap: 32px;
}

.hero-copy {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.brand-logo {
  width: min(300px, 80vw);
  height: auto;
}

.hero-divider {
  width: 96px;
  height: 4px;
  border-radius: 999px;
  background: #71378d;
}

.hero h1 {
  color: #ffffff;
  font-size: clamp(2rem, 5vw, 48px);
  font-weight: 700;
  line-height: 1.32;
}

.country-hero {
  width: min(455px, 100%);
  justify-self: center;
}

.subtle-admin {
  position: absolute;
  top: 20px;
  right: 20px;
  border-color: rgba(255,255,255,.35);
  background: rgba(5,3,25,.45);
  color: #fff;
  opacity: .75;
}

.directory-shell {
  max-width: none;
  padding: 80px 20px;
  background: #050319;
}

.search-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
  gap: 14px;
  align-items: end;
  max-width: 1200px;
  margin: 0 auto 34px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  background: rgba(255,255,255,.04);
}

.search-panel label {
  color: #ffffff;
}

.search-panel input,
.search-panel select {
  background: #ffffff;
  color: #172033;
  border-radius: 8px;
}

.search-panel input::placeholder {
  color: #64748b;
}

.directory-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 42px;
  max-width: 1200px;
  margin: 0 auto;
}

.mobile-filters {
  display: none;
}

.state-panel {
  position: sticky;
  top: 20px;
  align-self: start;
  max-height: min(680px, calc(100vh - 40px));
  overflow: hidden;
}

.state-panel h2 {
  margin: 0 0 18px;
  color: #ffffff;
  font-size: 24px;
  font-weight: 700;
}

.state-list {
  display: grid;
  gap: 0;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-color: #71378d transparent;
}

.state-select {
  display: none;
  margin-bottom: 12px;
}

.state-button {
  width: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  padding: 20px;
  text-align: left;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
}

.state-button:hover,
.state-button.active {
  background: #71378d;
}

.advanced-filters {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.advanced-filters input,
.advanced-filters select {
  color: #fff;
  background: #71378d;
  border: 0;
  border-radius: 30px;
  font-size: 18px;
}

.advanced-filters input::placeholder {
  color: #fff;
}

.prescriber-list {
  display: grid;
  gap: 0;
  justify-items: stretch;
}

.prescriber-card {
  width: 100%;
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 20px 0;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.prescriber-card h2 {
  margin: 0;
  color: #ffffff;
  font-size: 32px;
  font-weight: 700;
  line-height: 42px;
  text-decoration: none;
}

.prescriber-photo {
  width: min(180px, 100%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
}

.field-group {
  display: grid;
  justify-items: start;
  gap: 0;
  max-width: 100%;
}

.field-group h3 {
  margin: 0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 400;
  line-height: 22px;
  text-decoration: none;
}

.field-group p {
  margin: 0;
  color: #ffffff;
  font-size: 20px;
  font-weight: 400;
  line-height: 28px;
  overflow-wrap: anywhere;
}

.field-group.long-text {
  max-width: 720px;
  margin-top: 0;
}

.field-group.long-text p {
  line-height: 1.55;
}

.price {
  color: #111;
  font-weight: 700;
}

.contact-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 24px;
}

.site-header.compact { padding-bottom: 12px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}

h1, h2 { margin: 0; line-height: 1.1; }
h1 { font-size: clamp(2rem, 5vw, 4rem); }
h2 { font-size: 1.35rem; }

.lede {
  max-width: 650px;
  margin: 14px 0 0;
  font-size: 1.1rem;
  color: var(--muted);
}

.admin-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 16px;
  text-decoration: none;
  font-weight: 700;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.filters, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 220px 110px auto;
  gap: 14px;
  align-items: end;
  padding: 16px;
  margin-bottom: 22px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--foreground);
  font-weight: 700;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 15px;
  background: #71378d;
  color: #ffffff;
  padding: 10px 14px;
  font-weight: 600;
}

select option {
  color: #111;
  background: #fff;
}

input::placeholder {
  color: rgba(255,255,255,.92);
}

textarea { resize: vertical; }

.status {
  min-height: 24px;
  color: #ffffff;
  margin: 0 0 20px;
  text-align: left;
  font-size: 16px;
  font-weight: 600;
}

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

.professional-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.professional-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e8f1f6;
}

.card-body { padding: 16px; }
.card-body h2 { margin-bottom: 8px; }
.meta { color: var(--muted); font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip { border-radius: 999px; background: #cffafe; color: #155e75; padding: 4px 10px; font-size: .85rem; font-weight: 800; }

.admin-layout { max-width: 1180px; }
.admin-page .admin-layout {
  min-height: 100vh;
  display: grid;
  align-items: center;
}

.admin-login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px 0;
}

.login-card {
  width: min(100%, 430px);
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  color: #1f1230;
  box-shadow: 0 24px 80px rgba(0,0,0,.32);
}

.login-brand {
  display: grid;
  gap: 8px;
  margin-bottom: 6px;
}

.login-brand .eyebrow {
  color: var(--primary);
}

.login-brand h1 {
  color: #1f1230;
  font-size: 2rem;
}

.login-brand p {
  margin: 0;
  color: #5f526c;
}

.login-card label {
  color: #1f1230;
}

.login-card input {
  background: #f6f1f8;
  border: 1px solid #d8c8e1;
  color: #1f1230;
}

.login-card .status {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
}

.public-link {
  color: var(--primary);
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.panel { padding: 18px; margin-bottom: 18px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.toolbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid .inline { display: flex; align-items: center; gap: 8px; }
.form-grid .inline input { width: auto; }
.form-actions { display: flex; gap: 10px; }
.editor { border-top: 1px solid var(--border); padding-top: 16px; margin-bottom: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
td.actions { white-space: nowrap; }

body.admin-page {
  color: #172033;
  background: #f4f6f8;
}

body.admin-page.admin-dark {
  color: #e5e7eb;
  background: #111827;
}

body.admin-page.admin-light {
  color: #172033;
  background: #f4f6f8;
}

.admin-page .admin-layout {
  padding-top: 32px;
}

.admin-page .panel {
  background: #ffffff;
  border: 1px solid #d9dee7;
  color: #172033;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .08);
}

.admin-page.admin-dark .panel {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
  box-shadow: 0 16px 42px rgba(0,0,0,.28);
}

.admin-page h2,
.admin-page label,
.admin-page td,
.admin-page th {
  color: #172033;
}

.admin-page.admin-dark h2,
.admin-page.admin-dark label,
.admin-page.admin-dark td,
.admin-page.admin-dark th {
  color: #e5e7eb;
}

.admin-page .muted {
  color: #64748b;
}

.admin-page.admin-dark .muted {
  color: #9ca3af;
}

.admin-page input,
.admin-page select,
.admin-page textarea {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #172033;
  border-radius: 8px;
  font-weight: 500;
}

.admin-page.admin-dark input,
.admin-page.admin-dark select,
.admin-page.admin-dark textarea {
  background: #111827;
  border-color: #4b5563;
  color: #f9fafb;
}

.admin-page input[readonly] {
  background: #f8fafc;
  color: #475569;
}

.admin-page.admin-dark input[readonly] {
  background: #172033;
  color: #d1d5db;
}

.admin-page input::placeholder {
  color: #94a3b8;
}

.admin-page button {
  border: 1px solid #243044;
  border-radius: 8px;
  background: #243044;
  color: #ffffff;
}

.admin-page button:hover {
  background: #111827;
}

.admin-page button.secondary {
  border-color: #cbd5e1;
  background: #ffffff;
  color: #172033;
}

.admin-page button.danger {
  border-color: #b91c1c;
  background: #b91c1c;
}

.admin-page .status {
  color: #334155;
}

.admin-page table {
  background: #ffffff;
}

.admin-page.admin-dark table {
  background: #1f2937;
}

.admin-page th {
  background: #f8fafc;
  border-bottom-color: #d9dee7;
  color: #475569;
}

.admin-page.admin-dark th {
  background: #111827;
  border-bottom-color: #374151;
  color: #d1d5db;
}

.admin-page td {
  border-bottom-color: #e5e7eb;
}

.admin-page.admin-dark td {
  border-bottom-color: #374151;
}

.image-preview-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.image-preview {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #d9dee7;
  background: #f8fafc;
}

.admin-page.admin-dark .image-preview {
  border-color: #4b5563;
  background: #111827;
}

@media (max-width: 820px) {
  .hero {
    min-height: auto;
    padding: 150px 14px 48px;
  }
  .hero-inner {
    grid-template-columns: 1fr;
  }
  .hero-copy {
    justify-items: center;
    text-align: center;
  }
  .hero h1 {
    font-size: 32px;
    line-height: 42px;
  }
  .country-hero {
    width: min(80%, 360px);
  }
  .directory-shell {
    padding: 48px 14px;
  }
  .search-panel {
    grid-template-columns: 1fr;
    margin-bottom: 24px;
  }
  .directory-layout {
    grid-template-columns: 1fr;
  }
  .state-panel {
    position: static;
    max-height: 260px;
    overflow: hidden;
  }
  .state-select {
    display: block;
  }
  .state-list {
    max-height: 190px;
  }
  .site-header { flex-direction: column; }
  .filters, .professional-grid, .form-grid { grid-template-columns: 1fr; }
  .subtle-admin { position: static; justify-self: end; }
  .toolbar { align-items: flex-start; flex-direction: column; }
}
