/* ================================================
   PSC Saúde — Folha de Estilos Principal
   Design: profissional, neutro, minimalista
   ================================================ */

/* ── Variáveis ── */
:root {
  --bg:          #f0ede8;
  --surface:     #ffffff;
  --surface-2:   #f9f7f5;
  --border:      #e3ddd6;
  --border-2:    #cdc5bb;

  --sidebar-bg:  #2c2620;
  --sidebar-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.07);
  --sidebar-text: #a89d93;
  --sidebar-section: #7a6f65;

  --primary:     #6b4f2a;
  --primary-dk:  #4e3618;
  --primary-lt:  #f5f0ea;

  --text:        #1a1510;
  --text-2:      #3d3028;
  --text-3:      #7a6f65;
  --text-4:      #a89d93;

  --success-bg:  #f0fdf4;
  --success:     #166534;
  --success-bd:  #86efac;
  --warning-bg:  #fffbeb;
  --warning:     #92400e;
  --warning-bd:  #fcd34d;
  --danger-bg:   #fef2f2;
  --danger:      #991b1b;
  --danger-bd:   #fca5a5;
  --info-bg:     #f5f0ea;
  --info:        #6b4f2a;
  --info-bd:     #d4bfa0;

  --radius:      6px;
  --radius-lg:   10px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:      0 4px 12px rgba(0,0,0,.07), 0 1px 3px rgba(0,0,0,.05);
  --shadow-lg:   0 10px 30px rgba(0,0,0,.10), 0 4px 10px rgba(0,0,0,.06);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── Views ── */
.view { display: none; height: 100vh; }
.view.active { display: block; }

/* ════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════ */
.login-bg {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  overflow: hidden;
}

.login-accent-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, #9c7040 100%);
}

.login-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
}

.login-logo-mark {
  width: 44px;
  height: 44px;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 300;
  flex-shrink: 0;
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.login-instruction {
  padding: 22px 32px 4px;
  font-size: 20px;
  color: var(--text);
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.form-alert {
  margin: 12px 32px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid;
}
.form-alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-bd); }

.login-card .form-group { padding: 12px 32px 0; }
.login-card .btn-full { margin: 20px 32px; width: calc(100% - 64px); }

