:root {
  --fondo: #f6f7f9;
  --superficie: #ffffff;
  --texto: #1b1f24;
  --suave: #5b6470;
  --borde: #dde1e6;
  --acento: #1f5fbf;
  --acento-texto: #ffffff;
  --error: #b42318;
  --inactivo: #8a929c;
  --etiqueta: #e8eefb;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #111418;
    --superficie: #1a1e24;
    --texto: #e7eaee;
    --suave: #a2abb6;
    --borde: #2d333b;
    --acento: #5b9cf5;
    --acento-texto: #0b1220;
    --error: #ff8a80;
    --inactivo: #7b838d;
    --etiqueta: #22324d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo);
  color: var(--texto);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; }
[hidden] { display: none !important; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.empresa { margin: 0; color: var(--suave); font-size: .85rem; font-weight: 600; letter-spacing: .02em; }
.ayuda { color: var(--suave); font-size: .85rem; margin: .25rem 0 .75rem; }
.error { color: var(--error); font-size: .9rem; min-height: 1.2em; margin: .5rem 0; }

label { display: block; margin: 0 0 .9rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=search] {
  display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem;
  font: inherit; color: inherit; background: var(--superficie);
  border: 1px solid var(--borde); border-radius: 8px;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
input[readonly] { color: var(--suave); }

button { font: inherit; cursor: pointer; border-radius: 8px; padding: .55rem 1rem; border: 1px solid transparent; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primario { background: var(--acento); color: var(--acento-texto); font-weight: 600; }
.secundario { background: transparent; color: var(--texto); border-color: var(--borde); }
.enlace { background: none; color: var(--acento); padding: .2rem .4rem; }

.ingreso { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.tarjeta {
  width: 100%; max-width: 380px; background: var(--superficie);
  border: 1px solid var(--borde); border-radius: 14px; padding: 2rem 1.5rem;
}
.tarjeta h1 { margin: .25rem 0 0; }
.tarjeta .primario { width: 100%; margin-top: .5rem; }

.barra {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem; background: var(--superficie); border-bottom: 1px solid var(--borde);
}
.sesion { display: flex; align-items: center; gap: .75rem; color: var(--suave); font-size: .9rem; }
.contenido { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.herramientas { display: flex; gap: .75rem; align-items: center; }
.herramientas input { margin: 0; flex: 1; }

.tabla-envoltura { overflow-x: auto; background: var(--superficie); border: 1px solid var(--borde); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
th { font-size: .8rem; color: var(--suave); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tr.inactivo td { color: var(--inactivo); }
td.botones { white-space: nowrap; text-align: right; }
.etiqueta { background: var(--etiqueta); color: var(--acento); font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; }

dialog {
  width: min(460px, calc(100vw - 2rem)); border: 1px solid var(--borde); border-radius: 14px;
  background: var(--superficie); color: var(--texto); padding: 1.5rem;
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
fieldset { border: 1px solid var(--borde); border-radius: 10px; margin: 0 0 .9rem; padding: .6rem .9rem .2rem; }
legend { font-weight: 500; padding: 0 .3rem; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.casilla { display: flex; align-items: center; gap: .4rem; font-weight: 400; margin: 0 0 .6rem; }
.fila-campo { display: flex; gap: .5rem; align-items: stretch; margin-top: .3rem; }
.fila-campo input { margin: 0; font-family: ui-monospace, Menlo, monospace; }
.acciones { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }

.aviso {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--texto); color: var(--fondo); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem;
}

@media (max-width: 640px) {
  .herramientas { flex-direction: column; align-items: stretch; }
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr { border-bottom: 1px solid var(--borde); padding: .4rem 0; }
  td { border: 0; padding: .2rem .8rem; }
  td.botones { text-align: left; }
}
