* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  background: #0f172a; color: #e2e8f0; line-height: 1.5;
}
header {
  padding: 2rem; background: #1e293b; border-bottom: 1px solid #334155;
}
header h1 { font-size: 1.5rem; }
header .sub { color: #94a3b8; font-size: .9rem; margin-top: .25rem; }
#session { margin-top: .75rem; font-size: .9rem; color: #cbd5e1; }
#session a { color: #38bdf8; }
main { max-width: 900px; margin: 0 auto; padding: 2rem; }
main h2 { margin: 1.5rem 0 .75rem; font-size: 1.15rem; }
.hint, .warn, .sub { font-size: .85rem; }
.hint { color: #94a3b8; margin-bottom: 1rem; }
.warn { color: #fbbf24; margin-bottom: .75rem; }

button.primary {
  background: #38bdf8; color: #0f172a; border: 0; border-radius: 8px;
  padding: .7rem 1.4rem; font-size: 1rem; font-weight: 600; cursor: pointer;
}
button.primary:hover { background: #0ea5e9; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: #1e293b; border: 1px solid #334155; border-radius: 10px; padding: 1.1rem;
}
.card.has { border-left: 4px solid #22c55e; }
.card.no  { border-left: 4px solid #64748b; opacity: .85; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.app-name { font-weight: 600; font-size: .98rem; }
.app-desc { color: #94a3b8; font-size: .85rem; margin: .5rem 0 .8rem; }
.app-link { color: #38bdf8; text-decoration: none; font-weight: 600; font-size: .9rem; }
.app-link:hover { text-decoration: underline; }

.badge { font-size: .7rem; padding: .2rem .5rem; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: #14532d; color: #86efac; }
.badge-no { background: #334155; color: #cbd5e1; }

pre#jwt-claims {
  background: #0b1120; border: 1px solid #334155; border-radius: 8px;
  padding: 1rem; overflow-x: auto; font-size: .8rem; color: #a5b4fc;
}

.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  padding: .8rem 1.4rem; border-radius: 8px; font-weight: 600; font-size: .9rem;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.toast.ok  { background: #14532d; color: #86efac; }
.toast.err { background: #7f1d1d; color: #fca5a5; }

/* Loader en botones durante la llamada a la API */
button.loading { opacity: .8; cursor: progress; }
.spinner {
  display: inline-block; width: 12px; height: 12px; vertical-align: -1px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.actions button { text-align: left; }
.actions button small { opacity: .7; font-weight: 400; }

/* Enlace de vuelta al menu principal */
.back-link {
  display: inline-block; margin-bottom: .75rem; color: #38bdf8;
  text-decoration: none; font-size: .85rem; font-weight: 600;
}
.back-link:hover { text-decoration: underline; }

/* Boton de accion SIN permiso: rojo, para que sea evidente que fallara al picar */
button.deny {
  background: #7f1d1d; color: #fecaca; border: 1px solid #b91c1c;
  border-radius: 8px; padding: .7rem 1.1rem; font-size: .95rem;
  font-weight: 600; cursor: pointer;
}
button.deny:hover { background: #991b1b; }
button.deny .badge-no { background: #450a0a; color: #fca5a5; }

/* Accion con grupo pero con requisito extra faltante (ej. empresa): naranja.
   Puedes entrar a la app, pero esta accion fallara hasta cumplir el requisito. */
button.warnbtn {
  background: #78350f; color: #fed7aa; border: 1px solid #d97706;
  border-radius: 8px; padding: .7rem 1.1rem; font-size: .95rem;
  font-weight: 600; cursor: pointer;
}
button.warnbtn:hover { background: #92400e; }
.badge-warn { background: #451a03; color: #fdba74; }

/* Boton ghost (ruta publica, sin login): neutro pero con diseño */
button.ghost {
  background: transparent; color: #38bdf8; border: 1px solid #38bdf8;
  border-radius: 8px; padding: .7rem 1.2rem; font-size: .95rem;
  font-weight: 600; cursor: pointer; transition: background .15s;
}
button.ghost:hover { background: rgba(56,189,248,.12); }

/* Tarjeta de la ruta publica */
.public-card {
  margin-top: 1.5rem; background: #1e293b; border: 1px solid #334155;
  border-left: 4px solid #38bdf8; border-radius: 10px; padding: 1.1rem 1.25rem;
}
.public-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .25rem; }
.public-head h2 { margin: 0; font-size: 1.05rem; }
.badge-public { background: #0c4a6e; color: #7dd3fc; }

/* Caja de resultado de las pruebas del proxy */
.result {
  margin: .75rem 0 1.25rem; padding: 1rem 1.2rem; border-radius: 8px;
  font-size: .95rem; word-break: break-word;
}
.result.ok  { background: #14532d; color: #d1fae5; border: 1px solid #22c55e; }
.result.err { background: #7f1d1d; color: #fecaca; border: 1px solid #b91c1c; }
code { background: #0b1120; padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }
