/* Panel CRM de Telar: herramienta interna sobria. Colores y tipografia de DESIGN.md de telar-web. */
:root {
  --ink: #111111;
  --ink-soft: #2e2e2e;
  --muted: #666666;
  --thread: #9a9a9a;
  --control: #8c8c8c;
  --rule: #dcdcdc;
  --mist: #ededed;
  --fog: #f6f6f6;
  --paper: #ffffff;
  --error: #b42318;
  --sans: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Syne', 'Rubik', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); }
body { font-family: var(--sans); font-size: 16px; line-height: 1.5; min-height: 100vh; overflow-x: hidden; }
a { color: var(--ink); }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 28px; margin: 24px 0 16px; }
h2 { font-size: 20px; margin: 28px 0 12px; }
h3 { font-size: 17px; margin: 0 0 4px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.pequeno { font-size: 14px; }
.tnum { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.contenedor { max-width: 960px; margin: 0 auto; padding: 0 16px 64px; }

/* Cabecera */
.cabecera { border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 10; }
.cabecera-fila { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.marca { font-family: var(--display); font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -0.02em; }
.marca span { font-weight: 400; color: var(--muted); font-family: var(--sans); font-size: 14px; }
.cuenta { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cuenta-email { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55vw; }
.menu { max-width: 960px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
.menu a { padding: 10px 12px; text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; }
.menu a[aria-current="page"] { border-bottom-color: var(--ink); font-weight: 500; }
.badge { background: var(--ink); color: var(--paper); font-size: 12px; border-radius: 999px; padding: 1px 8px; font-variant-numeric: tabular-nums; }

/* Botones y campos */
.boton { font: inherit; font-size: 15px; font-weight: 500; min-height: 44px; padding: 8px 16px; border-radius: 2px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); cursor: pointer; }
.boton:hover { background: var(--ink-soft); }
.boton:disabled { opacity: 0.5; cursor: default; }
.boton-secundario { background: var(--paper); color: var(--ink); }
.boton-secundario:hover { background: var(--fog); }
.boton-fino { min-height: 44px; padding: 8px 14px; font-size: 14px; }
.boton-peligro { background: var(--paper); color: var(--error); border-color: var(--error); }
.boton-peligro:hover { background: #fdf1f0; }
.enlace-boton { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--ink); border-radius: 2px; text-decoration: none; font-weight: 500; }
.campo { display: block; width: 100%; font: inherit; font-size: 16px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--control); border-radius: 2px; background: var(--paper); color: var(--ink); }
.campo:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.control-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 15px; }
.fila-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.error { color: var(--error); font-size: 15px; margin: 8px 0; }
.aviso { border: 1px solid var(--rule); background: var(--fog); padding: 12px 14px; border-radius: 2px; margin: 12px 0; font-size: 15px; }
.aviso-rojo { border-color: var(--error); color: var(--error); background: #fdf1f0; }
.cargando { color: var(--muted); padding: 24px 0; }

/* Login */
.login { max-width: 380px; margin: 48px auto 0; }
.login form { display: grid; gap: 14px; margin-top: 20px; }

/* Inicio */
.metricas { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin: 16px 0 8px; }
.metrica { background: var(--paper); padding: 14px; min-width: 0; }
.metrica .valor { font-family: var(--display); font-weight: 700; font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.metrica .rotulo { font-size: 13px; color: var(--muted); }
.metrica-enlace { text-decoration: none; }
.metrica-enlace:hover { background: var(--fog); }
.barra-fila { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--mist); }
.barra-rotulo { font-size: 15px; min-width: 0; }
.barra { height: 10px; background: var(--mist); margin-top: 4px; }
.barra > span { display: block; height: 100%; background: var(--ink); min-width: 0; }
.barra-cifra { text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }

/* Filtros y listas */
.filtros { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 12px 0 8px; }
.filtros-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.resumen-lista { font-size: 14px; color: var(--muted); margin: 8px 0; }
.lista { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.lista li { border-bottom: 1px solid var(--rule); }
.lista a { display: block; padding: 12px 0; text-decoration: none; min-width: 0; }
.lista a:hover h3 { text-decoration: underline; }
.linea { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.etiqueta { display: inline-block; font-size: 12px; font-weight: 500; border: 1px solid var(--control); border-radius: 2px; padding: 0 6px; margin-right: 4px; color: var(--ink-soft); }
.etiqueta-piloto { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Ficha */
.datos { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 8px 0; border-top: 1px solid var(--rule); }
.datos div { display: grid; grid-template-columns: 1fr; padding: 8px 0; border-bottom: 1px solid var(--mist); }
.datos dt { font-size: 13px; color: var(--muted); }
.datos dd { margin: 0; overflow-wrap: anywhere; }
.catalogo { display: grid; gap: 12px; }
.catalogo img, .foto { width: 100%; height: auto; border-radius: 4px; background: var(--fog); display: block; }
.sin-imagen { background: var(--fog); border: 1px dashed var(--control); border-radius: 4px; padding: 24px; text-align: center; color: var(--muted); font-size: 15px; }
.linea-tiempo { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 1px solid var(--rule); }
.linea-tiempo li { position: relative; padding: 0 0 18px 4px; min-width: 0; }
.linea-tiempo li::before { content: ''; position: absolute; left: -21px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--paper); border: 1px solid var(--ink); }
.linea-tiempo .cuerpo { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; background: var(--fog); padding: 10px; border-radius: 2px; margin-top: 6px; }
.linea-tiempo summary { cursor: pointer; font-size: 14px; color: var(--muted); padding: 4px 0; }

/* Cola */
.tarjeta { border: 1px solid var(--rule); border-radius: 4px; padding: 16px; margin: 12px 0; background: var(--paper); min-width: 0; }
.tarjeta-cabecera { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.tarjeta h3 a, .grilla-catalogos h3 a { text-decoration: none; }
.tarjeta .asunto { font-weight: 500; margin: 8px 0; overflow-wrap: anywhere; }
.tarjeta .cuerpo { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; background: var(--fog); padding: 12px; border-radius: 2px; margin: 8px 0; }
.tarjeta .estado-aprobado { font-size: 15px; background: var(--fog); padding: 10px 12px; border-radius: 2px; margin: 8px 0; }
.grilla-catalogos { display: grid; grid-template-columns: 1fr; gap: 12px; }
.grilla-catalogos img { width: 100%; height: auto; border-radius: 4px; display: block; background: var(--fog); }

@media (min-width: 640px) {
  .metricas { grid-template-columns: repeat(4, 1fr); }
  .filtros-fila { grid-template-columns: 1fr 1fr 1fr; }
  .datos div { grid-template-columns: 180px minmax(0, 1fr); }
  .catalogo { grid-template-columns: minmax(0, 320px) 1fr; align-items: start; }
  .grilla-catalogos { grid-template-columns: 1fr 1fr; }
  .lista a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
}
.enlace-boton[aria-disabled="true"] { pointer-events: none; opacity: .5; }
.fila-material { margin-top: 16px; }
