/**
 * Aria Chat Widget — Frontend styles
 * Floating chat panel + tool widgets for the KNW Kids AI assistant.
 */

/* ============================================================
   Custom properties (re-uses token values from tokens.css)
   ============================================================ */
:root {
  --aria-primary:        #6366f1;
  --aria-primary-dark:   #4f46e5;
  --aria-surface:        #ffffff;
  --aria-surface-alt:    #f8f8ff;
  --aria-border:         #e5e7eb;
  --aria-text:           #1f2937;
  --aria-text-muted:     #6b7280;
  --aria-user-bg:        #6366f1;
  --aria-user-text:      #ffffff;
  --aria-bot-bg:         #f3f4f6;
  --aria-bot-text:       #1f2937;
  --aria-success:        #10b981;
  --aria-error:          #ef4444;
  --aria-warning:        #f59e0b;
  --aria-radius:         16px;
  --aria-radius-sm:      8px;
  --aria-shadow:         0 8px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
  --aria-panel-w:        420px;
  --aria-panel-h:        520px;
  --aria-z:              9999;
  --aria-font:           -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================================
   Floating widget host
   ============================================================ */
#knw-aria-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: var(--aria-z);
  font-family: var(--aria-font);
  font-size: 14px;
  line-height: 1.5;
  z-index: 10009;
}

#knw-aria-inline {
  position: relative;
  width: 100%;
  max-width: var(--aria-panel-w);
  margin: 0 auto;
  font-family: var(--aria-font);
  font-size: 14px;
  line-height: 1.5;
}

/* ============================================================
   FAB button
   ============================================================ */
.knw-aria__fab {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--aria-primary);
  color: #fff;
  border-radius: 28px;
  padding: 12px 18px;
  cursor: pointer;
  box-shadow: var(--aria-shadow);
  transition: background 0.2s, transform 0.15s;
  user-select: none;
  border: none;
}

.knw-aria__fab:hover {
  background: var(--aria-primary-dark);
  transform: translateY(-2px);
}

.knw-aria__fab:focus-visible {
  outline: 3px solid var(--aria-primary);
  outline-offset: 3px;
}

.knw-aria__fab-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.knw-aria__fab-label {
  font-weight: 600;
  font-size: 14px;
}

#knw-aria-widget[data-state="open"] .knw-aria__fab {
  border-radius: 50%;
  padding: 12px;
}

#knw-aria-widget[data-state="open"] .knw-aria__fab-label {
  display: none;
}

/* ============================================================
   Panel
   ============================================================ */
.knw-aria__panel {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: var(--aria-panel-w);
  height: var(--aria-panel-h);
  background: var(--aria-surface);
  border-radius: var(--aria-radius);
  box-shadow: var(--aria-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: knwAriaSlideIn 0.2s ease;
}

#knw-aria-inline .knw-aria__panel {
  position: relative;
  bottom: auto;
  right: auto;
  width: 100%;
  height: var(--aria-panel-h);
}

@keyframes knwAriaSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   Header
   ============================================================ */
.knw-aria__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--aria-primary) 0%, #8b5cf6 100%);
  color: #fff;
  flex-shrink: 0;
}

.knw-aria__header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.knw-aria__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.knw-aria__name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
}

.knw-aria__tagline {
  font-size: 11px;
  opacity: 0.8;
}

.knw-aria__close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.knw-aria__close:hover {
  color: #fff;
  background: rgba(255,255,255,0.15);
}

/* ============================================================
   Message list
   ============================================================ */
.knw-aria__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.knw-aria__messages::-webkit-scrollbar {
  width: 4px;
}
.knw-aria__messages::-webkit-scrollbar-track {
  background: transparent;
}
.knw-aria__messages::-webkit-scrollbar-thumb {
  background: var(--aria-border);
  border-radius: 2px;
}

/* ============================================================
   Message bubbles
   ============================================================ */
.knw-aria__message {
  display: flex;
  max-width: 88%;
}

.knw-aria__message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.knw-aria__message--assistant {
  align-self: flex-start;
}

.knw-aria__message--widget {
  max-width: 100%;
  width: 100%;
}

.knw-aria__bubble {
  background: var(--aria-bot-bg);
  color: var(--aria-bot-text);
  border-radius: 18px 18px 18px 4px;
  padding: 10px 14px;
  font-size: 13.5px;
  word-break: break-word;
  white-space: pre-wrap;
}

.knw-aria__message--user .knw-aria__bubble {
  background: var(--aria-user-bg);
  color: var(--aria-user-text);
  border-radius: 18px 18px 4px 18px;
}

.knw-aria__message--error .knw-aria__bubble {
  background: #fef2f2;
  color: var(--aria-error);
  border: 1px solid #fecaca;
}

