/* =========================================================
   Entrebosques — UI glass / iOS-like / mobile-first
   ========================================================= */
:root {
  --forest-950: #061a14;
  --forest-900: #0b3d2e;
  --mist: #c8e6d8;
  --leaf: #3ecf8e;
  --leaf-dim: #2aa86f;
  --amber: #e8b86d;
  --sky: #7eb8da;
  --glass: rgba(255, 255, 255, 0.12);
  --glass-strong: rgba(255, 255, 255, 0.18);
  --glass-border: rgba(255, 255, 255, 0.22);
  --text: #f4faf7;
  --text-muted: rgba(244, 250, 247, 0.68);
  --text-dim: rgba(244, 250, 247, 0.45);
  --danger: #ff6b6b;
  --ok: #3ecf8e;
  --warn: #e8b86d;
  --radius: 18px;
  --radius-sm: 12px;
  --nav-h: 72px;
  --topbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Outfit", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  --blur: 22px;
}

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

html {
  min-height: 100%;
  scrollbar-gutter: stable;
}
html, body {
  font-family: var(--font);
  color: var(--text);
  background: var(--forest-950);
  -webkit-font-smoothing: antialiased;
}
body {
  min-height: 100dvh;
  overflow-x: clip; /* clip avoids breaking position:sticky (unlike hidden) */
}

a { color: var(--leaf); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }

.bg-atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 10% -10%, #145c45 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 10%, #1a4a6e 0%, transparent 50%),
    linear-gradient(165deg, #07241c 0%, #0b3d2e 40%, #0a2a38 100%);
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(60px); opacity: 0.45;
  animation: float 14s ease-in-out infinite;
}
.orb-a { width: 280px; height: 280px; background: #2aa86f; top: 12%; left: -40px; }
.orb-b { width: 220px; height: 220px; background: #3d7ea6; bottom: 18%; right: -30px; animation-delay: -4s; }
.orb-c { width: 160px; height: 160px; background: #c4a35a; top: 48%; left: 40%; opacity: 0.25; animation-delay: -7s; }
.forest-grain {
  position: absolute; inset: 0; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-28px) scale(1.05); }
}

.app-shell { position: relative; z-index: 1; min-height: 100dvh; }

.boot-loader {
  min-height: 100dvh; display: grid; place-content: center; gap: 18px; text-align: center;
}
.boot-mark {
  font-family: var(--display); font-size: 2rem; letter-spacing: -0.02em;
  background: linear-gradient(120deg, #fff, var(--mist));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: pulse 1.4s ease-in-out infinite;
}
.boot-bar {
  width: 120px; height: 3px; margin: 0 auto; border-radius: 99px;
  background: rgba(255,255,255,0.12); overflow: hidden;
}
.boot-bar span {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--leaf), var(--sky));
  animation: load 1.1s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.7; } }
@keyframes load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(280%); }
}

.layout {
  display: flex; flex-direction: column; min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b));
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: var(--topbar-h);
  padding: 14px 18px 10px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  background: rgba(6, 26, 20, 0.72);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand {
  font-family: var(--display); font-size: 1.25rem; font-weight: 700;
  letter-spacing: -0.02em;
}
.brand span { color: var(--leaf); }
.topbar-meta { font-size: 0.78rem; color: var(--text-muted); text-align: right; }
.main { flex: 1; padding: 16px 16px 28px; max-width: 920px; margin: 0 auto; width: 100%; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 6px calc(8px + var(--safe-b));
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  background: rgba(8, 28, 22, 0.78);
  border-top: 1px solid var(--glass-border);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border: 0; background: transparent; color: var(--text-dim);
  font-size: 0.68rem; font-weight: 500; cursor: pointer;
  transition: color .2s, transform .2s;
}
.nav-item svg { width: 22px; height: 22px; }
.nav-item.active { color: var(--leaf); }
.nav-item:active { transform: scale(0.94); }

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(var(--blur)); -webkit-backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow);
  transition: transform .25s ease, background .25s, border-color .25s;
}
.glass:hover { background: var(--glass-strong); border-color: rgba(255,255,255,0.32); }
.glass-pad { padding: 18px; }

