/* Genetidoc Appointments. Same palette and building blocks as the other Genetidoc tools.
   Patient pages are mobile-first (most patients book on a phone); team pages are desktop-first and work on a tablet. */
:root {
  --blue: #3E3E7E; --blue-d: #2e2e63; --blue-l: #eceefc; --blue-m: #c9cdf6; --accent: #5E6CE6;
  --pink: #E84E85; --pink-l: #fdeaf1; --cream: #FFF3E8; --mist: #F7F9FC;
  --ink: #232a3d; --ink-2: #35405B; --ink-3: #7b8794; --line: #e3e8ee; --bg: #f5f7fb; --card: #fff;
  --green: #1b8a5a; --green-l: #e5f5ed; --red: #c62828; --red-l: #fdecec; --amber: #9a5b00; --amber-l: #fff4e0;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
h1, h2, h3 { color: var(--blue); }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 0 0 8px; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; white-space: nowrap; text-decoration: none; color: var(--ink); }
.btn:hover { background: #f0f2f8; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: #4b58d0; }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eef1f7; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.btn.block { width: 100%; }
.input, select.input, textarea.input { width: 100%; border: 1px solid #d3d9e4; border-radius: 8px; padding: 9px 11px; background: #fff; outline: none; }
textarea.input { resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--blue-l); }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-weight: 500; margin-bottom: 4px; font-size: 13px; color: var(--ink-2); }
label.field > span .req { color: var(--pink); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; cursor: pointer; }
.check input { margin-top: 4px; flex: none; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.error { color: var(--red); font-size: 13px; min-height: 18px; margin: 6px 0; }
.ok-msg { color: var(--green); font-size: 13px; }

/* notes / banners */
.note { border-radius: 10px; padding: 10px 14px; margin: 10px 0; font-size: 13.5px; }
.note.amber { background: var(--amber-l); color: #6b4300; border: 1px solid #f3d9a8; }
.note.blue { background: var(--blue-l); color: var(--blue-d); border: 1px solid var(--blue-m); }
.note.green { background: var(--green-l); color: #135f3e; border: 1px solid #bfe5d1; }
.note.red { background: var(--red-l); color: var(--red); border: 1px solid #f5c2c2; }

/* chips / badges */
.chip { display: inline-block; background: var(--blue-l); color: var(--blue); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 500; margin: 2px 4px 2px 0; }
.chip.pink { background: var(--pink-l); color: #b8325f; }
.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.requested { background: var(--amber-l); color: var(--amber); }
.badge.confirmed { background: var(--green-l); color: var(--green); }
.badge.completed { background: var(--blue-l); color: var(--blue); }
.badge.no_show { background: #f1f1f4; color: #555; }
.badge.cancelled { background: var(--red-l); color: var(--red); }
.badge.paid { background: var(--green-l); color: var(--green); }
.badge.unpaid { background: #f1f1f4; color: #666; }

.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--blue-l); flex: none; display: grid; place-items: center; color: var(--blue); font-weight: 700; font-size: 22px; }
.avatar.lg { width: 110px; height: 110px; font-size: 32px; }
.avatar.sm { width: 40px; height: 40px; font-size: 14px; }

/* ===================================================== PATIENT PAGES */
.pub-top { background: #fff; border-bottom: 1px solid var(--line); }
.pub-top .inner { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.pub-top img { height: 34px; }
.pub-top .call { margin-left: auto; font-size: 13px; color: var(--ink-2); text-decoration: none; }
.pub-wrap { max-width: 1120px; margin: 0 auto; padding: 18px 16px 60px; }
.hero { background: linear-gradient(150deg, var(--blue-l) 0%, var(--cream) 100%); border-radius: 16px; padding: 26px 22px; margin-bottom: 18px; }
.hero h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; }
.hero p { margin: 0; color: var(--ink-2); }
.hero .facts { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.doc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.doc-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.doc-card .name { font-weight: 700; color: var(--blue); font-size: 16px; line-height: 1.25; }
.doc-card .quals { font-size: 12.5px; color: var(--ink-2); }
.doc-card .meta { font-size: 12.5px; color: var(--ink-3); }
.doc-card .actions { margin-top: auto; display: flex; gap: 8px; }
.doc-card .actions .btn { flex: 1; }
.doc-card.any { background: linear-gradient(150deg, #fff 0%, var(--blue-l) 100%); border-color: var(--blue-m); }
.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; }

.book-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.book-layout > * { min-width: 0; }
.profile-card .avatar { margin: 0 auto; }
.profile-card { position: sticky; top: 14px; }
.profile-card .name { font-size: 19px; font-weight: 700; color: var(--blue); margin-top: 10px; line-height: 1.25; }
.profile-card ul { padding-left: 18px; margin: 6px 0; color: var(--ink-2); font-size: 13px; }
.step { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-no { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.step.locked { opacity: .55; }
.step.locked .step-body { display: none; }
.step .done-line { font-size: 13px; color: var(--ink-2); }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-opt { border: 2px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; background: #fff; text-align: left; }
.type-opt:hover { border-color: var(--blue-m); }
.type-opt.sel { border-color: var(--blue); background: var(--blue-l); }
.type-opt .t-name { font-weight: 700; color: var(--blue); }
.type-opt .t-fee { font-size: 20px; font-weight: 700; margin: 4px 0; }
.type-opt .t-desc { font-size: 12.5px; color: var(--ink-2); }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x mandatory; }
.day { flex: none; width: 64px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 4px; text-align: center; background: #fff; cursor: pointer; scroll-snap-align: start; }
.day .dw { font-size: 11px; color: var(--ink-3); text-transform: uppercase; }
.day .dd { font-size: 19px; font-weight: 700; line-height: 1.2; }
.day .dm { font-size: 11px; color: var(--ink-3); }
.day .dn { font-size: 10.5px; color: var(--green); margin-top: 2px; }
.day:disabled { opacity: .4; cursor: default; background: var(--mist); }
.day:disabled .dn { color: var(--ink-3); }
.day.sel { border-color: var(--blue); background: var(--blue); color: #fff; }
.day.sel .dw, .day.sel .dm, .day.sel .dn { color: #e6e8ff; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-top: 10px; }
.time { border: 1px solid var(--blue-m); background: #fff; color: var(--blue); border-radius: 8px; padding: 8px 4px; cursor: pointer; font-weight: 600; }
.time:hover { background: var(--blue-l); }
.time.sel { background: var(--blue); color: #fff; border-color: var(--blue); }
.part-label { font-size: 12px; font-weight: 600; color: var(--ink-3); margin: 12px 0 0; text-transform: uppercase; letter-spacing: .03em; }
.summary-box { background: var(--mist); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13.5px; }
.summary-box div { padding: 2px 0; }
.summary-box b { color: var(--ink-2); font-weight: 600; display: inline-block; min-width: 110px; }
.code-input { font-size: 26px; letter-spacing: .4em; text-align: center; max-width: 240px; font-weight: 700; }
.success-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--green-l); color: var(--green); display: grid; place-items: center; font-size: 30px; margin-bottom: 8px; }
.file-pick { border: 1.5px dashed var(--blue-m); border-radius: 10px; padding: 10px 12px; background: var(--mist); }
.file-pick input { width: 100%; }
.file-list { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.pub-foot { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 30px 16px 40px; }

@media (max-width: 820px) {
  .book-layout { grid-template-columns: minmax(0, 1fr); }
  .profile-card { position: static; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .types, .grid2, .grid3 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 20px; }
  .pub-top .call span { display: none; }
  .doc-grid { grid-template-columns: 1fr; }
}

/* ===================================================== TEAM PAGES */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, var(--blue-l) 0%, var(--cream) 100%); padding: 16px; }
.login-card { width: 400px; max-width: 100%; background: #fff; border-radius: 14px; padding: 30px; box-shadow: 0 10px 40px rgba(62,62,126,.14); }
.login-card img { height: 44px; }
.tabs { display: flex; gap: 4px; background: var(--mist); border-radius: 10px; padding: 4px; margin: 16px 0; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 7px; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--ink-2); }
.tabs button.on { background: #fff; color: var(--blue); box-shadow: var(--shadow); }

.topbar { min-height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; padding: 6px 18px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.topbar .logo { height: 30px; margin-right: 10px; }
.topbar .spacer { flex: 1; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; }
.nav a { padding: 7px 11px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: #f0f2f8; }
.nav a.active { background: var(--blue-l); color: var(--blue); }
.nav .count { background: var(--pink); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; }
.page { max-width: 1240px; margin: 0 auto; padding: 20px 20px 60px; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { font-size: 22px; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; text-align: left; }
.stat .n { font-size: 24px; font-weight: 700; color: var(--blue); }
.stat .l { font-size: 12.5px; color: var(--ink-3); }
.stat.warn .n { color: var(--amber); }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.seg button.on { background: var(--blue); color: #fff; }
table.list { width: 100%; border-collapse: collapse; background: #fff; }
table.list th { text-align: left; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); background: var(--mist); white-space: nowrap; }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #fafbff; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
.detail-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; align-items: start; }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--ink-3); font-size: 13px; }
dl.kv dd { margin: 0; word-break: break-word; }
.history { font-size: 12.5px; color: var(--ink-2); }
.history div { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; margin: 8px 0; }
.slot-grid button { border: 1px solid var(--blue-m); background: #fff; border-radius: 7px; padding: 5px 2px; cursor: pointer; color: var(--blue); font-weight: 600; font-size: 13px; }
.slot-grid button.sel { background: var(--blue); color: #fff; }
.modal-back { position: fixed; inset: 0; background: rgba(20,24,40,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 640px; max-width: 100%; max-height: 92vh; overflow: auto; padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: 880px; }
.modal h2 { margin-bottom: 12px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.hours-row { display: grid; grid-template-columns: 90px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hours-row .ranges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.range { display: inline-flex; align-items: center; gap: 4px; background: var(--mist); border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px; }
.range input { border: 1px solid #d3d9e4; border-radius: 6px; padding: 3px 4px; width: 124px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 80; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.err { background: var(--red); }
.guide { background: var(--blue-l); border: 1px solid var(--blue-m); border-radius: 10px; padding: 10px 14px; font-size: 13px; color: var(--blue-d); margin-bottom: 14px; }
.guide ol { margin: 4px 0 0; padding-left: 20px; }
.link-box { display: flex; gap: 6px; }
.link-box input { flex: 1; font-size: 12.5px; }
@media (max-width: 960px) {
  .detail-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