/* ============================================================
   Thinking indicator
   ============================================================ */
.knw-aria__thinking-dots {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
}

.knw-aria__thinking-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--aria-text-muted);
  border-radius: 50%;
  animation: knwThinkingBounce 1.2s infinite;
}

.knw-aria__thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.knw-aria__thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes knwThinkingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-5px); opacity: 1; }
}

/* ============================================================
   Available Tools Toggle (dashboard parity)
   ============================================================ */
.knw-aria__tools-toggle {
  position: relative;
  padding: 4px 12px 6px;
  flex-shrink: 0;
}

.knw-aria__tools-toggle:empty {
  display: none;
}

.knw-chat-tools-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(99, 102, 241, 0.24);
  background: rgba(99, 102, 241, 0.08);
  color: var(--aria-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--aria-font);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.knw-chat-tools-btn:hover,
.knw-chat-tools-btn.is-active {
  background: var(--aria-primary);
  border-color: var(--aria-primary);
  color: #fff;
}

.knw-tools-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: var(--aria-primary);
}

.knw-chat-tools-btn.is-active .knw-tools-count {
  background: rgba(255, 255, 255, 0.28);
}

.knw-chat-tools-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  min-width: 220px;
  max-width: 320px;
  max-height: 320px;
  background: var(--aria-surface);
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  display: none;
  flex-direction: column;
  z-index: 20;
}

.knw-chat-tools-panel.is-open {
  display: flex;
  animation: knwPanelIn 0.2s ease both;
}

@keyframes knwPanelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.knw-chat-tools-panel-header {
  padding: 10px 14px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--aria-text-muted);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.knw-chat-tools-search-wrap {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
}

.knw-chat-tools-search {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 9px;
  background: var(--aria-surface-alt);
  color: var(--aria-text);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  font-family: var(--aria-font);
}

.knw-chat-tools-search:focus {
  outline: none;
  border-color: var(--aria-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.knw-chat-tools-panel-scroll {
  overflow-y: auto;
  flex: 1;
}

.knw-chat-tools-group {
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.knw-chat-tools-group-header {
  width: 100%;
  border: none;
  background: rgba(0, 0, 0, 0.02);
  color: var(--aria-text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--aria-font);
}

.knw-chat-tools-group-title {
  flex: 1;
  text-align: left;
}

.knw-chat-tools-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 99px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.08);
  color: var(--aria-text-muted);
}

.knw-chat-tools-group-chevron {
  width: 12px;
  text-align: center;
}

.knw-chat-tool-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.knw-chat-tool-row:last-child {
  border-bottom: none;
}

.knw-chat-tool-item {
  display: block;
  width: 100%;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--aria-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--aria-text);
  padding: 11px 14px;
  transition: background 0.15s ease, color 0.15s ease;
}

.knw-chat-tool-item:hover,
.knw-chat-tool-item:focus {
  background: rgba(99, 102, 241, 0.08);
  color: var(--aria-primary);
  outline: none;
}

.knw-chat-tool-fav {
  width: 36px;
  flex-shrink: 0;
  border: none;
  border-left: 1px solid rgba(0, 0, 0, 0.04);
  background: transparent;
  color: var(--aria-text-muted);
  font-size: 14px;
  cursor: pointer;
}

.knw-chat-tool-fav:hover,
.knw-chat-tool-fav.is-active {
  color: #d79d00;
  background: rgba(215, 157, 0, 0.08);
}

.knw-chat-tools-empty {
  padding: 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--aria-text-muted);
}

/* ============================================================
   Attachment Tray (dashboard parity)
   ============================================================ */
.knw-chat-attach-tray {
  display: flex;
  align-items: center;
  justify-content: space-around;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  padding: 0 12px;
  flex-shrink: 0;
  background: var(--aria-surface-alt);
  border-top: 1px solid transparent;
  transition: max-height 0.3s ease, opacity 0.22s ease, padding 0.22s ease, border-color 0.22s ease;
}

.knw-chat-attach-tray.open {
  max-height: 96px;
  opacity: 1;
  padding: 12px 12px 10px;
  border-color: rgba(0, 0, 0, 0.06);
}

.knw-attach-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-family: var(--aria-font);
}

.knw-attach-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.knw-attach-icon svg {
  width: 20px;
  height: 20px;
}

