/* ============================================================
   HIPERDIA — Design System
   Paleta: verde-eucalipto · creme · terracota · âmbar
   Fontes: Fraunces · Manrope · JetBrains Mono
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300..700;1,9..144,300..700&family=Manrope:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---- Tokens ---- */
:root {
  --bg:       #F5EFE3;
  --bg-el:    #FBF7EE;
  --bg-deep:  #EDE6D8;
  --ink:      #142823;
  --ink-soft: #3A4D47;
  --ink-mut:  #7A857F;

  --pri:      #1A4D42;
  --pri-deep: #0E2F28;
  --pri-soft: #DDE9E3;
  --pri-xsoft:#EEF4F1;

  --acc:      #C8553D;
  --acc-soft: #F3D9D0;
  --acc-deep: #A8442F;

  --gold:     #C8943D;
  --gold-soft:#F3E5D0;
  --gold-deep:#A87630;

  --suc:      #4A7F4F;
  --suc-soft: #E2F0E0;
  --warn:     #C8943D;
  --dan:      #C8553D;
  --dan-soft: #F3D9D0;

  --line:     #D9D0BD;
  --line-s:   #E8E0CE;

  --rad:    10px;
  --rad-lg: 14px;
  --rad-xl: 20px;

  --fd: 'Fraunces', Georgia, serif;
  --fb: 'Manrope', system-ui, sans-serif;
  --fm: 'JetBrains Mono', 'Courier New', monospace;

  --sh-sm: 0 1px 3px rgba(20,40,35,.05), 0 0 0 1px rgba(20,40,35,.04);
  --sh-md: 0 4px 14px rgba(20,40,35,.08), 0 0 0 1px rgba(20,40,35,.04);
  --sh-lg: 0 12px 40px rgba(20,40,35,.12), 0 0 0 1px rgba(20,40,35,.04);

  --nav-h: 60px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--fb);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body.with-nav { padding-top: var(--nav-h); }

/* ---- Gradiente de fundo sutil ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(26,77,66,.04), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(200,85,61,.03), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--pri); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ============================================================
   NAVEGAÇÃO
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(245,239,227,.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.nav-in {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--fd);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  white-space: nowrap;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px;
  background: var(--pri);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--bg-el);
  font-family: var(--fd);
  font-style: italic;
  font-size: 18px;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-sub {
  font-family: var(--fb);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-mut);
  font-style: normal;
  display: block;
  line-height: 1.2;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-link:hover { background: var(--pri-xsoft); color: var(--pri); text-decoration: none; }
.nav-link.active { background: var(--pri-soft); color: var(--pri-deep); font-weight: 600; }
.nav-link svg { flex-shrink: 0; }

.nav-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }

.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--rad);
  cursor: pointer;
  position: relative;
}
.nav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--pri-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fd);
  font-size: 12px;
  font-weight: 600;
}
.nav-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-user-perfil {
  font-size: 10px;
  color: var(--ink-mut);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.layout { display: flex; min-height: calc(100vh - var(--nav-h)); position: relative; z-index: 1; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-el);
  border-right: 1px solid var(--line-s);
  padding: 20px 12px;
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 20px;
}
.sidebar-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--ink-mut);
  padding: 0 10px;
  margin-bottom: 6px;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--rad);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.sidebar-link:hover { background: var(--pri-xsoft); color: var(--pri); text-decoration: none; }
.sidebar-link.active { background: var(--pri-soft); color: var(--pri-deep); font-weight: 600; }
.sidebar-link .badge {
  margin-left: auto;
  background: var(--acc-soft);
  color: var(--acc-deep);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 100px;
  font-family: var(--fm);
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 28px 80px;
  max-width: 1220px;
}

/* ============================================================
   TIPOGRAFIA
   ============================================================ */
.eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--acc);
}

.page-title {
  font-family: var(--fd);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -.025em;
  line-height: 1.05;
  margin-top: 6px;
}
.page-title em { font-style: italic; font-weight: 400; color: var(--pri); }

.page-sub { color: var(--ink-mut); font-size: 14px; margin-top: 6px; }

.section-title {
  font-family: var(--fd);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -.015em;
}

.mono { font-family: var(--fm); }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 18px;
  border: none;
  border-radius: var(--rad);
  font-family: var(--fb);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }

.btn-pri  { background: var(--pri); color: var(--bg-el); }
.btn-pri:hover { background: var(--pri-deep); transform: translateY(-1px); box-shadow: var(--sh-md); }

