:root {
  --teal-900: #072E33; --teal-800: #0A3A40; --teal-700: #0E4D55; --teal-600: #13636C; --teal-100: #D9ECEA; --teal-50: #EEF6F5;
  --gold: #E9A23B; --gold-50: #FDF3E3; --gold-700: #9A6212;
  --bg: #F5F2EC; --card: #fff; --ink: #10262B; --muted: #5F6E71; --line: #E7E1D6; --line2: #F0EBE2;
  --green: #067647; --green-50: #ECFDF3; --red: #B42318; --red-50: #FEF3F2; --blue: #1D4ED8; --blue-50: #EFF4FF; --gray-50: #F4F4F2;
  --serif: 'Fraunces', Georgia, serif; --sans: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --shadow: 0 1px 2px rgba(16, 38, 43, .05), 0 8px 24px -12px rgba(16, 38, 43, .12);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--teal-700); }
button { font-family: inherit; }
[hidden] { display: none !important; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { position: relative; background: var(--teal-800) url('https://images.unsplash.com/photo-1577897113292-3b95936e5206?w=1400&q=70&auto=format&fit=crop') center/cover; }
.auth-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(7, 46, 51, .55), rgba(7, 46, 51, .92)); }
.auth-art div { position: absolute; left: 48px; right: 48px; bottom: 56px; color: #fff; z-index: 1; }
.auth-art h2 { font-family: var(--serif); font-weight: 600; font-size: 34px; line-height: 1.15; margin: 0 0 10px; }
.auth-art p { color: rgba(255, 255, 255, .8); font-size: 16px; margin: 0; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; }
.auth-form form { width: 100%; max-width: 380px; }
.auth-form h1 { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 18px 0 6px; }
.auth-form .sub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--teal-900); color: rgba(255, 255, 255, .78); padding: 22px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 16px; padding: 0 10px 22px; text-decoration: none; }
.brand svg { width: 28px; height: 28px; color: #fff; flex: none; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: rgba(255, 255, 255, .55); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none; font-weight: 600; cursor: pointer; border: 0; background: none; font-size: 14px; text-align: left; width: 100%; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.on { background: rgba(233, 162, 59, .16); color: #fff; }
.nav-item.on .ic { color: var(--gold); }
.nav-item .ic { width: 20px; text-align: center; font-size: 16px; }
.nav-item .count { margin-left: auto; background: var(--gold); color: var(--teal-900); font-size: 11px; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, .1); padding: 14px 10px 0; font-size: 12px; }
.side-foot a { color: rgba(255, 255, 255, .85); }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 22px 32px 0; flex-wrap: wrap; }
.top h1 { font-family: var(--serif); font-weight: 600; font-size: 28px; margin: 0; }
.top .sp { flex: 1; }
.content { padding: 20px 32px 60px; }
.mob-bar { display: none; }