.login-page {
  --login-bg: url('../assets/fondo.png');
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 28px 20px 36px; max-width: 440px; margin: 0 auto;
  position: relative;
  isolation: isolate;
}
.login-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--login-bg) center / cover no-repeat;
  transform: scale(1.02);
}
.login-page::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(165deg, rgba(6, 26, 20, 0.42) 0%, rgba(6, 26, 20, 0.68) 42%, rgba(6, 26, 20, 0.88) 100%),
    radial-gradient(ellipse at 30% 20%, rgba(62, 207, 142, 0.12), transparent 55%);
  pointer-events: none;
}
.login-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-top: 8vh; }
.login-brand {
  font-family: var(--display); font-size: clamp(2.6rem, 10vw, 3.4rem);
  line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 12px;
  text-shadow: 0 8px 40px rgba(0,0,0,0.45);
}
.login-brand em { font-style: normal; color: var(--leaf); }
.login-tag {
  color: var(--text-muted); font-size: 1.02rem; max-width: 28ch; line-height: 1.45;
  margin-bottom: 28px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.35);
}
.login-card,
.glass.login-card {
  padding: 22px;
  animation: rise .55s ease both;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.tabs {
  display: flex; gap: 6px; padding: 4px; margin-bottom: 18px;
  background: rgba(0,0,0,0.22); border-radius: 14px;
}
.tab {
  flex: 1; border: 0; background: transparent; color: var(--text-muted);
  padding: 10px; border-radius: 11px; cursor: pointer; font-weight: 500; font-size: 0.9rem;
}
.tab.active {
  background: rgba(255,255,255,0.14); color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 0.75rem; font-weight: 500;
  color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.02em;
}
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.28);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.2);
}
.field textarea { min-height: 90px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 600;
  cursor: pointer; transition: transform .15s, opacity .15s, background .2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--leaf) 0%, var(--leaf-dim) 100%);
  color: #062218; box-shadow: 0 8px 24px rgba(62, 207, 142, 0.28);
}
.btn-ghost {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  color: var(--text);
}
.btn-danger { background: rgba(255,107,107,0.2); color: #ffb4b4; border: 1px solid rgba(255,107,107,0.35); }
.btn-ok { background: rgba(62,207,142,0.18); color: var(--leaf); border: 1px solid rgba(62,207,142,0.35); }
.btn-sm { padding: 8px 12px; font-size: 0.82rem; border-radius: 10px; width: auto; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.linkish {
  background: none; border: 0; color: var(--mist); font-size: 0.85rem;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
  margin-top: 14px; width: 100%; text-align: center;
}

.page { animation: pageIn .35s ease both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-family: var(--display); font-size: 1.7rem; letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.page-sub { color: var(--text-muted); font-size: 0.92rem; margin-bottom: 18px; line-height: 1.4; }

.grid-stats {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 18px;
}
.stat {
  padding: 16px; border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
}
.stat-n {
  font-family: var(--display); font-size: 1.8rem; line-height: 1;
  margin-bottom: 4px;
}
.stat-l { font-size: 0.75rem; color: var(--text-muted); }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin: 22px 0 12px;
}
.section-head h2 { font-size: 1.05rem; font-weight: 600; }

.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { padding: 14px 16px; }
.list-item h3 { font-size: 0.98rem; font-weight: 600; margin-bottom: 4px; }
.list-item p, .meta { font-size: 0.82rem; color: var(--text-muted); line-height: 1.4; }
.meta { margin-top: 6px; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 99px; font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.02em; text-transform: uppercase;
}
.badge-pending { background: rgba(232,184,109,0.2); color: var(--warn); }
.badge-approved, .badge-confirmed, .badge-delivered { background: rgba(62,207,142,0.18); color: var(--ok); }
.badge-rejected, .badge-returned, .badge-cancelled { background: rgba(255,107,107,0.18); color: #ffb4b4; }
.badge-exited { background: rgba(126,184,218,0.2); color: var(--sky); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text-muted); padding: 7px 12px; border-radius: 99px;
  font-size: 0.78rem; cursor: pointer;
}
.chip.active { background: rgba(62,207,142,0.2); color: var(--leaf); border-color: rgba(62,207,142,0.4); }

.content-html { font-size: 0.95rem; line-height: 1.55; color: var(--text); }
.content-html h1, .content-html h2, .content-html h3 {
  font-family: var(--display); color: var(--mist); margin: 16px 0 8px; line-height: 1.25;
}
.content-html h1 { font-size: 1.45rem; }
.content-html h2 { font-size: 1.2rem; }
.content-html h3 { font-size: 1.05rem; }
.content-html p { margin-bottom: 10px; color: var(--text-muted); }
.content-html ul, .content-html ol { margin: 8px 0 12px 1.2em; color: var(--text-muted); }
.content-html li { margin-bottom: 6px; }
.content-html strong, .content-html b { color: var(--text); }
.content-html a { color: var(--leaf); text-decoration: underline; text-underline-offset: 2px; }
.content-html img { border-radius: var(--radius-sm); margin: 12px 0; max-width: 100%; }
.content-html u { text-decoration: underline; }

.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.menu-tile {
  padding: 18px 14px; text-align: left; cursor: pointer; border: 0; width: 100%;
  color: inherit; min-height: 110px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
}
.menu-tile .ico { font-size: 1.4rem; margin-bottom: auto; }
.menu-tile strong { font-size: 0.95rem; }
.menu-tile span { font-size: 0.75rem; color: var(--text-muted); }

.empty {
  text-align: center; padding: 36px 16px; color: var(--text-muted); font-size: 0.92rem;
}

.modal-back {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(520px, 100%); max-height: 88dvh; overflow: auto;
  border-radius: 22px 22px 0 0; padding: 20px 18px 28px;
  animation: sheet .3s ease;
}
@keyframes sheet {
  from { transform: translateY(40px); }
  to { transform: translateY(0); }
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.modal-head h3 { font-size: 1.15rem; }

.toast-root {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(360px, 92vw);
  pointer-events: none;
}
.toast {
  pointer-events: auto; padding: 12px 14px; border-radius: 14px;
  background: rgba(20, 40, 34, 0.92); border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px); font-size: 0.88rem;
  animation: rise .3s ease;
  box-shadow: var(--shadow);
}
.toast.error { border-color: rgba(255,107,107,0.45); }
.toast.ok { border-color: rgba(62,207,142,0.45); }

.feed-card .title-row {
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
}
.feed-card .author { font-size: 0.75rem; color: var(--text-dim); margin-top: 8px; }

.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: collapse; font-size: 0.82rem;
}
table.data th, table.data td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
table.data th { color: var(--text-muted); font-weight: 500; }

.public-home {
  min-height: 100dvh; display: flex; flex-direction: column;
  padding: 28px 20px 40px; max-width: 720px; margin: 0 auto;
}
.feature-strip {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 20px 0 24px;
}
.feature-strip .glass { padding: 12px; font-size: 0.8rem; color: var(--text-muted); }
.feature-strip strong { display: block; color: var(--text); font-size: 0.88rem; margin-bottom: 2px; }

/* —— Quill WYSIWYG (glass) —— */
.wysiwyg-field .ql-toolbar.ql-snow,
.wysiwyg-field .ql-container.ql-snow {
  border-color: rgba(255,255,255,0.16);
  font-family: var(--font);
}
.wysiwyg-field .ql-toolbar.ql-snow {
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: rgba(0,0,0,0.32);
  padding: 8px;
}
.wysiwyg-field .ql-container.ql-snow {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: rgba(0,0,0,0.28);
  min-height: 200px;
  font-size: 0.95rem;
}
.wysiwyg-field .ql-editor {
  min-height: 200px;
  color: var(--text);
  line-height: 1.55;
}
.wysiwyg-field .ql-editor.ql-blank::before {
  color: var(--text-dim); font-style: normal;
}
.wysiwyg-field .ql-snow .ql-stroke { stroke: var(--text-muted); }
.wysiwyg-field .ql-snow .ql-fill { fill: var(--text-muted); }
.wysiwyg-field .ql-snow .ql-picker { color: var(--text-muted); }
.wysiwyg-field .ql-snow .ql-picker-options {
  background: rgba(12, 36, 28, 0.96);
  border-color: var(--glass-border);
  border-radius: 10px;
}
.wysiwyg-field .ql-snow.ql-toolbar button:hover,
.wysiwyg-field .ql-snow .ql-toolbar button:hover,
.wysiwyg-field .ql-snow.ql-toolbar button.ql-active,
.wysiwyg-field .ql-snow .ql-toolbar button.ql-active {
  color: var(--leaf);
}
.wysiwyg-field .ql-snow.ql-toolbar button:hover .ql-stroke,
.wysiwyg-field .ql-snow .ql-toolbar button:hover .ql-stroke,
.wysiwyg-field .ql-snow.ql-toolbar button.ql-active .ql-stroke,
.wysiwyg-field .ql-snow .ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--leaf);
}
.wysiwyg-field .ql-snow.ql-toolbar button:hover .ql-fill,
.wysiwyg-field .ql-snow .ql-toolbar button:hover .ql-fill,
.wysiwyg-field .ql-snow.ql-toolbar button.ql-active .ql-fill,
.wysiwyg-field .ql-snow .ql-toolbar button.ql-active .ql-fill {
  fill: var(--leaf);
}
.wysiwyg-field .ql-editor img { max-width: 100%; border-radius: 8px; }
.wysiwyg-field .ql-tooltip {
  background: rgba(12, 36, 28, 0.96);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  color: var(--text);
  box-shadow: var(--shadow);
}
.wysiwyg-field .ql-tooltip input[type=text] {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--text);
  border-radius: 8px;
}
.wysiwyg-field .ql-snow .ql-tooltip::before { content: "Visitar URL:"; }
.wysiwyg-field .ql-snow .ql-tooltip a.ql-action::after { content: "Editar"; }
.wysiwyg-field .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: "Guardar"; }
.wysiwyg-field .ql-snow .ql-tooltip a.ql-remove::before { content: "Quitar"; }
.wysiwyg-field .ql-snow .ql-tooltip.ql-editing::before { content: "URL:"; }
.modal.modal-wide { width: min(640px, 100%); }

