/* ==========================================================
   SmartCare — tema visual (sobre Bootstrap 5 + Bootstrap Icons)
   ========================================================== */

:root {
  --sc-primary: #0d9488;
  --sc-primary-dark: #0b7a70;
  --sc-primary-deep: #0a3d3a;
  --sc-accent: #f5b95c;
  --sc-ink: #0f2a27;
  --sc-text: #1f2937;
  --sc-muted: #6b7280;
  --sc-bg: #f3f6f6;
  --sc-surface: #ffffff;
  --sc-border: #e6eceb;
  --sc-radius-lg: 20px;
  --sc-radius-md: 14px;
  --sc-shadow-sm: 0 2px 8px rgba(15, 42, 39, 0.06);
  --sc-shadow-md: 0 10px 30px rgba(10, 40, 37, 0.10);
  --sc-shadow-lg: 0 20px 50px rgba(10, 40, 37, 0.18);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--sc-bg);
  color: var(--sc-text);
}

h1, h2, h3, h4, .app-brand {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
}

a {
  color: var(--sc-primary);
}

.page-header {
  margin-bottom: 1.75rem;
}

.page-header h1 {
  font-size: clamp(1.5rem, 1.1rem + 1.5vw, 2.1rem);
  color: var(--sc-ink);
  margin-bottom: 0.25rem;
}

.page-header p {
  color: var(--sc-muted);
  margin-bottom: 0;
}

/* ---------------- Navbar ---------------- */
.app-navbar {
  background: linear-gradient(100deg, var(--sc-primary-deep), var(--sc-primary-dark) 65%, var(--sc-primary));
  box-shadow: 0 4px 24px rgba(10, 40, 37, 0.25);
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff !important;
  font-size: 1.15rem;
}

.brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--sc-accent);
  font-size: 1.05rem;
}

.brand-sub {
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.65);
}

.app-navbar .nav-link {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 600;
  font-size: 0.92rem;
  transition: color 0.15s ease;
}

.app-navbar .nav-link:hover {
  color: #fff;
}

.app-navbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

/* ---------------- Cards / paineis ---------------- */
.panel {
  background: var(--sc-surface);
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-lg);
  box-shadow: var(--sc-shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.panel-header h2 {
  font-size: 1.15rem;
  margin: 0;
  color: var(--sc-ink);
}

/* ---------------- Botoes ---------------- */
.btn-brand {
  background: linear-gradient(135deg, var(--sc-primary), var(--sc-primary-dark));
  border: none;
  color: #fff;
  font-weight: 700;
  border-radius: 12px;
  padding: 0.65rem 1.4rem;
  box-shadow: 0 8px 20px rgba(13, 148, 136, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-brand:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(13, 148, 136, 0.35);
}

.btn-brand-outline {
  background: #fff;
  border: 1.5px solid var(--sc-border);
  color: var(--sc-ink);
  font-weight: 600;
  border-radius: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.btn-brand-outline:hover {
  border-color: var(--sc-primary);
  color: var(--sc-primary-dark);
  transform: translateY(-1px);
}

.btn-icon-danger {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #fdecea;
  color: #c0392b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn-icon-danger:hover {
  background: #f8d5d1;
}

.feed-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon-edit {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: #eef6f5;
  color: var(--sc-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-icon-edit:hover {
  background: #dcefec;
  color: var(--sc-primary-dark);
  transform: translateY(-1px);
}

/* ---------------- Formularios ---------------- */
.form-floating > .form-control,
.form-floating > .form-select,
.form-control,
.form-select {
  border-radius: 12px;
  border: 1.5px solid var(--sc-border);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--sc-primary);
  box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.15);
}

/* ---------------- Feed (lista de clientes em "bolhas") ---------------- */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: var(--sc-surface);
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-lg);
  box-shadow: var(--sc-shadow-sm);
  padding: 1.1rem 1.3rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.feed-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--sc-shadow-md);
  border-color: rgba(13, 148, 136, 0.3);
}

.feed-avatar {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sc-primary), var(--sc-primary-dark));
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
}

.feed-content {
  flex: 1;
  min-width: 0;
}

