/* =========================================================================
   Adjuva — base visual (redesign 2026-11)

   Linguagem minimalista: fundo quase branco, bordas finas, quase nenhuma
   sombra, rótulos pequenos em maiúsculas cinza, selos de status tingidos.
   Carregado por TODAS as páginas, antes do CSS próprio de cada uma: aqui ficam
   os tokens e os componentes; a página só ajusta o que é dela.

   Spec: docs/superpowers/specs/2026-11-23-redesign-visual-design.md
   ========================================================================= */

:root {
  /* superfícies e texto */
  --bg: #fafafa;
  --card: #ffffff;
  --text: #171717;
  --muted: #5f5f5f;          /* 6.4:1 sobre #fafafa */
  --subtle: #8a8a8a;         /* só ícone/desabilitado, nunca texto corrido */
  --border: #e8e8e8;
  --border-strong: #d4d4d4;

  /* botão primário */
  --ink: #171717;
  --ink-hover: #000000;

  /* marca: logo, item ativo, foco, link */
  --primary: #0E7C7B;
  --primary-hover: #0A5E5D;
  --accent-bg: #e6f2f1;

  /* estados */
  --success: #15803d;  --success-bg: #ecfdf3;
  --warn: #b45309;     --warn-bg: #fffbeb; --warn-border: #f0d9a0;
  --danger: #b91c1c;   --danger-bg: #fef2f2; --danger-border: #fca5a5;
  --info: #1d4ed8;     --info-bg: #eff6ff;
  --neutral-bg: #f4f4f5;

  /* forma */
  --r: 10px;
  --r-lg: 12px;
  --shadow: none;
  --foco: 0 0 0 3px rgba(14, 124, 123, .18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
a:hover { color: var(--primary-hover); }

/* ---------------------------------------------------------------- cartão */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: none;
}

/* ---------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.2;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
  text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--neutral-bg); }
.btn:focus-visible { outline: none; box-shadow: var(--foco); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--neutral-bg); color: var(--text); }
.btn-danger { background: var(--card); border-color: var(--border-strong); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }

/* ---------------------------------------------------------------- selos */
.selo {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 500; line-height: 1;
  padding: 5px 9px; border-radius: 6px;
  background: var(--neutral-bg); color: var(--muted);
}
.selo-ok     { background: var(--success-bg); color: var(--success); }
.selo-pend   { background: var(--warn-bg);    color: var(--warn); }
.selo-erro   { background: var(--danger-bg);  color: var(--danger); }
.selo-info   { background: var(--info-bg);    color: var(--info); }
.selo-neutro { background: var(--neutral-bg); color: var(--muted); }

/* ---------------------------------------------------------------- rótulos */
.rotulo {
  display: block;
  font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted);
}

/* "CRIADO · STATUS · PLANO" — pares rótulo/valor lado a lado */
.meta-grade {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px 24px;
}
.meta-grade > div { min-width: 0; }
.meta-grade .rotulo { margin-bottom: 6px; }
.meta-grade .valor { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- cabeçalho */
.pg-cab { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pg-icone {
  width: 56px; height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--card); color: var(--primary);
}
.pg-sobre { font-size: 13px; color: var(--muted); margin: 0 0 2px; }
.pg-titulo {
  font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15;
  margin: 0; color: var(--text);
}
@media (max-width: 640px) {
  .pg-titulo { font-size: 22px; }
  .pg-icone { width: 44px; height: 44px; flex-basis: 44px; }
}

/* ---------------------------------------------------------------- linha do tempo */
.linha-tempo {
  display: flex; align-items: flex-start; gap: 0;
  padding: 20px 8px; overflow-x: auto;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 14px 14px;
  border-radius: var(--r);
}
.lt-passo {
  flex: 1 1 0; min-width: 96px; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.lt-passo::before {                      /* o traço até o passo anterior */
  content: ""; position: absolute; top: 17px; right: 50%; width: 100%;
  height: 1px; background: var(--border-strong); z-index: 0;
}
.lt-passo:first-child::before { display: none; }
.lt-passo .lt-ic {
  position: relative; z-index: 1;
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--border); color: var(--subtle);
}
.lt-passo .lt-nome { font-size: 12.5px; font-weight: 500; color: var(--muted);
  padding: 3px 8px; border-radius: 6px; background: var(--neutral-bg); }
.lt-passo .lt-data { font-size: 12px; color: var(--muted); }
.lt-passo.ok .lt-ic { color: var(--success); }
.lt-passo.ok .lt-nome { background: var(--success-bg); color: var(--success); }
.lt-passo.atual .lt-ic { color: var(--info); border-color: var(--info); }
.lt-passo.atual .lt-nome { background: var(--info-bg); color: var(--info); }

/* ---------------------------------------------------------------- abas */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  font: inherit; font-size: 13.5px; font-weight: 500;
  padding: 8px 12px; margin-bottom: -1px; cursor: pointer;
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--ink); }

/* ---------------------------------------------------------------- formulário */
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], input[type=tel], select, textarea {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--card);
  border: 1px solid var(--border-strong); border-radius: 8px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--foco);
}

