:root {
  --font-display: "Poppins", "Inter", system-ui, -apple-system, sans-serif;
  --font-body: "Nunito Sans", "Inter", system-ui, -apple-system, sans-serif;

  --accent: #6366F1;
  --accent-soft: rgba(99, 102, 241, 0.14);
  --ink: #22242c;
  --ink-soft: #5c5f6e;
  --ink-faint: #83879a;
  --ok: #15803d;
  --deny: #dc2626;

  /* glass tokens */
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-soft: rgba(255, 255, 255, 0.42);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-line: rgba(120, 120, 160, 0.16);
  --blur: blur(24px) saturate(150%);
  --shadow: 0 16px 48px rgba(80, 80, 130, 0.14);
  --shadow-sm: 0 8px 26px rgba(80, 80, 130, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 700px at 15% 0%, rgba(180, 205, 255, 0.55), transparent 60%),
    radial-gradient(1000px 700px at 100% 20%, rgba(240, 200, 235, 0.55), transparent 55%),
    radial-gradient(900px 800px at 60% 100%, rgba(255, 224, 210, 0.5), transparent 60%),
    linear-gradient(135deg, #e9f0ff 0%, #eee6fb 45%, #fbe7f2 100%);
  background-attachment: fixed;
}

/* two-font system: Poppins (display) for headings, Nunito Sans for body */
.hero-title,
.login-title,
.brand-name,
.suggestion-title,
.popover h3,
.toast-title { font-family: var(--font-display); }

.hidden { display: none !important; }
.muted { color: var(--ink-soft); font-weight: 400; }
button { font-family: inherit; cursor: pointer; }

/* ── BUTTONS ───────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px 22px;
  font-size: 15px;
  font-weight: 600;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn-primary:hover { filter: brightness(0.95); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-block { width: 100%; }

.btn-ghost {
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink-soft);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.65); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--ink-soft);
  font-size: 15px;
  padding: 6px 9px;
  border-radius: 9px;
  line-height: 1;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.btn-icon { line-height: 1; }

/* ── LOGIN ─────────────────────────────────────────────── */
.login-wrap {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 56px 48px 50px;
  width: 100%;
  max-width: 560px;
  min-height: 430px;
  text-align: center;
}
.login-logo, .brand-logo, .msg-avatar.bot {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo { width: 70px; height: 70px; font-size: 25px; margin: 0 auto 24px; border-radius: 18px; }
.login-title { font-size: 38px; font-weight: 700; letter-spacing: 0; line-height: 1.08; color: var(--accent); }
.login-sub { color: var(--ink-soft); font-size: 16px; margin-top: 14px; }

/* primary sign-in button with icon */
.login-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 62px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(82, 17, 218, 0.2);
}
.login-primary .btn-icon { font-size: 21px; }

/* "internal use only" divider */
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 42px 0 28px;
  color: var(--ink-faint); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.login-divider::before, .login-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--glass-line);
}

/* secondary action buttons */
.login-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.login-2nd {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 12px;
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.4);
  border-radius: 11px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.login-2nd:hover { border-color: var(--accent); color: var(--accent); background: rgba(255, 255, 255, 0.65); }
.login-hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 12px; }

/* trust row */
.login-security { margin-top: 24px; }
.login-secured {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 13.5px; color: var(--ink-soft);
}
.login-secured .btn-icon { font-size: 16px; color: var(--accent); }
.login-secured strong { color: var(--ink); font-weight: 700; }
.login-badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.login-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
}
.login-form { margin-top: 28px; text-align: left; display: flex; flex-direction: column; gap: 16px; }
.login-form label { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); display: flex; flex-direction: column; gap: 7px; }
.login-form input, .popover input[type="text"] {
  border: 1px solid var(--glass-line);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-form input:focus, .popover input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.login-form .btn-primary { margin-top: 6px; }
#oidc-login { margin-top: 40px; }
.login-err { color: var(--deny); font-size: 14px; min-height: 18px; font-weight: 500; margin-top: 14px; }
.login-foot { color: var(--ink-faint); font-size: 13px; margin-top: 16px; }

/* ── APP SHELL ─────────────────────────────────────────── */
.app { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--glass-border);
  position: relative;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; flex: 1; }
