/* ============================================================
   Nutrición · AppiaFree — Design system
   Paleta: Medical Clinic (teal + health green) — ui-ux-pro-max
   Tipografía: Poppins (headings) + Open Sans (body)
   ============================================================ */
:root {
  --primary: #0891B2;
  --primary-dark: #0E7490;
  --primary-light: #22D3EE;
  --accent: #16A34A;
  --accent-light: #DCFCE7;
  --bg: #F0FDFA;
  --page: #EAF7F5;
  --surface: #FFFFFF;
  --ink: #134E4A;
  --ink-2: #3F5F5D;
  --ink-muted: #6B8583;
  --border: #CCFBF1;
  --grid: #DCEFEC;
  --muted: #E8F1F0;
  --critical: #DC2626;
  --critical-bg: #FEE2E2;
  --good: #16A34A;
  --good-bg: #DCFCE7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(19,78,74,0.06), 0 1px 3px rgba(19,78,74,0.08);
  --shadow-md: 0 4px 12px rgba(19,78,74,0.08), 0 2px 4px rgba(19,78,74,0.06);
  --shadow-lg: 0 12px 32px rgba(19,78,74,0.14);
  --font-head: 'Poppins', system-ui, sans-serif;
  --font-body: 'Open Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0; font-family: var(--font-body);
  background: var(--page); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand { font-family: var(--font-head); }

.screen { min-height: 100vh; }

/* ---------- Login ---------- */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(34,211,238,0.18), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(22,163,74,0.14), transparent 45%),
    var(--page);
  padding: 24px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 36px 32px; width: 340px; box-shadow: var(--shadow-lg);
  position: relative;
}
.login-card::before {
  content: "🥗";
  display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; font-size: 26px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 14px; margin-bottom: 14px; box-shadow: var(--shadow-md);
}
.login-card h1 {
  margin: 0 0 4px; font-size: 1.5rem; font-weight: 700; color: var(--ink);
  letter-spacing: -0.01em;
}
.muted { color: var(--ink-2); }
.muted.small { font-size: 0.82rem; }
.login-card input, .login-card button { width: 100%; margin-top: 10px; }
.error { color: var(--critical); font-size: 0.85rem; min-height: 1.2em; font-weight: 600; }

input, select, textarea, button {
  font-family: inherit; font-size: 0.92rem; padding: 10px 12px;
  border: 1.5px solid var(--grid); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(8,145,178,0.15);
}
textarea { width: 100%; min-height: 64px; margin: 6px 0; resize: vertical; font-family: inherit; }

button {
  background: var(--primary); color: #fff; border: 1.5px solid var(--primary); cursor: pointer;
  font-weight: 600; letter-spacing: 0.01em; box-shadow: var(--shadow-sm);
}
button:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
button:active { transform: translateY(0); }
button.btn-small {
  padding: 6px 12px; font-size: 0.8rem; background: var(--surface); color: var(--primary);
  border: 1.5px solid var(--primary); box-shadow: none;
}
button.btn-small:hover { background: var(--primary); color: #fff; }
button.full { width: 100%; margin-top: 10px; }

/* ---------- App layout ---------- */
#app-screen { display: flex; }
.sidebar {
  width: 252px; min-height: 100vh; background: var(--surface); border-right: 1px solid var(--border);
  padding: 20px 16px; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
  position: sticky; top: 0; align-self: flex-start;
}
.sidebar h2 {
  font-size: 1.15rem; margin: 0 0 20px; font-weight: 700; color: var(--ink);
  display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em;
}
.sidebar h2::before {
  content: "🥗"; display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; font-size: 15px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.pacientes-header {
  display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem;
  color: var(--ink-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700;
}
.lista-pacientes { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.paciente-item {
  padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 0.88rem;
  color: var(--ink-2); font-weight: 500; transition: background .15s ease, color .15s ease;
}
.paciente-item:hover { background: var(--muted); color: var(--ink); }
.paciente-item.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.logout {
  margin-top: 14px; background: var(--surface); color: var(--critical); border: 1.5px solid var(--critical-bg);
  box-shadow: none;
}
.logout:hover { background: var(--critical-bg); border-color: var(--critical); color: var(--critical); transform: none; box-shadow: none; }

.contenido { flex: 1; padding: 28px 36px; max-width: 960px; }
.placeholder {
  color: var(--ink-muted); padding: 60px 24px; text-align: center; font-size: 0.95rem;
  background: var(--surface); border: 1.5px dashed var(--border); border-radius: var(--radius);
}

.paciente-titulo h2 { margin: 0 0 16px; font-weight: 700; font-size: 1.4rem; color: var(--ink); letter-spacing: -0.01em; }

.tabs {
  display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 2px solid var(--border); margin-bottom: 20px;
}
.tab-btn {
  background: none; border: none; color: var(--ink-muted); padding: 10px 14px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-weight: 600; cursor: pointer; font-size: 0.86rem; box-shadow: none; margin-bottom: -2px;
  border-bottom: 2px solid transparent;
}
.tab-btn:hover { color: var(--primary); background: var(--muted); transform: none; box-shadow: none; }
.tab-btn.active { color: var(--primary); border-bottom: 2px solid var(--primary); background: none; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadein .18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.form-row { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.form-row input, .form-row select { flex: 1; min-width: 130px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 10px; }

h3 {
  font-size: 0.98rem; margin: 26px 0 10px; color: var(--ink); font-weight: 700;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
h3:first-of-type { margin-top: 0; }
label { font-size: 0.82rem; color: var(--ink-2); display: block; margin-top: 10px; font-weight: 600; }

.resultado {
  background: var(--accent-light); border: 1px solid var(--good); color: #14532D; border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 0.92rem; min-height: 1.2em; font-weight: 600;
}
.resultado:empty { background: var(--muted); border-color: var(--border); color: var(--ink-muted); font-weight: 400; }

.lista-tabla { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.fila-tabla {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px;
  font-size: 0.85rem; box-shadow: var(--shadow-sm); transition: box-shadow .15s ease, transform .15s ease;
}
.fila-tabla:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.fila-tabla .fecha { color: var(--ink-muted); font-size: 0.76rem; font-weight: 600; }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  margin-left: 6px; letter-spacing: 0.02em;
}
.chip.fuera { background: var(--critical-bg); color: var(--critical); }
.chip.normal { background: var(--good-bg); color: var(--good); }

canvas {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px;
  margin-bottom: 10px; box-shadow: var(--shadow-sm);
}

#agenda-panel { max-width: 720px; }

/* scrollbar */
.lista-pacientes::-webkit-scrollbar { width: 6px; }
.lista-pacientes::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

@media (max-width: 720px) {
  #app-screen { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; position: static; }
  .contenido { padding: 20px; }
}
