/* ORTHOMX · Control de rentas · estilos
   Identidad: negro, blanco y cian del logo. Tipografía Outfit. Oscuro por defecto, claro opcional.
   Móvil primero: barra de pestañas inferior, botones grandes, tarjetas. Escritorio: barra lateral. */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  color-scheme: dark;
  --brand: #0b0c0d;            /* negro del logo */
  --brand-2: #15181a;
  --cian: #7fdbff;             /* cian del logo */
  --cian-2: #27b4e6;           /* cian más denso para acentos sobre claro */
  --cian-ink: #063a4d;         /* texto sobre cian */
  --page: #0e1012;
  --surface: #171a1d;
  --surface-2: #1f2327;
  --surface-3: #262b30;
  --ink: #ffffff;
  --ink-2: #c7ccd1;
  --muted: #8b949c;
  --border: rgba(255,255,255,.10);
  --border-2: rgba(255,255,255,.18);
  --ok: #3fcf7f;      --ok-chip: #14301f;   --ok-ink: #7fe3a9;
  --warn: #f2c14e;    --warn-chip: #3a2f14; --warn-ink: #f6d27a;
  --crit: #ff8a80;    --crit-chip: #3a1f1d; --crit-ink: #ffb3ac;
  --info-chip: #0f2a36; --info-ink: #8fe0ff;
  --neutral-chip: #262a2e;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.35);
  --r: 14px;
  --r-s: 10px;
  --nav-h: 64px;
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f0f3f5;
  --surface-3: #e6ebef;
  --ink: #0b0c0d;
  --ink-2: #3f474d;
  --muted: #6e787f;
  --border: rgba(11,12,13,.10);
  --border-2: rgba(11,12,13,.18);
  --ok: #178a4c;      --ok-chip: #e2f5ea;   --ok-ink: #0f6b3a;
  --warn: #a86a00;    --warn-chip: #fff2d6; --warn-ink: #7a4d00;
  --crit: #c62828;    --crit-chip: #fde8e6; --crit-ink: #9f1d1d;
  --info-chip: #e3f6fd; --info-ink: #0b5e7d;
  --neutral-chip: #e9edf0;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-family: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; min-height: 100vh; }
a { color: var(--cian); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 300; }
h2 { font-size: 17px; font-weight: 500; }
h3 { font-size: 14px; font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.cargando { padding: 3rem; text-align: center; color: var(--muted); }
.ayuda { font-size: 12.5px; color: var(--muted); margin-top: .25rem; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--brand); color: #fff; }
.login-caja { width: 100%; max-width: 400px; }
.login-caja img { height: 92px; max-width: 70vw; display: block; margin: 0 auto 28px; background: #fff; border-radius: 14px; padding: 8px 14px; }
.login-caja h1, .login-caja .sub { text-align: center; }
.login-caja h1 { color: #fff; font-weight: 400; font-size: 24px; margin-bottom: 6px; }
.login-caja .sub { color: rgba(255,255,255,.65); margin-bottom: 26px; font-size: 14px; }
.login-caja label { color: var(--cian); letter-spacing: .18em; font-size: 10.5px; text-transform: uppercase; font-weight: 500; }
.login-caja input { background: rgba(127,219,255,.08); border: 1px solid rgba(127,219,255,.45); color: #fff; height: 52px; border-radius: 12px; padding: 0 14px; width: 100%; margin: 6px 0 18px; }
.login-caja input:focus { outline: 2px solid var(--cian); border-color: var(--cian); }
.login-caja .btn { width: 100%; background: var(--cian); color: var(--cian-ink); border: none; height: 52px; font-weight: 600; font-size: 16px; }
.login-caja .btn:hover { background: #9be4ff; }
.login-caja .pie { color: rgba(255,255,255,.5); font-size: 12px; margin-top: 18px; text-align: center; }
.login-caja .pie a { color: var(--cian); }
.login-caja .error { background: rgba(255,138,128,.14); color: #ffb3ac; border: 1px solid rgba(255,138,128,.35); }

/* ---------- Barra superior ---------- */
.topbar { background: var(--brand); color: #fff; display: flex; align-items: center; gap: 14px; padding: 12px 18px; position: sticky; top: 0; z-index: 30; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
.topbar .marca { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .marca img { height: 32px; background: #fff; border-radius: 8px; padding: 3px 6px; display: block; }
.topbar .marca .rol { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: rgba(127,219,255,.75); border-left: 1px solid rgba(127,219,255,.3); padding-left: 12px; white-space: nowrap; }
.topbar .espacio { flex: 1; }
.topbar .quien { text-align: right; line-height: 1.15; }
.topbar .quien .lbl { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: rgba(127,219,255,.75); }
.topbar .quien .nom { font-size: 14px; font-weight: 500; color: #fff; }
.icono-btn { background: transparent; border: 1px solid rgba(127,219,255,.35); color: var(--cian); border-radius: 9px; height: 36px; width: 36px; cursor: pointer; display: grid; place-items: center; flex: none; font-size: 15px; }
.icono-btn:hover { background: rgba(127,219,255,.1); }

/* ---------- Estructura: barra lateral (escritorio) + pestañas inferiores (móvil) ---------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.lateral { border-right: 1px solid var(--border); background: var(--surface); padding: 18px 12px; position: sticky; top: 60px; height: calc(100vh - 60px); overflow: auto; align-self: start; }
.lateral h6 { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 16px 10px 6px; font-weight: 500; }
.lateral h6:first-child { margin-top: 0; }
.lateral a { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 9px; color: var(--ink-2); font-size: 14px; }
.lateral a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.lateral a.activa { background: var(--ink); color: var(--page); }
:root[data-theme="light"] .lateral a.activa { background: var(--brand); color: #fff; }
.lateral .punto { width: 6px; height: 6px; border-radius: 50%; background: var(--border-2); flex: none; }
.lateral a.activa .punto { background: var(--cian); }
.lateral .cuenta { margin-left: auto; font-size: 11px; background: var(--info-chip); color: var(--info-ink); border-radius: 10px; padding: 1px 8px; font-weight: 500; }
.lateral .cuenta.urgente { background: var(--crit-chip); color: var(--crit-ink); }
.lateral .salir { margin-top: 18px; color: var(--muted); }
main { padding: 22px 28px 56px; min-width: 0; max-width: 1200px; }

.inferior { display: none; }

@media (max-width: 860px) {
  .shell { display: block; }
  .lateral { display: none; }
  main { padding: 16px 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom, 0px)); }
  .inferior { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0px); height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }
  .inferior a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 10.5px; font-weight: 500; letter-spacing: .02em; position: relative; }
  .inferior a:hover { text-decoration: none; }
  .inferior a .ic { font-size: 20px; line-height: 1; }
  .inferior a.activa { color: var(--ink); }
  .inferior a.activa::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 2px; background: var(--cian); border-radius: 2px; }
  .inferior .cuenta { position: absolute; top: 6px; right: calc(50% - 22px); background: var(--cian); color: var(--cian-ink); font-size: 10px; font-weight: 600; border-radius: 10px; min-width: 18px; height: 18px; line-height: 18px; text-align: center; padding: 0 5px; }
  .inferior .cuenta.urgente { background: var(--crit); color: #fff; }
  .topbar .marca .rol, .topbar .quien .lbl { display: none; }
  h1 { font-size: 23px; }
}

/* ---------- Encabezado de página ---------- */
.encabezado { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.encabezado .titulo h1 { margin-top: 3px; }
.encabezado .acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.encabezado .acciones input, .encabezado .acciones select { width: auto; min-height: 42px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { font-size: 12.5px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 11px; color: var(--ink-2); white-space: nowrap; }

/* ---------- Tarjetas / listas ---------- */
.tarjeta { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.tarjeta h2 { margin-bottom: 10px; }
.lista { display: grid; gap: 12px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 16px; align-items: start; position: relative; overflow: hidden; }
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--border-2); }
.item.ok::before { background: var(--ok); }
.item.hoy::before { background: var(--warn); }
.item.atrasado::before { background: var(--crit); }
.item.pronto::before { background: var(--cian); }
.item .titulo { font-weight: 500; font-size: 17px; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.item .sub { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.item .sub b { color: var(--ink); font-weight: 500; }
.item .botones { display: flex; flex-direction: column; gap: 8px; min-width: 160px; }
.item .pie { grid-column: 1 / -1; display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 13px; padding-top: 8px; border-top: 1px solid var(--border); }
.item .pie a { color: var(--ink-2); display: inline-flex; align-items: center; gap: 5px; padding: 6px 2px; }
.item .pie a:hover { color: var(--cian); text-decoration: none; }
@media (max-width: 640px) {
  .item { grid-template-columns: 1fr; }
  .item .botones { flex-direction: row; flex-wrap: wrap; }
  .item .botones .btn { flex: 1 1 46%; }
  .item .botones .btn.grande { flex-basis: 100%; }
}

/* ---------- Chips ---------- */
.etiqueta { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; padding: 2px 9px; border-radius: 999px; background: var(--neutral-chip); color: var(--ink-2); letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.etiqueta.cian { background: var(--info-chip); color: var(--info-ink); }
.etiqueta.ok { background: var(--ok-chip); color: var(--ok-ink); }
.etiqueta.alerta { background: var(--warn-chip); color: var(--warn-ink); }
.etiqueta.error { background: var(--crit-chip); color: var(--crit-ink); }

/* ---------- Tablas ---------- */
.tabla-scroll { overflow: auto; max-height: 70vh; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 500; background: var(--surface); position: sticky; top: 0; z-index: 1; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.cancelada td { color: var(--muted); text-decoration: line-through; }
tr.por-confirmar td { background: var(--warn-chip); }
.tarjeta table { font-size: 13.5px; }
.tarjeta th { background: transparent; }

/* ---------- Formularios ---------- */
form.formulario { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 14px; }
form.formulario .ancho { grid-column: 1 / -1; }
form.formulario h3 { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-top: 6px; }
label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border-2); border-radius: var(--r-s); background: var(--surface-2); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--cian); outline-offset: -1px; border-color: var(--cian); }
input[type="date"] { -webkit-appearance: none; }
textarea { min-height: 76px; resize: vertical; }
.fila { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 14px; color: var(--ink); cursor: pointer; padding: 6px 0; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--cian); }

/* ---------- Botones ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; min-height: 46px; border-radius: 11px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primario, .btn.cian { background: var(--cian); border-color: var(--cian); color: var(--cian-ink); font-weight: 600; }
.btn.primario:hover, .btn.cian:hover { background: #9be4ff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #06301a; font-weight: 600; }
:root[data-theme="light"] .btn.ok { color: #fff; }
.btn.ok:hover { filter: brightness(1.08); }
.btn.peligro { background: transparent; border-color: var(--crit); color: var(--crit); }
.btn.secundario { background: var(--surface-2); }
.btn.chico { min-height: 38px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn.grande { min-height: 54px; font-size: 16px; }
.btn.fantasma { background: transparent; border-color: transparent; color: var(--ink-2); }

/* ---------- Avisos ---------- */
.aviso { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--cian); border-radius: var(--r-s); padding: 11px 14px; color: var(--ink-2); font-size: 13.5px; margin-bottom: 14px; }
.aviso.ok { border-left-color: var(--ok); }
.aviso.alerta { border-left-color: var(--warn); }
.aviso.error, .error { border-left: 3px solid var(--crit); background: var(--crit-chip); color: var(--crit-ink); padding: 10px 14px; border-radius: var(--r-s); font-size: 13.5px; }
.vacio { text-align: center; color: var(--muted); padding: 40px 16px; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px; }
.kpi .l { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.kpi .v { font-size: 26px; font-weight: 300; font-variant-numeric: tabular-nums; margin-top: 4px; letter-spacing: -.01em; }
.kpi .v small { font-size: 14px; color: var(--muted); }
.kpi.hero { background: var(--brand); color: #fff; border-color: transparent; position: relative; overflow: hidden; grid-column: span 2; }
.kpi.hero .l { color: var(--cian); }
.kpi.hero .v { font-size: 38px; }
.kpi.hero::after { content: ""; position: absolute; right: -40px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%; border: 28px solid rgba(127,219,255,.12); }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi.hero { grid-column: 1 / -1; } .kpi .v { font-size: 21px; } .kpi.hero .v { font-size: 32px; } .kpi { padding: 12px 14px; min-width: 0; overflow: hidden; } }
.barra-h { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.barra-h > div { height: 100%; background: var(--cian); border-radius: 4px; }
.dos-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }

/* ---------- Modal ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: end center; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; box-shadow: 0 -20px 60px rgba(0,0,0,.4); }
.modal h2 { margin-bottom: 14px; font-size: 19px; font-weight: 500; }
.modal .pie-modal { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; position: sticky; bottom: 0; background: var(--surface); padding-top: 10px; }
.modal .pie-modal .btn { flex: 1; }
@media (min-width: 700px) {
  .modal-fondo { place-items: center; padding: 20px; }
  .modal { border-radius: 18px; }
  .modal .pie-modal .btn { flex: 0 0 auto; }
}
pre.mensaje { background: var(--surface-2); border: 1px solid var(--border); padding: 12px 14px; border-radius: var(--r-s); white-space: pre-wrap; font-size: 14px; font-family: inherit; line-height: 1.5; }

.toast { position: fixed; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--page); padding: 11px 18px; border-radius: 999px; z-index: 60; font-size: 14px; font-weight: 500; max-width: 92vw; }
@media (min-width: 861px) { .toast { bottom: 24px; } }

@media print { .topbar, .lateral, .inferior, .acciones, .botones { display: none !important; } body { background: #fff; color: #000; } }
.icono-btn.salir-btn { width: auto; padding: 0 12px; font-size: 13px; }
