/* Posventa — mismo sistema visual que erp.pampalabs.com y el Mission Control de Pampa Labs:
   noche Pampa, grilla, dorado de marca, Plus Jakarta Sans para títulos e Inter para texto. */
:root {
  --pl-bg: .165 .042 262;
  --pl-surface: .205 .048 262;
  --pl-surface-2: .25 .05 262;
  --pl-border: .31 .045 262;
  --pl-border-strong: .52 .045 262;
  --pl-text: .955 .012 85;
  --pl-muted: .78 .022 80;
  --pl-brand: .78 .13 78;
  --pl-accent-fg: .18 .045 262;
  --pl-ok: .8 .12 170;
  --pl-warn: .8 .13 62;
  --pl-bad: .7 .17 25;
  --pl-info: .8 .09 245;
  --pl-grid: .96 .01 85 / .045;
  --pl-lime: #c8ff00;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: oklch(var(--pl-bg));
  background-image: linear-gradient(oklch(var(--pl-grid)) 1px, transparent 1px), linear-gradient(90deg, oklch(var(--pl-grid)) 1px, transparent 1px);
  background-size: 48px 48px;
  color: oklch(var(--pl-text)); font-family: var(--font-body); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0; text-wrap: balance; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14.5px; font-weight: 600; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid oklch(var(--pl-brand)); outline-offset: 2px; }
.cargando { padding: 40px; color: oklch(var(--pl-muted)); }
.muted { color: oklch(var(--pl-muted)); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Estructura */
.shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: oklch(var(--pl-bg) / .86); backdrop-filter: blur(10px);
  border-right: 1px solid oklch(var(--pl-border)); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; }
