/* Programador agronómico de riego ET0 */
:root,
[data-theme="dark"] {
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-page: #0b0f17;
  --bg-surface: #131b2e;
  --bg-surface-2: #192338;
  --bg-input: #0f1626;
  --border-color: #26334d;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #10b981;
  --accent-strong: #059669;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg-page: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-2: #f8fafc;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent: #059669;
  --accent-strong: #047857;
  --accent-soft: rgba(5, 150, 105, 0.1);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.1);
  --warn: #d97706;
  --danger: #dc2626;
  --shadow-card: 0 8px 24px rgba(15, 23, 42, 0.08);
  color-scheme: light;
}

[data-theme="dark"] .app-header { background: #131b2e !important; border-bottom: 1px solid #1e293b !important; }
[data-theme="dark"] .brand-title { color: #f8fafc !important; }
[data-theme="light"] .app-header { background: #ffffff !important; border-bottom: 1px solid #cbd5e1 !important; }
[data-theme="light"] .brand-title { color: #0f172a !important; }

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-main);
  background: var(--bg-page);
  color: var(--text-main);
  margin: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6, .brand-title, .section-title, .hero-title {
  font-family: var(--font-heading);
}
.mono, code {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.tool-layout {
  max-width: 1200px;
  width: 100%;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  flex: 1 0 auto;
}
.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}
.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

.card-main {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.35rem;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}

.hero-title {
  margin: 0 0 0.45rem;
  font-size: clamp(1.22rem, 2.5vw, 1.65rem);
  line-height: 1.25;
}
.hero-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.presets-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--border-color);
}
.presets-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-right: 0.25rem;
}
.preset-chip {
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-2);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.preset-chip:hover { border-color: var(--accent); }
.preset-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.eto-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.35rem;
  align-items: start;
}

.step-block {
  padding-bottom: 1.1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-color);
}
.step-block:last-child {
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom: none;
}

.step-head-inline {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.step-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}
.step-head-inline .step-title { margin-bottom: 0; }

.segmented {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--accent);
  color: #ffffff;
}

.grid-2, .grid-3, .grid-4 {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.grid-2:last-child, .grid-3:last-child, .grid-4:last-child { margin-bottom: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  min-width: 0;
}
.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input,
.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-size: 0.92rem;
  font-family: var(--font-main);
}
.form-input.mono { font-family: var(--font-mono); }

.form-select {
  appearance: none;
  padding-right: 40px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2394a3b8' stroke-width='2.2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-select option {
  background-color: var(--bg-surface);
  color: var(--text-main);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
}

.is-hidden { display: none !important; }

.kpi-hero-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.kpi-box {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.kpi-box.kpi-highlight {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.kpi-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); }
.kpi-value { font-size: 1.45rem; font-weight: 800; line-height: 1.15; }
.kpi-note { font-size: 0.75rem; color: var(--text-muted); }

.kpi-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}
.mini-kpi {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.mini-label { font-size: 0.72rem; color: var(--text-muted); }
.mini-val { font-size: 0.96rem; font-weight: 700; }

.schedule-banner {
  background: var(--info-soft);
  border: 1px solid var(--info);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 0.9rem;
}
.schedule-kicker {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--info);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.schedule-headline {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0.2rem 0;
}
.schedule-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.btn-secondary {
  min-height: 40px;
  padding: 0.5rem 0.95rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.copy-feedback {
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.specs-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.spec-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.7rem;
  background: var(--bg-surface-2);
  border-radius: 8px;
  font-size: 0.83rem;
}
.spec-row span:first-child { color: var(--text-muted); }
.spec-row strong { font-family: var(--font-mono); font-size: 0.84rem; text-align: right; }

.section-head-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.section-title { margin: 0 0 0.25rem; font-size: 1.08rem; }
.section-sub { margin: 0; font-size: 0.86rem; color: var(--text-muted); }

.canvas-wrap {
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  padding: 0.65rem;
}
#eto-chart {
  width: 100%;
  height: 280px;
  display: block;
}

.faq-list { display: flex; flex-direction: column; gap: 0.65rem; margin-top: 0.75rem; }
.faq-item {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-surface-2);
  padding: 0.75rem 1rem;
}
.faq-question {
  font-weight: 700;
  font-size: 0.94rem;
  cursor: pointer;
}
.faq-answer {
  margin: 0.6rem 0 0;
  font-size: 0.89rem;
  color: var(--text-muted);
  line-height: 1.55;
}

@media (max-width: 960px) {
  .eto-workspace { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .kpi-hero-row, .kpi-grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .preset-chip, .btn-secondary, .seg-btn {
    width: 100%;
    min-height: 42px;
  }
  .segmented { width: 100%; }
  .seg-btn { flex: 1 1 0%; }
}
