/* ============================================================
   Elevadores Baja Lift — Soluciones Verticales
   Sistema de diseño compartido por las tres aplicaciones.

   Verde de marca #0E9A46 · Teal de marca #0E9BB8

   Tema claro fijo, sin `prefers-color-scheme`. No es un descuido:
   la app la usan técnicos en la azotea de un edificio, a pleno sol.
   Un fondo oscuro a contraluz es ilegible, y el teléfono en modo
   oscuro cambiaría los colores justo cuando peor se ve.
   ============================================================ */

:root {
  --green: #0E9A46;
  --green-d: #0A7C38;
  --teal: #0E9BB8;
  --teal-d: #0B7F97;

  --bg: #eef1f4;
  --surface: #ffffff;
  --surface2: #f5f7f9;
  --border: #dbe0e6;

  --text: #14181d;
  --muted: #5d6672;
  --head: #101519;
  --head2: #1c242c;

  --accent: #0B7F97;
  --accent-soft: #e0f2f6;
  --ok: #0E9A46;
  --ok-soft: #e2f4e9;
  --warn: #c98209;
  --warn-soft: #fbf1dd;
  --bad: #c53b3b;
  --bad-soft: #fae5e5;
  --urgent: #b3261e;

  --shadow: 0 10px 30px rgba(16, 21, 25, .12);
  --radius: 10px;

  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { text-wrap: balance; }
a { color: var(--accent); }

/* El foco visible no se quita nunca: hay quien navega el formulario del
   reporte con teclado, y sin este anillo no se sabe dónde se está. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Cabecera ---------- */
.shell-header {
  background: var(--head); color: #fff; padding: 12px 22px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.logo-lockup { display: flex; align-items: center; gap: 11px; }
.logo-lockup svg { width: 52px; height: auto; flex: 0 0 auto; }
.wordmark b {
  display: block; font-size: 16.5px; font-weight: 800;
  letter-spacing: .4px; line-height: 1.1;
}
.wordmark b i { font-style: normal; color: var(--green); }
.wordmark b u { text-decoration: none; color: var(--teal); }
.wordmark span {
  display: block; font-size: 9.5px; letter-spacing: 3.1px;
  color: #9aa4ae; margin-top: 1px;
}
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.hdr-user { text-align: right; font-size: 12px; line-height: 1.3; }
.hdr-user b { display: block; font-size: 13px; }
.hdr-user span { color: #9aa4ae; }

.bell {
  position: relative; background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .18); color: #fff;
  width: 36px; height: 36px; border-radius: 9px; font-size: 16px; line-height: 1;
}
.bell:hover { background: rgba(255, 255, 255, .16); }
.bell .dot {
  position: absolute; top: -6px; right: -6px; background: var(--urgent);
  color: #fff; border-radius: 99px; min-width: 19px; height: 19px;
  font-size: 11px; font-weight: 700; display: none; place-items: center;
  padding: 0 5px; border: 2px solid var(--head);
}
.bell.has .dot { display: grid; }

.brandbar { height: 3px; background: linear-gradient(90deg, var(--green), var(--teal)); }

.tabs { background: var(--head); padding: 0 18px 13px; display: flex; gap: 7px; flex-wrap: wrap; }
.tab {
  background: transparent; color: #c3ccd4;
  border: 1px solid rgba(255, 255, 255, .2); border-radius: 99px;
  padding: 7px 17px; font-size: 13.5px; text-decoration: none;
}
.tab:hover { background: rgba(255, 255, 255, .09); }
.tab.active { background: #fff; color: var(--head); border-color: #fff; font-weight: 650; }
.tab .cnt {
  display: none; background: var(--urgent); color: #fff; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; padding: 1px 6px; margin-left: 5px;
}
.tab.has-cnt .cnt { display: inline-block; }

.view { max-width: 1180px; margin: 0 auto; padding: 16px 20px 60px; }

/* ---------- Sub-pestañas ---------- */
.subtabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px;
  border-bottom: 1px solid var(--border); padding-bottom: 10px;
}
.subtab {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px; font-size: 13px;
}
.subtab:hover { border-color: var(--accent); color: var(--text); }
.subtab.active { background: var(--head2); color: #fff; border-color: var(--head2); font-weight: 600; }
.subtab .cnt {
  background: var(--urgent); color: #fff; border-radius: 99px; font-size: 10px;
  font-weight: 700; padding: 1px 6px; margin-left: 5px; display: none;
}
.subtab.has-cnt .cnt { display: inline-block; }
.panel { display: none; }
.panel.active { display: block; }

/* ---------- Tarjetas y tablas ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card-h {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-h h3 { margin: 0; font-size: 14.5px; }
.card-h .sub { margin-left: auto; font-size: 12px; color: var(--muted); }
.card-b { padding: 14px 16px; }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.tbl th {
  text-align: left; font-size: 11px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); padding: 9px 14px; border-bottom: 1px solid var(--border);
  font-weight: 600; white-space: nowrap;
}
.tbl td {
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums; vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl tbody tr:hover { background: var(--surface2); }
.tbl .empty td { text-align: center; color: var(--muted); padding: 26px 14px; }

/* ---------- Etiquetas de estado ---------- */
.chip {
  display: inline-block; font-size: 11px; font-weight: 650; border-radius: 99px;
  padding: 2.5px 10px; letter-spacing: .2px; white-space: nowrap;
}
.chip.draft { background: var(--surface2); color: var(--muted); border: 1px solid var(--border); }
.chip.progress { background: var(--accent-soft); color: var(--accent); }
.chip.await { background: var(--warn-soft); color: var(--warn); }
.chip.signed { background: var(--ok-soft); color: var(--ok); }
.chip.sent { background: var(--head2); color: #fff; }
.chip.paid { background: var(--ok-soft); color: var(--ok); }
.chip.pend { background: var(--warn-soft); color: var(--warn); }
.chip.late { background: var(--bad-soft); color: var(--bad); }
.chip.urg { background: var(--urgent); color: #fff; }
.chip.open { background: var(--bad-soft); color: var(--bad); }
.chip.assigned { background: var(--accent-soft); color: var(--accent); }
.chip.closed { background: var(--ok-soft); color: var(--ok); }
.chip.voided { background: var(--surface2); color: var(--bad); border: 1px solid var(--bad); }

/* ---------- Botones ---------- */
.btn {
  border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600;
  font-size: 13.5px; text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; justify-content: center;
}
.btn-primary { background: var(--teal-d); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-green { background: var(--green-d); color: #fff; }
.btn-green:hover { background: var(--green); }
.btn-outline { background: var(--surface); color: var(--accent); border: 1.5px solid var(--accent); }
.btn-ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: var(--urgent); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-wide { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.loading { position: relative; color: transparent; }
.btn.loading::after {
  content: ""; position: absolute; width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite;
}
.btn-ghost.loading::after, .btn-outline.loading::after {
  border-color: rgba(11, 127, 151, .3); border-top-color: var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Indicadores ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 13px; margin-bottom: 16px;
}
.kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 13px 15px; border-top: 3px solid var(--teal);
}
.kpi.g { border-top-color: var(--green); }
.kpi.w { border-top-color: var(--warn); }
.kpi.r { border-top-color: var(--bad); }
.kpi .k-l {
  font-size: 11px; letter-spacing: .7px; text-transform: uppercase;
  color: var(--muted); font-weight: 650;
}
.kpi .k-v {
  font-size: 28px; font-weight: 750; margin-top: 2px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.kpi .k-s { font-size: 12.3px; margin-top: 1px; color: var(--muted); }
.k-up { color: var(--ok); }
.k-warn { color: var(--warn); }
.k-bad { color: var(--bad); }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1/-1; }
.field label { font-size: 12.5px; font-weight: 650; color: var(--text); }
.field label .req { color: var(--bad); }
.inp {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
  background: var(--surface); font-size: 14px; width: 100%;
}
.inp:focus { border-color: var(--accent); }
textarea.inp { min-height: 88px; resize: vertical; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.field.invalid .inp { border-color: var(--bad); }
.field .err { font-size: 12px; color: var(--bad); display: none; }
.field.invalid .err { display: block; }

/* ---------- Avisos ---------- */
.alert {
  border-radius: 9px; padding: 10px 13px; font-size: 13px; margin-bottom: 12px;
}
.alert-bad { background: var(--bad-soft); color: #8d2222; border: 1px solid #ecb5b5; }
.alert-warn { background: var(--warn-soft); color: #77500a; border: 1px solid #ecd6a0; }
.alert-ok { background: var(--ok-soft); color: #0a5c2a; border: 1px solid #a9dcbe; }
.alert-info { background: var(--accent-soft); color: #0a5a6c; border: 1px solid #a6d9e4; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert li { margin: 2px 0; }

/* ---------- Avisos flotantes ---------- */
.toast-host {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  z-index: 400; pointer-events: none; width: min(92vw, 480px);
}
.toast {
  background: var(--head2); color: #fff; border-radius: 10px;
  padding: 11px 16px; font-size: 13.2px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s;
  pointer-events: auto; width: 100%;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.bad { background: var(--urgent); }
.toast.ok { background: var(--green-d); }
.toast.warn { background: var(--warn); }
@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .btn.loading::after { animation: none; }
}

/* ---------- Modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(10, 14, 17, .6); display: none;
  align-items: center; justify-content: center; padding: 20px; z-index: 200;
}
.modal.open { display: flex; }
.modal-box {
  background: var(--surface); border-radius: 12px; max-width: 720px; width: 100%;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow);
}
.modal-box.wide { max-width: 980px; }
.modal-h {
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-h h3 { margin: 0; font-size: 15px; }
.modal-h .x {
  margin-left: auto; background: none; border: 0; font-size: 20px;
  color: var(--muted); line-height: 1; padding: 2px 8px; border-radius: 6px;
}
.modal-h .x:hover { background: var(--surface2); }
.modal-b { padding: 18px; }
.modal-f {
  padding: 13px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap;
}

/* ---------- Estados vacíos y carga ---------- */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .ic { font-size: 34px; display: block; margin-bottom: 8px; opacity: .6; }
.empty-state b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.skeleton {
  background: linear-gradient(90deg, var(--surface2) 25%, #e9edf1 50%, var(--surface2) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite;
  border-radius: 6px; height: 14px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* ---------- Crédito ---------- */
.site-credit {
  max-width: 1180px; margin: 0 auto; padding: 16px 20px 34px; text-align: center;
  font-size: 11.5px; letter-spacing: .3px; color: var(--muted); opacity: .6;
}
.site-credit b { font-weight: 650; }
.site-credit .rule { height: 1px; background: var(--border); margin: 0 auto 12px; max-width: 230px; }
