:root {
  --rust: #d5491f;
  --rust-deep: #b5431a;
  --charcoal: #2e2b28;
  --ink: #211d1a;
  --muted: #6b635c;
  --cream: #f6f2ea;
  --paper: #fffaf2;
  --line: #d8d1c8;
  --green: #2f6f4e;
  --red: #a83225;
  --blue: #355c7d;
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

.topbar {
  min-height: 76px;
  padding: 14px 28px;
  background: var(--charcoal);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-lockup img {
  width: 154px;
  height: auto;
  display: block;
}

.kicker {
  color: var(--rust);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.topbar .kicker {
  color: #eaa184;
}

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

h1 {
  font-size: clamp(1.35rem, 1.7vw, 1.85rem);
}

h2 {
  color: var(--charcoal);
  font-size: 1.2rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  max-width: min(38vw, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  color: #efe7dd;
  font-size: 0.86rem;
}

.workspace {
  width: min(1220px, calc(100vw - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.input-panel,
.output-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(33, 29, 26, 0.08);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.status-chip {
  min-width: 86px;
  text-align: center;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  background: #eee6dc;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-chip[data-tone="busy"] {
  color: var(--blue);
  background: #dbe9f4;
}

.status-chip[data-tone="ready"] {
  color: var(--green);
  background: #ddefe5;
}

.status-chip[data-tone="error"] {
  color: var(--red);
  background: #f5ded9;
}

form {
  margin-top: 16px;
}

.field-label {
  display: block;
  margin: 14px 0 7px;
  color: var(--charcoal);
  font-size: 0.84rem;
  font-weight: 700;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  min-height: 330px;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(213, 73, 31, 0.16);
}

.file-row {
  min-height: 48px;
  margin: 14px 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.file-drop-zone {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #fffaf4;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease;
}

.file-drop-zone.is-dragging {
  border-color: var(--rust);
  background: #fff2e8;
  box-shadow: 0 0 0 3px rgba(213, 73, 31, 0.16);
}

.file-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.file-button,
.button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
}

.button-primary {
  color: #fff;
  background: var(--rust);
}

.button-secondary,
.file-button {
  color: var(--charcoal);
  background: #ece4da;
}

.icon-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.full {
  width: 100%;
}

#fileName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.result-empty {
  min-height: 500px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  margin-top: 16px;
  background: linear-gradient(135deg, #312d2a, #1f1b18);
  display: grid;
  place-items: center;
}

.result-empty img {
  width: min(260px, 64%);
  height: auto;
  opacity: 0.3;
}

.result {
  margin-top: 16px;
}

.result-title {
  min-height: 52px;
  padding: 14px;
  border-left: 4px solid var(--rust);
  background: #fff;
  color: var(--charcoal);
  font-size: 1.16rem;
  font-weight: 800;
}

.download-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 16px;
}

.check-list {
  display: grid;
  gap: 8px;
}

.check {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  display: grid;
  gap: 2px;
}

.check strong {
  color: var(--charcoal);
}

.check span {
  color: var(--muted);
  line-height: 1.35;
}

.check-pass {
  border-left: 4px solid var(--green);
}

.check-warn {
  border-left: 4px solid var(--blue);
}

.check-fail {
  border-left: 4px solid var(--red);
}

body[data-authenticated="false"] textarea,
body[data-authenticated="false"] input:not([type="file"]) {
  opacity: 0.62;
}

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

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .workspace {
    grid-template-columns: 1fr;
    width: min(100vw - 20px, 720px);
  }

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