/* HuellaCasa · Prototipo navegable
   Sistema de diseño: colores, tipografía y componentes compartidos por la
   aplicación del cliente y el portal administrativo. */

/* Fuentes locales (licencia SIL Open Font License) */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 800; font-display: swap; src: url("fonts/nunito-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/inter-latin-700-normal.woff2") format("woff2"); }

:root {
  --teal-900: #0b4f4a;
  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-100: #ccfbf1;
  --teal-50: #effcf9;
  --coral-600: #e8553a;
  --coral-500: #f97352;
  --coral-50: #fff1ec;
  --amber-600: #b45309;
  --amber-50: #fff7e6;
  --red-700: #b42318;
  --red-50: #fef1f0;
  --green-700: #15803d;
  --green-50: #ecfdf3;
  --blue-700: #1d4ed8;
  --blue-50: #eef4ff;
  --ink: #1f2933;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --line: #e6e1d8;
  --bg: #faf7f2;
  --surface: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 41, 51, .06), 0 4px 16px rgba(31, 41, 51, .06);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Nunito", "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--teal-700); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--coral-500); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#app:focus { outline: none; }

/* ── Botones ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--teal-700); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--teal-900); }
.btn--accent { background: var(--coral-500); color: #fff; }
.btn--accent:hover:not(:disabled) { background: var(--coral-600); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover:not(:disabled) { border-color: var(--teal-700); color: var(--teal-700); }
.btn--danger { background: transparent; border-color: #f3c3bd; color: var(--red-700); }
.btn--danger:hover:not(:disabled) { background: var(--red-50); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn--block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; color: var(--teal-700); font-weight: 600; cursor: pointer; }

/* ── Tarjetas, insignias y utilidades ───────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.strong { font-weight: 700; }
.mt { margin-top: 16px; }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-main { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; margin-top: 16px; }
.grid-side { display: grid; grid-template-columns: 300px 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--teal-50); color: var(--teal-700);
}
.badge--gris { background: #f1efe9; color: var(--ink-2); }
.badge--ambar { background: var(--amber-50); color: var(--amber-600); }
.badge--rojo { background: var(--red-50); color: var(--red-700); }
.badge--verde { background: var(--green-50); color: var(--green-700); }
.badge--azul { background: var(--blue-50); color: var(--blue-700); }
.badge--coral { background: var(--coral-50); color: var(--coral-600); }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.alert--info { background: var(--blue-50); color: #1e3a8a; }
.alert--warn { background: var(--amber-50); color: #7c3f06; }
.alert--error { background: var(--red-50); color: var(--red-700); }
.alert--ok { background: var(--green-50); color: #14532d; }
.alert strong { display: block; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--teal-100); color: var(--teal-900); font-weight: 800; font-family: var(--font-display); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--lg { width: 64px; height: 64px; font-size: 22px; }
.avatar--perro { background: #fde7c8; color: #7c4a03; }
.avatar--gato { background: #e7e2fb; color: #4c2a85; }

.progress { height: 8px; border-radius: 999px; background: #efebe3; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--teal-600); border-radius: 999px; }
.progress--agotado > span { background: var(--coral-500); }

.empty { text-align: center; padding: 28px 12px; color: var(--ink-3); }
.empty strong { display: block; color: var(--ink); font-family: var(--font-display); font-size: 16px; margin-bottom: 4px; }

/* ── Formularios ────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label, .label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: var(--teal-600); outline: none; box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.field--error .input { border-color: var(--red-700); }
.field-error { color: var(--red-700); font-size: 13px; }
.hint { font-size: 12.5px; color: var(--ink-3); }

/* ── Toasts y modal ─────────────────────────────────────────────────── */
.toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 90; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; animation: subir .2s ease-out; }
.toast--error { background: var(--red-700); }
@keyframes subir { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, .45); display: grid; place-items: center; padding: 16px; z-index: 80; }
.modal { background: #fff; border-radius: 18px; width: min(100%, 520px); max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal--wide { width: min(100%, 720px); }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal__body { padding: 16px 20px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 20px 20px; flex-wrap: wrap; }
.close-x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #f3f0ea; cursor: pointer; font-size: 18px; }

/* ── Ingreso ────────────────────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login__brand {
  background: radial-gradient(circle at 20% 15%, #14b8a6 0, transparent 45%), linear-gradient(160deg, var(--teal-700), var(--teal-900));
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.login__brand h1 { font-size: 40px; }
.login__brand p { opacity: .9; max-width: 440px; font-size: 16px; }
.login__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.login__chips span { background: rgba(255,255,255,.14); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.login__panel { padding: 48px; display: flex; flex-direction: column; justify-content: center; max-width: 560px; }
.perfiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.perfil {
  text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer;
}
.perfil:hover, .perfil[aria-pressed="true"] { border-color: var(--teal-600); background: var(--teal-50); }
.perfil strong { display: block; font-size: 14px; }
.perfil span { font-size: 12.5px; color: var(--ink-3); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: inherit; text-decoration: none; }
.logo svg { width: 34px; height: 34px; }
.demo-note { font-size: 12.5px; color: var(--ink-3); border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 18px; }

/* ── Aplicación del cliente ─────────────────────────────────────────── */
.cliente { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: 88px; }
.c-top { position: sticky; top: 0; z-index: 20; background: rgba(250, 247, 242, .94); backdrop-filter: blur(8px); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.c-top .logo { font-size: 18px; color: var(--teal-900); }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.dot { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--coral-500); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.c-main { padding: 18px; }
.c-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: min(100%, 480px); z-index: 30;
  background: #fff; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.c-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-decoration: none; border-radius: 10px; }
.c-nav a svg { width: 22px; height: 22px; }
.c-nav a[aria-current="page"] { color: var(--teal-700); background: var(--teal-50); }
.hero-card { background: linear-gradient(135deg, var(--teal-700), var(--teal-900)); color: #fff; border: 0; }
.hero-card .muted { color: rgba(255,255,255,.8); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick a { display: flex; flex-direction: column; gap: 6px; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 600; }
.quick a svg { width: 26px; height: 26px; color: var(--teal-700); }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0ece4; }
.list-item:last-child { border-bottom: 0; }
.list-item a { text-decoration: none; color: inherit; }
.back { display: inline-flex; white-space: nowrap; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; margin-bottom: 12px; }
.back svg { width: 18px; height: 18px; flex: none; }

.plan-card { position: relative; }
.plan-card--actual { border: 2px solid var(--teal-600); }
.plan-price { font-family: var(--font-display); font-size: 26px; font-weight: 800; }
.plan-list { list-style: none; padding: 0; margin: 12px 0; }
.plan-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed #eee6da; font-size: 14px; }
.compare { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.compare th, .compare td { padding: 8px 6px; border-bottom: 1px solid #eee6da; text-align: center; }
.compare th:first-child, .compare td:first-child { text-align: left; }

.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.steps span { flex: 1; height: 6px; border-radius: 3px; background: #e9e4da; }
.steps span.on { background: var(--teal-600); }
.option {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; background: #fff;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer;
}
.option + .option { margin-top: 10px; }
.option:hover:not(:disabled) { border-color: var(--teal-600); }
.option[aria-pressed="true"] { border-color: var(--teal-700); background: var(--teal-50); }
.option:disabled { cursor: not-allowed; opacity: .6; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { padding: 10px 6px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-weight: 600; }
.slot[aria-pressed="true"] { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.slot:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.day { flex: none; width: 62px; padding: 8px 4px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; text-align: center; cursor: pointer; }
.day small { display: block; color: var(--ink-3); font-size: 11.5px; text-transform: capitalize; }
.day b { font-size: 18px; font-family: var(--font-display); }
.day[aria-pressed="true"] { border-color: var(--teal-700); background: var(--teal-50); }
.summary dt { font-size: 12.5px; color: var(--ink-3); }
.summary dd { margin: 0 0 10px; font-weight: 600; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--teal-100); }
.timeline li { position: relative; padding: 0 0 18px 18px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--teal-600); border: 2px solid #fff; }
.timeline li.anulado { opacity: .6; }
.timeline li.anulado::before { background: var(--ink-3); }
.ev-img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; margin-top: 8px; }

/* ── Portal administrativo ──────────────────────────────────────────── */
.portal { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--teal-900); color: #d7f5ef; padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.side .logo { color: #fff; padding: 0 8px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #d7f5ef; text-decoration: none; font-weight: 500; font-size: 14.5px; }
.side nav a svg { width: 19px; height: 19px; flex: none; }
.side nav a:hover { background: rgba(255,255,255,.08); }
.side nav a[aria-current="page"] { background: #fff; color: var(--teal-900); font-weight: 700; }
.side__label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; opacity: .65; padding: 0 12px; margin-top: 6px; }
.side__user { margin-top: auto; background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px; font-size: 13px; }
.side__user strong { display: block; color: #fff; font-size: 14px; }
.p-main { padding: 28px 32px 48px; min-width: 0; }
.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.p-head p { color: var(--ink-3); margin-top: 4px; }
.kpi { padding: 16px 18px; }
.kpi b { display: block; font-family: var(--font-display); font-size: 28px; }
.kpi span { color: var(--ink-3); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); background: #fbf9f5; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 12px; border-bottom: 1px solid #f0ece4; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 180px; }
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar { display: grid; grid-template-columns: 170px 1fr 48px; gap: 10px; align-items: center; font-size: 13.5px; }
.bar__track { height: 14px; background: #f0ece4; border-radius: 7px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--teal-600); border-radius: 7px; }
.bar__fill--coral { background: var(--coral-500); }
.route { list-style: none; margin: 0; padding: 0; counter-reset: parada; }
.route li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.route li::before { counter-increment: parada; content: counter(parada); flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--coral-500); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.route li:first-child::before { content: "B"; background: var(--teal-700); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--teal-700); color: #fff; border-color: var(--teal-700); }
.insumos { display: flex; flex-direction: column; gap: 8px; }
.insumo-row { display: grid; grid-template-columns: 1fr 90px 36px; gap: 8px; }
.menu-btn { display: none; }

/* ── Adaptación a pantallas pequeñas ────────────────────────────────── */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login__brand { padding: 28px 22px; }
  .login__brand h1 { font-size: 30px; }
  .login__panel { padding: 28px 22px; }
  .portal { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 60; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .p-main { padding: 18px 16px 40px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-main, .grid-side, .grid-2 { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 110px 1fr 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
