/* =============================================================================
   Cobros Arriendo — Tema oscuro + acento magenta. Mobile-first.
   ============================================================================= */

:root {
    --bg:        #0d0d12;
    --card:      #16161f;
    --card-2:    #1e1e2a;
    --border:    #2a2a38;
    --text:      #e8e8ef;
    --muted:     #9a9aae;

    --magenta:   #E9204F;
    --magenta-2: #C31C42;

    --agua:      #38bdf8;  /* azul gota */
    --luz:       #facc15;  /* amarillo rayo */
    --casa:      #E9204F;  /* magenta arriendo */

    --ok:        #22c55e;
    --warn:      #f59e0b;
    --danger:    #ef4444;

    --radius:    14px;
    --radius-sm: 10px;
    --shadow:    0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--magenta); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .75rem; }
small { color: var(--muted); }

/* ── Layout ── */
.container { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 16px 96px; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 16px;
    background: rgba(13,13,18,.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.topbar .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 12px var(--magenta); }
.topbar .who { color: var(--muted); font-size: .85rem; }

/* ── Navegación inferior (mobile) ── */
.nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    display: flex; justify-content: space-around;
    background: var(--card); border-top: 1px solid var(--border);
    padding: 6px 4px env(safe-area-inset-bottom);
}
.nav a {
    flex: 1; text-align: center; color: var(--muted); text-decoration: none;
    font-size: .68rem; padding: 6px 2px; border-radius: 8px;
}
.nav a.active { color: var(--text); }
.nav a.active svg { color: var(--magenta); }
.nav a svg { display: block; margin: 0 auto 2px; width: 22px; height: 22px; }

/* ── Tarjetas ── */
.card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; margin: 14px 0;
    box-shadow: var(--shadow);
}
.card.tight { padding: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }

/* ── Iconos de servicio ── */
.ic { width: 22px; height: 22px; flex: none; }
.ic-agua { color: var(--agua); }
.ic-luz  { color: var(--luz); }
.ic-casa { color: var(--casa); }

/* ── Botones ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid var(--border); background: var(--card-2); color: var(--text);
    padding: 12px 16px; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: filter .15s, opacity .15s;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.btn-primary:hover { background: var(--magenta-2); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 8px 12px; font-size: .85rem; }

/* ── Formularios ── */
label { display: block; margin: 12px 0 6px; font-size: .9rem; color: var(--muted); }
input, select, textarea {
    width: 100%; padding: 12px 14px; font-size: 1rem;
    background: var(--card-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    appearance: none;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--magenta);
    box-shadow: 0 0 0 3px rgba(233,32,79,.18);
}
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }
.hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }

/* ── Tabla de desglose / listados ── */
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); }
.kv .v { font-variant-numeric: tabular-nums; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.total-row .amount { font-size: 1.5rem; font-weight: 800; color: var(--magenta); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: .92rem; }
th { color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Badges de estado ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-pendiente { background: rgba(245,158,11,.15); color: var(--warn); border: 1px solid rgba(245,158,11,.35); }
.badge-pagado    { background: rgba(34,197,94,.15);  color: var(--ok);   border: 1px solid rgba(34,197,94,.35); }

/* ── Alertas / flash ── */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin: 12px 0; border: 1px solid; font-size: .92rem; }
.alert-ok    { background: rgba(34,197,94,.12);  border-color: rgba(34,197,94,.4);  color: #b9f6ca; }
.alert-error { background: rgba(239,68,68,.12);  border-color: rgba(239,68,68,.4);  color: #ffcdd2; }
.alert-warn  { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.4); color: #ffe0a3; }

/* ── Pasos del wizard ── */
.steps { display: flex; gap: 8px; margin: 6px 0 16px; }
.step { flex: 1; height: 4px; border-radius: 999px; background: var(--border); }
.step.done { background: var(--magenta); }

/* ── Subida de foto ── */
.uploader { display: flex; flex-direction: column; gap: 10px; }
.uploader .preview { width: 100%; max-height: 240px; object-fit: contain; border-radius: var(--radius-sm); border: 1px solid var(--border); background: #000; display: none; }
.uploader .preview.show { display: block; }
.cam-btn { position: relative; overflow: hidden; }
.cam-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login / setup ── */
.auth-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 8px; }
.auth-logo .dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 16px var(--magenta); }

/* ── Utilidades ── */
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hidden { display: none !important; }
.stat { background: var(--card-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.stat .label { color: var(--muted); font-size: .78rem; }
.stat .value { font-size: 1.35rem; font-weight: 800; }

@media (min-width: 720px) {
    .nav { position: static; max-width: 760px; margin: 8px auto 0; border-radius: var(--radius); border: 1px solid var(--border); }
    .container { padding-bottom: 32px; }
}
