/* Sistema Dr. Paulo Oliveira — estilos do painel */
:root {
  --preto: #0B0B0B; --texto: #3A3F3C; --cinza: #5F6461; --claro: #9AA09C;
  --borda: #E4E4E0; --borda2: #D6D6D1; --linha: #EFEFEB; --fundo: #F6F6F4; --branco: #FFFFFF;
  --verde: #0D5E5E; --verde-esc: #094545; --tint: #E3EFEE; --tint2: #F3F8F8;
  --ok-bg: #D9F2E5; --ok-fg: #13663C; --alerta-bg: #FDF1C7; --alerta-fg: #7A5B00; --erro-bg: #FDE2E2; --erro-fg: #B42318;
  --raio: 10px;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--preto); -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--fundo); }
body { font-size: 14px; line-height: 1.45; }
a { color: var(--verde); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; font-weight: 500; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 500; margin: 0; }
.lbl { margin: 0; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; color: var(--cinza); }
.muted { color: var(--cinza); }
.peq { font-size: 12px; }
[hidden] { display: none !important; }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--borda2); background: var(--branco); color: var(--preto); font-weight: 500; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { background: #F2F2EF; }
.btn.prim { background: var(--verde); border-color: var(--verde); color: #fff; }
.btn.prim:hover { background: var(--verde-esc); }
.btn.escuro { background: var(--preto); border-color: var(--preto); color: #fff; }
.btn.perigo { color: var(--erro-fg); border-color: #F5C2BE; }
.btn.link { border: none; background: none; color: var(--verde); padding: 4px; min-height: 0; }
.btn.grande { min-height: 48px; font-size: 15px; width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--texto); }
.campo input, .campo select, .campo textarea { font-size: 15px; font-weight: 400; color: var(--preto); padding: 10px 12px; border: 1px solid var(--borda2); border-radius: 8px; background: var(--branco); width: 100%; }
.campo input:focus, .campo select:focus, .campo textarea:focus { outline: 2px solid var(--verde); outline-offset: -1px; border-color: var(--verde); }
.campo small { font-weight: 400; color: var(--cinza); }
.senha-wrap { position: relative; }
.senha-wrap input { padding-right: 48px; }
.olho { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: none; background: none; color: var(--cinza); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.grade2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grade3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pilulas { display: flex; flex-wrap: wrap; gap: 6px; }
.pilula { font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--borda2); background: var(--branco); cursor: pointer; }
.pilula[aria-pressed="true"] { background: var(--verde); border-color: var(--verde); color: #fff; }
.tag { display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 999px; background: #F1F3F5; color: var(--texto); }
.aviso { padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.5; }
.aviso.ok { background: var(--ok-bg); color: var(--ok-fg); }
.aviso.alerta { background: var(--alerta-bg); color: var(--alerta-fg); }
.aviso.erro { background: var(--erro-bg); color: var(--erro-fg); }
.aviso.info { background: var(--tint2); color: var(--verde); }
.card { background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; padding: 16px; }
.pilha { display: flex; flex-direction: column; gap: 12px; }
.linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.entre { justify-content: space-between; }
.segmentado { display: inline-flex; background: var(--branco); border: 1px solid var(--borda); border-radius: 10px; padding: 3px; gap: 2px; }
.segmentado button { border: none; background: none; padding: 7px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; color: var(--texto); }
.segmentado button[aria-pressed="true"] { background: var(--verde); color: #fff; font-weight: 500; }
table.tab { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tab th { text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; color: var(--cinza); padding: 8px; border-bottom: 1px solid var(--borda); }
table.tab td { padding: 10px 8px; border-bottom: 1px solid var(--linha); vertical-align: middle; }

/* ---------- estrutura ---------- */
.app { display: flex; min-height: 100%; }
.menu { width: 236px; flex: none; background: var(--branco); border-right: 1px solid var(--borda); padding: 20px 14px; display: flex; flex-direction: column; gap: 3px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.menu .marca { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.menu .marca img { width: 34px; height: 34px; object-fit: contain; }
.menu .marca b { display: block; font-size: 14px; font-weight: 500; }
.menu .marca span { font-size: 12px; color: var(--cinza); }
.menu a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--texto); text-decoration: none; font-size: 13px; }
.menu a:hover { background: #ECECE8; }
.menu a.on { background: var(--tint); color: var(--verde); font-weight: 500; }
.menu svg { width: 19px; height: 19px; flex: none; }
.menu .rodape { margin-top: auto; padding-top: 12px; }
.conteudo { flex: 1; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.topo-tela { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.barra-mobile, .nav-inferior { display: none; }

/* tablet: só ícones */
@media (max-width: 1199px) {
  .menu { width: 72px; padding: 16px 10px; align-items: center; }
  .menu .marca { padding: 0 0 14px; }
  .menu .marca div, .menu a span { display: none; }
  .menu a { width: 48px; height: 44px; justify-content: center; padding: 0; }
  .menu svg { width: 22px; height: 22px; }
  .conteudo { padding: 16px; }
}
/* celular: barra em cima e menu embaixo */
@media (max-width: 719px) {
  .menu { display: none; }
  .barra-mobile { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--branco); border-bottom: 1px solid var(--borda); position: sticky; top: 0; z-index: 20; }
  .barra-mobile img { width: 28px; height: 28px; }
  .barra-mobile b { font-size: 16px; font-weight: 500; }
  .app { flex-direction: column; }
  .conteudo { padding: 12px 12px 92px; }
  .nav-inferior { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--branco); border-top: 1px solid var(--borda); padding: 6px 0 calc(10px + env(safe-area-inset-bottom)); }
  .nav-inferior a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--cinza); text-decoration: none; }
  .nav-inferior a span.ic { display: flex; align-items: center; justify-content: center; width: 52px; height: 28px; border-radius: 999px; }
  .nav-inferior a.on { color: var(--verde); font-weight: 500; }
  .nav-inferior a.on span.ic { background: var(--tint); }
  .nav-inferior svg { width: 21px; height: 21px; }
  .grade2, .grade3 { grid-template-columns: 1fr; }
  h1 { font-size: 19px; }
}

/* ---------- agenda ---------- */
.agenda-wrap { display: flex; gap: 16px; align-items: flex-start; }
.agenda-box { flex: 1; min-width: 0; background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.agenda-cab { display: grid; border-bottom: 1px solid var(--borda); background: var(--branco); position: sticky; top: 0; z-index: 3; }
.agenda-cab div { padding: 8px 6px; text-align: center; border-left: 1px solid var(--linha); }
.agenda-cab .sem { font-size: 11px; color: var(--cinza); text-transform: uppercase; letter-spacing: .05em; }
.agenda-cab .num { font-size: 17px; font-weight: 500; }
.agenda-cab .hoje .num { color: #fff; background: var(--verde); border-radius: 8px; padding: 0 8px; display: inline-block; }
.agenda-cab .loc { font-size: 11px; color: var(--cinza); }
.agenda-rolagem { overflow-y: auto; max-height: calc(100vh - 210px); }
.agenda-corpo { display: flex; position: relative; }
.agenda-horas { width: 54px; flex: none; }
.agenda-horas div { height: 62px; border-top: 1px solid var(--linha); padding: 2px 6px; font-size: 11px; color: var(--cinza); }
.agenda-col { flex: 1; min-width: 96px; position: relative; border-left: 1px solid var(--linha); }
.slot { display: block; width: 100%; height: 31px; border: none; margin: 0; padding: 0; cursor: pointer; background: var(--branco); }
.slot.hora { border-top: 1px solid var(--linha); }
.slot.meia { border-top: 1px dashed #F3F3F0; }
.slot.fora { background: repeating-linear-gradient(135deg, #F6F6F3 0 6px, #EDEDE9 6px 7px); }
.slot:hover { background: var(--tint2); box-shadow: inset 0 0 0 1px #9FC9C6; }
.ev { position: absolute; z-index: 2; text-align: left; border: none; border-left: 3px solid; border-radius: 6px; padding: 4px 7px; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.ev b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { font-size: 11px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev.sel { box-shadow: 0 0 0 2px var(--preto); }
.ev.fantasma { background: var(--tint2); color: var(--verde); border: 1.5px dashed var(--verde); border-left-width: 3px; pointer-events: none; }
.ev.riscado span:first-of-type { text-decoration: line-through; }
.agora-linha { position: absolute; left: 0; right: 0; height: 2px; background: #B42318; z-index: 4; pointer-events: none; }
.painel-lateral { width: 360px; flex: none; background: var(--branco); border: 1px solid var(--borda); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
@media (max-width: 1199px) { .painel-lateral { width: 320px; } }
@media (max-width: 899px) {
  .painel-lateral { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 82vh; border-radius: 16px 16px 0 0; z-index: 40; box-shadow: 0 -8px 30px rgba(0,0,0,.15); padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .agenda-rolagem { max-height: calc(100vh - 230px); }
}
.fechar { margin-left: auto; border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--cinza); width: 36px; height: 36px; }

/* ---------- entrar ---------- */
.tela-entrar { display: flex; flex-wrap: wrap; min-height: 100vh; }
.tela-entrar aside { flex: 1 1 420px; background: var(--preto); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.tela-entrar aside img { width: 230px; max-width: 70%; }
.tela-entrar aside p { color: #C9C9C3; }
.tela-entrar main { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.tela-entrar form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.codigo-input { font-size: 26px !important; letter-spacing: 10px; text-align: center; }
@media (max-width: 719px) { .tela-entrar aside { flex-basis: 100%; padding: 24px; gap: 12px; } .tela-entrar aside .sub { display: none; } }

/* ---------- listas ---------- */
.lista-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-bottom: 1px solid var(--linha); text-decoration: none; color: inherit; }
.lista-item:hover { background: #FAFAF8; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--tint); color: var(--verde); display: flex; align-items: center; justify-content: center; font-weight: 500; flex: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--preto); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 100; font-size: 14px; max-width: 90vw; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
@media (max-width: 719px) { .toast { bottom: 90px; } }
.vazio { padding: 32px 16px; text-align: center; color: var(--cinza); }
@media (max-width: 719px) { .painel-lateral .grade2 { grid-template-columns: 1fr 1fr; } }

/* ---------- janela (dialog) ---------- */
dialog.janela { border: none; border-radius: 16px; padding: 20px; width: min(560px, 94vw); max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.janela::backdrop { background: rgba(11,11,11,.45); }
.barra-prog { height: 8px; border-radius: 999px; background: var(--linha); overflow: hidden; }
.barra-prog > span { display: block; height: 100%; background: var(--verde); }
.num-grande { font-size: 22px; font-weight: 500; margin: 4px 0 0; }

/* ---------- impressão do recibo ---------- */
.recibo-folha { background: #fff; max-width: 720px; margin: 0 auto; padding: 40px; border: 1px solid var(--borda); border-radius: 12px; font-size: 15px; line-height: 1.7; }
@media print {
  .menu, .barra-mobile, .nav-inferior, .nao-imprimir, .toast { display: none !important; }
  .conteudo { padding: 0; }
  body, html { background: #fff; }
  .recibo-folha { border: none; padding: 0; }
}
