/* Tablero de tareas de Agencia Rueda. Mismo aspecto que el planner (rojo de la agencia #ff0000).
   Sin fuentes ni recursos externos. Sin estilos en línea: la CSP solo deja los de /static. */

:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --borde: #e3e1dc;
  --borde-fuerte: #cdcac3;
  --texto: #1d1d1b;
  --suave: #6b6a66;
  --acento: #ff0000;
  --acento-tinta: #ffffff;
  --acento-suave: #ffe5e5;
  --ok: #1f7a31;
  --peligro: #c62828;
  --sombra: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(0, 0, 0, .06);
  --sombra-fuerte: 0 8px 40px rgba(0, 0, 0, .22);
  --radio: 10px;
  --radio-sm: 6px;

  /* colores de cada columna (--f: fondo suave, --t: texto, --b: barra) */
  --c-gray-bg: #ebeae7;   --c-gray: #55534e;   --b-gray: #8d8a83;
  --c-blue-bg: #d9e8fb;   --c-blue: #1b4f91;   --b-blue: #2f7de1;
  --c-yellow-bg: #fbf0c7; --c-yellow: #7a5b00; --b-yellow: #e0b100;
  --c-green-bg: #d8f0dc;  --c-green: #1d6b2a;  --b-green: #2e9e48;

  --fuente: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--texto); font: 15px/1.5 var(--fuente); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; line-height: 1.25; }