/* —— Vehículos / mascotas —— */
.apt-chip {
  display: inline-flex; align-items: center;
  padding: 5px 10px; border-radius: 10px;
  font-weight: 700; font-size: 0.82rem; letter-spacing: 0.02em;
  background: linear-gradient(135deg, rgba(62, 207, 142, 0.28), rgba(62, 207, 142, 0.12));
  color: var(--leaf);
  border: 1px solid rgba(62, 207, 142, 0.35);
}
.owned-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 10px;
}
.plate-tag, .species-tag {
  font-family: var(--display); font-size: 0.95rem; font-weight: 600;
  letter-spacing: 0.04em; color: var(--mist);
}
.plate-tag { text-transform: uppercase; }
.apt-banner {
  padding: 12px 14px; margin-bottom: 14px; font-size: 0.9rem; color: var(--text-muted);
}
.apt-banner strong { color: var(--leaf); font-weight: 700; }
.filter-inline {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  margin-bottom: 14px;
}
.filter-inline .btn { width: auto; }

@media (min-width: 860px) {
  .layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "topbar topbar"
      "nav main";
    padding-bottom: 0;
    max-width: 1100px; margin: 0 auto;
  }
  .topbar {
    grid-area: topbar;
    position: sticky;
    top: 0;
    align-self: start;
    width: 100%;
  }
  .bottom-nav {
    grid-area: nav;
    position: sticky; top: var(--topbar-h); left: auto; right: auto; bottom: auto;
    flex-direction: column; height: auto; width: 200px;
    margin: 16px; border-radius: var(--radius); border: 1px solid var(--glass-border);
    padding: 12px; gap: 4px; align-self: start;
  }
  .main {
    grid-area: main;
    padding: 24px 28px 40px; max-width: none;
    min-width: 0; /* prevent grid blowout from wide chips/content */
  }
  .nav-item {
    flex-direction: row; justify-content: flex-start; gap: 10px;
    padding: 12px 12px; border-radius: 12px; font-size: 0.88rem;
  }
  .nav-item.active { background: rgba(62,207,142,0.12); }
  .grid-stats { grid-template-columns: repeat(4, 1fr); }
  .menu-grid { grid-template-columns: repeat(3, 1fr); }
  .modal-back { align-items: center; }
  .modal { border-radius: 22px; max-height: 80vh; }
  .login-page { justify-content: center; max-width: 480px; }
}
