:root {
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;

  /* Cores */
  --color-bg: #f2f5f3;
  --color-surface: #ffffff;
  --color-surface-alt: #fafafa;
  --color-text-main: #1a1a1a;
  --color-text-muted: #777777;

  --color-accent: #eef2ff;
  --color-success-bg: #e7f8ee;
  --color-success-text: #0f5132;
  --color-chart-line: #16a34a;
  --color-chart-proj: #0ea5e9;

  --color-gain: #dc2626;
  --color-loss: #16a34a;

  /* Spacing & Layout */
  --radius-card: 12px;
  --radius-container: 16px;
  --shadow-main: 0 10px 25px rgba(0, 0, 0, 0.06);
}

body {
  font-family: var(--font-family);
  margin: 0;
  padding: 16px;
  background: var(--color-bg);
  color: var(--color-text-main);
}

.container {
  max-width: 1200px;
  margin: auto;
  background: var(--color-surface);
  padding: 24px;
  border-radius: var(--radius-container);
  box-shadow: var(--shadow-main);
}

h1 {
  margin: 0 0 24px;
  font-size: 1.6rem;
  font-weight: 700;
}

/* Stats Grid */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.card {
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--color-surface-alt);
  text-align: center;
}

.card span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.card strong {
  display: block;
  margin-top: 6px;
  font-size: 1.2rem;
  font-weight: 700;
}

.card.highlight {
  background: var(--color-accent);
}
.card.success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

/* Controls */
.presets {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.presets button {
  border: none;
  padding: 6px 14px;
  border-radius: 999px;
  background: #e5e7eb;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.presets button:hover {
  background: #d1d5db;
}
.presets button.active {
  background: #1a1a1a;
  color: white;
}

.chart-container {
  position: relative;
  width: 100%;
  height: 400px;
  margin-bottom: 32px;
}

/* List */
.weight-list {
  padding: 0;
  margin-top: 24px;
}

.weight-list li {
  display: flex;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid #eee;
  list-style: none;
}

.weight-list li:last-child {
  border-bottom: none;
}
.weight-list li.is-milestone {
  background-color: #f0f9ff;
  border-radius: 6px;
}

.entry-icon {
  margin-right: 12px;
  font-weight: bold;
  width: 20px;
  text-align: center;
}

.entry-icon.loss {
  color: var(--color-loss);
}
.entry-icon.gain {
  color: var(--color-gain);
}

.entry-date {
  margin-right: auto;
  font-weight: 600;
}
.entry-weight {
  font-variant-numeric: tabular-nums;
}

/* Classes Utilitárias */
.hidden {
  display: none !important;
}

/* Login Styles */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh; /* Centraliza verticalmente */
}

.login-card {
  background: var(--color-surface);
  padding: 40px;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-main);
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.login-card h1 {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

.login-card p {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.login-card input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box; /* Garante que o padding não estoure a largura */
}

.error-msg {
  color: var(--color-gain); /* Vermelho */
  font-size: 0.85rem;
  margin-top: 12px;
  min-height: 1.2em; /* Reserva espaço para não pular layout */
}

/* Container para Input + Ícone */
.password-container {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}

/* O Input em si */
.password-container input {
  width: 100%;
  padding: 12px;
  padding-left: 48px; /* Espaço extra na esquerda para o ícone */
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

/* O Botão do Olho (Posicionado Absolutamente) */
.eye-btn {
  position: absolute;
  left: 10px; /* Encostado na esquerda */
  top: 50%;
  transform: translateY(-72%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  width: auto !important; /* Sobrescreve estilo genérico de button */
  transition: color 0.2s;
}

.eye-btn:hover {
  color: var(--color-text-main);
}

/* Utilitário para troca de ícones */
.hidden-icon {
  display: none;
}

/* Botão de Entrar (Classe específica para não conflitar com o do olho) */
.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--color-text-main);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-btn:hover {
  background: #333;
}
