/* Admin chat — fully scoped to .chat-* selectors. No bare element rules. */

.chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 4px;
}

.chat-log {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 14px;
  height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.chat-log:empty::before {
  content: "Ask me to add, list, or delete calendar events.";
  color: var(--muted);
  font-style: italic;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-msg-role {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.chat-msg-body {
  color: var(--fg);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.chat-msg-body strong { font-weight: 600; }
.chat-msg-body code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.chat-msg-user .chat-msg-body { color: var(--fg); }

.chat-tool {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow: hidden;
}

.chat-tool-head {
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  color: var(--muted);
}

.chat-tool-head:hover { background: #f3f3f3; }

.chat-tool-name {
  color: var(--fg);
  font-weight: 600;
}

.chat-tool-status {
  font-size: 0.78em;
  padding: 1px 6px;
  border-radius: 3px;
}
.chat-tool-status.pending { color: var(--muted); }
.chat-tool-status.ok      { color: #1a7f37; }
.chat-tool-status.err     { color: #b91c1c; }

.chat-tool-body {
  padding: 0 10px 8px 10px;
  border-top: 1px solid var(--line);
  background: #fafafa;
}

.chat-tool-body[hidden] { display: none; }

.chat-tool-section {
  margin-top: 6px;
}
.chat-tool-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.chat-tool-json {
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  font-size: 0.8rem;
}

.chat-status {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  padding: 4px 0;
}
.chat-status.err { color: #b91c1c; font-style: normal; }

.chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 60px;
  max-height: 200px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  resize: vertical;
  color: var(--fg);
  background: #fff;
}
.chat-input:focus {
  outline: none;
  border-color: #93b1ff;
  box-shadow: 0 0 0 2px rgba(147, 177, 255, 0.25);
}
.chat-input:disabled { background: var(--bg); color: var(--muted); }

.chat-btn {
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.chat-btn:hover:not(:disabled) { background: var(--bg); }
.chat-btn:disabled { color: var(--muted); cursor: not-allowed; }
.chat-btn-primary {
  background: var(--fg);
  color: #fff;
  border-color: var(--fg);
}
.chat-btn-primary:hover:not(:disabled) { background: #333; }
.chat-btn-primary:disabled { background: #999; border-color: #999; }

.chat-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.chat-footer-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}
.chat-footer-link:hover { color: var(--fg); }
.chat-footer-link:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: none;
}
