/* Portal de rentas. Sistema visual del boceto: fondo blanco, grises puros,
   un color de accion, status siempre con palabra, cuatro tamanos de letra. */
@font-face { font-family: "Inter Tight"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fuentes/inter-tight-latin.woff2") format("woff2"); }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 600; font-display: swap; src: url("fuentes/unbounded-600-exterioriza.woff2") format("woff2"); }

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --lane: #F4F4F4;
  --line: #E4E4E4;
  --line-strong: #8A8A8A;      /* borde de campo: 3.5:1 */
  --fg: #1F1F1F;
  --fg-muted: #5C5C5C;         /* 6.7:1 sobre blanco */
  --action: #0A766B;           /* 5.4:1 con blanco */
  --action-deep: #085E55;
  --tint: #E3F2EF;
  --good: #15803D;
  --good-deep: #116932;
  --good-tint: #EDF7F0;
  --warn: #92400E;
  --warn-tint: #FDF6EC;
  --bad: #B91C1C;
  --bad-tint: #FDF1F1;
  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Unbounded", "Inter Tight", system-ui, sans-serif;
  --t-s: 13px; --t-m: 14.5px; --t-l: 17px; --t-xl: 22px;
  --panel: 420px;
  --ease: cubic-bezier(.16,1,.3,1);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--t-m)/1.4 var(--font); -webkit-font-smoothing: antialiased; }
::selection { background: var(--tint); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--action-deep); }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

.pagina { transition: padding-right .28s var(--ease); }

/* Encabezado */
.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1320px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 20px; }
.brand { font: 600 14px/1 var(--display); letter-spacing: -.01em; color: var(--fg); text-decoration: none; }
.tabs { display: flex; gap: 2px; background: var(--lane); padding: 3px; border-radius: 999px; }
.tab { white-space: nowrap; padding: 6px 14px; border-radius: 999px; font-weight: 500; color: var(--fg-muted); text-decoration: none; display: inline-flex; align-items: center; }
.tab:hover { color: var(--fg); }
.tab[aria-current="page"] { background: var(--bg); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.10); }
.cuenta { margin-left: auto; position: relative; }
.cuenta summary { list-style: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; font-weight: 500; border: 1px solid var(--line); white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cuenta summary::-webkit-details-marker { display: none; }
.cuenta[open] summary, .cuenta summary:hover { background: var(--lane); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.10); padding: 6px; display: grid; z-index: 6; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; background: none; border-radius: 8px; color: var(--fg); text-decoration: none; font-weight: 500; }
.menu a:hover, .menu button:hover { background: var(--lane); }
.menu form { margin: 0; }
.menu-rol { margin: 0; padding: 6px 10px 8px; color: var(--fg-muted); font-size: var(--t-s); border-bottom: 1px solid var(--line); }

main { max-width: 1320px; margin: 0 auto; padding: 16px 24px 48px; }
.cab { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cab .acciones { margin-left: auto; display: flex; gap: 8px; align-items: center; }
h1 { font: 600 var(--t-l)/1.2 var(--font); letter-spacing: -.01em; margin: 0; }
h1 span { font-weight: 400; color: var(--fg-muted); }
h2 { font: 600 var(--t-m)/1.2 var(--font); margin: 0; }
.nota { color: var(--fg-muted); font-size: var(--t-s); }

/* Avisos: se quedan arriba del contenido y no tapan lo que la persona escribio */
.avisos { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.avisos:empty { display: none; }
.avisos .aviso { margin: 12px 0 0; display: flex; gap: 12px; align-items: baseline; }
.avisos .aviso button { margin-left: auto; border: 0; background: none; font-weight: 600; text-decoration: underline; color: inherit; padding: 0; }
.aviso { background: var(--bad-tint); color: var(--bad); border-radius: 10px; padding: 9px 12px; font-weight: 600; margin: 0 0 12px; }
.aviso.warn { background: var(--warn-tint); color: var(--warn); }
.aviso a { color: inherit; }
.listo { background: var(--good-tint); color: var(--good-deep); border-radius: 10px; padding: 9px 12px; font-weight: 600; margin: 0 0 12px; }

/* Filtros */
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.buscar { position: relative; width: min(280px, 100%); }
.buscar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--fg-muted); pointer-events: none; }
.buscar input { height: 36px; width: 100%; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 14px 0 34px; background: var(--bg); }
input::placeholder, textarea::placeholder { color: var(--fg-muted); opacity: 1; }
.filtros select { height: 36px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 12px; background: var(--bg); }
.filtros input[type=date] { height: 36px; width: auto; border-radius: 999px; }
.filtros label { display: inline-flex; align-items: center; gap: 6px; color: var(--fg-muted); font-size: var(--t-s); font-weight: 500; }

