:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #dbe4f0;
  --blue: #175cd3;
  --blue-dark: #0b3f98;
  --blue-soft: #eef5ff;
  --green: #067647;
  --surface: rgba(255, 255, 255, 0.94);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, #dbeafe 0, transparent 30%),
    radial-gradient(circle at 90% 12%, #e0f2fe 0, transparent 27%),
    #f6f8fc;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 34px;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(15, 40, 80, 0.14);
}

.login-brand { display: flex; align-items: center; gap: 15px; }
.login-brand h1 { margin-top: 4px; font-size: 1.55rem; }
.login-copy { margin: 26px 0; color: var(--muted); line-height: 1.6; }
.login-form { display: grid; gap: 9px; }
.login-form label { margin-top: 8px; font-size: 0.78rem; font-weight: 700; }
.login-form input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid #b8c7da;
  border-radius: 12px;
  color: var(--ink);
  background: white;
  font: inherit;
  outline: none;
}
.login-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px #dbeafe; }
.login-form button { min-height: 48px; margin-top: 16px; }
.login-error { padding: 10px 12px; border-radius: 10px; color: #b42318; background: #fef3f2; font-size: 0.82rem; }
.login-note { margin-top: 20px; color: var(--muted); text-align: center; font-size: 0.75rem; }

.shell {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(219, 228, 240, 0.9);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(15, 40, 80, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  color: white;
  font-weight: 800;
  background: linear-gradient(145deg, var(--blue), #4f8df7);
  box-shadow: 0 10px 24px rgba(23, 92, 211, 0.28);
}

h1, h2, p { margin: 0; }
h1 { font-size: 1.38rem; letter-spacing: -0.03em; }
h2 { margin-top: 7px; font-size: clamp(1.8rem, 4vw, 3rem); letter-spacing: -0.045em; }
.eyebrow { color: var(--blue); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.09em; text-transform: uppercase; }
.status { margin-left: auto; color: var(--green); font-size: 0.82rem; font-weight: 650; }
.status span { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 5px #d1fadf; }
.session-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.status { margin-left: 0; }
.logout-button { min-width: auto; padding: 9px 13px; border: 1px solid var(--line); color: var(--ink); background: white; }
.logout-button:hover { border-color: #b8c7da; background: var(--blue-soft); }

.workspace { overflow-y: auto; padding: 44px 8%; }
.intro { max-width: 700px; margin: 6vh auto 46px; text-align: center; }
.intro > p:last-child { max-width: 620px; margin: 18px auto 0; color: var(--muted); line-height: 1.65; }
.messages { display: grid; gap: 22px; }
.message { max-width: 82%; padding: 17px 19px; border-radius: 18px; line-height: 1.55; }
.message.user { margin-left: auto; color: white; border-bottom-right-radius: 6px; background: linear-gradient(145deg, var(--blue), var(--blue-dark)); }
.message.assistant { border: 1px solid var(--line); border-bottom-left-radius: 6px; background: white; box-shadow: 0 8px 24px rgba(23, 32, 51, 0.06); }
.message.error { border-color: #fecdca; background: #fffbfa; }
.provenance { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.76rem; }
.provenance span { padding: 5px 8px; border-radius: 999px; background: var(--blue-soft); }
.visualization-card { margin-top: 16px; padding: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #f8fbff; }
.visualization-card h3 { margin: 0 0 10px; font-size: 0.9rem; }
.visualization-card svg { display: block; width: 100%; min-width: 420px; max-height: 360px; }
.visualization-card rect { fill: url(#talkingbi-bar-gradient); fill: var(--blue); opacity: .88; }
.visualization-card text { fill: var(--ink); font: 13px Inter, ui-sans-serif, system-ui, sans-serif; }
.visualization-card .chart-grid { stroke: #dbe4f0; stroke-width: 1; }
.visualization-card .chart-axis-label { fill: var(--muted); font-size: 11px; }
.visualization-card .chart-series { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.visualization-card .chart-point { stroke: white; stroke-width: 2; }

.activity { padding: 18px 4px; color: var(--muted); font-size: 0.83rem; }
.activity span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--blue); animation: pulse 1s infinite alternate; }
.activity span:nth-child(2) { animation-delay: .2s; }
.activity span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse { to { opacity: .25; transform: translateY(-3px); } }

.composer { padding: 18px 28px 22px; border-top: 1px solid var(--line); background: rgba(255, 255, 255, 0.97); }
.composer label { display: block; margin-bottom: 9px; font-size: 0.78rem; font-weight: 700; }
.composer-row { display: flex; gap: 12px; }
textarea { width: 100%; min-height: 52px; max-height: 160px; resize: none; padding: 14px 16px; border: 1px solid #b8c7da; border-radius: 14px; color: var(--ink); font: inherit; outline: none; }
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px #dbeafe; }
button { align-self: stretch; min-width: 112px; border: 0; border-radius: 14px; color: white; font-weight: 750; cursor: pointer; background: linear-gradient(145deg, var(--blue), var(--blue-dark)); }
button:disabled { cursor: wait; opacity: .6; }
.composer > p { margin-top: 8px; color: var(--muted); font-size: 0.72rem; }

@media (max-width: 680px) {
  .shell { width: 100%; min-height: 100vh; margin: 0; border-radius: 0; }
  .status { display: none; }
  .session-actions { margin-left: auto; }
  .workspace { padding: 28px 20px; }
  .message { max-width: 94%; }
  .composer { padding: 14px 16px; }
  button { min-width: 84px; }
}