.feed-top {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

/* Cliente inativo ou suspenso: aparece mais apagado na lista. */
.feed-item-inativo {
  background: #f8faf9;
}

.feed-item-inativo .feed-avatar,
.feed-item-inativo .feed-name {
  opacity: 0.6;
}

.filtro-clientes .form-select {
  min-width: 190px;
}

.feed-name {
  margin: 0;
  font-size: 1.05rem;
  color: var(--sc-ink);
}

.feed-id {
  font-size: 0.78rem;
  color: var(--sc-muted);
  font-weight: 600;
}

.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ---------------- Chips (lista de remedios em "bolhas") ---------------- */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.chip-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--sc-surface);
  border: 1px solid var(--sc-border);
  border-radius: 999px;
  padding: 0.5rem 1.25rem 0.5rem 0.5rem;
  box-shadow: var(--sc-shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.chip-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sc-shadow-md);
  border-color: rgba(13, 148, 136, 0.3);
}

.chip-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sc-primary), var(--sc-primary-dark));
  color: #fff;
  font-size: 1rem;
}

.chip-id {
  display: block;
  font-size: 0.7rem;
  color: var(--sc-muted);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.chip-name {
  margin: 0;
  font-size: 0.95rem;
  color: var(--sc-ink);
  font-weight: 700;
}

/* ---------------- Cards de acao (dashboard) ---------------- */
.action-card {
  display: block;
  background: var(--sc-surface);
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-lg);
  box-shadow: var(--sc-shadow-sm);
  padding: 1.6rem;
  height: 100%;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.action-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--sc-shadow-md);
  border-color: rgba(13, 148, 136, 0.35);
}

.action-card .icon-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  background: linear-gradient(135deg, var(--sc-primary), var(--sc-primary-dark));
  margin-bottom: 1rem;
}

.action-card h2 {
  font-size: 1.1rem;
  color: var(--sc-ink);
  margin-bottom: 0.25rem;
}

.action-card p {
  color: var(--sc-muted);
  margin: 0;
  font-size: 0.92rem;
}

.action-card .go-arrow {
  color: var(--sc-primary);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  margin-left: 0.4rem;
}

.action-card:hover .go-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ---------------- Itens dinamicos da receita ---------------- */
.item-receita {
  position: relative;
  border: 1.5px dashed var(--sc-border);
  border-radius: var(--sc-radius-md);
  padding: 1.25rem 1.25rem 0.75rem;
  margin-bottom: 1rem;
  background: #fbfdfd;
}

.item-receita .item-index {
  position: absolute;
  top: -12px;
  left: 16px;
  background: var(--sc-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

.item-receita .btn-remove-item {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
}

/* Mesma altura do select buscavel (Tom Select), para os campos alinharem na linha */
.item-receita .form-control {
  min-height: 46px;
}

.btn-salvar {
  width: 100%;
}

/* ---------------- Receitas / QR ---------------- */
.receita-card {
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-lg);
  box-shadow: var(--sc-shadow-sm);
  overflow: hidden;
  margin-bottom: 1.75rem;
}

.receita-card-header {
  background: linear-gradient(100deg, var(--sc-primary-deep), var(--sc-primary-dark));
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.receita-toggle {
  flex: 1 1 260px;
  min-width: 0;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.receita-toggle h2 {
  color: #fff;
  font-size: 1.05rem;
  margin: 0;
}

.receita-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.receita-action-btn {
  font-weight: 700;
}

.receita-action-btn.text-brand {
  color: var(--sc-primary-dark);
}

.receita-action-btn.text-delete {
  color: #c0392b;
}

.receita-ver-mais {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.receita-toggle .txt-aberto {
  display: none;
}

.receita-toggle[aria-expanded='true'] .txt-fechado {
  display: none;
}

.receita-toggle[aria-expanded='true'] .txt-aberto {
  display: inline;
}

.receita-toggle .chevron {
  transition: transform 0.2s ease;
}

.receita-toggle[aria-expanded='true'] .chevron {
  transform: rotate(180deg);
}

.receita-card-body {
  padding: 1.5rem;
}

.receita-anexos {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--sc-border);
}

.item-qr-card {
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-md);
  padding: 1.25rem;
  text-align: center;
  height: 100%;
  background: #fff;
  transition: box-shadow 0.15s ease;
}

.item-qr-card:hover {
  box-shadow: var(--sc-shadow-sm);
}

.item-qr-card h3 {
  font-size: 1rem;
  color: var(--sc-ink);
  margin-bottom: 0.6rem;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #eef6f5;
  color: var(--sc-primary-dark);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0.1rem;
  white-space: nowrap;
}

/* No feed de clientes o conteudo (email/telefone) pode ser longo, entao ali
   deixamos a pilula quebrar em vez de estourar a largura do cartao. */
.feed-meta .badge-pill {
  white-space: normal;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.qrcode-frame {
  width: min(148px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0.9rem auto 0.75rem;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--sc-border);
  border-radius: 12px;
  box-shadow: var(--sc-shadow-sm);
}

.qrcode-frame-grande {
  width: min(260px, 100%);
}

.qrcode-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qrcode-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--sc-muted);
  margin-bottom: 0.75rem;
}

/* ---------------- Auth (login / area cliente) ---------------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  background: radial-gradient(1200px 600px at 15% 10%, rgba(13, 148, 136, 0.55), transparent 60%),
    radial-gradient(1000px 700px at 85% 90%, rgba(245, 185, 92, 0.25), transparent 55%),
    linear-gradient(160deg, var(--sc-primary-deep), var(--sc-ink) 60%, #081b19);
}

.auth-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  box-shadow: var(--sc-shadow-lg);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  color: #fff;
  background: linear-gradient(135deg, var(--sc-primary), var(--sc-primary-dark));
  box-shadow: 0 10px 24px rgba(13, 148, 136, 0.35);
}

.auth-card h1 {
  color: var(--sc-ink);
  font-size: 1.6rem;
  margin-bottom: 0.1rem;
}

.auth-card .subtitle {
  color: var(--sc-muted);
  margin-bottom: 1.5rem;
}

.auth-card .form {
  text-align: left;
}

/* ---------------- Select buscavel (Tom Select) ---------------- */
.ts-wrapper .ts-control {
  border-radius: 12px;
  border: 1.5px solid var(--sc-border);
  padding: 0.5rem 0.75rem;
  min-height: 46px;
}

.ts-wrapper.focus .ts-control {
  border-color: var(--sc-primary);
  box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.15);
}

