/* HealthNet — Sistema de Saúde Pública · v9 */

/* =====================================================
   RESET + TOKENS
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-brand:     #1a56db;
  --c-brand-dk:  #1145b7;
  --c-brand-lt:  #e8effe;
  --c-success:   #057a55;
  --c-success-lt:#def7ec;
  --c-danger:    #c81e1e;
  --c-danger-lt: #fde8e8;
  --c-warning:   #c27803;
  --c-warning-lt:#fdf6b2;
  --c-info-lt:   #e1effe;

  --c-bg:        #f9fafb;
  --c-surface:   #ffffff;
  --c-border:    #e5e7eb;
  --c-text:      #111827;
  --c-muted:     #6b7280;
  --c-subtle:    #9ca3af;

  --radius:  0.5rem;
  --radius-lg: 0.75rem;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);

  --sidebar-w: 240px;
  --font: 'Segoe UI', 'Segoe UI Emoji', system-ui, -apple-system, 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
}

html, body { height: 100%; font-family: var(--font); background: var(--c-bg); color: var(--c-text); }

#hn-app { min-height: 100vh; }

/* =====================================================
   LOGIN SCREEN
   ===================================================== */
.hn-login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f2fa8 0%, #1a56db 60%, #3b82f6 100%);
  padding: 1rem;
}
.hn-login-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
}
.hn-login-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-brand);
}
.hn-login-card h2 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.hn-login-card > p { color: var(--c-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.hn-login-links { margin-top: 1rem; text-align: center; }
.hn-login-links a { color: var(--c-brand); font-size: 0.875rem; text-decoration: none; }
.hn-login-links a:hover { text-decoration: underline; }

/* =====================================================
   SHELL LAYOUT
   ===================================================== */
.hn-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  /* FIX: usar 0 no lugar de auto para a linha do topbar no desktop
     evita que o grid reserve espaço para o topbar oculto */
  grid-template-rows: 0 1fr;
  min-height: 100vh;
}
/* Topbar só aparece no mobile — no desktop fica hidden */
.hn-shell > .hn-topbar {
  display: none;
  grid-column: 1 / -1;
  height: 0;
  overflow: hidden;
}
.hn-shell > .hn-sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
}
.hn-shell > .hn-main {
  grid-column: 2;
  grid-row: 1 / -1;
}
.hn-sidebar {
  background: var(--c-text);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.hn-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.hn-nav {
  flex: 1;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.hn-nav-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.75rem;
  border: none;
  background: transparent;
  color: #9ca3af;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.875rem;
  text-align: left;
  width: 100%;
  transition: background .15s, color .15s;
}
.hn-nav-btn:hover { background: rgba(255,255,255,.06); color: white; }
.hn-nav-btn.active { background: var(--c-brand); color: white; }
.hn-nav-icon { font-size: 1rem; width: 1.25rem; text-rendering: auto; font-style: normal; display: inline-block; text-align: center; }
.hn-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}
.hn-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
}
.hn-user-info { flex: 1; min-width: 0; }
.hn-user-name { display: block; font-size: 0.8rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hn-user-role { display: block; font-size: 0.7rem; color: var(--c-subtle); }
.hn-logout-btn {
  border: none;
  background: transparent;
  color: var(--c-subtle);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  border-radius: var(--radius);
  line-height: 1;
  transition: color .15s;
}
.hn-logout-btn:hover { color: var(--c-danger); }
.hn-main { background: var(--c-bg); overflow-y: auto; }
.hn-content { padding: 1.5rem 2rem; max-width: 1100px; }

/* =====================================================
   PAGE HEADER
   ===================================================== */
.hn-page-header h2 { font-size: 1.4rem; }

/* =====================================================
   FORMS
   ===================================================== */
.hn-field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; }
.hn-field label { font-size: 0.875rem; font-weight: 500; color: var(--c-muted); }
.hn-field input,
.hn-field select,
.hn-field textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
}
.hn-field input:focus,
.hn-field select:focus,
.hn-field textarea:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.hn-form { max-width: 600px; }
.hn-form-wide { max-width: 100%; }
.hn-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.hn-field--full { grid-column: 1 / -1; }
.hn-form-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.hn-input { padding: 0.5rem 0.75rem; border: 1px solid var(--c-border); border-radius: var(--radius); font-size: 0.9rem; background: var(--c-surface); }

/* =====================================================
   BUTTONS
   ===================================================== */
.hn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1.125rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, opacity .15s, transform .1s;
  font-family: var(--font);
  white-space: nowrap;
}
.hn-btn:disabled { opacity: .55; cursor: not-allowed; }
.hn-btn:active:not(:disabled) { transform: scale(.98); }
.hn-btn--primary   { background: var(--c-brand);   color: white; }
.hn-btn--primary:hover:not(:disabled)   { background: var(--c-brand-dk); }
.hn-btn--secondary { background: #f3f4f6; color: var(--c-text); border: 1px solid var(--c-border); }
.hn-btn--secondary:hover:not(:disabled) { background: #e5e7eb; }
.hn-btn--danger    { background: var(--c-danger);  color: white; }
.hn-btn--danger:hover:not(:disabled)    { background: #b91c1c; }
.hn-btn--success   { background: var(--c-success); color: white; }
.hn-btn--success:hover:not(:disabled)   { background: #046c4e; }
.hn-btn--ghost     { background: transparent; color: var(--c-brand); padding-left: 0; }
.hn-btn--ghost:hover:not(:disabled)     { text-decoration: underline; }
.hn-btn--full      { width: 100%; }
.hn-btn--xs        { padding: 0.2rem 0.5rem; font-size: 0.75rem; }

/* =====================================================
   CARDS
   ===================================================== */
.hn-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.hn-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.hn-card:hover { box-shadow: var(--shadow); }
.hn-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  background: #f9fafb;
  border-bottom: 1px solid var(--c-border);
}
.hn-card-body { padding: 0.875rem 1rem; }
.hn-card-body p { font-size: 0.875rem; color: var(--c-muted); margin: 0.2rem 0; }
.hn-card-footer {
  padding: 0.625rem 1rem;
  background: #f9fafb;
  border-top: 1px solid var(--c-border);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* =====================================================
   BADGES
   ===================================================== */
.hn-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.hn-badge--coletado        { background: #fce7f3;             color: #9d174d; }

/* =====================================================
   TABLE
   ===================================================== */
.hn-table-wrap { overflow-x: auto; }
.hn-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.hn-table th { text-align: left; padding: 0.75rem 1rem; background: #f3f4f6; color: var(--c-muted); font-weight: 600; border-bottom: 2px solid var(--c-border); }
.hn-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--c-border); }
.hn-table tbody tr:hover { background: #f9fafb; }

/* =====================================================
   SECTIONS (consultation grid)
   ===================================================== */
.hn-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.hn-section h3 { font-size: 1rem; margin-bottom: 0.875rem; color: var(--c-text); }
.hn-section h4 { font-size: 0.9rem; margin-bottom: 0.5rem; }
.hn-section--full { grid-column: 1 / -1; }
.hn-consult-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hn-record-item small { color: var(--c-muted); }

/* =====================================================
   EXAM CHECKLIST
   ===================================================== */
.hn-exam-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.4rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.75rem;
  background: #f9fafb;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}

/* =====================================================
   SEARCH BAR
   ===================================================== */
.hn-search-bar {
  display: flex;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}
.hn-search-bar .hn-input { flex: 1; }

/* =====================================================
   MODAL
   ===================================================== */
.hn-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
  animation: fadeIn .15s;
}
.hn-modal {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp .2s;
}
.hn-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--c-border);
}
.hn-modal-header h3 { font-size: 1rem; }
.hn-modal-close { border: none; background: transparent; cursor: pointer; font-size: 1.1rem; color: var(--c-muted); padding: 0.25rem; border-radius: 0.25rem; }
.hn-modal-close:hover { background: #f3f4f6; }
.hn-modal-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.hn-modal-footer { padding: 0.875rem 1.25rem; border-top: 1px solid var(--c-border); display: flex; justify-content: flex-end; gap: 0.625rem; }

/* =====================================================
   TOAST
   ===================================================== */
.hn-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10000;
  transform: translateY(1rem);
  opacity: 0;
  transition: transform .25s, opacity .25s;
  max-width: 360px;
}
.hn-toast.show { transform: translateY(0); opacity: 1; }
.hn-toast--info    { background: var(--c-text);        color: white; }
.hn-toast--success { background: var(--c-success);      color: white; }
.hn-toast--error   { background: var(--c-danger);       color: white; }

/* =====================================================
   MISC
   ===================================================== */
.hn-loading { color: var(--c-muted); padding: 2rem; text-align: center; }
.hn-empty   { color: var(--c-subtle); padding: 2rem; text-align: center; font-style: italic; }
.hn-error   { color: var(--c-danger); font-size: 0.875rem; margin-top: 0.5rem; }
.hn-muted   { color: var(--c-muted); font-size: 0.8rem; }
.hn-hint    { font-size: 0.8rem; color: var(--c-muted); margin-top: 0.5rem; }
.hn-denied-reason { background: var(--c-danger-lt); color: var(--c-danger); padding: 0.5rem; border-radius: 0.25rem; font-size: 0.85rem; margin-top: 0.5rem; }

@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* =====================================================
   RESPONSIVE
   ===================================================== */

/* =====================================================
   MOBILE TOPBAR + HAMBURGER TOGGLE
   ===================================================== */

/* Botão hamburguer — aparece só no mobile */
.hn-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 56px;
  background: #111827;
  position: sticky;
  top: 0;
  z-index: 200;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.hn-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: white;
  font-size: 1rem;
  font-weight: 700;
}
.hn-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.08);
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: background .15s;
  flex-shrink: 0;
}
.hn-hamburger:hover { background: rgba(255,255,255,.10); }
.hn-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform .25s, opacity .25s;
  transform-origin: center;
}
.hn-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hn-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hn-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay escuro atrás do sidebar aberto no mobile */
.hn-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 299;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.hn-sidebar-overlay.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* ─── Tablet (≤ 1024px): sidebar menor ─── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 210px; }
}

