/* ─── Council ───
   One open layout: a small label, Klui while the panel works, the final answer as
   plain prose, and the individual answers behind a hairline disclosure. No cards. */
.council-message {
  width: min(1180px, 100%);
  max-width: 100%;
  margin: 0 auto 32px;
  padding-left: 12px;
}

.council-shell {
  width: 100%;
}

.council-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 550;
}

.council-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.council-header-title {
  color: var(--text-secondary);
}

.council-header-sub::before {
  content: "·";
  margin-right: 7px;
}

/* Live progress: Klui + a three-step line + a hairline track. */
.council-progress {
  margin: 4px 0 22px;
  animation: council-fade-in 320ms var(--ease-out) both;
}

.council-progress[hidden] {
  display: none;
}

.council-progress .thinking-status.klui-bar {
  margin-bottom: 12px;
}

.council-progress-copy {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}

.council-progress.is-error .council-progress-copy {
  color: var(--danger, #c0392b);
}

.council-progress-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.council-progress-steps small {
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
}

.council-progress-track {
  height: 1px;
  background: var(--border-light);
  overflow: hidden;
}

.council-progress-track span {
  display: block;
  height: 100%;
  background: var(--text-secondary);
  transition: width 420ms var(--ease-out);
}

.council-stages {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.council-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-tertiary);
  font-weight: 600;
  transition: color 240ms ease;
}

.council-stage-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--border);
  transition: background 240ms ease, box-shadow 240ms ease;
}

.council-stage.active {
  color: var(--text);
}

.council-stage.active .council-stage-dot {
  background: var(--text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent);
  animation: council-pulse 1.5s ease-in-out infinite;
}

.council-stage.done {
  color: var(--text-secondary);
}

.council-stage.done .council-stage-dot {
  background: var(--text-secondary);
}

.council-stage.error {
  color: var(--danger, #c0392b);
}

.council-stage-sep {
  width: 28px;
  height: 1px;
  background: var(--border);
  transform-origin: left;
}

.council-stage-sep.done {
  background: var(--text-secondary);
}

@keyframes council-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.25); }
}

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

/* Final answer: reads like a normal reply, with a quiet caption. */
.council-synthesis {
  margin: 0 0 8px;
  animation: council-fade-in 360ms var(--ease-out) both;
}

.council-synthesis-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.council-synthesis-head .council-synthesis-model {
  color: var(--text-tertiary);
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
}

.council-synthesis-head .council-synthesis-model::before {
  content: "·";
  margin-right: 10px;
}

.council-synthesis-body {
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
}

.council-synthesis-pending {
  padding: 6px 0 2px;
  color: var(--text-tertiary);
  font-size: 13px;
}

.council-peer-status {
  padding: 0 0 12px;
  color: var(--text-tertiary);
  font-size: 12px;
  font-style: italic;
}

.council-peer-status:empty {
  display: none;
}

.council-details {
  margin-top: 18px;
  border-top: 1px solid var(--border-light);
}

.council-details > summary {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: color 160ms ease;
}

.council-details > summary:hover {
  color: var(--text);
}

.council-details > summary::-webkit-details-marker {
  display: none;
}

.council-details > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  margin-left: auto;
  transition: transform 200ms var(--ease-out);
  opacity: 0.6;
}

.council-details[open] > summary::after {
  transform: rotate(225deg) translateY(-2px);
}

.council-details > summary small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
}

.council-details-body {
  padding: 4px 0 8px;
  animation: council-fade-in 260ms var(--ease-out) both;
}

.council-details-body > .council-stages {
  margin-bottom: 14px;
}

.council-section-label {
  display: none;
}

/* Individual answers: a 2×2 grid divided by hairlines, like Compare. */
.council-panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.council-panelist {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 18px 32px 18px 0;
}

.council-panelist:nth-child(even) {
  padding: 18px 0 18px 32px;
  border-left: 1px solid var(--border-light);
}

.council-panelist:nth-child(n + 3) {
  border-top: 1px solid var(--border-light);
}

.council-panelist-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 6px;
  font-size: 12px;
}

.council-panelist-head .compare-model-mark {
  display: none;
}

.council-panelist-head strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.council-rank-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.council-rank-badge.rank-1 {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.council-rank-pending {
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
}

.council-panelist-head .compare-copy-btn {
  margin-left: auto;
}

.council-panelist-body {
  flex: 1;
  min-height: 0;
  font-size: 14.5px;
}

.council-justifications {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-light);
}

