.assistant-view {
  max-width: 1680px;
  margin: 0 auto;
}

.assistant-section-head,
.normative-head-actions,
.assistant-corpus-badge,
.assistant-input-meta,
.assistant-result-head,
.assistant-answer-actions,
.assistant-job-meta {
  display: flex;
  align-items: center;
}

.normative-head-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.assistant-corpus-badge {
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  color: #245f46;
  background: #e8f4ed;
  border: 1px solid #b7d7c5;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
}

.assistant-corpus-badge svg {
  width: 17px;
  height: 17px;
}

.assistant-login {
  max-width: 640px;
}

.assistant-login p {
  color: var(--muted);
  line-height: 1.55;
}

.assistant-workspace {
  display: grid;
  grid-template-columns: minmax(285px, 0.78fr) minmax(420px, 1.35fr) minmax(245px, 0.62fr);
  align-items: start;
  gap: 14px;
}

.assistant-workspace > .panel,
.assistant-admin > .panel {
  min-width: 0;
  margin: 0;
}

.assistant-compose,
.assistant-history {
  position: sticky;
  top: 18px;
}

.assistant-compose {
  display: grid;
  gap: 14px;
}

.assistant-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-soft);
}

.assistant-mode button {
  min-width: 0;
  min-height: 46px;
  padding: 8px 10px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 750;
}

.assistant-mode button:last-child {
  border-right: 0;
}

.assistant-mode button.is-active {
  color: #fff;
  background: var(--graphite);
}

.assistant-mode svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.assistant-question-field textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.5;
}

.assistant-input-meta {
  justify-content: space-between;
  gap: 12px;
  margin-top: -8px;
  color: var(--muted);
  font-size: 12px;
}

.assistant-policy-check {
  align-items: flex-start;
  line-height: 1.4;
}

.assistant-data-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px;
  color: #7a4d0c;
  background: #fff6df;
  border-left: 3px solid var(--amber);
  font-size: 12px;
  line-height: 1.45;
}

.assistant-data-note svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.assistant-result {
  min-height: 580px;
  padding: 0;
  overflow: hidden;
}

.assistant-empty,
.assistant-state {
  min-height: 500px;
  padding: 42px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.assistant-empty > svg,
.assistant-state > svg {
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  color: var(--orange);
}

.assistant-empty strong,
.assistant-state strong {
  font-size: 18px;
}

.assistant-empty p,
.assistant-state p {
  max-width: 560px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.assistant-state.is-working > svg {
  animation: assistant-spin 1.4s linear infinite;
}

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

.assistant-answer {
  padding: 22px;
}

.assistant-result-head {
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.assistant-result-head > div {
  min-width: 0;
}

.assistant-result-head h3 {
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.assistant-result-head span,
.assistant-job-meta {
  color: var(--muted);
  font-size: 12px;
}

.assistant-job-meta {
  gap: 7px;
  flex-wrap: wrap;
}

.assistant-answer-summary {
  margin: 18px 0;
  padding: 14px 16px;
  background: #eef5f8;
  border-left: 3px solid var(--blue);
  font-weight: 720;
  line-height: 1.55;
}

.assistant-answer-body {
  color: #2a3039;
  font-size: 15px;
  line-height: 1.7;
}

.assistant-answer-body p {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.assistant-answer-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.assistant-answer-section h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.assistant-answer-section ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.55;
}

.assistant-answer-section li + li {
  margin-top: 7px;
}

.assistant-source-list {
  display: grid;
  gap: 8px;
}

.assistant-source-list a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

.assistant-source-list a:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.assistant-source-list strong,
.assistant-history-item strong,
.assistant-admin-job-main strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assistant-source-list small {
  color: var(--muted);
}

.assistant-answer-actions {
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.assistant-feedback {
  display: flex;
  gap: 6px;
}

.assistant-feedback .is-active {
  color: #fff;
  background: var(--graphite);
}

.assistant-history {
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.assistant-history .panel-title,
.assistant-admin-jobs .panel-title {
  justify-content: space-between;
}

.assistant-history-list,
.assistant-admin-job-list {
  max-height: calc(100vh - 110px);
  overflow: auto;
  display: grid;
  gap: 6px;
}

.assistant-history-item {
  width: 100%;
  min-width: 0;
  padding: 10px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  display: grid;
  gap: 5px;
}

.assistant-history-item:hover,
.assistant-history-item.is-active {
  background: var(--surface-soft);
  border-color: var(--line);
}

.assistant-history-item span,
.assistant-admin-job-main span {
  color: var(--muted);
  font-size: 12px;
}

.assistant-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 6px;
  color: #5b6571;
  background: #edf0f3;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 750;
}

.assistant-status.completed { color: #246238; background: #e7f4eb; }
.assistant-status.failed { color: #8b312c; background: #f9e9e7; }
.assistant-status.processing,
.assistant-status.queued { color: #7a4d0c; background: #fff4d9; }

.assistant-disclaimer {
  margin-top: 14px;
}

.assistant-admin {
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 0.7fr) minmax(420px, 1.2fr);
  align-items: start;
  gap: 14px;
}

.assistant-admin.admin-workspace-section.is-active {
  display: grid;
}

.assistant-admin-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.assistant-admin-metrics div {
  padding: 12px;
  background: var(--surface-soft);
  border-radius: 5px;
}

.assistant-admin-metrics strong,
.assistant-admin-metrics span {
  display: block;
}

.assistant-admin-metrics strong {
  font-size: 22px;
}

.assistant-admin-metrics span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.assistant-admin-settings {
  display: grid;
  gap: 14px;
}

.assistant-admin-job-list {
  max-height: 580px;
}

.assistant-admin-job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.assistant-admin-job:last-child {
  border-bottom: 0;
}

.assistant-admin-job-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

@media (max-width: 1320px) {
  .assistant-workspace {
    grid-template-columns: minmax(280px, 0.75fr) minmax(420px, 1.25fr);
  }

  .assistant-history {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
  }

  .assistant-history-list {
    max-height: 300px;
  }

  .assistant-admin {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .assistant-admin-jobs {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .assistant-section-head,
  .normative-head-actions {
    align-items: flex-start;
  }

  .assistant-workspace,
  .assistant-admin.admin-workspace-section.is-active {
    grid-template-columns: minmax(0, 1fr);
  }

  .assistant-compose,
  .assistant-history {
    position: static;
  }

  .assistant-result {
    min-height: 440px;
  }

  .assistant-empty,
  .assistant-state {
    min-height: 390px;
    padding: 30px 18px;
  }

  .assistant-answer {
    padding: 17px;
  }

  .assistant-admin-jobs {
    grid-column: auto;
  }
}

@media (max-width: 480px) {
  .assistant-mode {
    grid-template-columns: minmax(0, 1fr);
  }

  .assistant-mode button {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .assistant-mode button:last-child {
    border-bottom: 0;
  }

  .assistant-result-head,
  .assistant-answer-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .assistant-admin-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
}
