:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #18212f;
  --muted: #667085;
  --line: #d7dde6;
  --panel: #ffffff;
  --accent: #1f7a68;
  --accent-2: #315b9d;
  --warn: #a15c12;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ghost {
  background: white;
  color: var(--accent);
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.3;
  letter-spacing: 0;
}

.topbar p,
.notice span,
.status,
.empty,
.upload-list,
.skill-card p {
  color: var(--muted);
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: white;
  white-space: nowrap;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: center;
  border: 1px solid #e2c798;
  background: #fff8eb;
  color: var(--warn);
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}

.workspace,
.results {
  display: grid;
  gap: 16px;
}

.workspace {
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
}

.results {
  grid-template-columns: minmax(280px, 0.9fr) minmax(260px, 0.75fr) minmax(420px, 1.2fr);
  margin-top: 16px;
}

.panel,
.skills-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

textarea {
  width: 100%;
  min-height: 156px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  color: var(--ink);
  background: #fbfcfd;
}

.file-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border: 1px dashed #9aa7b7;
  border-radius: 6px;
  margin-top: 12px;
  color: var(--accent-2);
  background: #f9fbff;
  cursor: pointer;
}

.file-box input {
  display: none;
}

.selected-list,
.upload-list {
  min-height: 24px;
  margin-top: 10px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.selected-list {
  color: var(--ink);
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.plan-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.plan-step:first-child {
  border-top: 0;
}

.step-index {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e9f5f2;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.plan-step strong {
  display: block;
}

.plan-step small {
  color: var(--accent-2);
}

.plan-step p {
  margin-top: 4px;
  color: var(--muted);
}

.status {
  margin-bottom: 12px;
  min-height: 22px;
  border-radius: 6px;
  padding: 0;
  color: var(--muted);
}

.status.running,
.status.completed,
.status.failed {
  border-left: 4px solid;
  padding: 10px 12px;
}

.status.running {
  border-color: #315b9d;
  background: #eef5ff;
  color: #1d4f91;
}

.status.completed {
  border-color: #1f7a68;
  background: #edf8f4;
  color: #166353;
}

.status.failed {
  border-color: var(--danger);
  background: #fff1f0;
  color: var(--danger);
}

.plan-section {
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.plan-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.plan-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--accent-2);
}

.plan-section ul {
  margin: 0;
  padding-left: 18px;
}

.plan-section li {
  margin: 5px 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.plan-summary p {
  margin-top: 6px;
  color: var(--ink);
}

.result-tree {
  min-height: 260px;
}

.file-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fbfcfd;
  color: var(--ink);
}

.file-row button {
  min-height: 30px;
  padding: 0 10px;
}

.preview-area {
  min-height: 320px;
  overflow: auto;
}

.result-summary {
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  background: #fbfcfd;
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.preview-area img {
  max-width: 100%;
  border: 1px solid var(--line);
  background: white;
}

.svg-preview {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  background: white;
}

.svg-preview svg {
  display: block;
  max-width: 100%;
  height: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #eef2f7;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #111827;
  color: #e5e7eb;
  border-radius: 6px;
  padding: 14px;
  line-height: 1.55;
}

.skills-panel {
  margin-top: 16px;
}

.hidden {
  display: none;
}

.skills-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.skill-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfd;
}

.skill-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.skill-card span {
  color: var(--accent-2);
  font-size: 12px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  width: min(640px, calc(100% - 32px));
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.dialog-body {
  padding: 18px;
}

.dialog-body p {
  margin: 8px 0 12px;
  color: var(--muted);
}

@media (max-width: 920px) {
  .workspace,
  .results {
    grid-template-columns: 1fr;
  }

  .topbar,
  .notice {
    align-items: flex-start;
    flex-direction: column;
  }
}
