/* LLM 테스트 화면 전용. 공용 panel·form·button·badge·banner 토큰은 styles.css 를 쓴다. */

.llm-purpose {
  margin: 0;
  color: var(--muted);
}

.llm-layout {
  align-items: stretch;
  grid-template-columns: minmax(360px, 1.05fr) minmax(360px, .95fr);
}

.llm-compose,
.llm-result-panel {
  min-height: 520px;
}

.llm-model-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: start;
}

.llm-model-field {
  margin-bottom: 0;
}

.llm-model-field select {
  min-height: 40px;
}

.llm-refresh-button {
  margin-top: 22px;
  white-space: nowrap;
}

.llm-empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed #d8b65c;
  border-radius: 8px;
  background: var(--warning-bg);
  color: var(--warning);
}

.llm-empty-state[hidden] {
  display: none;
}

.llm-empty-state p {
  margin: 0;
}

.llm-empty-state a {
  flex: none;
  color: inherit;
  font-weight: 700;
}

.llm-model-card-slot {
  margin-top: 14px;
}

.llm-card-placeholder {
  min-height: 84px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fbfbfc;
  color: var(--muted);
  text-align: center;
}

.llm-model-card {
  padding: 13px 14px;
  border: 1px solid #cad6ed;
  border-radius: 8px;
  background: #f8faff;
}

.llm-model-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.llm-model-card-heading strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.llm-model-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 12px;
  margin: 0;
  font-size: 12px;
}

.llm-model-facts dt {
  color: var(--muted);
  font-weight: 600;
}

.llm-model-facts dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.llm-variable-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.llm-variable-chips code {
  padding: 1px 6px;
  border: 1px solid #cfd8ea;
  border-radius: 999px;
  background: #fff;
  color: #334155;
}

.llm-input-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.llm-input-section h3 {
  margin-bottom: 6px;
}

.llm-input-mode {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.llm-variable-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 10px;
}

.llm-variable-field textarea {
  min-height: 78px;
}

.llm-json-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.llm-json-toolbar label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.llm-json-toolbar button {
  padding: 4px 10px;
  font-size: 12px;
}

.llm-json-editor {
  width: 100%;
  min-height: 190px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fcfcfd;
  color: inherit;
  resize: vertical;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}

.llm-json-editor[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(156, 43, 35, .08);
}

.llm-generate-actions {
  align-items: center;
  flex-wrap: wrap;
}

.llm-generate-actions button[type="submit"] {
  min-width: 178px;
  font-variant-numeric: tabular-nums;
}

.llm-cancel-button {
  border-color: var(--danger);
  color: var(--danger);
}

.llm-cancel-button:hover:not(:disabled) {
  background: var(--danger-bg);
}

.llm-shortcut {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.llm-result-slot {
  min-height: 456px;
  height: 100%;
}

.llm-result-empty {
  min-height: 420px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.llm-result-empty p {
  max-width: 36ch;
  margin: 0;
}

.llm-result-empty-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--info-bg);
  color: #64748b;
  font-size: 20px;
}

.llm-running {
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  border: 1px solid #cfdaf0;
  border-radius: 8px;
  background: #f8faff;
}

.llm-running-dot {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  background: var(--focus-ring);
  box-shadow: 0 0 0 0 rgba(47, 111, 237, .34);
  animation: llm-pulse 1.4s ease-out infinite;
}

.llm-running-title {
  margin: 0 0 2px;
  font-weight: 700;
}

.llm-running-elapsed {
  display: block;
  color: #315ca8;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.llm-running .notice {
  max-width: 34ch;
  margin: 4px 0 0;
}

@keyframes llm-pulse {
  70% { box-shadow: 0 0 0 10px rgba(47, 111, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 111, 237, 0); }
}

.llm-response-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.llm-response-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.llm-response-heading strong {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.llm-copy-button {
  flex: none;
}

.llm-result-text {
  min-height: 210px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--success);
  border-radius: 8px;
  background: #f8f9fb;
  color: #16191d;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 13px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.llm-usage-block {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfbfc;
}

.llm-usage-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.llm-usage-heading span {
  color: var(--muted);
  font-size: 11px;
}

.llm-usage-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.llm-usage-chip {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #dce1e8;
  border-radius: 6px;
  background: #fff;
}

.llm-usage-chip span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.llm-usage-chip strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.llm-usage-total {
  border-color: #bfd2f6;
  background: #f3f7ff;
}

.llm-finish-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 11px;
}

.llm-finish-row .badge {
  font-size: 12px;
}

.llm-finish-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.llm-finish-warning {
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
}

.llm-result-slot > .banner {
  margin-top: 0;
}

.llm-error-guidance {
  margin-bottom: 7px !important;
  font-weight: 700;
}

.llm-failure-elapsed {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.llm-retry-button {
  border-color: #16191d;
  background: #16191d;
  color: #fff;
}

.llm-retry-button:hover:not(:disabled) {
  background: #33383f;
}

.llm-history-panel {
  margin-top: 16px;
}

.llm-section-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.llm-section-heading h3 {
  margin-bottom: 0;
}

.llm-history-note {
  margin: 3px 0 8px;
}

.llm-history-empty {
  margin: 12px 0 0;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.llm-history-table-wrap {
  position: relative;
  max-width: 100%;
  overflow-x: auto;
}

.llm-history-table-wrap::after {
  content: "";
  position: sticky;
  z-index: 1;
  right: 0;
  float: right;
  width: 32px;
  height: 100%;
  margin-left: -32px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--panel-bg));
  pointer-events: none;
}

.llm-history-table {
  min-width: 900px;
}

.llm-history-table th:nth-child(1) { width: 190px; }
.llm-history-table th:nth-child(2) { width: 150px; }
.llm-history-table th:nth-child(4) { width: 72px; }
.llm-history-table th:nth-child(5),
.llm-history-table th:nth-child(6) { width: 110px; }
.llm-history-table th:nth-child(7) { width: 90px; }

.llm-history-table th > span:first-child {
  display: block;
}

.llm-history-table .th-code {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.llm-history-row {
  cursor: pointer;
}

.llm-history-row:hover {
  background: #f3f6fc !important;
}

.llm-history-row td {
  font-variant-numeric: tabular-nums;
}

.llm-history-row code {
  overflow-wrap: anywhere;
}

.llm-history-restore {
  padding: 4px 10px;
  white-space: nowrap;
  font-size: 12px;
}

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

  .llm-compose,
  .llm-result-panel {
    min-height: 0;
  }

  .llm-result-slot,
  .llm-result-empty,
  .llm-running {
    min-height: 300px;
  }
}

@media (max-width: 560px) {
  .llm-model-toolbar {
    grid-template-columns: 1fr;
  }

  .llm-refresh-button {
    width: 100%;
    margin-top: 0;
  }

  .llm-empty-state,
  .llm-response-heading,
  .llm-usage-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .llm-variable-grid,
  .llm-usage-chips {
    grid-template-columns: 1fr;
  }

  .llm-shortcut {
    width: 100%;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .llm-running-dot {
    animation: none;
  }
}

/* ---- 변수 모드 예시 채우기 툴바 ---- */
.llm-variable-toolbar { display: flex; justify-content: flex-end; margin-bottom: 6px; }
.llm-variable-toolbar button { font-size: 12px; padding: 3px 10px; }
