/* ============================================================
   TRACKER.TRU.AR - CSS global (estilo Apple Health)
   ============================================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  font-size: 16px;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.header h1 {
  font-size: 28px;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: -0.5px;
}

.header .subtitle {
  font-size: 14px;
  color: #6e6e73;
  margin-top: 2px;
}

.header .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #007aff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}

.section-label {
  font-size: 13px;
  color: #6e6e73;
  margin: 24px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

/* ============================================================
   CARDS (resumen del dashboard)
   ============================================================ */

.summary-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.summary-card {
  background: white;
  border-radius: 16px;
  padding: 16px;
}

.summary-card .label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.summary-card .label-row i {
  font-size: 16px;
}

.summary-card .label-row .label {
  font-size: 13px;
  margin: 0;
  font-weight: 600;
}

.summary-card .value {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  color: #1d1d1f;
  letter-spacing: -0.5px;
}

.summary-card .value .unit {
  font-size: 14px;
  color: #6e6e73;
  font-weight: 400;
}

.summary-card .trend {
  font-size: 12px;
  margin: 4px 0 0;
}

.summary-card .trend.up { color: #ff3b30; }
.summary-card .trend.down { color: #34c759; }
.summary-card .trend.neutral { color: #6e6e73; }

/* Color variants */
.color-peso { color: #007aff; }
.color-glucemia { color: #ff3b30; }
.color-hba1c { color: #ff9500; }
.color-meta { color: #34c759; }
.color-train { color: #ff9500; }
.color-lab { color: #5856d6; }
.color-med { color: #34c759; }
.color-hist { color: #8e8e93; }

/* ============================================================
   LINKS (linktree-style del dashboard)
   ============================================================ */

.link-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: white;
  border-radius: 12px;
  color: #1d1d1f;
  transition: background 0.15s;
}

.link-item:active {
  background: #ebebeb;
}

.link-item .icon-box {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.link-item .icon-box i {
  font-size: 18px;
}

.link-item .info {
  flex: 1;
  min-width: 0;
}

.link-item .info .title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.link-item .info .desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: #6e6e73;
}

.link-item .chevron {
  font-size: 16px;
  color: #c7c7cc;
  flex-shrink: 0;
}

/* Icon-box color backgrounds (15% opacity) */
.bg-peso { background: #007aff26; }
.bg-glucemia { background: #ff3b3026; }
.bg-train { background: #ff950026; }
.bg-lab { background: #5856d626; }
.bg-med { background: #34c75926; }
.bg-hist { background: #8e8e9326; }

/* ============================================================
   FORMS (registrar peso, glucemia, etc.)
   ============================================================ */

.card {
  background: white;
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 12px;
}

.card h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
  color: #1d1d1f;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.input-row label {
  font-size: 13px;
  color: #6e6e73;
  font-weight: 500;
  min-width: 90px;
}

.input-row input,
.input-row select {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  background: white;
  font-size: 16px;
  color: #1d1d1f;
  outline: none;
}

.input-row input:focus,
.input-row select:focus {
  border-color: #007aff;
}

.btn {
  width: 100%;
  height: 48px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  background: #007aff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s;
}

.btn:active { opacity: 0.8; }
.btn.btn-red { background: #ff3b30; }
.btn.btn-orange { background: #ff9500; }
.btn.btn-green { background: #34c759; }
.btn.btn-purple { background: #5856d6; }
.btn.btn-secondary {
  background: white;
  color: #007aff;
  border: 1px solid #e5e5ea;
}

/* ============================================================
   TABLES (historial)
   ============================================================ */

.data-table {
  width: 100%;
  font-size: 14px;
}

.data-table thead th {
  text-align: left;
  font-size: 12px;
  color: #6e6e73;
  font-weight: 600;
  padding: 8px 0;
  border-bottom: 1px solid #e5e5ea;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.data-table tbody td {
  padding: 12px 0;
  border-bottom: 1px solid #f2f2f7;
  color: #1d1d1f;
}

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

.data-table .num {
  font-weight: 600;
  text-align: right;
}

.data-table .trend-up { color: #ff3b30; font-size: 12px; }
.data-table .trend-down { color: #34c759; font-size: 12px; }

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge.bad { background: #ff3b3022; color: #ff3b30; }
.badge.warn { background: #ff950022; color: #ff9500; }
.badge.ok { background: #34c75922; color: #34c759; }
.badge.info { background: #007aff22; color: #007aff; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 20px;
  padding: 40px 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.login-card .logo {
  font-size: 13px;
  color: #6e6e73;
  letter-spacing: 2px;
  margin-bottom: 14px;
  font-weight: 600;
}

.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  color: #1d1d1f;
}

.login-card .tagline {
  font-size: 14px;
  color: #6e6e73;
  margin-bottom: 28px;
}

.login-card .btn-google {
  width: 100%;
  height: 50px;
  border-radius: 12px;
  background: white;
  color: #1d1d1f;
  font-weight: 600;
  font-size: 15px;
  border: 1px solid #e5e5ea;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
}

.login-card .btn-google:hover {
  background: #f5f5f7;
}

.login-card .btn-google img {
  width: 20px;
  height: 20px;
}

.login-card .footnote {
  margin-top: 22px;
  font-size: 11px;
  color: #c7c7cc;
  letter-spacing: 1px;
}

/* ============================================================
   FLASH MESSAGES
   ============================================================ */

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 12px;
}

.flash.success { background: #34c75922; color: #248a3d; }
.flash.error { background: #ff3b3022; color: #c5302a; }
.flash.info { background: #007aff22; color: #0056b3; }

/* ============================================================
   NAV BACK
   ============================================================ */

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #007aff;
  font-size: 15px;
  margin-bottom: 12px;
  font-weight: 500;
}

.nav-back i {
  font-size: 18px;
}

/* ============================================================
   CHART CONTAINER
   ============================================================ */

.chart-container {
  background: white;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 12px;
}

.chart-container h2 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
}

.chart-container canvas {
  width: 100% !important;
  height: 200px !important;
}

/* ============================================================
   META PROGRESS BARS
   ============================================================ */

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f2f2f7;
}

.meta-row:last-child { border-bottom: none; }

.meta-row .meta-info { display: flex; flex-direction: column; }
.meta-row .meta-info .meta-label { font-size: 14px; font-weight: 500; }
.meta-row .meta-info .meta-progress { font-size: 12px; color: #6e6e73; }
.meta-row .meta-value { font-weight: 600; font-size: 15px; }
.meta-row .meta-value.reached { color: #34c759; }

/* ============================================================
   ICONS de Tabler (CDN)
   ============================================================ */

/* Cargado via CDN en HTML */
