/* Línea gráfica MiKiuvo — la misma de planning.mikiuvo.com y facturacion.mikiuvo.com:
   tipografía Outfit, naranja #F25C27, fondo claro, tarjetas redondeadas con sombra suave. */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&display=swap");

:root {
  --paper: #f7f8fa; --raised: #ffffff; --ink: #0f172a; --muted: #6b7280; --line: #e5e7eb;
  --accent: #f25c27; --accent-hover: #d84d1d; --accent-10: rgba(242, 92, 39, .10); --accent-05: rgba(242, 92, 39, .05);
  --secondary: #171e2d;
  --rojo: #dc2626; --ambar: #b45309; --verde: #16a34a; --azul: #2563eb;
  --sombra: 0 1px 2px rgb(15 23 42 / .04), 0 8px 30px rgb(0 0 0 / .03);
  --fuente: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--fuente); color: var(--ink); background: var(--paper); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); font-weight: 600; text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .75rem; letter-spacing: -.02em; }
h2 { font-size: 1.75rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 800; }

/* ---------- botones ---------- */
button, input, select, textarea { font: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer;
  border: 0; border-radius: .75rem; padding: .62rem 1.1rem; font-size: .875rem; font-weight: 700;
  background: var(--accent); color: #fff; box-shadow: 0 10px 15px -3px rgba(242, 92, 39, .25); transition: all .15s;
}
button:hover { background: var(--accent-hover); }
button:active { transform: scale(.98); }
button:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(242, 92, 39, .3); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.sec { background: var(--raised); color: var(--muted); border: 1px solid var(--line); box-shadow: none; }
button.sec:hover { background: var(--paper); color: var(--accent); }
button.peligro { background: var(--rojo); box-shadow: 0 10px 15px -3px rgba(220, 38, 38, .2); }
button.peligro:hover { background: #b91c1c; }
button.ok { background: var(--verde); box-shadow: 0 10px 15px -3px rgba(22, 163, 74, .2); }
button.ok:hover { background: #15803d; }
button.mini { padding: .3rem .7rem; font-size: .78rem; border-radius: .6rem; }

/* ---------- formularios ---------- */
label { display: block; font-size: .875rem; font-weight: 600; color: #374151; margin: .8rem 0 .35rem; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: .75rem; padding: .62rem 1rem;
  background: #f9fafb; color: var(--ink); outline: none; transition: all .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background-color: #fff; box-shadow: 0 0 0 3px rgba(242, 92, 39, .2); }
input::placeholder, textarea::placeholder { color: #9ca3af; }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
select {
  appearance: none; cursor: pointer; padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right .6rem center; background-repeat: no-repeat; background-size: 1.1em 1.1em;
}
select:focus { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23F25C27' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e"); }

/* ---------- tablas ---------- */
table { border-collapse: collapse; width: 100%; background: var(--raised); }
th, td { padding: .65rem .8rem; border-bottom: 1px solid #f1f2f4; text-align: left; font-size: .9rem; vertical-align: top; }
th { background: #fafafb; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); position: sticky; top: 0; z-index: 1; }
tr:hover td { background: #fffaf7; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.tabla-scroll { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 1rem; background: var(--raised); box-shadow: var(--sombra); }
.tarjeta .tabla-scroll { box-shadow: none; }

/* ---------- piezas ---------- */
.tarjeta { background: var(--raised); border: 1px solid var(--line); border-radius: 1rem; padding: 1.25rem 1.4rem; margin-bottom: 1rem; box-shadow: var(--sombra); }
.fila { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
.fila > * { flex: 1 1 160px; }
.fila > label { margin-top: 0; }
.chip { display: inline-flex; align-items: center; padding: .15rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.chip.verde { background: rgba(22, 163, 74, .1); color: var(--verde); }
.chip.rojo { background: rgba(220, 38, 38, .08); color: var(--rojo); }
.chip.ambar { background: rgba(180, 83, 9, .1); color: var(--ambar); }
.chip.azul { background: var(--accent-10); color: var(--accent); }
.chip.gris { background: #f3f4f6; color: var(--muted); }
.suave { color: var(--muted); font-size: .875rem; font-weight: 500; }
.error { color: var(--rojo); font-weight: 600; }
.alerta { border-radius: .75rem; border: 1px solid rgba(220, 38, 38, .2); background: rgba(220, 38, 38, .05); color: var(--rojo); padding: .6rem 1rem; font-size: .875rem; font-weight: 600; }
.alerta:empty { display: none; }
.oculto { display: none !important; }
.etiqueta-app { border-radius: .375rem; background: var(--accent-10); color: var(--accent); padding: .12rem .4rem; font-size: .62rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.logo { font-size: 1.5rem; font-weight: 900; letter-spacing: -.05em; color: var(--accent); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--raised); border: 1px solid var(--line); border-radius: 1rem; padding: .9rem 1.1rem; box-shadow: var(--sombra); }
.kpi b { display: block; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.kpi span { color: var(--muted); font-size: .78rem; font-weight: 600; }

/* ---------- marco: menú lateral como planning ---------- */
.marco { display: flex; min-height: 100vh; }
.lateral { position: sticky; top: 0; height: 100vh; width: 16rem; flex: none; background: #fff; border-right: 1px solid #f3f4f6; display: flex; flex-direction: column; z-index: 60; }
.lateral .cabeza { height: 4rem; display: flex; align-items: center; gap: .5rem; padding: 0 1.5rem; border-bottom: 1px solid #f3f4f6; flex: none; }
nav.menu { flex: 1; overflow-y: auto; padding: .75rem; }
nav.menu a {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; margin-bottom: .375rem; border-radius: .75rem;
  color: #4b5563; font-size: .875rem; font-weight: 600; text-decoration: none; transition: all .15s;
}
nav.menu a:hover { background: var(--accent-05); color: var(--accent); }
nav.menu a.activo { background: var(--accent); color: #fff; font-weight: 900; box-shadow: 0 1px 2px rgba(242, 92, 39, .2); }
nav.menu a svg { width: 1.25rem; height: 1.25rem; flex: none; }
nav.menu .num { margin-left: auto; background: var(--rojo); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 800; padding: 0 .45rem; line-height: 1.3rem; }
nav.menu a.activo .num { background: #fff; color: var(--accent); }
.lateral .pie { border-top: 1px solid #f3f4f6; padding: 1rem; flex: none; }
.perfil { display: flex; align-items: center; gap: .75rem; padding: .35rem .25rem; border-radius: .75rem; margin-bottom: .75rem; color: inherit; text-decoration: none !important; }
.perfil:hover { background: var(--accent-05); }
.avatar { width: 2.25rem; height: 2.25rem; flex: none; border-radius: 999px; background: var(--accent-10); color: var(--accent); font-size: .75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px rgba(242, 92, 39, .2); }
.perfil .nombre { font-size: .78rem; font-weight: 800; color: #111827; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perfil .rol { font-size: .66rem; font-weight: 600; color: var(--muted); margin-top: .25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lateral .pie select { font-size: .78rem; padding: .4rem 2rem .4rem .7rem; margin-bottom: .6rem; }
.btn-salir { width: 100%; background: #fff; color: #4b5563; border: 1px solid #e5e7eb; box-shadow: none; font-size: .75rem; padding: .5rem 1rem; }
.btn-salir:hover { background: #f9fafb; color: var(--accent); }
.btn-salir svg { width: 1rem; height: 1rem; }
.contenido { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barra-movil { display: none; }
main { padding: 2rem; max-width: 1320px; width: 100%; }
.fondo-menu { display: none; }

@media (max-width: 1023px) {
  .lateral { position: fixed; left: 0; top: 0; width: 18rem; max-width: 85%; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 20px 50px rgba(0,0,0,.15); }
  .marco.menu-abierto .lateral { transform: none; }
  .marco.menu-abierto .fondo-menu { display: block; position: fixed; inset: 0; background: rgba(23, 30, 45, .4); z-index: 55; }
  .barra-movil { display: flex; position: sticky; top: 0; z-index: 40; height: 4rem; align-items: center; justify-content: space-between;
    padding: 0 1rem; border-bottom: 1px solid #f3f4f6; background: rgba(255,255,255,.85); backdrop-filter: blur(12px); }
  .barra-movil button { background: transparent; color: var(--muted); box-shadow: none; padding: .6rem; }
  .barra-movil button:hover { background: #f9fafb; }
  .barra-movil svg { width: 1.25rem; height: 1.25rem; }
  .barra-movil .logo { font-size: 1.25rem; }
  main { padding: 1.5rem 1rem; }
  h2 { font-size: 1.5rem; }
}

/* ---------- acceso (misma tarjeta que el login de planning) ---------- */
.acceso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: var(--paper); }
.acceso .caja { width: 100%; max-width: 420px; background: var(--raised); border: 1px solid #f3f4f6; border-radius: 1.5rem; padding: 2.5rem; box-shadow: 0 8px 30px rgb(0 0 0 / .04); }
.acceso .encabezado { text-align: center; margin-bottom: 2rem; }
.acceso .encabezado .logo { font-size: 1.875rem; }
.acceso .encabezado .app { margin-top: .15rem; font-size: .75rem; font-weight: 700; letter-spacing: .25em; text-transform: uppercase; color: var(--muted); }
.acceso .encabezado h1 { margin: 1.5rem 0 .25rem; font-size: 1.25rem; font-weight: 800; }
.acceso form { display: flex; flex-direction: column; }
.acceso form label { margin-top: 1rem; }
.acceso form button { margin-top: 1.4rem; padding: .8rem; width: 100%; }

/* ---------- modales, firma, flujo ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(23, 30, 45, .45); display: flex; align-items: center; justify-content: center; z-index: 80; padding: 1rem; }
.modal { background: #fff; border-radius: 1.5rem; padding: 1.6rem; width: min(640px, 100%); max-height: 92vh; overflow: auto; box-shadow: 0 25px 60px rgba(0,0,0,.18); }
.firma-caja { border: 2px dashed var(--line); border-radius: 1rem; background: #fcfcfd; position: relative; }
.firma-caja canvas { display: block; width: 100%; height: 170px; touch-action: none; }
.firma-caja .linea { position: absolute; left: 8%; right: 8%; bottom: 38px; border-bottom: 1px solid #c9ced8; pointer-events: none; }
.firma-caja .pie { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: .75rem; color: var(--muted); pointer-events: none; }
.linea-tiempo { list-style: none; padding: 0; margin: 0; }
.linea-tiempo li { display: flex; gap: .8rem; padding: .7rem 0; border-bottom: 1px dashed var(--line); align-items: center; }
.linea-tiempo .punto { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--line); }
.linea-tiempo .punto.ok { background: var(--verde); }
.linea-tiempo .punto.esp { background: var(--ambar); }
.linea-tiempo .punto.mal { background: var(--rojo); }
.linea-tiempo img { height: 48px; border: 1px solid var(--line); border-radius: .5rem; background: #fff; }
.pasos { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.pasos span { padding: .3rem .75rem; border-radius: 999px; font-size: .75rem; font-weight: 700; background: #f3f4f6; color: var(--muted); }
.pasos span.hecho { background: rgba(22, 163, 74, .1); color: var(--verde); }
.pasos span.actual { background: var(--accent); color: #fff; }
.notif { padding: .85rem 1.1rem; border-bottom: 1px solid #f3f4f6; }
.notif.nueva { background: var(--accent-05); }
.notif pre { white-space: pre-wrap; font-family: inherit; margin: .35rem 0 0; font-size: .875rem; color: #374151; }
