:root {
  color-scheme: light;
  --ink: #15202b;
  --muted: #687385;
  --line: #d8dee7;
  --panel: #ffffff;
  --canvas: #f4f6f9;
  --accent: #1b6b66;
  --accent-strong: #12524e;
  --warning: #9a3d23;
  --soft: #eaf3f2;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

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

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  font-size: 13px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.tool-nav small,
.eyebrow,
.tool-copy p,
.drop-zone small,
.choice-grid small,
.message,
dt {
  color: var(--muted);
}

.tool-nav {
  display: grid;
  gap: 8px;
}

.tool-nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
}

.tool-nav button.active {
  background: var(--soft);
  border-color: #bcd8d5;
}

.tool-nav button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.workspace {
  padding: 32px;
}

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

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
}

h2 {
  margin-bottom: 8px;
  font-size: 24px;
}

.status-pill {
  border: 1px solid #bcd8d5;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
  padding: 8px 12px;
  font-weight: 700;
}

.tool-panel,
.progress-panel,
.result-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  max-width: 920px;
}

.progress-panel {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.progress-panel[hidden] {
  display: none;
}

.progress-panel[data-error="true"] {
  border-color: #d9a18f;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.progress-header h2 {
  margin-bottom: 0;
}

#progressPercent {
  color: var(--accent-strong);
  font-size: 22px;
}

.progress-panel[data-error="true"] #progressPercent {
  color: var(--warning);
}

.progress-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e7ef;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.progress-panel[data-error="true"] .progress-track span {
  background: var(--warning);
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-weight: 700;
}

.tool-view {
  display: none;
}

.tool-view.active {
  display: block;
}

.tool-copy {
  max-width: 640px;
  margin-bottom: 22px;
}

.tool-form {
  display: grid;
  gap: 20px;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 2px dashed #aeb8c6;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 24px;
  text-align: center;
  cursor: pointer;
}

.drop-zone input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 32px;
  line-height: 1;
}

.drop-zone strong,
.drop-zone small {
  display: block;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-grid.split-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-grid legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  font-weight: 800;
}

.choice-grid label {
  display: flex;
  gap: 10px;
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.choice-grid input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.choice-grid strong,
.choice-grid small {
  display: block;
}

.field {
  display: grid;
  gap: 8px;
  max-width: 420px;
  font-weight: 800;
}

.field[hidden] {
  display: none;
}

.field input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
}

.field.compact {
  min-width: 160px;
}

.inline-options {
  display: flex;
  align-items: stretch;
  gap: 12px;
  flex-wrap: wrap;
}

.toggle-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px 14px;
}

.toggle-option input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.toggle-option strong,
.toggle-option small {
  display: block;
}

.toggle-option small {
  color: var(--muted);
}

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

.file-list[hidden] {
  display: none;
}

.file-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.file-list strong {
  overflow-wrap: anywhere;
}

.file-list small {
  color: var(--muted);
  white-space: nowrap;
}

.actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.actions button,
.download-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 0 18px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.actions button:hover,
.download-button:hover {
  background: var(--accent-strong);
}

.actions button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.message {
  margin: 0;
  font-weight: 700;
}

.message[data-error="true"] {
  color: var(--warning);
}

.result-panel {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.result-panel[hidden] {
  display: none;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

dt,
dd {
  margin: 0;
}

dd {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 850;
}

.download-button {
  display: inline-grid;
  place-items: center;
  justify-self: start;
}

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

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

  .tool-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    padding: 22px;
  }

  .choice-grid,
  .choice-grid.split-options,
  .stats {
    grid-template-columns: 1fr;
  }

  .progress-meta {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .tool-nav {
    grid-template-columns: 1fr;
  }

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