.btn-acc  { background: var(--acc); color: #fff; }
.btn-acc:hover { background: var(--acc-deep); transform: translateY(-1px); box-shadow: var(--sh-md); }

.btn-gold { background: var(--gold); color: var(--pri-deep); }
.btn-gold:hover { background: var(--gold-deep); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
}
.btn-ghost:hover { background: var(--line-s); color: var(--ink); }

.btn-danger { background: var(--dan); color: #fff; }
.btn-danger:hover { background: #A8442F; }

.btn-sm { padding: 7px 13px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-block { width: 100%; }

.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-el);
  border: 1px solid var(--line-s);
  border-radius: var(--rad-lg);
  padding: 24px;
  box-shadow: var(--sh-sm);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.card-title {
  font-family: var(--fd);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -.01em;
}
.card-sub { font-size: 13px; color: var(--ink-mut); margin-top: 2px; }

/* ============================================================
   KPIs (Dashboard)
   ============================================================ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }

.kpi {
  background: var(--bg-el);
  border: 1px solid var(--line-s);
  border-radius: var(--rad-lg);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 44px;
  background: var(--pri);
  border-radius: 0 0 3px 0;
}
.kpi.acc::before { background: var(--acc); }
.kpi.gold::before { background: var(--gold); }
.kpi.suc::before  { background: var(--suc); }

.kpi-label  { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mut); }
.kpi-value  { font-family: var(--fd); font-size: 42px; font-weight: 500; letter-spacing: -.03em; line-height: 1; margin-top: 8px; }
.kpi-value small { font-family: var(--fb); font-size: 16px; color: var(--ink-mut); }
.kpi-delta  { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 10px; color: var(--suc); }
.kpi-delta.down { color: var(--dan); }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--rad);
  font-family: var(--fb);
  font-size: 15px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--pri);
  box-shadow: 0 0 0 4px var(--pri-soft);
}
.form-control.is-invalid {
  border-color: var(--acc);
  box-shadow: 0 0 0 4px var(--acc-soft);
}
.form-control::placeholder { color: var(--ink-mut); }
.form-hint { font-size: 12px; color: var(--ink-mut); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--acc); margin-top: 5px; font-weight: 600; }

.form-row { display: grid; gap: 14px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }

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

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  color: var(--ink-mut);
  padding: 12px 10px;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line-s);
  font-size: 14px;
  font-family: var(--fm);
  vertical-align: middle;
}
.table td.td-text { font-family: var(--fb); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--pri-xsoft); }

/* ============================================================
   BADGES / TAGS
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.tag-pri  { background: var(--pri-soft);  color: var(--pri-deep); }
.tag-acc  { background: var(--acc-soft);  color: #8A2A1A; }
.tag-gold { background: var(--gold-soft); color: #8A5A1F; }
.tag-suc  { background: var(--suc-soft);  color: #2A5A2F; }
.tag-mut  { background: var(--line-s);    color: var(--ink-mut); }

/* Status da fila */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 4px 10px;
  border-radius: 100px;
}
.status-dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-aguardando { background: var(--gold-soft); color: #8A5A1F; }
.status-em_atendimento { background: var(--pri-soft); color: var(--pri-deep); }
.status-em_atendimento::before { animation: pulseDot 1.6s ease-in-out infinite; }
.status-atendido  { background: var(--suc-soft);  color: #2A5A2F; }
.status-faltou    { background: var(--line-s);     color: var(--ink-mut); }
.status-agendado  { background: var(--gold-soft);  color: #8A5A1F; }
.status-encerrado { background: var(--line-s);     color: var(--ink-mut); }

@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50%       { opacity: .6; box-shadow: 0 0 0 5px transparent; }
}

/* ============================================================
   ALERTAS / FLASH
   ============================================================ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--rad);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
}
.alert-suc  { background: var(--suc-soft);  border-left: 4px solid var(--suc);  color: #1A4D1F; }
.alert-erro { background: var(--acc-soft);  border-left: 4px solid var(--acc);  color: #8A2A1A; }
.alert-warn { background: var(--gold-soft); border-left: 4px solid var(--gold); color: #8A5A1F; }
.alert-info { background: var(--pri-soft);  border-left: 4px solid var(--pri);  color: var(--pri-deep); }

.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.alert strong { display: block; font-weight: 700; margin-bottom: 2px; }

/* ============================================================
   CAMPOS DE AFERIÇÃO (grandes, touch-friendly)
   ============================================================ */
.af-input-wrap {
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: var(--rad);
  padding: 14px 16px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.af-input-wrap:focus-within {
  border-color: var(--pri);
  box-shadow: 0 0 0 4px var(--pri-soft);
}
.af-input-wrap.alert-high {
  border-color: var(--acc);
  background: var(--acc-soft);
}
.af-input-wrap.alert-warn {
  border-color: var(--gold);
  background: var(--gold-soft);
}

.af-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-mut);
}
.af-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 4px;
}
.af-field {
  border: none;
  background: transparent;
  font-family: var(--fd);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--ink);
  width: 100%;
  outline: none;
  line-height: 1;
  min-width: 0;
}
.af-field.narrow { width: 65px; text-align: center; }
.af-sep   { font-family: var(--fd); font-size: 30px; color: var(--ink-mut); font-weight: 300; }
.af-unit  { font-size: 12px; color: var(--ink-mut); font-family: var(--fm); white-space: nowrap; }
.af-msg   { margin-top: 6px; font-size: 11px; color: var(--acc-deep); font-weight: 600; display: flex; align-items: center; gap: 5px; }

/* ============================================================
   FILA DE ATENDIMENTO (cards)
   ============================================================ */
.fila-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }

