/* Panel maestro: mismo lenguaje visual que el login de AUTIQ (oscuro, acento lima). */
:root {
  --bg: #11171a;
  --card: #182124;
  --card-2: #1e292d;
  --line: #2c3a3c;
  --line-strong: #3b4c4e;
  --text: #edf4ea;
  --text-2: #a7b9ad;
  --text-3: #7f9187;
  --accent: #a5ef75;
  --on-accent: #172316;
  --ok: #a5ef75;
  --ok-tint: rgb(165 239 117 / 0.13);
  --warn: #f5c062;
  --warn-tint: rgb(245 192 98 / 0.13);
  --bad: #ff8a7a;
  --bad-tint: rgb(255 138 122 / 0.13);
  --radius: 14px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  min-height: 100%;
}
body {
  background: radial-gradient(ellipse at 20% -10%, rgb(116 191 69 / 0.13), transparent 50%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
[hidden] {
  display: none !important;
}
h1,
h2 {
  margin: 0;
  letter-spacing: -0.01em;
}
.muted {
  color: var(--text-2);
}
.small {
  font-size: 12.5px;
}
.eyebrow {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 140ms,
    border-color 140ms,
    transform 120ms var(--ease);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn--sm {
  height: 34px;
  padding: 0 12px;
  font-size: 13px;
}
.btn--block {
  width: 100%;
}
.btn--accent {
  background: var(--accent);
  color: var(--on-accent);
}
.btn--accent:hover {
  background: #b6f48e;
}
.btn--ghost {
  border-color: var(--line-strong);
  background: rgb(255 255 255 / 0.02);
}
.btn--ghost:hover {
  border-color: #56696b;
  background: rgb(255 255 255 / 0.05);
}
.btn--danger {
  border-color: rgb(255 138 122 / 0.35);
  color: var(--bad);
}
.btn--danger:hover {
  background: var(--bad-tint);
}
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover {
  background: rgb(255 255 255 / 0.06);
  color: var(--text);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Campos */
.field {
  display: grid;
  gap: 6px;
}
.field > span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #121a1c;
  color: var(--text);
  font: inherit;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(165 239 117 / 0.15);
}
.error {
  margin: 0;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--bad-tint);
  color: var(--bad);
  font-size: 13px;
}

/* Entrar */
.auth {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.auth__card {
  display: grid;
  gap: 14px;
  width: min(400px, 100%);
  padding: 30px 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgb(24 33 36 / 0.92);
  box-shadow: 0 24px 70px rgb(0 0 0 / 0.35);
}
.auth__logo {
  width: 120px;
  margin-bottom: 6px;
}
.auth__card h1 {
  font-size: 24px;
  line-height: 1.2;
}
.auth__card p {
  margin: -4px 0 4px;
}

/* Panel */
.app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 64px;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.top__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top__brand img {
  height: 36px;
}
.top__tag {
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-2);
}
.head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 20px;
}
.head h1 {
  font-size: 30px;
}
.head p {
  margin: 4px 0 0;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}
.kpi {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
.kpi span {
  font-size: 12.5px;
  color: var(--text-2);
}
.kpi strong {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}
.kpi--warn strong {
  color: var(--warn);
}
.kpi--warn.is-zero strong {
  color: var(--text);
}

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 14px;
}
.tools__right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search {
  position: relative;
  flex: 0 1 380px;
}
.search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}
.search input {
  padding-left: 36px;
}

/* Tarjetas de empresa */
.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.co {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
/* Solo la primera vez que aparece la lista: al actualizar cada minuto no parpadea. */
.grid.is-entering .co {
  animation: rise 360ms var(--ease) both;
}
.co.is-down {
  border-color: rgb(255 138 122 / 0.35);
}
.co__banner {
  position: relative;
  display: flex;
  align-items: center;
  height: 92px;
  padding: 0 18px;
  background:
    radial-gradient(ellipse at 0% 0%, color-mix(in srgb, var(--co-accent, var(--accent)) 26%, transparent), transparent 70%),
    #0d1315;
  border-bottom: 1px solid var(--line);
}
.co__banner img {
  max-width: 70%;
  max-height: 54px;
  object-fit: contain;
}
.co__wordmark {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0.02em;
  color: var(--co-accent, var(--accent));
  overflow-wrap: anywhere;
}
.co__swatch {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--co-accent, var(--accent));
  box-shadow: 0 0 0 3px rgb(0 0 0 / 0.35);
}
.co__body {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
  flex: 1;
}
.co__title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.co__title h2 {
  font-size: 16.5px;
  overflow-wrap: anywhere;
}
.co__url {
  color: var(--text-2);
  font-size: 12.5px;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.co__url:hover {
  color: var(--text);
  text-decoration: underline;
}
.co__note {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-3);
}
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  background: rgb(255 255 255 / 0.05);
  color: var(--text-2);
}
.pill::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.pill--ok {
  background: var(--ok-tint);
  color: var(--ok);
}
.pill--warn {
  background: var(--warn-tint);
  color: var(--warn);
}
.pill--bad {
  background: var(--bad-tint);
  color: var(--bad);
}
.co__meta {
  font-size: 12px;
  color: var(--text-3);
}
.co__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}
.co__foot .spacer {
  flex: 1;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 56px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}
.empty p {
  max-width: 460px;
  margin: 0 0 8px;
}

/* Carga (esqueleto) */
.co--loading .co__banner,
.co--loading .co__body > * {
  background: linear-gradient(90deg, #1b2427 25%, #243034 50%, #1b2427 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  color: transparent;
}
.co--loading .co__body > * {
  height: 14px;
  border-radius: 6px;
}

/* Ventana */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(3px);
}
.modal__card {
  display: grid;
  gap: 14px;
  width: min(460px, 100%);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.5);
  animation: pop 200ms var(--ease) both;
}
.modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal__head h2 {
  font-size: 18px;
}
.modal__foot {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal__foot .spacer {
  flex: 1;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1100px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .app {
    padding: 0 16px 48px;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .head h1 {
    font-size: 26px;
  }
  .grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .search {
    flex: 1 1 100%;
  }
  .tools__right {
    width: 100%;
    justify-content: space-between;
  }
}