.knw-attach-icon--voice { background: #ede9fe; color: #7c3aed; }
.knw-attach-icon--image { background: #dbeafe; color: #1d4ed8; }
.knw-attach-icon--video { background: #d1fae5; color: #065f46; }
.knw-attach-icon--document { background: #fef3c7; color: #92400e; }
.knw-attach-icon--location { background: #fee2e2; color: #b91c1c; }

.knw-attach-item span {
  font-size: 10px;
  font-weight: 700;
  color: var(--aria-text-muted);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.knw-chat-attach-btn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--aria-border);
  background: var(--aria-surface-alt);
  color: var(--aria-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.knw-chat-attach-btn svg {
  width: 16px;
  height: 16px;
}

.knw-chat-attach-btn.open {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.35);
  color: var(--aria-primary);
  transform: rotate(45deg);
}

/* ============================================================
   Input area
   ============================================================ */
.knw-aria__input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 12px 12px 16px;
  border-top: 1px solid var(--aria-border);
  background: var(--aria-surface);
  flex-shrink: 0;
}

.knw-aria__input {
  flex: 1;
  border: 1.5px solid var(--aria-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: var(--aria-font);
  resize: none;
  outline: none;
  line-height: 1.4;
  min-height: 38px;
  max-height: none;
  overflow-y: hidden;
  transition: border-color 0.15s;
  color: var(--aria-text);
  background: var(--aria-surface);
}

.knw-aria__input:focus {
  border-color: var(--aria-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

.knw-aria__input::placeholder {
  color: var(--aria-text-muted);
}

.knw-aria__send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--aria-primary);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.1s;
}

.knw-aria__send:hover:not(:disabled) {
  background: var(--aria-primary-dark);
  transform: scale(1.08);
}

.knw-aria__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.knw-aria__send svg {
  width: 16px;
  height: 16px;
}

/* ============================================================
   Tool Widgets
   ============================================================ */
.knw-widget {
  background: var(--aria-surface);
  border: 1.5px solid var(--aria-border);
  border-radius: var(--aria-radius-sm);
  overflow: hidden;
  font-size: 13px;
  width: 100%;
}

.knw-widget--success {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.knw-widget--error {
  border-color: #fecaca;
  background: #fef2f2;
}

.knw-widget--pending {
  border-color: #fde68a;
  background: #fffbeb;
}

.knw-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: rgba(99,102,241,0.07);
  border-bottom: 1px solid var(--aria-border);
}

.knw-widget--success .knw-widget__header {
  background: rgba(16,185,129,0.08);
  border-bottom-color: #a7f3d0;
}

.knw-widget__tool-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--aria-primary);
  letter-spacing: 0.3px;
}

.knw-widget--success .knw-widget__tool-badge {
  color: #065f46;
}

.knw-widget__status-icon {
  font-size: 14px;
}

.knw-widget__body {
  padding: 12px;
}

.knw-widget__footer {
  padding: 8px 12px;
  background: rgba(0,0,0,0.02);
  border-top: 1px solid var(--aria-border);
  font-size: 12px;
  color: var(--aria-text-muted);
}

/* Reflection widget */
.knw-widget__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.knw-widget__mood,
.knw-widget__date,
.knw-widget__subject,
.knw-widget__period {
  font-size: 12px;
  background: rgba(99,102,241,0.08);
  color: var(--aria-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.knw-widget__reflection-text {
  margin: 0 0 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.7);
  border-left: 3px solid var(--aria-primary);
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: var(--aria-text);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.knw-widget__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.knw-widget__tag {
  background: rgba(99,102,241,0.1);
  color: var(--aria-primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

/* Stats widget */
.knw-widget__stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 8px 12px 12px;
}

.knw-widget__stat {
  background: rgba(99,102,241,0.06);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.knw-widget__stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--aria-primary);
  line-height: 1;
}

.knw-widget__stat-label {
  font-size: 11px;
  color: var(--aria-text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ============================================================
   Guided conversation choice chips
   ============================================================ */
.knw-guided-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 16px 10px;
}

.knw-guided-choices--skip {
  padding-top: 2px;
}

.knw-guided-choice-btn {
  background: var(--aria-surface);
  border: 1.5px solid var(--aria-border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: var(--aria-font);
  color: var(--aria-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.knw-guided-choice-btn:hover {
  background: rgba(99,102,241,0.07);
  border-color: var(--aria-primary);
  color: var(--aria-primary);
}

.knw-guided-choice-btn:active {
  background: var(--aria-primary);
  border-color: var(--aria-primary);
  color: #fff;
}

.knw-guided-choice-btn--skip {
  border-style: dashed;
  color: var(--aria-text-muted);
  font-size: 12px;
}

.knw-guided-choice-btn--skip:hover {
  border-color: var(--aria-text-muted);
  color: var(--aria-text-muted);
  background: rgba(0,0,0,0.04);
}

/* ============================================================
   Extended widget elements — profile, mission, journal, etc.
   ============================================================ */

/* Empty state */
.knw-widget__empty {
  color: var(--aria-text-muted);
  font-size: 12px;
  font-style: italic;
  margin: 0;
  padding: 4px 0;
}

/* Profile */
.knw-widget__profile-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--aria-text);
  margin-bottom: 4px;
}

.knw-widget__profile-detail {
  font-size: 12px;
  color: var(--aria-text-muted);
  margin-top: 2px;
}

/* Mission */
.knw-widget__mission-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--aria-text);
  margin-bottom: 6px;
}

.knw-widget__mission-desc {
  font-size: 12px;
  color: var(--aria-text-muted);
  margin: 0 0 10px;
  line-height: 1.5;
}

.knw-widget__progress-bar {
  width: 100%;
  height: 6px;
  background: var(--aria-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.knw-widget__progress-fill {
  height: 100%;
  background: var(--aria-primary);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.knw-widget__progress-label {
  font-size: 11px;
  color: var(--aria-text-muted);
}

/* Generic list item (journal, lessons, missions, knowledge) */
.knw-widget__list-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--aria-border);
}

.knw-widget__list-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.knw-widget__list-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--aria-text);
  margin-bottom: 2px;
}

.knw-widget__list-link {
  color: var(--aria-primary);
  text-decoration: none;
  font-weight: 700;
}

.knw-widget__list-link:hover {
  text-decoration: underline;
}

.knw-widget__list-preview {
  font-size: 12px;
  color: var(--aria-text-muted);
  margin: 2px 0 0;
  line-height: 1.4;
}

/* Timeline */
.knw-widget__timeline-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--aria-border);
}

.knw-widget__timeline-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.knw-widget__timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aria-primary);
  flex-shrink: 0;
  margin-top: 4px;
}

