:root {
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e6eaf1;
  --line-2: #d6dce6;
  --accent: #1c4a8c;
  --accent-ink: #ffffff;
  --accent-soft: #e8eef8;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #15803d;
  --ok-soft: #ecfdf3;
  --warn: #a16207;
  --warn-soft: #fef9e7;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: 0 1px 1px rgb(15 23 42 / .04);
  --shadow-lg: 0 24px 64px rgb(15 23 42 / .22);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f16;
    --surface: #131a24;
    --surface-2: #19212d;
    --ink: #e8edf5;
    --ink-2: #c3ccd9;
    --muted: #8b97a8;
    --line: #232d3b;
    --line-2: #2e3a4b;
    --accent: #7ea6e6;
    --accent-ink: #0b0f16;
    --accent-soft: #16233a;
    --danger: #f87171;
    --danger-soft: #2a1618;
    --ok: #4ade80;
    --ok-soft: #102419;
    --warn: #facc15;
    --warn-soft: #2a2410;
    --shadow: 0 1px 2px rgb(0 0 0 / .3);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border-radius: 5px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--ink);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink);  }
.btn.primary:hover { filter: brightness(1.06); }
.btn.lg { min-height: 48px; width: 100%; font-size: 15px; }
.btn.subtle { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn.danger-soft { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto;
  border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
}
.icon-btn.ghost { border-color: transparent; background: var(--surface-2); }
.icon-btn:hover { color: var(--danger); }

/* ---------- Topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) max(16px, calc((100vw - 1240px) / 2)) 10px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.brand img { border-radius: 6px; }
.brand div { min-width: 0; }
.brand b { display: block; font-size: 16px; letter-spacing: -.01em; }
.brand small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 420px) {
  .topbar .btn.primary { padding: 0 12px; }
  .brand img { width: 30px; height: 30px; }
}

.avatar {
  width: 40px; height: 40px; border-radius: 50%; border: 0; flex: 0 0 auto;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: linear-gradient(135deg, #3d6fb8, #1c4a8c); color: #fff;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.menu { position: relative; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 30;
}
.menu-list button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 6px; font-size: 14px; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list .sair { color: var(--danger); }
.menu-list .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-list .who small { display: block; color: var(--muted); font-size: 12px; }

main { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }

.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head > div { flex: 1; min-width: 200px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; line-height: 1.15; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-head p::first-letter { text-transform: uppercase; }

/* ---------- Indicadores / filtros ---------- */
.kpis { display: grid; gap: 10px; grid-template-columns: repeat(5, 1fr); margin-bottom: 12px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, 1fr); } .kpis .kpi:first-child { grid-column: span 2; } }
.kpi {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left;
  padding: 14px 16px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.kpi span { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi b { font-size: 30px; line-height: 1; letter-spacing: -.03em; font-weight: 700; }
.kpi .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.kpi.alerta b { color: var(--danger); }
.kpi.ok b { color: var(--ok); }
.kpi:hover { border-color: var(--line-2); }
.kpi.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 13px;
  border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface); font-size: 13px; font-weight: 500;
}
.chip b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 5px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; }
.chip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip.on b { background: rgb(255 255 255 / .18); }

.search {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; margin: 4px 0 8px;
  border-radius: 6px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
}
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; border: 0; background: none; outline: none; height: 100%; color: var(--ink); min-width: 0; }

/* ---------- Lista de pacientes ---------- */
.grupo h2 { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: 26px 0 12px; letter-spacing: -.01em; }
.grupo h2 i { width: 12px; height: 12px; border-radius: 4px; }
.grupo h2 span { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--line); padding: 1px 9px; border-radius: 5px; }
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); align-items: start; }

.card {
  --card-ink: var(--ink); --card-muted: var(--muted); --card-line: var(--line); --card-chip: var(--surface-2);
  position: relative; display: flex; flex-direction: column; gap: 10px;
  background: var(--surface); color: var(--card-ink);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgb(15 23 42 / .1); border-color: var(--line-2); }
