:root {
  --teal: #0d9488;
  --teal-dark: #0f766e;
  --teal-soft: #ccfbf1;
  --ink: #1e3a5f;
  --muted: #5d7290;
  --bg: #f3faf8;
  --card: #ffffff;
  --line: #dcebe8;
  --amber: #b45309;
  --amber-bg: #fef3c7;
  --green: #15803d;
  --green-bg: #dcfce7;
  --red: #b91c1c;
  --red-bg: #fee2e2;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(30,58,95,.08), 0 6px 24px rgba(30,58,95,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}
a { color: var(--teal-dark); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1060px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 12px;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.logo-name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.logo-sub { font-size: 11px; color: var(--muted); margin-top: -3px; }
.topbar-links { margin-left: auto; display: flex; gap: 16px; font-size: 14px; font-weight: 500; }
.topbar-links a { color: var(--ink); padding: 6px 2px; }
.topbar-links a:hover { color: var(--teal-dark); }

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px 64px; }

.hero { padding: 44px 0 28px; text-align: center; }
.hero h1 { font-size: clamp(26px, 4.5vw, 40px); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.hero h1 span { color: var(--teal-dark); }
.hero p { margin: 12px auto 0; max-width: 560px; color: var(--muted); font-size: 16px; }
.hero-badges { margin-top: 18px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.hero-badge {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; color: var(--muted); font-weight: 500;
}

.searchbar { margin: 26px auto 0; max-width: 640px; display: flex; gap: 10px; }
.searchbar input {
  flex: 1; padding: 14px 18px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
  box-shadow: var(--shadow); outline: none;
}
.searchbar input:focus { border-color: var(--teal); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 16px 0 6px; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500;
}
.chip.active { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }

.section-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 34px 0 16px; }

.clinic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.clinic-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.clinic-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(30,58,95,.12); }
.clinic-head { display: flex; gap: 14px; align-items: flex-start; }
.clinic-emoji {
  width: 48px; height: 48px; border-radius: 12px; background: var(--teal-soft);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.clinic-name { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.clinic-area { font-size: 13px; color: var(--muted); margin-top: 2px; }
.clinic-tagline { font-size: 14px; color: var(--muted); margin: 10px 0; }
.spec-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.spec-chip { background: var(--teal-soft); color: var(--teal-dark); border-radius: 6px; padding: 3px 9px; font-size: 12px; font-weight: 600; }
.clinic-foot { display: flex; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.clinic-foot .rating { color: #b45309; font-weight: 700; }
.clinic-foot .fee { margin-left: auto; font-weight: 600; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--teal-dark); color: #fff; border: none; border-radius: 12px;
  padding: 13px 22px; font-size: 15px; font-weight: 600;
  transition: background .15s ease;
}
.btn:hover { background: var(--teal); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline { background: #fff; color: var(--teal-dark); border: 1px solid var(--teal-dark); }
.btn-outline:hover { background: var(--teal-soft); }
.btn-small { padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; }

.detail-head { display: flex; align-items: flex-start; gap: 16px; padding: 28px 0 8px; }
.detail-head .clinic-emoji { width: 60px; height: 60px; font-size: 30px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); margin-top: 20px; cursor: pointer; }
.back-link:hover { color: var(--teal-dark); }
.info-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); margin-top: 16px;
  font-size: 14px; color: var(--muted); display: grid; gap: 6px;
}
.info-card b { color: var(--ink); font-weight: 600; }

.doctor-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.doc-avatar {
  width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; flex-shrink: 0;
}
.doc-info { flex: 1; min-width: 180px; }
.doc-name { font-weight: 700; font-size: 16px; }
.doc-spec { color: var(--teal-dark); font-size: 13px; font-weight: 600; margin-top: 1px; }
.doc-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.doc-right { text-align: right; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.doc-fee { font-weight: 700; font-size: 16px; }
.doc-fee small { color: var(--muted); font-weight: 500; font-size: 12px; }

.book-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); margin-top: 20px;
}
.book-panel h3 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.step-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 22px 0 10px; }
.date-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.date-pill {
  min-width: 74px; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  padding: 9px 6px; text-align: center; font-size: 13px; flex-shrink: 0;
}
.date-pill .dow { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.date-pill .dnum { font-weight: 700; font-size: 16px; margin-top: 2px; }
.date-pill.active { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.date-pill.active .dow { color: var(--teal-soft); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.slot-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 4px; font-size: 14px; font-weight: 600; color: var(--ink);
}
.slot-btn:hover:not(:disabled) { border-color: var(--teal); }
.slot-btn.active { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.slot-btn:disabled { color: #b9cdc9; text-decoration: line-through; cursor: not-allowed; background: #f7fbfa; }
.empty-note { color: var(--muted); font-size: 14px; padding: 12px 4px; }

.form-grid { display: grid; gap: 12px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-size: 13px; font-weight: 600; color: var(--ink); }
.form-row input, .form-row textarea, .form-row select {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink); outline: none; width: 100%;
}
.form-row input:focus, .form-row textarea:focus, .form-row select:focus { border-color: var(--teal); }
.form-2col { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.form-error { color: var(--red); font-size: 14px; margin-top: 4px; display: none; }
.form-note { font-size: 12px; color: var(--muted); }

.confirm-hero { max-width: 480px; margin: 40px auto 0; text-align: center; }
.confirm-check {
  width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--green-bg); color: var(--green);
  display: flex; align-items: center; justify-content: center; font-size: 36px;
}
.wa-bubble {
  margin: 22px auto 0; max-width: 420px; text-align: left;
  background: #e7ffdb; border-radius: 14px; border-top-left-radius: 4px;
  padding: 14px 16px; box-shadow: var(--shadow); position: relative;
  font-size: 14px;
}
.wa-bubble .wa-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #075e54; margin-bottom: 8px; }
.wa-bubble .wa-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.wa-bubble .wa-row .k { color: #4b6b64; }
.wa-bubble .wa-row .v { font-weight: 600; text-align: right; }
.wa-bubble .wa-ref {
  margin-top: 10px; background: #fff; border-radius: 8px; padding: 8px 12px;
  text-align: center; font-weight: 800; font-size: 17px; letter-spacing: .06em; color: #075e54;
}
.wa-bubble .wa-time { text-align: right; font-size: 11px; color: #8aa39d; margin-top: 6px; }
.wa-caption { font-size: 12px; color: var(--muted); margin-top: 10px; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; margin-top: 26px; flex-wrap: wrap; }

.status-badge { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.status-pending { background: var(--amber-bg); color: var(--amber); }
.status-confirmed { background: var(--green-bg); color: var(--green); }
.status-cancelled { background: var(--red-bg); color: var(--red); }

.track-card { max-width: 460px; margin: 36px auto 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.track-result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 14px; }
.track-result .wa-row { display: flex; justify-content: space-between; padding: 3px 0; }
.track-result .k { color: var(--muted); }
.track-result .v { font-weight: 600; }

.footer { border-top: 1px solid var(--line); margin-top: 48px; }
.footer-inner { max-width: 1060px; margin: 0 auto; padding: 22px 20px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }
.footer-inner .right { margin-left: auto; }

/* Admin */
.admin-login { max-width: 420px; margin: 48px auto 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.admin-login h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.admin-login p { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.admin-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 24px 0 4px; }
.admin-bar h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.admin-bar .spacer { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 20px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; box-shadow: var(--shadow); min-width: 110px; }
.stat-card .num { font-size: 22px; font-weight: 800; }
.stat-card .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.booking-list { display: grid; gap: 10px; }
.booking-row {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.bk-time { font-weight: 800; font-size: 16px; min-width: 62px; }
.bk-main { flex: 1; min-width: 200px; }
.bk-name { font-weight: 700; font-size: 15px; }
.bk-sub { font-size: 13px; color: var(--muted); margin-top: 1px; }
.bk-actions { display: flex; gap: 8px; align-items: center; }

.hidden { display: none !important; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; font-size: 15px; }

@media (max-width: 560px) {
  .topbar-inner { padding: 10px 14px; }
  .wrap { padding: 0 14px 48px; }
  .searchbar { flex-direction: column; }
  .doc-right { flex-direction: row; align-items: center; width: 100%; justify-content: space-between; }
  .form-2col { grid-template-columns: 1fr; }
  .bk-time { min-width: 0; }
}

.logo-mark-img { width: 38px; height: 38px; border-radius: 9px; }
.hero-lockup { height: 116px; width: auto; margin: 0 auto 20px; display: block; }

.date-row { scrollbar-width: thin; scrollbar-color: #bcd8d3 transparent; }
.date-row::-webkit-scrollbar { height: 5px; }
.date-row::-webkit-scrollbar-thumb { background: #bcd8d3; border-radius: 3px; }
.date-row::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 560px) {
  .topbar-inner { gap: 8px; }
  .logo { gap: 8px; }
  .logo-mark-img { width: 30px; height: 30px; border-radius: 7px; }
  .logo-name { font-size: 15px; white-space: nowrap; }
  .logo-sub { font-size: 10px; margin-top: -2px; }
  .topbar-links { gap: 12px; font-size: 13px; white-space: nowrap; }
  .hero-lockup { height: 92px; }
}

.clinic-foot { flex-wrap: wrap; row-gap: 4px; }
.clinic-foot .rating { white-space: nowrap; }
.clinic-foot .fee { white-space: nowrap; }
