:root {
  color-scheme: light;
  --ink: #152338;
  --muted: #526178;
  --faint: #e0e7ef;
  --blue: #1555c2;
  --blue-dark: #0f449e;
  --navy: #111f36;
  --red: #9f2a30;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f4f7fb;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; line-height: 1.55; }
a { color: var(--blue); text-underline-offset: 0.18em; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #3977e7; outline-offset: 3px; }

.skip-link { position: absolute; z-index: 2; top: 8px; left: -9999px; }
.skip-link:focus { left: 8px; background: white; padding: 0.45rem 0.75rem; }
.header { background: var(--navy); color: white; }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  width: min(100% - 2.5rem, 68rem);
  min-height: 4.4rem;
  margin-inline: auto;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  font-weight: 720;
  text-decoration: none;
  white-space: nowrap;
}
.brand-secondary { color: #adc2df; font-weight: 500; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  aspect-ratio: 1;
  border-radius: 0.58rem;
  background: #285fca;
  color: white;
}
.brand-mark span {
  display: block;
  width: 0.95rem;
  height: 0.98rem;
  border: 2px solid currentColor;
  border-radius: 0.18rem;
  background: linear-gradient(transparent 45%, currentColor 45% 60%, transparent 60%);
}
.header-nav { display: flex; align-items: center; gap: 0.9rem; }
.header-nav form { margin: 0; }
.header-nav a, .sign-out { color: #dce7f8; font-size: 0.875rem; white-space: nowrap; }
.sign-out {
  padding: 0.4rem 0.65rem;
  border: 1px solid #52637c;
  border-radius: 0.42rem;
  background: transparent;
}
.sign-out:hover { background: #2c3e5a; }

.workspace, .signin { width: min(100% - 2.5rem, 52rem); margin: 3.4rem auto 4rem; }
.signin { width: min(100% - 2.5rem, 27rem); margin-top: clamp(2rem, 9vh, 6rem); }
.page-heading { margin-bottom: 1.5rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.9rem, 4.6vw, 2.7rem); line-height: 1.13; letter-spacing: -0.045em; }
h2 { font-size: 1.15rem; line-height: 1.35; letter-spacing: -0.014em; }
.description { color: var(--muted); margin-top: 0.55rem; }
.panel {
  background: white;
  border: 1px solid var(--faint);
  border-radius: 0.9rem;
  box-shadow: 0 0.45rem 1.5rem #192f5609;
}
.signin-panel, .upload-panel, .result-panel { padding: clamp(1.1rem, 4vw, 2rem); }
.signin-panel h1 { font-size: 2.1rem; }
.signin-panel .form-stack { margin-top: 1.55rem; }
.form-stack { display: grid; gap: 1.25rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.9rem; font-weight: 650; }
.field input, .field select, textarea {
  width: 100%;
  min-height: 2.8rem;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  background: white;
  border: 1px solid #aebbcf;
  border-radius: 0.45rem;
}
.field input[type=file] { padding: 0.55rem; background: #f7faff; }
input[type=file]::file-selector-button {
  margin-right: 0.6rem;
  padding: 0.35rem 0.65rem;
  border: 0;
  border-radius: 0.25rem;
  background: #e5edfc;
  color: #134492;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.language-field { max-width: 21rem; }
.help { color: var(--muted); font-size: 0.875rem; }
.errorlist { margin: 0; padding-inline-start: 1.2rem; color: var(--red); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.48rem 0.95rem;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  font-weight: 670;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}
.primary { color: white; background: var(--blue); }
.primary:hover { background: var(--blue-dark); }
.secondary { color: var(--blue-dark); background: #f3f7ff; border-color: #c9d9f4; }
.secondary:hover { background: #e7efff; }

.recent { margin-top: 2.15rem; }
.recent h2 { margin-bottom: 0.7rem; }
.job-list { list-style: none; padding: 0; margin: 0; }
.job-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
}
.job-list li + li { border-top: 1px solid var(--faint); }
.job-list a, .filename { overflow-wrap: anywhere; }
.back { display: inline-block; margin-bottom: 0.65rem; font-size: 0.9rem; }
.job-meta { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.7rem; color: var(--muted); }
.status {
  display: inline-block;
  width: max-content;
  padding: 0.12rem 0.55rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 650;
  background: #e8eef7;
  color: #34465e;
}
.status-processing { color: #174a9d; background: #e3edff; }
.status-completed { color: #195d43; background: #e5f3ec; }
.status-failed { color: #902633; background: #fbe9eb; }
.result-panel { display: grid; gap: 0.9rem; }
.result-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
textarea { resize: vertical; min-height: 10rem; }
.copy-feedback:empty { display: none; }
.retention { border-top: 1px solid var(--faint); padding-top: 0.7rem; }
.failure { color: var(--red); }
.result-panel > .button, .pending > a { justify-self: start; }

@media (max-width: 480px) {
  .workspace { margin-top: 2rem; }
  .brand-secondary { display: none; }
  .header-nav { gap: 0.6rem; }
}
