@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  --lima: #c2d442;
  --verde: #78b845;
  --profundo: #4a7a1e;
  --profundo-hover: #2f5212;
  --tinta: #222222;
  --grafito: #666666;
  --texto2: #555555;
  --niebla: #f4f8e6;
  --linea: #e2e8d2;
  --borde: #dfe6cf;
  --campo: #b9c3a6;
  --fondo: #fbfcf8;
  --error: #9a2b12;
  --radio: 8px;
  --titulos: 'Poppins', Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Source Sans 3', Arial, sans-serif; font-size: 16px; line-height: 1.45; color: var(--tinta); background: var(--fondo); }
a { color: var(--profundo); }
:focus-visible { outline: 3px solid var(--verde); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--titulos); margin: 0; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.4px; }
h2 { font-size: 19px; font-weight: 600; }
.franja { height: 6px; background: var(--lima); }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Formularios */
label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 5px; }
input, select, textarea { width: 100%; font: inherit; font-size: 15px; color: var(--tinta); padding: 9px 11px; border: 1.5px solid var(--campo); border-radius: 0; background: #fff; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--profundo); box-shadow: 0 0 0 3px rgba(120, 184, 69, 0.25); }
textarea { resize: vertical; }
.opcional { font-weight: 400; color: var(--grafito); }
.ayuda { font-size: 13px; color: var(--grafito); margin: 4px 0 0; }
.error { color: var(--error); font-weight: 600; margin: 12px 0 0; min-height: 0; }
.error:empty { display: none; }
.boton { display: inline-block; font-family: var(--titulos); font-weight: 600; font-size: 15px; text-decoration: none; background: var(--profundo); color: #fff; border: 0; border-radius: var(--radio); padding: 11px 20px; cursor: pointer; }
.boton:hover { background: var(--profundo-hover); color: #fff; }
.boton:disabled { opacity: 0.6; cursor: progress; }
.boton.claro { background: #fff; color: var(--tinta); box-shadow: inset 0 0 0 1.5px var(--tinta); }
.boton.claro:hover { background: var(--niebla); }
.boton.chico { font-size: 13px; padding: 6px 12px; }
.campos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.campos.tres { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.campos .todo { grid-column: 1 / -1; }

/* Acceso */
.acceso { min-height: calc(100vh - 6px); display: grid; place-items: center; padding: 32px 16px; }
.acceso-caja { width: 100%; max-width: 400px; }
.acceso-logo { height: 44px; display: block; margin-bottom: 28px; }
.acceso form { background: #fff; border: 1px solid var(--borde); padding: 28px; }
.acceso h1 { font-size: 26px; }
.acceso .sub { color: var(--texto2); margin: 6px 0 20px; }
.acceso label { margin-top: 14px; }
.acceso .boton { width: 100%; margin-top: 20px; }
.acceso .pie { font-size: 13px; color: var(--grafito); margin: 16px 0 0; }

/* Barra superior */
.tope { display: flex; align-items: center; gap: 28px; padding: 10px 24px; background: #fff; border-bottom: 1px solid var(--linea); flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--tinta); }
.marca img { height: 34px; }
.marca span { font-family: var(--titulos); font-weight: 600; font-size: 15px; padding-left: 10px; border-left: 1px solid var(--borde); }
#nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#nav a { text-decoration: none; color: var(--tinta); font-weight: 600; font-size: 15px; padding: 8px 12px; border-radius: var(--radio); }
#nav a:hover { background: var(--niebla); }
#nav a[aria-current="page"] { background: var(--niebla); color: var(--profundo); box-shadow: inset 0 -3px 0 var(--lima); border-radius: var(--radio) var(--radio) 0 0; }
.yo { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.yo .rol { font-size: 12px; font-weight: 700; background: var(--lima); padding: 2px 8px; border-radius: 99px; }
.yo a, .yo button { font: inherit; font-size: 14px; color: var(--profundo); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }

main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; }
.cab { margin-bottom: 20px; }
.cab .sub { color: var(--texto2); margin: 4px 0 0; max-width: 760px; }
.tarjeta { background: #fff; border: 1px solid var(--borde); padding: 22px; margin-bottom: 24px; }
.tarjeta h2 { margin-bottom: 14px; }
.tarjeta .boton { margin-top: 16px; }
.tarjeta.angosta { max-width: 420px; }
.tarjeta.angosta label { margin-top: 12px; }

/* Bandeja */
.pestanas { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.pestanas button { font: inherit; font-size: 14px; font-weight: 600; background: #fff; border: 1.5px solid var(--borde); border-radius: 99px; padding: 6px 14px; cursor: pointer; color: var(--tinta); }
.pestanas button .n { font-weight: 400; color: var(--grafito); margin-left: 4px; font-variant-numeric: tabular-nums; }
.pestanas button[aria-selected="true"] { background: var(--tinta); border-color: var(--tinta); color: #fff; }
.pestanas button[aria-selected="true"] .n { color: #ddd; }
.filtros { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tabla-envoltura { overflow-x: auto; background: #fff; border: 1px solid var(--borde); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--linea); vertical-align: top; }
thead th { font-size: 13px; color: var(--grafito); font-weight: 600; background: var(--fondo); white-space: nowrap; }
table.bandeja tbody tr { cursor: pointer; }
table.bandeja tbody tr:hover { background: var(--niebla); }
table.bandeja tbody tr:focus-visible { outline-offset: -3px; }
td.fecha { white-space: nowrap; color: var(--grafito); font-variant-numeric: tabular-nums; }
td .nom { font-weight: 600; }
td .sec { color: var(--grafito); font-size: 13px; }
td.res { max-width: 360px; color: var(--texto2); }
.vacio { padding: 28px; text-align: center; color: var(--grafito); background: #fff; border: 1px solid var(--borde); border-top: 0; margin: 0; }

.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; white-space: nowrap; background: #eef0ea; color: #3d4236; }
.pill.Nueva, .pill[data-e="Nueva"] { background: var(--lima); color: var(--tinta); }
.pill[data-e="Por cotizar"] { background: #ffe9a8; color: #5c4400; }
.pill[data-e="Contactado"] { background: #dbeafe; color: #1e3a6e; }
.pill[data-e="Cotizado"] { background: #e3defc; color: #3b2a7a; }
.pill[data-e="En negociación"] { background: #fde2cc; color: #6a3410; }
.pill[data-e="Emitida"] { background: var(--profundo); color: #fff; }
.pill[data-e="Perdida"] { background: #eceae6; color: #77736b; }
.etiqueta-agente { display: inline-block; font-size: 11px; font-weight: 700; color: var(--profundo); border: 1px solid var(--profundo); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }

/* Ficha lateral */
.velo { position: fixed; inset: 0; background: rgba(34, 34, 34, 0.35); z-index: 30; }
.ficha { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: #fff; z-index: 31; overflow-y: auto; padding: 26px 28px 40px; box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15); border-top: 6px solid var(--lima); }
.ficha:focus { outline: none; }
.cerrar { position: absolute; top: 14px; right: 16px; font-size: 28px; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--grafito); padding: 4px 8px; }
.ficha h2 { font-size: 22px; padding-right: 36px; }
.ficha .meta { color: var(--grafito); font-size: 14px; margin: 4px 0 14px; }
.contacto { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.contacto a { font-size: 14px; font-weight: 600; text-decoration: none; border: 1.5px solid var(--borde); border-radius: var(--radio); padding: 6px 12px; color: var(--tinta); }
.contacto a:hover { border-color: var(--profundo); color: var(--profundo); }
.bloque { border-top: 1px solid var(--linea); padding-top: 16px; margin-top: 16px; }
.bloque h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; }
dl.datos { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.datos dt { color: var(--grafito); }
dl.datos dd { margin: 0; overflow-wrap: anywhere; }
.controles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; }
.controles .boton { grid-column: 1 / -1; justify-self: start; }
.hilo { list-style: none; padding: 0; margin: 0 0 12px; }
.hilo li { padding: 10px 0; border-bottom: 1px solid var(--linea); font-size: 14px; }
.hilo li .quien { font-weight: 600; }
.hilo li .cuando { color: var(--grafito); font-size: 12px; margin-left: 6px; }
.hilo li.cambio { color: var(--grafito); font-size: 13px; padding: 6px 0; }
.hilo li.cambio .quien { font-weight: 400; }
.hilo li .texto { white-space: pre-wrap; margin-top: 2px; }

/* Ligas */
.ligas { display: grid; gap: 10px; max-width: 860px; }
.liga { display: grid; grid-template-columns: 200px 1fr auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--borde); padding: 14px 16px; }
.liga strong { font-family: var(--titulos); font-weight: 600; }
.liga code { font-size: 13px; color: var(--texto2); overflow-wrap: anywhere; }

/* Usuarios */
.temporal { background: #fff; border-left: 5px solid var(--lima); padding: 16px 18px; margin-bottom: 20px; }
.temporal code { font-size: 17px; font-weight: 700; background: var(--niebla); padding: 2px 8px; }
table.usuarios td .acciones { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
tr.inactivo td { color: #9a9a9a; }

.aviso { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--tinta); color: #fff; padding: 10px 18px; border-radius: var(--radio); font-weight: 600; z-index: 40; }

@media (max-width: 860px) {
  .filtros, .campos.tres { grid-template-columns: 1fr 1fr; }
  .filtros input { grid-column: 1 / -1; }
  .yo { width: 100%; justify-content: flex-end; }
  .liga { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .campos, .filtros, .campos.tres, .controles { grid-template-columns: 1fr; }
  table.bandeja thead { display: none; }
  table.bandeja tr { display: grid; grid-template-columns: 1fr; padding: 10px 12px; border-bottom: 1px solid var(--linea); }
  .tope { gap: 8px 16px; padding: 10px 14px; }
  .marca { order: 1; }
  .yo { order: 2; width: auto; flex: 1; justify-content: flex-end; gap: 10px; }
  .yo #yoNombre { display: none; }
  #nav { order: 3; flex: none; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  #nav a { white-space: nowrap; }
  table.bandeja td { border: 0; padding: 2px 0; }
  table.bandeja td.res, table.bandeja td.resp { grid-column: 1 / -1; }
  dl.datos { grid-template-columns: 1fr; }
  dl.datos dt { margin-top: 6px; }
  main { padding: 20px 14px 50px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
