/* ==========================================================================
   FLUVIO PLANTA v1.1 — Design System (Telemetría Viva + Craft Industrial)
   Modo Claro + Modo Oscuro · Safe Areas · Bottom Sheets · Sidebar PC
   ========================================================================== */

:root {
  --bg: #f4f8fc;
  --surface: #ffffff;
  --surface-2: #eff4fa;
  --border: #e2eaf3;
  --border-strong: #c8d6e6;
  --ink: #0c172a;
  --ink-2: #334155;
  --muted: #64748b;
  --brand: #0b4f9e;
  --brand-vivid: #1d64d8;
  --brand-sky: #0284c7;
  --brand-indigo: #4f46e5;
  --brand-soft: #eff6ff;
  --brand-ink: #0b4f9e;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-soft: #ecfdf5;
  --emerald-ink: #047857;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --amber-ink: #b45309;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --danger-ink: #b91c1c;
  --shadow-xs: 0 2px 6px rgba(12, 23, 42, 0.045);
  --shadow-sm: 0 8px 22px rgba(12, 23, 42, 0.065);
  --shadow-md: 0 16px 36px rgba(12, 23, 42, 0.11);
  --shadow-lg: 0 26px 56px rgba(2, 6, 23, 0.24);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --sidebar-w: 262px;
  --font-head: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

body.theme-dark {
  --bg: #070d19;
  --surface: #0e1729;
  --surface-2: #152238;
  --border: rgba(148, 163, 184, 0.16);
  --border-strong: rgba(148, 163, 184, 0.28);
  --ink: #f8fafc;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --brand: #2563eb;
  --brand-vivid: #38bdf8;
  --brand-sky: #38bdf8;
  --brand-indigo: #818cf8;
  --brand-soft: rgba(37, 99, 235, 0.2);
  --brand-ink: #93c5fd;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --emerald-soft: rgba(16, 185, 129, 0.18);
  --emerald-ink: #6ee7b7;
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.18);
  --amber-ink: #fcd34d;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.18);
  --danger-ink: #fca5a5;
  --shadow-xs: 0 2px 6px rgba(0, 0, 0, 0.26);
  --shadow-sm: 0 8px 22px rgba(0, 0, 0, 0.32);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 26px 60px rgba(0, 0, 0, 0.62);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-vivid);
  outline-offset: 2px;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(840px 380px at 8% -4%, rgba(16, 185, 129, 0.14), transparent 64%),
    radial-gradient(760px 340px at 94% 4%, rgba(29, 100, 216, 0.14), transparent 62%),
    radial-gradient(520px 300px at 50% 100%, rgba(14, 165, 233, 0.08), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.theme-dark {
  background-image:
    radial-gradient(820px 400px at 10% -4%, rgba(16, 185, 129, 0.18), transparent 64%),
    radial-gradient(700px 360px at 92% 6%, rgba(37, 99, 235, 0.24), transparent 62%);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img, svg { display: block; max-width: 100%; }
.num { font-variant-numeric: tabular-nums; }
.is-hidden { display: none !important; }

@keyframes pulseRing {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulseAmber {
  0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.6); }
  70% { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes floatGlow {
  0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.72; }
  50% { transform: translate(-14px, 8px) scale(1.08); opacity: 0.95; }
}

/* ================= ONBOARDING ================= */
.onboarding-screen {
  min-height: 100svh;
  min-height: 100dvh;
  background:
    radial-gradient(760px 460px at 80% 10%, rgba(16, 185, 129, 0.22), transparent 60%),
    radial-gradient(520px 380px at 15% 85%, rgba(29, 100, 216, 0.25), transparent 65%),
    #080e1a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(28px + env(safe-area-inset-top)) 18px calc(32px + env(safe-area-inset-bottom));
}

.onboarding-card {
  width: 100%;
  max-width: 920px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: center;
}

.onb-brand { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.onb-brand-name { font-family: var(--font-head); font-weight: 800; font-size: 1.45rem; letter-spacing: -0.03em; }
.onb-brand-pill {
  font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.22); color: #6ee7b7; letter-spacing: 0.04em; text-transform: uppercase;
}
.onb-title {
  font-family: var(--font-head); font-weight: 800;
  font-size: clamp(1.85rem, 4vw, 2.75rem); line-height: 1.08; letter-spacing: -0.035em; margin-bottom: 14px;
}
.onb-sub { color: #cbd5e1; font-size: 0.98rem; max-width: 46ch; margin-bottom: 24px; }
.onb-panel {
  background: rgba(15, 23, 42, 0.88); border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 22px; padding: 24px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
}
.onb-panel h2 { font-family: var(--font-head); font-size: 1.15rem; margin-bottom: 4px; }
.onb-panel p { font-size: 0.86rem; color: #94a3b8; margin-bottom: 16px; }
.onb-divider {
  display: flex; align-items: center; gap: 12px; margin: 18px 0;
  font-size: 0.74rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}
.onb-divider::before, .onb-divider::after { content: ''; flex: 1; height: 1px; background: rgba(148, 163, 184, 0.18); }
.onb-saved-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.onb-saved-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(148, 163, 184, 0.18); color: #ffffff; text-align: left;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}
.onb-saved-item:hover { transform: translateY(-1px); background: rgba(16, 185, 129, 0.14); border-color: rgba(52, 211, 153, 0.48); }
.onb-saved-item small { display: block; font-size: 0.78rem; color: #94a3b8; }

/* ================= SHELL ================= */
.app-shell { min-height: 100svh; display: flex; flex-direction: column; }
.desktop-sidebar { display: none; }

.mobile-topbar {
  position: sticky; top: 0; z-index: 60;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(244, 248, 252, 0.86);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
body.theme-dark .mobile-topbar { background: rgba(7, 13, 25, 0.88); }

.top-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-brand-text { min-width: 0; }
.top-brand-title { font-family: var(--font-head); font-weight: 800; font-size: 0.98rem; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-brand-sub { font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px;
  border-radius: 999px; font-size: 0.72rem; font-weight: 700;
  background: var(--emerald-soft); color: var(--emerald-ink); white-space: nowrap;
  border: 1px solid rgba(16, 185, 129, 0.22);
}
.sync-pill.is-offline { background: var(--amber-soft); color: var(--amber-ink); border-color: rgba(245, 158, 11, 0.28); }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulseRing 2.4s infinite; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 140ms ease, border-color 150ms ease, background 150ms ease;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(0.95); }

.app-main {
  flex: 1; width: 100%; max-width: 1180px; margin: 0 auto;
  padding: 16px 16px calc(112px + env(safe-area-inset-bottom));
}
.view-panel { display: none; animation: fadeSlide 200ms cubic-bezier(0.22, 1, 0.36, 1); }
.view-panel.is-active { display: block; }

.view-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.view-head h1 { font-family: var(--font-head); font-weight: 800; font-size: clamp(1.36rem, 2.5vw, 1.75rem); letter-spacing: -0.03em; line-height: 1.15; }
.view-head p { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }

.section-bar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  margin: 20px 0 12px;
}
.section-bar h2 { font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; }
.section-bar p { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }

/* ================= PLANTA TELEMETRY HERO ================= */
.planta-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 20px;
  color: #ffffff;
  background:
    radial-gradient(420px 260px at 92% 8%, rgba(56, 189, 248, 0.32), transparent 64%),
    radial-gradient(360px 240px at 8% 95%, rgba(16, 185, 129, 0.28), transparent 62%),
    linear-gradient(140deg, #0b4f9e 0%, #09244b 54%, #081224 100%);
  box-shadow: 0 20px 44px rgba(11, 79, 158, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(147, 197, 253, 0.2);
}
body.theme-dark .planta-hero {
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.ph-glow {
  position: absolute;
  width: 240px; height: 240px; right: -48px; top: -60px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.34), transparent 70%);
  pointer-events: none;
  animation: floatGlow 7s ease-in-out infinite;
}

.ph-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}

.ph-main { min-width: 0; }

.ph-status-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}

.live-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.36);
  color: #a7f3d0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #34d399;
  animation: pulseRing 2.1s infinite;
}

.ph-clock {
  font-size: 0.74rem; font-weight: 700; color: rgba(226, 232, 240, 0.85);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 9px; border-radius: 999px;
}

.ph-kpi-wrap {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.ph-big-num {
  font-family: var(--font-head); font-weight: 800;
  font-size: clamp(2.15rem, 6vw, 3rem);
  line-height: 0.98; letter-spacing: -0.04em;
  background: linear-gradient(180deg, #ffffff 0%, #bae6fd 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ph-big-meta strong { display: block; font-size: 0.86rem; font-weight: 700; color: #f8fafc; }
.ph-big-meta span { display: block; font-size: 0.74rem; color: rgba(203, 213, 225, 0.82); margin-top: 1px; }

/* Health Ring Button */
.health-ring-btn {
  position: relative; width: 82px; height: 82px; flex-shrink: 0;
  border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  transition: transform 160ms ease, background 160ms ease;
}
.health-ring-btn:hover { transform: scale(1.05); background: rgba(255, 255, 255, 0.12); }
.health-ring-svg { width: 82px; height: 82px; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(255, 255, 255, 0.14); stroke-width: 7; }
.ring-fill {
  fill: none; stroke: #34d399; stroke-width: 7; stroke-linecap: round;
  transition: stroke-dashoffset 480ms cubic-bezier(0.22, 1, 0.36, 1), stroke 240ms ease;
}
.ring-fill.is-warn { stroke: #fbbf24; }
.ring-fill.is-due { stroke: #fb7185; }
.health-ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; line-height: 1.05;
}
.health-ring-center strong { font-family: var(--font-head); font-size: 1rem; font-weight: 800; color: #ffffff; }
.health-ring-center span { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; color: rgba(226, 232, 240, 0.82); text-transform: uppercase; }

/* Production Mix Bar */
.ph-mix {
  position: relative; z-index: 2;
  margin-top: 16px; padding: 12px 14px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.ph-mix-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  font-size: 0.74rem; color: rgba(226, 232, 240, 0.88); font-weight: 600; margin-bottom: 8px;
}
.mix-bar {
  height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  overflow: hidden; display: flex; gap: 2px;
}
.mix-seg { height: 100%; border-radius: 999px; transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1); }
.mix-seg.c-blue { background: linear-gradient(90deg, #38bdf8, #3b82f6); }
.mix-seg.c-sky { background: linear-gradient(90deg, #22d3ee, #06b6d4); }
.mix-seg.c-indigo { background: linear-gradient(90deg, #a78bfa, #818cf8); }

.mix-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 8px;
  font-size: 0.72rem; color: rgba(226, 232, 240, 0.9);
}
.mix-leg-item { display: inline-flex; align-items: center; gap: 6px; }
.mix-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mix-dot.c-blue { background: #38bdf8; }
.mix-dot.c-sky { background: #22d3ee; }
.mix-dot.c-indigo { background: #a78bfa; }

.ph-foot {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px; margin-top: 16px;
}

.ph-alert-pill {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px; padding: 8px 14px; border-radius: 13px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(251, 191, 36, 0.38);
  color: #fde68a; font-size: 0.8rem; font-weight: 700;
  transition: transform 150ms ease, background 150ms ease;
}
.ph-alert-pill:hover { transform: translateY(-1px); background: rgba(245, 158, 11, 0.26); }
.ph-alert-pill.is-ok {
  background: rgba(16, 185, 129, 0.18); border-color: rgba(52, 211, 153, 0.36); color: #a7f3d0;
}
.ph-alert-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #fbbf24;
  animation: pulseAmber 2s infinite;
}
.ph-alert-pill.is-ok .ph-alert-dot { background: #34d399; animation: pulseRing 2.2s infinite; }

/* ================= COMPLIANCE SUMMARY BANNER ================= */
.compliance-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.cb-row {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 8px; margin-bottom: 9px;
}
.cb-title { font-family: var(--font-head); font-weight: 800; font-size: 0.92rem; }
.cb-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-bar {
  height: 9px; border-radius: 999px; background: var(--surface-2);
  overflow: hidden; display: flex; gap: 2px;
}
.cb-seg-ok { background: linear-gradient(90deg, #10b981, #34d399); border-radius: 999px; }
.cb-seg-warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); border-radius: 999px; }
.cb-seg-due { background: linear-gradient(90deg, #ef4444, #f87171); border-radius: 999px; }

/* ================= LIVE CLOCK HERO (HORARIOS) ================= */
.clock-hero {
  border-radius: var(--radius-xl);
  padding: 20px 22px;
  margin-bottom: 16px;
  color: #ffffff;
  background:
    radial-gradient(360px 220px at 90% 10%, rgba(16, 185, 129, 0.28), transparent 64%),
    linear-gradient(135deg, #0b3b7d 0%, #09162e 100%);
  border: 1px solid rgba(147, 197, 253, 0.2);
  box-shadow: 0 18px 38px rgba(11, 59, 125, 0.24);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.clock-big {
  font-family: var(--font-head); font-weight: 800;
  font-size: clamp(2rem, 6vw, 2.85rem); line-height: 1.05; letter-spacing: -0.04em;
  margin-top: 8px;
}
.clock-sub { font-size: 0.8rem; color: rgba(203, 213, 225, 0.86); margin-top: 2px; }
.clock-hero-right { display: flex; align-items: center; gap: 10px; }
.clock-stat-box {
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px; padding: 9px 14px; text-align: center;
}
.clock-stat-box small { display: block; font-size: 0.68rem; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.clock-stat-box strong { font-family: var(--font-head); font-size: 1.25rem; font-weight: 800; color: #6ee7b7; }

.punch-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
@media (min-width: 768px) {
  .punch-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ================= NAVIGATION DOCK & BADGES ================= */
.mobile-dock {
  position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 70; background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border); border-radius: 22px; padding: 6px;
  box-shadow: var(--shadow-md);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px;
}
body.theme-dark .mobile-dock { background: rgba(14, 23, 41, 0.94); }

.dock-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; min-height: 54px; border-radius: 15px; color: var(--muted);
  font-size: 0.67rem; font-weight: 700; transition: background 160ms ease, color 160ms ease, transform 140ms ease;
}
.dock-btn:active { transform: scale(0.95); }
.dock-btn.is-active {
  background: linear-gradient(135deg, #1d64d8 0%, #0b4f9e 100%);
  color: #ffffff; box-shadow: 0 8px 18px rgba(11, 79, 158, 0.32);
}
.dock-icon-wrap { position: relative; display: inline-flex; }
.dock-badge {
  position: absolute; top: -5px; right: -10px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #f59e0b; color: #0c172a; font-size: 0.62rem; font-weight: 800;
  display: grid; place-items: center; border: 2px solid var(--surface);
}
.dock-btn.is-active .dock-badge { background: #fde68a; border-color: #1654bb; }

.nav-pill-count {
  margin-left: auto;
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--amber-soft); color: var(--amber-ink);
  font-size: 0.7rem; font-weight: 800; display: grid; place-items: center;
}
.sb-btn.is-active .nav-pill-count { background: rgba(255, 255, 255, 0.22); color: #ffffff; }

/* ================= PRIMITIVES ================= */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-xs); }
.card-elevated { box-shadow: var(--shadow-sm); }
.card-subtle { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; }
.card-head-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }

.mini-icon {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0;
}
.mini-blue { background: var(--brand-soft); color: var(--brand-vivid); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 13px;
  font-weight: 700; font-size: 0.87rem; border: 1px solid transparent;
  transition: transform 140ms ease, filter 160ms ease, background 160ms ease, box-shadow 160ms ease;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, #2563eb 0%, #0b4f9e 100%); color: #ffffff; box-shadow: 0 8px 20px rgba(11, 79, 158, 0.28); }
.btn-sky { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); color: #ffffff; box-shadow: 0 8px 18px rgba(2, 132, 199, 0.26); }
.btn-indigo { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); color: #ffffff; box-shadow: 0 8px 18px rgba(79, 70, 229, 0.26); }
.btn-emerald { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #ffffff; box-shadow: 0 8px 22px rgba(16, 185, 129, 0.34); }
.btn-amber { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #ffffff; box-shadow: 0 8px 18px rgba(217, 119, 6, 0.28); }
.btn-glass { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); color: #ffffff; }
.btn-glass:hover { background: rgba(255, 255, 255, 0.22); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger-ink); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.79rem; border-radius: 10px; }
.btn-block { width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.badge-blue { background: var(--brand-soft); color: var(--brand-ink); }
.badge-green { background: var(--emerald-soft); color: var(--emerald-ink); }
.badge-amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge-red { background: var(--danger-soft); color: var(--danger-ink); }
.badge-neutral { background: var(--surface-2); color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: 0.79rem; font-weight: 700; color: var(--ink-2); }
.onboarding-screen .field label { color: #cbd5e1; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  font-size: 0.92rem; outline: none; transition: border-color 140ms ease, box-shadow 140ms ease;
}
.textarea { min-height: 78px; resize: vertical; }
.onboarding-screen .input { background: rgba(255, 255, 255, 0.06); border-color: rgba(148, 163, 184, 0.25); color: #ffffff; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-vivid); box-shadow: 0 0 0 3px rgba(29, 100, 216, 0.16); }
.form-row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
  font-size: 0.8rem; font-weight: 700; transition: all 150ms ease;
}
.chip:hover { border-color: var(--border-strong); }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); box-shadow: 0 4px 12px rgba(12, 23, 42, 0.16); }

/* ================= PRODUCTION LINE CARDS ================= */
.prod-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }

.lote-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 170ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 170ms ease, border-color 170ms ease;
}
.lote-card::before {
  content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #1d64d8, #38bdf8);
}
.lote-card.tone-sky::before { background: linear-gradient(90deg, #0284c7, #22d3ee); }
.lote-card.tone-indigo::before { background: linear-gradient(90deg, #4f46e5, #818cf8); }
.lote-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

.lote-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lote-left { display: flex; align-items: center; gap: 13px; min-width: 0; }

.art-box {
  width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 6px 14px rgba(15, 23, 42, 0.08);
}
.art-blue { background: linear-gradient(135deg, #dbeafe 0%, #bae6fd 100%); color: #1d64d8; }
.art-sky { background: linear-gradient(135deg, #cffafe 0%, #bae6fd 100%); color: #0284c7; }
.art-indigo { background: linear-gradient(135deg, #e0e7ff 0%, #ddd6fe 100%); color: #4f46e5; }
body.theme-dark .art-blue { background: rgba(37, 99, 235, 0.25); color: #60a5fa; box-shadow: none; }
body.theme-dark .art-sky { background: rgba(2, 132, 199, 0.25); color: #38bdf8; box-shadow: none; }
body.theme-dark .art-indigo { background: rgba(79, 70, 229, 0.28); color: #a5b4fc; box-shadow: none; }

.lote-qty-line { display: flex; align-items: baseline; gap: 6px; margin-top: 2px; }
.lote-qty-line strong { font-family: var(--font-head); font-weight: 800; font-size: 1.2rem; color: var(--ink); }
.lote-qty-line span { font-size: 0.78rem; color: var(--muted); }

.lote-meter-wrap { display: flex; flex-direction: column; gap: 5px; }
.lote-meter-meta { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); font-weight: 600; }
.lote-meter { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.lote-meter-fill { height: 100%; border-radius: 999px; transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1); }
.lote-meter-fill.c-blue { background: linear-gradient(90deg, #1d64d8, #38bdf8); }
.lote-meter-fill.c-sky { background: linear-gradient(90deg, #0284c7, #22d3ee); }
.lote-meter-fill.c-indigo { background: linear-gradient(90deg, #4f46e5, #818cf8); }

/* ================= BITACORA CHECKLIST CARDS ================= */
.log-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.log-item-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--emerald);
  border-radius: var(--radius-lg); padding: 15px 16px;
  display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-xs);
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.log-item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.log-item-card.st-warn {
  border-left-color: #f59e0b;
  background: linear-gradient(135deg, var(--surface) 60%, rgba(245, 158, 11, 0.06) 100%);
}
.log-item-card.st-due {
  border-left-color: #ef4444;
  background: linear-gradient(135deg, var(--surface) 58%, rgba(239, 68, 68, 0.065) 100%);
}
.log-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.log-name { font-family: var(--font-head); font-weight: 800; font-size: 0.96rem; }
.log-freq { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.log-meta { font-size: 0.79rem; color: var(--ink-2); }
.log-life-track { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.log-life-fill { height: 100%; border-radius: 999px; transition: width 400ms ease; }
.log-life-fill.st-ok { background: linear-gradient(90deg, #10b981, #34d399); }
.log-life-fill.st-warn { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.log-life-fill.st-due { background: linear-gradient(90deg, #ef4444, #fb7185); }
.log-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ================= AVATARS & ROWS ================= */
.tx-row {
  display: flex; align-items: center; justify-content: space-between; gap: 11px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.tx-row:last-child { border-bottom: none; }
.tx-left-av { display: flex; align-items: center; gap: 11px; min-width: 0; }

.op-avatar {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center; font-family: var(--font-head);
  font-weight: 800; font-size: 0.82rem; color: #ffffff;
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.14);
}
.op-avatar.av-0 { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.op-avatar.av-1 { background: linear-gradient(135deg, #10b981, #059669); }
.op-avatar.av-2 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.op-avatar.av-3 { background: linear-gradient(135deg, #f59e0b, #ea580c); }
.op-avatar.av-4 { background: linear-gradient(135deg, #ec4899, #e11d48); }
.op-avatar.av-5 { background: linear-gradient(135deg, #06b6d4, #0284c7); }

/* ================= REPORTS ================= */
.pulse-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.report-hero {
  background:
    radial-gradient(360px 220px at 90% 10%, rgba(56, 189, 248, 0.25), transparent 64%),
    linear-gradient(145deg, #0b4f9e 0%, #080e1a 100%);
  color: #ffffff; border-radius: var(--radius-xl); padding: 22px; margin-bottom: 16px;
  box-shadow: var(--shadow-md); border: 1px solid rgba(147, 197, 253, 0.2);
}
.report-cards { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
.report-card {
  background: var(--surface); border: 1px solid var(--border); border-top: 3px solid #1d64d8;
  border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; justify-content: space-between; gap: 14px;
  box-shadow: var(--shadow-xs); transition: transform 160ms ease, box-shadow 160ms ease;
}
.report-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.report-card:nth-child(2) { border-top-color: #10b981; }
.report-card:nth-child(3) { border-top-color: #0ea5e9; }
.report-card:nth-child(4) { border-top-color: #f59e0b; }
.report-card h3 { font-family: var(--font-head); font-size: 1rem; margin-bottom: 4px; }
.report-card p { font-size: 0.82rem; color: var(--muted); }

/* ================= BOTTOM SHEETS & TOASTS ================= */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(2, 6, 23, 0.58);
  backdrop-filter: blur(5px); display: none; align-items: flex-end; justify-content: center;
}
.sheet-backdrop.is-open { display: flex; }
.sheet {
  width: 100%; max-width: 520px; max-height: 88svh; overflow-y: auto;
  background: var(--surface); color: var(--ink); border-radius: 26px 26px 0 0;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg);
}
.sheet-handle { width: 42px; height: 4px; border-radius: 999px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h3 { font-family: var(--font-head); font-weight: 800; font-size: 1.12rem; }

.toast-stack {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 140; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: min(92vw, 380px);
}
.toast {
  background: #0f172a; color: #ffffff; border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px; padding: 12px 16px; font-size: 0.86rem; font-weight: 600; box-shadow: var(--shadow-md);
}
.toast.is-success { border-left: 4px solid var(--emerald); }
.toast.is-warning { border-left: 4px solid var(--amber); }
.toast.is-error { border-left: 4px solid var(--danger); }

/* ================= RESPONSIVE ================= */
@media (min-width: 768px) {
  .onboarding-card { grid-template-columns: 1.05fr 0.95fr; gap: 40px; }
  .planta-hero { padding: 26px 28px; }
  .prod-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .log-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet-backdrop { align-items: center; padding: 20px; }
  .sheet { border-radius: 24px; padding: 22px 24px 24px; }
  .sheet-handle { display: none; }
}

@media (min-width: 1024px) {
  .app-shell { flex-direction: row; }
  .mobile-topbar, .mobile-dock { display: none; }
  .desktop-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
    background: var(--surface); border-right: 1px solid var(--border);
    padding: 20px 14px; display: flex; flex-direction: column; justify-content: space-between; z-index: 60;
    box-shadow: 4px 0 24px rgba(12, 23, 42, 0.03);
  }
  .sb-brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 16px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
  .sb-brand-name { font-family: var(--font-head); font-weight: 800; font-size: 1.18rem; letter-spacing: -0.03em; }
  .sb-brand-sub { font-size: 0.72rem; color: var(--muted); }
  .sb-plant-pill {
    width: 100%; padding: 11px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
    text-align: left; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    transition: border-color 150ms ease, background 150ms ease;
  }
  .sb-plant-pill:hover { border-color: var(--border-strong); }
  .sb-plant-pill strong { display: block; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sb-plant-pill small { display: block; font-size: 0.72rem; color: var(--muted); }
  .sb-nav { display: flex; flex-direction: column; gap: 5px; }
  .sb-btn {
    width: 100%; display: flex; align-items: center; gap: 11px; padding: 11px 12px;
    border-radius: 13px; font-size: 0.88rem; font-weight: 700; color: var(--muted); text-align: left;
    transition: background 150ms ease, color 150ms ease, transform 140ms ease;
  }
  .sb-btn:hover { background: var(--surface-2); color: var(--ink); }
  .sb-btn.is-active { background: linear-gradient(135deg, #2563eb 0%, #0b4f9e 100%); color: #ffffff; box-shadow: 0 8px 20px rgba(11, 79, 158, 0.3); }
  .sb-footer { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 10px; }
  .sb-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .app-main { margin-left: var(--sidebar-w); padding: 28px 34px 52px; max-width: calc(100% - var(--sidebar-w)); }
}
