:root {
  --bg: #eef3f6;
  --panel: #ffffff;
  --text: #142430;
  --muted: #5a6f7d;
  --brand: #0b8ea5;
  --brand-dark: #066e81;
  --line: #d9e3ea;
  --ok: #1d8f43;
  --warn: #c67a02;
  --bad: #b63737;
  --shadow: 0 16px 50px rgba(10, 35, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(11, 142, 165, 0.1), transparent 25%),
    radial-gradient(circle at 85% 0%, rgba(20, 36, 48, 0.08), transparent 30%),
    var(--bg);
}

.app-shell {
  width: min(1100px, 100% - 2rem);
  margin: 1.5rem auto 2rem;
  display: grid;
  gap: 1rem;
}

.app-header,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.app-header {
  padding: 1.2rem 1.25rem;
}

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

h1,
h2 {
  margin: 0.35rem 0 0;
}

.subtitle {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.panel {
  padding: 1rem;
}

.upload-panel {
  display: grid;
  gap: 1rem;
}

.dropzone {
  border: 2px dashed #a9c0cc;
  border-radius: 0.85rem;
  background: #f8fcff;
  min-height: 210px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1rem;
  transition: 180ms ease;
  cursor: pointer;
  position: relative;
}

.dropzone:hover,
.dropzone.dragging,
.dropzone:focus-visible {
  border-color: var(--brand);
  background: #eef9fc;
  outline: none;
}

.dropzone input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dropzone-content {
  display: grid;
  gap: 0.45rem;
}

.dropzone-content small {
  color: var(--muted);
}

.preview-wrap {
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #fbfdfe;
  display: grid;
  place-items: center;
  overflow: hidden;
}

#imagePreview {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
}

#previewPlaceholder {
  color: var(--muted);
}

.grid-two {
  display: grid;
  gap: 1rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-top: 0.9rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid #bfd0da;
  border-radius: 0.55rem;
  padding: 0.62rem 0.72rem;
  background: #fff;
}

input:focus,
select:focus {
  outline: 2px solid #94d8e4;
  outline-offset: 1px;
  border-color: var(--brand);
}

.inline-control {
  margin-top: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
}

.inline-control input {
  width: auto;
}

.status-list {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
  display: grid;
  gap: 0.35rem;
}

.status-list p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.btn {
  border: none;
  border-radius: 0.62rem;
  padding: 0.65rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: 180ms ease;
}

.btn.primary {
  margin-top: 1rem;
  width: 100%;
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover:enabled {
  background: var(--brand-dark);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.secondary {
  background: #e6f6fa;
  color: #054858;
}

.btn.secondary:hover {
  background: #d4eef4;
}

.preview-note {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tile-preview {
  margin-top: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: #fbfdff;
  padding: 0.8rem;
  min-height: 300px;
  display: grid;
  align-content: start;
  gap: 0.4rem;
}

.tile-placeholder {
  margin: auto;
  color: var(--muted);
}

.tile-grid {
  display: grid;
  gap: 0.35rem;
}

.tile-cell {
  border: 1px solid #9eb7c5;
  background: linear-gradient(155deg, #dff1f6, #f3fbff);
  border-radius: 0.5rem;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #184554;
}

.tile-meta {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.quality-ok {
  color: var(--ok);
}

.quality-warn {
  color: var(--warn);
}

.quality-bad {
  color: var(--bad);
}

@media (min-width: 860px) {
  .upload-panel {
    grid-template-columns: 1.15fr 1fr;
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 1rem, 1100px);
    margin: 0.75rem auto 1.25rem;
  }

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

  .panel {
    padding: 0.9rem;
  }
}