.brand { display: flex; flex-direction: column; gap: 4px; padding: 0 8px; }
.wordmark { font-family: var(--font-display); font-weight: 800; font-size: 21px; letter-spacing: -.03em; line-height: 1; }
.wordmark b { color: var(--pl-lime); font-weight: 800; }
.brand small { color: oklch(var(--pl-muted)); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: oklch(var(--pl-muted)); font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: oklch(var(--pl-surface)); color: oklch(var(--pl-text)); }
.nav a[aria-current="page"] { background: oklch(var(--pl-surface-2)); color: oklch(var(--pl-text)); box-shadow: inset 2px 0 0 oklch(var(--pl-brand)); }
.nav-sep { height: 1px; background: oklch(var(--pl-border)); margin: 6px 8px; }
.side-foot { margin-top: auto; padding: 10px 8px 0; border-top: 1px solid oklch(var(--pl-border)); display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: oklch(var(--pl-muted)); }
.side-foot a { color: oklch(var(--pl-brand)); }
.main { min-width: 0; padding: 26px 32px 64px; display: flex; flex-direction: column; gap: 22px; }
.top { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.top .t { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lead { color: oklch(var(--pl-muted)); max-width: 70ch; }
.eyebrow { display: inline-flex; align-items: center; gap: .6rem; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: oklch(var(--pl-brand)); }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: oklch(var(--pl-brand)); }
.fila { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid oklch(var(--pl-border)); padding: 14px; gap: 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-sep { display: none; }
  .side-foot { margin-top: 0; flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
  .main { padding: 18px 16px 56px; }
}

/* Piezas */
.card { background: oklch(var(--pl-surface)); border: 1px solid oklch(var(--pl-border)); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile { background: oklch(var(--pl-surface)); border: 1px solid oklch(var(--pl-border)); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.tile span { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: oklch(var(--pl-muted)); font-weight: 600; }
.tile strong { font-family: var(--font-display); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile small { color: oklch(var(--pl-muted)); font-size: 12.5px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid oklch(var(--pl-border-strong)); color: oklch(var(--pl-muted)); white-space: nowrap; }
.pill.ok { color: oklch(var(--pl-ok)); border-color: oklch(var(--pl-ok) / .5); }
.pill.warn { color: oklch(var(--pl-warn)); border-color: oklch(var(--pl-warn) / .5); }
.pill.bad { color: oklch(var(--pl-bad)); border-color: oklch(var(--pl-bad) / .55); }
.pill.gold { color: oklch(var(--pl-brand)); border-color: oklch(var(--pl-brand) / .5); }
.pill.info { color: oklch(var(--pl-info)); border-color: oklch(var(--pl-info) / .5); }
.aviso { border: 1px solid oklch(var(--pl-border)); border-left: 3px solid oklch(var(--pl-info)); background: oklch(var(--pl-surface)); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.aviso.error { border-left-color: oklch(var(--pl-bad)); }
.aviso.ok { border-left-color: oklch(var(--pl-ok)); }
.vacio { color: oklch(var(--pl-muted)); padding: 18px; border: 1px dashed oklch(var(--pl-border)); border-radius: 10px; text-align: center; }

/* Controles */
.btn { border: 1px solid oklch(var(--pl-border-strong)); background: oklch(var(--pl-surface-2)); color: oklch(var(--pl-text)); border-radius: 8px; padding: 7px 12px; font-weight: 600; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: oklch(var(--pl-brand)); }
.btn.primario { background: oklch(var(--pl-brand)); border-color: oklch(var(--pl-brand)); color: oklch(var(--pl-accent-fg)); }
.btn.chico { padding: 4px 9px; font-size: 12px; }
.btn.peligro:hover { border-color: oklch(var(--pl-bad)); color: oklch(var(--pl-bad)); }
.btn:disabled { opacity: .5; cursor: default; }
label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: oklch(var(--pl-muted)); min-width: 0; }
label.campo.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; color: oklch(var(--pl-text)); }
input, select, textarea { background: oklch(var(--pl-bg)); border: 1px solid oklch(var(--pl-border-strong)); border-radius: 8px; padding: 7px 10px; font-size: 14px; min-width: 0; }
input[type="checkbox"] { width: 16px; height: 16px; padding: 0; accent-color: oklch(var(--pl-brand)); }
textarea { min-height: 70px; resize: vertical; }
form.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); align-items: end; }
form.form .ancho { grid-column: 1 / -1; }

/* Tablas */
.tabla { overflow-x: auto; border: 1px solid oklch(var(--pl-border)); border-radius: 12px; background: oklch(var(--pl-surface)); }
table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 13.5px; }
th, td { text-align: left; vertical-align: top; padding: 9px 12px; border-bottom: 1px solid oklch(var(--pl-border)); }
th { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: oklch(var(--pl-muted)); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td a, .enlace { color: oklch(var(--pl-brand)); font-weight: 600; }

/* Agenda */
.boxes { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); align-items: start; }
.box-col { display: flex; flex-direction: column; gap: 10px; }
.turno { background: oklch(var(--pl-surface)); border: 1px solid oklch(var(--pl-border)); border-left: 3px solid oklch(var(--pl-border-strong)); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.turno.e-en_box { border-left-color: oklch(var(--pl-info)); }
.turno.e-listo { border-left-color: oklch(var(--pl-brand)); }
.turno.e-entregado { border-left-color: oklch(var(--pl-ok)); }
.turno.e-cancelado, .turno.e-ausente { opacity: .55; }
.turno.e-a_reprogramar { border-left-color: oklch(var(--pl-bad)); }
.turno .hora { font-family: var(--font-mono); font-size: 13px; color: oklch(var(--pl-muted)); }
.turno .cab { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.turno .pat { font-family: var(--font-mono); font-weight: 600; font-size: 15px; }
.turno .acc { display: flex; flex-wrap: wrap; gap: 6px; }

/* Historia clínica */
.linea { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.linea li { display: grid; grid-template-columns: 92px 14px minmax(0, 1fr); gap: 0 10px; padding: 10px 0; border-bottom: 1px dashed oklch(var(--pl-border)); }
.linea li:last-child { border-bottom: 0; }
.linea time { font-family: var(--font-mono); font-size: 12px; color: oklch(var(--pl-muted)); padding-top: 2px; }
.linea .punto { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: oklch(var(--pl-border-strong)); }
.linea .punto.service, .linea .punto.reparacion { background: oklch(var(--pl-ok)); }
.linea .punto.recomendado, .linea .punto.hallazgo { background: oklch(var(--pl-warn)); }
.linea .punto.lectura_km, .linea .punto.entrega { background: oklch(var(--pl-info)); }
.linea .punto.encuesta { background: oklch(var(--pl-brand)); }
.linea .que { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.linea .que .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Ingreso */
.ingreso { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.ingreso .card { width: min(400px, 100%); gap: 16px; padding: 24px; }
.ingreso form { display: flex; flex-direction: column; gap: 12px; }

dialog { background: oklch(var(--pl-surface)); color: inherit; border: 1px solid oklch(var(--pl-border-strong)); border-radius: 14px; padding: 20px; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: oklch(.1 .03 262 / .7); }
dialog .cuerpo { display: flex; flex-direction: column; gap: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
