/* ProxiLocal — Mobile First absolute */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: #ccfbf1;
  --open: #16a34a;
  --open-bg: #dcfce7;
  --closed: #dc2626;
  --closed-bg: #fee2e2;
  --premium: #d97706;
  --premium-bg: #fef3c7;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --radius: 16px;
  --radius-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --header-h: 56px;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
  padding-bottom: calc(72px + var(--safe-b));
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
img { max-width: 100%; display: block; }

/* ——— Header sticky ——— */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: .95rem;
  box-shadow: 0 4px 12px rgba(13,148,136,.35);
}
.loc-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 46vw;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: .78rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.loc-chip[data-state="loading"] { opacity: .7; }
.loc-chip[data-state="error"] {
  background: #fef2f2;
  color: #b91c1c;
}

/* ——— Hero / search ——— */
.hero {
  padding: 18px 16px 8px;
  background:
    radial-gradient(120% 80% at 0% 0%, #ccfbf1 0%, transparent 55%),
    radial-gradient(100% 70% at 100% 0%, #e0f2fe 0%, transparent 50%),
    var(--bg);
}
.hero h1 {
  margin: 0 0 4px;
  font-size: 1.45rem;
  line-height: 1.2;
  letter-spacing: -.03em;
}
.hero p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: .92rem;
}
.search-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 8px;
  display: grid;
  gap: 8px;
}
.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 12px;
}
.search-row input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 1rem;
  min-width: 0;
  padding: 10px 0;
}
.search-row input::placeholder { color: #94a3b8; }
.btn-icon, .btn-primary, .btn-ghost, .btn-call {
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 700;
}
.btn-icon {
  width: 44px; height: 44px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  flex-shrink: 0;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  min-height: 48px;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 600;
  font-size: .85rem;
}
.btn-call {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  min-height: 48px;
  width: 100%;
  font-size: 1rem;
}
.filters-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filters-row::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
}
.chip[aria-pressed="true"], .chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chip.open-filter[aria-pressed="true"] {
  background: var(--open);
  border-color: var(--open);
}

/* ——— Categories grid ——— */
.section {
  padding: 18px 16px 4px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
.section-head .meta {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 600;
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 6px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
  transition: transform .12s ease, border-color .12s ease;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.cat-card:active { transform: scale(.97); }
.cat-card .ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  background: color-mix(in srgb, var(--cat, var(--primary)) 14%, white);
}
.cat-card span {
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.15;
  color: #334155;
}

/* ——— Business list ——— */
.biz-list {
  display: grid;
  gap: 10px;
  padding: 4px 16px 24px;
}
.biz-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  position: relative;
}
.biz-card.premium {
  border-color: #fcd34d;
  background:
    linear-gradient(135deg, #fffbeb 0%, #ffffff 40%);
}
.biz-card-main { min-width: 0; }
.biz-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.biz-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge-open { background: var(--open-bg); color: var(--open); }
.badge-closed { background: var(--closed-bg); color: var(--closed); }
.badge-premium { background: var(--premium-bg); color: var(--premium); }
.badge-cat {
  background: #f1f5f9;
  color: #475569;
  font-weight: 700;
}
.biz-meta {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
}
.biz-meta strong { color: #334155; font-weight: 700; }
.biz-address {
  margin: 6px 0 0;
  font-size: .84rem;
  color: #475569;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.biz-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.dist {
  font-size: .78rem;
  font-weight: 800;
  color: var(--primary-dark);
  background: var(--primary-soft);
  padding: 4px 8px;
  border-radius: 999px;
}
.quick-call {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  box-shadow: 0 6px 14px rgba(13,148,136,.28);
}
.quick-call[aria-disabled="true"] {
  background: #cbd5e1;
  box-shadow: none;
  pointer-events: none;
}
.status-detail {
  margin-top: 4px;
  font-size: .78rem;
  color: var(--muted);
}

/* Empty / loading */
.state-box {
  margin: 8px 16px 24px;
  padding: 28px 18px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
}
.state-box strong { display: block; color: var(--text); margin-bottom: 4px; }
.skeleton {
  height: 110px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #e2e8f0 25%, #f8fafc 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ——— Detail page ——— */
.detail-hero {
  padding: 12px 16px 0;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: 10px;
}
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 16px;
  margin: 0 16px 16px;
}
.detail-card h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
  letter-spacing: -.03em;
}
.detail-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.detail-row:first-of-type { border-top: 0; }
.detail-ico {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.detail-row h3 {
  margin: 0 0 2px;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.detail-row p { margin: 0; font-weight: 600; }
.hours-list {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}
.hours-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  font-size: .9rem;
}
.hours-list li.today {
  font-weight: 800;
  color: var(--primary-dark);
}
.sticky-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
.sticky-cta .btn-ghost-border {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  min-height: 48px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

/* Footer minimal */
.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: .75rem;
  padding: 8px 16px 24px;
}

/* Desktop polish */
@media (min-width: 768px) {
  body { padding-bottom: 0; }
  .wrap {
    max-width: 720px;
    margin: 0 auto;
  }
  .app-header, .hero, .section, .biz-list, .detail-hero, .detail-card, .state-box {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
  .app-header { border-radius: 0 0 12px 12px; }
  .cat-grid { grid-template-columns: repeat(8, 1fr); }
  .sticky-cta {
    max-width: 720px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
  body.has-sticky-cta { padding-bottom: 88px; }
}