.knw-widget__timeline-body {
  flex: 1;
  min-width: 0;
}

.knw-widget__timeline-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--aria-text);
  margin-bottom: 2px;
}

/* Recommendations */
.knw-widget__rec {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--aria-border);
}

.knw-widget__rec:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.knw-widget__rec-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--aria-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.knw-widget__rec-body {
  flex: 1;
  min-width: 0;
}

.knw-widget__rec-action {
  font-size: 13px;
  font-weight: 600;
  color: var(--aria-text);
  margin-bottom: 2px;
}

.knw-widget__rec-reason {
  font-size: 12px;
  color: var(--aria-text-muted);
  line-height: 1.4;
}

/* Skill gap */
.knw-widget__gap-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.knw-widget__severity-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ============================================================
   Admin: Aria Settings page styles
   ============================================================ */
.knw-aria-settings {
  max-width: 760px;
}

.knw-aria-status-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
}

.knw-aria-status-banner--ok {
  background: #f0fdf4;
  border: 1px solid #a7f3d0;
  color: #065f46;
}

.knw-aria-status-banner--warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.knw-settings-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}

.knw-settings-section h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  padding: 0 0 10px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
}

.knw-test-ok   { color: #065f46; font-weight: 600; }
.knw-test-fail { color: #991b1b; font-weight: 600; }

.knw-aria-tools-list {
  margin: 8px 0 0 20px;
  line-height: 1.8;
}

.knw-aria-prompt-preview {
  margin-top: 10px;
  padding: 14px 16px;
  background: #f8f8ff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: #374151;
  max-height: 320px;
  overflow-y: auto;
}

/* Toggle switch */
.knw-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  vertical-align: middle;
}

.knw-toggle input { opacity: 0; width: 0; height: 0; }

.knw-toggle__slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s;
}

.knw-toggle__slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.knw-toggle input:checked + .knw-toggle__slider {
  background: var(--aria-primary);
}

.knw-toggle input:checked + .knw-toggle__slider::before {
  transform: translateX(20px);
}


/* ── Loop widget additions ─────────────────────────────────── */

.knw-widget__list-item--btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--aria-border);
  padding: 9px 4px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 13px;
  color: var(--aria-text);
}

.knw-widget__list-item--btn:last-child {
  border-bottom: none;
  padding-bottom: 4px;
}

.knw-widget__list-item--btn:hover {
  background: rgba(99,102,241,0.06);
  border-radius: 4px;
}

.knw-widget__list-item-text {
  flex: 1;
}

.knw-widget__list-item-arrow {
  color: var(--aria-text-muted);
  font-size: 16px;
}

.knw-widget__footer--action {
  padding: 10px 12px;
}

.knw-widget__action-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 6px;
  color: var(--aria-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}

.knw-widget__action-btn:hover {
  background: rgba(99,102,241,0.15);
  border-color: rgba(99,102,241,0.4);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px) {
  #knw-aria-widget {
    bottom: 12px;
    right: 12px;
  }

  .knw-aria__panel {
    width: calc(100vw - 24px);
    height: 70vh;
    bottom: 68px;
    right: 0;
  }
}
