/* HoldCare — tema acolhedor (azul claro, verde leve, cinza, branco)
   Foco em acessibilidade: tipografia generosa, contraste suave, áreas de toque amplas. */
:root {
  --primary:        #5EB8E2;   /* azul claro acolhedor */
  --primary-dark:   #3B9BCB;
  --primary-soft:   #E0F1FB;
  --accent:         #6FCF97;   /* verde leve / saúde */
  --accent-soft:    #E3F6EA;
  --warm:           #F6E1B5;   /* destaque acolhedor */
  --bg:             #F7FAFC;
  --panel:          #FFFFFF;
  --panel-2:        #F2F7FB;
  --border:         #E3E9EF;
  --text:           #1F2937;
  --text-soft:      #4B5563;
  --muted:          #6B7280;
  --danger:         #E07474;
  --warn:           #E0A050;
  --shadow:         0 4px 18px rgba(94, 184, 226, 0.10);
  --shadow-lg:      0 8px 28px rgba(94, 184, 226, 0.18);
  --radius:         14px;
  --radius-lg:      20px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

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

/* ---------- Auth (login / register) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 20% 10%, var(--primary-soft) 0%, transparent 60%),
    radial-gradient(ellipse at 90% 80%, var(--accent-soft) 0%, transparent 55%),
    var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.auth-brand .logo {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  color: white; font-weight: 700; font-size: 22px;
  box-shadow: var(--shadow);
}
.auth-brand h1 {
  font-size: 26px; margin: 0;
  color: var(--text);
  letter-spacing: -0.3px;
}
.auth-sub {
  color: var(--text-soft);
  font-size: 15px;
  margin: 4px 0 28px;
}

/* ---------- Layout principal ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
  position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 19px;
  color: var(--text);
}
.brand .logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center;
  color: white; font-weight: 700;
  box-shadow: var(--shadow);
}
.brand small { color: var(--text-soft); font-weight: 500; font-size: 12px; letter-spacing: 0.4px; text-transform: uppercase; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary);
  color: white; font-weight: 600; font-size: 14px;
}
.user-chip .nome { font-size: 14px; color: var(--text); font-weight: 500; }
.user-chip .papel { font-size: 12px; color: var(--muted); }

.main { flex: 1; display: flex; }
.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  flex-shrink: 0;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-soft);
  cursor: pointer;
  margin-bottom: 4px;
  font-weight: 500;
  user-select: none;
  transition: background .15s ease, color .15s ease;
}
.sidebar .nav-item:hover { background: var(--panel-2); color: var(--text); }
.sidebar .nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 600;
}
.sidebar .nav-item .ico { width: 22px; text-align: center; font-size: 18px; }
.sidebar .nav-section { font-size: 11px; color: var(--muted); padding: 16px 14px 6px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }

.content { flex: 1; padding: 28px; min-width: 0; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-header h2 { font-size: 24px; margin: 0; color: var(--text); letter-spacing: -0.3px; }
.page-header .sub { color: var(--text-soft); font-size: 14px; margin-top: 2px; }

/* ---------- Cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 17px; font-weight: 600; margin: 0 0 14px; color: var(--text); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 14px; color: var(--text-soft); font-weight: 500; }
.field input, .field textarea, .field select {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  font-size: 15px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(94,184,226,0.18);
}
.field textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.accent { background: var(--accent); }
.btn.accent:hover { background: #5BBC85; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #C75858; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: -8px 0 18px; padding-bottom: 0; flex-wrap: wrap; }
.tab {
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-soft);
  border-bottom: 2px solid transparent;
  user-select: none;
  font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Idosos cards (lista) ---------- */
.idosos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.idoso-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: center;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.idoso-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.idoso-card .photo {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: grid; place-items: center;
  font-size: 22px; font-weight: 700; color: var(--primary-dark);
  background-size: cover; background-position: center;
  flex-shrink: 0;
  border: 2px solid var(--primary-soft);
}
.idoso-card .info { min-width: 0; }
.idoso-card .info h3 { margin: 0 0 4px; font-size: 17px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idoso-card .info p { margin: 0; font-size: 13px; color: var(--muted); }

.empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-soft);
}
.empty .ico { font-size: 56px; margin-bottom: 12px; opacity: 0.6; }
.empty h3 { margin: 0 0 6px; color: var(--text); }
.empty p { margin: 0 0 16px; font-size: 14px; }

/* ---------- Foto upload ---------- */
.photo-upload {
  display: flex; align-items: center; gap: 16px;
  padding: 14px;
  background: var(--panel-2);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.photo-upload .preview {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: grid; place-items: center;
  font-size: 30px; color: var(--primary-dark); font-weight: 700;
  background-size: cover; background-position: center;
}

/* ---------- Listas internas (alergias, doenças, contatos, meds) ---------- */
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  background: var(--panel-2);
  border-radius: 10px;
  margin-bottom: 8px;
}
.list-item .left strong { display: block; font-size: 15px; color: var(--text); }
.list-item .left span { font-size: 13px; color: var(--muted); }
.list-item .right { display: flex; gap: 6px; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-size: 14px;
  color: var(--text-soft);
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--danger); color: white; border-color: var(--danger); }

.tag {
  display: inline-block; padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 500;
  background: var(--primary-soft); color: var(--primary-dark);
}
.tag.warn { background: #FEF3C7; color: #92400E; }
.tag.danger { background: #FEE2E2; color: #991B1B; }
.tag.ok { background: var(--accent-soft); color: #166534; }

/* ---------- Alertas inline ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
}
.alert.error { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.alert.success { background: var(--accent-soft); color: #166534; border: 1px solid #86EFAC; }
.alert.info { background: var(--primary-soft); color: var(--primary-dark); }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .sidebar {
    position: fixed; inset: 56px 0 0 0; transform: translateX(-100%);
    width: 260px; height: calc(100vh - 56px); z-index: 40;
    transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 18px; }
  .topbar { padding: 10px 16px; }
  .page-header h2 { font-size: 20px; }
}

.hamburger {
  display: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  font-size: 20px;
  align-items: center; justify-content: center;
}
@media (max-width: 760px) {
  .hamburger { display: flex; }
}

.spinner {
  width: 22px; height: 22px;
  border: 3px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 60px 20px; }
