/* ============================================================
   VIDA EM CONTROLE — CSS Principal
   Paleta: Teal/Emerald sobre slate escuro. Tipografia: DM Sans + DM Mono
   ============================================================ */

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

/* ---- Variáveis ---- */
:root {
  --bg:          #0b1120;
  --bg-2:        #111827;
  --bg-3:        #1a2436;
  --bg-4:        #243044;
  --surface:     #1e2d40;
  --surface-2:   #253348;
  --border:      #2a3d56;
  --border-2:    #344d68;

  --teal:        #14b8a6;
  --teal-light:  #5eead4;
  --teal-dim:    #0d9488;
  --emerald:     #10b981;
  --emerald-dim: #059669;
  --amber:       #f59e0b;
  --rose:        #f43f5e;
  --sky:         #38bdf8;
  --violet:      #a78bfa;

  --text:        #e2e8f0;
  --text-2:      #94a3b8;
  --text-3:      #64748b;
  --text-inv:    #0b1120;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;
  --radius-xl:   24px;

  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.25);
  --glow-teal:   0 0 20px rgba(20,184,166,.25);
  --glow-em:     0 0 20px rgba(16,185,129,.2);

  --sidebar-w:   240px;
  --header-h:    60px;
  --transition:  .2s cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--teal-light); }

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}

input, select, textarea {
  font-family: inherit;
  font-size: .9375rem;
  color: var(--text);
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .625rem .875rem;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20,184,166,.15);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

select option { background: var(--bg-3); }

textarea { resize: vertical; min-height: 80px; }

label {
  display: block;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .375rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--bg-4); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* ====================================================================
   LOGIN PAGE
   ==================================================================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(20,184,166,.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, rgba(16,185,129,.08) 0%, transparent 55%),
    var(--bg);
}

.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow), var(--glow-teal);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--teal-dim), var(--emerald));
  border-radius: var(--radius-lg);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  box-shadow: var(--glow-em);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--teal-light), var(--emerald));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  font-size: .875rem;
  color: var(--text-2);
  margin-top: .25rem;
}

.login-tabs {
  display: flex;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  padding: .25rem;
  margin-bottom: 1.75rem;
  gap: .25rem;
}

.tab-btn {
  flex: 1;
  padding: .5rem;
  background: transparent;
  color: var(--text-2);
  border-radius: 4px;
  font-size: .875rem;
  font-weight: 500;
}

.tab-btn.active {
  background: var(--surface);
  color: var(--teal-light);
  box-shadow: var(--shadow-sm);
}

.login-form { display: flex; flex-direction: column; gap: 1.125rem; }
.form-group { display: flex; flex-direction: column; }

.login-divider {
  text-align: center;
  position: relative;
  color: var(--text-3);
  font-size: .8125rem;
  margin: .5rem 0;
}

.login-divider::before, .login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 2rem);
  height: 1px;
  background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }

.btn-magic {
  width: 100%;
  padding: .75rem;
  background: linear-gradient(135deg, rgba(20,184,166,.15), rgba(16,185,129,.1));
  border: 1.5px dashed var(--teal-dim);
  color: var(--teal-light);
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
}

.btn-magic:hover {
  background: linear-gradient(135deg, rgba(20,184,166,.25), rgba(16,185,129,.18));
  border-color: var(--teal);
}

/* ====================================================================
   LAYOUT PRINCIPAL
   ==================================================================== */
.app-layout {
  display: flex;
  min-height: 100dvh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100dvh;
  z-index: 200;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .75rem;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--teal-dim), var(--emerald));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-title { font-size: .9375rem; font-weight: 700; color: var(--text); }
.sidebar-subtitle { font-size: .75rem; color: var(--text-3); }

.sidebar-user {
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .625rem;
  background: var(--bg-3);
  margin: .75rem;
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal-dim), var(--violet));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8125rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .8125rem; font-weight: 600; truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.user-email { font-size: .6875rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

nav.sidebar-nav { flex: 1; padding: .5rem .75rem; }

.nav-section-label {
  font-size: .6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: .75rem .5rem .375rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: .625rem;
  padding: .5625rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: 1.5px solid transparent;
}

.nav-link .nav-icon { font-size: 1rem; flex-shrink: 0; }
.nav-link .nav-badge {
  margin-left: auto;
  background: var(--rose);
  color: #fff;
  font-size: .6875rem;
  font-weight: 700;
  border-radius: 99px;
  padding: .1rem .4rem;
  min-width: 18px;
  text-align: center;
}

.nav-link:hover {
  background: var(--bg-3);
  color: var(--text);
}

.nav-link.active {
  background: rgba(20,184,166,.12);
  color: var(--teal-light);
  border-color: rgba(20,184,166,.25);
}

.sidebar-footer {
  padding: .75rem;
  border-top: 1px solid var(--border);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  height: var(--header-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-menu-btn {
  display: none;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: .375rem .625rem;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
}

.top-bar-title { font-size: 1rem; font-weight: 600; flex: 1; }

.status-indicator {
  display: flex;
  align-items: center;
  gap: .375rem;
  font-size: .75rem;
  color: var(--text-3);
  font-weight: 500;
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  animation: pulse-dot 2s infinite;
}

.status-dot.offline { background: var(--rose); animation: none; }

@keyframes pulse-dot {
  0%,100% { opacity: 1; }
  50% { opacity: .4; }
}

.page-body {
  flex: 1;
  padding: 1.75rem 1.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ====================================================================
   COMPONENTES — Botões
   ==================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .625rem 1.125rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal-dim), var(--emerald-dim));
  color: #fff;
  box-shadow: 0 2px 12px rgba(20,184,166,.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--teal), var(--emerald));
  transform: translateY(-1px);
  box-shadow: 0 4px 18px rgba(20,184,166,.4);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text-2);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover { border-color: var(--border-2); color: var(--text); background: var(--bg-4); }

