/* ============================================================
   Sistema de Lavandería — Sistema de diseño
   Paleta: azul lavado / acento turquesa / ámbar sol / papel
   Tipografía: Outfit (títulos) · Inter (cuerpo) · Plex Mono (precios)
   ============================================================ */

:root {
  --lav-bg: #f2f7fa;
  --lav-surface: #ffffff;
  --lav-ink: #16283b;
  --lav-muted: #6b7c8f;
  --lav-navy: #1d4e89;
  --lav-navy-dark: #143a6a;
  --lav-teal: #0fa3a3;
  --lav-teal-soft: #e0f4f4;
  --lav-amber: #e8a33d;
  --lav-amber-soft: #fdf3e3;
  --lav-green: #2e9e6b;
  --lav-green-soft: #e4f5ec;
  --lav-red: #c7442c;
  --lav-red-soft: #fbe9e4;
  --lav-border: #dfe8ef;
  --radius: 14px;
  --shadow-card: 0 1px 2px rgba(22, 40, 59, .05), 0 6px 18px rgba(22, 40, 59, .06);
}

* { box-sizing: border-box; }

body {
  background: var(--lav-bg);
  color: var(--lav-ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: .95rem;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, .font-display {
  font-family: "Outfit", "Inter", sans-serif;
  letter-spacing: -.01em;
}

.mono, .precio, .orden-numero {
  font-family: "IBM Plex Mono", "Consolas", monospace;
}

/* ---------- Barra superior ---------- */
.app-header {
  background: linear-gradient(120deg, var(--lav-navy) 0%, var(--lav-navy-dark) 100%);
  color: #fff;
  padding: .8rem 1.25rem;
  box-shadow: 0 2px 12px rgba(20, 58, 106, .25);
  position: sticky;
  top: 0;
  z-index: 1030;
}

.app-header .brand {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .01em;
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: .2rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  flex: none;
}

.app-nav {
  display: flex;
  gap: .25rem;
  flex-wrap: wrap;
}
.app-nav .nav-link {
  color: rgba(255, 255, 255, .82);
  font-weight: 500;
  font-size: .9rem;
  border-radius: 999px;
  padding: .4rem .85rem;
  transition: background .15s ease, color .15s ease;
}
.app-nav .nav-link:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.app-nav .nav-link.active { color: var(--lav-navy-dark); background: #fff; }

/* Dropdown del menú de navegación */
.nav-dropdown { position: relative; }
.nav-dropdown .nav-link { white-space: nowrap; }
.nav-dropdown-toggle {
  color: rgba(255, 255, 255, .82);
  font-weight: 500;
  font-size: .9rem;
  border-radius: 999px;
  padding: .4rem .85rem;
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: background .15s ease, color .15s ease;
}
.nav-dropdown-toggle:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.nav-dropdown-toggle.active { color: var(--lav-navy-dark); background: #fff; }
.nav-dropdown .dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--lav-surface);
  border: 1px solid var(--lav-border);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  padding: .35rem;
  display: none;
  z-index: 50;
}
.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu,
.nav-dropdown.open .dropdown-menu { display: block; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: .45rem .75rem;
  border-radius: 7px;
  color: var(--lav-ink);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
}
.dropdown-item:hover { background: var(--lav-teal-soft); color: var(--lav-navy-dark); }
.dropdown-item.active { background: var(--lav-teal); color: #fff; }
button.dropdown-item {
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
}
.dropdown-sub { position: relative; }
.dropdown-sub > .dropdown-toggle { cursor: pointer; }
.dropdown-sub .sub-menu {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 200px;
  background: var(--lav-surface);
  border: 1px solid var(--lav-border);
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  padding: .35rem;
  display: none;
  z-index: 51;
}
.dropdown-sub:hover .sub-menu,
.dropdown-sub:focus-within .sub-menu,
.dropdown-sub.open .sub-menu { display: block; }
@media (max-width: 991px) {
  .dropdown-sub .sub-menu { left: auto; right: 100%; }
}

/* Fila maestro-detalle expandible (reportes de insumos) */
.md-fila { cursor: pointer; }
.md-fila:hover { background: var(--lav-teal-soft); }
.md-fila .chevron { display: inline-block; transition: transform .15s ease; color: var(--lav-muted); }
.md-detalle .md-inner { padding: 1rem 1.25rem; }
@media print {
  .md-detalle { display: none !important; }
}


/* ---------- Contenido ---------- */
.app-main { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1.25rem 4rem; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; margin: 0; }
.page-head .lead { color: var(--lav-muted); margin: .15rem 0 0; font-size: .92rem; }

.card-lav {
  background: var(--lav-surface);
  border: 1px solid var(--lav-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-lav .card-lav-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--lav-border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.card-lav .card-lav-body { padding: 1.25rem; }

/* ---------- Indicadores / estado ---------- */
.chip-estado {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  font-size: .78rem; font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.chip-estado::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, .9);
}

.dot-estado {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: .35rem;
}

/* ---------- Precios ---------- */
.precio { color: var(--lav-teal); font-weight: 600; font-variant-numeric: tabular-nums; }
.precio-total { color: var(--lav-navy); font-weight: 700; font-size: 1.05rem; }
.saldo-neg { color: var(--lav-red); font-weight: 600; }

/* ---------- Estadísticas ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { padding: 1.1rem 1.25rem; }
.stat-card .stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--lav-muted); font-weight: 600; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; font-family: "Outfit", sans-serif; line-height: 1.2; }
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.15rem; color: #fff; flex: none;
}
.stat-teal { background: var(--lav-teal); }
.stat-navy { background: var(--lav-navy); }
.stat-amber { background: var(--lav-amber); }
.stat-green { background: var(--lav-green); }

/* ---------- Tablas ---------- */
.table-lav thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--lav-muted); font-weight: 600; border-bottom: 1px solid var(--lav-border);
  padding: .7rem .8rem; white-space: nowrap;
}
.table-lav tbody td { padding: .8rem; vertical-align: middle; border-color: var(--lav-border); }
.table-lav tbody tr:hover { background: #f7fbfd; }

.orden-numero { font-weight: 600; color: var(--lav-navy); white-space: nowrap; }

/* ---------- Botones ---------- */
.btn-lav {
  background: var(--lav-navy); border: 1px solid var(--lav-navy); color: #fff;
  border-radius: 10px; font-weight: 600; padding: .5rem 1rem; transition: all .15s ease;
}
.btn-lav:hover, .btn-lav:focus { background: var(--lav-navy-dark); border-color: var(--lav-navy-dark); color: #fff; }
.btn-teal {
  background: var(--lav-teal); border: 1px solid var(--lav-teal); color: #fff;
  border-radius: 10px; font-weight: 600; padding: .5rem 1rem; transition: all .15s ease;
}
.btn-teal:hover, .btn-teal:focus { background: #0c8a8a; border-color: #0c8a8a; color: #fff; }
.btn-ghost { background: #fff; border: 1px solid var(--lav-border); color: var(--lav-ink); border-radius: 10px; font-weight: 500; }
.btn-ghost:hover { border-color: var(--lav-navy); color: var(--lav-navy); background: #f4f8fb; }

.permiso-check { border: 1px solid var(--lav-border); border-radius: 10px; padding: .45rem .7rem; margin: 0; }
.permiso-check:has(input:disabled) { opacity: .7; cursor: not-allowed; }
.permiso-check input:disabled { cursor: not-allowed; }

/* Normaliza <button class="btn"> para que herede la misma tipografía que <a class="btn">.
   Sin esto, el elemento <button> nativo del navegador usa su propia font/line-height y se ve de otro tamaño. */
button.btn { font-family: inherit; line-height: inherit; letter-spacing: inherit; text-align: center; }

/* ---------- Formularios ---------- */
.form-lav .form-control, .form-lav .form-select {
  border-radius: 10px; border-color: var(--lav-border);
  padding: .55rem .8rem; font-size: .92rem;
}
.form-lav .form-control:focus, .form-lav .form-select:focus {
  border-color: var(--lav-teal); box-shadow: 0 0 0 .2rem rgba(15, 163, 163, .15);
}
.form-lav label { font-weight: 600; font-size: .82rem; color: var(--lav-ink); margin-bottom: .3rem; }

/* ---------- Formulario de orden ---------- */
.selector-cliente {
  border: 2px dashed var(--lav-border);
  border-radius: var(--radius);
  padding: 1.1rem;
  transition: border-color .2s ease;
}
.selector-cliente.seleccionado { border-color: var(--lav-teal); background: var(--lav-teal-soft); }

.resultado-cliente {
  position: absolute; z-index: 1050; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--lav-border); border-radius: 10px;
  box-shadow: var(--shadow-card); max-height: 260px; overflow: auto;
  display: none;
}
.resultado-cliente .resultado-item {
  padding: .6rem .9rem; cursor: pointer; border-bottom: 1px solid #eef3f7;
  display: flex; justify-content: space-between; align-items: center; gap: .75rem;
}
.resultado-cliente .resultado-item:hover { background: #f0f8fa; }
.resultado-cliente .resultado-item:last-child { border-bottom: 0; }

.tipo-tab .nav-link {
  color: var(--lav-ink); border-radius: 10px; font-weight: 600; font-size: .88rem;
  padding: .5rem 1rem;
}
.tipo-tab .nav-link.active { background: var(--lav-navy); color: #fff; }

.item-servicio {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .7rem .9rem;
  border: 1px solid var(--lav-border); border-radius: 10px;
  background: #fff; margin-bottom: .5rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.item-servicio:hover { border-color: var(--lav-teal); box-shadow: 0 0 0 2px rgba(15, 163, 163, .1); }
.item-servicio .servicio-nombre { font-weight: 600; font-size: .9rem; }
.item-servicio .servicio-precio { font-size: .85rem; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--lav-border); border-radius: 999px; overflow: hidden; }
.stepper button {
  border: 0; background: #fff; width: 30px; height: 30px;
  font-weight: 700; color: var(--lav-navy); cursor: pointer; line-height: 1;
}
.stepper button:hover { background: var(--lav-teal-soft); }
.stepper .valor { width: 34px; text-align: center; font-weight: 700; font-family: "IBM Plex Mono", monospace; }

.linea-item {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: .6rem; align-items: center;
  padding: .55rem .9rem; border-bottom: 1px solid #eef3f7;
}
.linea-item .cat { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--lav-muted); font-weight: 600; }
.linea-item > :first-child { min-width: 0; }
.linea-item .linea-desc { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }

.resumen-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 1.1rem; border-radius: 12px;
  background: var(--lav-navy); color: #fff; font-size: 1.05rem;
}
.resumen-total .importe { font-family: "IBM Plex Mono", monospace; font-size: 1.35rem; font-weight: 700; }

/* ---------- Etiqueta de retiro (firma del sistema) ---------- */
.ticket-etiqueta {
  background: #fff;
  border: 1px dashed var(--lav-teal);
  border-radius: 12px;
  padding: 1.1rem 1.3rem;
  position: relative;
}
.ticket-etiqueta::before, .ticket-etiqueta::after {
  content: "";
  position: absolute; left: -9px; top: 50%;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--lav-bg);
  transform: translateY(-50%);
  border: 1px solid var(--lav-border);
}
.ticket-etiqueta::after { left: auto; right: -9px; }
.ticket-etiqueta .etq-numero { font-family: "IBM Plex Mono", monospace; font-weight: 700; font-size: 1.6rem; color: var(--lav-navy); line-height: 1; }
.ticket-etiqueta .etq-cliente { font-size: 1.05rem; font-weight: 600; }

/* ---------- Flash ---------- */
.alert-lav { border-radius: 10px; border: 0; font-weight: 500; }
.alert-lav.ok { background: var(--lav-green-soft); color: #1c6b49; }
.alert-lav.error { background: var(--lav-red-soft); color: #8f301f; }

/* ---------- Varios ---------- */
.muted { color: var(--lav-muted); }
.vacio { text-align: center; padding: 3rem 1rem; color: var(--lav-muted); }
.vacio .vacio-icon { font-size: 2.2rem; margin-bottom: .5rem; }

/* ---------- Login / Autenticación ---------- */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--lav-navy) 0%, var(--lav-navy-dark) 100%);
}
.auth-wrap { width: 100%; max-width: 400px; }
.auth-card { padding: 2rem; }
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: .4rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1rem;
}
.auth-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--lav-navy-dark);
  margin: 0;
}
.auth-sub { color: var(--lav-muted); margin: .25rem 0 0; font-size: .9rem; }

/* Usuario logueado + Salir en el header */
.auth-usuario { color: rgba(255,255,255,.92); font-weight: 500; font-size: .85rem; }
.auth-rol { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; background: rgba(255,255,255,.16); padding: .15rem .5rem; border-radius: 999px; margin-left: .4rem; }
.btn-salir { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff !important; border-radius: 999px; padding: .3rem .85rem; font-size: .82rem; font-weight: 500; }
.btn-salir:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.7); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}