.ts-dropdown {
  border-radius: 12px;
  border: 1px solid var(--sc-border);
  box-shadow: var(--sc-shadow-md);
  overflow: hidden;
  margin-top: 6px;
}

.ts-dropdown .option.active,
.ts-dropdown .option:hover {
  background: #eef6f5;
  color: var(--sc-primary-dark);
}

.ts-wrapper .item {
  background: #eef6f5;
  color: var(--sc-primary-dark);
  border-radius: 8px;
}

/* ---------------- Alertas ---------------- */
.alert {
  border-radius: 12px;
  border: none;
  font-size: 0.92rem;
}

/* ---------------- Utilidades ---------------- */
.text-ink { color: var(--sc-ink); }
.text-muted-sc { color: var(--sc-muted); }

@media (max-width: 575.98px) {
  .auth-card {
    padding: 2rem 1.5rem;
  }
}

/* ---------------- Computador ---------------- */
@media (min-width: 768px) {
  /* Remedios em grade alinhada em vez de pilulas soltas */
  .chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}

@media (min-width: 992px) {
  .app-navbar .navbar-nav .nav-link {
    padding: 0.45rem 0.9rem;
  }

  /* Clientes em duas colunas para aproveitar a largura da tela */
  .feed-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  /* Campos do medicamento numa linha so; o "x" ganha uma coluna propria a direita */
  .item-receita {
    padding: 1.4rem 3.75rem 1rem 1.25rem;
  }

  .item-receita .btn-remove-item {
    top: 50%;
    transform: translateY(-50%);
  }

  .form-acoes {
    display: flex;
    justify-content: flex-end;
  }

  .btn-salvar {
    width: auto;
    min-width: 340px;
  }
}

/* ==========================================================
   Relatorio da receita (documento para tela e impressao A4)
   ========================================================== */
.rel-body {
  --rel-ok: #16a34a;
  --rel-atrasado: #ea580c;
  --rel-adiantado: #ca8a04;
  --rel-nok: #dc2626;
  --rel-pendente: #64748b;
  --rel-vazio: #e2e8f0;
  background: var(--sc-bg);
}