.brand-logo { width: 42px; height: 42px; font-size: 15px; border-radius: 13px; flex-shrink: 0; }
.brand-text { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.brand-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: 0; white-space: nowrap; overflow: visible; text-overflow: clip; }
.brand-sub { display: block; font-size: 12.5px; line-height: 1.2; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--accent);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 10px 15px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip i { font-size: 13px; line-height: 1; }
.chip:hover { background: rgba(255, 255, 255, 0.74); }
.user-pill {
  display: inline-flex; align-items: center; gap: 9px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  padding: 5px 6px 5px 7px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.user-name {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

/* user avatar */
.user-avatar,
.msg-avatar.user {
  width: 34px; height: 34px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.72)) padding-box,
    linear-gradient(135deg, var(--accent), rgba(255, 255, 255, 0.95)) border-box;
  border: 1px solid transparent;
  color: var(--accent);
  font-size: 12px; font-weight: 800; flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.62);
}

/* sign-out action inside the user box */
.signout-btn {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
  font-size: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  margin-left: 2px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.signout-btn:hover {
  background: var(--accent);
  color: #fff;
  transform: scale(1.08);
}

/* ── POPOVERS ──────────────────────────────────────────── */
.popover {
  position: absolute;
  top: 70px;
  left: 22px;
  background: var(--glass-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
  width: 340px;
  max-width: calc(100vw - 32px);
  z-index: 40;
}
.popover-right { left: auto; right: 22px; }
.popover h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.popover label { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.popover input[type="color"] { width: 52px; height: 36px; border: 1px solid var(--glass-line); border-radius: 9px; background: none; padding: 3px; cursor: pointer; }
.popover-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.popover-actions button { padding: 10px 18px; font-size: 14px; }

.tools-list { display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.tool-item { padding: 12px 14px; border-radius: 12px; transition: background 0.12s ease; }
.tool-item + .tool-item { border-top: 1px solid var(--glass-line); }
.tool-item:hover { background: rgba(255, 255, 255, 0.55); }
.tool-item .t-name { font-size: 15px; font-weight: 600; color: var(--ink); }
.tool-item .t-desc { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.5; }

/* ── MAIN: hero → chat layout ──────────────────────────── */
.main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 24px;
}
.app:not(.chatting) .main { justify-content: center; }
.app:not(.chatting) .thread { flex: 0 0 auto; overflow: visible; }
.app.chatting .main { justify-content: flex-start; }
.app.chatting .thread { flex: 1 1 auto; overflow-y: auto; }

.thread {
  width: 100%;
  max-width: 1008px;
  margin: 0 auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.thread::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* hero greeting */
.hero { text-align: center; padding: 0 0 30px; }
.app.chatting .hero { display: none; }
.hero-title { font-size: 44px; font-weight: 800; letter-spacing: -0.025em; color: #2b2b38; line-height: 1.1; }

/* composer zone (slides from center to bottom via FLIP) */
.composer-zone {
  width: 100%;
  max-width: 1008px;
  margin: 0 auto;
  flex-shrink: 0;
  padding-bottom: 18px;
  will-change: transform;
}
.app.chatting .composer-zone { padding-top: 10px; }

/* composer glass box */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  box-shadow: var(--shadow);
  padding: 14px 14px 14px 22px;
}
.composer textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 17px;
  line-height: 1.5;
  resize: none;
  min-height: 32px;
  max-height: 200px;
  color: var(--ink);
  font-family: inherit;
  padding: 6px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.composer textarea::-webkit-scrollbar { width: 0; height: 0; display: none; }
.composer textarea::placeholder { color: var(--ink-faint); }
.send-btn {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 21px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.send-btn:hover { filter: brightness(0.95); }
.send-btn:active { transform: translateY(1px); }
.send-btn:disabled { opacity: 0.45; cursor: default; }
.send-btn i { font-size: 17px; transform: translateX(1px); }

/* suggestions */
.suggestions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.app.chatting .suggestions { display: none; }
.suggestion {
  text-align: left;
  background: var(--glass-soft);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, background 0.15s ease;
}
.suggestion:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.66); }
.suggestion:active { transform: translateY(0); }
.suggestion-icon { font-size: 20px; color: var(--accent); line-height: 1; }
.suggestion-title { font-size: 15px; font-weight: 600; color: #2b2b38; margin-top: 10px; }
.suggestion-sub { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }

.composer-foot { text-align: center; font-size: 12px; color: var(--ink-faint); margin-top: 12px; }
.app:not(.chatting) .composer-foot { display: none; }

/* ── MESSAGES ──────────────────────────────────────────── */
.chat-inner { padding: 34px 16px 8px; }
.msg-row { display: flex; margin: 22.5px 0 45px; align-items: flex-start; }
.msg-row.user { justify-content: flex-end; }
.msg-avatar {
  width: 29px; height: 29px; border-radius: 50%; flex-shrink: 0;
  position: absolute;
  top: -22px;
  z-index: 2;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  margin-bottom: 0;
}
.msg-avatar.user { border-radius: 50%; font-size: 10.5px; font-weight: 800; }
.msg-row.bot .msg-avatar { left: -6px; }
.msg-row.user .msg-avatar { right: -6px; }
.msg-body {
  flex: 1; min-width: 0; padding-top: 0; position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
}
.msg-row.user .msg-body { align-items: flex-end; }
/* bubble + tool trace share one shrink-to-fit column, so the trace matches the
   response bubble width instead of spanning the whole row */
.msg-stack {
  display: flex;
  flex-direction: column;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
}
.msg-row.user .msg-stack { max-width: 88%; }

/* message bubble — fills the stack (which is sized to content) */
.msg-text {
  position: relative;
  width: 100%;
  font-size: 16px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: #262932;
  border-radius: 16px;
  padding: 8.5px 17px;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
.thinking-row .msg-avatar {
  position: static;
  margin-bottom: 6px;
}
/* assistant: brighter, more prominent response bubble */
.msg-row.bot .msg-text {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}
/* user: softer prompt bubble */
.msg-row.user .msg-text {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(120, 120, 170, 0.28);
  box-shadow:
    0 10px 28px rgba(80, 80, 130, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.msg-text a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}
.msg-text a:hover { filter: brightness(0.9); }
.msg-text strong { font-weight: 700; color: #1b1d27; }
.msg-text code {
  background: rgba(120, 120, 160, 0.14);
  border: 1px solid var(--glass-line);
  border-radius: 7px;
  padding: 2px 7px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
  font-weight: 600;
  color: #37384a;
}

/* markdown tables → clean key/value layout */
.msg-text .md-table {
  border-collapse: collapse;
  margin: 12px 0 4px;
  font-size: 15px;
  line-height: 1.5;
}
.msg-text .md-table th,
.msg-text .md-table td {
  text-align: left;
  padding: 9px 28px 9px 0;
  border-bottom: 1px solid var(--glass-line);
  vertical-align: top;
}
.msg-text .md-table thead th {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 8px;
}
.msg-text .md-table td:first-child { font-weight: 600; color: #2b2d3a; }
.msg-text .md-table tbody tr:last-child td { border-bottom: none; }

/* tool trace — glassy human-friendly chips */
.trace { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; width: 100%; }
.trace-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  padding: 13px 18px;
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  font-size: 14.5px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.trace-item.ok { border-color: rgba(21, 128, 61, 0.3); background: rgba(220, 245, 228, 0.5); }
.trace-item.deny { border-color: rgba(220, 38, 38, 0.35); background: rgba(252, 226, 226, 0.5); }
.trace-status { width: 17px; font-weight: 800; font-size: 15px; line-height: 1; flex-shrink: 0; }
.trace-item.ok .trace-status { color: var(--ok); }
.trace-item.deny .trace-status { color: var(--deny); }
.trace-label { font-weight: 600; color: var(--ink); }
.trace-item.deny .trace-label { color: #b91c1c; }
.trace-gw { color: var(--ink-faint); font-size: 12.5px; }
.trace-ms { margin-left: auto; color: var(--ink-faint); font-size: 12.5px; white-space: nowrap; }

/* thinking */
.thinking { display: flex; gap: 6px; padding-top: 8px; }
.thinking span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: 0.4; animation: blink 1.3s infinite ease-in-out; }
.thinking span:nth-child(2) { animation-delay: 0.2s; }
.thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

/* ── TOASTS ────────────────────────────────────────────── */
.toast-stack { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 60; max-width: calc(100vw - 48px); }
.toast {
  display: flex; align-items: center; gap: 12px;
  background: var(--glass-strong);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  min-width: 290px;
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-icon { color: var(--accent); font-size: 19px; line-height: 1; flex-shrink: 0; }
.toast-body { display: flex; flex-direction: column; min-width: 0; }
.toast-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.toast-sub { font-size: 13px; color: var(--ink-soft); margin-top: 1px; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-title { font-size: 34px; }
  .suggestions { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .topbar { padding: 11px 15px; }
  .brand-logo { width: 38px; height: 38px; }
  .brand-name { font-size: 16px; }
  .brand-sub { display: none; }
  .main { padding: 0 15px; }
  .hero-title { font-size: 28px; }
  .composer textarea { font-size: 16px; }
  .popover { top: 64px; left: 14px; right: 14px; width: auto; }
  .popover-right { left: 14px; right: 14px; }
}

@media (max-width: 520px) {
  html { font-size: 15px; }
  .topbar-right { gap: 8px; }
  .chip { padding: 8px 11px; }
  .chip-label { display: none; }
  .user-pill { padding: 5px 6px 5px 7px; font-size: 13px; }
  .user-name { font-size: 13px; }
  .hero-title { font-size: 25px; }
  .msg-avatar { width: 25.5px; height: 25.5px; }
  .msg-text { font-size: 15.5px; }
  .send-btn { width: 42px; height: 42px; font-size: 19px; }
  .login-card { padding: 32px 24px; }
  .trace-gw { display: none; }
  .toast-stack { right: 12px; left: 12px; bottom: 12px; }
  .toast { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .composer-zone { transition: none !important; }
}

/* ── Environment picker (login screen) ─────────────────── */
.env-picker {
  margin: 22px 0 4px;
  text-align: left;
}
.env-picker > label {
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 8px;
}
.env-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.env-select-wrap .env-select-icon {
  position: absolute;
  left: 14px;
  color: var(--accent);
  font-size: 14px;
  pointer-events: none;
}
.env-select-wrap .env-select-caret {
  position: absolute;
  right: 14px;
  color: var(--ink-faint);
  font-size: 12px;
  pointer-events: none;
}
#env-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 13px 38px 13px 40px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: var(--glass-strong);
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#env-select:hover { border-color: var(--accent); }
#env-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.env-target {
  margin: 8px 2px 0;
  font-family: var(--font-body);
  font-size: 11.5px;
  color: var(--ink-faint);
  word-break: break-all;
  line-height: 1.5;
}

/* ── Governed delegation (OBO journey) ─────────────────── */
.journey {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--glass-line);
  border-radius: 14px;
  background: var(--glass-soft);
}
.journey-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}
.journey-head i { color: var(--accent); }
.journey-head .muted { font-weight: 600; color: var(--ink-faint); }
.j-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 14px 0 6px;
}
.j-node {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid var(--glass-line);
  background: var(--glass-strong);
  color: var(--ink);
}
.j-node.human { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.j-node.agent { }
.j-node.target { border-style: dashed; color: var(--ink-soft); }
.j-arrow { color: var(--ink-faint); font-size: 11px; }
.j-branches {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  vertical-align: middle;
}
.j-branch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.j-hops {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.j-hop {
  padding: 10px 12px;
  border: 1px solid var(--glass-line);
  border-radius: 10px;
  background: var(--glass-strong);
}
.j-hop-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
}
.j-hop-arw { color: var(--ink-faint); font-size: 11px; }
.j-decision {
  margin-left: auto;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.j-decision.ok { color: var(--ok); background: rgba(21, 128, 61, 0.12); }
.j-decision.deny { color: var(--deny); background: rgba(220, 38, 38, 0.12); }
.j-hop-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 7px;
}
.j-hop-meta code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--accent-soft);
  padding: 1px 7px;
  border-radius: 6px;
}
.j-meta { font-size: 11px; color: var(--ink-faint); font-family: var(--font-body); }

/* Governance-trail toggle (show/hide the behind-the-scenes DAG + receipts) */
.journey-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 2px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
}
.journey-toggle i.fa-shield-halved { color: var(--accent); }
.journey-toggle .muted { font-weight: 600; color: var(--ink-faint); }
.journey-toggle .jt-caret {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 12px;
  transition: transform 0.2s ease;
}
.journey.open .jt-caret { transform: rotate(180deg); }
.journey-body { margin-top: 4px; }

/* A called tool is a leaf under its agent — distinct from agent nodes. */
.j-node.tool {
  border-color: rgba(13, 148, 136, 0.4);
  color: #0f766e;
  background: rgba(13, 148, 136, 0.10);
}
.j-node.tool i { font-size: 10px; opacity: 0.85; }

/* Per-hop protocol badge: A2A skill vs MCP tool. */
.j-proto {
  font-family: var(--font-body);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 6px;
  flex-shrink: 0;
}
.j-proto.a2a { color: var(--accent); background: var(--accent-soft); }
.j-proto.mcp { color: #0f766e; background: rgba(13, 148, 136, 0.12); }

/* Blocked-hop banner: WHY a request was refused (the real policy reason). */
.jt-blocked {
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: var(--deny);
  background: rgba(220, 38, 38, 0.12);
  white-space: nowrap;
}
.journey-toggle.has-blocks i.fa-shield-halved { color: var(--deny); }
.j-blocks { margin: 10px 0 4px; display: flex; flex-direction: column; gap: 8px; }
.j-block {
  border: 1px solid rgba(220, 38, 38, 0.32);
  background: rgba(220, 38, 38, 0.06);
  border-radius: 12px;
  padding: 10px 12px;
}
.j-block-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.j-block-line > i.fa-ban { color: var(--deny); }
.j-block-tag {
  font-family: var(--font-body);
  font-size: 10px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--deny); background: rgba(220, 38, 38, 0.14);
  padding: 2px 7px; border-radius: 6px;
}
/* Which enforcement layer refused the hop — capability profile (skill/tool exposure) vs policy engine. */
.j-layer {
  font-family: var(--font-body);
  font-size: 9.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 6px; flex-shrink: 0;
}
.j-layer.capability { color: #b45309; background: rgba(217, 119, 6, 0.14); }
.j-layer.policy { color: #6d28d9; background: rgba(109, 40, 217, 0.13); }
.j-block-target { font-family: var(--font-body); font-size: 12.5px; font-weight: 700; color: var(--ink); }
.j-block-target i { color: var(--ink-faint); font-size: 10px; }
.j-block-reason {
  margin-top: 6px;
  font-family: var(--font-body); font-size: 12.5px; color: var(--deny);
}

/* Per-hop OBO receipt — the full signed token for that hop. */
.j-receipt-wrap { margin-top: 8px; }
.j-receipt-wrap > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 3px 9px;
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  background: var(--glass-strong);
  user-select: none;
}
.j-receipt-wrap > summary::-webkit-details-marker { display: none; }
.j-receipt-wrap > summary:hover { color: var(--accent); border-color: var(--accent); }
.j-receipt-wrap[open] > summary { color: var(--accent); border-color: var(--accent); }
.j-receipt-wrap > summary i { font-size: 10px; }
.j-receipt {
  margin-top: 8px;
  border: 1px solid var(--glass-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-x: auto;
}
.r-row { display: flex; gap: 10px; align-items: baseline; }
.r-k {
  flex: 0 0 96px;
  font-family: var(--font-body);
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--ink-faint);
}
.r-v {
  flex: 1;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px; color: var(--ink);
  word-break: break-word;
}
