/* NORA — layout chat + sidebar istoric */
.nora-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(99, 102, 241, 0.12);
  color: #6366f1;
  margin-bottom: 4px;
}
.nora-app {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 0;
  min-height: calc(100vh - 150px);
}

@media (max-width: 900px) {
  .nora-app {
    grid-template-columns: 1fr;
  }

  .nora-sidebar {
    display: none;
  }

  .nora-sidebar.is-open {
    display: flex;
    position: fixed;
    z-index: 200;
    left: 12px;
    right: 12px;
    top: 84px;
    bottom: 12px;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  }
}

.nora-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 10px;
  border-right: 1px solid var(--glass-border);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.06) 0%, rgba(0, 0, 0, 0.08) 100%);
  border-radius: 18px 0 0 18px;
  max-height: calc(100vh - 150px);
  overflow: hidden;
}

body.light-mode .nora-sidebar {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.nora-sidebar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 8px 4px;
}

.nora-new-btn {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: transform 0.15s, box-shadow 0.15s;
}

.nora-new-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.45);
}

.nora-search {
  padding: 0 4px;
}

.nora-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  box-sizing: border-box;
}

body.light-mode .nora-search input {
  background: #fff;
}

.nora-search-wrap {
  position: relative;
}

.nora-search-wrap::before {
  content: "⌕";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.45;
  font-size: 14px;
}

.nora-conv-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 2px 8px;
}

.nora-conv-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: 10px;
  position: relative;
}

.nora-conv-row:hover .nora-conv-actions {
  opacity: 1;
}

.nora-conv-row.is-active {
  background: rgba(99, 102, 241, 0.14);
}

.nora-conv-item {
  flex: 1;
  text-align: left;
  padding: 10px 10px 10px 12px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  line-height: 1.35;
  min-width: 0;
}

.nora-conv-item-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.nora-conv-row.is-active .nora-conv-item-title {
  font-weight: 600;
}

.nora-conv-item time {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.nora-conv-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding-right: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

@media (max-width: 900px) {
  .nora-conv-actions {
    opacity: 1;
  }
}

.nora-icon-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.nora-icon-btn:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--ink);
}

.nora-icon-btn--danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.nora-sidebar-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 20px 12px;
}

.nora-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 20px 20px;
}

.nora-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0 8px;
}

.nora-sidebar-toggle {
  display: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
}

@media (max-width: 900px) {
  .nora-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
}

.nora-chat-header {
  flex: 1;
  min-width: 0;
  display: none;
  align-items: center;
  gap: 10px;
}

.nora-chat-header.is-visible {
  display: flex;
}

.nora-chat-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nora-chat-header-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.nora-hero-compact .sub {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 0;
  max-width: 560px;
}

.nora-chat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  overflow: hidden;
  min-height: 420px;
  backdrop-filter: blur(16px);
}

.nora-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 20px 12px;
  overflow-y: auto;
  max-height: min(58vh, 560px);
}

.nora-thread-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  max-width: 360px;
  line-height: 1.5;
}

.nora-bubble {
  max-width: min(88%, 640px);
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  animation: nora-fade-in 0.25s ease;
}

@keyframes nora-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.nora-bubble--user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.35) 0%, rgba(79, 70, 229, 0.25) 100%);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-bottom-right-radius: 4px;
}

body.light-mode .nora-bubble--user {
  background: linear-gradient(135deg, #e0e7ff 0%, #eef2ff 100%);
}

.nora-bubble--assistant {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
}

body.light-mode .nora-bubble--assistant {
  background: #fff;
}

.nora-bubble--typing {
  align-self: flex-start;
  padding: 14px 18px;
  color: var(--muted);
  font-size: 14px;
}

.nora-bubble-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #818cf8;
  margin-bottom: 8px;
}

.nora-feedback {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 12px 4px;
  padding: 0 2px;
}

.nora-feedback-label {
  font-size: 11px;
  color: var(--muted);
  margin-right: 2px;
}

.nora-fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

body.light-mode .nora-fb-btn {
  background: #f8fafc;
}