.rel-pagina {
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* Barra de acoes */
.rel-barra {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.rel-barra-btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; font-weight: 600; }

.rel-barra-filtro {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 14px;
  background: #fff;
  border: 1px solid var(--sc-border);
  border-radius: 999px;
  box-shadow: var(--sc-shadow-sm);
}

.rel-barra-filtro label { font-size: 0.85rem; font-weight: 600; color: var(--sc-muted); white-space: nowrap; }
.rel-barra-filtro .form-control { width: auto; border-radius: 999px; }
.rel-barra-filtro .btn-brand { border-radius: 999px; }

/* Folha */
.rel-documento {
  background: #fff;
  border-radius: var(--sc-radius-lg);
  box-shadow: var(--sc-shadow-md);
  overflow: hidden;
}

.rel-cabecalho {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 28px 36px;
  background: linear-gradient(110deg, var(--sc-primary-deep), var(--sc-primary-dark) 60%, var(--sc-primary));
  color: #fff;
}

.rel-logo {
  height: 56px;
  padding: 8px 12px;
  background: #fff;
  border-radius: 14px;
}

.rel-sobretitulo {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.8;
}

.rel-cabecalho h1 {
  margin: 4px 0 0;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  color: #fff;
}

.rel-cabecalho-meta { display: flex; gap: 24px; margin: 0; text-align: right; }
.rel-cabecalho-meta dt { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.75; }
.rel-cabecalho-meta dd { margin: 2px 0 0; font-weight: 700; }

/* Periodo */
.rel-periodo {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px 20px;
  padding: 22px 36px;
  border-bottom: 1px solid var(--sc-border);
  background: #f8fbfb;
}

.rel-periodo-item { display: flex; align-items: center; gap: 10px; }
.rel-periodo-item .bi { font-size: 1.4rem; color: var(--sc-primary); }
.rel-periodo-item span { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sc-muted); }
.rel-periodo-item strong { font-size: 1.15rem; color: var(--sc-ink); }

.rel-periodo-linha { height: 8px; border-radius: 999px; background: var(--rel-vazio); overflow: hidden; }
.rel-periodo-linha span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--sc-primary), var(--sc-primary-dark)); }

.rel-periodo-dados {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  font-size: 0.9rem;
  color: var(--sc-muted);
}

.rel-periodo-dados strong { color: var(--sc-ink); }

.rel-chip { padding: 3px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.rel-chip-andamento { background: #ccfbf1; color: var(--sc-primary-dark); }
.rel-chip-encerrado { background: #e2e8f0; color: #334155; }
.rel-chip-futuro { background: #fef3c7; color: #a16207; }

/* Secoes */
.rel-secao { padding: 28px 36px; border-bottom: 1px solid var(--sc-border); }

.rel-secao-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--sc-ink);
}

.rel-secao-titulo span {
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--sc-primary);
  color: #fff;
  font-size: 0.75rem;
}

/* Visao geral */
.rel-visao {
  display: grid;
  grid-template-columns: 190px 1fr 230px;
  align-items: center;
  gap: 32px;
}

.rel-rosca {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.rel-rosca-centro {
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 1px var(--sc-border);
}

.rel-rosca-centro strong { font-family: 'Manrope', 'Inter', sans-serif; font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--sc-ink); }
.rel-rosca-centro span { margin-top: 4px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sc-muted); }

