:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #68727f;
  --line: #d9e0e6;
  --accent: #126b72;
  --accent-2: #4e7f52;
  --danger: #b83c45;
  --shadow: 0 10px 28px rgba(27, 39, 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", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.small {
  min-height: 32px;
  padding: 0 10px;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 100vh;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 8px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.field > span {
  font-size: 13px;
  font-weight: 700;
}

input[type="text"] {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.check-list {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.check-list label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.option-row {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.option-row.disabled {
  color: var(--muted);
  background: #f1f4f6;
}

.upload-box {
  border: 1px dashed #9fb0be;
  border-radius: 8px;
  min-height: 92px;
  display: grid;
  place-items: center;
  background: #fff;
  cursor: pointer;
  text-align: center;
}

.upload-box input {
  display: none;
}

.upload-box span {
  font-weight: 700;
}

.upload-box small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.action-stack {
  display: grid;
  gap: 10px;
}

.revise-box {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 45%) minmax(360px, 55%);
  gap: 18px;
  padding: 18px;
  min-width: 0;
}

.preview-pane,
.output-pane {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.preview-pane {
  display: flex;
  flex-direction: column;
}

.pane-header {
  min-height: 54px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pane-header h2 {
  margin: 0;
  font-size: 16px;
}

.pane-header span {
  color: var(--muted);
  font-size: 13px;
}

.image-frame {
  position: relative;
  flex: 1;
  min-height: 520px;
  background: #eef2f4;
  overflow: auto;
}

.image-frame img {
  display: none;
  max-width: 100%;
  height: auto;
}

.image-frame.has-image img {
  display: block;
}

.empty-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.image-frame.has-image .empty-preview {
  display: none;
}

.output-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

textarea {
  width: 100%;
  min-height: 0;
  flex: 1;
  border: 0;
  resize: none;
  padding: 16px;
  line-height: 1.6;
  outline: none;
  color: var(--ink);
}

textarea.revision {
  min-height: 180px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #18252f;
  color: #fff;
  border-radius: 6px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: 0.18s ease;
  pointer-events: none;
  max-width: min(420px, calc(100vw - 36px));
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .image-frame {
    min-height: 360px;
  }
}
