:root {
  --bg: #f4f6f3;
  --ink: #171c19;
  --muted: #66726c;
  --line: #daddd7;
  --line-strong: #c7cdc5;
  --panel: #ffffff;
  --panel-soft: #f7f8f5;
  --panel-strong: #eef3ef;
  --accent: #0f6b5f;
  --accent-dark: #0a4c44;
  --accent-soft: #e2f0ed;
  --accent-ring: rgba(15, 107, 95, 0.22);
  --warn: #9a5728;
  --danger: #a93636;
  --shadow: 0 20px 44px rgba(22, 28, 25, 0.08), 0 1px 2px rgba(22, 28, 25, 0.06);
  --shadow-soft: 0 12px 26px rgba(22, 28, 25, 0.06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #fafbf8 0%, var(--bg) 46%, #eef1ed 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 30px;
  display: grid;
  align-items: start;
}

.workspace {
  width: 100%;
  display: grid;
  gap: 14px;
}

.topbar,
.drop-panel,
.controls-panel,
.queue-panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(218, 221, 215, 0.92);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 96px;
  border-radius: 8px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), var(--shadow-soft);
}

.topbar-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.trust-strip span {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 850;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 3.2vw, 2.7rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
  letter-spacing: 0;
}

.topbar-subtitle {
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.35;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 1.25rem;
  font-weight: 850;
  line-height: 1;
}

.icon-button:hover {
  color: var(--danger);
  border-color: rgba(169, 54, 54, 0.45);
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(348px, 0.75fr);
  gap: 14px;
}

.drop-panel,
.controls-panel,
.queue-panel {
  border-radius: 8px;
  padding: 16px;
}

.drop-panel {
  display: grid;
  gap: 12px;
}

.drop-zone {
  min-height: 316px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0)),
    var(--panel-soft);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  text-align: center;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 5px var(--accent-ring);
  transform: translateY(-2px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 650;
  line-height: 1;
  box-shadow: var(--shadow-soft);
}

.drop-title {
  font-size: 1.25rem;
  font-weight: 850;
}

.drop-subtitle,
.privacy-note,
.file-meta,
.status {
  color: var(--muted);
  font-size: 0.92rem;
}

.controls-panel {
  align-self: start;
}