/* Seletor de unidade no login (opções clicáveis em forma de card) */
.unidade-opts { display: flex; flex-direction: column; gap: 10px; }
.unidade-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.unidade-opt::before {
  content: "";
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 50%;
  flex: 0 0 auto;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.unidade-opt:hover { border-color: var(--primary); background: var(--primary-lt); }
.unidade-opt.selected {
  border-color: var(--primary);
  background: var(--primary-lt);
  box-shadow: 0 0 0 1px var(--primary);
}
.unidade-opt.selected::before {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.login-demo {
  text-align: center;
  font-size: 11px;
  color: var(--text-4);
  padding: 0 32px 24px;
}

.login-footer {
  font-size: 11px;
  color: var(--text-4);
}

/* ── Logo no login ── */
.login-logo-dark {
  background: var(--bg);
  padding: 28px 32px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  border-radius: 12px 12px 0 0;
}

.login-logo-img {
  width: 100%;
  max-width: 200px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.login-logo-tagline {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* ── Logo na sidebar ── */
.sidebar-brand-logo {
  background: var(--bg);
  padding: 16px 18px;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo-img {
  width: 100%;
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.sidebar-logo-img {
  width: 100%;
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* ── Olho de senha ── */
.input-wrap { position: relative; }
.input-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-4);
  padding: 4px;
  display: flex;
  align-items: center;
  line-height: 1;
}
.input-eye:hover { color: var(--text-2); }

/* ════════════════════════════════════════════════
   LAYOUT PRINCIPAL
   ════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-admin { background: #141c28; }
.sidebar-prontuario { background: #162032; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-cross {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 300;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.2px;
}

.sidebar-user-badge {
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
  color: var(--sidebar-text);
  line-height: 1.5;
}
.sidebar-user-badge strong { color: rgba(255,255,255,.85); font-weight:600; display:block; font-size:13px; }
.sidebar-user-badge span { color: var(--sidebar-text); font-size:11px; }

.sidebar-nav {
  flex: 1;
  padding: 10px 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--sidebar-text);
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-link:hover { background: var(--sidebar-hover); color: rgba(255,255,255,.8); }
.sidebar-link.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 600; }

.sidebar-link-sub {
  padding-left: 28px;
  font-size: 12px;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: .7;
}
.sidebar-link.active .nav-icon { opacity: 1; }

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.06);
  margin: 8px 10px;
}

.sidebar-section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sidebar-section);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.sidebar-submenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  transition: max-height .2s;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: auto;
}

.btn-logout, .btn-back {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.1);
  background: transparent;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background .15s, color .15s;
  text-align: left;
}
.btn-logout:hover, .btn-back:hover {
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.8);
}

/* ── Main ── */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.app-topbar {
  display: none;
}

.topbar-title { display: none; }

.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Cabeçalho do dashboard ── */
.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.dash-hero-text {}
.dash-greeting {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.dash-date {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── Prontuário sidebar patient card ── */
.pront-patient-card {
  margin: 12px 10px;
  background: rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid rgba(255,255,255,.08);
}
.pront-patient-card .pront-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}
.pront-patient-card .pront-meta {
  font-size: 11px;
  color: var(--sidebar-text);
  line-height: 1.6;
}

/* ════════════════════════════════════════════════
   FORMULÁRIOS
   ════════════════════════════════════════════════ */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.form-control::placeholder { color: var(--text-4); }

select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

.form-row {
  display: grid;
  gap: 12px;
}
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

/* ════════════════════════════════════════════════
   BOTÕES
   ════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:focus { outline: none; }

.btn-full { width: 100%; padding: 10px 16px; font-size: 14px; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dk); border-color: var(--primary-dk); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border-2);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-bd);
}
.btn-danger:hover { background: #fee2e2; }

.btn-ghost {
  background: transparent;
  color: var(--text-3);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ════════════════════════════════════════════════
   CARDS / PAINÉIS
   ════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.1px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
}

.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Stat cards ── */
.stat-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--border-2);
}
.stat-card.blue  { border-left-color: var(--primary); }
.stat-card.green { border-left-color: #16a34a; }
.stat-card.amber { border-left-color: #d97706; }
.stat-card.slate { border-left-color: #64748b; }
.stat-card.red   { border-left-color: #dc2626; }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
  line-height: 1;
}
.stat-note {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 4px;
}

/* ════════════════════════════════════════════════
   TABELAS
   ════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead tr {
  border-bottom: 2px solid var(--border);
}
.data-table th {
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  text-align: left;
  white-space: nowrap;
  background: var(--surface-2);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .empty-row td {
  text-align: center;
  color: var(--text-4);
  padding: 32px;
  font-size: 13px;
}

/* ── Linha clicável ── */
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover td { color: var(--text); }

/* ════════════════════════════════════════════════
   BADGES / PILLS
   ════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-blue    { background: var(--info-bg);    color: var(--info); }
.badge-green   { background: var(--success-bg); color: var(--success); }
.badge-amber   { background: var(--warning-bg); color: var(--warning); }
.badge-red     { background: var(--danger-bg);  color: var(--danger); }
.badge-slate   { background: #f1f5f9; color: #475569; }
.badge-neutral { background: #f3f4f6; color: #374151; }

/* ════════════════════════════════════════════════
   PESQUISA / FILTROS
   ════════════════════════════════════════════════ */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-input-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}
.search-input-wrap input {
  padding-left: 34px;
}

/* ════════════════════════════════════════════════
   ALERTA / AVISO
   ════════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  border: 1px solid;
  margin-bottom: 16px;
  line-height: 1.5;
}
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-bd); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-bd); }

/* ════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.45);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-box.modal-lg { max-width: 800px; }
.modal-box.modal-sm { max-width: 440px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.modal-close {
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text-4);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--surface-2); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  pointer-events: auto;
  animation: toast-in .2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid rgba(255,255,255,.4);
}
.toast.toast-success { background: #166534; border-left-color: #4ade80; }
.toast.toast-error   { background: #991b1b; border-left-color: #f87171; }
.toast.toast-info    { background: #1e40af; border-left-color: #93c5fd; }
.toast.toast-warning { background: #92400e; border-left-color: #fbbf24; }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ════════════════════════════════════════════════
   DASHBOARD WIDGETS
   ════════════════════════════════════════════════ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.activity-list { list-style: none; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-text { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--text-4); margin-top: 2px; }

/* ════════════════════════════════════════════════
   PRONTUÁRIO — conteúdo das abas
   ════════════════════════════════════════════════ */
.pront-section {
  margin-bottom: 24px;
}

.pront-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.pront-entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.pront-entry-meta {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.pront-entry-meta strong { color: var(--text-2); }
.pront-entry-body { font-size: 13px; color: var(--text-2); line-height: 1.6; }

.pront-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-4);
  font-size: 13px;
}
.pront-empty strong { display: block; font-size: 15px; color: var(--text-3); margin-bottom: 6px; }

/* Pill de CID */
.cid-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

/* Documento card */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  background: var(--surface);
}
.doc-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.doc-card-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.doc-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  word-break: break-word;
  line-height: 1.3;
}
.doc-card-date { font-size: 11px; color: var(--text-4); margin-top: 4px; }

/* ════════════════════════════════════════════════
   UTILITÁRIOS
   ════════════════════════════════════════════════ */
.text-muted { color: var(--text-3); }
.text-sm    { font-size: 12px; }
.text-xs    { font-size: 11px; }
.text-right { text-align: right; }
.text-center { text-align: center; }

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex    { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center  { display: flex; align-items: center; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }

.divider { height: 1px; background: var(--border); margin: 20px 0; }

/* ════════════════════════════════════════════════
   EVOLUÇÃO DE ENFERMAGEM — Timeline
   ════════════════════════════════════════════════ */

.ev-entrada-card .card-header { gap: 12px; }

.ev-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
  font-size: 13px;
}

.ev-timeline {
  position: relative;
  padding-left: 28px;
}

.ev-timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.ev-item {
  position: relative;
  margin-bottom: 20px;
}

.ev-timeline-dot {
  position: absolute;
  left: -24px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-2);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--border-2);
  z-index: 1;
}

.ev-dot-latest {
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.ev-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.ev-item-latest .ev-card {
  border-color: #bfdbfe;
  box-shadow: 0 0 0 1px #bfdbfe, var(--shadow-sm);
}

.ev-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
  gap: 8px;
}

.ev-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ev-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.ev-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ev-prof {
  font-size: 12px;
  color: var(--text-3);
}

.ev-sinais {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.ev-sinal {
  flex: 1;
  min-width: 90px;
  padding: 8px 14px;
  border-right: 1px solid var(--border);
  text-align: center;
}
.ev-sinal:last-child { border-right: none; }

.ev-sinal-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 3px;
}

.ev-sinal-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ev-texto {
  padding: 16px 18px;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.75;
  white-space: pre-wrap;
}

/* Scrollbar sutil */
::-webkit-sc
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); }