.btn-danger {
  background: rgba(244,63,94,.12);
  color: var(--rose);
  border: 1.5px solid rgba(244,63,94,.25);
}
.btn-danger:hover { background: rgba(244,63,94,.22); border-color: var(--rose); }

.btn-ghost { background: transparent; color: var(--text-2); border: 1.5px solid transparent; }
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }

.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }
.btn-lg { padding: .875rem 1.5rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ====================================================================
   COMPONENTES — Cards
   ==================================================================== */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: .75rem;
}

.card-title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.card-actions { display: flex; gap: .5rem; flex-shrink: 0; }

/* Stat cards dashboard */
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.teal::before  { background: linear-gradient(90deg, var(--teal-dim), var(--teal)); }
.stat-card.green::before { background: linear-gradient(90deg, var(--emerald-dim), var(--emerald)); }
.stat-card.amber::before { background: linear-gradient(90deg, #d97706, var(--amber)); }
.stat-card.rose::before  { background: linear-gradient(90deg, #e11d48, var(--rose)); }
.stat-card.sky::before   { background: linear-gradient(90deg, #0284c7, var(--sky)); }
.stat-card.violet::before{ background: linear-gradient(90deg, #7c3aed, var(--violet)); }

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: .625rem;
  display: block;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: .25rem;
}

.stat-sub {
  font-size: .75rem;
  color: var(--text-3);
  margin-top: .25rem;
}

.stat-change {
  font-size: .75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  margin-top: .375rem;
}

.stat-change.up { color: var(--rose); }
.stat-change.down { color: var(--emerald); }
.stat-change.neutral { color: var(--text-3); }

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
  margin-top: .625rem;
}

.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--teal-dim), var(--teal));
  transition: width .6s ease;
}

.progress-fill.emerald { background: linear-gradient(90deg, var(--emerald-dim), var(--emerald)); }
.progress-fill.amber   { background: linear-gradient(90deg, #d97706, var(--amber)); }

/* ====================================================================
   GRIDS
   ==================================================================== */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ====================================================================
   COMPONENTES — Formulários
   ==================================================================== */
.form-section { margin-bottom: 1.75rem; }
.form-section-title {
  font-size: .8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--teal);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.form-row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; }

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem;
  margin-top: .375rem;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .375rem .75rem;
  cursor: pointer;
  font-size: .875rem;
  transition: all var(--transition);
  user-select: none;
}

.checkbox-item:has(input:checked) {
  background: rgba(20,184,166,.12);
  border-color: var(--teal);
  color: var(--teal-light);
}

.checkbox-item input { display: none; }

/* Toggle switch */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  cursor: pointer;
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--bg-4);
  border-radius: 99px;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
}

input:checked + .toggle { background: var(--teal-dim); }
input:checked + .toggle::after { transform: translateX(18px); }

/* Star/Mood picker */
.mood-picker {
  display: flex;
  gap: .5rem;
  margin-top: .375rem;
}

.mood-option {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
}

.mood-option.selected {
  background: rgba(20,184,166,.15);
  border-color: var(--teal);
  transform: scale(1.1);
}

/* ====================================================================
   COMPONENTES — Tabelas
   ==================================================================== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

thead th {
  background: var(--bg-3);
  padding: .75rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text-2);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover td { background: var(--bg-3); color: var(--text); }

/* ====================================================================
   COMPONENTES — Badges / Pills
   ==================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .625rem;
  border-radius: 99px;
  border: 1px solid;
}

.badge-normal  { background: rgba(16,185,129,.12);  color: var(--emerald);  border-color: rgba(16,185,129,.25); }
.badge-atencao { background: rgba(245,158,11,.12);  color: var(--amber);    border-color: rgba(245,158,11,.25); }
.badge-alterado{ background: rgba(244,63,94,.12);   color: var(--rose);     border-color: rgba(244,63,94,.25); }
.badge-teal    { background: rgba(20,184,166,.12);  color: var(--teal);     border-color: rgba(20,184,166,.25); }
.badge-sky     { background: rgba(56,189,248,.12);  color: var(--sky);      border-color: rgba(56,189,248,.25); }

/* ====================================================================
   COMPONENTES — Alertas / Toast
   ==================================================================== */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .625rem;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .875rem 1.125rem;
  min-width: 280px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: .75rem;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: slideUp .3s ease;
  font-size: .875rem;
}