.card-head { display: flex; gap: 12px; align-items: center; }
.leito {
  flex: 0 0 auto; min-width: 54px; padding: 6px 8px; border-radius: 6px; text-align: center; line-height: 1.05;
  font-weight: 800; font-size: 18px; letter-spacing: -.02em;
  background: color-mix(in srgb, var(--setor) 16%, transparent); color: color-mix(in srgb, var(--setor) 75%, var(--card-ink));
  border: 1px solid color-mix(in srgb, var(--setor) 35%, transparent);
}
.leito small { display: block; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }
.card-id { flex: 1; min-width: 0; }
.card-id .nome { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.card-id .meta { font-size: 13px; color: var(--card-muted); }

.status {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
}
.status small { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; opacity: .9; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.late { background: var(--danger-soft); color: var(--danger); }

.hd { font-size: 14px; color: var(--card-ink); }
.hd span { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--card-muted); margin-right: 6px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; background: var(--card-chip); color: var(--card-ink); }
.badge.vm { background: var(--danger); color: #fff; }
.badge.iso { background: #fff; color: #000; }
.badge.atb { background: var(--accent-soft); color: var(--accent); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.falta { padding-top: 12px; border-top: 1px solid var(--card-line); }
.falta-titulo {
  display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--danger); margin-bottom: 8px;
}
.falta-itens { display: flex; flex-wrap: wrap; gap: 6px; }
.pend {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 5px 11px; border-radius: 5px; border: 1px solid transparent;
  background: var(--danger-soft); color: var(--danger); font-weight: 600;
}
button.pend svg { opacity: .4; }
button.pend:hover { border-color: var(--danger); }
button.pend:hover svg { opacity: 1; }
.pronto { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 6px 12px; border-radius: 5px; }
.atualizado { font-size: 11.5px; color: var(--card-muted); }

/* Paciente em isolamento: card preto */
.card.iso {
  --card-ink: #f1f5f9; --card-muted: #94a3b8; --card-line: #273142; --card-chip: #1c2533;
  background: #0b0f14; border-color: #000;
}
.card.iso .leito { background: #fff; color: #000; border-color: #fff; }
.card.iso .status { background: #1c2533; color: #c7d2fe; }
.card.iso .status.ok { color: #86efac; }
.card.iso .status.late { color: #fca5a5; }
.card.iso .badge.atb, .card.iso .badge.info { background: #1e2a4a; color: #a5b4fc; }
.card.iso .badge.warn { background: #3a2f0b; color: #fde68a; }
.card.iso .pend { background: #3b1113; color: #fecaca; }
.card.iso .falta-titulo { color: #fca5a5; }
.card.iso .pronto { background: #0f2a1a; color: #86efac; }

.vazio { text-align: center; color: var(--muted); padding: 56px 16px; background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); margin-top: 16px; }
.vazio b { color: var(--ink); }


/* ---------- Formulário (painel lateral) ---------- */
.sheet-bg {
  position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end;
  background: rgb(15 23 42 / .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  animation: fade .18s ease-out;
}
.sheet {
  width: 100%; max-width: 720px; height: 100%; background: var(--bg);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  animation: slide .22s cubic-bezier(.2, .8, .2, 1);
}
.sheet > form { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.sheet.small { max-width: 520px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
@media (max-width: 640px) { @keyframes slide { from { transform: translateY(40px); opacity: .4; } } }

.sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 14px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-head small { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.sheet-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px calc(env(safe-area-inset-bottom) + 12px); background: var(--surface); border-top: 1px solid var(--line);
}
.foot-msg { flex: 1; font-size: 13px; color: var(--muted); }
.foot-msg.erro { color: var(--danger); font-weight: 600; }

.fsec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.fsec h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; font-size: 15px; letter-spacing: -.01em; }
.fsec h3 span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent); font-size: 13px;
}
.row { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.label em, .mini em { color: var(--danger); font-style: normal; margin-left: 3px; }
.field input, .field select, .field textarea, .mini input {
  width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: border-color .15s, box-shadow .15s, background .15s;
}
.field textarea { min-height: 76px; resize: vertical; line-height: 1.4; }
.field input:focus, .field textarea:focus, .mini input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.calc { font-size: 13px; color: var(--accent); font-weight: 600; min-height: 1em; }
.field .msg, .sub > .msg { display: none; color: var(--danger); font-size: 12.5px; font-weight: 600; }
.field.invalid > .msg, .sub.invalid > .msg { display: block; }
.field.invalid input, .field.invalid textarea, .sub.invalid .mini input:placeholder-shown, .sub.invalid input:invalid { border-color: var(--danger); background: var(--danger-soft); }
.field.invalid > .opts .opt span { border-color: var(--danger); }
.field.invalid > .label { color: var(--danger); }
.sub.invalid { border-color: var(--danger); }
.sub.vazao.invalid .mini input { border-color: var(--danger); background: var(--danger-soft); }

/* Opções em forma de botões (radio / checkbox) */
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { position: relative; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 15px;
  border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-2); font-size: 14px; font-weight: 500;
  user-select: none; cursor: pointer; transition: all .12s;
}
.opt span:hover { border-color: var(--muted); }
.opt input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.opt input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.opts.seg .opt { flex: 1; }
.opts.seg .opt span { width: 100%; justify-content: center; min-width: 76px; }
.opts.setores .opt { flex: 1; }
.opts.setores .opt span { width: 100%; justify-content: center; min-height: 52px; font-weight: 600; }
.opts.setores .opt span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.opts.setores .opt input:checked + span { background: var(--c); border-color: var(--c); color: #fff; }
.opts.setores .opt input:checked + span::before { background: #fff; }
.opts.lista { flex-direction: column; }
.opts.lista .opt span { width: 100%; }
.opts.pendencia .opt input:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }
.opt.nenhum input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }

.sub {
  margin: -4px 0 16px; padding: 14px 14px 2px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.sub .field input, .sub .mini input { background: var(--surface); }
.sub.vazao { margin-top: 10px; padding-bottom: 14px; max-width: 280px; }
.mini { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.unit { display: flex; align-items: center; gap: 8px; }
.unit span { color: var(--muted); font-weight: 600; font-size: 14px; }
.hint { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: -6px 0 16px; }
.hint.late { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.iso-hint { background: #0b0f14; color: #f1f5f9; border-color: #000; }

.atb-row { display: grid; grid-template-columns: 1fr 210px 42px; gap: 10px; align-items: end; margin-bottom: 12px; }
@media (max-width: 560px) { .atb-row { grid-template-columns: 1fr 42px; } .atb-row .mini:nth-child(2) { grid-column: 1; grid-row: 2; } }
#atb-box { padding-bottom: 14px; }
#atb-box > .msg { margin: -4px 0 10px; }

.form-extra { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; margin-top: 4px; }
.hist-item { font-size: 13px; padding: 6px 0; border-top: 1px solid var(--line); }
.hist-item:first-of-type { border-top: 0; }
.erro { color: var(--danger); font-weight: 600; font-size: 14px; margin: 6px 0; }

@media (max-width: 640px) {
  .sheet-body { padding: 12px 12px 20px; }
  .fsec { padding: 16px 14px; }
}

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% -10%, var(--accent-soft), transparent 60%), var(--bg);
}
.login { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 32px 28px; box-shadow: var(--shadow-lg); }
.login img { border-radius: 6px; margin-bottom: 14px; }
.login h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.02em; }
.login p { margin: 0 0 22px; color: var(--muted); font-size: 14px; }

/* ---------- Listas (saídas, usuários) ---------- */
.lista { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lista-item { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.lista-item:first-child { border-top: 0; }
.lista-item.inativo { opacity: .5; }
.lista-item .grow { flex: 1; min-width: 180px; }
.lista-item small { color: var(--muted); display: block; font-size: 12.5px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); }
#uform .btn.primary { margin-top: 8px; }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--surface); padding: 11px 18px; border-radius: 5px; font-size: 14px; font-weight: 500; z-index: 60;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.erro { background: var(--danger); color: #fff; }

/* ---------- Relatórios mensais ---------- */
.select {
  height: 40px; padding: 0 12px; border-radius: 5px; border: 1px solid var(--line-2);
  background: var(--surface); font-weight: 600; font-size: 14px;
}
.kpi.static { cursor: default; }
.kpi.static:hover { border-color: var(--line); }
.rel-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); margin-bottom: 14px; }
@media (max-width: 420px) { .rel-grid { grid-template-columns: 1fr; } }
.rel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.rel-card h3 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.rel-card > .muted { margin: 2px 0 14px; }

.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 70px; gap: 10px; align-items: center; padding: 4px 6px; margin: 0 -6px; border-radius: 6px; }
.bar-row:hover { background: var(--surface-2); }
.bar-label { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 12px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; min-width: 0; }
.bar-val { font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.bar-val small { color: var(--muted); }

.colunas { display: flex; align-items: flex-end; gap: 2px; height: 150px; padding-top: 8px; }
.col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; cursor: default; }
.col-fill { width: 100%; max-width: 16px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; }
.col:hover .col-fill { filter: brightness(1.15); }
.col small { height: 14px; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.tabela-wrap { overflow-x: auto; margin: 12px -18px -18px; }
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tabela td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.tabela td small { display: block; color: var(--muted); font-size: 12px; }
.tabela tbody tr:hover { background: var(--surface-2); }
.tabela tbody tr:last-child td { border-bottom: 0; }

/* ---------- Acesso / cadastro ---------- */
.login-hint { margin: 14px 0 0 !important; font-size: 13px !important; text-align: center; }
.login .btn.ghost { margin-top: 4px; color: var(--muted); }
.tag.pendente { background: var(--warn-soft); color: var(--warn); }
.cadastro-ok { border-color: var(--ok); }
.cadastro-ok h3 { color: var(--ok); }
.cadastro-ok p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.cadastro-ok pre {
  white-space: pre-wrap; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; margin: 0 0 12px;
}
.tabela .anon { color: var(--muted); font-style: italic; font-weight: 500; }

/* ---------- Enfermagem ---------- */
.badges.enf { padding-top: 8px; border-top: 1px dashed var(--card-line); align-items: center; }
.badges-rotulo { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--card-muted); margin-right: 2px; }
.badge.alergia { background: #fce7f3; color: #be185d; }
.badge.enf-pend { background: var(--warn-soft); color: var(--warn); border: 1px dashed currentColor; }
.badge.pulseiras { display: inline-flex; align-items: center; gap: 3px; }
.badge.pulseiras i, i.pulseira { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid; }
i.pulseira { width: 12px; height: 12px; margin-right: 2px; }
.card.iso .badge.alergia { background: #4a1230; color: #fbcfe8; }
.opt span small { font-weight: 400; opacity: .8; margin-left: 3px; }
.calc.alerta { color: var(--danger); }
.fsec.ro { background: var(--surface-2); }
.fsec.ro h3 small { font-weight: 500; font-size: 12px; }
.ro-item { display: grid; grid-template-columns: 170px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.ro-item:first-of-type { border-top: 0; }
.ro-item span { color: var(--muted); }
.ro-item b { font-weight: 600; }
@media (max-width: 560px) { .ro-item { grid-template-columns: 1fr; gap: 2px; } }
.row.sv { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.pa { display: flex; align-items: center; gap: 6px; }
.pa input { min-width: 0; }
.pa span { color: var(--muted); font-weight: 700; }

/* Aviso de nova versão */
#aviso-versao {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 72px); transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center;
  width: min(760px, calc(100vw - 24px)); padding: 12px 16px; border-radius: 6px;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg); font-size: 14px;
}
#aviso-versao > span:first-child { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px; }
#aviso-versao b { margin-right: 4px; }
#aviso-versao .acoes { display: flex; gap: 8px; }
#aviso-versao .btn:not(.primary) { background: transparent; color: inherit; border-color: rgb(255 255 255 / .35); }

/* Cuidados paliativos */
.paliativo { font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 6px; background: #ccfbf1; color: #0f766e; }
.card.iso .paliativo { background: #134e4a; color: #99f6e4; }
@media (prefers-color-scheme: dark) { .paliativo { background: #134e4a; color: #99f6e4; } }

/* Busca do CID-10 */
.cid-busca { position: relative; }
.cid-lista {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; box-shadow: var(--shadow-lg); padding: 4px;
}
.cid-lista button { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font-size: 13.5px; }
.cid-lista button:hover { background: var(--surface-2); }
.cid-lista button b { flex: 0 0 52px; color: var(--accent); }
.cid-vazio { padding: 10px; color: var(--muted); font-size: 13px; }

/* Manter conectado */
.login .manter { display: flex; gap: 10px; align-items: flex-start; margin: 2px 0 10px; cursor: pointer; }
.login .manter input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.login .manter b { display: block; font-size: 14px; }
.login .manter small { color: var(--muted); font-size: 12px; }

/* Atalho de desfecho no rodapé do card */
.card-rodape { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.btn-desfecho { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 5px;
  font-size: 12.5px; font-weight: 700; color: var(--danger); background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-desfecho:hover { border-color: var(--danger); }
.card.iso .btn-desfecho { background: #2a1618; color: #fca5a5; border-color: #7f1d1d; }

/* Janela "PDF pronto" (app instalado) */
.pdf-pronto { text-align: center; padding: 22px 18px; }
.pdf-pronto .pdf-icone { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 6px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.pdf-pronto .pdf-icone svg { width: 28px; height: 28px; }
.pdf-pronto p { font-size: 14px; line-height: 1.5; color: var(--ink-2); }

/* Fichas de paciente: texto em caixa alta (convertido de verdade ao sair do campo e ao salvar). */
:is(#pform, #eform, #ndform) :is(input:not([type]), input[type="text"], textarea) { text-transform: uppercase; }
:is(#pform, #eform, #ndform) :is(input, textarea)::placeholder { text-transform: none; }

/* ======================= Censo HOL ======================= */
:root { --hol-navy: #143a70; }

/* Logo do HOL no topo e no login */
.brand-logo { height: 34px; width: auto; border-radius: 0 !important; background: #fff; padding: 2px 4px; }
.login-logo { display: block; width: 190px; height: auto; margin: 0 auto 18px; border-radius: 0 !important; }
.login h1, .login > p { text-align: center; }
.login { border-top: 4px solid var(--hol-navy); }

/* Indicadores: 5 colunas (total, 3 UAIs, sem visita) e a ocupação em texto */
.kpi small { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: -2px; }
.kpis.kpis-6 { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1000px) { .kpis.kpis-6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .kpis.kpis-6 { grid-template-columns: repeat(2, 1fr); } .kpis.kpis-6 .kpi:first-child { grid-column: auto; } }
.kpi.setor b { color: var(--c); }
.chip.chip-risco { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); font-weight: 700; }
.chip.chip-risco.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.grupo h2 .ocup { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 2px; }

/* Aviso: cirúrgicos com risco pendente */
.aviso-risco {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin-bottom: 16px; padding: 14px 18px;
  border-radius: var(--radius); border: 0; background: var(--danger); color: #fff; box-shadow: 0 10px 28px rgb(220 38 38 / .28);
}
.aviso-risco .aviso-icone { background: rgb(255 255 255 / .18); color: #fff; }
.aviso-risco .grow { flex: 1; min-width: 0; }
.aviso-risco b { display: block; font-size: 15px; }
.aviso-risco small { display: block; opacity: .92; font-size: 13px; margin-top: 2px; }
.aviso-risco .btn { background: #fff; color: var(--danger); border-color: #fff; }

/* Faixa cirúrgica no topo do card */
.card.risco { border: 3px solid var(--danger); padding-top: 0; box-shadow: 0 6px 22px rgb(220 38 38 / .18); }
.faixa-cir {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 -16px; padding: 8px 16px;
  font-size: 12.5px; border-radius: 6px 6px 0 0;
}
.faixa-cir b { letter-spacing: .05em; }
.faixa-cir span { font-weight: 600; opacity: .92; }
.faixa-cir span::before { content: "· "; }
.faixa-cir.pendente { background: var(--danger); color: #fff; }
.faixa-cir.liberado { background: var(--ok-soft); color: var(--ok); margin-top: -16px; border-bottom: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.card.iso .faixa-cir.liberado { background: #0f2a1a; color: #86efac; }

/* Visita de hoje */
.visita {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; padding: 7px 8px 7px 12px; border-radius: 6px;
  background: var(--warn-soft); color: var(--warn);
}
.visita > svg { flex: 0 0 auto; }
.visita > span { flex: 1; min-width: 140px; }
.visita small { font-weight: 700; opacity: .8; }
.visita.andamento { background: var(--accent-soft); color: var(--accent); }
.visita.feita { background: var(--ok-soft); color: var(--ok); }
.vbtns { display: flex; gap: 6px; margin-left: auto; }
.vbtn {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 11px; border-radius: 5px; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 12.5px; font-weight: 700;
}
.vbtn svg { width: 14px; height: 14px; }
.vbtn.ghost { background: transparent; color: inherit; border: 1px solid currentColor; opacity: .85; }
.card.iso .visita { background: #1c2533; color: #fde68a; }
.card.iso .visita.feita { color: #86efac; }
.card.iso .visita.andamento { color: #a5b4fc; }

/* Doença de base (CIDs) */
.cids { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cids .rot, .hd span { font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--card-muted); text-transform: uppercase; margin-right: 2px; }
.cid { font-size: 12.5px; color: var(--card-muted); overflow-wrap: anywhere; }
.cid b { font-weight: 700; color: var(--card-ink); }
.hd b { font-weight: 700; }
.badge.paliativo { background: #ccfbf1; color: #0f766e; }
@media (prefers-color-scheme: dark) { .badge.paliativo { background: #134e4a; color: #99f6e4; } }

/* Pendências no card: descrição + etapa e dias em aberto */
.falta-titulo { justify-content: flex-start; }
.falta-titulo .ok-txt, .ok-txt { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.mini-add {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 5px;
  border: 1px dashed var(--line-2); background: transparent; color: var(--card-muted); font-size: 11.5px; font-weight: 700; text-transform: none; letter-spacing: 0;
}
.mini-add:hover { border-color: var(--accent); color: var(--accent); }
button.pend { flex-direction: column; align-items: flex-start; gap: 0; border-radius: 6px; padding: 5px 11px; text-align: left; background: var(--warn-soft); color: var(--warn); }
button.pend span { font-weight: 700; }
button.pend small { font-size: 11px; font-weight: 600; opacity: .85; }
button.pend.atraso { background: var(--danger-soft); color: var(--danger); }
button.pend:hover { border-color: currentColor; }
.card.iso button.pend { background: #3a2f0b; color: #fde68a; }
.card.iso button.pend.atraso { background: #3b1113; color: #fecaca; }
.card.iso .mini-add { border-color: #334155; color: #94a3b8; }
.resolvidas { margin-top: 14px; }
.resolvidas .hist-item svg { color: var(--ok); vertical-align: -3px; }
.pnova { display: grid; grid-template-columns: 190px 1fr 42px; gap: 8px; margin-bottom: 8px; }
.pnova select, .pnova input { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.pnova input { text-transform: uppercase; }
@media (max-width: 560px) { .pnova { grid-template-columns: 1fr 42px; } .pnova input { grid-column: 1; } }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Leitos: grade com os livres e ocupados */
.grade-leitos { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.grade-leitos .opt span { width: 100%; justify-content: center; padding: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.grade-leitos .opt.ocupado span { opacity: .45; text-decoration: line-through; cursor: not-allowed; background: var(--surface); }
input.curto { max-width: 160px; }
.opts.risco .opt:first-child input:checked + span { background: var(--danger); border-color: var(--danger); color: #fff; }
.opts.risco .opt:last-child input:checked + span { background: var(--ok); border-color: var(--ok); color: #fff; }
.field select { appearance: auto; }

/* CID: linhas com remover e a busca */
.cid-linha { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.cid-linha .cid-busca { flex: 1; min-width: 0; }
.cid-busca input { width: 100%; min-height: 46px; padding: 10px 13px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface-2); }
.cid-busca input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.invalid .cid-busca input { border-color: var(--danger); background: var(--danger-soft); }
:is(#pform, #eform) input.cid-input { text-transform: none; }

/* Saída: opção de engano separada */
.opts.engano { margin-top: -6px; margin-bottom: 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.opts.engano .opt span { color: var(--muted); font-size: 13px; }

/* Estatísticas */
.rel-card.largo { grid-column: 1 / -1; }
.rel-card.largo .bar-row { grid-template-columns: minmax(160px, 34%) 1fr 120px; }
.bar-val small { white-space: nowrap; }
@media (max-width: 560px) { .rel-card.largo .bar-row { grid-template-columns: minmax(110px, 40%) 1fr 90px; } }

.selo-tempo { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; padding: 6px 9px; border-radius: 6px; line-height: 1.05; text-align: center;
  background: var(--surface-2); color: var(--card-ink, var(--ink)); border: 1px solid var(--line); }
.selo-tempo svg { width: 13px; height: 13px; opacity: .7; }
.selo-tempo b { font-size: 17px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.selo-tempo small { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .7; }
.selo-tempo.medio { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.selo-tempo.alto { background: #dc2626; color: #fff; border-color: #dc2626; box-shadow: 0 4px 12px rgb(220 38 38 / .3); }
.selo-tempo.alto svg, .selo-tempo.alto small { opacity: .9; }
.card.iso .selo-tempo:not(.medio):not(.alto) { background: #1c2533; color: #e2e8f0; border-color: #334155; }
@media (prefers-color-scheme: dark) {
  .selo-tempo.medio { background: #3a2c0b; color: #fde68a; border-color: #b45309; }
  .selo-tempo.alto { background: #b91c1c; border-color: #ef4444; }
}


/* Card: informação secundária discreta */
.card { min-width: 0; }
.card-id, .hd, .falta, .card-sec { min-width: 0; overflow-wrap: anywhere; }
.card-sec { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--card-muted); }
.status-txt { font-weight: 600; color: var(--card-ink); }
.status-txt.ok { color: var(--ok); }
.card-sec .cids { gap: 4px 8px; }
.card-rodape { justify-content: flex-end; }
.ult-alt { margin: 0 0 10px; }
button.pend { max-width: 100%; }

/* Celular: topo enxuto, com os indicadores fixos ao rolar */
@media (max-width: 560px) {
  main { padding-top: 12px; }
  .page-head { align-items: center; margin-bottom: 10px; gap: 8px; }
  .page-head > div:first-child { min-width: 150px; }
  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 12.5px; margin-top: 2px; }
  .kpis:not(.kpis-6) {
    position: sticky; top: calc(env(safe-area-inset-top) + 56px); z-index: 10;
    grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin: 0 -16px 8px; padding: 6px 16px; background: var(--bg);
  }
  .kpis:not(.kpis-6) .kpi { grid-column: auto; padding: 6px 2px; gap: 2px; align-items: center; text-align: center; border-radius: 6px; box-shadow: none; }
  .kpis:not(.kpis-6) .kpi span { font-size: 10.5px; line-height: 1.15; justify-content: center; gap: 3px; }
  .kpis:not(.kpis-6) .kpi b { font-size: 18px; }
  .kpis:not(.kpis-6) .kpi small, .kpis:not(.kpis-6) .kpi .dot { display: none; }
  .aviso-risco { padding: 10px 12px; gap: 10px; margin-bottom: 8px; box-shadow: none; }
  .aviso-risco .aviso-icone, .aviso-risco small { display: none; }
  .aviso-risco b { font-size: 13.5px; }
  .aviso-risco .btn { min-height: 32px; padding: 0 12px; }
  .search { height: 40px; margin-top: 0; }
  .grupo h2 { margin: 16px 0 8px; }
}
.grupo h2 { flex-wrap: wrap; row-gap: 2px; }

/* ======================= Identidade HOL: quadro de enfermaria ======================= */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url(fonts/plex-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url(fonts/plex-500.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url(fonts/plex-600.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-display: swap; src: url(fonts/plex-700.woff2) format("woff2"); }

/* Topo azul-marinho, com o logo num bloco branco */
.topbar {
  background: var(--hol-navy); backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: 0; color: #fff;
  padding-top: calc(env(safe-area-inset-top) + 8px); padding-bottom: 8px;
}
.brand small { color: rgb(255 255 255 / .72); }
.brand-logo { height: 38px; padding: 3px 6px; border-radius: 4px !important; }
.topbar .btn { background: transparent; border-color: rgb(255 255 255 / .45); color: #fff; }
.topbar .btn:hover { border-color: #fff; }
.topbar .btn.internar { background: #fff; border-color: #fff; color: var(--hol-navy); }
.avatar { border-radius: 6px; background: rgb(255 255 255 / .16); }
.lista-item .avatar { background: var(--accent); }
.menu-list { color: var(--ink); }

.page-head h1 { letter-spacing: -.01em; }
.kpi { padding: 10px 14px; box-shadow: none; gap: 3px; }
.kpi span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi b { font-size: 26px; letter-spacing: -.01em; font-weight: 600; }
.kpi.setor b { color: inherit; }
.chip { height: 32px; font-size: 12.5px; }
.search { height: 42px; }

/* Visita pendente deixa de ser alerta: tom neutro */
.visita { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.visita.andamento, .visita.feita { border-color: transparent; }
.card.iso .visita { color: #e2e8f0; border-color: #334155; }

/* Alternar mapa e lista */
.modo-seg { flex: 0 0 auto !important; min-width: 0 !important; display: inline-flex; border: 1px solid var(--line-2); border-radius: 5px; overflow: hidden; background: var(--surface); }
.modo-seg button { border: 0; background: none; padding: 7px 16px; font-size: 13px; font-weight: 600; color: var(--muted); }
.modo-seg button.on { background: var(--hol-navy); color: #fff; }

/* Título da UAI */
.grupo h2 { padding-bottom: 7px; border-bottom: 2px solid var(--setor, var(--hol-navy)); }
.grupo h2 i { display: none; }
.grupo h2 .prog-visita { margin-left: auto; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.grupo h2 .prog-visita b { font-weight: 700; }

/* Mapa de leitos */
.mapa-bloco { margin-bottom: 12px; }
.mapa-bloco h3 { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mapa { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(168px, 100%), 1fr)); }
@media (max-width: 560px) { .mapa { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cel {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; min-height: 112px; padding: 7px 9px; text-align: left;
  background: var(--surface); border: 1px solid var(--line-2); border-top: 3px solid var(--setor); border-radius: 4px; color: var(--ink);
}
.cel:hover { border-color: var(--accent); }
.cel-topo { display: flex; justify-content: space-between; align-items: baseline; }
.cel-topo b { font-size: 16px; font-weight: 700; }
.cel-nome { font-size: 12.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.cel-mot { font-size: 11.5px; color: var(--muted); line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cel-sinais { display: flex; flex-wrap: wrap; gap: 3px; margin-top: auto; padding-top: 4px; }
.cel .sin { font-size: 10.5px; padding: 0 5px; }
.cel.risco { border-color: var(--danger); border-top-color: var(--danger); background: var(--danger-soft); }
.cel.iso { background: #0b0f14; color: #f1f5f9; border-color: #000; }
.cel.iso .cel-mot, .cel.iso .lin-d:not(.medio):not(.alto) { color: #94a3b8; }
.cel.iso .sin.nenhuma, .cel.iso .sin.pend { background: #1c2533; color: #e2e8f0; }
.cel.iso .sin.iso { display: none; }
.cel.livre { background: transparent; border-style: dashed; border-top: 1px dashed var(--line-2); color: var(--muted); min-height: 0; }
.cel.livre .cel-topo b { font-weight: 500; }
.cel.apagado { opacity: .22; }
.vazio.curto { padding: 18px; margin-top: 0; }

/* Lista: tabela de plantão */
.lin-head, .linha { display: grid; grid-template-columns: 54px minmax(170px, 1.5fr) 46px minmax(130px, 1.3fr) minmax(150px, 1.3fr) 118px minmax(120px, 1fr); gap: 10px; align-items: center; }
.lin-head { position: sticky; top: 54px; z-index: 5; padding: 7px 10px; margin-top: 8px; background: var(--hol-navy); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; border-radius: 4px 4px 0 0; }
.linhas { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.linha { width: 100%; padding: 8px 10px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); color: var(--ink); }
.linha:first-child { border-top: 0; }
.linha:hover { background: var(--surface-2); }
.linha.risco { box-shadow: inset 4px 0 0 var(--danger); }
.lin-leito { min-width: 0; padding: 5px 2px; border-radius: 4px; font-size: 14px; font-weight: 700; text-align: center; background: color-mix(in srgb, var(--setor) 12%, transparent); color: color-mix(in srgb, var(--setor) 85%, var(--ink)); }
.lin-leito.iso { background: #0b0f14; color: #fff; }
.lin-nome { min-width: 0; display: flex; flex-direction: column; }
.lin-nome b { font-size: 13.5px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.lin-nome small { font-size: 11.5px; color: var(--muted); }
.lin-d { font-style: normal; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.lin-d.medio { color: var(--warn); }
.lin-d.alto { color: var(--danger); }
.lin-mot { min-width: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.3; }
.lin-pend { min-width: 0; font-size: 12px; line-height: 1.3; }
.so-tabela { display: flex; flex-direction: column; }
.so-tabela small { color: var(--muted); }
.so-celular { display: none; }
.txt-atraso { color: var(--danger); font-weight: 600; }
.txt-ok { color: var(--muted); }
.lin-sin { display: flex; flex-wrap: wrap; gap: 3px; }
.sin { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 3px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.sin svg { width: 12px; height: 12px; }
.sin.risco { background: var(--danger); color: #fff; }
.sin.lib, .sin.feita { background: var(--ok-soft); color: var(--ok); }
.sin.andamento { background: var(--accent-soft); color: var(--accent); }
.sin.nenhuma { color: var(--muted); }
.sin.pend, .sin.ficha { background: var(--warn-soft); color: var(--warn); }
.sin.atraso { background: var(--danger-soft); color: var(--danger); }
.sin.iso { background: #0b0f14; color: #fff; }
.sin.alergia { background: #fce7f3; color: #be185d; }
@media (prefers-color-scheme: dark) { .sin.alergia { background: #4a1230; color: #fbcfe8; } .sin.iso { background: #000; } }
@media (max-width: 900px) {
  .lin-head { display: none; }
  /* Linhas empilhadas: leito à esquerda, dia à direita e os sinais na mesma linha. */
  .linha { display: block; position: relative; padding: 9px 10px 9px 64px; }
  .lin-leito { position: absolute; left: 10px; top: 9px; width: 44px; padding: 7px 2px; }
  .lin-d { position: absolute; right: 10px; top: 9px; }
  .lin-nome { padding-right: 40px; }
  .lin-mot { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
  .lin-pend, .lin-vis, .lin-sin { display: inline-flex; flex-wrap: wrap; gap: 3px; vertical-align: top; margin: 0 3px 3px 0; }
  .so-tabela { display: none; }
  .so-celular { display: inline-flex; }
}

/* Painel do paciente */
.painel { padding: 12px; }
.painel .card { cursor: pointer; border: 1px solid var(--line); box-shadow: none; }
.painel .card:hover { transform: none; box-shadow: none; }
.painel .card-rodape { justify-content: flex-start; }
.faixa-cir span::before { content: none; }

/* Topo no celular */
@media (max-width: 560px) {
  .brand-logo { height: 32px; }
  .brand small, .topbar #btn-pdf span { display: none; }
  .topbar .btn { padding: 0 10px; min-height: 36px; font-size: 13px; }
  .topbar .btn.internar span { font-size: 0; }
  .topbar .btn.internar span::after { content: "Internar"; font-size: 13px; }
  .avatar { width: 36px; height: 36px; font-size: 13px; }
  .kpis:not(.kpis-6) .kpi span { text-transform: none; letter-spacing: 0; }
}

/* Anotação da visita */
.nota-visita { display: flex; flex-direction: column; gap: 4px; }
.nota-visita label, .notas-lista .rot { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--card-muted); }
.nota-visita textarea {
  width: 100%; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.4; font-size: 16px; /* 16px: o iPhone não dá zoom ao tocar */
  border: 1px solid var(--line-2); border-radius: 4px; background: var(--surface); color: var(--ink);
}
.nota-visita textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.nota-status { font-size: 11.5px; color: var(--card-muted); }
.nota-status.erro { color: var(--danger); font-weight: 600; }
.notas-lista { display: flex; flex-direction: column; gap: 6px; cursor: default; }
.nota-item { font-size: 13px; line-height: 1.35; padding: 6px 9px; background: var(--surface-2); border-left: 3px solid var(--line-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.nota-item small { display: block; font-size: 11px; font-weight: 600; color: var(--card-muted); }
.card.iso .nota-visita textarea { background: #131a24; color: #f1f5f9; border-color: #334155; }
.card.iso .nota-item { background: #1c2533; border-left-color: #334155; }
.nota-ro { display: block; font-weight: 400; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