/* ================================================
   DASHBOARD - Layout e componentes
   ================================================ */

.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.dash-greeting {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}
.dash-date {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 2px;
}

.dashboard-grid-3 {
  display: grid;
  grid-template-columns: 1fr 480px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) {
  .dashboard-grid-3 { grid-template-columns: 1fr; }
}

.dash-col-side {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
}
.stat-card.blue  { border-left-color: #3b82f6; }
.stat-card.green { border-left-color: #22c55e; }
.stat-card.amber { border-left-color: #f59e0b; }
.stat-card.slate { border-left-color: #94a3b8; }

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-note {
  font-size: 11px;
  color: var(--text-4);
  margin-top: 4px;
}

.evol-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.evol-item:last-child { border-bottom: none; }
.evol-item:hover { background: var(--surface-2); }

.evol-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.evol-pac-nome {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.evol-meta {
  font-size: 12px;
  color: var(--text-3);
}
.evol-sinais {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.evol-sinais span {
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: 4px;
  padding: 2px 7px;
}
.evol-texto {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 4px;
}
.evol-author {
  font-size: 11px;
  color: var(--text-4);
}

.recado-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.recado-item:last-child { border-bottom: none; }
.recado-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.recado-texto {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 3px;
}
.recado-meta {
  font-size: 11px;
  color: var(--text-4);
}

.badge-amber {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fcd34d;
}
.badge-green {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-bd);
}

.pront-empty {
  padding: 20px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-4);
}

/* ================================================
   PARAMETRIZACAO
   ================================================ */
.param-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.param-row:last-of-type { border-bottom: none; }
.param-info { flex: 1; }
.param-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.param-desc {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
}
.param-control {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Documentos no cadastro do paciente */
.doc-upload-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}
.doc-upload-row:last-child { border-bottom: none; }
.doc-upload-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  min-width: 140px;
}
.doc-upload-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.doc-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.doc-link {
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.doc-link:hover { color: var(--primary-dk); }

/* Botão Iniciar / Encerrar Atendimento (sidebar prontuário) */
.btn-atendimento {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  margin-bottom: 8px;
  transition: opacity .15s;
  text-align: center;
}
.btn-atendimento:hover { opacity: .85; }
.btn-atendimento-start {
  background: #dcfce7;
  color: #166534;
}
.btn-atendimento-externo {
  background: #dbeafe;
  color: #1e40af;
}
.btn-atendimento-stop {
  background: #fee2e2;
  color: #991b1b;
}

/* ════════════════════════════════════════════════
   RESPONSIVO — sidebar vira drawer (hambúrguer) em telas pequenas
   ════════════════════════════════════════════════ */
.hamburger {
  display: none;            /* só aparece no mobile (media query abaixo) */
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  color: var(--text-2);
  padding: 4px 8px;
  border-radius: var(--radius, 8px);
}
.hamburger:hover { background: rgba(0,0,0,.06); }

.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.45);
  z-index: 900;             /* abaixo do modal (1000) e do drawer (950) */
}
.sidebar-overlay.show { display: block; }

@media (max-width: 1000px) {
  /* Barra superior fininha só no mobile, com o botão de menu */
  .app-topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
  }
  .topbar-title { display: block; font-size: 16px; font-weight: 700; margin-right: auto; }
  .hamburger { display: inline-flex; align-items: center; }

  /* Sidebar deixa de ocupar espaço e vira gaveta deslizante */
  .app-layout .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 264px;
    max-width: 82vw;
    z-index: 950;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,.3);
  }
  .app-layout.sidebar-open .sidebar { transform: translateX(0); }

  /* Conteúdo ocupa toda a largura e respira menos apertado */
  .app-content { padding: 16px; }
  .table-wrap { overflow-x: auto; }   /* tabelas largas rolam na horizontal */
}
