/* Agentic Miner - V360 Visual Identity
 *
 * Colors:
 *   --purple-dark:   #391B54  (body text)
 *   --purple-mid:    #592A9E  (sections, accents)
 *   --purple-light:  #783DBC  (headings, primary buttons)
 *   --orange:        #FF5C13  (accent, highlights)
 *   --navy:          #151731  (dark sections)
 *   --gray-bg:       #F1F0EE  (alt backgrounds)
 *   --white:         #FFFFFF
 *   --text-muted:    rgba(57, 27, 84, 0.6)
 *
 * Fonts: Ubuntu (headings), Inter (body)
 */

:root {
  --purple-dark: #391B54;
  --purple-mid: #592A9E;
  --purple-light: #783DBC;
  --orange: #FF5C13;
  --navy: #151731;
  --gray-bg: #F1F0EE;
  --text-muted: rgba(57, 27, 84, 0.6);
  --border-color: rgba(57, 27, 84, 0.12);
  --border-color-strong: rgba(57, 27, 84, 0.2);
}

/* === Reset & Base === */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #FFFFFF;
  color: var(--purple-dark);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: 'Ubuntu', sans-serif;
  font-weight: 600;
  color: var(--purple-light);
  margin-top: 0;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }

a {
  color: var(--purple-light);
  text-decoration: none;
}

a:hover {
  color: var(--purple-mid);
  text-decoration: underline;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* === Nav === */

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.65rem 1.5rem;
  background: #FFFFFF;
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(57, 27, 84, 0.06);
}

.nav-brand {
  font-family: 'Ubuntu', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--purple-light);
  text-decoration: none;
  letter-spacing: -0.5px;
}

.nav-brand:hover {
  text-decoration: none;
  color: var(--purple-mid);
}

.nav-brand span {
  color: var(--orange);
}

.nav a {
  color: var(--purple-dark);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.nav a:hover {
  color: var(--purple-light);
  border-bottom-color: var(--purple-light);
  text-decoration: none;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-menu {
  position: relative;
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--purple-light);
  color: #fff;
  border: 2px solid transparent;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s;
}

.profile-avatar:hover {
  border-color: var(--purple-mid);
}

.profile-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  width: max-content;
  max-width: 280px;
  z-index: 100;
  overflow: hidden;
}

.profile-menu:hover .profile-dropdown,
.profile-menu:focus-within .profile-dropdown {
  display: block;
}

.profile-dropdown-header {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-dropdown-item,
.profile-dropdown a.profile-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--purple-dark);
  text-decoration: none;
  background: none;
  border: none;
  border-bottom: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.profile-dropdown-item:hover,
.profile-dropdown a.profile-dropdown-item:hover {
  background: var(--gray-bg);
  color: var(--purple-dark);
  border-bottom: none;
}

.profile-dropdown-signout {
  border-top: 1px solid var(--border-color);
  color: var(--orange);
}

.profile-dropdown form {
  margin: 0;
}

/* === Main Content === */

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* === Flash Messages === */

.flash-notice {
  color: #2e7d32;
  background: #e8f5e9;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid #a5d6a7;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.flash-alert {
  color: #c62828;
  background: #ffebee;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid #ef9a9a;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* === Buttons === */

.btn {
  display: inline-block;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
  transition: background 0.2s, transform 0.1s;
  line-height: 1.4;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--purple-light);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--purple-mid);
  color: #FFFFFF;
}

.btn-primary:disabled {
  background: var(--border-color-strong);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-orange {
  background: var(--orange);
  color: #FFFFFF;
}

.btn-orange:hover {
  background: #e05210;
  color: #FFFFFF;
}

.btn-outline {
  background: transparent;
  color: var(--purple-light);
  border: 1px solid var(--purple-light);
}

.btn-outline:hover {
  background: rgba(120, 61, 188, 0.06);
  color: var(--purple-mid);
}

.btn-danger {
  background: none;
  border: none;
  color: #c62828;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0.5rem;
}

.btn-danger:hover {
  color: #b71c1c;
  text-decoration: underline;
}

.table-actions {
  white-space: nowrap;
}

.table-actions > * {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.table-actions > *:last-child {
  margin-right: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
  color: var(--text-muted);
  transition: color 0.15s, background 0.15s;
}

.btn-icon:hover {
  background: rgba(120, 61, 188, 0.08);
  color: var(--purple-mid);
}

.btn-icon--danger {
  color: var(--text-muted);
}

.btn-icon--danger:hover {
  background: rgba(198, 40, 40, 0.08);
  color: #c62828;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
}

/* === Forms === */

.form-section {
  margin-bottom: 1.5rem;
}

.form-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--purple-dark);
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #FFFFFF;
  color: var(--purple-dark);
  border: 1px solid var(--border-color-strong);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(120, 61, 188, 0.12);
}

