:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --primary-soft: #f0fdfa;
  --accent: #059669;
  --accent-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0f766e, #059669);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
}
.brand-title { font-weight: 700; font-size: 1.08rem; letter-spacing: -0.02em; }
.brand-sub { font-size: 0.78rem; color: var(--muted); }
.top-stats { display: flex; align-items: center; gap: 14px; font-size: 0.84rem; color: var(--muted); }
.top-pill {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #a7f3d0;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
}

.hero {
  background: linear-gradient(180deg, #ffffff 0%, #f0fdfa 100%);
  border-bottom: 1px solid var(--border);
  padding: 24px 20px 18px;
}
.hero-inner {
  max-width: 1440px;
  margin: 0 auto;
}
.hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  letter-spacing: -0.025em;
}
.hero p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.96rem;
}

.search-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto auto;
  gap: 10px;
  background: var(--surface);
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.search-bar input,
.search-bar select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.93rem;
  color: var(--ink);
  background: #fff;
}
.search-bar input:focus,
.search-bar select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--border); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #047857; }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.14s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.workspace {
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 20px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
  align-items: start;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.clinic-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.clinic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.clinic-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.card-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--ink);
}
.card-local {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 2px;
}
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.76rem;
  font-weight: 600;
}
.badge-verified { background: var(--accent-soft); color: var(--accent); border: 1px solid #a7f3d0; }
.badge-partner { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.badge-tag { background: #f1f5f9; color: #334155; }
.badge-hours { background: var(--primary-soft); color: var(--primary); }
.badge-score {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.card-meta {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.card-actions {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.map-panel {
  position: sticky;
  top: 76px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
#map {
  width: 100%;
  height: calc(100vh - 150px);
  min-height: 460px;
  background: #e2e8f0;
}
.map-footer {
  padding: 8px 12px;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  max-width: 780px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f1f5f9;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.info-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.86rem;
}
.info-box strong { display: block; font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; }

.claim-banner {
  margin-top: 18px;
  background: linear-gradient(135deg, #f0fdfa, #ecfdf5);
  border: 1px solid #99f6e4;
  border-radius: 12px;
  padding: 16px;
}
.claim-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.claim-form .full { grid-column: 1 / -1; }
.claim-form input,
.claim-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
}
.claim-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.86rem;
  background: #fff;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #a7f3d0;
}
.claim-checkbox input { width: auto; margin-top: 3px; }
.claim-status-msg {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.86rem;
  display: none;
}
.claim-status-msg.ok { display: block; background: var(--accent-soft); color: #065f46; border: 1px solid #6ee7b7; }
.claim-status-msg.err { display: block; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

.nearby-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.nearby-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.82rem;
  cursor: pointer;
}
.nearby-item:hover { border-color: var(--primary); background: var(--primary-soft); }

@media (max-width: 980px) {
  .search-bar { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .map-panel { position: static; order: -1; }
  #map { height: 320px; min-height: 320px; }
  .claim-form { grid-template-columns: 1fr; }
}
