/* Proxy Guard — chat full-width (estilo Streamlit / jornada) */
:root {
  --bg: #eef4f8;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #0e9384;
  --accent-2: #0ea5e9;
  --danger: #b45309;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 55% at 50% -15%, rgba(14, 147, 132, 0.08), transparent 55%),
    linear-gradient(180deg, #eef4f8 0%, #f7fafc 42%, #ffffff 100%);
}

html.demo-gate-checking body { visibility: hidden; }

.pg-primary {
  border: none;
  border-radius: 12px;
  padding: 0.8rem 1.1rem;
  font: inherit;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.25);
}
.pg-primary:disabled { opacity: 0.65; cursor: wait; }

.linkish {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.linkish:hover { color: var(--text); }

/* —— SSO shell (portal limpio) —— */
.sso-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem 1rem 2rem;
}

.sso-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.07);
  padding: 1.65rem 1.5rem 1.35rem;
}

.sso-card__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.35rem;
}

.sso-card__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.sso-card__head strong {
  display: block;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.sso-card__head span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.sso-card__title {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin-bottom: 0.4rem;
  line-height: 1.25;
}

.sso-card__lead {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin-bottom: 1.2rem;
}

.sso-providers {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sso-provider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.72rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.sso-provider:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.sso-provider:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.sso-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.15rem 0 0.95rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sso-divider::before,
.sso-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.sso-fields label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #334155;
  margin: 0.65rem 0 0.3rem;
}

.sso-fields label:first-child { margin-top: 0; }

.sso-fields select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  padding-right: 2rem;
}

.sso-fields select:focus {
  outline: none;
  border-color: #7dd3fc;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.sso-enter {
  width: 100%;
  margin-top: 1.15rem;
  border-radius: 10px;
  box-shadow: none;
}

.sso-foot {
  margin-top: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.sso-foot a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.sso-foot a:hover { color: var(--text); }

.chat-mark-img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}

/* —— Full-width chat —— */
.chat-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1rem 1rem;
}

.chat-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.chat-top__brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.chat-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 0.7rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.chat-top__brand strong { display: block; font-size: 0.95rem; }
.chat-top__brand small { color: var(--muted); font-size: 0.78rem; }

.chat-top__status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: var(--danger);
}
.chip.ok {
  background: #f0fdfa;
  border-color: #99f6e4;
  color: #0f766e;
}
.chip--soft {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.75rem 0;
}

.chat-suggestions button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.chat-suggestions button:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
  min-height: 420px;
}

.chat-empty {
  margin: auto;
  text-align: center;
  max-width: 36ch;
  color: var(--muted);
  padding: 2rem 1rem;
}
.chat-empty h2 { color: var(--text); margin-bottom: 0.4rem; }

.bubble {
  max-width: 85%;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.92rem;
  line-height: 1.45;
}
.bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #ecfeff, #f0fdfa);
  border-color: #99f6e4;
}
.bubble.assistant { align-self: flex-start; }
.bubble .who {
  display: block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.bubble.user .who { color: #0f766e; }
.bubble pre {
  margin-top: 0.45rem;
  padding: 0.55rem 0.65rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.78rem;
  white-space: pre-wrap;
  color: #334155;
  font-family: ui-monospace, monospace;
}

.chat-compose {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 0.85rem;
  background: transparent;
}

.chat-compose textarea {
  flex: 1;
  min-height: 56px;
  max-height: 140px;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  font: inherit;
  font-size: 0.92rem;
  resize: vertical;
  background: #fff;
}
.chat-compose textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}
.chat-compose .pg-primary {
  min-width: 110px;
}
