:root {
  color-scheme: light;
  --page: #f5f7fb; --paper: #fff; --soft: #edf3ff; --subtle: #f8fafd;
  --ink: #132036; --muted: #50607a; --line: #d9e2ee;
  --brand: #1e52c5; --on-brand: #fff; --error: #a52236;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
}
:root[data-theme=dark] {
  color-scheme: dark;
  --page: #0d1320; --paper: #151f2f; --soft: #1c2c49; --subtle: #111a29;
  --ink: #edf3ff; --muted: #acbdd6; --line: #2e3d56;
  --brand: #9ab9ff; --on-brand: #11213e; --error: #ffa6b1;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
button, input, select, a { font: inherit; }
button, select, label[for], a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.shell { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }
.top { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.025em; }
.brand strong { font-weight: 550; color: var(--muted); }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: var(--soft); color: var(--brand); }
.brand-mark svg, .theme svg { width: 18px; height: 18px; }
.theme { min-height: 44px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); padding: 0 12px; cursor: pointer; font-size: .86rem; }
.moon, [data-theme=dark] .sun { display: none; }
[data-theme=dark] .moon { display: block; }
.hero { padding: 47px 0 31px; }
.eyebrow { color: var(--brand); font-size: .73rem; font-weight: 750; letter-spacing: .11em; margin: 0; }
h1 { font-size: clamp(2.15rem, 5.5vw, 3.65rem); line-height: 1.05; letter-spacing: -.055em; margin: 8px 0 10px; }
.hero > p:last-child { color: var(--muted); max-width: 610px; line-height: 1.55; margin: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 362px) minmax(0, 1fr); align-items: start; gap: 16px; }
.card { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 19px; }
.card h2 { display: flex; align-items: center; gap: 9px; font-size: 1.07rem; letter-spacing: -.018em; margin: 0 0 14px; }
.step { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 6px; background: var(--soft); color: var(--brand); font-size: .75rem; flex-shrink: 0; }
.drop { min-height: 120px; padding: 15px 10px; display: grid; justify-items: center; align-content: center; gap: 5px; text-align: center; border: 1px dashed var(--brand); border-radius: 11px; background: var(--soft); cursor: pointer; overflow-wrap: anywhere; }
.drop svg { width: 26px; height: 26px; margin-bottom: 2px; color: var(--brand); }
.drop small, .card-caption, .preview-note, footer { color: var(--muted); font-size: .82rem; line-height: 1.5; }
.drop.is-dragging { border-style: solid; outline: 2px solid var(--brand); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.upload-card:has(#invoice-file:focus-visible) .drop, :is(button,select,a):focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.languages { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: end; gap: 9px; margin-top: 15px; }
.languages label { display: grid; gap: 5px; color: var(--muted); font-size: .78rem; min-width: 0; }
.languages select { width: 100%; min-height: 44px; color: var(--ink); background: var(--subtle); border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-size: .87rem; }
.arrow { color: var(--muted); height: 44px; display: grid; align-items: center; }
.ocr { display: flex; align-items: center; min-height: 44px; gap: 8px; color: var(--muted); font-size: .82rem; line-height: 1.3; margin: 6px 0; }
.ocr input { width: 17px; height: 17px; margin: 0; flex-shrink: 0; accent-color: var(--brand); }
.primary, .secondary { min-height: 46px; border-radius: 8px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-decoration: none; cursor: pointer; font-size: .86rem; font-weight: 750; }
.primary { border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); }
.secondary { border: 1px solid var(--line); background: var(--subtle); color: var(--ink); }
.primary:disabled { opacity: .65; cursor: default; }
.primary:hover:enabled, .download:hover { filter: brightness(.91); }
#translate { width: 100%; }
.status { margin-top: 13px; padding: 11px; border: 1px solid var(--line); background: var(--subtle); border-radius: 9px; }
.status-head { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; }
#percent { color: var(--brand); font-weight: 750; font-variant-numeric: tabular-nums; }
.track { overflow: hidden; border-radius: 99px; margin: 8px 0 6px; background: var(--line); height: 6px; }
#fill { width: 0; height: 100%; border-radius: 99px; background-color: var(--brand); transition: width .35s ease; }
.status[data-state=working] #fill, .status[data-state=uploading] #fill { background-image: linear-gradient(110deg,transparent 30%,#ffffff65 52%,transparent 75%); background-size: 150px 100%; animation: shimmer 1.5s linear infinite; }
.status[data-state=waiting] #fill { width: 35% !important; animation: sweep 1.5s ease-in-out infinite alternate; }
.status[data-state=failed] #status-title { color: var(--error); }
#status-detail { min-height: 1em; margin: 0; color: var(--muted); font-size: .75rem; line-height: 1.45; }
@keyframes shimmer { to { background-position: 150px 0; } }
@keyframes sweep { from { transform: translateX(-20%); } to { transform: translateX(200%); } }
.card-caption { margin: -5px 0 14px; }
.previews { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
figure { min-width: 0; margin: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
figcaption { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 9px; background: var(--paper); font-size: .79rem; font-weight: 700; }
figcaption span { color: var(--muted); font-size: .72rem; font-weight: 500; }
.preview { min-height: 215px; display: grid; place-items: center; color: var(--muted); background: var(--subtle); border-top: 1px solid var(--line); font-size: .78rem; text-align: center; }
.preview img { max-width: 100%; max-height: 330px; width: 100%; object-fit: contain; }
.preview-note { margin: 10px 0 0; }
.downloads { display: grid; gap: 8px; grid-template-columns: repeat(2,minmax(0,1fr)); margin-top: 12px; }
footer { display: flex; flex-wrap: wrap; gap: 5px 14px; padding: 18px 0 22px; }
@media (max-width: 860px) {
  .workspace { grid-template-columns: minmax(0,1fr); }
  .hero { padding-top: 33px; }
}
@media (max-width: 540px) {
  .shell { width: calc(100% - 24px); }
  .top { min-height: 57px; }
  .brand { font-size: .91rem; }
  .hero { padding: 24px 0 19px; }
  .hero > p:last-child { font-size: .92rem; }
  .card { padding: 13px; border-radius: 12px; }
  .preview { min-height: 105px; }
  .preview img { max-height: 250px; }
  .downloads { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