/* ─────────────────────────────────────────────────────────────
   MOBILE (≤ 768px): sidebar vira drawer lateral com toggle
   ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 288px; }

  /* Shell: empilhar topbar + main em coluna */
  .hn-shell {
    display: flex !important;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
  }

  /* Topbar: fixado com position:fixed para nunca sair da tela ao scrollar */
  .hn-shell > .hn-topbar,
  .hn-topbar {
    display: flex !important;
    order: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    z-index: 200;
    flex-shrink: 0;
  }

  /* Sidebar: drawer lateral, fora do fluxo */
  .hn-shell > .hn-sidebar,
  .hn-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100dvh;         /* dynamic viewport height */
    height: 100vh;
    width: var(--sidebar-w) !important;
    max-width: 92vw;
    z-index: 300;
    transform: translateX(calc(-1 * var(--sidebar-w))) !important;
    transition: transform .28s cubic-bezier(.4,0,.2,1),
                box-shadow .28s;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Anular grid positioning */
    grid-column: unset !important;
    grid-row: unset !important;
    order: -1;
  }

  /* Sidebar ABERTO */
  .hn-sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 6px 0 32px rgba(0,0,0,.35);
  }

  /* Main: ocupa tudo abaixo da topbar fixa */
  .hn-shell > .hn-main,
  .hn-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    min-width: 0;
    grid-column: unset !important;
    grid-row: unset !important;
    order: 1;
    padding-top: 56px; /* compensar topbar fixed */
  }
  .hn-content {
    padding: 1rem;
    max-width: 100%;
  }

  /* ── Nav dentro do drawer: scroll vertical ── */
  .hn-nav {
    flex-direction: column !important;
    flex: 1;
    padding: 0.5rem;
    gap: 2px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    /* Scroll suave no iOS */
    scroll-behavior: smooth;
  }

  /* Items do nav */
  .hn-nav-btn {
    flex-shrink: 0;
    font-size: 0.875rem;
    padding: 0.7rem 0.875rem;
    text-align: left;
    width: 100%;
    border-radius: 8px;
    white-space: nowrap;
  }
  .hn-nav-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
  }

  /* User footer: manter visível */
  .hn-sidebar-user {
    display: flex;
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
    gap: 8px;
    align-items: center;
  }
  .hn-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .hn-user-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }

  /* ── Grids e layouts ── */
  .hn-form-grid,
  .hn-prontuario-grid,
  .hn-reg-info-grid,
  .hn-ref-reg-body {
    grid-template-columns: 1fr !important;
  }
  .hn-card-grid { grid-template-columns: 1fr; }
  .hn-prontuario-grid { grid-template-columns: 1fr !important; }

  /* Tabelas: scroll horizontal */
  .hn-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
  }
  .hn-table { min-width: 520px; }

  /* Page header */
  .hn-page-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-bottom: 0.875rem;
  }
  .hn-page-header h2 { font-size: 1.15rem; }

  /* Search bar */
  .hn-search-bar { flex-wrap: wrap; gap: 8px; }
  .hn-search-bar .hn-input,
  .hn-search-bar input { width: 100%; }
  .hn-search-bar .hn-btn { width: 100%; justify-content: center; }

  /* ── Wizard ── */
  .wiz-container { padding: 0; }
  .wiz-header h2 { font-size: 1.1rem; }
  .wiz-progress { gap: 2px; padding: 0.75rem 0.5rem; }
  .wiz-step-label { font-size: 0.62rem; }
  .wiz-step-circle { width: 28px; height: 28px; font-size: 0.75rem; }
  .wiz-step-line { flex: 1; }
  .wiz-nav { flex-direction: column; gap: 8px; }
  .wiz-nav button { width: 100%; justify-content: center; }
  .wiz-slot-btn { min-width: 72px; padding: 8px 6px; font-size: 0.8rem; }
  .wiz-slots-row { gap: 6px; }
  .wiz-doc-card { padding: 10px; }
  .wiz-success { padding: 1.5rem 1rem; }
  .wiz-success-icon { font-size: 2.5rem; }
  .wiz-success h2 { font-size: 1.25rem; }

  /* ── Calendário wizard ── */
  .wiz-cal-grid { gap: 2px; }
  .wiz-cal-cell { min-height: 36px; font-size: 0.78rem; padding: 2px; }
  .wiz-cal-day-num { font-size: 0.78rem; }
  .wiz-cal-header { padding: 8px 4px; }
  .wiz-cal-month-label { font-size: 0.875rem; }

  /* ── Modal ── */
  .hn-modal-overlay { align-items: flex-end; padding: 0; }
  .hn-modal {
    width: 100vw;
    max-width: 100vw;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Toast ── */
  .hn-toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
    max-width: none;
    text-align: center;
  }

  /* ── Formulário de receita ── */
  .hn-rx-wrap { padding: 0; }
  .hn-rx-patient-bar { flex-direction: column; gap: 8px; }
  .hn-rx-patient-bar > div { flex-direction: row; gap: 8px; align-items: center; }
  .hn-rx-type-btn { font-size: 11px; padding: 6px 8px; }
  .hn-rx-footer { flex-direction: column; gap: 12px; }
  .hn-rx-actions { flex-direction: column; gap: 8px; }
  .hn-rx-actions .hn-btn { width: 100%; justify-content: center; }

  /* ── Encaminhamento ── */
  .hn-ref-specialty-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .hn-ref-specialty-btn { font-size: 12px; padding: 6px 8px; }
  .hn-ref-reg-header { flex-wrap: wrap; gap: 8px; }
  .hn-ref-reg-meta { flex-wrap: wrap; gap: 6px; }
  .hn-ref-reg-body { display: flex; flex-direction: column; gap: 8px; }
  .hn-ref-reg-body dl { display: flex; flex-direction: column; gap: 4px; }
  .hn-ref-urgency-pills { flex-wrap: wrap; gap: 6px; }
  .hn-ref-urgency-pill { flex: 1; min-width: 100px; justify-content: center; text-align: center; }

  /* ── Regulação cards ── */
  .hn-reg-card-header { flex-wrap: wrap; gap: 8px; }
  .hn-reg-card-meta { flex-wrap: wrap; gap: 6px; }
  .hn-reg-info-grid { grid-template-columns: 1fr !important; }
  .hn-reg-actions { flex-direction: column; gap: 8px; }
  .hn-reg-actions .hn-btn { width: 100%; justify-content: center; }

  /* ── Tabs ── */
  .hn-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 6px;
    padding-bottom: 2px;
  }
  .hn-tab { white-space: nowrap; flex-shrink: 0; padding: 8px 12px; font-size: 13px; }

  /* ── Prontuário ── */
  .hn-prontuario-actions { flex-wrap: wrap; gap: 8px; }
  .hn-prontuario-actions .hn-btn { flex: 1; min-width: 140px; justify-content: center; }
  .hn-cid-tag-row { flex-wrap: wrap; gap: 6px; }
  .hn-exam-grid { grid-template-columns: 1fr 1fr; }

  /* ── Laboratório ── */
  .hn-publish-section { flex-direction: column; gap: 12px; text-align: center; }
  .hn-publish-section .hn-btn { width: 100%; justify-content: center; }
  .hn-result-block { padding: 12px; }

  /* ── Médicos (diretor) ── */
  .dm-doctor-grid { grid-template-columns: 1fr; }
  .hn-doc-row { flex-direction: column; gap: 10px; }
  .hn-doc-row-actions { width: 100%; }
  .hn-doc-row-actions .hn-btn { width: 100%; justify-content: center; }

  /* ── Recepção calendário ── */
  .hn-agenda-section { margin-bottom: 1.25rem; }
  .hn-agenda-item { flex-wrap: wrap; gap: 8px; }
  .hn-agenda-info { flex: 1; min-width: 0; }

  /* ── Dashboard stats ── */
  .hn-dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .hn-stat-card { padding: 12px; }
  .hn-stat-count { font-size: 1.5rem; }

  /* ── Botões large ── */
  .hn-btn--lg { padding: 0.75rem 1.25rem; font-size: 0.9rem; width: 100%; justify-content: center; }
  .hn-btn--full { width: 100% !important; justify-content: center; }

  /* ── Campos full em grid ── */
  .hn-field--full { grid-column: 1 / -1 !important; }

  /* ── Diretório cards ── */
  .dir-grid { grid-template-columns: 1fr !important; }
  .dir-filters { flex-direction: column; gap: 10px; }
  .dir-filter-pills { flex-wrap: wrap; gap: 6px; }
  .dir-search-wrap input { width: 100%; }
  .dir-card-contacts { flex-wrap: wrap; gap: 6px; }
  .dir-contact-btn { font-size: 12px; padding: 6px 10px; }

  /* ── Page header back ── */
  .hn-page-back { width: 100%; }
  .hn-page-back .hn-btn { width: auto; }

  /* ── Form actions ── */
  .hn-form-actions { flex-direction: column; gap: 8px; }
  .hn-form-actions .hn-btn { width: 100%; justify-content: center; }

  /* ── Card footer ── */
  .hn-card-footer { flex-wrap: wrap; gap: 6px; }
  .hn-card-footer .hn-btn { flex: 1; min-width: 100px; justify-content: center; text-align: center; }

  /* ── Receituário footer ── */
  .wiz-confirm-summary { gap: 10px; }
  .wiz-summary-row { gap: 10px; }

  /* ── Médico pedido lab ── */
  .hn-card.hn-card--footer-stacked .hn-card-footer { flex-direction: column; }

  /* ── Ocultar coluna secundária nas tabelas pequenas ── */
  .hn-table .hide-mobile { display: none; }

  /* Slots de horário: mais compactos */
  .wiz-slot-group { margin-bottom: 12px; }
  .wiz-slot-group-label { font-size: 12px; margin-bottom: 6px; }
}

/* ── Very small phones (< 400px) ── */
@media (max-width: 400px) {
  .hn-content { padding: 0.75rem; }
  .hn-dashboard-grid { grid-template-columns: 1fr; }
  .hn-exam-grid { grid-template-columns: 1fr; }
  .wiz-cal-cell { min-height: 30px; font-size: 0.72rem; }
  .hn-ref-specialty-grid { grid-template-columns: 1fr; }
  .hn-nav-btn { font-size: 0.82rem; padding: 0.65rem 0.75rem; }
  .dir-card-contacts { flex-direction: column; }
  .wiz-slot-btn { min-width: 64px; font-size: 0.75rem; }
}

/* ── Very small phones (< 400px) ── */
@media (max-width: 400px) {
  .hn-content { padding: 0.75rem; }
  .hn-page-header h2 { font-size: 1.1rem; }
  .hn-ref-specialty-grid { grid-template-columns: 1fr; }
  .wiz-step-label { display: none; }
}

@media print {
  .hn-sidebar, .hn-page-header .hn-btn, .hn-card-footer { display: none !important; }
  .hn-shell { display: block; }
  .hn-content { padding: 0; }
}

/* ====================================================
   HealthNet Styles v3.0 — Componentes dos Painéis
==================================================== */

