/* Pet Med Control */
:root {
  --pm-primary: #0f766e;
  --pm-primary-dark: #115e59;
  --pm-bg: #f3f7f6;
  --pm-card: #ffffff;
  --pm-radius: 18px;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: #115e59;
  --bs-purple: #7c3aed;
  --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body { background: var(--pm-bg); -webkit-tap-highlight-color: transparent; }
body.with-nav { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (min-width: 768px) { body.with-nav { padding-bottom: 24px; } }
.min-w-0 { min-width: 0; }

/* Bootstrap: cor primária e extras */
.btn-primary { --bs-btn-bg: #0f766e; --bs-btn-border-color: #0f766e; --bs-btn-hover-bg: #115e59; --bs-btn-hover-border-color: #115e59; --bs-btn-active-bg: #134e4a; --bs-btn-active-border-color: #134e4a; --bs-btn-disabled-bg: #0f766e; --bs-btn-disabled-border-color: #0f766e; }
.btn-outline-primary { --bs-btn-color: #0f766e; --bs-btn-border-color: #0f766e; --bs-btn-hover-bg: #0f766e; --bs-btn-hover-border-color: #0f766e; --bs-btn-active-bg: #0f766e; --bs-btn-active-border-color: #0f766e; }
.text-primary { color: #0f766e !important; }
.bg-primary { background-color: #0f766e !important; }
.bg-purple { background-color: #7c3aed !important; }
.border-purple { border-color: #7c3aed !important; }
.text-bg-primary { background-color: #0f766e !important; }
.nav-pills { --bs-nav-pills-link-active-bg: #0f766e; }
.form-check-input:checked { background-color: #0f766e; border-color: #0f766e; }
.form-control:focus, .form-select:focus { border-color: #5eead4; box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .2); }
.badge.bg-warning { color: #3f2d00; }

/* Navegação */
.app-navbar { background: linear-gradient(120deg, #0f766e, #0d9488); box-shadow: 0 2px 12px rgba(15, 118, 110, .25); }
.app-navbar .navbar-brand, .app-navbar .nav-link { color: #fff; }
.app-navbar .nav-link { border-radius: 999px; opacity: .85; }
.app-navbar .nav-link:hover { opacity: 1; background: rgba(255, 255, 255, .12); color: #fff; }
.app-navbar .nav-link.active { background: rgba(255, 255, 255, .22); opacity: 1; color: #fff; }
.brand-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .7); background: #fff; }
.bell-dot { position: absolute; top: 4px; right: 5px; width: 9px; height: 9px; background: #ef4444; border-radius: 50%; border: 2px solid #fff; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; display: flex; background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); border-top: 1px solid #e5e7eb; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: #64748b; text-decoration: none; font-size: 11px; }
.bottom-nav a i { font-size: 22px; line-height: 1; }
.bottom-nav a.active { color: #0f766e; font-weight: 600; }
.bottom-nav a.active i { transform: translateY(-1px); }

.fab { position: fixed; right: 18px; bottom: calc(86px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; background: #0f766e; color: #fff; display: grid; place-items: center; font-size: 26px; box-shadow: 0 8px 20px rgba(15, 118, 110, .45); z-index: 1020; }
.fab:hover { color: #fff; background: #115e59; }

/* Cartões */
.section-card { border: 0; border-radius: var(--pm-radius); box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px rgba(15, 23, 42, .04); }
.section-card > .card-header { background: transparent; border-bottom: 1px solid #eef2f1; font-weight: 600; padding: .85rem 1.1rem; }
.section-card > .list-group > .list-group-item:last-child { border-bottom-left-radius: var(--pm-radius); border-bottom-right-radius: var(--pm-radius); }

/* Cabeçalho do pet */
.pet-hero { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: 22px; color: #fff; background: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .18), transparent 40%), linear-gradient(135deg, #0f766e 0%, #14b8a6 100%); box-shadow: 0 10px 24px rgba(15, 118, 110, .28); }
.pet-photo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 4px solid rgba(255, 255, 255, .85); background: #fff; flex-shrink: 0; }
.pet-photo-lg { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 4px solid #ccfbf1; background: #fff; }

/* Indicadores */
.stat-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); height: 100%; }
.stat-tile i { font-size: 24px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-tile b { display: block; font-size: 1.5rem; line-height: 1; }
.stat-tile span { font-size: .8rem; color: #64748b; }
.stat-warning i { background: #fef3c7; color: #b45309; }
.stat-danger i { background: #fee2e2; color: #dc2626; }
.stat-success i { background: #dcfce7; color: #16a34a; }
.stat-info i { background: #ccfbf1; color: #0f766e; }
.stat-secondary i { background: #f1f5f9; color: #64748b; }
.stat-danger.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .35); } 50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); } }

/* Doses */
.dose-card { background: #fff; border-radius: 14px; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); overflow: hidden; }
.dose-main { display: flex; align-items: center; gap: 12px; padding: 12px; color: inherit; text-decoration: none; }
.dose-thumb { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; background: #f1f5f9; flex-shrink: 0; }
.dose-thumb.sm { width: 40px; height: 40px; border-radius: 10px; }
.dose-actions { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
.dose-actions .btn { flex: 1 1 auto; border-radius: 10px; }
.state-badge { font-weight: 600; white-space: nowrap; }
.next-dose { display: flex; gap: 16px; align-items: center; }
.next-thumb { width: 88px; height: 88px; border-radius: 18px; object-fit: cover; background: #f1f5f9; }
.next-time { font-size: 2.2rem; font-weight: 800; color: #0f766e; line-height: 1; }
.next-time small { font-size: .9rem; font-weight: 600; color: #64748b; }
.empty-state { text-align: center; padding: 18px 8px; color: #64748b; }

/* Linha do tempo de hoje */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 26px; top: 6px; bottom: 6px; width: 2px; background: #e2e8f0; }
.timeline li { position: relative; }
.tl-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: inherit; text-decoration: none; }
.tl-time { width: 54px; font-weight: 700; font-variant-numeric: tabular-nums; background: #fff; position: relative; z-index: 1; text-align: center; padding: 2px 0; border-radius: 8px; }
.tl-name { flex-grow: 1; min-width: 0; }
.tl-done .tl-time { color: #16a34a; }
.tl-late .tl-time { color: #dc2626; }
.tl-due .tl-time { color: #b45309; }
.tl-skipped .tl-name { text-decoration: line-through; color: #94a3b8; }

/* Lista de remédios */
.med-card { border: 0; border-radius: var(--pm-radius); overflow: hidden; box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 6px 16px rgba(15, 23, 42, .04); }
.med-photo { height: 150px; background: #e6f4f1 center/cover no-repeat; position: relative; }
.med-photo .badge { position: absolute; left: 10px; bottom: 10px; }
.photo-preview { width: 100%; max-width: 260px; aspect-ratio: 1; object-fit: cover; border-radius: 18px; background: #f1f5f9; }

.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
@media (max-width: 575px) { .type-grid { grid-template-columns: repeat(2, 1fr); } }
.type-grid .btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; font-size: .78rem; border-radius: 12px; }
.type-grid .btn i { font-size: 1.3rem; }
.time-chip { width: auto; }
.time-chip input { max-width: 130px; }
.wd-btn { min-width: 46px; border-radius: 10px; }
.sticky-save { position: sticky; top: 80px; }

/* Dose (detalhe) */
.dose-hero { height: 200px; background: #e6f4f1 center/cover no-repeat; }
.dose-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.dose-facts div { background: #f8fafc; border-radius: 12px; padding: 10px 12px; }
.dose-facts span { display: block; font-size: .75rem; color: #64748b; text-transform: uppercase; letter-spacing: .03em; }
.dose-facts b { font-size: 1.05rem; }

/* Calendário */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head div { text-align: center; font-size: .75rem; font-weight: 700; color: #64748b; padding: 4px 0; }
.cal-cell { min-height: 64px; border-radius: 12px; background: #f8fafc; padding: 6px; color: inherit; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; border: 2px solid transparent; }
.cal-cell.empty { background: transparent; }
.cal-cell:hover { background: #ecfdf5; }
.cal-cell.today { border-color: #14b8a6; }
.cal-cell.selected { background: #ccfbf1; }
.cal-cell.all-done { background: #f0fdf4; }
.cal-cell.has-problem { background: #fef2f2; }
.cal-num { font-weight: 700; font-size: .9rem; }
.cal-dots { display: flex; flex-wrap: wrap; gap: 2px; }
.dot { display: inline-grid; place-items: center; min-width: 10px; height: 10px; border-radius: 999px; font-size: 8px; color: #fff; font-weight: 700; padding: 0 2px; vertical-align: middle; }
@media (min-width: 768px) { .cal-cell { min-height: 84px; } .dot { min-width: 14px; height: 14px; font-size: 9px; } }

/* Histórico em cartões no celular */
@media (max-width: 767px) {
  .history-table thead { display: none; }
  .history-table tr { display: block; padding: 10px 12px; border-bottom: 1px solid #eef2f1; }
  .history-table td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 3px 0; }
  .history-table td::before { content: attr(data-label); color: #64748b; font-size: .8rem; }
  .history-table td:first-child::before { content: none; }
}

/* Ajustes */
.settings-tabs .nav-link { border-radius: 999px; color: #334155; }
.check-list li { padding: 6px 0; display: flex; gap: 8px; align-items: center; }
.check-list li.ok i { color: #16a34a; }
.check-list li.bad i { color: #dc2626; }
.check-list li.warn i { color: #d97706; }

/* Login */
body.bare { background: radial-gradient(circle at 20% 10%, #ccfbf1, transparent 50%), radial-gradient(circle at 90% 90%, #99f6e4, transparent 45%), #f0fdfa; }
.auth-wrap { min-height: calc(100vh - 48px); display: grid; place-items: center; }
.auth-card { width: 100%; max-width: 400px; border: 0; border-radius: 24px; }
.auth-logo { width: 84px; height: 84px; border-radius: 24px; object-fit: cover; box-shadow: 0 8px 20px rgba(15, 118, 110, .25); }
