.history-panel {
  display: grid;
  gap: 16px;
}

.history-guest-hint {
  margin: 0;
  color: var(--kavana-muted);
  font-size: 0.85rem;
  text-align: center;
}

.history-section h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--kavana-blue-dark);
}

.history-list {
  max-height: none;
  overflow-y: visible;
}

.history-item-open {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: white;
  /* public/styles.css's global "button" rule sets color: white (meant for
     the app's normal blue-filled buttons) - this row is a plain light
     button, so it needs its own readable text color explicitly, not just
     an overridden background. */
  color: var(--kavana-text);
  border: 1px solid var(--kavana-border);
  border-radius: 10px;
  padding: 10px 14px;
  text-align: right;
}

.history-item-open:hover {
  border-color: var(--kavana-blue);
  color: var(--kavana-text);
}

.history-item-open:focus-visible {
  outline: 2px solid var(--kavana-blue);
  outline-offset: 1px;
  color: var(--kavana-text);
}

.history-item-title {
  color: var(--kavana-text);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item-meta {
  color: var(--kavana-muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.history-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.history-attempt-card {
  border: 1px solid var(--kavana-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--kavana-soft-blue);
}

.history-attempt-card summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--kavana-blue-dark);
}

.history-attempt-meta {
  margin: 8px 0 0;
  font-size: 0.88rem;
}

.history-attempt-meta p {
  margin: 3px 0;
}

.history-transcript {
  white-space: pre-wrap;
  background: white;
  border: 1px solid var(--kavana-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0 0;
  font-size: 0.9rem;
  max-height: 260px;
  overflow-y: auto;
}

.history-attempt-feedback {
  margin-top: 10px;
  display: grid;
  gap: 12px;
}

.history-message {
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.history-message-user {
  background: var(--kavana-soft-blue);
}

.history-message-assistant {
  background: white;
  border: 1px solid var(--kavana-border);
}

.history-message-role {
  display: block;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--kavana-muted);
  margin-bottom: 3px;
}

/* Deliberately understated - a "delete everything" action should never
   look like the page's primary action. */
.history-danger-zone {
  border-top: 3px solid var(--kavana-border);
  display: grid;
  gap: 8px;
  justify-items: start;
}

.history-danger-zone h2 {
  color: var(--kavana-muted);
  font-size: 0.95rem;
}

.history-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.printable-conversation { display: none; }

@media print {
  body > .shell > *:not(#conversation-print-view) { display: none !important; }
  .printable-conversation {
    display: block !important;
    white-space: pre-wrap;
    direction: rtl;
    color: #000;
    font: 12pt/1.6 Heebo, Arial, sans-serif;
  }
}
