/* =============================================
   Hospital360 - Sistema de Gestão Hospitalar
   CSS Principal
   ============================================= */

:root {
  --primary:     #2563eb;
  --primary-dark:#1d4ed8;
  --secondary:   #64748b;
  --success:     #16a34a;
  --danger:      #dc2626;
  --warning:     #d97706;
  --info:        #0284c7;
  --bg:          #f1f5f9;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --sidebar-bg:  #1e293b;
  --sidebar-text:#cbd5e1;
  --sidebar-active: #2563eb;
  --navbar-bg:   #1e293b;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ========== NAVBAR ========== */
.navbar {
  --navbar-logo-width: clamp(122px, 10vw, 160px);
  --navbar-logo-height: 42px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px;
  background: var(--navbar-bg);
  display: flex; align-items: center;
  padding: 0 1.25rem; gap: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.navbar-brand { display: flex; align-items: center; gap: .5rem; }
.brand-icon { font-size: 1.5rem; }
.brand-text { font-size: 1.1rem; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.brand-logo-wrap {
  display: flex; align-items: center; justify-content: center;
  width: var(--navbar-logo-width);
  height: var(--navbar-logo-height);
  padding: 0;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.navbar-info {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  min-width: 0;
}
.clock { color: #94a3b8; font-size: .85rem; font-variant-numeric: tabular-nums; }
.context-pill {
  min-width: 0; max-width: 460px;
  display: inline-flex; align-items: center; gap: .45rem;
  color: #e2e8f0; text-decoration: none;
  border: 1px solid rgba(148,163,184,.35);
  background: rgba(15,23,42,.45);
  border-radius: 999px;
  padding: .25rem .65rem;
  font-size: .75rem;
}
.context-pill strong {
  display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .76rem; font-weight: 600;
}
.context-pill small {
  color: #cbd5e1;
  font-size: .68rem;
  white-space: nowrap;
}
.context-pill:hover { background: rgba(30,64,175,.45); color: #fff; }
.context-pill-empty { border-color: rgba(251,191,36,.5); color: #fef3c7; }
.tab-bar {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--border);
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .9rem;
  margin-bottom: -2px;
  padding: .5rem 1rem;
  text-decoration: none;
}
.tab-btn.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}
.navbar-user { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.user-info {
  display: flex; flex-direction: column; align-items: flex-end;
  min-width: 0; max-width: min(34vw, 360px);
  line-height: 1.15;
}
.user-info strong,
.user-info small {
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-info strong { color: #f1f5f9; font-size: .9rem; }
.user-info small { color: #94a3b8; font-size: .75rem; }
.user-info .user-unit { color: #cbd5e1; font-size: .68rem; }

/* ========== LAYOUT ========== */
.main-container {
  display: flex;
  margin-top: 56px;
  min-height: calc(100vh - 56px);
}
.sidebar {
  width: 220px; min-width: 220px;
  background: var(--sidebar-bg);
  padding: 1rem 0;
  position: fixed; top: 56px; left: 0; bottom: 0;
  overflow-y: auto;
}
.sidebar-menu { list-style: none; }
.sidebar-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: .88rem;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-link.active { background: var(--sidebar-active); color: #fff; border-right: 3px solid #60a5fa; }
.menu-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.menu-icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.content-area, .main-content-area {
  margin-left: 220px;
  padding: 1.5rem;
  flex: 1;
  max-width: calc(100vw - 220px);
}
.main-content-area { display: contents; }

/* ========== CARDS / SECTIONS ========== */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.section-title {
  font-size: .95rem; font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--border);
  color: var(--text);
}
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem;
}
.page-header h2 { font-size: 1.3rem; font-weight: 700; }

/* ========== FORMS ========== */
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group label { font-size: .82rem; font-weight: 500; color: var(--text-muted); }
.form-control {
  width: 100%; padding: .45rem .65rem;
  border: 1px solid var(--border); border-radius: 6px;
  font-size: .88rem; font-family: inherit;
  background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control[readonly] { background: #f8fafc; color: var(--text-muted); }
.form-control-compact { min-width: 110px; padding: .35rem .5rem; font-size: .78rem; }
.required { color: var(--danger); font-size: .8rem; }
.field-hint { font-size: .78rem; margin-top: .15rem; }

.form-grid { display: grid; gap: .75rem; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-6 { grid-template-columns: repeat(6, 1fr); }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.align-end { align-items: end; }

.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.form-actions-inline { display: flex; gap: .5rem; margin-top: .5rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-header .form-actions { margin-top: 0; }
.agenda-actions-stack { display: flex; flex-direction: column; gap: .35rem; min-width: 320px; }
.agenda-row-action { margin-top: 0; }
.form-check { flex-direction: row; align-items: center; gap: .5rem; }

/* Checkbox styling */
.check-label {
  display: flex; align-items: center; gap: .4rem;
  cursor: pointer; font-size: .88rem; color: var(--text);
}
.check-label input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--primary); }
.check-danger { color: var(--danger); font-weight: 600; }
.triagem-checks { display: flex; gap: 1.5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem;
  border: 1px solid transparent; border-radius: 6px;
  font-size: .85rem; font-weight: 500; font-family: inherit;
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--primary);   color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success   { background: var(--success);   color: #fff; border-color: var(--success); }
.btn-success:hover  { background: #15803d; }
.btn-danger    { background: var(--danger);    color: #fff; border-color: var(--danger); }
.btn-danger:hover   { background: #b91c1c; }
.btn-secondary { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.btn-info      { background: var(--info);      color: #fff; border-color: var(--info); }
.btn-warning   { background: var(--warning);   color: #fff; border-color: var(--warning); }
.btn-outline   { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-outline-danger { background: transparent; color: var(--danger); border-color: var(--danger); padding: .3rem .6rem; font-size: .78rem; }
.btn-outline-danger:hover { background: var(--danger); color: #fff; }
.btn-sm  { padding: .3rem .6rem; font-size: .78rem; }
.btn-block, .w-full { width: 100%; justify-content: center; }

/* ========== ALERTS ========== */
.alert {
  padding: .75rem 1rem; border-radius: 6px;
  margin-bottom: 1rem; font-size: .88rem;
  border-left: 4px solid;
}
.alert-success { background: #f0fdf4; color: #166534; border-color: var(--success); }
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: var(--danger); }
.alert-warning { background: #fffbeb; color: #92400e; border-color: var(--warning); }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: var(--info); }

/* ========== TABLES ========== */
.table-wrapper { overflow-x: auto; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem;
}
.data-table th {
  background: #f8fafc; color: var(--text-muted);
  font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .5px;
  padding: .6rem .75rem; text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: .6rem .75rem; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: #f8fafc; }
.row-inactive { opacity: .55; }
.actions-cell { white-space: nowrap; display: flex; gap: .3rem; }

/* ========== BADGES ========== */
.badge {
  display: inline-flex; align-items: center;
  padding: .2rem .5rem; border-radius: 99px;
  font-size: .72rem; font-weight: 600;
  white-space: nowrap;
}
.badge-success  { background: #dcfce7; color: #166534; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-warning  { background: #fef9c3; color: #854d0e; }
.badge-primary  { background: #dbeafe; color: #1e40af; }
.badge-secondary{ background: #f1f5f9; color: #475569; }

/* Manchester protocol badges */
.badge-manchester-vermelho { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-manchester-laranja  { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.badge-manchester-amarelo  { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.badge-manchester-verde    { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.badge-manchester-azul     { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* Row colors for Manchester */
tr.manchester-vermelho td { border-left: 3px solid #ef4444; }
tr.manchester-laranja  td { border-left: 3px solid #f97316; }
tr.manchester-amarelo  td { border-left: 3px solid #eab308; }
tr.manchester-verde    td { border-left: 3px solid #22c55e; }
tr.manchester-azul     td { border-left: 3px solid #3b82f6; }

/* ========== STATS CARDS ========== */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; margin-bottom: 1.25rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: var(--shadow);
}
.stat-blue   { border-top: 3px solid var(--primary); }
.stat-green  { border-top: 3px solid var(--success); }
.stat-orange { border-top: 3px solid var(--warning); }
.stat-purple { border-top: 3px solid #7c3aed; }
.stat-icon { font-size: 2rem; }
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-label  { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* ========== ACTION GRID ========== */
.action-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 1.2rem .75rem;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text); font-size: .85rem; font-weight: 500;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
  text-align: center;
}
.action-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.action-icon { font-size: 1.8rem; }

/* ========== ATENDIMENTO HEADER ========== */
.atendimento-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: .75rem 1.25rem;
  margin-bottom: 1.25rem;
  font-size: .88rem;
}
.header-user { color: var(--text-muted); }
.header-ficha { text-align: center; }
.ficha-label { display: block; font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.ficha-número { font-size: 1.5rem; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.header-clock { color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ========== AUTOCOMPLETE ========== */
.autocomplete-wrapper { position: relative; }
.autocomplete-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 200;
  background: var(--surface); border: 1px solid var(--border);
  border-top: none; border-radius: 0 0 6px 6px;
  max-height: 200px; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.autocomplete-dropdown.hidden { display: none; }
.autocomplete-item { padding: .5rem .75rem; cursor: pointer; font-size: .88rem; }
.autocomplete-item:hover { background: #f0f7ff; color: var(--primary); }

/* ========== INFO GRID ========== */
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem; font-size: .88rem;
}
.info-grid div { padding: .4rem 0; }
.history-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.history-results-note {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.history-counts {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.history-results-window {
  max-height: min(72vh, 980px);
  overflow-y: auto;
  padding-right: .35rem;
}
.history-results-window::-webkit-scrollbar {
  width: 10px;
}
.history-results-window::-webkit-scrollbar-track {
  background: #e2e8f0;
  border-radius: 999px;
}
.history-results-window::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 999px;
}
.history-entry {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .05);
}
.history-entry:last-child {
  margin-bottom: 0;
}
.history-entry-latest {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}
.history-entry-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}
.history-entry-badges {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}
.history-entry-date {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .2rem;
  text-align: right;
}
.history-entry-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}
.history-detail-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem;
}
.history-detail-title {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: .45rem;
}
.history-detail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: 0;
  padding: 0;
  font-size: .86rem;
}
.history-detail-list li {
  line-height: 1.35;
}
.history-detail-empty {
  font-size: .84rem;
}
.history-entry-codes {
  margin-top: .85rem;
}
.history-source {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.history-source small,
.history-meta small,
.history-code-title,
.history-code-empty {
  color: var(--text-muted);
}
.history-meta {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
}
.history-code-stack {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.history-code-group {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .7rem;
}
.history-code-title {
  font-size: .74rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .35rem;
}
.history-code-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  margin: 0;
  padding: 0;
}
.history-code-list li {
  display: flex;
  align-items: flex-start;
  gap: .45rem;
  line-height: 1.35;
}
.info-box {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 6px; padding: 1rem;
  font-size: .88rem;
}
.info-box ul { margin-left: 1.2rem; margin-top: .4rem; }
.info-box li { margin-bottom: .25rem; }
.info-box code { background: #e2e8f0; padding: .1rem .35rem; border-radius: 3px; font-size: .82rem; }

/* ========== PATIENT SHELL ========== */
.patient-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 1rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  color: #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-md);
}
.patient-shell-main { min-width: 0; }
.patient-shell-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  color: #93c5fd;
  margin-bottom: .35rem;
}
.patient-shell-header h2 {
  font-size: 1.55rem;
  line-height: 1.15;
  margin-bottom: .45rem;
}
.patient-shell-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  color: #cbd5e1;
  font-size: .84rem;
}
.patient-shell-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
}
.patient-shell-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.summary-metric {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: .9rem;
}
.summary-metric strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}
.summary-metric span {
  display: block;
  font-size: .77rem;
  color: #cbd5e1;
  margin-top: .2rem;
}
.patient-shell-actions {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  align-self: stretch;
  justify-content: center;
}

/* ========== CLINICAL MODULES ========== */
.clinical-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.form-textarea {
  min-height: 84px;
  resize: vertical;
}
.record-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-bottom: 1rem;
}
.record-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem;
  background: #f8fafc;
}
.record-header {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: flex-start;
  margin-bottom: .35rem;
}
.record-item p {
  margin-bottom: .35rem;
  font-size: .86rem;
}
.record-item small {
  color: var(--text-muted);
}

/* ========== MODULE BOARD ========== */
.module-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--primary);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: var(--shadow);
}
.module-live { border-top-color: var(--success); }
.module-build { border-top-color: var(--warning); }
.module-plan { border-top-color: var(--primary); }
.module-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.module-card h3 {
  font-size: 1rem;
}
.module-card p {
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.module-list {
  margin-left: 1rem;
  color: var(--text);
}
.module-list li {
  margin-bottom: .35rem;
}

/* ========== CARE LAYER ========== */
.module-two-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, .9fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.table-cell-wrap {
  min-width: 260px;
  white-space: normal;
}
.module-inline-form {
  display: grid;
  gap: .45rem;
  min-width: 220px;
}
.bed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.bed-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.bed-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}
.bed-card-body {
  display: grid;
  gap: .45rem;
  font-size: .86rem;
}
.bed-card-disponivel { border-top: 3px solid var(--success); }
.bed-card-ocupado { border-top: 3px solid var(--danger); }
.bed-card-bloqueado { border-top: 3px solid var(--warning); }
.bed-card-higienizacao,
.bed-card-manutencao { border-top: 3px solid var(--info); }

/* ========== ATTENTION POPDOWN ========== */
.attention-popdown {
  position: fixed;
  top: 72px;
  right: 20px;
  width: min(420px, calc(100vw - 32px));
  z-index: 1200;
  background: #fff7ed;
  color: #7c2d12;
  border: 1px solid #fdba74;
  border-left: 6px solid #ea580c;
  border-radius: 12px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, .18);
  overflow: hidden;
  transform: translateY(-14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.attention-popdown.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.attention-popdown-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: .9rem 1rem .55rem;
}
.attention-popdown-title {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .03em;
}
.attention-popdown-subtitle {
  display: block;
  color: #9a3412;
  font-size: .8rem;
  margin-top: .2rem;
}
.attention-popdown-close {
  border: 0;
  background: transparent;
  color: #9a3412;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.attention-popdown-body {
  padding: 0 1rem 1rem;
}
.attention-popdown-list {
  list-style: none;
}
.attention-popdown-item {
  padding: .55rem 0;
  border-top: 1px solid rgba(154, 52, 18, .15);
}
.attention-popdown-item strong {
  display: block;
  font-size: .84rem;
}
.attention-popdown-item span {
  display: block;
  font-size: .8rem;
  color: #9a3412;
  margin-top: .2rem;
}
.attention-highlight {
  margin-top: .5rem;
  color: #9a3412;
  font-size: .8rem;
  font-weight: 600;
}

/* ========== SUS BILLING ========== */
.sus-inline-note {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: .65rem .8rem;
  border-radius: 8px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: .84rem;
}
.sus-scroll-pane {
  max-height: 420px;
  overflow-y: auto;
  padding-right: .25rem;
}
.sus-procedure-row {
  display: grid;
  gap: .2rem;
  padding: .65rem 0;
  border-top: 1px solid var(--border);
}
.sus-procedure-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.sus-procedure-row strong {
  font-size: .83rem;
  color: var(--primary-dark);
}
.sus-procedure-row span {
  font-size: .82rem;
  color: var(--text);
}

.medication-support-card {
  margin-top: .85rem;
  padding: .85rem 1rem;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
}
.medication-support-title {
  font-size: .82rem;
  font-weight: 800;
  color: #1d4ed8;
  letter-spacing: .02em;
  margin-bottom: .65rem;
}
.medication-support-grid {
  display: grid;
  gap: .65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.medication-support-item {
  display: grid;
  gap: .2rem;
}
.medication-support-item strong {
  font-size: .78rem;
  color: var(--primary-dark);
}
.medication-support-item span {
  font-size: .8rem;
  color: var(--text);
  line-height: 1.5;
}
.module-subsection {
  display: grid;
  gap: .85rem;
}
.stock-summary-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.stock-summary-card {
  display: grid;
  gap: .2rem;
  padding: .9rem 1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
}
.stock-summary-card strong {
  font-size: 1rem;
  color: var(--primary-dark);
}
.stock-summary-card span {
  font-size: .8rem;
  color: var(--text-muted);
}
.stock-lot-list {
  display: grid;
  gap: .65rem;
}
.stock-lot-item {
  display: grid;
  gap: .18rem;
  padding: .8rem .95rem;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  background: #fff;
}
.stock-lot-item strong {
  font-size: .84rem;
  color: var(--primary-dark);
}
.stock-lot-item span {
  font-size: .8rem;
  color: var(--text-muted);
}
.stock-entry-form {
  padding-top: .25rem;
  border-top: 1px solid var(--border);
}

/* ========== LOGIN PAGE ========== */
body.login-page {
  --login-page-padding: 1rem;
  --login-card-width: 486px;
  --login-card-padding-y: 2.2rem;
  --login-card-padding-x: 2.5rem;
  --login-card-radius: 14px;
  --login-card-y-offset: 0px;
  --login-header-margin-bottom: 1.45rem;
  --login-logo-width: clamp(240px, 64vw, 330px);
  --login-logo-frame-height: 96px;
  --login-logo-offset-y: -58px;
  --login-logo-gap: .15rem;
  --login-subtitle-size: .95rem;
  --login-form-gap: .55rem;
  --login-field-gap: .3rem;
  --login-button-margin-top: .05rem;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}
.login-container {
  width: 100%;
  max-width: var(--login-card-width);
  padding: var(--login-page-padding);
  transform: translateY(var(--login-card-y-offset));
}
.login-card {
  background: #fff; border-radius: var(--login-card-radius);
  padding: var(--login-card-padding-y) var(--login-card-padding-x);
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  overflow: visible;
}
.login-header {
  text-align: center;
  margin-bottom: var(--login-header-margin-bottom);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--login-logo-gap);
}
.login-logo { font-size: 3.5rem; margin-bottom: .5rem; }
.login-logo-wrap {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  height: var(--login-logo-frame-height);
  overflow: hidden;
  padding: 0;
}
.login-logo-img {
  display: block;
  width: var(--login-logo-width);
  max-width: 100%;
  height: auto;
  object-fit: contain;
  transform: translateY(var(--login-logo-offset-y));
}
.login-subtitle {
  color: var(--text-muted);
  font-size: var(--login-subtitle-size);
  margin: 0;
}
.login-card form {
  display: grid;
  gap: var(--login-form-gap);
}
.login-card .form-group {
  gap: var(--login-field-gap);
}
.login-card .btn-block {
  margin-top: var(--login-button-margin-top);
}
.login-header h1 { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.login-header p { color: var(--text-muted); font-size: var(--login-subtitle-size); margin: 0; }

/* ========== UTILITIES ========== */
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.mt-2  { margin-top: .5rem; }
.mt-3  { margin-top: .75rem; }
.mb-3  { margin-bottom: .75rem; }
.hidden { display: none; }

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  .sidebar  { display: none; }
  .content-area { margin-left: 0; max-width: 100%; }
  .navbar { gap: .5rem; padding: 0 .75rem; }
  .navbar-info { justify-content: flex-start; }
  .context-pill { max-width: 260px; }
  .form-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid-6 { grid-template-columns: repeat(3, 1fr); }
  .col-span-3, .col-span-4 { grid-column: span 2; }
  .clinical-grid, .module-board, .patient-shell { grid-template-columns: 1fr; }
  .module-two-cols { grid-template-columns: 1fr; }
  .stock-summary-grid, .medication-support-grid { grid-template-columns: 1fr; }
  .history-card-header { flex-direction: column; }
  .history-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-entry-head { flex-direction: column; }
  .history-entry-date { align-items: flex-start; text-align: left; }
  .patient-shell-badges { justify-content: flex-start; }
}
@media (max-width: 600px) {
  .clock { display: none; }
  .context-pill { max-width: 150px; padding: .22rem .5rem; }
  .context-pill small { display: none; }
  .user-info { display: none; }
  .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .col-span-2, .col-span-3, .col-span-4 { grid-column: span 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .history-results-note { align-items: flex-start; }
  .history-entry-grid { grid-template-columns: 1fr; }
  .patient-shell-meta { flex-direction: column; gap: .25rem; }
}

/* ========== SKIP LINK (acessibilidade) ========== */
.skip-link {
  position: absolute; top: -999px; left: 4px; z-index: 9999;
  padding: .5rem 1rem; background: var(--primary); color: #fff;
  border-radius: 0 0 6px 6px; font-size: .88rem; font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ========== FOCO VISIVEL (acessibilidade) ========== */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* ========== HAMBURGER (mobile) ========== */
.hamburger {
  display: none;
  flex-direction: column; gap: 4px; cursor: pointer;
  background: none; border: none; padding: .4rem;
  border-radius: 6px; transition: background .15s;
  aria-label: "Menu";
}
.hamburger:hover { background: rgba(255,255,255,.1); }
.hamburger span {
  display: block; width: 20px; height: 2px;
  background: #e2e8f0; border-radius: 2px;
  transition: transform .25s, opacity .25s;
}
.hamburger-close .hamburger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger-close .hamburger span:nth-child(2) { opacity: 0; }
.hamburger-close .hamburger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 89;
  background: rgba(15,23,42,.5); backdrop-filter: blur(2px);
}
@media (max-width: 900px) {
  .hamburger { display: flex; }
  .sidebar {
    transform: translateX(-100%); transition: transform .25s ease;
    z-index: 90;
  }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-open .sidebar-backdrop { display: block; }
  .content-area { margin-left: 0; max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .hamburger span, .btn, .action-btn { transition: none !important; }
}

/* ========== BUSCA RAPIDA GLOBAL ========== */
.search-trigger {
  display: flex; align-items: center; gap: .5rem;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; padding: .35rem .75rem;
  cursor: pointer; color: #94a3b8; font-size: .82rem;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.search-trigger:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.3); color: #e2e8f0; }
.search-trigger kbd {
  background: rgba(255,255,255,.1); border-radius: 4px;
  padding: .1rem .35rem; font-size: .72rem; font-family: inherit;
}
.search-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15,23,42,.6); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 10vh;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.search-overlay.visible { opacity: 1; pointer-events: all; }
.search-box {
  width: 100%; max-width: 580px; margin: 0 1rem;
  background: #fff; border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
  overflow: hidden;
  transform: translateY(-12px);
  transition: transform .18s;
}
.search-overlay.visible .search-box { transform: translateY(0); }
.search-input-row {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.search-input-row svg { color: var(--text-muted); flex-shrink: 0; }
.search-input-field {
  flex: 1; border: none; outline: none;
  font-size: 1.05rem; font-family: inherit; color: var(--text);
  background: transparent;
}
.search-input-field::placeholder { color: var(--text-muted); }
.search-close-btn {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: .2rem .5rem;
  font-size: .75rem; color: var(--text-muted); cursor: pointer;
}
.search-results {
  max-height: 380px; overflow-y: auto;
}
.search-result-item {
  display: flex; align-items: center; gap: .85rem;
  padding: .85rem 1.25rem; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  text-decoration: none; color: var(--text);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover, .search-result-item.active { background: #f0f7ff; }
.search-result-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; flex-shrink: 0;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-sub { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.search-result-actions { display: flex; gap: .35rem; flex-shrink: 0; }
.search-empty { text-align: center; padding: 2rem; color: var(--text-muted); font-size: .9rem; }
.search-hint { padding: .6rem 1.25rem; font-size: .75rem; color: var(--text-muted); display: flex; gap: 1rem; }
.search-hint kbd { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: .1rem .4rem; font-size: .72rem; }

/* ========== QUEUE CARDS (fila visual) ========== */
.queue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: .85rem;
  margin-bottom: 1rem;
}
.queue-card {
  background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--secondary);
  transition: box-shadow .15s, transform .1s;
  cursor: pointer;
}
.queue-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.queue-card-em_triagem     { border-left-color: var(--warning); }
.queue-card-aguardando     { border-left-color: var(--primary); }
.queue-card-em_atendimento { border-left-color: var(--success); }
.queue-card-observacao     { border-left-color: #7c3aed; }
.queue-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  margin-bottom: .6rem;
}
.queue-card-ficha {
  font-size: .75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.queue-card-name {
  font-size: .95rem; font-weight: 700; color: var(--text);
  margin-bottom: .25rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.queue-card-meta {
  font-size: .78rem; color: var(--text-muted);
  display: flex; gap: .75rem; flex-wrap: wrap;
}
.queue-card-actions { display: flex; gap: .4rem; margin-top: .75rem; flex-wrap: wrap; }
.queue-filter-bar {
  display: flex; gap: .5rem; flex-wrap: wrap;
  margin-bottom: 1rem; align-items: center;
}
.filter-chip {
  padding: .3rem .75rem; border-radius: 999px;
  border: 1px solid var(--border); background: #fff;
  font-size: .8rem; cursor: pointer; color: var(--text-muted);
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== TOAST NOTIFICATIONS ========== */
.toast-container {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 400;
  display: flex; flex-direction: column; gap: .5rem;
  max-width: 360px;
}
.toast {
  background: #1e293b; color: #f1f5f9;
  padding: .85rem 1.1rem; border-radius: 10px;
  font-size: .875rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  display: flex; align-items: center; gap: .6rem;
  animation: toastIn .25s ease;
  border-left: 4px solid var(--primary);
}
.toast-success { border-left-color: var(--success); }
.toast-danger  { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== COLLAPSIBLE SECTIONS ========== */
.collapsible-header {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  padding-bottom: .5rem; border-bottom: 2px solid var(--border);
  margin-bottom: 1rem;
}
.collapsible-header:hover { color: var(--primary); }
.collapsible-arrow {
  font-size: .75rem; color: var(--text-muted);
  transition: transform .2s;
  width: 1.2rem; text-align: center;
}
.collapsible-header.open .collapsible-arrow { transform: rotate(180deg); }
.collapsible-body { overflow: hidden; }
.collapsible-body.collapsed { display: none; }

/* ========== HOME PROFILE PANELS ========== */
.home-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}
.home-col-4  { grid-column: span 4; }
.home-col-6  { grid-column: span 6; }
.home-col-8  { grid-column: span 8; }
.home-col-12 { grid-column: span 12; }
@media (max-width: 900px) {
  .home-col-4, .home-col-6, .home-col-8 { grid-column: span 12; }
}
.welcome-banner {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  color: #fff; border-radius: 14px; padding: 1.5rem 1.75rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  margin-bottom: 1rem;
}
.welcome-banner h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: .2rem; }
.welcome-banner p { color: #bfdbfe; font-size: .9rem; }
.welcome-banner-unit { margin-top: .2rem; }
.welcome-banner-unit strong { color: #fff; }
.welcome-banner-time { text-align: right; }
.welcome-banner-time .time-big { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.welcome-banner-time .time-date { font-size: .85rem; color: #bfdbfe; }
.quick-actions-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .65rem;
}
.quick-action-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 1rem .75rem; gap: .5rem;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  text-decoration: none; color: var(--text); font-size: .82rem; font-weight: 600;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
  text-align: center;
}
.quick-action-card:hover { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quick-action-card .qa-icon { width: 52px; height: 52px; border-radius: 14px; background: #eff6ff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s; }
.quick-action-card .qa-icon svg { width: 28px; height: 28px; stroke: #2563eb; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: stroke .15s; }
.quick-action-card:hover .qa-icon { background: rgba(255,255,255,.18); }
.quick-action-card:hover .qa-icon svg { stroke: #fff; }
.pending-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .7rem .85rem; border-radius: 8px; background: #f8fafc;
  border: 1px solid var(--border); margin-bottom: .45rem;
  text-decoration: none; color: var(--text);
  transition: background .12s;
}
.pending-item:hover { background: #f0f7ff; border-color: #bfdbfe; }
.pending-icon { font-size: 1.25rem; width: 2rem; text-align: center; flex-shrink: 0; }
.pending-info { flex: 1; min-width: 0; }
.pending-title { font-size: .875rem; font-weight: 600; }
.pending-sub { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.pending-count { font-size: 1rem; font-weight: 800; color: var(--primary); }
.pending-count.danger { color: var(--danger); }
.pending-count.warning { color: var(--warning); }
.home-section-title {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: .75rem;
}

/* ========== AGENDA VISUAL (semanal) ========== */
.calendar-nav {
  display: flex; align-items: center; gap: .75rem;
}
.calendar-nav button { min-width: 36px; justify-content: center; }
.calendar-week {
  display: grid; grid-template-columns: 60px repeat(7, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: #fff;
}
.calendar-header-cell {
  background: #f8fafc; padding: .6rem .5rem;
  text-align: center; font-size: .78rem; font-weight: 600;
  color: var(--text-muted); border-bottom: 2px solid var(--border);
  text-transform: uppercase; letter-spacing: .04em;
}
.calendar-header-cell.today { background: var(--primary); color: #fff; }
.calendar-header-cell.time-col { border-right: 1px solid var(--border); }
.calendar-day-col {
  border-left: 1px solid var(--border); min-height: 120px; padding: .35rem;
  position: relative;
}
.calendar-day-col.today-col { background: #eff6ff; }
.cal-event {
  display: block; border-radius: 6px; padding: .25rem .45rem;
  font-size: .73rem; font-weight: 600; margin-bottom: 3px;
  cursor: pointer; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .12s;
}
.cal-event:hover { opacity: .85; }
.cal-ev-aberta   { background: #dbeafe; color: #1e40af; }
.cal-ev-lotada   { background: #fef3c7; color: #92400e; }
.cal-ev-encerrada{ background: #f1f5f9; color: #64748b; }
.cal-ev-bloqueada{ background: #fee2e2; color: #991b1b; }
.cal-count-more  { font-size: .7rem; color: var(--text-muted); text-align: right; padding: .1rem .25rem; }
@media (max-width: 768px) {
  .calendar-week { grid-template-columns: 40px repeat(7, 1fr); }
  .cal-event { font-size: .65rem; padding: .18rem .3rem; }
  .calendar-header-cell { font-size: .68rem; padding: .4rem .2rem; }
}
@media (max-width: 600px) {
  .calendar-week { grid-template-columns: 36px repeat(5, 1fr); }
}

/* ========== ALERTAS CLINICOS APRIMORADOS ========== */
.clinical-alert-bar {
  display: flex; align-items: center; gap: .65rem;
  padding: .7rem 1rem; border-radius: 8px; margin-bottom: .5rem;
  font-size: .85rem; font-weight: 500;
  border-left: 4px solid var(--danger);
  background: #fff5f5; color: #9b1c1c;
}
.clinical-alert-bar.warning { border-left-color: var(--warning); background: #fffbeb; color: #78350f; }
.clinical-alert-bar.info    { border-left-color: var(--info); background: #eff6ff; color: #1e3a8a; }
.clinical-alert-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.clinical-alerts-group {
  border: 1px solid #fecaca; border-radius: 10px;
  background: #fef2f2; padding: .75rem 1rem; margin-bottom: 1rem;
}
.clinical-alerts-title {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: .88rem; color: #991b1b;
  margin-bottom: .5rem;
}
.clinical-alerts-grid {
  display: flex; flex-wrap: wrap; gap: .35rem;
}
.clinical-alert-tag {
  display: inline-flex; align-items: center; gap: .3rem;
  background: #fff; border: 1px solid #fca5a5; border-radius: 6px;
  padding: .2rem .55rem; font-size: .78rem; color: #991b1b; font-weight: 500;
}

/* ========== TABLE CONTAINER (scrollable) ========== */
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ========== BADGE EXTRAS ========== */
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-info   { background: #e0f2fe; color: #0369a1; }

/* ========== STATUS INDICATOR ========== */
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.status-dot-green  { background: var(--success); box-shadow: 0 0 0 2px #dcfce7; }
.status-dot-orange { background: var(--warning); box-shadow: 0 0 0 2px #fef9c3; }
.status-dot-red    { background: var(--danger);  box-shadow: 0 0 0 2px #fee2e2; }
.status-dot-blue   { background: var(--primary); box-shadow: 0 0 0 2px #dbeafe; }

/* ========== SCROLLBAR CUSTOMIZADO ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