.toast.success { border-left: 3px solid var(--emerald); }
.toast.error   { border-left: 3px solid var(--rose); }
.toast.info    { border-left: 3px solid var(--teal); }
.toast.warning { border-left: 3px solid var(--amber); }

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

/* ====================================================================
   COMPONENTES — Modal
   ==================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
}

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-sm);
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  animation: slideModal .3s cubic-bezier(.34,1.56,.64,1);
}

@media (min-width: 600px) {
  .modal { border-radius: var(--radius-xl); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title { font-size: 1.0625rem; font-weight: 700; }

.modal-close {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.modal-close:hover { background: var(--bg-4); color: var(--text); }

@keyframes slideModal {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ====================================================================
   SEÇÕES DE PÁGINA
   ==================================================================== */
.page-section { display: none; }
.page-section.active { display: block; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.page-header-left h2 {
  font-size: 1.3125rem;
  font-weight: 700;
}

.page-header-left p {
  font-size: .875rem;
  color: var(--text-2);
  margin-top: .125rem;
}

/* ====================================================================
   DASHBOARD — Gráfico
   ==================================================================== */
.chart-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 1rem;
}

#weight-chart {
  width: 100%;
  border-radius: var(--radius-sm);
}

/* ====================================================================
   CHECKLIST DE REMÉDIOS
   ==================================================================== */
.med-checklist {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.med-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .875rem 1rem;
  background: var(--bg-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.med-item:hover { border-color: var(--border-2); }

.med-item.taken {
  background: rgba(16,185,129,.07);
  border-color: rgba(16,185,129,.25);
}

.med-check {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .875rem;
  flex-shrink: 0;
  transition: all var(--transition);
}

.med-item.taken .med-check {
  background: var(--emerald-dim);
  border-color: var(--emerald);
  color: #fff;
}

.med-info { flex: 1; min-width: 0; }
.med-name { font-size: .9375rem; font-weight: 600; }
.med-details { font-size: .8125rem; color: var(--text-3); }

.med-time {
  font-size: .75rem;
  font-family: 'DM Mono', monospace;
  color: var(--text-3);
  background: var(--bg-4);
  padding: .2rem .5rem;
  border-radius: var(--radius-sm);
}

/* ====================================================================
   INDICADORES DE STATUS ESPECIAIS
   ==================================================================== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-3);
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .5; }
.empty-state p { font-size: .9375rem; }

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: .75rem;
  color: var(--text-3);
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border-2);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ====================================================================
   OFFLINE PAGE
   ==================================================================== */
.offline-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  text-align: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(244,63,94,.07), transparent),
    var(--bg);
}

.offline-content { max-width: 380px; }
.offline-icon { font-size: 4rem; margin-bottom: 1.5rem; }
.offline-content h1 { font-size: 1.75rem; margin-bottom: .75rem; }
.offline-content p { color: var(--text-2); margin-bottom: 1.5rem; }

/* ====================================================================
   AVISO MÉDICO
   ==================================================================== */
.medical-disclaimer {
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.2);
  border-radius: var(--radius);
  padding: .875rem 1rem;
  font-size: .8125rem;
  color: var(--amber);
  display: flex;
  gap: .625rem;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ====================================================================
   FILTER BAR
   ==================================================================== */
.filter-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.filter-btn {
  padding: .375rem .875rem;
  border-radius: 99px;
  font-size: .8125rem;
  font-weight: 600;
  background: var(--bg-3);
  color: var(--text-2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-btn.active {
  background: rgba(20,184,166,.15);
  color: var(--teal-light);
  border-color: rgba(20,184,166,.4);
}

/* ====================================================================
   MOBILE
   ==================================================================== */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    width: 260px;
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vw rgba(0,0,0,.55);
  }

  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; }

  .page-body { padding: 1rem; }

  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .form-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; justify-content: center; }

  .stat-value { font-size: 1.4rem; }

  .table-wrap { font-size: .8125rem; }
  thead th, tbody td { padding: .625rem .75rem; }

  #toast-container { bottom: 1rem; right: 1rem; left: 1rem; }
  .toast { max-width: 100%; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 95dvh; }
}

@media (max-width: 480px) {
  .grid-stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .stat-card { padding: 1rem; }
}

/* ====================================================================
   UTILITIES
   ==================================================================== */
.text-teal   { color: var(--teal); }
.text-green  { color: var(--emerald); }
.text-amber  { color: var(--amber); }
.text-rose   { color: var(--rose); }
.text-muted  { color: var(--text-3); }
.text-sm     { font-size: .875rem; }
.text-xs     { font-size: .75rem; }
.font-mono   { font-family: 'DM Mono', monospace; }
.font-bold   { font-weight: 700; }

.mt-1  { margin-top: .25rem; }
.mt-2  { margin-top: .5rem; }
.mt-3  { margin-top: .75rem; }
.mt-4  { margin-top: 1rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.gap-2 { gap: .5rem; }
.flex  { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.hidden { display: none !important; }

.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Separador de seção */
.section-sep {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}