/* ---------------------------------------------------------------- tabela */
table { border-collapse: collapse; }
th {
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); text-align: left;
}
th, td { border-bottom: 1px solid var(--border); }

/* ---------------------------------------------------------------- modal */
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .08);
}

/* ---------------------------------------------------------------- ícones */
.ic-svg { display: inline-block; vertical-align: -3px; flex: none; }
button .ic-svg, a .ic-svg, summary .ic-svg, h2 .ic-svg, h3 .ic-svg, p .ic-svg { margin-right: 6px; }

/* =========================================================================
   Menu lateral (#adj-rail) — computador: aberto (232px), com rótulos;
   tablet: só ícones (60px), abre ao passar o mouse; celular: gaveta que abre
   pelo botão ☰ da barra de cima, com véu escuro atrás.
   Usado pela casca do /app e pelo menu-lateral.js das outras telas.
   ========================================================================= */
:root { --rail-w: 232px; --rail-aberto: 232px; }
@media (max-width: 1023px) { :root { --rail-w: 60px; } }
@media (max-width: 767px)  { :root { --rail-w: 0px; } }

#adj-rail {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-w);
  background: var(--card); border-right: 1px solid var(--border);
  z-index: 60; display: flex; flex-direction: column; gap: 1px;
  padding: 10px 10px 12px; overflow-x: hidden; overflow-y: auto;
  transition: width .16s ease, transform .2s ease;
}
#adj-rail .marca {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px 12px;
  color: var(--text); font-weight: 600; font-size: 15px; letter-spacing: -.01em;
  white-space: nowrap; border-radius: 8px; cursor: pointer;
}
#adj-rail .marca img { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 7px; }
#adj-rail .marca:hover { background: var(--neutral-bg); }
#adj-rail .rail-sec {
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 14px 10px 6px; white-space: nowrap;
}
#adj-rail button, #adj-rail a.rail-it {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 500;
  text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer;
}
#adj-rail button .ic, #adj-rail a.rail-it .ic {
  flex: 0 0 20px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 16px; line-height: 1;
}
#adj-rail button .ic .ic-svg, #adj-rail a.rail-it .ic .ic-svg { margin: 0; }
#adj-rail button:hover, #adj-rail a.rail-it:hover { background: var(--neutral-bg); color: var(--text); }
#adj-rail button.on, #adj-rail a.rail-it.on, #adj-rail .marca.on {
  background: var(--neutral-bg); color: var(--text); font-weight: 600;
}
#adj-rail button.on .ic, #adj-rail a.rail-it.on .ic { color: var(--primary); }
#adj-rail .rot-txt { opacity: 1; overflow: hidden; text-overflow: ellipsis; }
#adj-rail .empurra { flex: 1; min-height: 12px; }
#adj-rail .rail-sep { height: 1px; background: var(--border); margin: 8px 4px; flex: none; }

/* Botão que foi promovido ao menu lateral: some do menu ⚙ sem mudar o seu
   display — é o display dele que diz se o item do menu lateral aparece. */
.promovido { position: absolute !important; width: 1px !important; height: 1px !important;
  overflow: hidden !important; clip: rect(0 0 0 0) !important; padding: 0 !important; border: 0 !important; }

/* tablet: só ícones, abre por cima ao passar o mouse */
@media (min-width: 768px) and (max-width: 1023px) {
  #adj-rail { padding: 10px 8px; }
  #adj-rail .rot-txt, #adj-rail .rail-sec { opacity: 0; transition: opacity .12s ease; }
  #adj-rail .rail-sec { height: 0; padding: 0; overflow: hidden; }
  #adj-rail:hover { width: var(--rail-aberto); box-shadow: 0 12px 40px rgba(0, 0, 0, .08); }
  #adj-rail:hover .rot-txt { opacity: 1; }
  #adj-rail:hover .rail-sec { opacity: 1; height: auto; padding: 14px 10px 6px; }
}

/* celular: gaveta */
#adj-hamb { display: none; }
#adj-veu { display: none; }
@media (max-width: 767px) {
  #adj-rail { width: 264px; transform: translateX(-100%); }
  body.rail-aberto #adj-rail { transform: none; box-shadow: 0 12px 40px rgba(0, 0, 0, .12); }
  body.rail-aberto #adj-veu { display: block; position: fixed; inset: 0; z-index: 59; background: rgba(0, 0, 0, .3); }
  #adj-hamb {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--card); color: var(--text); cursor: pointer; padding: 0;
  }
  #adj-hamb .ic-svg { margin: 0; }
}

/* telas fora do /app (pacientes, internação, admin) */
body.adj-lateral { padding-left: var(--rail-w); transition: padding-left .16s ease; }

