@font-face { font-family: 'Open Sans'; font-weight: 300 800; font-display: swap; src: url(/fonts/open-sans.woff2) format('woff2'); }
@font-face { font-family: 'Roboto Condensed'; font-weight: 100 900; font-display: swap; src: url(/fonts/roboto-condensed.woff2) format('woff2'); }

/* Paleta tomada de sumijal.com (variables globales de Elementor). */
:root {
  --primary: #17acca;
  --primary-dark: #0e6779;
  --secondary: #38338a;
  --ink: #25225c;
  --accent: #ee7126;
  --accent-dark: #ab480d;
  --ok: #0d9a6c;
  --bad: #c0392b;
  --wa: #25d366;
  --bg: #f4f4f4;
  --surface: #ffffff;
  --text: #1b1a33;
  --muted: #5c6470;
  /* Tonos más oscuros de la marca para fondos con texto blanco (contraste ≥ 4.5:1, se lee al sol). */
  --accent-strong: #b8500f;
  --wa-strong: #0b7a43;
  --line: #e2e4ea;
  --tint: #e5f5f7;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(37, 34, 92, .06), 0 4px 14px rgba(37, 34, 92, .06);
  --gradient: linear-gradient(135deg, var(--secondary) 0%, #2d5ca8 55%, #0d7f99 100%);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 'Open Sans', system-ui, sans-serif;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}
h1, h2, .btn, .chip, .tabbar, .sync-pill, .badge { font-family: 'Roboto Condensed', 'Open Sans', sans-serif; }
a { color: var(--primary-dark); }
[hidden] { display: none !important; }
.ico { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* ---------- Login ---------- */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: var(--gradient);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px;
  padding: 28px 22px 22px; box-shadow: 0 20px 50px rgba(20, 16, 70, .35); text-align: center;
}
.login-logo { width: 200px; height: auto; margin: 0 auto 8px; display: block; }
.login-card h1 { margin: 6px 0 4px; color: var(--ink); font-size: 26px; letter-spacing: .2px; }
.login-card > p { margin: 0 0 18px; }
.login-card form { text-align: left; }
.support { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.support p { margin: 0 0 10px; color: var(--muted); font-size: 14px; }

/* ---------- Estructura ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px 16px; min-height: 56px;
  background: var(--gradient); color: #fff; box-shadow: 0 2px 10px rgba(37, 34, 92, .25);
}
.topbar h1 { flex: 1; margin: 0; font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: inherit; padding: 6px; margin-left: -8px; border-radius: 50%; display: grid; place-items: center; }
.icon-btn .ico { width: 24px; height: 24px; }
.icon-btn:active { background: rgba(255, 255, 255, .15); }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, .16); white-space: nowrap;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #7cf0c4; }
.sync-pill.off .dot { background: #c9c9d6; }
.sync-pill.off { background: rgba(0, 0, 0, .22); }
.sync-pill.warn .dot { background: #ffb37a; }
.sync-pill.busy .dot { background: #fff; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .25; } }

.view { padding: 14px 14px calc(96px + var(--safe-b)); max-width: 720px; margin: 0 auto; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex;
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 9px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600;
}
.tabbar a .ico { width: 24px; height: 24px; }
.tabbar a.on { color: var(--secondary); }
.tabbar a.on .ico { color: var(--primary); }

/* ---------- Tarjetas y listas ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--secondary); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-head h2 { margin: 0; }

.hero { display: flex; align-items: center; gap: 14px; }
.hero h1 { margin: 0; font-size: 23px; color: var(--ink); line-height: 1.15; }
.hero p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { font-family: 'Roboto Condensed', sans-serif; font-weight: 700; color: var(--accent-dark) !important; margin: 0 0 2px !important; letter-spacing: .5px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { margin-bottom: 8px; }
.list.flush > li { margin: 0; border-top: 1px solid var(--line); }
.list.flush > li:first-child { border-top: 0; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: inherit;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
}
.list.flush .row, li.row { box-shadow: none; padding: 12px 0; border-radius: 0; background: transparent; }
.row:active { background: var(--tint); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.row-side { display: flex; align-items: center; gap: 6px; flex: none; }
.row.inactive { opacity: .55; }
.client-link { box-shadow: var(--shadow); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--tint); color: var(--secondary); font: 700 18px 'Roboto Condensed', sans-serif;
}
.avatar.lg { width: 56px; height: 56px; font-size: 24px; background: var(--gradient); color: #fff; }

.badge { font-size: 13px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--tint); color: var(--primary-dark); white-space: nowrap; }
.tone-accent { background: #fce7d9; color: var(--accent-dark); }
.tone-primary { background: #d4f4fa; color: var(--primary-dark); }
.tone-ok { background: #d5f3e8; color: #085c41; }
.tone-bad { background: #f8dcd8; color: #8e2a1f; }
.tone-muted { background: #eceef2; color: var(--muted); }
.pending { color: var(--accent); display: inline-flex; }
.pending .ico { width: 18px; height: 18px; }

.dl { margin: 0; display: grid; gap: 10px; }
.dl > div { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 10px; }
.dl dt { color: var(--muted); font-size: 14px; }
.dl dd { margin: 0; font-weight: 600; word-break: break-word; }
.notes { margin: 0; white-space: pre-wrap; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 4px 12px; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty .btn { margin-top: 8px; }

/* ---------- Búsqueda y filtros ---------- */
.searchbar {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 12px;
  padding: 0 12px; box-shadow: var(--shadow); margin-bottom: 12px; color: var(--muted);
}
.searchbar input { flex: 1; border: 0; outline: 0; padding: 13px 0; font: inherit; background: transparent; color: var(--text); min-width: 0; }
.chips.filter { flex-wrap: nowrap; overflow-x: auto; margin: 0 -14px 12px; padding: 2px 14px 4px; scrollbar-width: none; }
.chips.filter::-webkit-scrollbar { display: none; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px;
  border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; letter-spacing: .2px;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; }
.btn.block { width: 100%; margin-top: 8px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.wa { background: var(--wa-strong); border-color: var(--wa-strong); color: #fff; }
.btn.wa .ico { width: 22px; height: 22px; }
.danger-link { border: 0; background: none; color: var(--bad); width: 100%; margin-top: 4px; }
.actions-row { display: flex; gap: 8px; margin-bottom: 12px; }
.actions-row .btn { flex: 1; padding: 0 8px; }

.fab {
  position: fixed; right: 16px; bottom: calc(76px + var(--safe-b)); z-index: 9; display: inline-flex; align-items: center; gap: 6px;
  height: 54px; padding: 0 20px 0 16px; border-radius: 28px; background: var(--accent-strong); color: #fff; text-decoration: none;
  font: 700 17px 'Roboto Condensed', sans-serif; box-shadow: 0 6px 18px rgba(238, 113, 38, .45);
}
.fab .ico { width: 24px; height: 24px; }
@media (min-width: 760px) { .fab { right: calc(50% - 344px); } }

/* ---------- Formularios ---------- */
.form-section h2 { margin-bottom: 4px; }
.field { display: block; border: 0; margin: 12px 0 0; padding: 0; min-width: 0; }
.field > span, .field > legend { display: block; font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 6px; padding: 0; }
.req { color: var(--accent-dark); }
.field input:not([type=hidden]), .field select, .field textarea {
  width: 100%; font: inherit; color: var(--text); padding: 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fbfbfd; outline: 0; appearance: none;
}
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(23, 172, 202, .18); }
.field.invalid input, .field.invalid select, .field.invalid .chips { border-color: var(--bad); }
.field.invalid > span, .field.invalid > legend { color: var(--bad); }
.field.invalid .chips { border: 1.5px solid var(--bad); border-radius: 12px; padding: 6px; }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.form-error { color: var(--bad); font-size: 14px; min-height: 1em; margin: 10px 0 0; }
.form-actions { position: sticky; bottom: calc(68px + var(--safe-b)); padding: 8px 0 0; background: linear-gradient(transparent, var(--bg) 30%); }
.other-input { margin-top: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.small { margin-top: 8px; gap: 6px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 99px;
  padding: 8px 14px; font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 40px;
}
.chips.small .chip { padding: 4px 10px; font-size: 14px; min-height: 32px; }
.chip.on { background: var(--secondary); border-color: var(--secondary); color: #fff; }

/* ---------- Avisos ---------- */
/* Sobre la barra de título (que solo repite el nombre de la pantalla), sin tapar contenido. */
.toasts { position: fixed; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 6px); display: grid; justify-items: center; gap: 8px; z-index: 50; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 15px; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); transition: opacity .35s, transform .35s; max-width: 440px; }
.toast.ok { background: #085c41; }
.toast.bad { background: var(--bad); }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* ---------- Instalación y extras ---------- */
.install-card { text-align: left; }
.install-card h1, .install-card > p, .install-card .login-logo { text-align: center; }
.steps { margin: 6px 0 10px; padding-left: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 9px 0 9px 42px; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 7px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--gradient); color: #fff; display: grid; place-items: center; font: 700 15px 'Roboto Condensed', sans-serif;
}
.or { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 0; }
.install-done { display: flex; gap: 12px; align-items: flex-start; background: #d5f3e8; color: #085c41; border-radius: 12px; padding: 14px; margin: 10px 0; }
.install-done .ico { width: 28px; height: 28px; }
.install-done p { margin: 0; }
.btn.link { border: 0; background: none; color: var(--muted); font-weight: 600; width: 100%; margin-top: 6px; min-height: 40px; }
.check { display: flex; gap: 10px; align-items: center; margin-top: 14px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--secondary); }
.row-side.wrap { flex-wrap: wrap; justify-content: flex-end; max-width: 55%; }
.callout { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--accent-dark); background: #fce7d9; }
.callout .ico { width: 26px; height: 26px; }
.callout span { display: flex; flex-direction: column; }
.callout small { color: var(--text); }
.gate-warn { background: #fce7d9; color: var(--accent-dark); border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-weight: 600; font-size: 15px; }
.install-card > p:not(.muted):not(.hint) { margin: 8px 0; }

/* ---------- Nombre, requisitos ---------- */
.people { margin-top: 6px; }
.people .chips { margin: 6px 0 4px; }
.gate-alt { margin-top: 14px; padding-top: 4px; border-top: 1px dashed var(--line); }
.gate-alt .or { margin-top: 10px; }

/* ---------- Partidas ---------- */
.item-row { border: 1.5px solid var(--line); border-radius: 12px; padding: 2px 12px 10px; margin-top: 12px; background: #fbfbfd; }
.item-nums { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: end; }
.item-nums .field { margin-top: 10px; }
.item-del { color: var(--muted); margin: 0 0 6px; padding: 10px; }
.item-amount { margin: 6px 0 0; text-align: right; font-weight: 600; color: var(--secondary); min-height: 1.2em; font-size: 15px; }
.items-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.items-actions .btn { flex: 1 1 auto; }
.totals { margin: 14px 0 0; display: grid; gap: 6px; }
.totals > div { display: flex; justify-content: space-between; color: var(--muted); }
.totals dd { margin: 0; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.totals .grand { border-top: 1.5px solid var(--line); padding-top: 8px; color: var(--ink); font: 700 19px 'Roboto Condensed', sans-serif; }
.totals .grand dd { color: var(--ink); }
.items-view { list-style: none; margin: 0; padding: 0; counter-reset: it; }
.items-view li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.items-view li strong { grid-column: 1 / -1; font-weight: 600; word-break: break-word; }
.items-view li span { color: var(--muted); font-size: 14px; }
.items-view li b { font-variant-numeric: tabular-nums; }
.amount { font: 700 15px 'Roboto Condensed', sans-serif; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount.lg { font-size: 22px; margin-left: 6px; }
.row-side.col { flex-direction: column; align-items: flex-end; gap: 4px; }
.row-side.col > span { display: flex; align-items: center; gap: 6px; }
.list > li.more { margin-top: 4px; }
.item-row textarea { resize: none; min-height: 0; }

/* ---------- Fichas: una sola tarjeta de datos y botón Editar arriba a la derecha ---------- */
.hero .hero-main { flex: 1; min-width: 0; }
.hero .hero-main h1 { word-break: break-word; }
.edit-btn { flex: none; align-self: flex-start; min-height: 44px; padding: 0 16px; }
.details .group + .group { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.details h3 { margin: 0 0 8px; font: 700 13px 'Roboto Condensed', sans-serif; text-transform: uppercase; letter-spacing: .6px; color: var(--secondary); }
.new-client { margin-top: 4px; padding: 2px 12px 12px; border: 1.5px dashed var(--line); border-radius: 12px; }
@media (max-width: 360px) { .edit-btn { padding: 0 12px; } }
