.editor-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.editor-column[hidden] {
  display: none;
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 24px;
  box-shadow: var(--shadow-soft);
}

.editor-toolbar {
  display: grid;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-muted);
  margin: -24px -24px 0;
  padding: 18px 24px;
}

.editor-head {
  display: flex;
  align-items: center;
}

.editor-title-block {
  flex: 1;
  min-width: 0;
}

.editor-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.title-input {
  width: 100%;
  padding: 2px 0 0;
  border: 0;
  border-radius: 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
}

.title-input:focus {
  box-shadow: none;
}

.editor-status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 4px;
}

.editor-actions .icon-button {
  border-color: transparent;
  background: transparent;
}

.editor-actions .icon-button:hover {
  border-color: var(--line);
  background: var(--panel);
  color: var(--accent-strong);
}

.editor-actions .save-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.editor-actions .save-action:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  color: #fff;
}

.editor-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(100%, 430px);
  border: 0;
  background: transparent;
  padding: 0;
}

.editor-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 2px;
  font-size: 13px;
  font-weight: 800;
}

.editor-tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.tab-panel {
  display: grid;
  gap: 18px;
}

.tab-panel[hidden] {
  display: none;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  align-items: start;
  gap: 14px;
  padding-top: 2px;
}

.category-custom {
  margin-top: 7px;
}

.stacked textarea {
  resize: vertical;
  line-height: 1.5;
}

.prompt-body-panel {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 2px;
}

.prompt-body-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-body-head label {
  font-size: 13px;
  font-weight: 700;
}

.body-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.body-copy-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.body-copy-button:hover {
  color: var(--text);
}

.body-copy-button svg {
  width: 16px;
  height: 16px;
}

.body-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 3px;
}

.body-view-tabs button {
  min-height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 900;
}

.body-view-tabs button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.body-view-panel[hidden] {
  display: none;
}

.body-view-panel,
.prompt-body-panel textarea,
.prompt-preview {
  height: 360px;
}

.prompt-body-panel textarea {
  min-height: 360px;
  resize: none;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
}

.prompt-preview {
  min-height: 360px;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  padding: 14px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}

.prompt-preview h3,
.prompt-preview h4,
.prompt-preview h5,
.prompt-preview p,
.prompt-preview ul,
.prompt-preview pre,
.preview-table-wrap {
  margin: 0 0 12px;
}

.prompt-preview h3 {
  font-size: 18px;
}

.prompt-preview h4 {
  font-size: 16px;
}

.prompt-preview h5 {
  font-size: 14px;
}

.prompt-preview ul {
  padding-left: 20px;
}

.prompt-preview code {
  background: var(--panel);
}

.prompt-preview pre {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0f172a;
  padding: 12px;
}

.prompt-preview pre code {
  border: 0;
  background: transparent;
  color: #e5edf5;
  padding: 0;
}

.preview-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.prompt-preview table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  font-size: 13px;
}

.prompt-preview th,
.prompt-preview td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.prompt-preview th {
  background: var(--panel);
  color: var(--text);
  font-weight: 900;
}

.prompt-preview tr:last-child td {
  border-bottom: 0;
}

.preview-empty {
  color: var(--muted);
}

.placeholder-panel {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-muted);
  padding: 14px;
}

.placeholder-panel h3 {
  font-size: 15px;
}

code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  padding: 1px 4px;
  color: var(--accent-strong);
}

.audit-panel,
.history-panel {
  display: grid;
  gap: 14px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 15px;
}

.audit-panel {
  grid-template-columns: 148px minmax(0, 1fr);
  align-items: start;
}

.audit-panel .panel-head,
.audit-panel .audit-details,
.audit-panel .audit-findings {
  grid-column: 1 / -1;
}

.panel-head h3 {
  font-size: 16px;
}

.audit-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.audit-actions .icon-button {
  border-color: transparent;
  background: transparent;
}

.audit-actions .icon-button:hover {
  border-color: transparent;
  background: transparent;
  color: var(--accent-strong);
}

.score-ring {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  margin: 0;
  border: 10px solid var(--accent-soft);
  border-radius: 50%;
}

.score-ring.medium {
  border-color: var(--amber-soft);
}

.score-ring.high {
  border-color: var(--red-soft);
}

.score-ring strong {
  font-size: 30px;
  line-height: 1;
}

.score-ring span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.audit-breakdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-self: center;
}

.score-card {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 11px;
}

.score-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-card strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.score-card small {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.score-card.warn {
  border-color: var(--amber-soft);
  background: #fffaf0;
}

.score-card.final.low {
  border-color: var(--green-soft);
  background: #f0fdf4;
}

.score-card.final.medium {
  border-color: var(--amber-soft);
  background: #fffaf0;
}

.score-card.final.high {
  border-color: var(--red-soft);
  background: #fff7f6;
}

.audit-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.audit-details section {
  display: grid;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
}

.audit-details h4 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.audit-checks,
.suggestion-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-checks li {
  display: grid;
  gap: 3px;
  border-left: 3px solid var(--green);
  padding-left: 9px;
}

.audit-checks li.review {
  border-color: var(--amber);
}

.audit-checks strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.factor-id {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--text);
  font-size: 10px;
  line-height: 18px;
}

.audit-checks span,
.suggestion-list li,
.export-warning {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.export-warning {
  margin: 0;
}

.export-warning.high {
  color: var(--red);
  font-weight: 800;
}

.audit-findings {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-findings li {
  border-left: 3px solid var(--line-strong);
  padding-left: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.audit-findings li.warn {
  border-color: var(--amber);
  color: #704b12;
}

.audit-findings li.high {
  border-color: var(--red);
  color: var(--red);
}

.history-item {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px;
  text-align: left;
}

.history-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.history-item strong {
  font-size: 12px;
}

.history-item span {
  color: var(--muted);
  font-size: 11px;
}