.council-justifications-title {
  margin-bottom: 4px;
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.council-justification {
  margin: 3px 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.45;
}

.council-justification strong {
  font-weight: 650;
}

@media (max-width: 860px) {
  .council-message {
    max-width: 100%;
  }

  .council-panel-grid {
    grid-template-columns: 1fr;
  }

  .council-panelist,
  .council-panelist:nth-child(even) {
    padding: 18px 0;
    border-left: 0;
  }

  .council-panelist + .council-panelist {
    border-top: 1px solid var(--border-light);
  }

  .council-synthesis-body {
    font-size: 15px;
  }

  .council-progress-steps {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .council-details > summary small {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .council-progress,
  .council-synthesis,
  .council-details-body,
  .council-stage.active .council-stage-dot {
    animation: none;
  }
}

/* ─── Composer Image Previews ─── */

.composer-previews {

  display: flex;

  flex-wrap: wrap;

  gap: 8px;

}

.composer-previews:empty {

  display: none;

}

/* `~` not `+`: the (usually hidden) research-mode chip sits between the
   previews and the textarea, so an adjacent-sibling rule never matches. */
.composer-previews:not(:empty) ~ textarea {

  margin-top: 14px;

}

.preview-thumb {

  position: relative;

  width: 64px;

  height: 64px;

  border-radius: 10px;

  overflow: hidden;

  border: 1px solid var(--border-light);

  cursor: pointer;

  flex-shrink: 0;

  transition: border-color var(--transition);

}

.preview-thumb:hover {

  border-color: var(--border);

}

.preview-remove {

  position: absolute;

  top: 2px;

  right: 2px;

  width: 18px;

  height: 18px;

  border-radius: var(--radius-full);

  background: rgba(0, 0, 0, 0.55);

  color: white;

  display: flex;

  align-items: center;

  justify-content: center;

  font-size: 12px;

  line-height: 1;

  opacity: 0;

  transition: opacity var(--transition);

  pointer-events: none;

}

.preview-thumb:hover .preview-remove {

  opacity: 1;

  pointer-events: auto;

}

.preview-thumb img {

  width: 100%;

  height: 100%;

  object-fit: cover;

  display: block;

}

.preview-pasted {
  width: 150px;
  height: 94px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
}

.preview-pasted > span {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.preview-pasted > strong,
.pasted-text-badge {
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.pasted-text-card {
  width: 156px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-secondary);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--motion-fast) var(--ease-out), transform var(--motion-fast) var(--ease-out);
}

.pasted-text-card:hover { border-color: var(--text-tertiary); }
.pasted-text-card:active { transform: scale(.985); }

.pasted-text-preview {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.pasted-text-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .58);
  backdrop-filter: blur(4px);
}

.pasted-text-dialog.hidden { display: none; }

.pasted-text-dialog-card {
  width: min(900px, 100%);
  max-height: min(760px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: var(--shadow-lg);
}

.pasted-text-dialog-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.pasted-text-dialog-card h2 { margin: 0 0 4px; font-size: 20px; }
.pasted-text-dialog-card p { margin: 0; color: var(--text-tertiary); font-size: 13px; }
.pasted-text-dialog-card header button { padding: 6px; color: var(--text-secondary); }

.pasted-text-dialog-card pre {
  margin: 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text);
  font: 13px/1.55 var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .pasted-text-dialog { padding: 12px; }
  .pasted-text-dialog-card { max-height: calc(100dvh - 24px); padding: 18px; }
}

.preview-file {

  width: 180px;

  display: flex;

  align-items: center;

  gap: 8px;

  padding: 8px 30px 8px 10px;

  background: var(--bg-secondary);

}

/* While the progress ring is visible (any non-ready status) it occupies the
   right 24-42px — reserve room so the filename ellipsis never runs under it. */
.preview-file.preview-queued,
.preview-file.preview-uploading,
.preview-file.preview-processing,
.preview-file.preview-failed {

  padding-right: 48px;

}

.preview-file span {

  min-width: 0;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  font-size: 12px;

  font-weight: 600;

  color: var(--text-secondary);

}

.preview-file-icon {

  display: inline-flex;

  color: var(--text-tertiary);

  flex-shrink: 0;

}

.preview-progress {

  position: absolute;

  right: 24px;

  top: 50%;

  width: 18px;

  height: 18px;

  border-radius: 50%;

  transform: translateY(-50%);

  background:

    radial-gradient(circle at center, var(--bg-secondary) 0 48%, transparent 50%),

    conic-gradient(var(--accent) calc(var(--progress, 0) * 1%), var(--border) 0);

}

.preview-uploading .preview-progress,

.preview-queued .preview-progress {

  animation: preview-spin 1s linear infinite;

  background:

    radial-gradient(circle at center, var(--bg-secondary) 0 48%, transparent 50%),

    conic-gradient(var(--accent) 0 25%, var(--border) 0);

}

@keyframes preview-spin {

  to {

    transform: translateY(-50%) rotate(360deg);

  }

}

.preview-failed {

  border-color: rgba(220, 38, 38, 0.45);

}

.preview-failed .preview-progress {

  background:

    radial-gradient(circle at center, var(--bg-secondary) 0 48%, transparent 50%),

    conic-gradient(#dc2626 0 100%, #dc2626 0);

}
