/* MediBook – giao diện bệnh nhân */
.mdb-app {
	--mdb-primary: #0f766e;
	--mdb-text: #0f172a;
	--mdb-muted: #64748b;
	--mdb-line: #e2e8f0;
	--mdb-soft: #f8fafc;
	--mdb-radius: 12px;
	--mdb-danger: #dc2626;
	box-sizing: border-box;
	max-width: 760px;
	margin: 0 auto 24px;
	padding: 20px;
	background: #fff;
	border: 1px solid var(--mdb-line);
	border-radius: 16px;
	color: var(--mdb-text);
	font-size: 16px;
	line-height: 1.5;
	text-align: left;
}
.mdb-app *, .mdb-app *::before, .mdb-app *::after { box-sizing: border-box; }
.mdb-app button, .mdb-app input, .mdb-app select, .mdb-app textarea { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.mdb-loading, .mdb-cal-loading, .mdb-slots-loading { padding: 24px; text-align: center; color: var(--mdb-muted); }
.mdb-loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
.mdb-spin { width: 18px; height: 18px; border: 2px solid var(--mdb-line); border-top-color: var(--mdb-primary); border-radius: 50%; animation: mdbSpin .8s linear infinite; }
@keyframes mdbSpin { to { transform: rotate(360deg); } }
.mdb-title { margin: 0 0 12px; font-size: 1.35em; }
.mdb-muted { color: var(--mdb-muted); font-size: .93em; margin: 6px 0; }

/* Bước */
.mdb-steps { display: flex; gap: 6px; margin-bottom: 18px; overflow-x: auto; }
.mdb-step { flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--mdb-soft); color: var(--mdb-muted); font-size: .9em; white-space: nowrap; min-width: 0; }
.mdb-step-num { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #e2e8f0; font-weight: 700; font-size: .85em; }
.mdb-step.is-active { background: color-mix(in srgb, var(--mdb-primary) 10%, #fff); color: var(--mdb-primary); font-weight: 600; }
.mdb-step.is-active .mdb-step-num, .mdb-step.is-done .mdb-step-num { background: var(--mdb-primary); color: #fff; }
@media (max-width: 520px) { .mdb-step:not(.is-active) .mdb-step-label { display: none; } .mdb-step:not(.is-active) { flex: none; } }

.mdb-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.mdb-section-title { font-weight: 700; font-size: 1.08em; margin-bottom: 10px; }
.mdb-section-head .mdb-section-title { margin: 0; }
.mdb-chip { padding: 4px 12px; border-radius: 999px; background: var(--mdb-soft); font-size: .9em; }

/* Dịch vụ */
.mdb-services { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mdb-service { --mdb-svc: var(--mdb-primary); display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 16px; border: 1px solid var(--mdb-line); border-left: 4px solid var(--mdb-svc); border-radius: var(--mdb-radius); background: #fff; cursor: pointer; transition: box-shadow .15s, transform .15s; }
.mdb-service:hover, .mdb-service:focus-visible { box-shadow: 0 6px 20px rgba(15, 23, 42, .08); transform: translateY(-1px); outline: none; }
.mdb-service-name { font-weight: 700; font-size: 1.02em; }
.mdb-service-desc { color: var(--mdb-muted); font-size: .9em; }
.mdb-service-meta { display: flex; gap: 12px; color: var(--mdb-muted); font-size: .85em; margin-top: auto; }

/* Lịch + giờ */
.mdb-dtp { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(220px, 1fr); gap: 20px; }
@media (max-width: 640px) { .mdb-dtp { grid-template-columns: 1fr; } }
/* Giữ chỗ khi đang tải để phần "Kiểm tra lịch" bên dưới không bị đẩy xuống (CLS): lịch gần vuông, vùng giờ trống cao tối thiểu. */
.mdb-cal-loading { aspect-ratio: 1 / .97; display: flex; align-items: center; justify-content: center; }
.mdb-slots { min-height: 330px; }
/* Khung đặt lịch giữ chiều cao gần đúng khi chưa dựng xong để phần bên dưới không bị đẩy xuống:
   máy tính ~708px (đo ở 1350px); điện thoại ~1090px (gần như không đổi với bề rộng khung 280–420px). */
.mdb-booking:has(> .mdb-loading) { min-height: 1090px; }
@media (min-width: 641px) { .mdb-booking:has(> .mdb-loading) { min-height: 708px; } }
.mdb-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mdb-cal-title { font-weight: 700; }
.mdb-cal-nav { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--mdb-line); background: #fff; cursor: pointer; font-size: 20px; line-height: 1; padding: 0; }
.mdb-cal-nav:disabled { opacity: .35; cursor: default; }
.mdb-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mdb-cal-wd { text-align: center; font-size: .78em; color: var(--mdb-muted); padding: 4px 0; font-weight: 600; }
.mdb-cal-day { position: relative; aspect-ratio: 1 / 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.mdb-cal-day.is-free { background: var(--mdb-soft); font-weight: 600; }
.mdb-cal-day.is-free:hover { background: color-mix(in srgb, var(--mdb-primary) 12%, #fff); }
.mdb-cal-day.is-off { color: #cbd5e1; cursor: default; }
.mdb-cal-day.is-today .mdb-cal-num { text-decoration: underline; text-underline-offset: 3px; }
.mdb-cal-day.is-selected { background: var(--mdb-primary) !important; color: #fff; }
.mdb-cal-dot { position: absolute; bottom: 5px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--mdb-primary); }
.mdb-cal-day.is-selected .mdb-cal-dot { background: #fff; }
.mdb-slots-title { font-weight: 700; margin-bottom: 10px; }
.mdb-slot-group { margin-bottom: 12px; }
.mdb-slot-group-label { font-size: .82em; color: var(--mdb-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.mdb-slot-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.mdb-slot { padding: 10px 4px; border: 1px solid var(--mdb-line); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.mdb-slot:hover { border-color: var(--mdb-primary); color: var(--mdb-primary); }
.mdb-slot.is-selected { background: var(--mdb-primary); border-color: var(--mdb-primary); color: #fff; }
.mdb-slot.is-full { background: var(--mdb-soft); color: #94a3b8; cursor: not-allowed; text-decoration: line-through; }
.mdb-slot small { font-size: .7em; font-weight: 400; text-decoration: none; }

/* Biểu mẫu */
.mdb-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 12px 14px; border-radius: var(--mdb-radius); background: color-mix(in srgb, var(--mdb-primary) 8%, #fff); margin-bottom: 16px; }
.mdb-summary .mdb-link { margin-left: auto; }
.mdb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.mdb-field { grid-column: span 2; min-width: 0; }
.mdb-field.mdb-w-half { grid-column: span 1; }
@media (max-width: 560px) { .mdb-grid { grid-template-columns: 1fr; } .mdb-field, .mdb-field.mdb-w-half { grid-column: span 1; } }
.mdb-label { display: block; font-weight: 600; font-size: .93em; margin-bottom: 5px; }
.mdb-req { color: var(--mdb-danger); }
.mdb-app input[type=text], .mdb-app input[type=tel], .mdb-app input[type=email], .mdb-app input[type=number], .mdb-app input[type=date], .mdb-app select, .mdb-app textarea {
	width: 100%; max-width: 100%; padding: 11px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; font-size: 16px; line-height: 1.4; box-shadow: none; margin: 0;
}
.mdb-app input:focus, .mdb-app select:focus, .mdb-app textarea:focus { outline: none; border-color: var(--mdb-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mdb-primary) 20%, transparent); }
.mdb-field-heading { font-weight: 700; font-size: 1.02em; padding-top: 6px; border-top: 1px solid var(--mdb-line); }
.mdb-help { font-size: .84em; color: var(--mdb-muted); margin-top: 4px; }
.mdb-error { font-size: .85em; color: var(--mdb-danger); margin-top: 4px; min-height: 0; }
.mdb-field.has-error input, .mdb-field.has-error select, .mdb-field.has-error textarea { border-color: var(--mdb-danger); }
.mdb-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.mdb-choice { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid #cbd5e1; border-radius: 999px; cursor: pointer; font-size: .95em; }
.mdb-choice input { margin: 0; accent-color: var(--mdb-primary); }
.mdb-choice:has(input:checked) { border-color: var(--mdb-primary); background: color-mix(in srgb, var(--mdb-primary) 8%, #fff); }
.mdb-consent { display: flex; gap: 10px; align-items: flex-start; font-size: .93em; cursor: pointer; }
.mdb-consent input { margin-top: 4px; width: 18px; height: 18px; flex: none; accent-color: var(--mdb-primary); }
.mdb-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* Nút */
.mdb-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.mdb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 20px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none !important; line-height: 1.2; transition: filter .15s, background .15s; }
.mdb-btn:disabled { opacity: .5; cursor: not-allowed; }
.mdb-btn-primary { background: var(--mdb-primary); color: #fff !important; }
.mdb-btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.mdb-btn-ghost { background: #fff; border-color: var(--mdb-line); color: var(--mdb-text) !important; }
.mdb-btn-ghost:hover { border-color: var(--mdb-primary); }
.mdb-btn-danger { background: var(--mdb-danger); color: #fff !important; }
.mdb-btn-danger-ghost { background: #fff; border-color: #fecaca; color: var(--mdb-danger) !important; }
.mdb-btn-link, .mdb-link { background: none; border: 0; color: var(--mdb-primary); cursor: pointer; padding: 6px 4px; font-weight: 600; text-decoration: none; }
.mdb-btn-block { width: 100%; }
@media (max-width: 560px) { .mdb-actions .mdb-btn { flex: 1; } }

/* Thông báo */
.mdb-notice { padding: 12px 14px; border-radius: 10px; margin: 10px 0; font-size: .94em; }
.mdb-notice-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.mdb-notice-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.mdb-notice-info { background: #f8fafc; color: #334155; border: 1px solid var(--mdb-line); }

/* Hoàn tất + phiếu hẹn */
.mdb-done { text-align: center; padding: 8px 0; }
.mdb-done h3 { margin: 10px 0 4px; font-size: 1.3em; }
.mdb-done-icon { width: 60px; height: 60px; margin: 0 auto; border-radius: 50%; background: color-mix(in srgb, var(--mdb-primary) 12%, #fff); color: var(--mdb-primary); display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; }
.mdb-done-msg { color: var(--mdb-muted); margin: 0 0 14px; }
.mdb-ticket { text-align: left; border: 1px dashed #cbd5e1; border-radius: var(--mdb-radius); padding: 6px 16px; margin: 12px 0; background: var(--mdb-soft); }
.mdb-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--mdb-line); }
.mdb-row:last-child { border-bottom: 0; }
.mdb-row-label { color: var(--mdb-muted); }
.mdb-row-value { text-align: right; font-weight: 600; }
.mdb-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.1em; letter-spacing: .03em; }
.mdb-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }
.mdb-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .82em; font-weight: 600; background: #f1f5f9; color: #334155; }
.mdb-st-pending { background: #fef3c7; color: #92400e; }
.mdb-st-confirmed { background: #dcfce7; color: #166534; }
.mdb-st-completed { background: #dbeafe; color: #1e40af; }
.mdb-st-no_show { background: #fae8ff; color: #86198f; }
.mdb-st-cancelled { background: #fee2e2; color: #991b1b; }

/* Quản lý */
.mdb-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mdb-manage-area { margin-top: 18px; }
.mdb-manage-area:empty { display: none; }
.mdb-cancel-box { padding: 16px; border: 1px solid #fecaca; border-radius: var(--mdb-radius); background: #fffafa; }
.mdb-lookup .mdb-actions { justify-content: flex-start; }

/* Tự điền theo số điện thoại */
.mdb-prefill-msg:empty { display: none; }
.mdb-prefill-msg { color: var(--mdb-primary, #0f766e); font-weight: 600; }
.mdb-form .is-prefilled { background: #f0fdfa; }

/* Ô kiểm tra lịch đã đăng ký */
.mdb-check { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--mdb-line, #e2e8f0); }
.mdb-check-row { display: flex; gap: 8px; align-items: stretch; }
.mdb-check-row input { flex: 1 1 auto; min-width: 0; }
.mdb-check-row .mdb-btn { flex: 0 0 auto; }
.mdb-check-result { margin-top: 12px; }
.mdb-check-item { margin-bottom: 10px; }