.nora-fb-btn:hover:not(:disabled) {
  color: var(--ink);
  border-color: rgba(99, 102, 241, 0.35);
}

.nora-fb-btn--up.is-active {
  color: #22c55e;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
}

.nora-fb-btn--down.is-active {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
}

.nora-feedback.is-busy .nora-fb-btn {
  opacity: 0.55;
  pointer-events: none;
}

.nora-feedback-error {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #f87171;
  line-height: 1.35;
}

.nora-answer-body {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}

.nora-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #818cf8;
  margin: 16px 0 8px;
}

.nora-section-title:first-child {
  margin-top: 0;
}

.nora-answer-body p {
  margin: 0 0 12px;
}

.nora-answer-body p:last-child {
  margin-bottom: 0;
}

.nora-answer-list {
  margin: 0 0 12px;
  padding-left: 1.25rem;
}

.nora-answer-list li {
  margin-bottom: 6px;
}

.nora-answer-list li:last-child {
  margin-bottom: 0;
}

.nora-section--compact.nora-section-title {
  margin-top: 12px;
  font-size: 10px;
  color: #94a3b8;
}

.nora-section-body.nora-section--compact {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(226, 232, 240, 0.92);
}

.nora-section-body.nora-section--compact .nora-answer-list {
  margin-bottom: 8px;
}

.nora-section-body.nora-section--compact .nora-answer-list li {
  margin-bottom: 4px;
}

body.light-mode .nora-section-body.nora-section--compact {
  color: #475569;
}

/* SURSA / SURSE — pliate implicit */
.nora-sources-fold {
  margin-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  padding-top: 2px;
}

.nora-sources-fold:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.nora-sources-fold > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nora-sources-fold > summary::-webkit-details-marker {
  display: none;
}

.nora-sources-fold > summary::marker {
  content: "";
}

.nora-sources-fold > summary::before {
  content: "▸";
  font-size: 10px;
  line-height: 1;
  color: #818cf8;
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.nora-sources-fold[open] > summary::before {
  transform: rotate(90deg);
}

.nora-section-title--fold {
  margin: 10px 0 0;
}

.nora-sources-fold[open] > .nora-section-body {
  margin-top: 8px;
}

.nora-refs-fold > summary.nora-refs-title {
  margin-bottom: 0;
}

.nora-refs-fold[open] .nora-refs-chips {
  margin-top: 8px;
}

.nora-refs {
  align-self: flex-start;
  max-width: min(92%, 680px);
  margin-top: 4px;
  padding: 10px 0 4px;
}

.nora-refs-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

.nora-refs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.nora-ref-chip {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.22);
  color: var(--ink);
}

body.light-mode .nora-ref-chip {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.nora-compose {
  border-top: 1px solid var(--glass-border);
  padding: 16px 18px 18px;
  background: rgba(0, 0, 0, 0.06);
}

body.light-mode .nora-compose {
  background: #f9fafb;
}

.nora-compose-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
}

.nora-field textarea {
  min-height: 72px;
}

.nora-filter-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.nora-field-hint {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.nora-detect-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #6366f1;
  font-weight: 500;
}

body.light-mode .nora-detect-hint {
  color: #4f46e5;
}

@media (max-width: 900px) {
  .nora-filter-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .nora-filter-row {
    grid-template-columns: 1fr;
  }
}

.nora-row {
  display: block;
}

.nora-loader {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: nora-spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes nora-spin {
  to {
    transform: rotate(360deg);
  }
}

.nora-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nora-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.nora-field textarea,
.nora-field select {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  resize: vertical;
}

body.light-mode .nora-field textarea,
body.light-mode .nora-field select {
  background: #fff;
  border-color: #e5e7eb;
}

.nora-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.nora-btn {
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  background: var(--accent, #6366f1);
  color: #fff;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.nora-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.nora-msg {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-top: 10px;
}

.nora-msg-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
}

body.light-mode .nora-msg-error {
  color: #b91c1c;
  background: #fef2f2;
}