.control-stack {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.guideline-panel {
  border: 1px solid rgba(17, 106, 99, 0.28);
  border-radius: 8px;
  background: #f7fbf9;
  padding: 12px;
  color: var(--ink);
  font-size: 0.86rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.guideline-panel strong {
  display: block;
  margin-bottom: 7px;
}

.guideline-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.guideline-panel li + li {
  margin-top: 4px;
}

.job-summary {
  min-height: 74px;
  border: 1px solid rgba(17, 106, 99, 0.28);
  border-radius: 8px;
  background: #f7fbf9;
  padding: 12px;
  display: grid;
  align-content: center;
  gap: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.job-summary strong {
  font-size: 0.92rem;
}

.job-summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.advanced-settings {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.advanced-settings summary {
  min-height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--accent-dark);
  font-weight: 850;
  cursor: pointer;
}

.advanced-stack {
  border-top: 1px solid var(--line);
  padding: 12px;
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 750;
}

select,
input[type="number"],
input[type="text"] {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 19px,
    calc(100% - 12px) 19px;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus,
input[type="color"]:focus {
  border-color: rgba(15, 107, 95, 0.55);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

input[type="color"] {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 4px;
  outline: none;
}

.enhance-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.toggle-row {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

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

.primary-button,
.secondary-button,
.download-link {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  text-decoration: none;
}

.primary-button {
  width: 100%;
  background: linear-gradient(180deg, #13776a, var(--accent-dark));
  color: white;
  box-shadow: 0 10px 20px rgba(15, 107, 95, 0.18);
  transition:
    box-shadow 150ms ease,
    transform 150ms ease,
    background 150ms ease;
}

.primary-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #168275, #073f39);
  box-shadow: 0 14px 26px rgba(15, 107, 95, 0.22);
  transform: translateY(-1px);
}

.progress-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.progress-panel progress {
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}

.secondary-button,
.download-link {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--accent-dark);
  padding: 0 14px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.secondary-button:hover:not(:disabled),
.download-link:hover {
  border-color: rgba(15, 107, 95, 0.42);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.queue-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.site-footer {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  font-size: 0.82rem;
  font-weight: 750;
}

.site-footer a,
.legal-back {
  color: var(--accent-dark);
  text-decoration: none;
}

.site-footer a:hover,
.legal-back:hover {
  text-decoration: underline;
}

.queue-stats {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
}

.queue-stat {
  min-width: 0;
  min-height: 68px;
  padding: 11px 12px;
  display: grid;
  align-content: center;
  gap: 3px;
  border-left: 1px solid var(--line);
}

.queue-stat:first-child {
  border-left: 0;
}

.queue-stat strong {
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.queue-stat span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.queue-stat.is-pass {
  background: #f1f9f5;
}

.queue-stat.is-pass strong {
  color: var(--accent-dark);
}

.queue-stat.is-warn {
  background: #fff5ed;
}

.queue-stat.is-warn strong {
  color: var(--warn);
}

.queue-stat.is-danger {
  background: #fff2f2;
}

.queue-stat.is-danger strong {
  color: var(--danger);
}

.queue-stat.is-info {
  background: #fbfcfa;
}

.empty-state {
  min-height: 122px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--panel-soft);
}

.file-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.file-row {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  box-shadow: 0 1px 1px rgba(22, 28, 25, 0.03);
}

.thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.file-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.file-details {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.source-scan-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-badge {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 850;
}

.source-badge.is-pass {
  border-color: rgba(15, 107, 95, 0.32);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.source-badge.is-warn {
  border-color: rgba(154, 87, 40, 0.38);
  background: #fff5ed;
  color: var(--warn);
}

.source-badge.is-info {
  border-color: var(--line-strong);
  background: #fbfcfa;
}

.preflight-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preflight-badge {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--muted);
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 850;
}

.preflight-badge.is-pass {
  border-color: rgba(15, 107, 95, 0.28);
  background: #f4faf7;
  color: var(--accent-dark);
}

.preflight-badge.is-warn {
  border-color: rgba(154, 87, 40, 0.36);
  background: #fff5ed;
  color: var(--warn);
}

.preflight-badge.is-info {
  border-color: var(--line-strong);
  background: var(--panel-soft);
}

.proof-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.proof-badge {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 800;
}

.proof-badge.is-pass {
  border-color: rgba(17, 106, 99, 0.35);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.proof-badge.is-warn {
  border-color: rgba(159, 77, 34, 0.35);
  background: #fff3eb;
  color: var(--warn);
}

.compare-strip {
  margin-top: 5px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 112px));
  gap: 8px;
}

.compare-strip figure {
  margin: 0;
  display: grid;
  gap: 4px;
}

.compare-strip img {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  object-fit: cover;
}

.compare-strip figcaption {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.file-actions {
  min-width: 136px;
  display: grid;
  gap: 8px;
  justify-items: end;
}

.remove-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.remove-button:hover {
  color: var(--danger);
  border-color: rgba(169, 54, 54, 0.45);
}

.status.is-error {
  color: var(--danger);
}

.status.is-working {
  color: var(--warn);
}

.legal-page {
  width: min(760px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 34px 0;
  display: grid;
  align-content: start;
  gap: 16px;
}

.legal-panel {
  border: 1px solid rgba(218, 221, 215, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 14px;
}

.legal-panel h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.legal-panel h2 {
  margin-top: 8px;
}

.legal-panel p {
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding: 10px 0 20px;
    align-items: start;
  }

  .topbar {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .trust-strip {
    justify-content: flex-start;
  }

  .panel-grid,
  .file-row {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 220px;
  }

  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .queue-actions {
    justify-content: stretch;
  }

  .queue-actions .secondary-button {
    flex: 1 1 180px;
  }

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

  .queue-stat {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .queue-stat:nth-child(-n + 2) {
    border-top: 0;
  }

  .queue-stat:nth-child(even) {
    border-left: 1px solid var(--line);
  }

  .queue-stat:last-child {
    grid-column: 1 / -1;
  }

  .file-row {
    align-items: start;
  }

  .file-actions {
    min-width: 0;
    justify-content: stretch;
  }

  .download-link {
    width: 100%;
  }
}

@media (max-width: 540px) {
  .brand-lockup {
    align-items: flex-start;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .topbar-subtitle {
    font-size: 0.86rem;
  }

  .size-grid {
    grid-template-columns: 1fr;
  }

  .queue-stats {
    grid-template-columns: 1fr;
  }

  .queue-stat,
  .queue-stat:nth-child(even) {
    border-left: 0;
  }

  .queue-stat:nth-child(n) {
    border-top: 1px solid var(--line);
  }

  .queue-stat:first-child {
    border-top: 0;
  }
}
