:root {
  --parchment: #ece2c9;
  --parchment-dark: #1c1712;
  --panel: #26201a;
  --panel-alt: #2f2820;
  --oxblood: #6b1f27;
  --oxblood-light: #8c2a34;
  --gold: #c9a24b;
  --gold-light: #e0c273;
  --text: #ece2c9;
  --text-dim: #b3a688;
  --error: #c1543f;
  --success: #6f8f4e;
}

* { box-sizing: border-box; }

body {
  background: var(--parchment-dark);
  color: var(--text);
  font-family: 'Newsreader', serif;
  margin: 0;
  min-height: 100vh;
}

h1, h2, h3, .brand, .card-title {
  font-family: 'Fraunces', serif;
}

.mono { font-family: 'JetBrains Mono', monospace; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 2px solid var(--gold);
  padding: 0.75rem 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topbar-brand {
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--gold-light);
}

.topbar-nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.topbar-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
}
.topbar-nav a:hover { color: var(--gold-light); background: var(--panel-alt); }

.topbar-stats { display: flex; align-items: center; gap: 1rem; font-family: 'JetBrains Mono', monospace; }
.topbar-stats .logout { color: var(--oxblood-light); text-decoration: none; }

.container { max-width: 1000px; margin: 0 auto; padding: 1.5rem; }

.flashes { margin-bottom: 1rem; }
.flash { padding: 0.6rem 1rem; border-radius: 6px; margin-bottom: 0.5rem; font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; }
.flash-success { background: rgba(111,143,78,0.2); border: 1px solid var(--success); color: var(--success); }
.flash-error { background: rgba(193,84,63,0.2); border: 1px solid var(--error); color: var(--error); }
.flash-info { background: rgba(201,162,75,0.15); border: 1px solid var(--gold); color: var(--gold-light); }

.grid { display: grid; gap: 1rem; }
.grid-plots { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid #3a3126;
  border-radius: 10px;
  padding: 1rem;
}

.plot {
  background: var(--panel-alt);
  border: 2px solid #3a3126;
  border-radius: 10px;
  padding: 1rem;
  text-align: center;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.plot.ready { border-color: var(--gold); box-shadow: 0 0 12px rgba(201,162,75,0.35); }
.plot.empty { opacity: 0.75; }

.btn {
  background: var(--oxblood);
  color: var(--parchment);
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
}
.btn:hover { background: var(--oxblood-light); }
.btn-gold {
  background: var(--gold);
  color: #241d14;
  font-weight: 600;
}
.btn-gold:hover { background: var(--gold-light); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

select, input[type="text"], input[type="password"], input[type="number"] {
  background: var(--panel-alt);
  border: 1px solid #4a3f30;
  color: var(--text);
  padding: 0.4rem;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
}

.progress-bar {
  background: #3a3126;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  margin: 0.4rem 0;
}
.progress-fill { background: var(--gold); height: 100%; }

.auth-box {
  max-width: 380px;
  margin: 4rem auto;
  background: var(--panel);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--gold);
}
.auth-box h1 { color: var(--gold-light); margin-top: 0; }
.auth-box label { display: block; margin: 0.8rem 0 0.3rem; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; color: var(--text-dim); }
.auth-box input { width: 100%; }
.auth-box .btn { width: 100%; margin-top: 1.2rem; }
.auth-box .switch { margin-top: 1rem; text-align: center; font-size: 0.85rem; }
.auth-box .switch a { color: var(--gold-light); }

.section-title {
  color: var(--gold-light);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 0.4rem;
  margin-top: 2rem;
}

form.inline { display: inline; }
.item-row { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid #3a3126; }
.muted { color: var(--text-dim); font-size: 0.85rem; }

/* ===== Rediseño: bitácora de granjero al atardecer ===== */

body {
  background:
    radial-gradient(ellipse at top, rgba(107,31,39,0.15), transparent 60%),
    var(--parchment-dark);
  background-attachment: fixed;
}

.topbar-brand::before {
  content: "🌾 ";
}

.plot {
  position: relative;
  background: linear-gradient(160deg, #2b2318, #201a12);
  border: 1px solid #443725;
  transition: box-shadow 0.25s ease, transform 0.15s ease;
}
.plot.empty {
  background: repeating-linear-gradient(135deg, #201a12, #201a12 6px, #241d13 6px, #241d13 12px);
}
.plot.ready {
  animation: glow-pulse 2s ease-in-out infinite;
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(201,162,75,0.25); }
  50% { box-shadow: 0 0 20px rgba(201,162,75,0.55); }
}
.plot-icon { font-size: 2rem; line-height: 1; margin-bottom: 0.3rem; }

.card, .plot {
  animation: fade-in 0.35s ease both;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sello de cera — aparece junto a mensajes de éxito */
.flash-success::before {
  content: "🔴";
  filter: grayscale(1) sepia(1) hue-rotate(-20deg) saturate(3);
  margin-right: 0.5rem;
}

.btn {
  transition: transform 0.1s ease, background 0.15s ease;
}
.btn:active:not(:disabled) { transform: scale(0.96); }

.progress-fill {
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  transition: width 0.4s ease;
}

.stat-pill {
  background: var(--panel-alt);
  border: 1px solid #443725;
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
}

.dashboard-banner {
  background: linear-gradient(135deg, rgba(107,31,39,0.35), rgba(201,162,75,0.12));
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 0.8rem 1.1rem;
  margin-bottom: 1.2rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}