/* Tabs */
.hn-tabs { display:flex; gap:4px; margin-bottom:16px; border-bottom:2px solid #e2e8f0; padding-bottom:0; }
.hn-tab  { padding:8px 16px; border:none; background:transparent; cursor:pointer;
           font-size:13px; font-weight:600; color:#64748b; border-bottom:2px solid transparent;
           margin-bottom:-2px; transition:all .15s; }
.hn-tab.active { color:#1a56db; border-bottom-color:#1a56db; }
.hn-tab:hover:not(.active) { color:#0f172a; }

/* Page header */
.hn-page-header { display:flex; align-items:center; gap:12px; flex-wrap:wrap;
                  margin-bottom:20px; padding-bottom:16px; border-bottom:1.5px solid #e2e8f0; }
.hn-page-back   { flex-shrink:0; }
.hn-page-title h2 { margin:0; font-size:20px; font-weight:700; color:#0f172a; }
.hn-page-title p  { margin:0; font-size:13px; color:#64748b; }
.hn-subtitle { color:#64748b; font-size:13px; margin:2px 0 0; }

/* Appointment cards (paciente) */
.hn-appt-list { display:flex; flex-direction:column; gap:8px; }
.hn-appt-card { display:flex; align-items:center; gap:16px; padding:14px 16px;
                background:#fff; border:1.5px solid #e2e8f0; border-radius:10px;
                transition:box-shadow .15s; }
.hn-appt-card:hover { box-shadow:0 2px 12px rgba(0,0,0,.08); }
.hn-appt-datetime { display:flex; flex-direction:column; align-items:center;
                    min-width:80px; background:#eff6ff; border-radius:8px; padding:8px; }
.hn-appt-date { font-size:13px; font-weight:700; color:#1d4ed8; }
.hn-appt-time { font-size:18px; font-weight:800; color:#1d4ed8; }
.hn-appt-info { flex:1; display:flex; flex-direction:column; gap:2px; }
.hn-appt-info strong { font-size:14px; font-weight:600; color:#0f172a; }
.hn-appt-spec  { font-size:12px; color:#64748b; }
.hn-appt-notes { font-size:12px; color:#64748b; margin:2px 0 0; font-style:italic; }
.hn-appt-actions { display:flex; flex-direction:column; align-items:flex-end; gap:6px; }

/* Patient cards */
.hn-card--patient .hn-patient-avatar {
    width:40px; height:40px; border-radius:10px; background:#1a56db;
    color:#fff; display:flex; align-items:center; justify-content:center;
    font-weight:700; font-size:16px; flex-shrink:0; }
.hn-card--clickable { cursor:pointer; }
.hn-card--clickable:hover { border-color:#1a56db; box-shadow:0 2px 12px rgba(26,86,219,.12); }

/* Doctor list (recepção) */
.hn-doctor-list { display:flex; flex-direction:column; gap:8px; }
.hn-doc-row { display:flex; align-items:center; gap:16px; padding:14px 16px;
              background:#fff; border:1.5px solid #e2e8f0; border-radius:10px; }
.hn-doc-row--vacation { border-color:#fde68a; background:#fffbeb; }
.hn-doc-row--inactive  { border-color:#fca5a5; background:#fff5f5; opacity:.8; }
.hn-doc-row-info { display:flex; align-items:center; gap:12px; flex:1; }
.hn-doc-row-avatar { width:40px; height:40px; border-radius:10px; background:#0f172a;
                     color:#fff; display:flex; align-items:center; justify-content:center;
                     font-weight:700; font-size:16px; flex-shrink:0; }
.hn-doc-row--vacation .hn-doc-row-avatar { background:#d97706; }
.hn-doc-row--inactive  .hn-doc-row-avatar { background:#94a3b8; }
.hn-doc-row-info > div { display:flex; flex-direction:column; gap:2px; }
.hn-doc-row-info strong { font-size:14px; font-weight:600; color:#0f172a; }
.hn-doc-row-info small  { font-size:11px; color:#64748b; }
.hn-doc-row-status { display:flex; flex-direction:column; align-items:flex-end; gap:4px; min-width:100px; }
.hn-doc-row-status small { font-size:11px; color:#64748b; }
.hn-doc-row-actions { display:flex; gap:8px; }

/* Prontuário grid (médico) */
.hn-prontuario-grid { display:grid; grid-template-columns:1fr 1.4fr; gap:16px; }
@media(max-width:900px){ .hn-prontuario-grid { grid-template-columns:1fr; } }
.hn-prontuario-col { display:flex; flex-direction:column; gap:16px; }
.hn-record-item  { padding:10px 0; border-bottom:1px solid #f1f5f9; }
.hn-record-item:last-child { border-bottom:none; }
.hn-record-date { font-size:11px; color:#94a3b8; font-weight:600; margin-bottom:4px; }
.hn-record-body p { margin:2px 0; font-size:13px; color:#334155; }
.hn-prev-reqs   { margin-top:12px; border-top:1px solid #e2e8f0; padding-top:12px; }
.hn-prev-reqs strong { font-size:12px; color:#64748b; display:block; margin-bottom:6px; }
.hn-prev-req-row { display:flex; gap:10px; align-items:center; padding:4px 0;
                   font-size:12px; color:#64748b; }

/* Exam checkbox grid */
.hn-exam-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:6px; }
.hn-checkbox-label { display:flex; align-items:center; gap:8px; padding:7px 10px;
                     border:1.5px solid #e2e8f0; border-radius:8px; cursor:pointer;
                     font-size:13px; color:#334155; transition:all .12s; }
.hn-checkbox-label:hover { border-color:#1a56db; background:#eff6ff; }
.hn-checkbox-label input { accent-color:#1a56db; width:15px; height:15px; }

/* Agenda médico */
.hn-agenda-list { display:flex; flex-direction:column; gap:6px; }
.hn-agenda-item { display:flex; align-items:center; gap:16px; padding:12px 16px;
                  background:#fff; border:1.5px solid #e2e8f0; border-radius:10px; }
.hn-agenda-time { font-size:18px; font-weight:700; color:#1a56db; min-width:56px; text-align:center; }
.hn-agenda-info { flex:1; }
.hn-agenda-info strong { font-size:14px; font-weight:600; color:#0f172a; display:block; }
.hn-agenda-info p { margin:2px 0 0; font-size:12px; color:#64748b; }

/* Regulação cards */
.hn-reg-list  { display:flex; flex-direction:column; gap:8px; }
.hn-reg-card  { background:#fff; border:1.5px solid #e2e8f0; border-radius:10px; overflow:hidden; }
.hn-reg-card-header:hover { background:#f8fafc; }
.hn-reg-patient { font-size:14px; font-weight:600; color:#0f172a; display:block; }
.hn-reg-posto   { font-size:12px; color:#64748b; display:block; margin-top:2px; }
.hn-reg-card-meta { display:flex; align-items:center; gap:10px; }
.hn-reg-chevron { color:#64748b; font-size:12px; }
.hn-reg-card-body { padding:16px; border-top:1px solid #f1f5f9; }
.hn-reg-info-grid strong { font-size:11px; color:#64748b; text-transform:uppercase;
                            letter-spacing:.5px; display:block; margin-bottom:6px; }
.hn-reg-info-grid ul { margin:0; padding-left:16px; }
.hn-reg-info-grid li { font-size:13px; color:#334155; margin:2px 0; }
.hn-reg-info-grid p  { font-size:13px; color:#334155; margin:2px 0; }
.hn-reg-actions { display:flex; gap:10px; padding-top:12px; border-top:1px solid #f1f5f9; }
.hn-denied-note { background:#fef2f2; border:1px solid #fecaca; border-radius:8px;
                  padding:10px 12px; }
.hn-denied-note strong { font-size:12px; color:#991b1b; display:block; margin-bottom:4px; }
.hn-denied-note p { font-size:13px; color:#7f1d1d; margin:0; }

/* Obs. regulação (recepção) */
.hn-regulacao-obs { background:#fef9c3; border:1px solid #fde68a; border-radius:8px;
                    padding:10px 12px; margin:8px 0; }
.hn-regulacao-obs strong { font-size:12px; color:#854d0e; display:block; margin-bottom:4px; }
.hn-regulacao-obs p { font-size:13px; color:#78350f; margin:0; }
.hn-card--denied { border-color:#fca5a5; background:#fff5f5; }

/* Resultados técnico */
.hn-result-block { background:#fff; border:1.5px solid #e2e8f0; border-radius:10px;
                   padding:16px; margin-bottom:12px; }
.hn-result-block-title { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.hn-result-num { width:24px; height:24px; border-radius:50%; background:#0f172a; color:#fff;
                 display:flex; align-items:center; justify-content:center;
                 font-size:11px; font-weight:700; flex-shrink:0; }
.hn-result-block-title strong { font-size:14px; font-weight:600; color:#0f172a; }
.hn-badge--saved { background:#dcfce7; color:#166534; border:1px solid #bbf7d0; }

.hn-publish-section { display:flex; align-items:center; justify-content:space-between;
                      flex-wrap:wrap; gap:16px; background:#eff6ff; border:1.5px solid #bfdbfe;
                      border-radius:12px; padding:20px; margin-top:20px; }
.hn-publish-section strong { font-size:15px; font-weight:600; color:#1e40af; display:block; }
.hn-publish-section p { font-size:13px; color:#3b82f6; margin:4px 0 0; }
.hn-btn--lg { padding:12px 24px; font-size:15px; }

/* Badges extras */
.hn-badge--negado    { background:#fee2e2; color:#991b1b; }
.hn-badge--autorizado{ background:#dcfce7; color:#166534; }
.hn-badge--pendente  { background:#fef9c3; color:#854d0e; }
.hn-badge--agendado  { background:#dbeafe; color:#1d4ed8; }
.hn-badge--expirado  { background:#fee2e2; color:#991b1b; }
.hn-badge--reagendamento_solicitado { background:#ede9fe; color:#5b21b6; }
.hn-badge--resultado_pronto { background:#dcfce7; color:#166534; }
.hn-badge--cancelled { background:#fee2e2; color:#991b1b; }
.hn-badge--rascunho  { background:#f1f5f9; color:#64748b; }

/* Notice warn */

/* DL */
.hn-dl { display:grid; grid-template-columns:auto 1fr; gap:6px 12px;
         font-size:13px; margin:0; }
.hn-dl dt { color:#64748b; font-weight:600; }
.hn-dl dd { margin:0; color:#0f172a; }

/* Result text */
.hn-result-text { font-size:13px; color:#334155; white-space:pre-wrap; }

/* Empty state */
.hn-empty-state { display:flex; flex-direction:column; align-items:center;
                  padding:60px 20px; gap:12px; color:#94a3b8; }
.hn-empty-state span { font-size:48px; opacity:.4; }
.hn-empty-state p { font-size:15px; margin:0; }

/* Loading */
.hn-loading-spinner { text-align:center; padding:40px; color:#64748b; font-size:14px; }

/* Input sizes */
.hn-input-sm { padding:6px 10px; border:1.5px solid #e2e8f0; border-radius:6px;
               font-size:12px; color:#0f172a; outline:none; }
.hn-input-sm:focus { border-color:#1a56db; }

/* ====================================================
   Prescrição Médica + CID — v3.1
==================================================== */

/* --- Bloco de prescrição --- */
.hn-prescription-block {
    background: #f0fdf4;
    border: 1.5px solid #bbf7d0;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 12px 0;
}
.hn-prescription-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--c-border);
}
.hn-prescription-icon { font-size: 20px; }
.hn-prescription-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--c-text);
    flex: 1;
}
.hn-prescription-header small { font-size: 11px; color: var(--c-muted); margin-left: auto; }

.hn-prescription-block textarea {
    border-color: #86efac;
    background: #fff;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
}
.hn-prescription-block textarea:focus { border-color: #22c55e; }

/* Prescrição no histórico */
.hn-record-prescription {
    background: #f0fdf4;
    border-left: 3px solid #22c55e;
    padding: 6px 10px;
    margin: 6px 0;
    border-radius: 0 6px 6px 0;
}
.hn-record-prescription strong {
    font-size: 11px;
    color: #166534;
    display: block;
    margin-bottom: 4px;
}
.hn-record-prescription pre {
    margin: 0;
    font-size: 12px;
    color: #14532d;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Courier New', Courier, monospace;
    line-height: 1.6;
}

/* --- Bloco de CID --- */
.hn-cid-block {
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    border-radius: 12px;
    padding: 14px 16px;
    margin: 12px 0;
}
.hn-cid-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.hn-cid-icon { font-size: 20px; }
.hn-cid-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #1e40af;
    flex: 1;
}
.hn-cid-header small { font-size: 11px; color: #93c5fd; }

.hn-cid-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.hn-cid-search-row .hn-input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    background: #fff;
}
.hn-cid-search-row .hn-input:focus { border-color: #1a56db; }

/* Sugestões do autocomplete */
.hn-cid-suggestions {
    background: #fff;
    border: 1.5px solid #bfdbfe;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(26,86,219,.12);
    overflow: hidden;
    margin-bottom: 8px;
    max-height: 260px;
    overflow-y: auto;
}
.hn-cid-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    transition: background .1s;
    border-bottom: 1px solid #f1f5f9;
}
.hn-cid-suggestion-item:last-child { border-bottom: none; }
.hn-cid-suggestion-item:hover { background: #eff6ff; }
.hn-cid-code {
    font-weight: 700;
    font-size: 12px;
    color: #1a56db;
    background: #dbeafe;
    padding: 2px 7px;
    border-radius: 6px;
    white-space: nowrap;
    font-family: monospace;
}
.hn-cid-name { font-size: 13px; color: #334155; }
.hn-cid-no-result { padding: 10px 12px; font-size: 13px; color: #64748b; }

/* Tags selecionadas */
.hn-cid-selected {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.hn-cid-tag-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hn-cid-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #dbeafe;
    border: 1.5px solid #93c5fd;
    border-radius: 100px;
    font-size: 12px;
    color: #1e40af;
    font-weight: 500;
}
.hn-cid-tag strong { font-family: monospace; font-weight: 700; }
.hn-cid-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #64748b;
    padding: 2px 5px;
    border-radius: 4px;
    transition: all .1s;
    flex-shrink: 0;
}
.hn-cid-remove:hover { background: #fee2e2; color: #991b1b; }
.hn-cid-empty { font-size: 12px; color: #93c5fd; margin: 4px 0 0; }

/* CIDs no histórico */
.hn-record-cids {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 6px 0;
    align-items: center;
}
.hn-record-cids strong {
    font-size: 11px;
    color: #1e40af;
    margin-right: 4px;
}
.hn-record-cids .hn-cid-tag {
    font-size: 11px;
    padding: 2px 8px;
}

/* ====================================================
   Gerenciador de Calendário — Recepção v3.2
==================================================== */

.hn-cal-mgr-tabs { display:flex; gap:4px; margin-bottom:20px;
    border-bottom:2px solid #e2e8f0; padding-bottom:0; }

.hn-cal-config-wrap { max-width:900px; }

.hn-cal-config-info {
    background:#fffbeb; border:1.5px solid #fde68a; border-radius:10px;
    padding:12px 16px; font-size:13px; color:#78350f; margin-bottom:20px;
    line-height:1.6;
}

/* Selector de médico */
.hn-cal-prof-selector { margin-bottom:20px; }
.hn-cal-prof-selector label { display:block; font-size:12px; font-weight:600;
    color:#374151; margin-bottom:6px; }
.hn-cal-select {
    padding:9px 12px; border:1.5px solid #e2e8f0; border-radius:8px;
    font-size:13px; color:#0f172a; background:#fff; outline:none;
    min-width:320px; cursor:pointer; }
.hn-cal-select:focus { border-color:#1a56db; }

/* Card de configuração do médico */
.hn-cal-config-card {
    background:#fff; border:1.5px solid #e2e8f0; border-radius:14px; padding:20px;
}
.hn-cal-config-card h3 { margin:0 0 6px; font-size:16px; color:#0f172a; }

/* Grid de dias */
.hn-cal-days-grid {
    display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr));
    gap:12px; margin:16px 0;
}

.hn-cal-day-card {
    border:1.5px solid #e2e8f0; border-radius:10px; overflow:hidden;
    transition:border-color .15s;
}
.hn-cal-day-card.active { border-color:#1a56db; background:#f8faff; }

.hn-cal-day-header {
    padding:10px 14px; background:#f8fafc; border-bottom:1px solid #e2e8f0;
}
.hn-cal-day-card.active .hn-cal-day-header { background:#eff6ff; }

.hn-cal-day-toggle {
    display:flex; align-items:center; gap:8px; cursor:pointer; font-weight:600;
    font-size:14px; color:#0f172a; user-select:none;
}
.hn-cal-day-toggle input { accent-color:#1a56db; width:16px; height:16px; cursor:pointer; }
.hn-cal-day-name { font-size:14px; font-weight:700; }

.hn-cal-day-times { padding:12px 14px; display:flex; flex-direction:column; gap:8px; }

.hn-cal-time-row {
    display:flex; align-items:center; gap:8px; font-size:12px; color:#374151;
}
.hn-cal-time-row label { width:50px; font-weight:600; flex-shrink:0; }
.hn-cal-time-select {
    padding:5px 8px; border:1.5px solid #e2e8f0; border-radius:6px;
    font-size:12px; color:#0f172a; background:#fff; flex:1; cursor:pointer; outline:none;
}
.hn-cal-time-select:focus { border-color:#1a56db; }

/* Preview de slots */
.hn-cal-slots-preview { margin-top:8px; }
.hn-cal-slots-label { font-size:11px; color:#64748b; margin:0 0 6px; font-weight:600; }
.hn-cal-slots-chips { display:flex; flex-wrap:wrap; gap:4px; }
.hn-cal-slot-chip {
    padding:2px 7px; background:#dbeafe; color:#1d4ed8;
    border-radius:4px; font-size:10px; font-weight:600; font-family:monospace;
}

/* Ações */
.hn-cal-config-actions {
    display:flex; justify-content:flex-end; gap:10px;
    padding-top:16px; border-top:1px solid #f1f5f9; margin-top:8px;
}

/* Summary modal */
.hn-cal-summary p { font-size:14px; color:#0f172a; margin:0 0 12px; }
.hn-cal-summary-grid { display:flex; flex-direction:column; gap:8px; }
.hn-cal-summary-row {
    display:flex; align-items:center; gap:12px; padding:8px 12px;
    background:#f8fafc; border-radius:8px; font-size:13px;
}
.hn-cal-summary-row strong { min-width:70px; color:#0f172a; }
.hn-cal-summary-row span { flex:1; color:#64748b; }

/* Bloqueio form */
.hn-cal-block-list { margin-top:16px; }

/* Visualização semanal */
.hn-cal-view-wrap { }
.hn-cal-view-header { margin-bottom:16px; }
.hn-cal-view-header h3 { margin:0 0 4px; font-size:16px; color:#0f172a; }

.hn-cal-view-grid {
    display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr));
    gap:8px; margin-bottom:24px;
}

.hn-cal-view-day {
    background:#fff; border:1.5px solid #e2e8f0; border-radius:10px;
    overflow:hidden; min-height:120px;
}
.hn-cal-view-day.today { border-color:#1a56db; background:#f8faff; }

.hn-cal-view-day-header {
    padding:8px 10px; background:#f8fafc; border-bottom:1px solid #e2e8f0;
    display:flex; align-items:center; justify-content:space-between;
}
.hn-cal-view-day.today .hn-cal-view-day-header { background:#eff6ff; }
.hn-cal-view-wday { font-size:12px; font-weight:700; color:#0f172a; }
.hn-today-badge {
    font-size:9px; background:#1a56db; color:#fff;
    padding:1px 5px; border-radius:4px; font-weight:700;
}

.hn-cal-view-appts { padding:6px 8px; display:flex; flex-direction:column; gap:4px; }
.hn-cal-view-appt {
    display:flex; align-items:flex-start; gap:6px;
    padding:4px 6px; background:#f1f5f9; border-radius:6px;
}
.hn-cal-view-time {
    font-size:10px; font-weight:700; color:#1a56db; white-space:nowrap;
    font-family:monospace; padding-top:1px;
}
.hn-cal-view-appt-info { display:flex; flex-direction:column; }
.hn-cal-view-appt-info span { font-size:11px; color:#0f172a; font-weight:500; }
.hn-cal-view-appt-info small { font-size:10px; color:#64748b; }
.hn-cal-view-empty { font-size:11px; color:#94a3b8; padding:8px 10px; margin:0; }
.hn-cal-view-more { font-size:10px; color:#1a56db; margin:2px 0 4px 8px; font-weight:600; }

/* Disponibilidade médicos */
.hn-cal-avail-grid {
    display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr));
    gap:10px;
}
.hn-cal-avail-card {
    background:#fff; border:1.5px solid #e2e8f0; border-radius:10px;
    padding:12px 16px; display:flex; align-items:center; gap:12px;
}
.hn-cal-avail-name { flex:1; display:flex; flex-direction:column; gap:2px; }
.hn-cal-avail-name strong { font-size:13px; color:#0f172a; }
.hn-cal-avail-name small { font-size:11px; color:#64748b; }
.hn-cal-avail-count { text-align:center; }
.hn-cal-appt-count {
    display:block; font-size:22px; font-weight:800; color:#1a56db; line-height:1;
}
.hn-cal-avail-count small { font-size:10px; color:#64748b; }

/* ====================================================
   Receituário + Encaminhamentos — v3.3
==================================================== */

/* ── Botões de ação rápida no prontuário ─────────── */
.hn-prontuario-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
}
.hn-prontuario-actions strong {
    width: 100%;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    display: block;
    margin-bottom: 2px;
}

/* ── Receita impressa ───────────────────────────── */
.hn-rx-wrap {
    max-width: 700px;
}
.hn-rx-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
    color: #fff;
    padding: 20px 24px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.hn-rx-clinic h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.hn-rx-clinic p  { margin: 0; font-size: 12px; opacity: .8; }
.hn-rx-title { text-align: right; }
.hn-rx-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.hn-rx-title .hn-rx-type-badge {
    display: inline-block;
    background: rgba(255,255,255,.2);
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 11px;
    margin-top: 4px;
}

.hn-rx-body {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-top: none;
    padding: 20px 24px;
    border-radius: 0 0 12px 12px;
}

.hn-rx-patient-bar {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 16px;
}
.hn-rx-patient-bar div { display: flex; flex-direction: column; gap: 1px; }
.hn-rx-patient-bar label { font-size: 10px; color: #94a3b8; font-weight: 600; text-transform: uppercase; }
.hn-rx-patient-bar span  { font-size: 13px; color: #0f172a; font-weight: 500; }

.hn-rx-meds-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}
.hn-rx-meds-box {
    border: 1.5px dashed #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    min-height: 100px;
    white-space: pre-wrap;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    color: #0f172a;
}
.hn-rx-meds-textarea {
    width: 100%;
    border: 1.5px dashed #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}
.hn-rx-meds-textarea:focus { border-color: #1a56db; }

.hn-rx-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1.5px solid #e2e8f0;
}
.hn-rx-validity { font-size: 12px; color: #64748b; }
.hn-rx-signature { text-align: center; }
.hn-rx-signature-line {
    width: 200px;
    border-top: 1.5px solid #0f172a;
    margin: 0 auto 4px;
}
.hn-rx-signature-name { font-size: 12px; font-weight: 600; color: #0f172a; }
.hn-rx-signature-crm  { font-size: 11px; color: #64748b; }

.hn-rx-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}

/* Receita list */
.hn-rx-list { display: flex; flex-direction: column; gap: 8px; }
.hn-rx-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all .15s;
}
.hn-rx-item:hover { border-color: #1a56db; background: #f8faff; }
.hn-rx-item-date { font-size: 12px; color: #64748b; min-width: 90px; font-weight: 600; }
.hn-rx-item-info { flex: 1; }
.hn-rx-item-info strong { font-size: 14px; color: #0f172a; display: block; }
.hn-rx-item-info small  { font-size: 12px; color: #64748b; }
.hn-rx-type-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: #f1f5f9;
    color: #64748b;
}

/* ── Encaminhamento ──────────────────────────────── */
.hn-ref-wrap { max-width: 700px; }
.hn-ref-header {
    background: linear-gradient(135deg, #5b21b6 0%, #1e40af 100%);
    color: #fff;
    padding: 18px 24px;
    border-radius: 12px 12px 0 0;
}
.hn-ref-header h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.hn-ref-header p  { margin: 0; font-size: 12px; opacity: .8; }

.hn-ref-body {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-top: none;
    padding: 20px 24px;
    border-radius: 0 0 12px 12px;
}

.hn-ref-specialty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    margin: 8px 0 16px;
}
.hn-ref-specialty-btn {
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #334155;
    text-align: left;
    transition: all .12s;
}
.hn-ref-specialty-btn:hover  { border-color: #1a56db; background: #eff6ff; color: #1a56db; }
.hn-ref-specialty-btn.active { border-color: #1a56db; background: #1a56db; color: #fff; }

.hn-ref-urgency-pills { display: flex; gap: 8px; margin: 8px 0; }
.hn-ref-urgency-pill {
    padding: 6px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 100px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    transition: all .12s;
}
.hn-ref-urgency-pill[data-urgency="eletivo"].active    { background: #dcfce7; border-color: #22c55e; color: #166534; }
.hn-ref-urgency-pill[data-urgency="prioritario"].active { background: #fef9c3; border-color: #eab308; color: #854d0e; }
.hn-ref-urgency-pill[data-urgency="urgente"].active     { background: #fee2e2; border-color: #ef4444; color: #991b1b; }

/* Regulação — card de encaminhamento */
.hn-ref-reg-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}
.hn-ref-reg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background .12s;
}
.hn-ref-reg-header:hover { background: #f8fafc; }
.hn-ref-reg-patient { font-size: 14px; font-weight: 600; color: #0f172a; }
.hn-ref-reg-specialty { font-size: 12px; color: #1a56db; font-weight: 500; margin-top: 2px; }
.hn-ref-reg-meta { display: flex; align-items: center; gap: 10px; }

.hn-ref-reg-body {
    padding: 16px;
    border-top: 1px solid #f1f5f9;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}
.hn-ref-reg-body dt { font-size: 11px; color: #94a3b8; font-weight: 600; text-transform: uppercase; margin-bottom: 2px; }
.hn-ref-reg-body dd { font-size: 13px; color: #0f172a; margin: 0 0 8px; }
.hn-ref-summary {
    grid-column: 1 / -1;
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px 12px;
}
.hn-ref-summary strong { font-size: 11px; color: #64748b; display: block; margin-bottom: 4px; }
.hn-ref-summary p { margin: 0; font-size: 13px; color: #334155; }

.hn-ref-reg-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

/* Urgency badges */
.hn-urgency-eletivo    { background: #dcfce7; color: #166534; }
.hn-urgency-prioritario { background: #fef9c3; color: #854d0e; }
.hn-urgency-urgente     { background: #fee2e2; color: #991b1b; }

/* Print styles */
@media print {
    .hn-sidebar, .hn-nav, .hn-rx-actions, .hn-form-actions,
    .hn-btn, button, .hn-modal-overlay { display: none !important; }
    .hn-rx-wrap, .hn-ref-wrap { max-width: 100%; }
    body { background: #fff; }
    .hn-rx-header, .hn-ref-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ====================================================
   Wizard de Agendamento — v3.4
==================================================== */

/* Container geral */
.wiz-container {
    max-width: 700px;
    margin: 0 auto;
}

.wiz-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}
.wiz-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}
.wiz-back-main {
    flex-shrink: 0;
}

/* Barra de progresso */
.wiz-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 28px;
    gap: 0;
}

.wiz-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.wiz-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    border: 2px solid #e2e8f0;
}
.wiz-step.active .wiz-step-circle {
    background: #1a56db;
    color: #fff;
    border-color: #1a56db;
    box-shadow: 0 0 0 4px #dbeafe;
}
.wiz-step.done .wiz-step-circle {
    background: #22c55e;
    color: #fff;
    border-color: #22c55e;
}

.wiz-step-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    white-space: nowrap;
}
.wiz-step.active .wiz-step-label { color: #1a56db; }
.wiz-step.done  .wiz-step-label  { color: #22c55e; }

.wiz-step-line {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin: 0 8px;
    margin-bottom: 20px;
    max-width: 80px;
    transition: background .2s;
}
.wiz-step-line.done { background: #22c55e; }

/* Corpo do wizard */
.wiz-body {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
}

.wiz-step-content {
    padding: 24px;
}

.wiz-step-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
}

.wiz-step-hint {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 20px;
}

/* Passo 1 — Especialidades */
.wiz-spec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.wiz-spec-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}
.wiz-spec-card:hover {
    border-color: #1a56db;
    background: #eff6ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(26,86,219,.1);
}
.wiz-spec-card.selected {
    border-color: #1a56db;
    background: #1a56db;
    color: #fff;
    box-shadow: 0 4px 16px rgba(26,86,219,.3);
}
.wiz-spec-card.selected .wiz-spec-count { color: #93c5fd; }

.wiz-spec-icon { font-size: 28px; line-height: 1; }
.wiz-spec-name { font-size: 12px; font-weight: 600; line-height: 1.3; }
.wiz-spec-count { font-size: 10px; color: #94a3b8; }

/* Passo 2 — Médicos */
.wiz-doc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.wiz-doc-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    width: 100%;
}
.wiz-doc-card:hover {
    border-color: #1a56db;
    background: #f8faff;
}
.wiz-doc-card.selected {
    border-color: #1a56db;
    background: #eff6ff;
}

.wiz-doc-avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.wiz-doc-card.selected .wiz-doc-avatar { background: #1a56db; }

.wiz-doc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.wiz-doc-info strong { font-size: 15px; font-weight: 600; color: #0f172a; }
.wiz-doc-info span   { font-size: 12px; color: #64748b; }
.wiz-doc-info small  { font-size: 11px; color: #94a3b8; }

.wiz-doc-check {
    font-size: 20px;
    color: #1a56db;
    font-weight: 700;
    flex-shrink: 0;
}

/* Passo 3 — Calendário */
.wiz-cal {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.wiz-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0f172a;
    color: #fff;
}

.wiz-cal-nav {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.wiz-cal-nav:hover:not(:disabled) { background: rgba(255,255,255,.25); }
.wiz-cal-nav:disabled { opacity: .35; cursor: not-allowed; }

.wiz-cal-month-label {
    font-size: 15px;
    font-weight: 700;
    text-transform: capitalize;
}

.wiz-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding: 12px;
    background: #f8fafc;
}

.wiz-cal-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    padding: 4px 0 8px;
}

.wiz-cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 10px;
    cursor: pointer;
    transition: all .12s;
    position: relative;
    background: #fff;
    border: 1.5px solid transparent;
}
.wiz-cal-cell:hover:not(.disabled):not(.empty) {
    border-color: #1a56db;
    background: #eff6ff;
}
.wiz-cal-cell.selected {
    background: #1a56db !important;
    border-color: #1a56db;
    color: #fff;
}
.wiz-cal-cell.today {
    border-color: #1a56db;
}
.wiz-cal-cell.today .wiz-cal-today-dot {
    width: 5px; height: 5px;
    background: #1a56db;
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
}
.wiz-cal-cell.selected .wiz-cal-today-dot { background: #fff; }
.wiz-cal-cell.disabled {
    opacity: .35;
    cursor: not-allowed;
    background: #f1f5f9;
}
.wiz-cal-cell.empty { background: transparent; border: none; cursor: default; }
.wiz-cal-cell.saturday .wiz-cal-day-num { color: #1a56db; }

.wiz-cal-day-num {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}
.wiz-cal-cell.selected .wiz-cal-day-num { color: #fff; }
.wiz-cal-cell.disabled .wiz-cal-day-num { color: #94a3b8; }

.wiz-cal-legend {
    display: flex;
    gap: 16px;
    padding: 8px 12px;
    font-size: 11px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
}
.wiz-legend-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 4px;
}
.wiz-legend-dot.today    { background: #fff; border: 2px solid #1a56db; }
.wiz-legend-dot.selected { background: #1a56db; }
.wiz-legend-dot.disabled { background: #f1f5f9; border: 1px solid #e2e8f0; }

.wiz-date-chosen {
    text-align: center;
    font-size: 14px;
    color: #64748b;
    margin: 8px 0 0;
    padding: 8px;
    background: #eff6ff;
    border-radius: 8px;
}
.wiz-date-chosen strong { color: #1a56db; }

/* Passo 4 — Slots */
.wiz-confirm-summary {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.wiz-summary-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.wiz-summary-icon { font-size: 22px; flex-shrink: 0; }
.wiz-summary-row strong { font-size: 14px; font-weight: 600; color: #0f172a; display: block; }
.wiz-summary-row small  { font-size: 12px; color: #64748b; }

.wiz-slot-group { margin-bottom: 16px; }
.wiz-slot-group-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}
.wiz-slots-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wiz-slot-btn {
    padding: 8px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    font-family: monospace;
    transition: all .12s;
    min-width: 68px;
    text-align: center;
}
.wiz-slot-btn:hover { border-color: #1a56db; background: #eff6ff; color: #1a56db; }
.wiz-slot-btn.selected {
    background: #1a56db;
    border-color: #1a56db;
    color: #fff;
    box-shadow: 0 2px 8px rgba(26,86,219,.25);
}

/* Navegação */
.wiz-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

/* Tela de sucesso */
.wiz-success {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.wiz-success-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #fff;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(34,197,94,.3);
    animation: wiz-pop .4s cubic-bezier(.175,.885,.32,1.275);
}
@keyframes wiz-pop {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.wiz-success h2 { margin: 0; font-size: 24px; font-weight: 700; color: #0f172a; }
.wiz-success-card {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 24px;
    width: 100%;
    max-width: 380px;
}
.wiz-success-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
}
.wiz-success-row:last-child { border-bottom: none; }
.wiz-success-row strong { color: #64748b; font-weight: 600; }
.wiz-success-row span   { color: #0f172a; font-weight: 500; }

/* ====================================================
   Diretório — Laboratórios e Especialidades (v3.5)
==================================================== */

/* Filtros */
.dir-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
}

.dir-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

.dir-pill {
    padding: 6px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 100px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    transition: all .15s;
    white-space: nowrap;
}
.dir-pill:hover { border-color: #1a56db; color: #1a56db; background: #eff6ff; }
.dir-pill.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.dir-pill--pub.active  { background: #166534; border-color: #166534; }
.dir-pill--priv.active { background: #4338ca; border-color: #4338ca; }
.dir-pill--area.active { background: #0ea5e9; border-color: #0ea5e9; }

.dir-search-wrap { min-width: 220px; }
.dir-search-wrap .hn-input {
    padding: 7px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}
.dir-search-wrap .hn-input:focus { border-color: #1a56db; }

/* Seções */
.dir-section { margin-bottom: 28px; }
.dir-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Grid de cards */
.dir-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

/* Card */
.dir-card {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .15s, transform .15s;
    position: relative;
    overflow: hidden;
}
.dir-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-2px);
}
.dir-card--featured {
    border-color: #fbbf24;
    box-shadow: 0 0 0 1px #fbbf24;
}
.dir-card--pub  { border-left: 4px solid #22c55e; }
.dir-card--priv { border-left: 4px solid #6366f1; }

/* Header */
.dir-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.dir-card-logo {
    flex-shrink: 0;
}
.dir-logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    padding: 4px;
}
.dir-logo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1.5px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.dir-card-title-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dir-card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
}
.dir-card-area {
    font-size: 12px;
    color: #0ea5e9;
    font-weight: 600;
}

.dir-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.dir-type-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
}
.dir-type-pub  { background: #dcfce7; color: #166534; }
.dir-type-priv { background: #ede9fe; color: #4338ca; }
.dir-badge-custom {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 100px;
    background: #fef3c7;
    color: #92400e;
}
.dir-badge-featured {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    background: #fef9c3;
    color: #854d0e;
}

/* Descrição */
.dir-card-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Endereço */
.dir-card-address {
    font-size: 12px;
    color: #64748b;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    line-height: 1.4;
}

/* Botões de contato */
.dir-card-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.dir-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: all .12s;
    border: 1.5px solid transparent;
}
.dir-contact-btn:hover { filter: brightness(.92); transform: translateY(-1px); }

.dir-contact-phone    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.dir-contact-whatsapp { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.dir-contact-email    { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.dir-contact-web      { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* ====================================================
   Wizard Agendamento v3.6 — Passo 1 Spec+Doc,
   Bloqueio de duplo agendamento
==================================================== */

/* Card de consulta ativa (bloqueio) */
.wiz-active-appt {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: #fef9c3;
    border: 1.5px solid #fde68a;
    border-radius: 12px;
    margin-bottom: 16px;
}
.wiz-active-appt-icon { font-size: 32px; }
.wiz-active-appt-info h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 700;
    color: #78350f;
}
.wiz-active-appt-info p {
    margin: 0;
    font-size: 13px;
    color: #92400e;
}
.wiz-current-card {
    border-color: #fde68a;
    background: #fffbeb;
}

/* Grupos de especialidade no passo 1 */
.wiz1-spec-group {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.wiz1-spec-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    cursor: pointer;
    user-select: none;
    transition: background .12s;
}
.wiz1-spec-header:hover { background: #f1f5f9; }

.wiz1-spec-icon { font-size: 20px; flex-shrink: 0; }
.wiz1-spec-name {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}
.wiz1-spec-count {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
}
.wiz1-spec-chevron {
    font-size: 12px;
    color: #94a3b8;
    transition: transform .15s;
}

.wiz1-doc-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #fff;
}

/* Dot de dia lotado no calendário */
.wiz-cal-busy-dot {
    width: 4px;
    height: 4px;
    background: #f97316;
    border-radius: 50%;
    position: absolute;
    bottom: 3px;
    right: 6px;
}

/* ============================================================
   NOTIFICAÇÕES IN-APP — BELL + PAINEL
============================================================ */
.hn-bell-btn:hover { background: rgba(255,255,255,.16) !important; }
.hn-notif-item:hover { background: #f8faff !important; }

/* Painel de notificações — mobile */
@media (max-width: 768px) {
  #hn-notif-panel {
    width: 100vw !important;
    border-radius: 16px 16px 0 0;
    position: fixed !important;
    bottom: 0;
    top: auto !important;
    height: 85vh !important;
    max-height: 85vh !important;
  }
}

/* ============================================================
   MULTI-TENANT — SELETOR DE UNIDADE
============================================================ */
.hn-unit-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,.06);
  border-top: 1px solid rgba(255,255,255,.08);
  font-size: 12px;
  color: rgba(255,255,255,.6);
}
.hn-unit-selector select {
  background: transparent;
  border: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.8);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  flex: 1;
  min-width: 0;
}

/* ============================================================
   CONSENTIMENTO LGPD — MODAL STYLING
============================================================ */
.hn-consent-label:hover {
  border-color: var(--c-brand) !important;
  background: #f0f7ff !important;
}

/* ============================================================
   TIMELINE VISUAL
============================================================ */
.hn-timeline { position:relative; padding: 0 0 20px; }
.hn-timeline-month { margin-bottom: 28px; }
.hn-timeline-month-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--c-muted); margin-bottom: 12px;
  padding-bottom: 6px; border-bottom: 1.5px solid var(--c-border);
}
.hn-timeline-item {
  display: flex; gap: 14px; margin-bottom: 14px; align-items: flex-start;
  padding: 12px 16px; background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg); transition: box-shadow .15s;
}
.hn-timeline-item:hover { box-shadow: var(--shadow-sm); }
.hn-timeline-dot {
  width: 38px; height: 38px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 16px;
  flex-shrink: 0; border: 2px solid transparent; background: var(--c-bg);
}
.hn-timeline-content { flex: 1; min-width: 0; }
.hn-timeline-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 3px;
}
.hn-timeline-header strong { font-size: 13px; color: var(--c-text); font-weight: 600; }
.hn-timeline-sub  { font-size: 12px; color: var(--c-muted); margin: 2px 0; }
.hn-timeline-notes{ font-size: 12px; color: var(--c-muted); font-style: italic; margin: 3px 0; }
.hn-timeline-date { font-size: 11px; color: var(--c-subtle); }

/* ============================================================
   KPI CARDS — Admin Dashboard
============================================================ */
.hn-kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
@media (max-width: 768px) { .hn-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .hn-kpi-grid { grid-template-columns: 1fr; } }

/* ============================================================
   TEMPLATES DE PRESCRIÇÃO
============================================================ */
.hn-templates-panel {
  position: absolute; z-index: 100; background: var(--c-surface);
  border: 1.5px solid var(--c-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 260px; max-height: 400px; overflow-y: auto;
  top: calc(100% + 4px); left: 0;
}
.hn-templates-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--c-border);
  font-size: 12px; font-weight: 700; color: var(--c-text);
  position: sticky; top: 0; background: var(--c-surface);
}
.hn-templates-list { padding: 6px; }
.hn-template-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px;
  border: none; background: none; cursor: pointer; border-radius: 6px;
  font-size: 13px; color: var(--c-text); text-align: left; transition: background .12s;
}
.hn-template-item:hover { background: var(--c-bg); }
.hn-template-icon { font-size: 16px; flex-shrink: 0; }
.hn-template-name { font-size: 12px; font-weight: 500; }

/* Botão de templates na receita */
.hn-btn-templates {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
}

/* ============================================================
   AGENDA DO MÉDICO — Horário de Trabalho
============================================================ */
#horario-table input:disabled,
#horario-table select:disabled { opacity: .4; cursor: not-allowed; }
#horario-table tr[data-dow] { transition: opacity .15s; }

/* ============================================================
   DOCUMENTOS
============================================================ */
.hn-doc-upload-area {
  border: 2px dashed var(--c-border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer; transition: border-color .15s;
}
.hn-doc-upload-area:hover { border-color: var(--c-brand); background: var(--c-brand-lt); }

/* ============================================================
   ADMIN BADGES EXTRA
============================================================ */
.hn-badge--active   { background: var(--c-success-lt); color: var(--c-success); }
.hn-badge--inactive { background: var(--c-danger-lt);  color: var(--c-danger);  }
.hn-badge--vacation { background: var(--c-warning-lt); color: var(--c-warning); }
.hn-badge--info     { background: var(--c-info-lt);    color: var(--c-brand);   }

/* ============================================================
   PRONTUÁRIO — Botão Templates
============================================================ */

/* Scroll de notificação n8n */
.hn-notice--warn { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px;
  padding: 10px 14px; color: #92400e; font-size: 13px; }
.hn-notice--success { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px;
  padding: 10px 14px; color: #166534; font-size: 13px; }

/* ============================================================
   ENCAMINHAMENTOS — Cards do médico (v2.6)
============================================================ */
.hn-ref-card {
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--radius); margin-bottom: 12px;
  transition: box-shadow .15s;
}
.hn-ref-card:hover { box-shadow: var(--shadow-sm); }

.hn-ref-card-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 14px 16px 10px;
}
.hn-ref-card-patient {
  font-size: 14px; font-weight: 700; color: var(--c-text); margin-bottom: 3px;
}
.hn-ref-card-specialty { font-size: 12px; color: var(--c-muted); }
.hn-ref-card-date      { font-size: 11px; color: var(--c-muted); margin-top: 2px; }
.hn-ref-card-badges    { display: flex; flex-wrap: wrap; gap: 6px; flex-shrink: 0; }

.hn-ref-card-summary {
  padding: 0 16px 10px; font-size: 13px; color: var(--c-text);
  line-height: 1.5; border-top: 1px solid var(--c-border); padding-top: 10px;
}

.hn-ref-card-regulacao {
  margin: 0 16px 10px; padding: 10px 12px;
  background: #f0fdf4; border-radius: 8px;
  font-size: 12px; color: #166534; line-height: 1.5;
}
.hn-ref-card-regulacao--negado {
  background: #fef2f2; color: #991b1b;
}

.hn-ref-card-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px 14px; border-top: 1px solid var(--c-border);
}

/* Patient info bar inside modal */
.hn-ref-patient-bar {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px;
  background: var(--c-bg); border-radius: 8px; padding: 12px 14px;
  margin-bottom: 14px;
}
.hn-ref-patient-bar label {
  display: block; font-size: 10px; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
}
.hn-ref-patient-bar span { font-size: 13px; color: var(--c-text); font-weight: 600; }

/* Notice info variant */
.hn-notice--info {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 8px; padding: 10px 14px; color: #1e40af; font-size: 13px;
}

/* Botão SM */
.hn-btn--sm { font-size: 12px; padding: 5px 10px; border-radius: 6px; }

@media (max-width: 600px) {
  .hn-ref-card-header { flex-direction: column; }
  .hn-ref-patient-bar { grid-template-columns: 1fr; }
  .hn-ref-card-actions { flex-direction: column; }
  .hn-ref-card-actions .hn-btn { width: 100%; justify-content: center; }
}

/* ============================================================
   PRONTUÁRIO — Histórico de Resultados de Exames (v2.8)
============================================================ */
.hn-exam-result-group {
  border: 1.5px solid var(--c-border); border-radius: var(--radius);
  margin-bottom: 12px; overflow: hidden;
}
.hn-exam-result-group-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--c-bg); padding: 8px 14px;
  font-size: 12px; font-weight: 700; color: var(--c-muted);
  border-bottom: 1px solid var(--c-border);
}
.hn-exam-result-group-date { color: var(--c-text); }
.hn-exam-result-group-count { color: var(--c-muted); font-weight: 500; }

.hn-exam-result-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border);
}
.hn-exam-result-item:last-child { border-bottom: none; }

.hn-exam-result-type {
  display: flex; align-items: center; gap: 4px;
  font-size: 13px; margin-bottom: 6px;
}
.hn-exam-result-text {
  font-size: 13px; color: var(--c-text); line-height: 1.6;
  background: var(--c-bg); border-radius: 6px;
  padding: 8px 10px; white-space: pre-wrap;
  border: 1px solid var(--c-border); margin-bottom: 6px;
}
.hn-exam-result-text--empty {
  color: var(--c-muted); font-style: italic;
}
.hn-exam-result-file {
  font-size: 12px; color: var(--c-brand); margin-bottom: 4px;
}
.hn-exam-result-meta {
  font-size: 11px; color: var(--c-muted);
}

/* ============================================================
   RECEPÇÃO — Gestão de Médicos e Agendas (v2.9)
============================================================ */
.hn-agenda-editor { align-items: start; }

.hn-medico-sidebar {
  border: 1.5px solid var(--c-border); border-radius: var(--radius);
  overflow: hidden; background: var(--c-surface);
}
.hn-medico-sidebar-header {
  padding: 10px 14px; font-size: 11px; font-weight: 700;
  color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em;
  background: var(--c-bg); border-bottom: 1px solid var(--c-border);
}
.hn-medico-sidebar-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: none; background: none; cursor: pointer;
  border-bottom: 1px solid var(--c-border); text-align: left;
  transition: background .12s;
}
.hn-medico-sidebar-btn:last-child { border-bottom: none; }
.hn-medico-sidebar-btn:hover  { background: var(--c-bg); }
.hn-medico-sidebar-btn.active { background: var(--c-brand-lt); }
.hn-medico-sidebar-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--c-brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.hn-medico-sidebar-info { flex: 1; min-width: 0; }
.hn-medico-sidebar-info strong { display: block; font-size: 13px; color: var(--c-text); }
.hn-medico-sidebar-info small  { display: block; font-size: 11px; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Horário editor */
.hn-horario-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.hn-horario-notice {
  display: flex; gap: 8px; align-items: flex-start;
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 10px 12px; font-size: 12px; color: #1e40af; margin-bottom: 14px; line-height: 1.5;
}
.hn-horario-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border: 1.5px solid var(--c-border);
  border-radius: var(--radius); margin-bottom: 8px;
  background: var(--c-surface); transition: border-color .15s;
}
.hn-horario-row--active { border-color: var(--c-brand); background: var(--c-brand-lt); }
.hn-horario-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 140px; }
.hn-horario-day { font-size: 13px; font-weight: 600; color: var(--c-text); }
.hn-horario-fields {
  display: flex; gap: 10px; flex-wrap: wrap; flex: 1; align-items: center;
}
.hn-horario-fields--disabled { opacity: .4; pointer-events: none; }
.hn-horario-field { display: flex; flex-direction: column; gap: 3px; }
.hn-horario-field label { font-size: 10px; font-weight: 700; color: var(--c-muted); text-transform: uppercase; }

/* Lista do Dia */
.hn-lista-dia-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px;
}
.hn-lista-dia-stat {
  border-radius: var(--radius); padding: 12px 14px; text-align: center;
  border: 1.5px solid var(--c-border);
}
.hn-lista-dia-stat-num   { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.hn-lista-dia-stat-label { display: block; font-size: 11px; color: var(--c-muted); margin-top: 2px; }
.hn-lista-dia-stat--scheduled { border-color: #93c5fd; background: #eff6ff; }
.hn-lista-dia-stat--scheduled .hn-lista-dia-stat-num { color: #1d4ed8; }
.hn-lista-dia-stat--completed { border-color: #6ee7b7; background: #f0fdf4; }
.hn-lista-dia-stat--completed .hn-lista-dia-stat-num { color: #15803d; }
.hn-lista-dia-stat--noshow    { border-color: #fca5a5; background: #fff1f2; }
.hn-lista-dia-stat--noshow    .hn-lista-dia-stat-num { color: #b91c1c; }
.hn-lista-dia-stat--cancelled { border-color: #d1d5db; background: #f9fafb; }
.hn-lista-dia-stat--cancelled .hn-lista-dia-stat-num { color: #6b7280; }

.hn-table--lista-dia td { vertical-align: middle; }
.hn-lista-row--no_show   td { opacity: .6; }
.hn-lista-row--cancelled td { opacity: .5; }
.hn-lista-row--completed td { background: #f0fdf4; }

/* Badge no_show */
.hn-badge--no_show    { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.hn-badge--scheduled  { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }
.hn-badge--completed  { background: #dcfce7; color: #166534; border-color: #6ee7b7; }

@media (max-width: 768px) {
  .hn-agenda-editor { grid-template-columns: 1fr; }
  .hn-lista-dia-stats { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 480px) {
  .hn-lista-dia-stats { grid-template-columns: 1fr 1fr; }
  .hn-horario-fields { flex-direction: column; }
}

/* ============================================================
   HISTÓRICO RECEPÇÃO — Resultados com Impressão (v2.9)
============================================================ */
.hn-result-preview {
  font-size: 12px; color: var(--c-text); line-height: 1.4;
  max-width: 280px; display: inline-block;
}
@media print {
  .hn-prontuario-actions, .hn-tabs, .hn-btn,
  #hn-sidebar, .hn-topbar, .hn-shell > aside { display: none !important; }
}

/* ============================================================
   REGULAÇÃO — Cards de Pedidos (v3.0)
============================================================ */
.hn-reg-card--expanded { margin-bottom: 14px; }

.hn-reg-card-header { padding: 14px 16px; }
.hn-reg-card-header--collapsible { cursor: pointer; }
.hn-reg-card-header--collapsible:hover { background: var(--c-bg); }

.hn-reg-card-title {
  display: flex; flex-direction: column; gap: 5px; flex: 1;
}
.hn-reg-card-patient {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 14px; color: var(--c-text);
}
.hn-reg-card-doctor {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  font-size: 13px; color: var(--c-muted);
}
.hn-reg-card-meta-inline {
  font-size: 11px; color: var(--c-muted);
  background: var(--c-bg); border-radius: 4px;
  padding: 1px 6px; border: 1px solid var(--c-border);
}
.hn-reg-card-date { font-size: 12px; color: var(--c-muted); }

/* Exames em tags */
.hn-reg-exams-list {
  padding: 12px 16px 10px;
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}
.hn-reg-exams-list > strong { font-size: 12px; display: block; margin-bottom: 8px; color: var(--c-text); }
.hn-reg-exams-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.hn-reg-exam-tag {
  background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe;
  border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 500;
}

/* Info grid */
.hn-reg-info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; padding: 14px 16px;
}
.hn-reg-info-block { font-size: 13px; }
.hn-reg-info-block strong { display: block; font-size: 11px; font-weight: 700;
  color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.hn-reg-info-block p { margin: 2px 0; color: var(--c-text); line-height: 1.5; }
.hn-reg-info-block code { font-size: 12px; background: var(--c-bg); padding: 1px 4px; border-radius: 3px; }
.hn-reg-info-block--full { grid-column: 1 / -1; }

@media (max-width: 600px) {
  .hn-reg-card-patient, .hn-reg-card-doctor { flex-direction: column; align-items: flex-start; gap: 4px; }
  .hn-reg-info-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   RECEPÇÃO — Posto de Saúde (v3.0)
============================================================ */
.hn-posto-banner {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(135deg, #1a56db 0%, #1e40af 100%);
  color: #fff; border-radius: var(--radius); padding: 20px 24px;
  margin-bottom: 16px;
}
.hn-posto-icon { font-size: 2.5rem; flex-shrink: 0; }
.hn-posto-banner-info { flex: 1; min-width: 0; }
.hn-posto-banner-info h2 { font-size: 20px; font-weight: 800; margin: 0 0 6px; }
.hn-posto-banner-info h3 { font-size: 16px; font-weight: 700; margin: 0 0 4px; }
.hn-posto-banner-info p  { margin: 0; opacity: .85; font-size: 13px; }
.hn-posto-banner-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.hn-posto-banner-meta .hn-badge { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.3); }
.hn-posto-banner .hn-btn { flex-shrink: 0; background: rgba(255,255,255,.15); color: #fff;
  border: 1.5px solid rgba(255,255,255,.3); }
.hn-posto-banner .hn-btn:hover { background: rgba(255,255,255,.25); }

.hn-posto-info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.hn-posto-info-block {
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.hn-posto-info-block--full { grid-column: 1 / -1; }
.hn-posto-info-label {
  font-size: 11px; font-weight: 700; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.hn-posto-info-value {
  font-size: 13px; color: var(--c-text); line-height: 1.6;
}

/* Modal fields full width */
.hn-field--full-modal { grid-column: 1 / -1; }

@media (max-width: 600px) {
  .hn-posto-banner { flex-direction: column; align-items: flex-start; }
  .hn-posto-info-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PACIENTE — Exames: laudo consolidado por dia (v3.1)
============================================================ */
.hn-exam-day-card {
  background: var(--c-surface); border: 1.5px solid var(--c-border);
  border-radius: var(--radius); margin-bottom: 14px;
  overflow: hidden; transition: box-shadow .15s;
}
.hn-exam-day-card:hover { box-shadow: var(--shadow-sm); }

.hn-exam-day-header {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 18px 0;
}
.hn-exam-day-info {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.hn-exam-day-date {
  font-size: 15px; font-weight: 700; color: var(--c-text);
}
.hn-exam-day-count {
  font-size: 12px; color: var(--c-muted);
  background: var(--c-bg); border-radius: 20px;
  padding: 2px 8px; border: 1px solid var(--c-border);
}
.hn-exam-day-types {
  display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 12px;
}
.hn-exam-type-tag {
  background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe;
  border-radius: 20px; padding: 3px 10px;
  font-size: 12px; font-weight: 500;
}

/* Preview inline */
.hn-exam-day-preview {
  border-top: 1px solid var(--c-border);
  padding: 14px 18px;
  background: var(--c-bg);
}
.hn-exam-preview-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border);
}
.hn-exam-preview-item:last-child { border-bottom: none; padding-bottom: 0; }

.hn-exam-preview-type {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; margin-bottom: 8px;
}
.hn-exam-preview-date {
  font-size: 11px; color: var(--c-muted); margin-left: auto;
}
.hn-exam-preview-text {
  font-size: 13px; color: var(--c-text); line-height: 1.7;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: 6px; padding: 10px 12px;
  white-space: pre-wrap; max-height: 200px; overflow-y: auto;
}

/* Ações do card */
.hn-exam-day-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 18px; border-top: 1px solid var(--c-border);
  background: var(--c-surface);
}

@media (max-width: 480px) {
  .hn-exam-day-actions { flex-direction: column; }
  .hn-exam-day-actions .hn-btn { width: 100%; justify-content: center; }
}

/* ═══════════════════════════════════════════════════════════════
   PRONTUÁRIO MÉDICO — TABS v2.0
   Auditoria 2026 — 4 tabs por paciente, dados isolados
═══════════════════════════════════════════════════════════════ */

/* Container das tabs do prontuário */
.hn-prontuario-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 2px solid var(--c-border);
  margin-bottom: 20px;
  padding-bottom: 0;
}

.hn-prontuario-tabs .hn-tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
  background: var(--c-bg-alt);
  color: var(--c-muted);
  cursor: pointer;
  transition: all .15s;
  margin-bottom: -2px;
  position: relative;
}

.hn-prontuario-tabs .hn-tab:hover {
  background: var(--c-surface);
  color: var(--c-text);
}

.hn-prontuario-tabs .hn-tab.active {
  background: var(--c-surface);
  color: var(--c-primary);
  border-color: var(--c-border);
  border-bottom-color: var(--c-surface);
  z-index: 1;
}

/* Painéis */
.hn-tab-panel {
  animation: hn-fadein .18s ease;
}

@keyframes hn-fadein {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tab 1: Dados do Paciente ─────────────────────────────── */
.hn-prontuario-dados-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.hn-card--full {
  grid-column: 1 / -1;
}

.hn-dl--wide dt { min-width: 140px; }
.hn-dl--wide { gap: 8px 0; }

/* Resumo estatístico */
.hn-resumo-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.hn-resumo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
  padding: 12px 16px;
  background: var(--c-bg-alt);
  border-radius: 10px;
  border: 1px solid var(--c-border);
  gap: 2px;
}

.hn-resumo-icon { font-size: 1.3rem; }
.hn-resumo-num  { font-size: 1.6rem; font-weight: 700; color: var(--c-primary); line-height: 1.1; }
.hn-resumo-label{ font-size: 11px; color: var(--c-muted); text-align: center; }

/* Badge SUS */
.hn-sus-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e8f4fd;
  color: #1565c0;
  border: 1px solid #90caf9;
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  font-family: 'Courier New', monospace;
}

/* ── Barra de identificação do paciente nos pedidos ─────── */
.hn-pedido-patient-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background: linear-gradient(135deg, #e8f4fd 0%, #e3f2fd 100%);
  border: 1px solid #90caf9;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}

.hn-pedido-patient-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
}

.hn-pedido-patient-field label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #1565c0;
  margin: 0;
}

.hn-pedido-patient-field span,
.hn-pedido-patient-field strong {
  font-size: 13px;
  color: var(--c-text);
}

.hn-pedido-patient-field--sus .hn-sus-badge {
  font-size: 12px;
}

/* ── Formulário de encaminhamento inline ─────────────────── */
.hn-enc-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Mini card de encaminhamento no histórico ─────────────── */
.hn-ref-card-mini {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 12px 14px;
}

/* ── Aviso de erro/info ──────────────────────────────────── */
.hn-notice--error {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* ── Responsivo ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .hn-prontuario-dados-grid { grid-template-columns: 1fr; }
  .hn-prontuario-tabs .hn-tab { padding: 8px 12px; font-size: 12px; }
  .hn-pedido-patient-bar { gap: 10px; }
}

/* ── Ações rápidas do prontuário (Tab Consulta e Tab Dados) ─── */
.hn-pront-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  align-items: center;
}

.hn-pront-quick-actions::before {
  content: '⚡ Ações Rápidas:';
  font-size: 11px;
  font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-right: 4px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════
   TAB RECEITA MÉDICA — Estilos isolados
   IDs sufixados por patient.id — sem risco de colisão
═══════════════════════════════════════════════════════════════ */

/* Tab com cor especial para receita */
.hn-prontuario-tabs .hn-tab.hn-tab--receita {
  color: #166534;
}
.hn-prontuario-tabs .hn-tab.hn-tab--receita.active {
  color: #166534;
  border-bottom-color: var(--c-surface);
}
.hn-prontuario-tabs .hn-tab.hn-tab--receita:hover {
  background: #f0fdf4;
}

/* Seletor de tipo de receita */
.hn-rx-tab-tipos {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hn-rx-tab-tipo-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1.5px solid var(--c-border, #e5e7eb);
  background: var(--c-bg-alt, #f9fafb);
  color: var(--c-text, #111827);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  transition: all .15s;
}

.hn-rx-tab-tipo-btn:hover {
  border-color: #6b7280;
  background: var(--c-surface);
}

.hn-rx-tab-tipo-btn.active {
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}


/* ============================================================
   WORDPRESS ADMIN BAR — neutralização completa
   O WP injeta margin-top:32px no body via wp-admin-bar.css.
   O HealthNet é uma SPA fullscreen — qualquer margin no body
   gera espaço em branco no topo. Neutralizamos aqui.
   O #wpadminbar já é position:fixed no WP moderno (≥3.8),
   portanto NÃO precisamos compensar com margin no shell.
============================================================ */
html,
body,
body.admin-bar,
body.no-admin-bar {
  margin-top: 0 !important;
  padding-top: 0 !important;
}
#hn-app, .hn-shell { margin-top: 0 !important; }


/* ============================================================
   SUPRESSÃO DO TEMA WORDPRESS EM PÁGINAS DO HEALTHNET
   Quando body tem .healthnet-page (injetado pelo Bootstrap),
   ocultamos todos os elementos do tema (header, footer, nav)
   que ficam acima/abaixo do #hn-app, causando espaço em branco.
============================================================ */
body.healthnet-page,
body.healthnet-fullscreen {
  overflow: hidden;
  margin: 0 !important;
  padding: 0 !important;
}

/* Oculta elementos comuns de temas que envolvem o conteúdo */
body.healthnet-page #masthead,
body.healthnet-page #site-header,
body.healthnet-page .site-header,
body.healthnet-page header.site-header,
body.healthnet-page header[role="banner"],
body.healthnet-page #colophon,
body.healthnet-page #site-footer,
body.healthnet-page .site-footer,
body.healthnet-page footer.site-footer,
body.healthnet-page footer[role="contentinfo"],
body.healthnet-page #secondary,
body.healthnet-page .sidebar,
body.healthnet-page .widget-area,
body.healthnet-page nav.navigation,
body.healthnet-page .breadcrumbs,
body.healthnet-page .entry-header,
body.healthnet-page .page-header,
body.healthnet-page .wp-block-template-part:not(#hn-app *),
body.healthnet-page .wp-site-blocks > header,
body.healthnet-page .wp-site-blocks > footer {
  display: none !important;
}

/* Zera qualquer padding/margin de wrappers do tema ao redor do conteúdo */
body.healthnet-page #page,
body.healthnet-page #content,
body.healthnet-page .site,
body.healthnet-page .site-content,
body.healthnet-page #primary,
body.healthnet-page .content-area,
body.healthnet-page main#main,
body.healthnet-page .wp-site-blocks,
body.healthnet-page .entry-content,
body.healthnet-page article.page {
  margin: 0 !important;
  padding: 0 !important;
  max-width: none !important;
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Garante que o #hn-app ocupe toda a viewport */
body.healthnet-page #hn-app,
body.healthnet-page .hn-app-root {
  position: fixed;
  inset: 0;
  z-index: 9000;
  overflow-y: auto;
  background: var(--c-bg, #f8fafc);
}

/* ============================================================
   HealthNet v2.5 — Triagem · Fila · Perfil Clínico
============================================================ */

/* ── Fila de Atendimento ─────────────────────────────────── */
.hn-kpi-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hn-kpi {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 20px;
  text-align: center;
  min-width: 100px;
  flex: 1;
}
.hn-kpi-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--c-primary, #2563eb);
  line-height: 1;
}
.hn-kpi-label {
  display: block;
  font-size: 0.75rem;
  color: var(--c-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ── Triagem — cores de risco ───────────────────────────── */
.hn-tri-risco {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.hn-tri-risco--vermelho { background: #ef4444; }
.hn-tri-risco--laranja  { background: #f97316; }
.hn-tri-risco--amarelo  { background: #eab308; color: #1a1a1a; }
.hn-tri-risco--verde    { background: #22c55e; }
.hn-tri-risco--azul     { background: #3b82f6; }

/* Botão de cor de triagem */
.hn-tri-cor {
  padding: 6px 12px;
  font-size: 13px;
  transition: opacity .15s, font-weight .1s;
}
.hn-tri-cor:hover { opacity: 1 !important; }

/* ── Autocomplete ─────────────────────────────────────────── */
.hn-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  z-index: 500;
  max-height: 200px;
  overflow-y: auto;
}
.hn-autocomplete-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--c-border);
}
.hn-autocomplete-item:last-child { border-bottom: none; }
.hn-autocomplete-item:hover { background: var(--c-bg); }
.hn-autocomplete-item small { color: var(--c-muted); margin-left: 6px; }

/* ── Perfil Clínico ──────────────────────────────────────── */
.hn-clinical-alert {
  background: #fff1f2;
  border-left: 4px solid #ef4444;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 12px;
  font-size: 13px;
  color: #991b1b;
  margin-bottom: 8px;
}
.hn-clinical-alert strong { display: block; margin-bottom: 2px; }

/* Estado do prontuário */
.hn-record-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.hn-record-state--draft   { background: #fef3c7; color: #92400e; }
.hn-record-state--signed  { background: #dcfce7; color: #166534; }
.hn-record-state--locked  { background: #e0e7ff; color: #3730a3; }

/* ── Merge de pacientes ──────────────────────────────────── */
.hn-merge-box {
  border: 2px dashed var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.hn-merge-box.src { border-color: #ef4444; background: #fff1f2; }
.hn-merge-box.tgt { border-color: #22c55e; background: #f0fdf4; }

/* ── Responsivo v2.5 ────────────────────────────────────── */
@media (max-width: 768px) {
  .hn-kpi-row { gap: 8px; }
  .hn-kpi     { min-width: calc(50% - 4px); }
  .hn-tri-cor { font-size: 12px; padding: 4px 8px; }
}

/* ============================================================
   HealthNet v2.6 — Estilos novos
============================================================ */

/* Badge piscante para emergências na fila */
@keyframes hn-pulse-badge {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.7; transform: scale(1.06); }
}
.hn-badge-pulse {
    animation: hn-pulse-badge 1.2s infinite;
    display: inline-block;
}

/* KPI de urgentes na fila */
.hn-kpi--alert {
    border: 2px solid #dc2626;
    background: #fff1f2;
    border-radius: 8px;
    padding: 4px 10px;
    animation: hn-pulse-badge 1.5s infinite;
}

/* Banner de estado legal do prontuário */
.hn-state-banner {
    margin-bottom: 14px;
}

/* Toast urgente */
@keyframes hn-toast-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
    50%       { box-shadow: 0 0 0 8px rgba(220,38,38,0); }
}
.hn-toast-urgent {
    animation: hn-toast-pulse 1s infinite;
}

/* Linha da fila com urgência */
tr[style*="background:#fef2f2"] td {
    border-top: 1px solid #fecaca;
    border-bottom: 1px solid #fecaca;
}

/* 2FA challenge layout */
.hn-2fa-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--c-bg, #f1f5f9);
}

/* Histórico de triagem */
.hn-triage-history-item {
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border-left-width: 5px;
    border-left-style: solid;
    background: #fff;
}

/* Autocomplete para campos de busca */
.hn-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 200;
    max-height: 220px;
    overflow-y: auto;
}
.hn-autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--c-bg-alt, #f9fafb);
    transition: background 0.1s;
}
.hn-autocomplete-item:hover {
    background: var(--c-bg-alt, #f1f5f9);
}
.hn-autocomplete-item small {
    color: var(--c-muted, #6b7280);
    font-size: 11px;
    margin-left: 6px;
}

/* ================================================================
   FILA DO CHAT — painel de gestão (renderFilaChatStaff)
================================================================ */

/* Layout geral */
.fc-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    height: calc(100vh - 220px);
    min-height: 480px;
}
@media (max-width: 768px) {
    .fc-layout { grid-template-columns: 1fr; height: auto; }
    .fc-panel-right { min-height: 400px; }
}

/* Painel esquerdo: lista de pacientes */
.fc-panel-left {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Abas */
.fc-tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}
.fc-tab {
    flex: 1;
    border: none;
    background: none;
    padding: 10px 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: color .15s, border-bottom .15s;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}
.fc-tab:hover { color: #1a56db; }
.fc-tab--active {
    color: #1a56db;
    border-bottom-color: #1a56db;
    background: #fff;
}
.fc-badge {
    display: inline-block;
    background: #ef4444;
    color: #fff;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    padding: 0 4px;
    text-align: center;
    line-height: 16px;
    vertical-align: middle;
    margin-left: 2px;
}
.fc-badge:empty { display: none; }

/* Lista de pacientes */
#fc-list-queue, #fc-list-active, #fc-list-hist {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
    scrollbar-width: thin;
}

.fc-patient-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    transition: background .12s;
    border-bottom: 1px solid #f3f4f6;
}
.fc-patient-row:hover { background: #f1f5f9; }
.fc-patient-row--selected { background: #eff6ff; }
.fc-patient-row--mine { border-left: 3px solid #22c55e; }
.fc-patient-row--finished { opacity: .75; }

.fc-patient-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #1a56db;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.fc-patient-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.fc-patient-info strong { font-size: 13px; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-patient-info small  { font-size: 11px; color: #6b7280; }
.fc-patient-preview     { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fc-pos-badge {
    font-size: 11px; font-weight: 700;
    background: #fef3c7; color: #92400e;
    border-radius: 6px; padding: 2px 6px;
    flex-shrink: 0;
}

.fc-list-empty {
    padding: 32px 16px;
    text-align: center;
    color: #6b7280;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.fc-list-empty span { font-size: 2rem; }
.fc-list-empty p    { font-size: 14px; font-weight: 600; margin: 0; }
.fc-list-empty small { font-size: 12px; color: #9ca3af; }

/* Painel direito: thread da conversa */
.fc-panel-right {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fc-convo-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #9ca3af;
    padding: 40px;
    text-align: center;
}
.fc-convo-empty span { font-size: 2.5rem; }
.fc-convo-empty p    { font-size: 15px; font-weight: 600; color: #6b7280; margin: 0; }
.fc-convo-empty small { font-size: 12px; }

/* Cabeçalho da conversa */
.fc-convo-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}
.fc-convo-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: #1a56db;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 15px;
    flex-shrink: 0;
}
.fc-convo-info { flex: 1; }
.fc-convo-info strong { display: block; font-size: 14px; color: #111827; }
.fc-convo-info small  { font-size: 11px; color: #6b7280; }

/* Lista de mensagens */
.fc-msgs-list {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
}
.fc-msg { display: flex; flex-direction: column; max-width: 70%; }
.fc-msg--patient { align-self: flex-start; }
.fc-msg--staff   { align-self: flex-end; }

.fc-msg-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.fc-msg--patient .fc-msg-bubble {
    background: #f1f5f9;
    color: #111827;
    border-bottom-left-radius: 3px;
}
.fc-msg--staff .fc-msg-bubble {
    background: #1a56db;
    color: #fff;
    border-bottom-right-radius: 3px;
}
.fc-msg-meta {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 3px;
    padding: 0 4px;
}
.fc-msg--staff .fc-msg-meta { text-align: right; }

/* Barra de resposta */
.fc-reply-bar {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 10px 14px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    flex-shrink: 0;
}
.fc-reply-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    resize: none;
    outline: none;
    transition: border-color .15s;
    font-family: inherit;
    line-height: 1.5;
}
.fc-reply-input:focus { border-color: #1a56db; }
.fc-reply-bar--closed {
    justify-content: center;
    color: #9ca3af;
    font-size: 12px;
    font-style: italic;
}
