@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;600;700&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  --primary: #0891B2;
  --primary-dark: #0E7490;
  --primary-deep: #164E63;
  --primary-soft: #E0F5FA;
  --cta: #059669;
  --cta-dark: #047857;
  --cta-soft: #E3F5EE;
  --bg: #F4FBFD;
  --surface: #FFFFFF;
  --text: #164E63;
  --muted: #4B7285;
  --line: #D6E9F0;
  --warn: #B45309;
  --warn-soft: #FDF0E1;
  --danger: #B91C1C;
  --danger-soft: #FDECEC;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(22,78,99,.08), 0 4px 16px rgba(22,78,99,.07);
  --font-head: 'Lexend', 'Segoe UI', 'Nirmala UI', system-ui, sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', 'Nirmala UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: #E4F0F5;
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(22,78,99,.12);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(120deg, var(--primary-dark), var(--primary));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.topbar .logo {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: rgba(255,255,255,.16);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.topbar .logo svg { width: 26px; height: 26px; }
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-family: var(--font-head); font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.brand span { font-size: 11.5px; opacity: .85; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lang-btn {
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  min-height: 40px;
  min-width: 52px;
  padding: 4px 10px;
  border-radius: 10px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.lang-btn:hover { background: rgba(255,255,255,.28); }

main {
  flex: 1;
  padding: 18px 16px calc(28px + env(safe-area-inset-bottom, 0px));
}

h1, h2, h3 { font-family: var(--font-head); margin: 0 0 6px; color: var(--primary-deep); }
h1 { font-size: 26px; line-height: 1.25; }
h2 { font-size: 21px; }
h3 { font-size: 17.5px; }
p { margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 15px; }
.en { color: var(--muted); font-size: 13px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

/* My Clinics live card */
.clinic-card {
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.clinic-card:hover { border-color: var(--primary); box-shadow: 0 4px 18px rgba(8,145,178,.18); }
.clinic-card .cc-body { flex: 1; min-width: 0; }
.clinic-card .cc-name { font-family: var(--font-head); font-weight: 600; font-size: 17px; }
.clinic-card .cc-meta { font-size: 13.5px; color: var(--muted); }
.clinic-card .cc-live {
  flex: 0 0 auto;
  text-align: center;
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 8px 14px;
  min-width: 74px;
}
.clinic-card .cc-live b { font-family: var(--font-head); font-size: 30px; color: var(--primary-dark); display: block; line-height: 1.1; }
.clinic-card .cc-live span { font-size: 11px; color: var(--muted); }
.clinic-card.has-token .cc-live { background: var(--cta-soft); }
.clinic-card.has-token .cc-live b { color: var(--cta-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .1s;
  text-decoration: none;
  color: #fff;
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: translateY(1px); }
.btn-green { background: var(--cta); }
.btn-green:hover { background: var(--cta-dark); }
.btn-cyan { background: var(--primary); }
.btn-cyan:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--primary-dark); border: 2px solid var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-warn { background: var(--warn-soft); color: var(--warn); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--cta);
  outline-offset: 2px;
}

/* ---------- Fields ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 15px; margin-bottom: 5px; }
.field input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 11px;
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--text);
  background: var(--surface);
}
.field input:focus { border-color: var(--primary); outline: none; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 3px; }
.code-input {
  font-family: var(--font-head) !important;
  font-size: 30px !important;
  letter-spacing: 14px;
  text-align: center;
  font-weight: 700;
}

/* ---------- Token board (customer live view) ---------- */
.board {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: 18px;
  padding: 22px 18px;
  text-align: center;
  margin-bottom: 14px;
  box-shadow: 0 10px 30px rgba(8,145,178,.35);
}
.board .lbl { font-size: 14.5px; opacity: .9; letter-spacing: .5px; }
.board .num {
  font-family: var(--font-head);
  font-size: 88px;
  font-weight: 700;
  line-height: 1.05;
  margin: 2px 0;
}
.board .num.pulse { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
.board .split {
  display: flex;
  border-top: 1px solid rgba(255,255,255,.25);
  margin-top: 14px;
  padding-top: 12px;
}
.board .split > div { flex: 1; }
.board .split b { font-family: var(--font-head); font-size: 26px; display: block; }
.board .split span { font-size: 13px; opacity: .85; }

.mytoken {
  background: var(--cta);
  color: #fff;
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(5,150,105,.35);
}
.mytoken .tk { font-family: var(--font-head); font-size: 46px; font-weight: 700; line-height: 1; }
.mytoken .info { flex: 1; }
.mytoken .info b { font-size: 17px; }
.mytoken .info span { display: block; font-size: 14px; opacity: .92; }

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-weight: 600;
  display: flex;
  gap: 10px;
  align-items: center;
}
.banner svg { width: 22px; height: 22px; flex: 0 0 auto; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.banner.green { background: var(--cta-soft); color: var(--cta-dark); }
.banner.red { background: var(--danger-soft); color: var(--danger); }

/* ---------- Clinic dashboard ---------- */
.big-current { text-align: center; padding: 10px 16px 18px; }
.big-current .num {
  font-family: var(--font-head);
  font-size: 96px;
  font-weight: 700;
  color: var(--primary-deep);
  line-height: 1.05;
}
.big-current .lbl { font-size: 15px; color: var(--muted); }
.next-btn { min-height: 76px !important; font-size: 24px !important; border-radius: 16px !important; }
.stat-row { display: flex; gap: 10px; margin-bottom: 14px; }
.stat {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}
.stat b { font-family: var(--font-head); font-size: 24px; color: var(--primary-dark); display: block; }
.stat span { font-size: 12.5px; color: var(--muted); }

.qlist { max-height: 300px; overflow-y: auto; }
.q-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.q-row:last-child { border-bottom: none; }
.q-row .tk {
  min-width: 46px;
  text-align: center;
  font-family: var(--font-head);
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 4px 6px;
}
.q-row.served { opacity: .45; }
.q-row.current .tk { background: var(--cta); color: #fff; }
.q-row .via { margin-left: auto; font-size: 12.5px; color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.chip.green { background: var(--cta-soft); color: var(--cta-dark); }
.chip.red { background: var(--danger-soft); color: var(--danger); }
.chip.white { background: rgba(255,255,255,.18); color: #fff; }
.chip.grey { background: #E5EEF2; color: var(--muted); }

.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

/* ---------- Hero (illustrated gradient header) ---------- */
.hero {
  position: relative;
  border-radius: 20px;
  background: linear-gradient(140deg, #0E7490 0%, #0891B2 55%, #10B4D4 100%);
  color: #fff;
  padding: 22px 140px 22px 20px;
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(8,145,178,.35);
  min-height: 132px;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30'%3E%3Cpath d='M13 9h4v4h4v4h-4v4h-4v-4H9v-4h4z' fill='%23ffffff'/%3E%3C/svg%3E");
  opacity: .07;
}
.hero h1, .hero h2 { color: #fff; position: relative; }
.hero p { color: rgba(255,255,255,.88); position: relative; font-size: 14.5px; margin: 0; }
.hero .art { position: absolute; right: 6px; bottom: -6px; width: 126px; height: auto; }

/* ---------- Avatars (WhatsApp jaise colorful) ---------- */
.avatar {
  width: 50px; height: 50px;
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700;
  flex: 0 0 auto;
  box-shadow: inset 0 -10px 16px rgba(0,0,0,.14), 0 3px 8px rgba(22,78,99,.18);
}
.avatar.sm { width: 42px; height: 42px; font-size: 18px; border-radius: 12px; }

/* ---------- Role picker cards ---------- */
.role-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  cursor: pointer;
  border-left: 5px solid var(--primary);
  transition: transform .15s, box-shadow .2s, border-color .2s;
}
.role-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(8,145,178,.22); }
.role-card.gold { border-left-color: var(--cta); }
.role-card.deep { border-left-color: var(--primary-deep); }
.role-art { width: 62px; height: 62px; flex: 0 0 auto; }

/* ---------- Live blink dot ---------- */
.live-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #34D399;
  display: inline-block;
  animation: blink 1.4s ease infinite;
}
@keyframes blink { 50% { opacity: .3; } }

/* ---------- Richer buttons & cards ---------- */
.btn-green { background: linear-gradient(135deg, #059669, #10B981); }
.btn-green:hover { background: linear-gradient(135deg, #047857, #059669); }
.btn-cyan { background: linear-gradient(135deg, #0E7490, #0891B2); }
.btn-cyan:hover { background: linear-gradient(135deg, #0A5D74, #0E7490); }
.next-btn { box-shadow: 0 10px 26px rgba(5,150,105,.35); }
.card { transition: box-shadow .2s; }
.clinic-card:hover { transform: translateY(-2px); }
.clinic-card { transition: transform .15s, border-color .2s, box-shadow .2s; }
.empty-art { width: 150px; height: auto; margin: 0 auto 12px; display: block; }

.topbar { background: linear-gradient(120deg, #0A5D74, #0891B2 70%, #10B4D4); }

/* ---------- Logout button (professional) ---------- */
.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  min-height: 44px;
  border: 1.5px solid #EFC7C7;
  border-radius: 12px;
  background: var(--surface);
  color: var(--danger);
  font-family: var(--font-head);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
}
.btn-logout:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-logout svg { width: 18px; height: 18px; }

/* ---------- Search result option rows ---------- */
.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
  font-family: var(--font-body);
  text-align: left;
  transition: border-color .15s, background .15s;
  width: 100%;
  color: var(--text);
}
.opt:hover { border-color: var(--primary); background: var(--primary-soft); }
.opt .opt-en { display: block; font-size: 13px; color: var(--muted); }

/* ---------- Tabs (clinic dashboard) ---------- */
.tabbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
}
.tabbar button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-family: var(--font-head);
  font-size: 15.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.tabbar button.active { background: var(--primary); color: #fff; }

/* ---------- Plan cards ---------- */
.plan-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 10px;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.plan-card b { font-family: var(--font-head); font-size: 26px; color: var(--primary-dark); }
.plan-card span { font-size: 14px; color: var(--muted); }
.plan-card.sel { border-color: var(--cta); background: var(--cta-soft); }
.plan-card.sel b { color: var(--cta-dark); }

.divider { border: none; border-top: 1px solid var(--line); margin: 16px 0; }

.share-box {
  background: var(--primary-soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  word-break: break-all;
}
.share-box b { font-family: var(--font-head); }

.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--primary-deep);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 60;
  max-width: 90%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footnote { text-align: center; font-size: 13px; color: var(--muted); padding: 8px 14px 0; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty svg { width: 52px; height: 52px; color: #A8CFDD; margin-bottom: 8px; }

/* ---------- Patient register table ---------- */
table.reg { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.reg th, table.reg td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.reg th { font-size: 12.5px; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
table.reg tr.served td { color: var(--muted); }
table.reg tr.skipped td { color: var(--danger); text-decoration: line-through; }
table.reg tr.waiting td:first-child { color: var(--cta-dark); font-weight: 700; }

/* ---------- Print: sirf register chhape (PDF = Print → Save as PDF) ---------- */
#print-area { display: none; }
@media print {
  body { background: #fff; }
  .shell, .toast { display: none !important; }
  #print-area { display: block; font-family: 'Segoe UI', 'Nirmala UI', Arial, sans-serif; color: #000; padding: 6mm; }
  #print-area h1 { font-size: 20px; margin: 0 0 2px; }
  #print-area .meta { font-size: 12px; color: #333; margin-bottom: 10px; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area th, #print-area td { border: 1px solid #777; padding: 5px 7px; font-size: 12px; text-align: left; }
  #print-area th { background: #eee; }
  #print-area .foot { margin-top: 12px; font-size: 11px; color: #555; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