h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #2f6fed; outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.suave { color: var(--suave); }
.chico { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.carga-inicial { padding: 40px 16px; text-align: center; color: var(--suave); }
.error { color: var(--peligro); font-size: 13px; }
.error:empty { display: none; }
.ico { flex: none; vertical-align: -3px; }

/* ---------- botones y campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 6px 14px; border: 1px solid var(--borde-fuerte); background: var(--surface); border-radius: var(--radio-sm); white-space: nowrap; font-weight: 500; text-decoration: none; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.grande { min-height: 52px; padding: 10px 22px; font-size: 17px; font-weight: 600; border-radius: var(--radio); }
.btn.primario { background: var(--acento); border-color: var(--acento); color: var(--acento-tinta); }
.btn.primario:hover:not(:disabled) { background: #d90000; }
.btn.fantasma { border-color: transparent; background: none; }
.btn.fantasma:hover:not(:disabled) { background: var(--surface-2); }
.btn[aria-pressed="true"].filtro-btn { background: var(--texto); border-color: var(--texto); color: #fff; }
.icono-btn { display: inline-grid; place-items: center; min-width: 38px; min-height: 38px; border: 0; background: none; border-radius: var(--radio-sm); color: var(--texto); }
.icono-btn:hover { background: var(--surface-2); }

.campo-input { width: 100%; min-height: 38px; border: 1px solid var(--borde-fuerte); background: var(--surface); border-radius: var(--radio-sm); padding: 7px 10px; }
.campo-input:focus { outline: none; border-color: var(--texto); box-shadow: 0 0 0 3px rgba(29, 29, 27, .15); }
.campo-input.con-error { border-color: var(--peligro); }
textarea.campo-input { resize: vertical; line-height: 1.45; }
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.campo > label { font-size: 14px; font-weight: 600; }
.campo .ayuda { font-size: 12px; color: var(--suave); }
.acciones { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- colores por columna ---------- */
.col-gray   { --f: var(--c-gray-bg);   --t: var(--c-gray);   --b: var(--b-gray); }
.col-blue   { --f: var(--c-blue-bg);   --t: var(--c-blue);   --b: var(--b-blue); }
.col-yellow { --f: var(--c-yellow-bg); --t: var(--c-yellow); --b: var(--b-yellow); }
.col-green  { --f: var(--c-green-bg);  --t: var(--c-green);  --b: var(--b-green); }

.pastilla { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; background: var(--f); color: var(--t); }
.cliente-chip { display: inline-flex; align-items: center; max-width: 100%; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.5; letter-spacing: .02em; background: var(--surface-2); color: var(--texto); border: 1px solid var(--borde-fuerte); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marca { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.5; color: #fff; white-space: nowrap; }
.marca.urgente { background: var(--acento); }
.marca.problema { background: #b26a00; }

/* ---------- páginas sueltas (login, errores) ---------- */
.centro { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; }
.tarjeta-centro { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--borde); border-radius: 16px; box-shadow: var(--sombra); padding: 36px 28px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.logo { width: 52px; height: 52px; border-radius: 14px; background: var(--acento); color: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.marca-texto { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--suave); }
.aviso-login { background: var(--c-yellow-bg); color: var(--c-yellow); padding: 8px 12px; border-radius: var(--radio-sm); font-size: 14px; }
.tarjeta-centro .btn.grande { width: 100%; }

/* ---------- página ---------- */
.pagina { max-width: 1400px; margin: 0 auto; padding: 0 20px 40px; }
.cabecera { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 22px 0 10px; flex-wrap: wrap; }
.cabecera-izq { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cabecera-der { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.actualizado { margin-right: 4px; }

.avisos { display: flex; flex-direction: column; gap: 8px; }
.avisos:not(:empty) { margin-bottom: 8px; }
.aviso-suave { background: var(--surface); border: 1px solid var(--borde-fuerte); padding: 10px 14px; border-radius: var(--radio); font-size: 14px; }
.aviso-error { border-color: var(--peligro); color: var(--peligro); }

.barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0 14px; }
.select-cliente { width: auto; min-width: 200px; max-width: 100%; }

/* ---------- tablero ---------- */
.tabs-cols { display: none; }
.tablero { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.columna { background: var(--surface-2); border-radius: var(--radio); padding: 10px; min-height: 60vh; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--b); transition: background .1s; }
.columna.suelta { background: var(--acento-suave); outline: 3px dashed var(--acento); outline-offset: -3px; }
.columna-cab { display: flex; align-items: center; gap: 8px; font-size: 15px; flex-wrap: wrap; }
.punto { width: 10px; height: 10px; border-radius: 999px; background: var(--b); }
.cuenta { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--borde-fuerte); font-size: 12px; font-weight: 700; }
.periodo { font-weight: 400; }
.lista { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.vacio { padding: 18px 8px; text-align: center; color: var(--suave); font-size: 14px; }

.tarjeta { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--borde); border-left: 4px solid var(--b); border-radius: 8px; padding: 10px 12px; box-shadow: var(--sombra); cursor: pointer; min-width: 0; }
.tarjeta:hover { border-color: var(--borde-fuerte); border-left-color: var(--b); }
.tarjeta[draggable="true"] { cursor: grab; }
.tarjeta.arrastrando { opacity: .4; }
.tarjeta-top { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.tarjeta-titulo { font-weight: 600; overflow-wrap: anywhere; line-height: 1.35; }
.tarjeta-meta { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--suave); }
.vence { display: inline-flex; align-items: center; gap: 4px; }
.vence.atrasada, .atrasada { color: var(--peligro); font-weight: 700; }

/* ---------- diálogos ---------- */
dialog { border: 0; padding: 0; color: var(--texto); background: var(--surface); }
dialog::backdrop { background: rgba(20, 20, 18, .45); }
dialog.modal { border-radius: 14px; box-shadow: var(--sombra-fuerte); width: min(560px, calc(100vw - 24px)); max-width: none; max-height: min(86vh, 760px); overflow: hidden; }
dialog.modal.chico { width: min(460px, calc(100vw - 24px)); }
dialog[open].modal, dialog[open].panel { animation: aparecer .14s ease-out; }
@keyframes aparecer { from { opacity: 0; } }
.modal-int { display: flex; flex-direction: column; max-height: min(86vh, 760px); }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--borde); }
.modal-cuerpo { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; overflow: auto; }

/* ---------- panel de la tarea ---------- */
dialog.panel { position: fixed; inset: 0 0 0 auto; margin: 0; height: 100dvh; max-height: none; width: min(560px, 100vw); max-width: none; border-radius: 0; box-shadow: var(--sombra-fuerte); overflow: hidden; }
.panel-raiz { height: 100%; }
.panel-int { display: flex; flex-direction: column; height: 100%; }
.panel-cab { padding: 14px 14px 12px 22px; border-bottom: 1px solid var(--borde); display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.panel-fila { display: flex; align-items: flex-start; gap: 10px; }
.panel-titulo { flex: 1; min-width: 0; font-size: 21px; overflow-wrap: anywhere; padding-top: 4px; }
.panel-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.panel-cuerpo { flex: 1; overflow: auto; padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 22px; }
.panel-seccion { display: flex; flex-direction: column; gap: 10px; }
.datos { display: flex; flex-direction: column; gap: 6px; }
.dato { display: flex; gap: 12px; }
.dato dt { width: 90px; flex: none; color: var(--suave); font-size: 13px; padding-top: 1px; }
.dato dd { min-width: 0; overflow-wrap: anywhere; }
.estados { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.estado-btn { border-left: 5px solid var(--b); }
.estado-btn[aria-pressed="true"] { background: var(--f); color: var(--t); font-weight: 700; opacity: 1; }
.texto-largo { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.texto-largo a, .com-texto a { color: var(--c-blue); text-decoration: underline; }
.hilo { display: flex; flex-direction: column; gap: 10px; }
.comentario { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.com-cab { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.com-quien { font-size: 12px; font-weight: 700; color: var(--suave); }
.com-texto { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- aviso flotante ---------- */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 14px; background: var(--texto); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--sombra-fuerte); max-width: calc(100vw - 24px); }
.toast-error { background: var(--peligro); }

/* ---------- pantallas medianas y celular: una columna por vez, con solapas ----------
   Arrastrar no anda en la mayoría de los celulares: ahí se abre la tarea y se usan los botones de estado. */
@media (max-width: 899px) {
  .pagina { padding: 0 12px 32px; }
  .tabs-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; background: var(--surface-2); padding: 3px; border-radius: 10px; }
  .tab { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 6px 2px; border-radius: 8px; color: var(--suave); font-weight: 600; font-size: 13px; min-height: 48px; line-height: 1.2; text-align: center; }
  .tab[aria-selected="true"] { background: var(--surface); color: var(--texto); box-shadow: var(--sombra); border-bottom: 3px solid var(--b); }
  .tab .cuenta { height: 18px; min-width: 18px; font-size: 11px; }
  .tablero { grid-template-columns: minmax(0, 1fr); }
  .columna { display: none; min-height: 40vh; }
  .columna.activa { display: flex; }
  .columna-cab { display: none; }
  .cabecera { padding: 14px 0 6px; flex-wrap: nowrap; align-items: flex-start; }
  .cabecera-der { flex: none; }
  .actualizado { display: none; }
  .barra { gap: 8px; }
  .select-cliente { flex: 1 1 100%; min-width: 0; }
  dialog.panel { width: 100vw; }
  dialog.modal, dialog.modal.chico { width: calc(100vw - 16px); max-height: 92dvh; }
  .modal-int { max-height: 92dvh; }
  .panel-cab { padding: 10px 8px 10px 16px; }
  .panel-cuerpo { padding: 16px 16px 40px; }
  .toast { bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  dialog[open].modal, dialog[open].panel { animation: none; }
  .columna { transition: none; }
}
