:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #1f2933;
  --muted: #7b8794;
  --brand: #075e54;
  --brand-2: #25d366;
  --border: #e4e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: #d64545; font-size: 13px; min-height: 18px; margin-top: 4px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--card); width: 360px; max-width: 100%; padding: 32px; border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.brand { font-size: 22px; font-weight: 700; color: var(--brand); }
.login-card label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; margin-top: 6px; }
.login-card input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; color: var(--ink); }
.login-card button { margin-top: 10px; background: var(--brand); color: #fff; border: none; padding: 11px; border-radius: 8px; font-size: 15px; cursor: pointer; }
.login-card button:hover { background: #064d45; }

/* Topbar */
.topbar { background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 20px; }
.clinic-name { font-weight: 600; font-size: 17px; }
.logo-img { height: 28px; width: 28px; object-fit: contain; border-radius: 6px; background: #fff; }
.tabs { display: flex; gap: 4px; margin-left: 18px; }
.tab { background: transparent; color: #cdebe4; border: none; padding: 6px 12px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.tab.active { background: rgba(255,255,255,.18); color: #fff; }
.tab:hover { color: #fff; }

/* Forms */
/* overflow-y + min-height:0 let a modal's form scroll internally (mirrors
   .transcript below) instead of being clipped by .modal-card's max-height —
   only kicks in when the form is actually taller than the modal allows. */
.form { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; max-width: 480px; overflow-y: auto; min-height: 0; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; resize: vertical; }
.form button { background: var(--brand); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.form button:hover { background: #064d45; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; }
.form.inline input { flex: 1; min-width: 160px; }
.form-actions { display: flex; align-items: center; gap: 12px; }
.btn-remove { background: none; border: 1px solid var(--border); color: #d64545; border-radius: 6px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.btn-edit { background: none; border: 1px solid var(--border); color: var(--brand); border-radius: 6px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; margin-right: 6px; }
.btn-edit:hover { background: #eef7f5; }
.btn-primary { background: var(--brand); color: #fff; border: none; border-radius: 8px; padding: 8px 14px; font-size: 13.5px; cursor: pointer; }
.btn-primary:hover { background: #064d45; }
.btn-remove:hover { background: #fdecec; }
.btn-suggest { align-self: flex-start; background: #f3eefc; color: #6b3fa0; border: 1px solid #ddc9f2; border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; margin-top: -4px; }
.btn-suggest:hover { background: #ecdffb; }

/* Working hours */
.day-tabs { display: flex; gap: 6px; padding: 0 18px 14px; flex-wrap: wrap; }
.day-tab { background: var(--bg); color: var(--ink); border: 1px solid var(--border); padding: 7px 14px; border-radius: 8px; font-size: 13px; cursor: pointer; position: relative; }
.day-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.day-tab.is-closed:not(.active)::after { content: ''; position: absolute; top: 5px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #d64545; }
.day-editor-label { font-weight: 600; font-size: 15px; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px !important; font-size: 14px !important; color: var(--ink) !important; }
.checkbox-row input { width: auto; padding: 0; }

#pricingBody input { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
#pricingForm button { background: var(--brand); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
#pricingForm button:hover { background: #064d45; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-right .muted { color: #cdebe4; }
.btn-ghost { background: rgba(255,255,255,.15); color: #fff; border: none; border-radius: 6px; padding: 7px 12px; font-size: 13px; cursor: pointer; }
.btn-ghost:hover { background: rgba(255,255,255,.28); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }

/* Stat cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.card { background: var(--card); border-radius: 10px; padding: 18px; box-shadow: var(--shadow); }
.card .num { font-size: 28px; font-weight: 700; }
.card .label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.card-clickable { cursor: pointer; transition: transform .1s ease, box-shadow .1s ease; }
.card-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.12); }

/* Panel + table */
.panel { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 10px; }
.panel-head h2 { font-size: 16px; }
.filters { display: flex; gap: 8px; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.filters input { width: 240px; max-width: 50vw; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
tbody tr:hover { background: #fafbfc; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

select.status { border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px; font-size: 12.5px; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef; color: #556; white-space: nowrap; }
.badge-confirmed { background: #e3f6ec; color: #1c7a45; }
.badge-pending { background: #fdf2dd; color: #92660c; }
.badge-source { background: #eef0fb; color: #4a4fa0; }
.notes-btn { background: none; border: 1px dashed var(--border); border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; color: var(--muted); }
.notes-btn.has-notes { border-style: solid; color: var(--ink); }
.stars { color: #f5a623; letter-spacing: 1px; }

.btn-export { background: var(--brand-2); color: #fff; border: none; border-radius: 8px; padding: 8px 12px; font-size: 13px; text-decoration: none; display: inline-flex; align-items: center; }
.btn-export:hover { background: #1db855; }

.insights { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
@media (max-width: 760px) { .insights { grid-template-columns: 1fr; } }
.hint { padding: 0 18px 8px; }
.qlist { list-style: none; padding: 8px 0 14px; }
.qlist li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.qlist li:last-child { border-bottom: none; }
.qlist .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.qlist .empty-row { color: var(--muted); justify-content: center; }

.view-link { background: none; border: none; color: var(--brand); font-weight: 600; font-size: 13.5px; cursor: pointer; padding: 0; text-align: left; }
.view-link:hover { text-decoration: underline; }

/* Calendar */
.cal-toolbar { flex-wrap: wrap; gap: 12px; }
.cal-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cal-modes { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-mode-btn { background: var(--card); border: none; padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--muted); }
.cal-mode-btn + .cal-mode-btn { border-left: 1px solid var(--border); }
.cal-mode-btn.active { background: var(--brand); color: #fff; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-btn { background: var(--bg); border: 1px solid var(--border); color: var(--ink); border-radius: 6px; padding: 6px 11px; font-size: 13px; cursor: pointer; }
.cal-btn:hover { background: #eef0f2; }
.cal-nav-btn { padding: 6px 12px; }
.cal-label { font-weight: 600; font-size: 14.5px; color: var(--ink); }

.cal-wrap { overflow-x: auto; padding: 0 0 4px; }
.cal-grid { display: grid; min-width: 600px; }
.cal-grid.mode-day { grid-template-columns: 64px 1fr; }
.cal-grid.mode-week { grid-template-columns: 64px repeat(7, 1fr); }

.cal-corner { border-bottom: 1px solid var(--border); }
.cal-head-cell { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-head-cell.is-today { color: var(--brand); }

.cal-time-cell { padding: 6px 8px; font-size: 11.5px; color: var(--muted); text-align: right; border-top: 1px solid var(--border); white-space: nowrap; }
.cal-slot-cell { border-top: 1px solid var(--border); border-left: 1px solid var(--border); min-height: 52px; padding: 3px; }
.cal-slot-cell.is-today-col { background: #f7fbfa; }

.cal-chip { background: var(--brand); color: #fff; border-radius: 5px; padding: 3px 6px; font-size: 11.5px; line-height: 1.3; margin-bottom: 3px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip:hover { filter: brightness(1.1); }
.cal-chip.status-cancelled { background: #eceff1; color: var(--muted); text-decoration: line-through; }
.cal-chip.status-confirmed { background: #1c7a45; }
.cal-chip-time { font-weight: 600; margin-right: 4px; }

.cal-empty-hint { grid-column: 1 / -1; padding: 30px; text-align: center; color: var(--muted); font-size: 13px; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: var(--card); width: 460px; max-width: 100%; max-height: 85vh; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head .btn-ghost { background: #eef0f2; color: var(--ink); }
.modal-meta { padding: 8px 18px; font-size: 12.5px; text-transform: capitalize; border-bottom: 1px solid var(--border); }
.transcript { padding: 14px 18px; overflow-y: auto; background: #efeae2; display: flex; flex-direction: column; gap: 8px; }
.t-row { display: flex; }
.t-row.user { justify-content: flex-end; }
.t-row.bot { justify-content: flex-start; }
.t-bubble { max-width: 80%; padding: 8px 11px; border-radius: 8px; font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.t-row.user .t-bubble { background: #d9fdd3; border-top-right-radius: 2px; }
.t-row.bot .t-bubble { background: #fff; border-top-left-radius: 2px; }

/* Onboarding wizard */
.onboarding-nav { background: var(--brand-2); }
.onboarding-nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 24px; flex-wrap: wrap; color: #06331e; }
.onboarding-title { font-weight: 700; font-size: 14.5px; }
.onboarding-step-label { font-size: 13px; opacity: .85; }
.onboarding-nav-actions { display: flex; gap: 8px; margin-left: auto; }
.onboarding-nav-actions .btn-ghost { background: rgba(255,255,255,.35); color: #06331e; }
.onboarding-nav-actions .btn-ghost:hover { background: rgba(255,255,255,.5); }
.onboarding-nav-actions .btn-ghost:disabled { opacity: .5; cursor: default; }
.onboarding-preview-block { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.onboarding-preview-block:last-child { border-bottom: none; }
.onboarding-preview-block h3 { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.onboarding-preview-text { font-family: inherit; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
