:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #182033;
  --muted: #657186;
  --line: #dce3ef;
  --line-strong: #c9d4e5;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --teal: #0f9488;
  --soft-blue: #eef4ff;
  --shadow: 0 16px 40px rgba(24, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

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

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 5px 0 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.subtitle {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.badge {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.editor-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="file"],
input[type="number"],
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fbfcff;
  color: var(--ink);
  font: inherit;
}

select,
input[type="number"] {
  height: 40px;
  padding: 0 11px;
}

input[type="file"] {
  min-height: 40px;
  padding: 7px;
  font-size: 13px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  min-height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

select:focus,
input:focus,
textarea:focus,
button:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.16);
  outline-offset: 2px;
}

textarea {
  min-height: 0;
  padding: 11px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}

.note {
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft-blue);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.option-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcff;
}

.hidden {
  display: none;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  min-height: 28px;
}

.check-row input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
}

.compact {
  grid-template-columns: 104px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.primary {
  background: var(--blue);
  color: #ffffff;
}

.primary:hover {
  background: var(--blue-dark);
}

.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-stack .primary {
  grid-column: 1 / -1;
}

.advanced {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcff;
}

.advanced summary {
  min-height: 40px;
  padding: 10px 12px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.advanced-body {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.helper {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 720px;
}

.editor {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  padding: 14px;
  min-width: 0;
}

.editor textarea {
  height: 100%;
  resize: none;
}

.footnote {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-grid {
    min-height: 900px;
  }
}
