/* Panel del local. La base (colores, botones) está en /css/estilos.css.
   Diálogo, tabla, calendario, semáforo y alarmas: reutilizados de la
   muestra de abogados y pasados a los colores de la tienda. */

body.panel { background: var(--section); }
.panel__cabecera { width: auto; padding: .6rem 1.2rem; }
.panel__usuario { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: #fff; }
.etiqueta { background: #fde68a; color: #422006; font-size: .78rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; }

.panel__login { display: grid; place-items: center; padding: 3rem 1rem; min-height: calc(100vh - 60px); background: linear-gradient(135deg, #0f172a 0%, #134e4a 100%); }
.panel__login .tarjeta { position: relative; z-index: 1; border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); }
.tarjeta {
  background: var(--superficie); border-radius: var(--radio); padding: 1.6rem;
  width: min(100%, 380px); display: flex; flex-direction: column; gap: .9rem; box-shadow: var(--sombra);
}
.tarjeta h1 { margin: 0; }
.tarjeta label, .campo > label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .92rem; color: var(--azul); }

input[type="text"], input[type="email"], input[type="password"], input[type="url"], input[type="tel"],
input[type="date"], input[type="time"], input[type="number"], input[type="search"], select, textarea {
  font: inherit; font-weight: 400; color: var(--texto); padding: .5rem .65rem;
  border: 1px solid var(--borde-campo); border-radius: 8px; background: #fff; width: 100%; min-height: 44px;
}
textarea { resize: vertical; }

.pestanas { background: var(--azul); overflow-x: auto; }
.pestanas ul { list-style: none; display: flex; gap: .2rem; margin: 0; padding: 0 1rem; }
.pestanas [hidden] { display: none; }
.pestanas a { display: block; color: #cbd5e1; text-decoration: none; padding: .7rem .9rem; white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 600; }
.pestanas a:hover { color: #fff; }
.pestanas a[aria-current="page"] { color: #fff; border-bottom-color: #5eead4; }

.panel__contenido { padding: 1.2rem; max-width: 1280px; margin: 0 auto; }
/* Aviso flotante abajo: se ve aunque estés al final de una lista larga. */
.aviso {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 50;
  width: max-content; max-width: calc(100% - 32px); margin: 0;
  background: #dcfce7; color: #14532d; padding: .75rem 1.1rem; border-radius: var(--radio); font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .2);
}
.aviso:not([hidden]) { animation: subir .25s ease-out; }
@keyframes subir { from { opacity: 0; transform: translate(-50%, 12px); } }
.aviso--error { background: #fee2e2; color: #7f1d1d; }

.barra { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.barra h1 { margin: 0; font-size: 1.5rem; }
.barra__acciones { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.barra__acciones input[type="search"] { width: 230px; }
.barra__acciones select { width: auto; }

.tabla { width: 100%; border-collapse: collapse; background: var(--superficie); border-radius: var(--radio); overflow: hidden; margin-top: 1rem; box-shadow: var(--sombra); }
.tabla th, .tabla td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla th { background: #f8fafc; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .04em; font-size: .75rem; font-weight: 700; border-bottom: 2px solid var(--linea); }
.tabla tbody tr:hover td { background: #f0fdfa; }
.tabla__acciones { white-space: nowrap; text-align: right !important; }
.tabla__acciones > * + * { margin-left: .3rem; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tr.fila--anulada td { color: #94a3b8; text-decoration: line-through; }
.paginacion { margin-top: 1rem; display: flex; gap: .8rem; align-items: center; }

/* Estados (presupuestos, pagos, reparaciones, stock) */
.estado { display: inline-block; font-size: .78rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: #e2e8f0; color: #334155; white-space: nowrap; }
.estado--aceptado, .estado--cancelado, .estado--listo, .estado--hay { background: #dcfce7; color: #14532d; }
.estado--pendiente, .estado--parcial, .estado--diagnostico, .estado--en_reparacion, .estado--poco { background: #fef3c7; color: #78350f; }
.estado--rechazado, .estado--anulado, .estado--sin { background: #fee2e2; color: #7f1d1d; }
.estado--esperando_repuesto { background: #ede9fe; color: #4c1d95; }
.estado--sin_reparacion { background: #ffedd5; color: #7c2d12; }
.estado--recibido { background: #dbeafe; color: #1e3a8a; }

/* ---------- Tarjetas de resumen (arriba de la agenda) ---------- */
.resumen { list-style: none; padding: 0; margin: .8rem 0 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .7rem; }
.resumen button { width: 100%; text-align: left; font: inherit; background: var(--superficie); border: 0; border-left: 6px solid #94a3b8; border-radius: var(--radio); padding: .7rem .9rem; box-shadow: var(--sombra); cursor: pointer; display: flex; flex-direction: column; }
.resumen button:hover { background: #f8fafc; }
.resumen strong { font-size: 1.5rem; color: var(--azul); line-height: 1.1; }
.resumen span { font-size: .85rem; color: var(--texto-suave); }
.resumen .r--alerta { border-left-color: #dc2626; }
.resumen .r--aviso { border-left-color: #f59e0b; }
.resumen .r--ok { border-left-color: #16a34a; }
.resumen .r--info { border-left-color: var(--acento); }

/* ---------- Diálogo de edición ---------- */
.dialogo { border: 0; border-radius: var(--radio); padding: 0; width: min(820px, calc(100% - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.dialogo::backdrop { background: rgba(15, 23, 42, .55); }
.dialogo form { display: flex; flex-direction: column; max-height: calc(100vh - 24px); }
.dialogo__cabecera { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.2rem; background: var(--azul); color: #fff; }
.dialogo__cabecera h2 { margin: 0; font-size: 1.15rem; color: #fff; }
.dialogo__cerrar { background: none; border: 0; color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; min-width: 44px; min-height: 44px; border-radius: 8px; }
.dialogo__cerrar:hover { background: rgba(255, 255, 255, .12); }
/* Pestañas: en pantallas chicas, un degradé avisa que se pueden deslizar. */
@media (max-width: 900px) {
  .pestanas { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .pestanas a { min-height: 44px; display: flex; align-items: center; }
}
.resumen button { transition: translate .2s ease; }
@media (hover: hover) { .resumen button:hover { translate: 0 -2px; } }
.dialogo__cuerpo { padding: 1.1rem 1.2rem; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.dialogo form > .error { padding: 0 1.2rem; }
.dialogo__pie { display: flex; justify-content: flex-end; gap: .6rem; padding: .9rem 1.2rem; border-top: 1px solid var(--linea); }
.campo { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.campo--ancho { grid-column: 1 / -1; }
.campo--check label { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: var(--azul); }
.campo__ayuda { color: var(--texto-suave); font-size: .82rem; }
.campo--checks { border: 1px solid var(--linea); border-radius: 8px; padding: .5rem .8rem; }
.checks { display: flex; flex-wrap: wrap; gap: .3rem 1rem; }
@media (max-width: 640px) { .dialogo__cuerpo { grid-template-columns: 1fr; } }

/* Lector de códigos de barras (cámara) */
.campo__con-boton, .items__codigo { display: flex; gap: .4rem; align-items: stretch; }
.campo__con-boton input, .items__codigo input { flex: 1; min-width: 0; }
.items__codigo { margin-bottom: .5rem; }
.boton--lector { white-space: nowrap; flex: none; }
.lector { width: min(520px, calc(100% - 24px)); }
.lector__marco { position: relative; background: #000; aspect-ratio: 4 / 3; overflow: hidden; }
.lector__video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* La mira: un rectángulo apaisado, como un código de barras, con una línea que barre. */
.lector__mira { position: absolute; inset: 30% 10%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 10px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
.lector__mira::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: #f43f5e; box-shadow: 0 0 8px #f43f5e; animation: lector-barrido 1.6s ease-in-out infinite alternate; }
@keyframes lector-barrido { from { top: 12%; } to { top: 88%; } }
@media (prefers-reduced-motion: reduce) { .lector__mira::after { animation: none; } }
.lector__estado { margin: 0; padding: .8rem 1.2rem; text-align: center; }

/* Renglones del presupuesto */
.items { width: 100%; border-collapse: collapse; }
.items th { font-size: .8rem; text-align: left; color: var(--texto-suave); padding: .2rem .3rem; }
.items td { padding: .2rem .3rem; vertical-align: top; }
.items td:nth-child(2) { width: 5.5rem; }
.items td:nth-child(3) { width: 8.5rem; }
.items td:nth-child(4) { width: 7rem; }
.items__total { text-align: right; font-size: 1.15rem; font-weight: 800; color: var(--azul); margin: .5rem 0 0; }
.items__desc { display: flex; flex-direction: column; gap: .25rem; }
@media (max-width: 640px) {
  .items thead { display: none; }
  .items tr { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; border-bottom: 1px solid var(--linea); padding: .4rem 0; }
  .items td:first-child { grid-column: 1 / -1; }
  .items td { width: auto !important; }
}

/* Ficha (cliente, presupuesto, reparación) */
.ficha { background: var(--superficie); border-radius: var(--radio); padding: 1rem 1.2rem; box-shadow: var(--sombra); margin: .8rem 0; }
.ficha h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
.ficha dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.ficha dt { font-weight: 600; color: var(--texto-suave); }
.ficha dd { margin: 0; overflow-wrap: anywhere; }
.cuenta { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: 1.05rem; }
.cuenta strong { font-size: 1.35rem; color: var(--azul); display: block; }
.cuenta .saldo strong { color: #b91c1c; }
.cuenta .saldo--cero strong { color: #15803d; }
.volver { display: inline-block; margin-bottom: .5rem; }
.ficha > .campo { margin-top: 1rem; }   /* «Cambiar el estado» quedaba pegado a los datos */

/* ===================== AGENDA: el semáforo (de abogados) ===================== */
.semaforo--dorado   { --sem: #ca8a04; --sem-texto: #0f172a; }   /* blanco encima daba 2,9:1 */
.semaforo--amarillo { --sem: #facc15; --sem-texto: #0f172a; }
.semaforo--naranja  { --sem: #c2410c; --sem-texto: #fff; }      /* 5,2:1 (el #ea580c daba 3,6) */
.semaforo--rojo     { --sem: #dc2626; --sem-texto: #fff; }
.semaforo--normal   { --sem: #0f766e; --sem-texto: #fff; }
.semaforo--hecha    { --sem: #cbd5e1; --sem-texto: #475569; }
.semaforo--taller   { --sem: #1d4ed8; --sem-texto: #fff; }

.calendario__nav { display: flex; align-items: center; gap: .6rem; margin: .8rem 0; flex-wrap: wrap; }
.calendario__nav h2 { margin: 0; min-width: 11ch; text-align: center; text-transform: capitalize; font-size: 1.2rem; }
.calendario { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.calendario__dia-semana { text-align: center; font-weight: 700; font-size: .8rem; color: var(--texto-suave); padding: .2rem 0; }
.calendario__celda { background: var(--superficie); border: 1px solid var(--linea); border-radius: 8px; min-height: 92px; padding: .25rem; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.calendario__celda[class*="semaforo--"]:not(.semaforo--normal):not(.semaforo--hecha) { border: 2px solid var(--sem); background: color-mix(in srgb, var(--sem) 12%, #fff); }
.calendario__celda--fuera { opacity: .45; }
.calendario__celda--hoy .calendario__numero { background: var(--azul); color: #fff; }
.calendario__numero { align-self: flex-start; border: 0; background: transparent; font: inherit; font-weight: 700; font-size: .85rem; border-radius: 999px; min-width: 1.8em; padding: .1rem .35rem; cursor: pointer; color: var(--azul); }
.calendario__numero:hover { background: var(--section); }
.calendario__memoria { border: 0; border-radius: 4px; background: var(--sem); color: var(--sem-texto); font: inherit; font-size: .74rem; text-align: left; padding: .15rem .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.calendario__memoria.semaforo--hecha { text-decoration: line-through; }
.calendario__mas { font-size: .72rem; color: var(--texto-suave); }

.leyenda { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; padding: 0; margin: .8rem 0 0; font-size: .85rem; }
.leyenda li { display: flex; align-items: center; gap: .4rem; }
.leyenda__color { width: 1rem; height: 1rem; border-radius: 3px; background: var(--sem); }

.agenda__subtitulo { margin: 1.6rem 0 .6rem; font-size: 1.2rem; }
.memorias { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.memoria, .alarma { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; background: var(--superficie); border-left: 6px solid var(--sem); border-radius: var(--radio); padding: .6rem .8rem; }
.memoria__texto { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.memoria__cuando { font-size: .88rem; font-weight: 600; color: var(--azul); }
.memoria__quien { font-size: .8rem; color: var(--texto-suave); }
.memoria__acciones, .alarma__acciones { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ===================== Cartel de alarmas ===================== */
.alarmas { background: #fff7ed; border: 2px solid #ea580c; border-radius: var(--radio); padding: .8rem 1rem; margin-bottom: 1rem; }
.alarmas__cabecera { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; color: var(--azul); }
.alarmas ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }

@media (max-width: 700px) {
  .panel__contenido { padding: .8rem; }
  .calendario { gap: 2px; }
  .calendario__celda { min-height: 60px; padding: 2px; }
  /* En el celular cada recordatorio es una rayita de color: el detalle está en la lista. */
  .calendario__memoria { font-size: 0; height: 6px; padding: 0; }
  .calendario__dia-semana { font-size: .7rem; }
  /* Las tablas pasan a tarjetas, con el título de cada columna. */
  .tabla thead { display: none; }
  .tabla, .tabla tbody, .tabla tr, .tabla td { display: block; width: 100%; }
  .tabla tr { border-bottom: 2px solid var(--linea); padding: .4rem 0; }
  .tabla td { border: 0; padding: .2rem .7rem; text-align: left !important; }
  .tabla td[data-titulo]::before { content: attr(data-titulo) ": "; font-weight: 600; color: var(--texto-suave); }
  .tabla__acciones { white-space: normal; }
}

/* ---------- Comprobante de la reparación (se imprime) ---------- */
.comprobante { display: none; }
@media print {
  body.imprimiendo > *:not(.comprobante) { display: none !important; }
  body.imprimiendo .comprobante { display: block; font-size: 12pt; color: #000; }
  .comprobante h2 { margin: 0 0 .3rem; }
  .comprobante__codigo { font-size: 20pt; font-weight: 800; letter-spacing: .1em; border: 2px dashed #000; padding: .3rem .6rem; display: inline-block; }
  .comprobante__corte { border-top: 2px dashed #000; margin: 1.2rem 0; }
}