.rel-nota { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.rel-nota-otima { background: #dcfce7; color: #15803d; }
.rel-nota-boa { background: #ccfbf1; color: #0f766e; }
.rel-nota-regular { background: #fef3c7; color: #a16207; }
.rel-nota-baixa { background: #fee2e2; color: #b91c1c; }
.rel-nota-neutra { background: #f1f5f9; color: #475569; }

.rel-visao-frase { margin: 10px 0 14px; color: var(--sc-text); }
.txt-nok { color: var(--rel-nok); }

.rel-legenda { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rel-legenda li { display: grid; grid-template-columns: 12px 1fr auto 44px; align-items: center; gap: 10px; font-size: 0.92rem; }
.rel-legenda i { width: 12px; height: 12px; border-radius: 4px; }
.rel-legenda em { font-style: normal; text-align: right; color: var(--sc-muted); }

.rel-kpis { display: grid; gap: 10px; }

.rel-kpi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-md);
}

.rel-kpi .bi { font-size: 1.3rem; color: var(--sc-primary); }
.rel-kpi strong { display: block; font-size: 1.2rem; color: var(--sc-ink); line-height: 1.1; }
.rel-kpi span { font-size: 0.8rem; color: var(--sc-muted); }

/* Por medicamento */
.rel-remedio {
  padding: 18px 20px;
  margin-bottom: 14px;
  border: 1px solid var(--sc-border);
  border-radius: var(--sc-radius-md);
  break-inside: avoid;
}

.rel-remedio-topo { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }

.rel-remedio-icone {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #ccfbf1;
  color: var(--sc-primary-dark);
  font-size: 1.3rem;
}

.rel-remedio-nome { flex: 1; min-width: 0; }
.rel-remedio-nome h3 { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--sc-ink); }
.rel-remedio-nome p { margin: 2px 0 0; font-size: 0.88rem; color: var(--sc-muted); }

.rel-remedio-pct { padding: 8px 14px; border-radius: 12px; text-align: center; }
.rel-remedio-pct strong { display: block; font-size: 1.3rem; line-height: 1.1; }
.rel-remedio-pct span { font-size: 0.75rem; font-weight: 600; }

.rel-calendario { display: flex; flex-wrap: wrap; gap: 5px; }

.rel-dia,
.rel-legenda-dias i {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

.rel-dia-ok { background: var(--rel-ok); }
.rel-dia-atrasado { background: var(--rel-atrasado); }
.rel-dia-adiantado { background: var(--rel-adiantado); }
.rel-dia-nok { background: var(--rel-nok); }
.rel-dia-pendente { background: #fff; color: var(--rel-pendente); border: 2px dashed var(--rel-pendente); }
.rel-dia-futuro { background: #f1f5f9; color: #94a3b8; border: 1px solid var(--rel-vazio); }

.rel-legenda-dias {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 6px 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--sc-muted);
}

.rel-legenda-dias li { display: flex; align-items: center; gap: 6px; }
.rel-legenda-dias i { width: 14px; height: 14px; border-radius: 4px; }

.rel-detalhe { margin-top: 12px; }
.rel-detalhe summary { cursor: pointer; font-size: 0.88rem; font-weight: 600; color: var(--sc-primary-dark); }

.rel-tabela { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 0.88rem; }
.rel-tabela th { padding: 8px 10px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sc-muted); border-bottom: 2px solid var(--sc-border); text-align: left; }
.rel-tabela td { padding: 8px 10px; border-bottom: 1px solid var(--sc-border); }
.rel-tabela tbody tr:nth-child(even) { background: #f8fbfb; }
.rel-dif { font-variant-numeric: tabular-nums; color: var(--sc-muted); }

.rel-status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.rel-status-ok { background: #dcfce7; color: #15803d; }
.rel-status-atrasado { background: #ffedd5; color: #c2410c; }
.rel-status-adiantado { background: #fef3c7; color: #a16207; }
.rel-status-nok { background: #fee2e2; color: #b91c1c; }
.rel-status-pendente { background: #f1f5f9; color: #475569; }

.rel-vazio { margin: 0; color: var(--sc-muted); font-size: 0.9rem; }

/* Esquecidas */
.rel-tudo-certo { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: var(--sc-radius-md); background: #dcfce7; color: #15803d; font-weight: 600; }

.rel-esquecidas { display: grid; gap: 8px; }

.rel-esquecida {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-left: 4px solid var(--rel-nok);
  border-radius: 10px;
  background: #fef2f2;
}

.rel-esquecida-dia { font-weight: 800; color: #b91c1c; min-width: 48px; }

/* Rodape */
.rel-rodape {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 16px 36px;
  font-size: 0.78rem;
  color: var(--sc-muted);
  background: #f8fbfb;
}

.rel-rodape img { height: 16px; margin-right: 4px; vertical-align: -3px; }

/* Celular */
@media (max-width: 860px) {
  .rel-visao { grid-template-columns: 1fr; justify-items: center; }
  .rel-visao-dados, .rel-kpis { width: 100%; }
  .rel-cabecalho { grid-template-columns: 1fr; gap: 14px; padding: 22px; }
  .rel-cabecalho-meta { text-align: left; }
  .rel-periodo, .rel-secao, .rel-rodape { padding-left: 20px; padding-right: 20px; }
  .rel-periodo { grid-template-columns: 1fr; }
  .rel-tabela { font-size: 0.8rem; }
}

/* Impressao */
@media print {
  @page { size: A4; margin: 10mm; }
  .rel-body { background: #fff; }
  .app-navbar, .rel-sem-impressao { display: none !important; }
  .rel-pagina { max-width: none; padding: 0; }
  .rel-documento { box-shadow: none; border-radius: 0; }
  .rel-body * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .rel-secao { padding: 18px 24px; }
  .rel-visao { grid-template-columns: 170px 1fr 210px; gap: 20px; }
  .rel-rosca { width: 170px; height: 170px; }
  .rel-rosca-centro { width: 120px; height: 120px; }
  .rel-detalhe summary { display: none; }
  .rel-tabela tr { break-inside: avoid; }
}