.fila-card {
  background: var(--bg-el);
  border: 1px solid var(--line-s);
  border-radius: var(--rad-lg);
  padding: 18px;
  transition: box-shadow .2s;
}
.fila-card:hover { box-shadow: var(--sh-md); }
.fila-card.atendido { opacity: .55; }

.fila-card-nome {
  font-family: var(--fd);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -.01em;
  line-height: 1.2;
  margin-top: 10px;
}
.fila-card-info { font-size: 12px; color: var(--ink-mut); font-family: var(--fm); margin-top: 4px; }
.fila-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-s);
}
.fila-card-time { font-size: 12px; color: var(--ink-mut); }
.fila-card-time strong { color: var(--ink); font-family: var(--fm); }

/* ============================================================
   SCAN / CÂMERA
   ============================================================ */
.scan-panel {
  background: linear-gradient(160deg, var(--pri-deep), var(--pri));
  color: var(--bg-el);
  border-radius: var(--rad-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.scan-panel::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(200,148,61,.18), transparent 70%);
  border-radius: 50%;
}
.scan-frame {
  width: 180px; height: 180px;
  border: 2px dashed rgba(255,255,255,.3);
  border-radius: var(--rad);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto;
}
.scan-corner {
  position: absolute;
  width: 24px; height: 24px;
  border: 3px solid var(--gold);
}
.scan-corner.tl { top:-2px; left:-2px; border-right:none; border-bottom:none; border-top-left-radius:6px; }
.scan-corner.tr { top:-2px; right:-2px; border-left:none; border-bottom:none; border-top-right-radius:6px; }
.scan-corner.bl { bottom:-2px; left:-2px; border-right:none; border-top:none; border-bottom-left-radius:6px; }
.scan-corner.br { bottom:-2px; right:-2px; border-left:none; border-top:none; border-bottom-right-radius:6px; }
.scan-line {
  position: absolute;
  left: 8px; right: 8px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  box-shadow: 0 0 12px var(--gold);
  animation: scanLine 2.2s ease-in-out infinite;
}
@keyframes scanLine { 0%,100%{ top:8px } 50%{ top:calc(100% - 10px) } }

/* ============================================================
   PRONTUÁRIO — Timeline
   ============================================================ */
.timeline { }
.timeline-item {
  padding: 10px 0 10px 18px;
  border-left: 2px solid var(--line-s);
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -5px; top: 14px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pri);
  border: 2px solid var(--bg-el);
}
.timeline-date {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-mut);
  font-weight: 600;
}
.timeline-value { font-family: var(--fm); font-size: 13px; margin-top: 3px; }

/* ============================================================
   RISCO CARDIOVASCULAR — Widget
   ============================================================ */
.risk-widget { text-align: center; }
.risk-dial { width: 130px; height: 130px; position: relative; margin: 10px auto; }
.risk-dial-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.risk-cat {
  font-family: var(--fd);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.risk-cat.baixo   { color: var(--suc); }
.risk-cat.moderado{ color: var(--gold); }
.risk-cat.alto    { color: var(--dan); }
.risk-pct { font-family: var(--fm); font-size: 11px; color: var(--ink-mut); margin-top: 2px; }

/* ============================================================
   CARTEIRINHA
   ============================================================ */
.carteirinha {
  width: 320px;
  background: linear-gradient(160deg, var(--bg-el) 0%, var(--bg) 100%);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--sh-lg);
  border: 1px solid var(--line-s);
}
.ct-header {
  background: linear-gradient(135deg, var(--pri-deep), var(--pri));
  color: var(--bg-el);
  padding: 18px 20px 16px;
  position: relative;
  overflow: hidden;
}
.ct-header::after {
  content: '';
  position: absolute;
  bottom: -70px; right: -70px;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,148,61,.2), transparent 70%);
}
.ct-body { padding: 20px; }
.ct-nome { font-family: var(--fd); font-size: 20px; font-weight: 500; letter-spacing: -.01em; }

/* ============================================================
   LGPD — Assinatura
   ============================================================ */
.sig-canvas {
  border: 2px dashed var(--line);
  border-radius: var(--rad);
  background: #fff;
  width: 100%;
  height: 160px;
  cursor: crosshair;
  display: block;
  touch-action: none;
}
.sig-canvas.has-sig { border-color: var(--pri); }