.form-input::placeholder {
  color: rgba(57, 27, 84, 0.35);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.form-row .form-group {
  flex: 1;
}

.form-check-inline {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-check-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.inline-form {
  margin-bottom: 2rem;
  padding: 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 0.5rem;
  background: #fafafa;
}

.inline-form .form-group {
  margin-bottom: 0.5rem;
}

.inline-form .form-actions {
  margin-top: 0.5rem;
}

.form-errors {
  color: #c62828;
  background: #ffebee;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid #ef9a9a;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* === Cards === */

.card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(57, 27, 84, 0.05);
}

/* === Tables === */

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color-strong);
}

.table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  vertical-align: middle;
}


.table tr:hover {
  background: rgba(120, 61, 188, 0.03);
}

/* === Page Header === */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

/* === Chat Sessions List === */

.session-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  text-decoration: none;
  color: var(--purple-dark);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.session-item:hover {
  border-color: var(--purple-light);
  box-shadow: 0 2px 8px rgba(120, 61, 188, 0.08);
  text-decoration: none;
  color: var(--purple-dark);
}

.session-id {
  font-weight: 600;
  color: var(--purple-dark);
}

.session-model {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 0.75rem;
}

.session-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 0.75rem;
}

.session-status {
  margin-left: 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.session-status.active {
  color: #2e7d32;
}

.session-status.completed {
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

/* === Chat Show === */

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.chat-header h2 {
  margin: 0;
}

.chat-header-meta {
  color: var(--text-muted);
  font-size: 0.8em;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

.chat-header-back {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  background: var(--gray-bg);
  border-radius: 10px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border-color);
}

.message-composer {
  border: 1px solid var(--border-color-strong);
  border-radius: 10px;
  background: #FFFFFF;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.message-composer:focus-within {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(120, 61, 188, 0.12);
}

.message-input {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--purple-dark);
  border: none !important;
  border-radius: 0;
  resize: none;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
}

.message-input .lexxy-editor__content {
  min-block-size: 5rem;
}

.message-composer-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid var(--border-color);
  background: rgba(241, 240, 238, 0.5);
}

.chat-ended {
  text-align: center;
  color: var(--text-muted);
  padding: 0.5rem;
}

.message-processing {
  background: transparent;
  border: none;
  font-size: 0.85em;
  color: var(--text-muted);
  padding: 0.3rem 0.75rem;
}

.message-processing .message-content {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.processing-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--purple-light);
  border-radius: 50%;
  animation: processing-pulse 1.2s ease-in-out infinite;
}

@keyframes processing-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.btn-stop-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--border-color-strong);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-stop-icon:hover {
  background: var(--gray-bg);
  border-color: var(--purple-light);
  color: var(--purple-dark);
}

/* === Message Bubble === */

.message {
  margin-bottom: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
}

.message-user {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
}

.message-assistant {
  background: rgba(120, 61, 188, 0.06);
  border: 1px solid rgba(120, 61, 188, 0.1);
}

.message-system {
  background: rgba(57, 27, 84, 0.04);
  font-size: 0.85em;
  color: var(--text-muted);
}

.message-meta {
  font-size: 0.7em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
  font-weight: 500;
}

.message-meta-time {
  margin-left: 0.5rem;
  font-weight: 400;
}

.message-content {
  color: var(--purple-dark);
  word-wrap: break-word;
  line-height: 1.5;
}

.message-content p {
  margin: 0 0 0.4em;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* === Message Feedback === */

.message-feedback {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding-top: 0.25rem;
}

.feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75em;
  transition: all 0.15s ease;
}

.feedback-btn:hover {
  border-color: var(--purple-light);
  color: var(--purple-light);
}

.feedback-btn--active {
  border-color: var(--purple-light);
  background: rgba(120, 61, 188, 0.1);
  color: var(--purple-light);
}

.feedback-count {
  font-size: 0.85em;
  min-width: 0.5em;
  text-align: center;
}

/* === Feedback Dashboard === */

.feedback-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.feedback-stat-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
}

.feedback-stat-card h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.feedback-stat-value {
  font-family: 'Ubuntu', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--purple-light);
}

.feedback-stat-value--positive {
  color: #2e7d32;
}

.feedback-stat-value--negative {
  color: #c62828;
}

.feedback-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.feedback-chart-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
}

.feedback-chart-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

@media (max-width: 768px) {
  .feedback-charts {
    grid-template-columns: 1fr;
  }
}

/* === Auth Pages === */

.auth-container {
  max-width: 400px;
  margin: 4rem auto;
  padding: 2rem;
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-container .form-input {
  margin-bottom: 0.75rem;
}

.auth-container .btn {
  width: 100%;
  text-align: center;
  margin-bottom: 1rem;
}

.auth-link {
  display: block;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-link:hover {
  color: var(--purple-light);
}

/* === Admin Chat Session Details === */

.chat-session-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.chat-session-detail {
  font-size: 0.88rem;
}

.chat-session-detail-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: block;
  margin-bottom: 0.1rem;
}

.chat-session-badge {
  display: inline-block;
  background: rgba(120, 61, 188, 0.08);
  color: var(--purple-mid);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}

/* Tool call / tool result message styles */

.message-tool-call {
  background: rgba(57, 27, 84, 0.04);
  border: 1px dashed var(--border-color-strong);
  font-size: 0.88em;
}

.message-tool-call code {
  font-size: 0.9em;
  word-break: break-all;
}

.message-tool-result {
  background: rgba(57, 27, 84, 0.03);
  border: 1px solid var(--border-color);
  font-size: 0.85em;
  color: var(--text-muted);
}

/* === Admin === */

.admin-edit-form textarea.form-input {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
}

/* === Onboarding === */

.onboarding-wrapper {
  min-height: 100vh;
  background: var(--gray-bg);
}

.onboarding-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.65rem 1.5rem;
  background: #FFFFFF;
  border-bottom: 2px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(57, 27, 84, 0.06);
}

