/* CondoSys — sistema de diseño mobile-first (sin dependencias externas) */

:root {
  --ink: #10231f;
  --ink-2: #3d4f4a;
  --muted: #6b7c77;
  --line: #dfe7e3;
  --moss: #1a5c4a;
  --moss-2: #134637;
  --moss-soft: #e3efe9;
  --mist: #d7e4df;
  --sand: #f3f6f4;
  --sun: #e8b84a;
  --sun-soft: #fbf0d6;
  --coral: #c45c4a;
  --coral-soft: #f8e3df;
  --sky-soft: #e4edf7;
  --white: #fff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 35, 31, 0.06), 0 6px 20px rgba(16, 35, 31, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--sand);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--moss); text-decoration: none; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 22px; height: 22px; flex: none;
  stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.ic--sm { width: 18px; height: 18px; }
.ic--lg { width: 28px; height: 28px; }

/* ---------- Tipografía y utilidades ---------- */
.h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 750; letter-spacing: -0.01em; }
.h2 { font-size: 1.15rem; font-weight: 700; }
.h3 { font-size: 1rem; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.tiny { font-size: 0.76rem; }
.eyebrow { font-size: 0.74rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; }
.strong { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.row > .input--date { flex: 0 0 auto; width: 9.75rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.block { display: block; }
.mx-auto { margin-left: auto; margin-right: auto; }
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; min-height: 28px; }
.summary::-webkit-details-marker { display: none; }
.summary::after { content: "+"; font-size: 1.3rem; color: var(--moss); }
details[open] > .summary::after { content: "–"; }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; margin-bottom: 4px; font-weight: 650; font-size: 0.92rem; }
.skeleton--inline { display: inline-block; width: 60%; height: 2.2rem; vertical-align: middle; }
.topbar select.input { width: auto; min-height: 40px; padding-top: 6px; padding-bottom: 6px; font-weight: 650; }

/* ---------- Estructura móvil ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { max-width: 560px; margin: 0 auto; display: flex; align-items: center; gap: 10px; min-height: 40px; }
.brand { font-size: 0.8rem; font-weight: 750; letter-spacing: 0.2em; text-transform: uppercase; color: var(--moss); }
.brand-sub { font-size: 0.78rem; color: var(--muted); }

.content {
  max-width: 560px; margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 28px);
}
.content--plain { padding-bottom: calc(var(--safe-bottom) + 28px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px 8px calc(var(--safe-bottom) + 6px);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border-radius: 14px;
  color: var(--muted); font-size: 0.72rem; font-weight: 600;
}
.tabbar a[aria-current="page"] { color: var(--moss); }
.tabbar a[aria-current="page"] .ic { stroke-width: 2.4; }
@media (min-width: 720px) {
  .tabbar { left: 50%; right: auto; width: 520px; transform: translateX(-50%); bottom: 14px; border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); padding-bottom: 6px; }
}

/* ---------- Tarjetas ---------- */
.card { background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card--flat { box-shadow: none; border: 1px solid var(--line); }
.card--hero {
  color: var(--white);
  background: radial-gradient(120% 140% at 100% 0%, #2f8f74 0%, transparent 55%), linear-gradient(160deg, var(--moss), var(--moss-2));
  box-shadow: 0 10px 30px rgba(26, 92, 74, 0.28);
}
.card--hero .muted, .card--hero .eyebrow { color: rgba(255, 255, 255, 0.75); }
.amount { font-size: 2.4rem; font-weight: 780; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.amount-sub { font-size: 1.05rem; font-weight: 600; opacity: 0.92; font-variant-numeric: tabular-nums; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 0.85rem; color: rgba(255, 255, 255, 0.85); }
.hero-note { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.12); font-size: 0.86rem; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 2px 10px; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border: 0; border-radius: 999px;
  font-weight: 650; font-size: 1rem; cursor: pointer; text-align: center;
  background: var(--mist); color: var(--ink);
  transition: transform 0.08s ease, background-color 0.15s ease, opacity 0.15s ease;
  touch-action: manipulation; user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn--primary { background: var(--ink); color: var(--white); }
.btn--primary:hover { background: var(--moss); }
.btn--moss { background: var(--moss); color: var(--white); }
.btn--sun { background: var(--sun); color: var(--ink); }
.btn--danger { background: var(--coral); color: var(--white); }
.btn--ghost { background: transparent; color: var(--moss); }
.btn--outline { background: var(--white); border: 1px solid var(--line); }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }
.btn--block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(128, 128, 128, 0.35); border-top-color: currentColor;
  color: var(--white); animation: spin 0.7s linear infinite;
}
.btn--outline.is-busy::after, .btn--ghost.is-busy::after { color: var(--moss); }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 14px; background: transparent; cursor: pointer; color: var(--ink);
}
.icon-btn:active { background: var(--sand); }

/* ---------- Formularios ---------- */
.field { display: block; }
.field > .label, .label { display: block; margin-bottom: 6px; font-size: 0.84rem; font-weight: 650; color: var(--ink-2); }
.hint { margin-top: 6px; font-size: 0.8rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--white); border: 1px solid var(--line); border-radius: 14px;
  outline: none; -webkit-appearance: none; appearance: none;
}
select.input {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
textarea.input { min-height: 92px; resize: vertical; }
.input:focus { border-color: var(--moss); box-shadow: 0 0 0 3px rgba(26, 92, 74, 0.15); }
.input--amount { font-size: 1.9rem; font-weight: 750; min-height: 64px; font-variant-numeric: tabular-nums; }
input[type="date"].input, input[type="time"].input { min-height: 50px; display: block; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--mist); border-radius: 14px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 8px; border-radius: 11px;
  font-size: 0.9rem; font-weight: 650; color: var(--ink-2); cursor: pointer; text-align: center;
}
.segmented input:checked + label { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 35, 31, 0.12); }
.segmented input:focus-visible + label { outline: 2px solid var(--moss); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--white);
  font-size: 0.88rem; font-weight: 600; cursor: pointer; color: var(--ink-2);
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--white); }
.chip .count { font-variant-numeric: tabular-nums; opacity: 0.8; }