/* elements */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 14px; border-radius: 10px; font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #CFC7B8; background: #FCFBF8; }
.btn.primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.btn.primary:hover { background: var(--teal-600); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--teal-900); }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--line2); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line2); }
.card-h h3 { margin: 0; font-size: 15px; }
.card-h .sp { flex: 1; }
.card-b { padding: 16px 18px; }
.muted { color: var(--muted); }
.banner { display: flex; align-items: center; gap: 12px; background: var(--gold-50); border: 1px solid #F3D9AE; color: var(--gold-700); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-weight: 600; }
.banner .btn { margin-left: auto; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 18px; }
.kpi .l { color: var(--muted); font-weight: 600; font-size: 13px; }
.kpi .v { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1.1; margin: 6px 0 2px; }
.kpi .s { font-size: 12px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 18px; }

.chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; padding-top: 10px; }
.chart .bar { flex: 1; background: var(--teal-100); border-radius: 4px 4px 0 0; position: relative; min-height: 3px; transition: background .15s; }
.chart .bar.has { background: var(--teal-600); }
.chart .bar:hover { background: var(--gold); }
.chart .bar:hover::after { content: attr(data-t); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }
.chart-x { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.goalbars { display: grid; gap: 10px; }
.goalbar .row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.goalbar .track { height: 8px; background: var(--gray-50); border-radius: 8px; overflow: hidden; }
.goalbar .fill { height: 100%; background: linear-gradient(90deg, var(--teal-600), var(--gold)); border-radius: 8px; }

.list-appt { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line2); cursor: pointer; }
.list-appt:last-child { border-bottom: 0; }
.list-appt:hover { background: #FCFBF8; }
.when-box { flex: none; width: 58px; text-align: center; background: var(--teal-50); border-radius: 10px; padding: 6px 0; }
.when-box b { display: block; font-size: 18px; line-height: 1.1; color: var(--teal-700); }
.when-box small { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.list-appt .who { flex: 1; min-width: 0; }
.list-appt .who b { display: block; }
.list-appt .who span { color: var(--muted); font-size: 13px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.booked { background: var(--blue-50); color: var(--blue); }
.pill.completed, .pill.sent { background: var(--green-50); color: var(--green); }
.pill.no_show, .pill.failed { background: var(--red-50); color: var(--red); }
.pill.cancelled, .pill.skipped { background: var(--gray-50); color: #6B7280; }
.pill.pending { background: var(--gold-50); color: var(--gold-700); }
.pill.test { background: #F4EBFF; color: #6941C6; }

/* toolbar + table */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.tabs button { border: 0; background: none; padding: 7px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; color: var(--muted); cursor: pointer; }
.tabs button.on { background: var(--teal-700); color: #fff; }
.search { flex: 1; min-width: 180px; max-width: 340px; position: relative; }
.search input { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: 10px; font: 500 14px var(--sans); background: #fff; }
.search::before { content: '⌕'; position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--muted); font-size: 16px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FCFBF8; }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #FCFBF8; }
.tbl .nm { font-weight: 700; }
.tbl .sub { color: var(--muted); font-size: 12px; }
.goal-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.goal-tags span { background: var(--teal-50); color: var(--teal-700); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.cal-head h2 { margin: 0 8px; font-size: 18px; }
.cal { display: grid; grid-template-columns: 56px repeat(7, 1fr); background: #fff; border-radius: 16px; border: 1px solid var(--line2); box-shadow: var(--shadow); overflow: hidden; min-width: 760px; }
.cal-wrap { overflow-x: auto; }
.cal .dh { padding: 10px 6px; text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line2); background: #FCFBF8; }
.cal .dh b { display: block; font-size: 18px; }
.cal .dh small { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.cal .dh.today b { color: #fff; background: var(--teal-700); border-radius: 50%; width: 32px; height: 32px; line-height: 32px; margin: 0 auto; }
.cal .hours { position: relative; }
.cal .hr { height: 56px; font-size: 11px; color: var(--muted); text-align: right; padding: 0 8px; transform: translateY(-7px); }
.cal .col { position: relative; border-left: 1px solid var(--line2); background-image: repeating-linear-gradient(0deg, transparent 0 55px, var(--line2) 55px 56px); }
.cal .col.off { background-color: #FAF8F4; }
.ev { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 4px 7px; font-size: 12px; overflow: hidden; cursor: pointer; border-left: 3px solid var(--teal-700); background: var(--teal-50); color: var(--teal-800); line-height: 1.3; }
.ev:hover { filter: brightness(.97); box-shadow: var(--shadow); }
.ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.completed { border-color: var(--green); background: var(--green-50); color: var(--green); }
.ev.no_show { border-color: var(--red); background: var(--red-50); color: var(--red); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 1; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }

/* drawer + modal */
.scrim { position: fixed; inset: 0; background: rgba(7, 46, 51, .35); z-index: 80; opacity: 0; transition: opacity .2s; }
.scrim.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--bg); z-index: 90; box-shadow: -20px 0 60px -20px rgba(0, 0, 0, .3); transform: translateX(100%); transition: transform .28s cubic-bezier(.2, .7, .2, 1); display: flex; flex-direction: column; }
.drawer.show { transform: none; }
.drawer-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.drawer-h h2 { margin: 0; font-size: 18px; }
.drawer-h .x { margin-left: auto; border: 0; background: var(--gray-50); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 18px; }
.drawer-b { overflow-y: auto; padding: 18px 22px 40px; display: grid; gap: 14px; align-content: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.big-when { font-family: var(--serif); font-size: 22px; font-weight: 600; line-height: 1.2; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.tl li:last-child { border: 0; }
.tl .k { font-weight: 700; min-width: 0; flex: 1; }
.tl .k small { display: block; color: var(--muted); font-weight: 500; }
textarea, input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number], input[type=time], input[type=date], input[type=datetime-local], select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: 500 14px var(--sans); color: var(--ink); background: #fff; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--teal-600); box-shadow: 0 0 0 3px rgba(19, 99, 108, .12); }
.contact-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal-box { background: #fff; border-radius: 18px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .4); }
.modal-box.wide { width: min(760px, 100%); }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-h h3 { margin: 0; font-size: 16px; }
.modal-h .x { margin-left: auto; border: 0; background: var(--gray-50); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 17px; }
.modal-b { padding: 18px 20px; display: grid; gap: 12px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
iframe.preview { width: 100%; height: 70vh; border: 0; background: #EFEAE1; display: block; }

/* forms / settings */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.f label, .f > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
.f .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.set-grid { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.set-nav { position: sticky; top: 20px; display: grid; gap: 2px; }
.set-nav a { padding: 8px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 600; }
.set-nav a:hover { background: #fff; color: var(--ink); }
.set-sec { margin-bottom: 18px; scroll-margin-top: 20px; }
.set-sec .card-b { display: grid; gap: 14px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; }
.days label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 600; background: #fff; }
.days input { accent-color: var(--teal-700); }
.switch { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.switch input { width: 38px; height: 22px; appearance: none; background: #D6D2CA; border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked { background: var(--teal-600); }
.switch input:checked::after { transform: translateX(16px); }
.save-bar { position: sticky; bottom: 0; background: linear-gradient(0deg, var(--bg) 70%, transparent); padding: 16px 0 4px; display: flex; gap: 10px; justify-content: flex-end; }
.sched-demo { background: var(--teal-50); border-radius: 12px; padding: 12px 14px; font-size: 13px; }
.sched-demo ol { margin: 6px 0 0; padding-left: 18px; }
.testi-row { display: grid; grid-template-columns: 1fr 160px 160px auto; gap: 8px; align-items: start; }
.provider-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.provider-tabs label { flex: 1; min-width: 140px; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #fff; }
.provider-tabs label:has(input:checked) { border-color: var(--teal-700); background: var(--teal-50); }
.provider-tabs input { accent-color: var(--teal-700); margin-right: 6px; }
.provider-tabs small { display: block; color: var(--muted); margin-top: 3px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 200; transition: transform .3s cubic-bezier(.2, .7, .2, 1); max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
#toast.show { transform: translateX(-50%); }
#toast.err { background: var(--red); }
.err-msg { color: var(--red); font-weight: 600; font-size: 13px; }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 95; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; }
  .mob-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--teal-900); color: #fff; position: sticky; top: 0; z-index: 70; }
  .mob-bar button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
  .mob-bar b { font-size: 15px; }
  .top { padding: 16px 16px 0; }
  .top h1 { font-size: 24px; }
  .content { padding: 14px 16px 60px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .set-grid { grid-template-columns: 1fr; }
  .set-nav { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .testi-row { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}
@media (max-width: 520px) { .kpis { gap: 10px; } .kpi { padding: 14px; } .kpi .v { font-size: 28px; } .kv { grid-template-columns: 110px 1fr; } }