/* Tablas */
.tabla-caja { border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
th { font-size: var(--t-s); font-weight: 600; color: var(--fg-muted); background: var(--lane); white-space: nowrap; }
th a { color: inherit; text-decoration: none; }
th a:hover, th a[aria-current="true"] { color: var(--fg); }
td.der, th.der { text-align: right; }
tbody tr[data-abrir] { cursor: pointer; }
tbody tr[data-abrir]:hover { background: #FAFAFA; }
.clave { background: var(--lane); border-radius: 6px; padding: 2px 7px; font-weight: 700; font-size: var(--t-s); white-space: nowrap; color: var(--fg); text-decoration: none; }
a.clave:hover { background: var(--line); }
.enlace-fila { color: var(--fg); font-weight: 600; text-decoration: none; }
.enlace-fila:hover { text-decoration: underline; }
.vacio { text-align: center; color: var(--fg-muted); padding: 40px 12px; }
.vacio p { margin: 0 0 12px; }
.cambio { margin: 0; }
.cambio + .cambio { margin-top: 2px; }
.tenue { color: var(--fg-muted); }
.sin-corte { white-space: nowrap; }

/* Status: siempre con palabra, el color solo acompana */
.estado { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: var(--t-s); white-space: nowrap; }
.punto { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.estado.activo { color: var(--good-deep); }
.estado.mantenimiento { color: var(--warn); }
.estado.retirado, .estado.inactivo { color: var(--fg-muted); }
.estado.retirado .punto, .estado.inactivo .punto { background: none; border: 1.5px solid currentColor; }

/* Panel lateral */
.velo { position: fixed; inset: 0; background: rgba(0,0,0,.2); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9; }
.velo.on { opacity: 1; pointer-events: auto; }
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--panel), 100vw); background: var(--bg); border-left: 1px solid var(--line); transform: translateX(100%); visibility: hidden; transition: transform .28s var(--ease), visibility 0s .28s; z-index: 10; display: flex; flex-direction: column; }
.panel.on { transform: none; visibility: visible; transition: transform .28s var(--ease), visibility 0s; box-shadow: -8px 0 24px rgba(0,0,0,.06); }
.panel-head { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.panel-head h2 { font: 700 var(--t-l)/1.25 var(--font); margin: 0; letter-spacing: -.01em; }
.panel-head p { margin: 2px 0 0; color: var(--fg-muted); }
.cerrar { margin-left: auto; border: 0; background: var(--lane); border-radius: 50%; width: 32px; height: 32px; display: grid; place-items: center; flex: none; }
.cerrar:hover { background: var(--line); }
.panel-body { padding: 14px 18px 24px; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.seccion { margin-top: 18px; }
.seccion > h3 { font: 600 var(--t-s)/1.2 var(--font); color: var(--fg-muted); margin: 0 0 8px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 16px; margin: 0; }
dt { color: var(--fg-muted); }
dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.botones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.historia { list-style: none; margin: 0; padding: 0; }
.historia li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.historia li:last-child { border-bottom: 0; }
.historia .quien { color: var(--fg-muted); font-size: var(--t-s); }

/* Formularios */
.forma { display: grid; gap: 12px; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo { display: grid; gap: 4px; font-size: var(--t-s); color: var(--fg-muted); font-weight: 500; border: 0; padding: 0; margin: 0; min-width: 0; }
.campo .rot { display: block; }
.campo .opc { font-weight: 400; }
.campo .ayuda { font-weight: 400; }
input[type=text], input[type=date], input[type=email], input[type=password], select, textarea { height: 38px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 10px; background: var(--bg); color: var(--fg); font-size: 15px; width: 100%; }
textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--action); outline-offset: 0; border-color: var(--action); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-weight: 600; }
fieldset.grupo { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; display: grid; gap: 12px; }
fieldset.grupo legend { padding: 0 6px; font-size: var(--t-s); font-weight: 600; color: var(--fg-muted); }
.btn { height: 42px; border: 0; border-radius: 10px; background: var(--action); color: #fff; font-weight: 600; padding: 0 16px; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.btn:hover { background: var(--action-deep); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn.sec2 { background: var(--bg); color: var(--fg); border: 1px solid var(--line-strong); height: 38px; font-size: var(--t-m); }
.btn.sec2:hover { background: var(--lane); }
.btn.peligro { background: var(--bg); color: var(--bad); border: 1px solid var(--bad); height: 38px; font-size: var(--t-m); }
.btn.peligro:hover { background: var(--bad-tint); }
.txt { border: 0; background: none; padding: 6px 0; color: var(--action-deep); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Entrar y avisos de pagina completa */
.entrar { max-width: 380px; margin: 8vh auto 0; display: grid; gap: 14px; }

@media (min-width: 1100px) {
  body.con-panel .pagina { padding-right: var(--panel); }
  .velo { display: none; }
}
@media (max-width: 700px) {
  .top-in { padding: 8px 16px; gap: 8px 10px; flex-wrap: wrap; }
  main { padding: 14px 16px 40px; }
  .avisos { padding: 0 16px; }
  .panel { border-left: 0; }
  .buscar { width: 100%; }
  .dos { grid-template-columns: 1fr; }
  .cab .acciones { margin-left: 0; width: 100%; }
}
/* Telefono: cada fila de tabla se vuelve una ficha de dos o tres renglones; nada se corta a lo ancho. */
@media (max-width: 700px) {
  .tabla-caja { overflow-x: visible; }
  table thead { display: none; }
  table, tbody { display: block; }
  tbody tr { display: grid; gap: 3px 10px; padding: 11px 12px; border-bottom: 1px solid var(--line); align-items: baseline; }
  tbody tr:last-child { border-bottom: 0; }
  tbody td { display: block; padding: 0; border: 0; min-width: 0; text-align: left; }
  tbody td.vacio { padding: 28px 0; text-align: center; }
  .t-espacios tbody tr { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "clave ubi ubi" "tipo zona precio" "estado estado estado"; }
  .c-clave { grid-area: clave; } .c-ubi { grid-area: ubi; } .c-tipo { grid-area: tipo; } .c-zona { grid-area: zona; }
  .c-precio { grid-area: precio; text-align: right; } .t-espacios .c-estado { grid-area: estado; }
  .c-tipo, .c-zona { color: var(--fg-muted); font-size: var(--t-s); }
  .t-usuarios tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nombre estado" "correo rol"; }
  .c-nombre { grid-area: nombre; } .t-usuarios .c-estado { grid-area: estado; } .c-correo { grid-area: correo; overflow-wrap: anywhere; } .c-rol { grid-area: rol; }
  .c-correo, .c-rol { color: var(--fg-muted); font-size: var(--t-s); }
  .t-bitacora tbody tr { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "que cuando" "sobre quien" "cambios cambios"; }
  .c-que { grid-area: que; font-weight: 600; } .c-cuando { grid-area: cuando; } .c-sobre { grid-area: sobre; } .c-quien { grid-area: quien; } .c-cambios { grid-area: cambios; overflow-wrap: anywhere; }
  .c-cuando, .c-quien { color: var(--fg-muted); font-size: var(--t-s); text-align: right; }
}
@media (pointer: coarse), (max-width: 700px) {
  .clave { padding: 6px 9px; }
  .tab { min-height: 44px; padding: 0 16px; }
  .cuenta summary { min-height: 44px; display: flex; align-items: center; }
  .menu a, .menu button { padding: 13px 10px; }
  .buscar input, .filtros select, .filtros input[type=date], input[type=text], input[type=date], input[type=email], input[type=password], select { height: 44px; font-size: 16px; }
  textarea { font-size: 16px; }
  .cerrar { width: 44px; height: 44px; }
  .btn, .btn.sec2, .btn.peligro { height: 48px; }
  .txt { padding: 12px 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
