:root {
  --teal: #2a9d8f; --teal-dark: #1f7a70; --teal-deep: #155e57; --teal-soft: #e3f4f1; --teal-mist: #f2faf8;
  --bg: #f5fbfa; --card: #ffffff; --text: #1c3734; --muted: #5d7673; --line: #d9ebe8;
  --danger: #b4443c; --danger-soft: #fbeceb; --warn: #9a6b10; --warn-soft: #fff6e0; --ok: #1f7a4a;
  --radius: 18px; --radius-sm: 12px; --shadow: 0 6px 24px rgba(21, 94, 87, .08); --shadow-sm: 0 2px 8px rgba(21, 94, 87, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 68px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.5; font-size: 16px;
  min-height: 100vh; display: flex; flex-direction: column; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
body.public { padding-bottom: 0; }
img { max-width: 100%; display: block; }
a { color: var(--teal-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; color: var(--teal-deep); letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid #7fd1c6; outline-offset: 2px; }

/* topo */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; padding-top: calc(10px + env(safe-area-inset-top));
  background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--teal-deep); font-size: 1.02rem; white-space: nowrap; }
.brand strong { font-weight: 800; }
.topnav { display: none; gap: 4px; margin-left: 12px; }
.topnav a, .tabbar a { text-decoration: none; color: var(--muted); font-weight: 600; }
.topnav a { padding: 8px 14px; border-radius: 999px; }
.topnav a[aria-current="page"] { background: var(--teal-soft); color: var(--teal-deep); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tabbar { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 16px rgba(21, 94, 87, .06); }
.tabbar:empty { display: none; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: .74rem; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--teal-dark); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; display: grid; place-items: center; padding: 0 4px; }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 32px; outline: none; }
.loading { padding: 60px 0; text-align: center; color: var(--muted); }
.footer { padding: 20px 16px 28px; text-align: center; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); background: #fff; }
.footer p { margin: 0 0 4px; }

/* componentes */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 22px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .08s, background .2s, box-shadow .2s; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--teal); color: #fff; box-shadow: 0 6px 16px rgba(42, 157, 143, .28); }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: var(--teal-soft); color: var(--teal-deep); }
.btn-ghost:hover { background: #d3ede9; }
.btn-outline { background: #fff; color: var(--teal-deep); border: 1.5px solid var(--line); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: .9rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--teal-soft); color: var(--teal-deep); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.icon-btn svg { width: 22px; height: 22px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); padding: 20px; }
.card + .card { margin-top: 14px; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--teal-soft); color: var(--teal-deep); }
.pill.gray { background: #eef2f1; color: var(--muted); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; color: #9fd3cb; margin: 0 auto 8px; }
.page-head { margin-bottom: 18px; }
.page-head p { color: var(--muted); margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: 10px; }
.notice { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--teal-mist); border: 1px solid var(--line); font-size: .92rem; }
.notice.warn { background: var(--warn-soft); border-color: #f1dfb0; }
.test-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .8rem; font-weight: 600; padding: 6px 12px; }

/* formulários */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
input, select, textarea { width: 100%; font: inherit; padding: 12px 14px; min-height: 48px; border-radius: var(--radius-sm); border: 1.5px solid var(--line); background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(42, 157, 143, .18); }
.form-error { color: var(--danger); background: var(--danger-soft); border-radius: 10px; padding: 10px 12px; font-size: .9rem; margin-bottom: 12px; }
.hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.tabs { display: flex; background: var(--teal-soft); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--teal-deep); min-height: 42px; border-radius: 999px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: #fff; box-shadow: var(--shadow-sm); }

/* boas-vindas */
.hero { display: grid; gap: 22px; align-items: center; }
.hero-img { position: relative; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 3 / 2; }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-img .badge { position: absolute; left: 14px; bottom: 14px; background: rgba(255, 255, 255, .94); border-radius: 14px; padding: 10px 14px; font-size: .88rem; font-weight: 600; color: var(--teal-deep); box-shadow: var(--shadow-sm); }
.hero .eyebrow { display: inline-block; font-weight: 700; color: var(--teal-dark); background: var(--teal-soft); border-radius: 999px; padding: 4px 12px; font-size: .85rem; margin-bottom: 10px; }
.hero p.lead { font-size: 1.08rem; color: var(--muted); }
.hero .row .btn { flex: 1 1 180px; }
.features { display: grid; gap: 14px; margin-top: 30px; }
.feature { display: flex; gap: 14px; align-items: center; }
.feature img { width: 84px; height: 84px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.steps { display: grid; gap: 10px; margin-top: 26px; counter-reset: s; }
.steps li { list-style: none; display: flex; gap: 12px; align-items: center; }
.steps li::before { counter-increment: s; content: counter(s); width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.steps { padding: 0; }

/* autenticação */
.auth { max-width: 460px; margin: 0 auto; }
.auth-side { display: none; }

/* início */
.grid-home { display: grid; gap: 16px; }
.next-card { background: linear-gradient(135deg, var(--teal) 0%, #3bb3a3 100%); color: #fff; border: 0; }
.next-card h2, .next-card h3 { color: #fff; }
.next-card .when { font-size: 1.35rem; font-weight: 800; margin: 4px 0 10px; }
.next-card .btn-ghost { background: rgba(255, 255, 255, .2); color: #fff; }
.notif { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.notif:first-of-type { border-top: 0; }
.notif .ic { width: 38px; height: 38px; border-radius: 50%; background: var(--teal-soft); display: grid; place-items: center; flex-shrink: 0; font-size: 1.1rem; }
.notif.unread .t { font-weight: 800; }
.notif .t { margin: 0; }
.notif .b { margin: 0; color: var(--muted); font-size: .92rem; }
.notif time { font-size: .76rem; color: var(--muted); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick a { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: var(--radius-sm); background: var(--teal-mist); border: 1px solid var(--line); text-decoration: none; color: var(--teal-deep); font-weight: 700; }
.quick svg { width: 26px; height: 26px; color: var(--teal); }

/* serviços */
.services { display: grid; gap: 16px; }
.service { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.service img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.service .body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; }
.service .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.service .body p { color: var(--muted); flex: 1; }

/* horários */
.svc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.svc-head img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.day { scroll-snap-align: start; flex: 0 0 auto; width: 66px; padding: 10px 4px; border-radius: 16px; border: 1.5px solid var(--line); background: #fff; text-align: center; cursor: pointer; font: inherit; color: var(--text); }
.day .dw { font-size: .74rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.day .dn { font-size: 1.3rem; font-weight: 800; }
.day .dm { font-size: .72rem; color: var(--muted); }
.day[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.day[aria-pressed="true"] .dw, .day[aria-pressed="true"] .dm { color: #e9fffb; }
.day:disabled { opacity: .4; cursor: default; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; margin-top: 8px; }
.slot { border: 1.5px solid var(--line); border-radius: 14px; background: #fff; padding: 10px 6px; font: inherit; cursor: pointer; color: var(--text); text-align: center; }
.slot strong { display: block; font-size: 1.12rem; }
.slot span { font-size: .76rem; color: var(--muted); }
.slot:hover:not(:disabled) { border-color: var(--teal); background: var(--teal-mist); }
.slot:disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; }
.slot.mine { border-color: var(--teal); background: var(--teal-soft); }

/* confirmação */
.confirm { max-width: 560px; margin: 0 auto; }
.summary { padding: 0; overflow: hidden; }
.summary img { width: 100%; aspect-ratio: 21 / 9; object-fit: cover; }
.summary dl { margin: 0; padding: 18px 20px; display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; }
.summary dt { color: var(--muted); font-size: .9rem; }
.summary dd { margin: 0; font-weight: 700; }
.success { text-align: center; padding: 10px 0 4px; }
.success .check { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; animation: pop .4s ease-out; }
.success .check svg { width: 46px; height: 46px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* sessões */
.session { display: flex; gap: 14px; align-items: center; }
.session img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.session .info { flex: 1; min-width: 0; }
.session .info strong { display: block; }
.session .when { color: var(--muted); font-size: .92rem; }
.session.cancelled { opacity: .7; }

/* admin */
.admin-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.admin-bar input[type="date"] { width: auto; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; color: var(--teal-deep); }
.stat span { font-size: .8rem; color: var(--muted); }
.agenda-item { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.agenda-item:first-child { border-top: 0; }
.agenda-item .hour { font-weight: 800; font-size: 1.1rem; color: var(--teal-deep); }
.agenda-item.off { opacity: .55; }
.people { list-style: none; padding: 0; margin: 8px 0 0; }
.people li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 10px; background: var(--teal-mist); border-radius: 10px; margin-top: 6px; font-size: .92rem; }
.people li.cancel { background: #f4f4f4; color: var(--muted); text-decoration: line-through; }
.admin-grid { display: grid; gap: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.svc-edit { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.svc-edit .full { grid-column: 1 / -1; }
.svc-row { padding: 14px 0; border-top: 1px solid var(--line); }
.svc-row:first-child { border-top: 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; margin: 0; }
.switch input { width: 20px; height: 20px; min-height: 0; accent-color: var(--teal); }
details summary { cursor: pointer; font-weight: 700; color: var(--teal-dark); padding: 6px 0; }
.patient { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.patient:first-child { border-top: 0; }
.credits li { margin-bottom: 10px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--teal-deep); color: #fff;
  padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* tablet (820) */
@media (min-width: 700px) {
  main { padding: 28px 28px 40px; }
  .services { grid-template-columns: repeat(2, 1fr); }
  .features { grid-template-columns: repeat(3, 1fr); }
  .feature { flex-direction: column; align-items: flex-start; }
  .feature img { width: 100%; height: auto; aspect-ratio: 16 / 10; }
  .grid-home { grid-template-columns: 1fr 1fr; }
  .grid-home .span2 { grid-column: 1 / -1; }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .stats { grid-template-columns: repeat(3, 1fr); }
}
/* desktop */
@media (min-width: 1024px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .topnav { display: flex; }
  .topbar { padding-left: 32px; padding-right: 32px; }
  .toast { bottom: 28px; }
  .hero { grid-template-columns: 1.05fr 1fr; gap: 48px; padding: 20px 0; }
  .hero-img { aspect-ratio: 4 / 3.4; order: 2; }
  .services { grid-template-columns: repeat(3, 1fr); }
  .grid-home { grid-template-columns: 1.3fr 1fr; }
  .grid-home .span2 { grid-column: auto; }
  .auth-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; max-width: 1000px; margin: 20px auto; }
  .auth { margin: 0; }
  .auth-side { display: block; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); position: relative; }
  .auth-side img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
  .auth-side .quote { position: absolute; left: 20px; right: 20px; bottom: 20px; background: rgba(255,255,255,.94); border-radius: 16px; padding: 16px; color: var(--teal-deep); font-weight: 600; }
  .admin-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .slots-layout { display: grid; grid-template-columns: 1fr; }
}