/* ============================================================
   HEADER DA PÁGINA
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ============================================================
   DASHBOARD — Gráfico
   ============================================================ */
.chart-wrap { height: 220px; position: relative; }
.chart-wrap canvas { position: absolute; inset: 0; }
.chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11px;
  color: var(--ink-mut);
  font-family: var(--fm);
}

/* ============================================================
   AUTOCOMPLETE / SEARCH
   ============================================================ */
.search-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mut);
}
.search-input {
  padding-left: 44px;
  font-size: 16px;
  border-radius: var(--rad);
}
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-el);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  box-shadow: var(--sh-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 500;
  display: none;
}
.autocomplete-list.open { display: block; }
.ac-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  cursor: pointer;
  transition: background .12s;
  font-size: 14px;
}
.ac-item:hover { background: var(--pri-xsoft); }
.ac-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--pri-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--fd);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}
.ac-name { font-weight: 600; }
.ac-sub  { font-size: 11px; color: var(--ink-mut); font-family: var(--fm); margin-top: 1px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .sidebar { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .main-content { padding: 20px 16px 60px; }
  .page-title { font-size: 26px; }
  .kpis { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .fila-grid { grid-template-columns: 1fr; }
  .nav-links .nav-link span { display: none; }
  .table { font-size: 13px; }
  .table td, .table th { padding: 10px 6px; }
}

@media (max-width: 480px) {
  .af-field { font-size: 28px; }
  .kpi-value { font-size: 34px; }
}

/* ============================================================
   UTILITÁRIOS
   ============================================================ */
.d-flex    { display: flex; }
.d-grid    { display: grid; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mt-24  { margin-top: 24px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.text-mut  { color: var(--ink-mut); }
.text-pri  { color: var(--pri); }
.text-acc  { color: var(--acc); }
.text-suc  { color: var(--suc); }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-right{ text-align: right; }
.text-center{text-align: center; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.font-mono { font-family: var(--fm); }
.font-serif{ font-family: var(--fd); }
.w-full  { width: 100%; }
.flex-1  { flex: 1; }
.truncate{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ============================================================
   IMPRESSÃO
   ============================================================ */
@media print {
  .nav, .sidebar, .page-header-actions, .btn { display: none !important; }
  body { background: #fff; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .main-content { padding: 0; }
}

/* ============================================================
   FILA — layout de lista inline (recepção/estação)
   ============================================================ */
.fila-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-s);
}
.fila-card:last-child { border-bottom: none; }
.fila-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-deep);
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fm);
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.fila-info { flex: 1; min-width: 0; }
.fila-nome { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-meta { font-size: 12px; color: var(--ink-mut); margin-top: 2px; }

/* ============================================================
   TIMELINE (prontuário)
   ============================================================ */
.timeline-body { flex: 1; }
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--pri);
  flex-shrink: 0;
  margin-top: 4px;
}
.timeline-dot.dot-danger { background: var(--dan); }
.timeline-dot.dot-warn   { background: var(--gold); }
.timeline-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-s);
}
.timeline-item:last-child { border-bottom: none; }

/* ============================================================
   AUTOCOMPLETE (genérico)
   ============================================================ */
.autocomplete-wrap {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-el);
  border: 1px solid var(--line);
  border-radius: var(--rad);
  box-shadow: var(--sh-lg);
  max-height: 260px;
  overflow-y: auto;
  z-index: 600;
}
.autocomplete-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  transition: background .1s;
  border-bottom: 1px solid var(--line-s);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--pri-xsoft); }

/* ============================================================
   ALERTAS CLÍNICOS (inline nos campos de aferição)
   ============================================================ */
.alerta-clinico {
  margin-top: 6px;
  padding: 7px 12px;
  border-radius: var(--rad);
  font-size: 12px;
  font-weight: 600;
}
.alerta-critico { background: var(--acc-soft); color: #8A2A1A; border-left: 3px solid var(--acc); }
.alerta-warn    { background: var(--gold-soft); color: #8A5A1F; border-left: 3px solid var(--gold); }
.alerta-info    { background: var(--pri-soft);  color: var(--pri-deep); border-left: 3px solid var(--pri); }

/* ============================================================
   TAGS ADICIONAIS
   ============================================================ */
.tag-danger { background: var(--acc-soft); color: #8A2A1A; }
.opacity-50 { opacity: 0.5; }
.afericao-input { font-family: var(--fm); font-size: 22px; font-weight: 600; letter-spacing: -.02em; padding: 14px; text-align: center; }
.text-danger { color: var(--dan); }

/* status-em_andamento no evento */
.status-em_andamento { background: var(--pri-soft); color: var(--pri-deep); }
.status-em_andamento::before { background: var(--pri); animation: pulseDot 1.6s ease-in-out infinite; }
