:root {
  color-scheme: light;
  --ink: #211916;
  --muted: #736966;
  --line: #ead9d5;
  --surface: #ffffff;
  --soft: #fff7f3;
  --accent: #d71920;
  --accent-strong: #a80f18;
  --warn: #a45115;
  --gold: #b9842f;
  --shadow: 0 18px 50px rgba(84, 36, 26, 0.12);
}

* {
  box-sizing: border-box;
}

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

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workbench {
  width: min(1440px, 100%);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.workbench::before {
  display: block;
  height: 6px;
  background: linear-gradient(90deg, var(--accent), #ef8a28, var(--gold));
  content: "";
}

.topbar,
.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: #fffdfb;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 82px;
  height: 56px;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 24px;
}

.mission {
  margin: 6px 0 0;
  color: var(--gold);
  font-size: 14px;
  font-weight: 800;
}

h2 {
  font-size: 18px;
}

.panels {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(480px, 1.18fr);
  min-height: calc(100vh - 122px);
}

.input-panel,
.output-panel {
  padding: 24px;
}

.input-panel {
  border-right: 1px solid var(--line);
  background: var(--soft);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 24px;
  border: 1px dashed #95a5ae;
  background: #fff;
  text-align: center;
  cursor: pointer;
}

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

.dropzone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: #ffe8e3;
  color: var(--accent-strong);
  font-size: 24px;
  line-height: 1;
}

.dropzone small {
  margin-top: 6px;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field-hint {
  color: var(--muted);
  font-weight: 600;
}

textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  line-height: 1.55;
  outline: none;
}

textarea:focus,
.text-input:focus {
  border-color: var(--accent);
}

.text-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  outline: none;
}

.mini-button {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 1px solid transparent;
  cursor: pointer;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button {
  width: 100%;
  min-height: 44px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.secondary-button {
  width: 100%;
  min-height: 44px;
  background: #ffffff;
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 800;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button,
.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
  font-weight: 700;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status.error {
  color: #b42318;
}

.output-panel {
  background: #fff;
  overflow: auto;
}

.result-toolbar {
  margin-bottom: 16px;
}

.download-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.result {
  min-height: 520px;
  padding: 2px 0 32px;
  line-height: 1.6;
  overflow-x: auto;
}

.result.empty {
  display: grid;
  place-items: center;
  padding: 40px;
  border: 1px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.result h1,
.result h2,
.result h3 {
  margin: 24px 0 10px;
}

.result h1 {
  font-size: 22px;
}

.result h2 {
  font-size: 18px;
}

.result h3 {
  font-size: 16px;
}

.result table {
  width: 100%;
  margin: 12px 0 22px;
  border-collapse: collapse;
  font-size: 14px;
}

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

.result .customer-id-cell {
  position: relative;
  padding-right: 54px;
}

.result .copy-id-button {
  position: absolute;
  top: 6px;
  right: 6px;
  min-height: 24px;
  padding: 0 7px;
  border: 1px solid var(--accent);
  background: #ffffff;
  color: var(--accent-strong);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.result .copy-id-button:hover {
  background: #ffe8e3;
}

.result th {
  background: #fff0ed;
}

.result tr.tone-danger {
  background: #fff1f0;
}

.result tr.tone-warning {
  background: #fff7e6;
}

.result tr.tone-success {
  background: #f0f9eb;
}

.result tr.tone-muted {
  background: #f5f7fa;
  color: #5f6b7a;
}

.result .cell-danger,
.result .cell-warning,
.result .cell-success,
.result .cell-muted {
  font-weight: 800;
}

.result .cell-danger {
  color: #b42318;
}

.result .cell-warning {
  color: #a45115;
}

.result .cell-success {
  color: #177245;
}

.result .cell-muted {
  color: #687385;
}

.result blockquote {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 4px solid var(--accent);
  background: #fff7f3;
}

.result code {
  padding: 2px 5px;
  background: #edf1f4;
}

@media (max-width: 960px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    align-items: flex-start;
    padding: 18px;
  }

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

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

  h1 {
    font-size: 20px;
  }

  .action-row {
    grid-template-columns: 1fr;
  }
}