/* agenda da clínica: mês com bolinhas, grade do dia por local, configuração */
.role-secretaria #ag-config { display: none !important; }
.ag-mes { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 12px; }
.ag-mes .cab { font-size: 11.5px; color: var(--muted); text-align: center; text-transform: uppercase; }
.ag-mes .d { min-height: 62px; border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  color: var(--text); padding: 6px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; font: inherit; }
.ag-mes .d:hover { border-color: var(--primary-hover); }
.ag-mes .d.fora { border: 0; background: none; cursor: default; }
.ag-mes .d.hoje .n { color: var(--primary-hover); font-weight: 700; }
.ag-mes .d.bloq { background: var(--border); color: var(--muted); }
.ag-mes .bols { display: flex; gap: 4px; flex-wrap: wrap; }
.bol { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.bol-consulta { background: #3b82f6; }
.bol-retorno { background: #8b5cf6; }
.bol-procedimento { background: #10b981; }
.bol-cirurgia { background: #eab308; }
.bol-bloq { background: var(--border); border: 1px solid var(--muted); }
.ag-legenda { display: flex; gap: 14px; flex-wrap: wrap; padding: 4px 14px 12px; font-size: 12px; color: var(--muted); }
.ag-legenda > span { display: inline-flex; align-items: center; gap: 5px; }
.ag-sec h4 .btn-mini { float: right; margin-top: -3px; }
.ag-grade { display: flex; gap: 10px; overflow-x: auto; padding: 10px 12px 14px; }
.ag-col { flex: 1 1 240px; min-width: 220px; }
.ag-col-t { font-weight: 700; font-size: 13px; padding: 4px 2px 8px; }
.ag-slot { display: flex; gap: 8px; align-items: flex-start; border-top: 1px solid var(--border); padding: 5px 2px; min-height: 30px; }
.ag-slot .h { width: 42px; flex: 0 0 42px; font-size: 12px; color: var(--muted); padding-top: 3px; }
.ag-slot .cx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ag-slot .mot { font-size: 12px; color: var(--muted); padding-top: 3px; }
.ag-slot.livre { cursor: pointer; }
.ag-slot.livre:hover { background: rgba(59, 130, 246, .07); }
.ag-slot.bloqueado { background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(127, 127, 127, .12) 6px 12px); }
.ag-slot.intervalo .mot { font-style: italic; }
.ag-cartao { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; font-size: 12.5px; padding: 4px 7px;
  border-radius: 6px; border-left: 3px solid #3b82f6; background: rgba(59, 130, 246, .08); }
.ag-cartao.fam-retorno { border-left-color: #8b5cf6; background: rgba(139, 92, 246, .08); }
.ag-cartao.fam-procedimento { border-left-color: #10b981; background: rgba(16, 185, 129, .08); }
.ag-cartao.fam-cirurgia { border-left-color: #eab308; background: rgba(234, 179, 8, .1); }
.ag-cartao.faltou { opacity: .6; }
.ag-cartao .nm[data-edit] { cursor: pointer; }
.ag-cartao .tag.am { background: #fde68a; color: #78350f; }
.ag-cartao .tag.enc { background: #fecaca; color: #7f1d1d; }
.ag-cartao .st { margin-left: auto; font-size: 11px; color: var(--muted); }
.ag-fora-t { font-size: 11.5px; color: var(--muted); margin: 10px 0 4px; text-transform: uppercase; }
.ag-hist { font-size: 12px; color: var(--muted); margin-top: 10px; max-height: 140px; overflow: auto; line-height: 1.6; }
.ag-hist-t { font-weight: 700; color: var(--text); }
.ag-cf .cf-l { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 5px 0; border-bottom: 1px solid var(--border); }
.ag-cf .cf-nome { flex: 1 1 180px; }
.ag-cf .cf-dur { width: 74px; }
.ag-cf .cf-h { display: grid; grid-template-columns: 70px repeat(4, minmax(0, 1fr)) 64px; gap: 6px; align-items: center; padding: 3px 0; }
.ag-cf .cf-h.cab { font-size: 11.5px; color: var(--muted); }
@media (max-width: 767px) {
  .ag-mes .d { min-height: 48px; padding: 4px; }
  .ag-cf .cf-h { grid-template-columns: 56px repeat(4, minmax(0, 1fr)) 52px; font-size: 12px; }
}
.ag-slot .cx .btn-mini { align-self: flex-start; width: auto; }
.ag-cartao .btn-mini { width: auto; padding: 1px 6px; min-height: 0; line-height: 1.3; }
.fila-g-t { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  padding: 10px 17px 4px; cursor: default; }
.fila-g-t span { color: var(--primary-hover); }
details.fila-g > summary { cursor: pointer; }
.cq-quadro { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cq-col { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding-bottom: 8px; min-width: 0; }
.cq-cartao { border-top: 1px solid var(--border); padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.cq-l1 { font-size: 14px; }
.cq-l2 { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.cq-cartao .acs { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 767px) { .cq-quadro { grid-template-columns: 1fr; } }
.ag-aviso-esp { margin: 8px 12px 0; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: rgba(234, 179, 8, .12); display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.rt-oferta { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 9500; display: none;
  align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 32px);
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .15); font-size: 13.5px; }
.rt-oferta.show { display: flex; }
.cf-selo { font-size: 11px; padding: 1px 6px; border-radius: 999px; margin-left: 6px;
  background: rgba(234, 179, 8, .16); white-space: nowrap; }
