/* JWT Sentinel — blue / white / blue */
:root {
  --blue-900: #082f5c;
  --blue-700: #0a4d9e;
  --blue-600: #0b5cab;
  --blue-500: #1873d3;
  --blue-100: #d7e8fa;
  --blue-50: #eaf3fc;
  --white: #ffffff;
  --ink: #1a2733;
  --ink-soft: #51667a;
  --ok: #1f8b4d;
  --bad: #c43636;
  --warn: #b57b12;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(8, 47, 92, 0.08);
  font-size: 16px;
}

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

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, var(--blue-50) 0%, #f6faff 40%, var(--white) 100%);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.7rem 1.4rem;
  background: var(--blue-700);
  color: var(--white);
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.logo-placeholder {
  width: 42px; height: 42px; border-radius: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  display: grid; place-items: center;
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: 0.2px; }
.brand-sub { font-size: 0.72rem; opacity: 0.85; }
.account { display: flex; align-items: center; gap: 0.6rem; }
.user-chip {
  background: rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.85rem;
}

/* ---------------- buttons ---------------- */
.btn {
  border: 1px solid var(--blue-100);
  background: var(--white); color: var(--blue-700);
  padding: 0.5rem 1rem; border-radius: 9px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn.primary { background: var(--blue-500); border-color: var(--blue-500); color: var(--white); }
.btn.primary:hover { background: var(--blue-600); }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, 0.4); color: inherit; }
.btn.small { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: wait; transform: none; }

/* ---------------- layout ---------------- */
main { flex: 1; width: min(1180px, 94vw); margin: 0 auto; padding: 1.6rem 0 2.5rem; }

.hero {
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.4rem;
  align-items: center; margin-bottom: 1.4rem;
}
.hero h1 { font-size: 1.7rem; color: var(--blue-900); line-height: 1.25; margin-bottom: 0.6rem; }
.hero p { color: var(--ink-soft); max-width: 46ch; }

.gate-card {
  background: var(--white); border: 1px solid var(--blue-100);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 0.7rem;
}
.gate-row { display: flex; align-items: center; gap: 0.55rem; font-weight: 600; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.dot-idle { background: #b9c8d8; }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(31, 139, 77, 0.15); }
.dot-bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(196, 54, 54, 0.15); }
.gate-identity {
  font-family: Consolas, "Cascadia Mono", monospace; font-size: 0.8rem;
  background: var(--blue-50); border-radius: 8px; padding: 0.55rem 0.7rem;
  word-break: break-all; color: var(--blue-900);
}

.note {
  background: var(--blue-50); border: 1px solid var(--blue-100);
  border-radius: var(--radius); padding: 1rem 1.2rem; color: var(--ink-soft);
}

.workspace {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 1.3rem; align-items: start;
}
.side { display: flex; flex-direction: column; gap: 1.3rem; }

.panel {
  background: var(--white); border: 1px solid var(--blue-100);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.7rem; }
.panel-head h2 { font-size: 1.02rem; color: var(--blue-700); }
.panel .btn.ghost { border-color: var(--blue-100); color: var(--blue-600); }
.hint { font-size: 0.78rem; color: var(--ink-soft); margin-bottom: 0.6rem; }

/* ---------------- chat ---------------- */
.chat-panel { display: flex; flex-direction: column; min-height: 540px; }
.chat-log {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.7rem;
  padding: 0.3rem 0.2rem; max-height: 60vh;
}
.msg {
  max-width: 88%; padding: 0.65rem 0.9rem; border-radius: 12px;
  font-size: 0.92rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
}
.msg.user { align-self: flex-end; background: var(--blue-500); color: var(--white); border-bottom-right-radius: 4px; }
.msg.agent { align-self: flex-start; background: var(--blue-50); border: 1px solid var(--blue-100); border-bottom-left-radius: 4px; }
.msg.agent code { background: rgba(11, 92, 171, 0.1); padding: 0 4px; border-radius: 4px; font-size: 0.85em; }
.msg.thinking { color: var(--ink-soft); font-style: italic; }
.chat-input { display: flex; gap: 0.6rem; margin-top: 0.8rem; }
.chat-input input {
  flex: 1; border: 1px solid var(--blue-100); border-radius: 9px;
  padding: 0.6rem 0.9rem; font-size: 0.92rem; outline: none;
}
.chat-input input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(24, 115, 211, 0.15); }

/* ---------------- playground ---------------- */
.scenarios { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.8rem; }
.btn.scenario { border-color: var(--blue-100); color: var(--blue-700); font-size: 0.8rem; padding: 0.4rem 0.7rem; }
.sim-result {
  border-radius: 10px; border: 1px solid var(--blue-100); background: #f8fbff;
  padding: 0.7rem 0.8rem; font-size: 0.82rem; margin-top: 0.4rem;
  font-family: Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; word-break: break-word;
  max-height: 300px; overflow-y: auto;
}
.sim-result .status-200 { color: var(--ok); font-weight: 700; }
.sim-result .status-4xx { color: var(--bad); font-weight: 700; }
.decode-box summary { cursor: pointer; color: var(--blue-600); font-size: 0.88rem; font-weight: 600; margin: 0.5rem 0; }
.decode-box textarea {
  width: 100%; border: 1px solid var(--blue-100); border-radius: 9px;
  padding: 0.6rem; font-family: Consolas, monospace; font-size: 0.78rem; margin-bottom: 0.5rem;
}

/* ---------------- log feed ---------------- */
.log-feed { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.78rem; max-height: 320px; overflow-y: auto; }
.log-row {
  display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 0.5rem; align-items: center;
  padding: 0.4rem 0.55rem; border-radius: 8px; background: #f8fbff; border: 1px solid var(--blue-50);
  font-family: Consolas, "Cascadia Mono", monospace;
}
.log-status { font-weight: 700; text-align: center; border-radius: 6px; padding: 0.1rem 0.3rem; }
.log-status.ok { background: rgba(31, 139, 77, 0.12); color: var(--ok); }
.log-status.denied { background: rgba(196, 54, 54, 0.12); color: var(--bad); }
.log-status.other { background: rgba(181, 123, 18, 0.12); color: var(--warn); }
.log-uri { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { color: var(--ink-soft); }

footer {
  text-align: center; padding: 1rem; font-size: 0.78rem; color: var(--ink-soft);
  border-top: 1px solid var(--blue-100); background: var(--white);
}

@media (max-width: 900px) {
  .hero, .workspace { grid-template-columns: 1fr; }
}
