/* MPHG staff app. Dark navy header, white body, cyan accents on links/hover only. */
:root {
  --navy: #0a1f3a;
  --navy-2: #12294a;
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --line-2: #f2f4f7;
  --bg: #ffffff;
  --bg-alt: #fafbfc;
  --cyan: #00b8d4;
  --cyan-hover: #00d4ff;
  --user-bubble: #f2f4f7;
  --gadget-bubble: #ffffff;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06);
  --shadow-md: 0 6px 24px rgba(16,24,40,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Topbar */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--navy-2);
  flex-shrink: 0;
}
.brand-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .2px;
}
.brand-sub {
  margin-left: 12px;
  font-size: 12px;
  color: #a9b7c9;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.actor {
  font-size: 12px;
  color: #a9b7c9;
}
.actor #actor-email { color: #fff; font-weight: 500; }

/* Shell */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr 280px;
  flex: 1;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  background: var(--bg-alt);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  overflow-y: auto;
}
.sidebar-section { margin-bottom: 22px; }
.sidebar h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 10px 4px;
}
.new-chat {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  transition: border-color .15s, color .15s;
}
.new-chat:hover { border-color: var(--cyan); color: var(--cyan); }
.history-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.history-list li {
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.history-list li:hover { background: #fff; color: var(--cyan); }
.history-list li.active { background: #fff; color: var(--cyan); }
.history-empty { color: var(--muted); font-style: italic; cursor: default !important; }
.history-empty:hover { background: transparent !important; color: var(--muted) !important; }

/* Chat pane */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 12px;
}
.welcome {
  max-width: 640px;
  margin: 60px auto 0;
  text-align: center;
}
.welcome h1 {
  font-family: 'Playfair Display', serif;
  font-size: 42px;
  margin: 0 0 8px;
  color: var(--navy);
}
.welcome p {
  color: var(--muted);
  margin: 0;
}

/* Message bubbles */
.msg {
  max-width: 720px;
  margin: 0 auto 18px;
  display: flex;
  flex-direction: column;
}
.msg-role {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user .bubble {
  background: var(--user-bubble);
  border: 1px solid var(--line);
}
.msg.gadget .bubble {
  background: var(--gadget-bubble);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.msg.gadget .tools-used {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.msg.thinking .bubble {
  color: var(--muted);
  font-style: italic;
  background: var(--line-2);
  border-color: var(--line);
}
.dot-loader::after {
  content: '';
  animation: dots 1.2s steps(3, end) infinite;
}
@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* Composer */
.composer {
  border-top: 1px solid var(--line);
  padding: 14px 24px 20px;
  background: #fff;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 14px;
  font: inherit;
  color: var(--ink);
  outline: none;
  max-height: 160px;
  transition: border-color .15s;
}
.composer textarea:focus { border-color: var(--cyan); }
.composer button {
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 11px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.composer button:hover { background: var(--cyan); }
.composer button:disabled { opacity: .5; cursor: not-allowed; }

/* Quick actions panel */
.quickpanel {
  background: var(--bg-alt);
  border-left: 1px solid var(--line);
  padding: 18px 14px;
  overflow-y: auto;
}
.quickpanel h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 0 0 12px 4px;
}
.quickpanel button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.quickpanel button:hover { border-color: var(--cyan); color: var(--cyan); }

/* Mobile */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar, .quickpanel { display: none; }
  .welcome h1 { font-size: 32px; }
  .messages { padding: 16px; }
  .composer { padding: 12px 14px 16px; }
}
