:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --border: #d9dee8;
  --accent: #2357c6;
  --accent-dark: #183f93;
  --green: #11855a;
  --red: #b42318;
  --amber: #b76e00;
}

* {
  box-sizing: border-box;
}

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

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.brand {
  color: var(--ink);
  font-size: 16px;
  font-weight: 750;
  text-decoration: none;
}

.model-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 700;
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.detail-shell {
  width: min(920px, calc(100vw - 32px));
}

.landing-shell {
  width: min(860px, calc(100vw - 32px));
}

.page-heading {
  margin-bottom: 22px;
}

.page-heading.compact {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

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

.tool-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tool-button {
  display: grid;
  gap: 10px;
  min-height: 150px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.06);
  color: var(--ink);
  text-decoration: none;
}

.tool-button:hover {
  border-color: rgba(35, 87, 198, 0.42);
}

.tool-button span {
  font-size: 20px;
  font-weight: 800;
}

.tool-button small {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.06);
}

.form-panel,
.queue-panel,
.progress-panel,
.preview-panel {
  padding: 22px;
}

.field-group {
  margin-bottom: 18px;
}

.field-group label {
  display: block;
  margin-bottom: 7px;
  color: #263242;
  font-size: 14px;
  font-weight: 760;
}

textarea,
input[type="file"] {
  width: 100%;
}

textarea {
  display: block;
  resize: vertical;
  min-height: 130px;
  padding: 12px 13px;
  border: 1px solid #cfd6e2;
  border-radius: 7px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  line-height: 1.5;
}

textarea:focus {
  outline: 3px solid rgba(35, 87, 198, 0.16);
  border-color: var(--accent);
}

input[type="file"] {
  min-height: 42px;
  padding: 8px;
  border: 1px dashed #b8c2d3;
  border-radius: 7px;
  background: #fbfcff;
  font: inherit;
  color: var(--muted);
}

.field-help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.file-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  color: #ffffff;
  background: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.panel-heading {
  margin-bottom: 12px;
}

.request-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.request-list li + li {
  border-top: 1px solid var(--border);
}

.request-list a {
  display: grid;
  gap: 4px;
  padding: 13px 0;
  text-decoration: none;
}

.request-list span {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-list small,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.form-errors,
.errorlist,
.error-text {
  color: var(--red);
}

.errorlist {
  margin: 7px 0 0;
  padding-left: 18px;
  font-size: 13px;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  color: var(--muted);
  font-weight: 650;
}

.progress-slider {
  width: 100%;
  accent-color: var(--accent);
}

.progress-meta,
.download-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.progress-meta {
  color: var(--muted);
  font-size: 14px;
}

.progress-meta strong {
  color: var(--ink);
  font-size: 18px;
}

.progress-panel[data-status="complete"] .status-pill {
  color: var(--green);
  border-color: rgba(17, 133, 90, 0.22);
  background: rgba(17, 133, 90, 0.08);
}

.progress-panel[data-status="failed"] .status-pill {
  color: var(--red);
  border-color: rgba(180, 35, 24, 0.22);
  background: rgba(180, 35, 24, 0.08);
}

.preview-panel {
  margin-top: 18px;
}

.preview-panel h2 {
  margin-bottom: 14px;
}

.preview-panel pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #263242;
  font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.is-hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 16px;
  }

  .workspace-grid,
  .file-row,
  .tool-actions {
    grid-template-columns: 1fr;
  }

  .progress-meta,
  .download-row,
  .status-line {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    justify-content: stretch;
  }

  .primary-button {
    width: 100%;
  }
}
