:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #172033;
  background: #eef2f7;
  font-synthesis: none;
}

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #eef2f7, #dfe7f1); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1440px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 40px; }

.card {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(23,32,51,.08);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(23,32,51,.08);
  padding: 20px;
}

.hidden { display: none !important; }

.login { max-width: 480px; margin: 8vh auto 0; }
.brand { font-size: 30px; font-weight: 800; letter-spacing: -.04em; }
.brand span { opacity: .45; }
.eyebrow { margin: 10px 0; font-size: 12px; font-weight: 800; letter-spacing: .12em; opacity: .55; }
h1 { margin: 16px 0 8px; font-size: 32px; }
h2 { margin: 0; font-size: 18px; }
.muted { color: #667085; line-height: 1.5; }
.error { min-height: 20px; margin: 10px 0 0; color: #b42318; font-size: 13px; }

label { display: block; margin: 14px 0; font-size: 13px; font-weight: 700; }
label input {
  display: block; width: 100%; margin-top: 7px; padding: 12px 13px;
  border: 1px solid #d5dae4; border-radius: 10px; outline: none;
}
label input:focus, textarea:focus { border-color: #667085; box-shadow: 0 0 0 3px rgba(102,112,133,.12); }

button {
  border: 0; border-radius: 10px; padding: 11px 15px;
  background: #172033; color: #fff; font-weight: 700;
}
button:disabled { opacity: .55; cursor: wait; }
.ghost { background: transparent; color: #172033; border: 1px solid #d5dae4; }
.small { padding: 7px 10px; font-size: 12px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.identity-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.identity-strip div { display: flex; flex-direction: column; gap: 4px; }
.identity-strip span { color: #667085; font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pill {
  padding: 6px 9px; border-radius: 999px; background: #eef2f7;
  color: #475467; font-size: 11px; font-weight: 800; letter-spacing: .06em;
}

.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid #edf0f4; }
.kv:last-child { border-bottom: 0; }
.kv span { color: #667085; font-size: 13px; }
.kv strong { text-align: right; font-size: 13px; }

.admin-box { padding: 12px; border: 1px solid #e6e9ef; border-radius: 12px; margin-bottom: 8px; }
.admin-box span, .admin-box small { display: block; color: #667085; }
.admin-box strong { display: block; margin: 3px 0; }

.team-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 11px 0;
  border-bottom: 1px solid #edf0f4;
}
.team-row span { color: #667085; font-size: 13px; }
.team-note { margin-bottom: 0; font-size: 12px; }

.source, .audit-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid #edf0f4; font-size: 12px;
}
.audit-row { display: grid; grid-template-columns: 1.2fr 1fr; }
.audit-row small { grid-column: 1 / -1; color: #98a2b3; overflow-wrap: anywhere; }
.ok { color: #027a48; font-weight: 700; }
.bad { color: #b42318; font-weight: 700; }

.chat-log {
  min-height: 190px; max-height: 440px; overflow: auto;
  padding: 4px 0 12px; border-bottom: 1px solid #edf0f4; margin-bottom: 14px;
}
.msg { max-width: 86%; padding: 12px 14px; margin: 10px 0; border-radius: 12px; line-height: 1.5; }
.msg.user { margin-left: auto; background: #172033; color: #fff; }
.msg.assistant { background: #f2f4f7; color: #172033; }
.msg-role { font-size: 10px; font-weight: 800; letter-spacing: .08em; opacity: .65; margin-bottom: 5px; }

.chat-form { display: flex; gap: 10px; align-items: flex-end; }
.chat-form textarea {
  flex: 1; resize: vertical; min-height: 72px; padding: 11px 12px;
  border: 1px solid #d5dae4; border-radius: 10px; outline: none;
}

@media (max-width: 920px) {
  .grid { grid-template-columns: 1fr; }
  .identity-strip { grid-template-columns: 1fr; }
}
