/* =========================================================
   Agenda Clínica — estilos
   Identidade própria (diferente da GR Digital): azul-petróleo + IBM Plex.
   ========================================================= */
:root {
  --bg: #F3F5F7;
  --surface: #FFFFFF;
  --ink: #13202B;
  --muted: #5B6875;
  --faint: #8995A1;
  --line: #E0E5EA;
  --line-2: #EDF0F3;
  --brand: #0E5E6F;
  --brand-dark: #0A4A58;
  --brand-soft: #E2EFF1;

  --ok: #17704A;     --ok-bg: #E1F2E9;
  --wait: #8F5B00;   --wait-bg: #FBF0D9;
  --miss: #B42318;   --miss-bg: #FCE7E5;
  --done: #4A5763;   --done-bg: #EAEEF2;
  --cancel: #8995A1; --cancel-bg: #F1F3F5;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --radius: 10px;
  --row-h: 50px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: var(--brand); }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 13.5px; }
.muted { color: var(--faint); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.demo-bar { background: #0B141B; color: #B9C3CC; font-size: 12.5px; text-align: center; padding: 7px 16px; }
.demo-bar a { color: #fff; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-line { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-line:hover:not(:disabled) { border-color: var(--ink); }
.btn-soft { background: var(--brand-soft); color: var(--brand-dark); }
.btn-soft:hover { background: #CFE4E8; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--miss); border-color: var(--miss); }
.btn-danger-ghost { background: transparent; color: var(--miss); padding: 0 6px; }
.btn-danger-ghost:hover { text-decoration: underline; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-icon { width: 42px; padding: 0; background: var(--surface); border-color: var(--line); font-size: 20px; line-height: 1; font-weight: 500; }
.btn-icon:hover { border-color: var(--ink); }
.btn-block { width: 100%; height: 48px; font-size: 15.5px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ---------- Chips de status ---------- */
.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chip-aguardando { background: var(--wait-bg); color: var(--wait); }
.chip-confirmado { background: var(--ok-bg); color: var(--ok); }
.chip-concluido { background: var(--done-bg); color: var(--done); }
.chip-faltou { background: var(--miss-bg); color: var(--miss); }
.chip-cancelado { background: var(--cancel-bg); color: var(--cancel); text-decoration: line-through; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 4px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; vertical-align: 1px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; flex: none; }
.sent { font-size: 12.5px; color: var(--ok); font-weight: 600; white-space: nowrap; }
.count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #D9480F; color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; }
.badge[hidden] { display: none; }

.avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.avatar-soft { background: var(--brand-soft); color: var(--brand-dark); width: 32px; height: 32px; font-size: 12px; }

/* ---------- Barra superior ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 32px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.brand b { display: block; font-size: 15px; line-height: 1.2; }
.brand small { display: block; font-size: 12.5px; color: var(--muted); }
.tabs { display: flex; gap: 4px; height: 100%; }
.tabs a { display: flex; align-items: center; padding: 0 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand); }
.patient-link { margin-left: auto; }

.bottom-nav { display: none; }

/* ---------- Página ---------- */
.view { max-width: 1280px; margin: 0 auto; padding: 28px 24px 56px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
.page-head h1 { font-size: 28px; letter-spacing: -0.02em; line-height: 1.15; margin-top: 4px; }
.date-title::first-letter { text-transform: uppercase; }
.sub { color: var(--muted); margin-top: 2px; }
.sub::first-letter { text-transform: uppercase; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; }
.card-head h2::first-letter { text-transform: uppercase; }
.card-head a { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.card-head a:hover { text-decoration: underline; }

.empty { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 32px 16px; color: var(--muted); }
.empty b { color: var(--ink); font-weight: 600; }
.empty span { font-size: 14px; max-width: 320px; }
.foot-note { margin-top: 24px; font-size: 13px; color: var(--faint); text-align: center; }

/* ---------- Painel do dia ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; align-content: start; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi b em { font-style: normal; color: var(--faint); font-size: 18px; font-weight: 500; }
.kpi small { font-size: 12.5px; color: var(--faint); }
.kpi.warn { background: var(--wait-bg); border-color: #F0DDB4; }
.kpi.warn b { color: var(--wait); }
.kpi.warn small { color: var(--wait); }
.bar { height: 6px; border-radius: 3px; background: var(--line-2); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 3px; }

.dash { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
.side { display: grid; gap: 16px; }

.day-scroll { position: relative; margin: 0 -20px -18px; max-height: 620px; overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
.day-list { list-style: none; margin: 0; padding: 0; }
.day-row { display: grid; grid-template-columns: 56px 1fr auto auto; align-items: center; gap: 12px; padding: 8px 20px; border-top: 1px solid var(--line-2); }
.day-row time { font-family: var(--mono); font-size: 13.5px; color: var(--muted); }
.day-row.past { opacity: .62; }
.day-row.live { background: #F4FAFB; }
.day-row.live time { color: var(--brand); font-weight: 500; }
.day-main { text-align: left; background: none; border: 0; padding: 4px 0 4px 12px; border-left: 3px solid var(--cor); cursor: pointer; min-width: 0; }
.day-main b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-main small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-main:hover b { color: var(--brand); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; min-width: 0; }
.now-line { position: relative; height: 0; border-top: 2px solid #D9480F; margin: 0; list-style: none; }
.now-line span { position: absolute; left: 20px; top: -11px; background: #D9480F; color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px; font-family: var(--mono); }

.mini-list { list-style: none; margin: 0 -20px -18px; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 20px; border-top: 1px solid var(--line-2); }
.mini-main { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.mini-main b { display: block; font-weight: 600; font-size: 14px; }
.mini-main small { display: flex; align-items: center; color: var(--muted); font-size: 12.5px; }
.mini-main:hover b { color: var(--brand); }

/* ---------- Agenda ---------- */
.date-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.date-input { height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; color: var(--ink); background: var(--surface); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted); }
.pill:hover { border-color: var(--ink); color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.grid-wrap { max-height: calc(100vh - 290px); min-height: 420px; overflow: auto; }
.grid {
  display: grid; position: relative;
  grid-template-columns: 64px repeat(var(--cols), minmax(180px, 1fr));
  grid-template-rows: 60px repeat(var(--rows), var(--row-h));
}
.g-corner, .g-head { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); grid-row: 1; }
.g-corner { grid-column: 1; left: 0; z-index: 5; }
.g-head { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-left: 1px solid var(--line); min-width: 0; }
.g-head b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-head small { display: block; font-size: 12px; color: var(--muted); }
.g-head .avatar { width: 32px; height: 32px; font-size: 12px; }
.g-time { grid-column: 1; position: sticky; left: 0; z-index: 2; background: var(--surface); font-family: var(--mono); font-size: 12px; color: var(--faint); padding: 0 10px; transform: translateY(-8px); text-align: right; }
.g-cell { border: 0; border-left: 1px solid var(--line); border-top: 1px solid var(--line-2); background: transparent; padding: 0; cursor: pointer; position: relative; }
.g-cell span { opacity: 0; font-size: 12px; font-weight: 600; color: var(--brand); transition: opacity .1s; }
.g-cell:hover { background: var(--brand-soft); }
.g-cell:hover span, .g-cell:focus-visible span { opacity: 1; }
.g-cell.past { background: repeating-linear-gradient(135deg, transparent 0 6px, #F6F7F9 6px 7px); }
.g-cell.past:hover { background: var(--brand-soft); }
.g-cell.lunch { cursor: default; background: repeating-linear-gradient(135deg, #F7F8FA 0 6px, #EEF1F4 6px 7px); }
.g-cell.lunch span { opacity: 1; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); font-weight: 500; }

.appt {
  position: relative; z-index: 3; margin: 2px 4px; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  text-align: left; border: 1px solid var(--line); border-left: 4px solid var(--cor); border-radius: 6px;
  background: var(--surface); padding: 4px 8px; cursor: pointer; overflow: hidden;
  box-shadow: 0 1px 2px rgba(19,32,43,.05);
  transition: box-shadow .15s, transform .15s;
}
.appt:hover { box-shadow: 0 6px 16px -6px rgba(19,32,43,.25); transform: translateY(-1px); }
.appt-top { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; }
.appt b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.appt .chip { margin-top: auto; height: 20px; font-size: 11px; }
.appt .st-dot { position: absolute; right: 8px; top: 9px; width: 8px; height: 8px; border-radius: 50%; }
.appt:has(.st-dot) .appt-top { padding-right: 14px; }
.st-aguardando .st-dot { background: #E0A100; }
.st-confirmado .st-dot { background: var(--ok); }
.st-concluido .st-dot { background: #A3AEB9; }
.st-faltou .st-dot { background: var(--miss); }
.appt.st-aguardando { background: #FFFCF5; }
.appt.st-concluido { background: #F8F9FA; }
.appt.st-concluido b, .appt.st-concluido small { color: var(--faint); }
.appt.st-faltou { background: #FFF8F7; }
.appt.st-faltou b { text-decoration: line-through; text-decoration-color: var(--miss); }

.now-marker { grid-column: 2 / -1; z-index: 3; align-self: start; height: 0; border-top: 2px solid #D9480F; margin-top: calc(var(--frac) * var(--row-h)); position: relative; pointer-events: none; }
.now-marker span { position: absolute; left: -58px; top: -10px; background: #D9480F; color: #fff; font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px; }

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.legend-hint { margin-left: auto; font-size: 13px; color: var(--faint); }

/* lista do dia no celular */
.m-list { list-style: none; margin: 0; padding: 6px 0; }
.m-list li { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; padding: 4px 14px; }
.m-list time { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.m-appt { display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--cor); border-radius: 8px; background: var(--surface); cursor: pointer; }
.m-appt span { min-width: 0; }
.m-appt b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-appt small { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-appt.st-concluido { opacity: .65; }
.m-free { width: 100%; text-align: left; padding: 10px 12px; border: 1px dashed #C7D0D8; border-radius: 8px; background: transparent; color: var(--brand); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.m-more { display: block; width: calc(100% - 28px); margin: 10px 14px 4px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); font-size: 13.5px; font-weight: 500; cursor: pointer; }
.m-hint { padding: 4px 14px 14px 74px; font-size: 13px; color: var(--faint); }

/* ---------- Pacientes ---------- */
.search { position: relative; margin-bottom: 14px; max-width: 420px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { width: 100%; height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px 0 40px; font: inherit; background: var(--surface); }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #FAFBFC; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.table td small { display: block; color: var(--faint); font-size: 12px; }
.table tbody tr[data-acao] { cursor: pointer; }
.table tbody tr[data-acao]:hover { background: #F7FAFB; }
.table tbody tr:last-child td { border-bottom: 0; }
.person { display: flex; align-items: center; gap: 10px; }
.person b { font-weight: 600; }

/* ---------- Janelas ---------- */
dialog { border: 0; padding: 0; border-radius: 14px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px -16px rgba(11,20,27,.4); }
dialog::backdrop { background: rgba(11,20,27,.45); }
.dlg { padding: 22px 24px; display: grid; gap: 16px; }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dlg-head h2 { font-size: 21px; letter-spacing: -0.01em; margin-top: 2px; }
.dlg-head .btn-icon { width: 36px; height: 36px; font-size: 15px; flex: none; }
.status-set { display: flex; flex-wrap: wrap; gap: 6px; }
.st-opt { height: 34px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 500; cursor: pointer; color: var(--muted); }
.st-opt:hover { border-color: var(--ink); color: var(--ink); }
.st-opt[aria-pressed="true"][data-valor="aguardando"] { background: var(--wait-bg); border-color: #E9C97A; color: var(--wait); }
.st-opt[aria-pressed="true"][data-valor="confirmado"] { background: var(--ok-bg); border-color: #8DCBAA; color: var(--ok); }
.st-opt[aria-pressed="true"][data-valor="concluido"] { background: var(--done-bg); border-color: #B5C0CA; color: var(--done); }
.st-opt[aria-pressed="true"][data-valor="faltou"] { background: var(--miss-bg); border-color: #F0A79F; color: var(--miss); }
.st-opt[aria-pressed="true"][data-valor="cancelado"] { background: var(--cancel-bg); border-color: #C8D0D7; color: var(--done); }
.wa-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field[hidden] { display: none; }
.field > span { font-size: 13px; font-weight: 500; color: var(--muted); }
.field small { font-weight: 400; color: var(--faint); }
.field input, .field select, .field textarea {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px;
  font: inherit; color: var(--ink); background: var(--surface);
}
.field textarea { height: auto; padding: 10px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.span-2 { grid-column: span 2; }
.form-error { background: var(--miss-bg); color: var(--miss); font-size: 13.5px; font-weight: 500; padding: 9px 12px; border-radius: 8px; }
.form-error[hidden] { display: none; }
.dlg-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 4px; }
.dlg-foot-r { display: flex; gap: 8px; }

.history { border-top: 1px solid var(--line); padding-top: 14px; }
.history h3 { font-size: 15px; }
.history ul { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.history li button { width: 100%; display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border: 0; border-top: 1px solid var(--line-2); background: none; text-align: left; cursor: pointer; font-size: 14px; }
.history li button:hover { color: var(--brand); }
.history li small { display: block; font-size: 12px; color: var(--faint); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 32px -8px rgba(11,20,27,.45); transition: opacity .2s, transform .25s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Página do paciente ---------- */
.modo-paciente { background: #EEF3F4; }
.modo-paciente .topbar, .modo-paciente .bottom-nav { display: none; }
.modo-paciente .view { max-width: none; padding: 0 0 48px; }
.patient-bar { background: #FFF4D6; color: #6B4A00; font-size: 13.5px; text-align: center; padding: 9px 16px; border-bottom: 1px solid #F0DDA0; }
.patient-bar a { color: inherit; font-weight: 600; }
.book { max-width: 620px; margin: 0 auto; padding: 32px 16px 0; }
.book-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.book-logo { width: 48px; height: 48px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; flex: none; }
.book-head h1 { font-size: 24px; letter-spacing: -0.02em; }
.book-head p { color: var(--muted); font-size: 13.5px; }
.book-card { background: var(--surface); border-radius: 16px; box-shadow: 0 1px 2px rgba(19,32,43,.06), 0 12px 32px -16px rgba(19,32,43,.18); }
.step { padding: 22px; border-top: 1px solid var(--line-2); display: grid; gap: 14px; }
.step:first-child { border-top: 0; }
.step h2 { display: flex; align-items: center; gap: 10px; font-size: 16.5px; }
.step h2 span { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 13px; display: grid; place-items: center; flex: none; }

.prof-opts { display: grid; gap: 8px; }
.prof-opt, .serv-opt, .day-opt, .time-opt {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; cursor: pointer; text-align: left;
  transition: border-color .12s, background .12s;
}
.prof-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.prof-opt b { display: block; font-weight: 600; }
.prof-opt small { color: var(--muted); font-size: 13px; }
.serv-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.serv-opt { padding: 11px 14px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.serv-opt b { font-weight: 600; font-size: 14px; }
.serv-opt small { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.day-opts { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.day-opt { flex: 0 0 74px; padding: 10px 6px; display: grid; justify-items: center; gap: 0; scroll-snap-align: start; }
.day-opt small { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.day-opt b { font-size: 22px; font-weight: 600; line-height: 1.2; }
.day-opt:disabled { opacity: .4; cursor: default; }
.time-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.time-opt { height: 42px; text-align: center; font-family: var(--mono); font-size: 14px; font-weight: 500; }
.prof-opt:hover, .serv-opt:hover, .day-opt:hover:not(:disabled), .time-opt:hover { border-color: var(--brand); }
.prof-opt[aria-pressed="true"], .serv-opt[aria-pressed="true"], .day-opt[aria-pressed="true"], .time-opt[aria-pressed="true"] {
  border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand);
}
.time-opt[aria-pressed="true"], .day-opt[aria-pressed="true"] { background: var(--brand); color: #fff; }
.day-opt[aria-pressed="true"] small { color: #CFE4E8; }
.recap { background: var(--bg); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.recap span { color: var(--muted); font-size: 14px; }
.recap span::first-letter { text-transform: uppercase; }

.done { padding: 36px 28px; text-align: center; display: grid; gap: 12px; justify-items: center; margin-top: 8px; }
.done-ic { width: 60px; height: 60px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); display: grid; place-items: center; }
.done h1 { font-size: 26px; letter-spacing: -0.02em; }
.done > p { color: var(--muted); max-width: 420px; }
.summary { width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; text-align: left; background: var(--bg); border-radius: 10px; padding: 16px 18px; margin: 8px 0; font-size: 14px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; }
.summary dd::first-letter { text-transform: uppercase; }
.book-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- Rodapé com o selo da GR Digital ---------- */
.app-foot { display: flex; justify-content: center; padding: 8px 16px 32px; }
.modo-paciente .app-foot { padding-bottom: 40px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .modo-paciente { padding-bottom: 0; }
  .topbar-in { height: 56px; padding: 0 16px; }
  .tabs, .patient-link { display: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { display: grid; justify-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11.5px; font-weight: 500; color: var(--faint); text-decoration: none; position: relative; }
  .bottom-nav a.active { color: var(--brand); }
  .bottom-nav .badge { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; }
  .view { padding: 20px 16px 32px; }
  .page-head h1 { font-size: 23px; }
  .page-head > .btn-primary { width: 100%; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 25px; }
  .day-row { grid-template-columns: 46px 1fr auto; padding: 8px 16px; row-gap: 6px; }
  .day-row .row-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .day-row .row-actions:empty { display: none; }
  .day-scroll, .mini-list { margin: 0 -16px -16px; }
  .day-scroll { max-height: 70vh; }
  .mini-list li { padding: 10px 16px; }
  .card { padding: 16px; }
  .card-flush { padding: 0; }
  .date-nav { width: 100%; }
  .date-input { flex: 1; min-width: 0; }
  .date-nav .btn-primary { display: none; }
  .pills { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px; }
  .pill { flex: none; }
  .legend-hint { display: none; }
  /* tabela vira cartões */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
  .table td { padding: 0; border: 0; font-size: 13.5px; }
  .table td:first-child { grid-column: span 2; margin-bottom: 4px; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
  .fields { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  dialog { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .dlg { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .dlg-foot { flex-wrap: wrap; }
  .dlg-foot-r { flex: 1; justify-content: flex-end; }
  .history li button { grid-template-columns: 1fr auto; }
  .history li button .mono { grid-column: span 2; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .book { padding-top: 20px; }
  .step { padding: 18px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