.onboarding-title {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.onboarding-progress {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border-color);
}

.onboarding-progress-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all 0.2s;
}

.onboarding-progress-step.active {
  background: var(--purple-light);
  color: #FFFFFF;
}

.onboarding-progress-step.completed {
  background: rgba(120, 61, 188, 0.1);
  color: var(--purple-mid);
}

.onboarding-progress-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--border-color);
  color: var(--text-muted);
}

.onboarding-progress-step.active .onboarding-progress-dot {
  background: rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
}

.onboarding-progress-step.completed .onboarding-progress-dot {
  background: var(--purple-light);
  color: #FFFFFF;
}

.onboarding-progress-label {
  display: none;
}

@media (min-width: 640px) {
  .onboarding-progress-label {
    display: inline;
  }
}

.onboarding-container {
  max-width: 640px;
  margin: 2rem auto;
  padding: 2rem;
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(57, 27, 84, 0.06);
}

.onboarding-container h2 {
  margin-bottom: 0.25rem;
}

.onboarding-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.onboarding-form {
  margin-top: 0.5rem;
}

.onboarding-info {
  background: rgba(120, 61, 188, 0.06);
  border: 1px solid rgba(120, 61, 188, 0.1);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--purple-mid);
  margin-bottom: 1rem;
}

/* Model selection grid */

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.model-card {
  position: relative;
  display: block;
  padding: 0.85rem 1rem;
  background: #FFFFFF;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.model-card:hover {
  border-color: var(--purple-light);
}

.model-card.selected {
  border-color: var(--purple-light);
  background: rgba(120, 61, 188, 0.04);
  box-shadow: 0 0 0 3px rgba(120, 61, 188, 0.12);
}

.model-checkbox {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.model-checkbox:focus + .model-card-name {
  outline: 2px solid var(--purple-light);
  outline-offset: 2px;
  border-radius: 4px;
}

.model-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--purple-dark);
  margin-bottom: 0.15rem;
}

.model-card-id {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: 'SFMono-Regular', Consolas, monospace;
}

.model-card-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* SOUL editor */

.soul-editor {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  min-height: 300px;
}

/* Complete step */

.onboarding-complete {
  text-align: center;
}

.onboarding-complete h2 {
  color: var(--purple-light);
}

.onboarding-summary {
  background: var(--gray-bg);
  border-radius: 10px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  text-align: left;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-label {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.summary-value {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--purple-dark);
}

/* === Badges === */

.badge {
  display: inline-block;
  background: rgba(120, 61, 188, 0.08);
  color: var(--purple-mid);
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.1rem 0.5rem;
  border-radius: 4px;
}

.badge--active {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge--completed {
  background: rgba(57, 27, 84, 0.06);
  color: var(--text-muted);
}

.badge--positive {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge--negative {
  background: #ffebee;
  color: #c62828;
}

.chart-container {
  width: 100%;
  height: 300px;
}

/* === Utility classes === */

.muted {
  color: var(--text-muted);
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  transform: none;
}

.btn-sm:hover {
  transform: none;
}

.text-muted {
  color: var(--text-muted);
}

.mb-md {
  margin-bottom: 1.25rem;
}

.ml-xs {
  margin-left: 0.25rem;
}

.mt-md {
  margin-top: 2rem;
}

.messages-area--static {
  height: auto;
  max-height: none;
  flex: none;
}

.pre-wrap-sm {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.85em;
}

.form-actions--center {
  justify-content: center;
}

/* === Admin section === */

.admin-section {
  margin-top: 2rem;
}

.admin-section h2 {
  margin-bottom: 0.5rem;
}

/* === Code block === */

.code-block {
  background: var(--gray-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
}

/* === Form check === */

.form-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.15rem 0;
}

.form-check label {
  font-size: 0.9rem;
  color: var(--purple-dark);
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--purple-light);
  cursor: pointer;
}

/* === Responsive nav === */

.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--purple-dark);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .nav-toggle-label {
    display: block;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #FFFFFF;
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 4px 8px rgba(57, 27, 84, 0.08);
    padding: 0.75rem 1.5rem;
    gap: 0.5rem;
    z-index: 100;
  }

  .nav-toggle:checked ~ .nav-links {
    display: flex;
  }

  .nav {
    flex-wrap: wrap;
    position: relative;
  }

  .nav-right {
    margin-left: auto;
  }
}