.switch-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch-row:last-child { border-bottom: 0; }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #c9d4d0; transition: background 0.2s ease; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--white); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s ease;
}
.switch input:checked + span { background: var(--moss); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--moss); outline-offset: 2px; }
.switch input:disabled + span { opacity: 0.5; }
.switch-row--plain { border-bottom: 0; padding: 4px 0; }

.input-group { position: relative; display: block; }
.input-group .input { padding-right: 52px; }
.input-group__btn {
  position: absolute; top: 0; right: 0; width: 50px; height: 50px;
  display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.form-error { padding: 10px 12px; border-radius: 12px; background: var(--coral-soft); color: #8f3727; font-size: 0.9rem; font-weight: 600; }
.temp-pass {
  padding: 16px; border-radius: 16px; background: var(--moss-soft); color: var(--moss);
  font: 750 1.8rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.08em; text-align: center; user-select: all;
}

.dropzone {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  border: 1.5px dashed #b9c9c3; border-radius: var(--radius); background: var(--white); cursor: pointer;
}
.dropzone__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--moss-soft); color: var(--moss); flex: none; }
.dropzone__preview { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; flex: none; }
.dropzone.has-file { border-style: solid; border-color: var(--moss); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.sticky-submit {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 8px); z-index: 5;
  padding-top: 8px; background: linear-gradient(transparent, var(--sand) 35%);
}
@media (min-width: 720px) { .sticky-submit { bottom: calc(var(--tabbar-h) + 30px); } }

/* ---------- Listas ---------- */
.list { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 60px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
a.list-item, button.list-item { width: 100%; border-left: 0; border-right: 0; border-top: 0; background: transparent; color: inherit; text-align: left; cursor: pointer; font: inherit; }
a.list-item:active, button.list-item:active { background: var(--sand); }
.list-item__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--moss-soft); color: var(--moss); flex: none; }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font-weight: 650; }
.list-item__meta { font-size: 0.84rem; color: var(--muted); }
.list-item__end { text-align: right; flex: none; }

/* En el teléfono, los botones de la fila bajan debajo del texto en vez de comprimirlo */
@media (max-width: 720px) {
  .list-item:has(.list-item__end .btn),
  .list-item:has(.list-item__end .icon-btn) {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .list-item:has(.list-item__end .btn) .list-item__end,
  .list-item:has(.list-item__end .icon-btn) .list-item__end {
    flex: 1 0 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 2px;
    padding-left: 52px;
    text-align: right;
  }
  .list-item__end .btn.block { display: inline-flex; width: auto; }
}

.house-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  grid-template-areas:
    "icon title badge"
    "icon meta actions";
  gap: 2px 12px;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.house-row:last-child { border-bottom: 0; }
.house-row__icon {
  grid-area: icon; align-self: start;
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--moss-soft); color: var(--moss);
}
.house-row__title { grid-area: title; font-weight: 650; min-width: 0; }
.house-row__badge { grid-area: badge; justify-self: end; }
.house-row__meta { grid-area: meta; font-size: 0.84rem; color: var(--muted); min-width: 0; }
.house-row__actions { grid-area: actions; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 4px; }
@media (max-width: 720px) {
  .house-row {
    grid-template-areas:
      "icon title badge"
      "meta meta meta"
      "actions actions actions";
    row-gap: 8px;
  }
  .house-row__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .house-row__actions .btn { min-width: 0; padding-inline: 8px; }
}

