/* Agromilch riego — mismos tokens visuales que panel Apolo */
:root {
  --ink: #132019;
  --muted: #4d6357;
  --fog: rgba(255, 255, 255, 0.78);
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --line: rgba(19, 32, 25, 0.14);
  --ok: #1f7a4c;
  --wait: #9a6700;
  --stop: #7a1f1f;
  --water: #1565c0;
  --btn: #132019;
  --btn-text: #f4faf6;
  --display: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --ui: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--ui);
  background: #0d1511;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: #0d1511 url("../img/panel-bg.jpg") center center / cover no-repeat;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42) 0%, rgba(255, 255, 255, 0.18) 34%, rgba(10, 18, 14, 0.55) 100%),
    radial-gradient(1200px 520px at 50% 8%, rgba(255, 255, 255, 0.28), transparent 72%);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 740px;
  margin: 0 auto;
  padding: 20px 16px 36px;
}

@media (min-width: 920px) {
  .shell {
    max-width: 860px;
    padding: 28px 24px 44px;
  }
}

.brand-block {
  text-align: center;
  animation: fade 0.6s ease both;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.55rem, 5vw, 2.35rem);
  letter-spacing: 0.34em;
  font-weight: 700;
  text-indent: 0.34em;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.65);
}

.tagline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass-strong);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  font-size: 0.84rem;
  font-weight: 700;
}

.live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8a9a90;
}

.live.on i {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(31, 122, 76, 0.18);
  animation: pulse 1.6s ease infinite;
}

.live.wait {
  color: var(--wait);
}

.live.wait i {
  background: var(--wait);
}

.live.off {
  color: var(--stop);
}

.live.off i {
  background: var(--stop);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(31, 122, 76, 0.28);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(31, 122, 76, 0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero {
  margin: 18px 0 14px;
  padding: 30px 18px 24px;
  text-align: center;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(8, 16, 12, 0.18);
  animation: rise 0.65s ease both;
}

.status {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.state-label {
  font-family: var(--display);
  font-weight: 700;
  line-height: 0.95;
  font-size: clamp(2.8rem, 14vw, 4.8rem);
  letter-spacing: -0.02em;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.4);
}

.state-label.open {
  color: var(--ok);
}

.state-label.closed {
  color: var(--stop);
}

.substate {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.95rem;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0 0 12px;
  background: rgba(19, 32, 25, 0.1);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  backdrop-filter: blur(12px);
  animation: rise 0.7s 0.05s ease both;
}

.stat {
  padding: 14px 12px;
  background: var(--fog);
  text-align: center;
}

.stat b {
  display: block;
  font-size: 1.28rem;
  font-weight: 800;
}

.stat span {
  display: block;
  margin-top: 3px;
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card {
  margin: 0 0 12px;
  padding: 16px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  animation: rise 0.75s 0.06s ease both;
}

.card h2 {
  margin: 0 0 12px;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.timer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.timer-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
}

.timer-field input[type="number"] {
  width: 100%;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
}

.timer-field input[type="range"] {
  width: 100%;
  margin-top: 8px;
  accent-color: var(--water);
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.85);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.chip:active {
  transform: scale(0.98);
}

.countdown {
  display: none;
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(21, 101, 192, 0.12);
  border: 1px solid rgba(21, 101, 192, 0.25);
  text-align: center;
}

.countdown.on {
  display: block;
}

.countdown .time {
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--water);
}

.countdown .hint {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 2px;
  animation: rise 0.75s 0.08s ease both;
}

button {
  border: 0;
  border-radius: 18px;
  padding: 16px 12px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  background: var(--btn);
  color: var(--btn-text);
  box-shadow: 0 10px 24px rgba(8, 16, 12, 0.24);
  transition: transform 0.12s ease, opacity 0.12s ease;
  cursor: pointer;
}

button:active {
  transform: scale(0.98);
  opacity: 0.92;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.open {
  background: var(--ok);
}

button.close {
  background: var(--stop);
}

button.water {
  grid-column: 1 / -1;
  background: var(--water);
}

button.alt {
  background: var(--glass-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

button.stop-timer {
  grid-column: 1 / -1;
  background: #101714;
}

.foot {
  margin-top: 18px;
  text-align: center;
  color: rgba(244, 250, 246, 0.88);
  font-size: 0.72rem;
  font-weight: 650;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
}

.foot a {
  color: #c8f5d8;
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 18, 14, 0.55);
  backdrop-filter: blur(4px);
}

.modal.on {
  display: flex;
  animation: fade 0.2s ease both;
}

.modal .box {
  width: 100%;
  max-width: 380px;
  padding: 22px 20px 18px;
  border-radius: 22px;
  background: var(--glass-strong);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 18px 50px rgba(8, 16, 12, 0.35);
}

.modal .box h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.15rem;
  text-align: center;
}

.modal .box p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.modal label {
  display: block;
  margin: 10px 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.modal select,
.modal input[type="text"],
.modal input[type="url"] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
}

.modal .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  z-index: 60;
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(10, 18, 14, 0.92);
  color: #e8f5ec;
  font-size: 0.85rem;
  font-weight: 700;
  transition: transform 0.25s ease;
  pointer-events: none;
}

.toast.on {
  transform: translateX(-50%) translateY(0);
}

.settings-btn {
  position: absolute;
  top: 18px;
  right: 16px;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: var(--glass-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
  font-size: 1.1rem;
}

@media (min-width: 920px) {
  .settings-btn {
    right: 24px;
  }
  .logout-btn {
    right: 72px;
  }
}

.modal input[type="email"],
.modal input[type="password"] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  margin-bottom: 4px;
}