.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 4px; border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow);
  color: var(--ink); font-size: 0.78rem; font-weight: 650; text-align: center; line-height: 1.2;
}
.quick__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--moss-soft); color: var(--moss); }
.quick:active { transform: scale(0.98); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700; white-space: nowrap; background: var(--mist); color: var(--ink-2);
}
.badge--pending { background: var(--sun-soft); color: #7a5a10; }
.badge--ok { background: var(--moss-soft); color: var(--moss); }
.badge--bad { background: var(--coral-soft); color: #8f3727; }
.badge--info { background: var(--sky-soft); color: #2b4e78; }
.badge--muted { background: #eef1f0; color: var(--muted); }

.copy-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.copy-row:last-child { border-bottom: 0; }
.copy-row__value { font-weight: 650; font-variant-numeric: tabular-nums; }

.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--sky-soft); color: #23446b; font-size: 0.9rem; }
.notice--warn { background: var(--sun-soft); color: #6d500e; }
.notice--bad { background: var(--coral-soft); color: #7f2f21; }
.notice--ok { background: var(--moss-soft); color: var(--moss-2); }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 0.92rem; }
.empty .ic { width: 34px; height: 34px; margin: 0 auto 8px; display: block; opacity: 0.6; }

.skeleton { border-radius: 12px; background: linear-gradient(90deg, #e9efec 25%, #f4f7f6 50%, #e9efec 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; min-height: 18px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Tarjetas de operación (pagos, avisos, solicitudes) ---------- */
.op-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.op-card + .op-card { margin-top: 12px; }
.op-card__head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.op-card__head .row--between { align-items: flex-start; min-width: 0; }
.op-card__title { font-weight: 700; font-size: 1.02rem; }
.op-card .row--between > .op-card__title { flex: 1; min-width: 0; }
.op-card .row--between > .badge { flex: none; margin-top: 2px; }
.op-card__meta { font-size: 0.84rem; color: var(--muted); }
.op-card__actions { display: flex; gap: 8px; margin-top: 12px; }
.op-card__actions .btn { flex: 1; min-width: 0; }
.op-card__note { margin-top: 10px; padding: 9px 11px; border-radius: 10px; background: var(--sand); font-size: 0.86rem; }
.op-card__note--private { background: #f3f0fa; color: #4a3a75; }
.thumb {
  width: 76px; height: 76px; border-radius: 12px; object-fit: cover; flex: none;
  background: var(--mist); border: 0; padding: 0; cursor: zoom-in; overflow: hidden;
  display: grid; place-items: center; color: var(--moss);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.kind-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; flex: none; background: var(--moss-soft); color: var(--moss); }
.kind-icon--DELIVERY { background: var(--sun-soft); color: #7a5a10; }
.kind-icon--MOVE { background: var(--sky-soft); color: #2b4e78; }
.big-amount { font-size: 1.3rem; font-weight: 750; font-variant-numeric: tabular-nums; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
.stat { display: block; background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); color: var(--ink); }
.stat__label { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.stat__value { margin-top: 6px; font-size: 1.5rem; font-weight: 760; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 0.8rem; color: var(--muted); }
.stat--alert .stat__value { color: #9a6a00; }

.table-wrap { overflow-x: auto; border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table th { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: #fafcfb; }

/* ---------- Diálogos tipo hoja (bottom sheet) ---------- */
dialog.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 24px 24px 0 0; background: var(--white); color: var(--ink);
  box-shadow: 0 -10px 40px rgba(16, 35, 31, 0.2);
}
dialog.sheet[open] { animation: sheet-up 0.22s cubic-bezier(0.22, 1, 0.36, 1); }
dialog.sheet::backdrop { background: rgba(16, 35, 31, 0.45); }
.sheet__body { padding: 10px 18px calc(var(--safe-bottom) + 18px); overflow-y: auto; max-height: 92dvh; }
.sheet__grab { width: 40px; height: 5px; border-radius: 3px; background: #d3ddd9; margin: 0 auto 12px; }
.sheet__actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet__actions .btn { flex: 1; }
@keyframes sheet-up { from { transform: translateY(30px); opacity: 0.4; } }
@media (min-width: 720px) {
  dialog.sheet { margin: auto; border-radius: 24px; }
  .sheet__body { padding-bottom: 20px; }
}

dialog.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0b1412; color: #fff; }
dialog.viewer::backdrop { background: #0b1412; }
.viewer__bar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: calc(var(--safe-top) + 8px) 12px 8px; background: linear-gradient(rgba(0, 0, 0, 0.6), transparent); z-index: 1; }
.viewer__bar .icon-btn, .viewer__bar a { color: #fff; }
.viewer__stage { width: 100%; height: 100%; display: grid; place-items: center; overflow: auto; padding: 56px 8px 16px; }
.viewer__stage img { max-height: calc(100dvh - 80px); object-fit: contain; }
.viewer__stage iframe { width: 100%; height: calc(100dvh - 80px); border: 0; background: #fff; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 100;
  max-width: min(92vw, 440px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: var(--white); font-size: 0.92rem; font-weight: 550; box-shadow: var(--shadow);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { background: #7f2f21; }
.toast[data-kind="ok"] { background: var(--moss); }
body.no-tabbar .toast { bottom: calc(var(--safe-bottom) + 20px); }

/* ---------- Pantalla de acceso ---------- */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px); background: radial-gradient(120% 80% at 10% 0%, #2f8f74 0%, transparent 55%), linear-gradient(170deg, var(--moss), var(--ink)); }
.gate__card { width: 100%; max-width: 400px; background: var(--white); border-radius: 26px; padding: 28px 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25); }
.gate__card .brand { display: block; margin-bottom: 14px; }

.house-tag {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px;
  background: var(--moss-soft); color: var(--moss); font-size: 0.82rem; font-weight: 700;
}
.house-tag:empty { display: none; }

.credit {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 6px;
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 0.78rem; color: var(--muted); text-align: center;
}
.credit .ic { color: var(--moss); }
.credit a { color: var(--moss); font-weight: 700; text-decoration: none; }
.credit a:hover, .credit a:focus-visible { text-decoration: underline; }
.credit__site { flex-basis: 100%; font-size: 0.72rem; letter-spacing: 0.04em; opacity: 0.8; }
.credit--dark { margin-top: 14px; padding-top: 12px; border-top-color: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.6); }
.credit--dark .ic, .credit--dark a { color: var(--mist); }
.sidenav .credit a { display: inline; padding: 0; min-height: 0; border-radius: 0; background: none; font-size: inherit; }

.hero {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end;
  padding: calc(var(--safe-top) + 40px) 22px calc(var(--safe-bottom) + 36px); color: var(--white);
  background: radial-gradient(90% 60% at 15% 10%, #2f8f74 0%, transparent 60%), radial-gradient(70% 50% at 90% 85%, #0d2e28 0%, transparent 70%), linear-gradient(180deg, var(--moss), var(--ink));
}
.hero__inner { width: 100%; max-width: 460px; margin: 0 auto; }
.hero h1 { font-size: 2.6rem; line-height: 1.08; font-weight: 800; letter-spacing: -0.02em; margin-top: 14px; }
.hero p { color: rgba(255, 255, 255, 0.82); margin-top: 12px; }
.hero .brand { color: var(--mist); }
.role-link { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: rgba(255, 255, 255, 0.1); color: var(--white); border: 1px solid rgba(255, 255, 255, 0.2); }
.role-link + .role-link { margin-top: 10px; }
.role-link .ic { width: 26px; height: 26px; }
@media (min-width: 720px) { .hero { justify-content: center; } }

/* ---------- Administración ---------- */
.admin { min-height: 100dvh; }
.sidenav {
  position: fixed; inset: 0 auto 0 0; z-index: 50; width: 268px;
  display: flex; flex-direction: column; padding: calc(var(--safe-top) + 18px) 12px calc(var(--safe-bottom) + 14px);
  background: var(--ink); color: rgba(255, 255, 255, 0.86);
  transform: translateX(-100%); transition: transform 0.22s ease; overflow-y: auto;
}
.sidenav.open { transform: none; box-shadow: 20px 0 50px rgba(0, 0, 0, 0.3); }
.sidenav .brand { color: var(--mist); padding: 0 10px 18px; display: block; }
.sidenav nav { display: flex; flex-direction: column; gap: 2px; }
.sidenav a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border-radius: 12px;
  color: rgba(255, 255, 255, 0.78); font-weight: 600; font-size: 0.95rem;
}
.sidenav a:hover { background: rgba(255, 255, 255, 0.06); }
.sidenav a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); color: var(--white); }
.sidenav .nav-badge { margin-left: auto; min-width: 24px; padding: 2px 8px; border-radius: 999px; background: var(--sun); color: var(--ink); font-size: 0.75rem; font-weight: 800; text-align: center; }
.sidenav__foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.85rem; }
.sidenav__foot button { margin-top: 10px; color: var(--white); background: rgba(255, 255, 255, 0.1); }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(16, 35, 31, 0.45); }
.admin-main { min-height: 100dvh; }
.admin-content { max-width: 1040px; margin: 0 auto; padding: 18px 16px calc(var(--safe-bottom) + 40px); }
.admin-content .topbar__inner, .admin .topbar__inner { max-width: 1040px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0; }
.toolbar .input { min-height: 44px; width: auto; flex: 1 1 160px; }
.toolbar .input[type="date"] { flex: 0 1 10rem; }
.narrow { max-width: 480px; }
.audit-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cards-grid { display: grid; gap: 12px; }
.cards-grid .op-card + .op-card { margin-top: 0; }
@media (min-width: 900px) { .cards-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) {
  .sidenav { transform: none; }
  .admin-main { margin-left: 268px; }
  .menu-btn { display: none; }
  .scrim { display: none; }
  .admin .toast { bottom: 24px; }
}
body.admin-page .toast { bottom: calc(var(--safe-bottom) + 20px); }

.assistant-launcher {
  position: fixed; right: 16px; z-index: 30;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  width: 56px; height: 56px; border: 0; border-radius: 50%;
  background: var(--moss); color: #fff; box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.assistant-launcher .ic { stroke: currentColor; }
body.admin-page .assistant-launcher { bottom: calc(var(--safe-bottom) + 16px); }
.assistant-log {
  display: flex; flex-direction: column; gap: 8px;
  min-height: 220px; max-height: 48dvh; overflow-y: auto; margin-top: 12px;
}
.assistant-msg { max-width: 88%; padding: 10px 12px; border-radius: 16px; white-space: pre-wrap; }
.assistant-msg--user { margin-left: auto; background: var(--moss); color: #fff; border-bottom-right-radius: 4px; }
.assistant-msg--model { background: var(--sand); border-bottom-left-radius: 4px; }
.assistant-form { display: flex; gap: 8px; align-items: flex-end; margin-top: 12px; }
.assistant-form .input { min-height: 44px; resize: none; }

body.landing-page {
  background:
    radial-gradient(90% 50% at 0% 0%, #3aa884 0%, transparent 55%),
    radial-gradient(70% 40% at 100% 12%, #e8b84a 0%, transparent 46%),
    linear-gradient(165deg, #1a5c4a 0%, #10231f 72%);
  color: var(--white);
}
.landing { max-width: 32rem; margin: 0 auto; padding: calc(var(--safe-top) + 28px) 20px calc(var(--safe-bottom) + 32px); }
.landing__hero .brand { color: #d7e4df; }
.landing__badge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 18px;
  padding: 6px 12px; border-radius: 999px;
  background: #c45c4a; color: var(--white); font-size: 0.82rem; font-weight: 750;
}
.landing__hero h1 { margin-top: 14px; color: var(--white); font-size: 2rem; }
.landing__lead { margin-top: 10px; color: rgba(255, 255, 255, 0.86); }
.landing__card { margin-top: 22px; color: var(--ink); }
.landing__card .btn--ghost { color: var(--moss-2); }
.landing ol { margin: 0; padding-left: 1.35rem; display: grid; gap: 14px; color: var(--ink); font-size: 1.05rem; }
.landing ol li::marker { color: var(--moss); font-weight: 750; }
body.landing-page { font-size: 1.125rem; }
.landing .h1, .landing__hero h1 { font-size: 2.15rem; }
.landing .label, .landing .btn, .landing .hint { font-size: 1.05rem; }
.landing .btn { min-height: 3.4rem; }
.landing .input { min-height: 3.25rem; font-size: 1.125rem; }
.choice + .choice { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.panic {
  min-height: 7.5rem;
  font-size: 1.35rem;
  border-radius: 28px;
}
.shortcut-url {
  word-break: break-all;
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.86rem;
}
.card--alert { border: 1px solid var(--coral); background: var(--coral-soft); }
.card--alert .eyebrow { color: #7f2f21; }
.alert-banner { background: var(--coral-soft); border: 1px solid var(--coral); border-radius: var(--radius); padding: 14px; }
.alert-banner a { font-weight: 650; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
