:root {
  --bg: #f4efe7;
  --ink: #172033;
  --muted: #55627b;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --line: rgba(23, 32, 51, 0.12);
  --brand: #d75f34;
  --brand-deep: #b2441b;
  --accent: #0f766e;
  --shadow: 0 24px 60px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(215, 95, 52, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.18), transparent 24%),
    linear-gradient(180deg, #fcfaf7 0%, var(--bg) 100%);
}

body.auth-locked .app {
  display: none;
}

body.auth-ready .auth-screen {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 2.4rem;
}

.auth-copy {
  margin-bottom: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-card .btn {
  width: 100%;
}

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero,
.workspace,
.help-grid,
.grid-2,
.grid-3,
.actions,
.meta,
.batch-controls,
.batch-actions,
.download-panel,
.import-panel {
  display: grid;
}

.hero {
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero > div,
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero > div:first-child {
  padding: 28px;
}

.hero-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.86), rgba(248, 233, 226, 0.92)),
    var(--panel);
}

.hero-chip {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(23, 32, 51, 0.05);
  font-weight: 600;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 4.4rem);
  line-height: 0.96;
  margin-bottom: 14px;
}

.hero-copy {
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.workspace {
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.panel {
  padding: 22px;
}

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

.panel-heading h2 {
  font-size: 1.28rem;
  margin-bottom: 6px;
}

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

.field {
  display: block;
  margin-bottom: 16px;
}

.settings-group {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.settings-group .field {
  margin-bottom: 0;
}

.settings-group-physical {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(247, 242, 235, 0.8));
}

.settings-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.settings-head h3 {
  font-size: 0.98rem;
}

.settings-head p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.3;
}

.field span {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.compact-field span,
.range-field span {
  margin-bottom: 10px;
  font-size: 0.92rem;
}

.download-panel .field span {
  white-space: nowrap;
}

.field input[type="text"],
.field input[type="number"],
.field select,
.number-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  font-size: 1rem;
  color: var(--ink);
}

.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field select:focus,
.number-input:focus {
  outline: 2px solid rgba(215, 95, 52, 0.18);
  border-color: rgba(215, 95, 52, 0.42);
  box-shadow: 0 0 0 4px rgba(215, 95, 52, 0.08);
}

.field input[type="range"] {
  width: 100%;
  accent-color: #2f6773;
}

.number-shell {
  display: grid;
  grid-template-columns: minmax(120px, 160px);
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 242, 235, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.number-input {
  width: 100%;
  min-width: 120px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  outline: none;
  text-align: center;
}

.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
  margin: 0;
}


.field strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(215, 95, 52, 0.08);
  color: var(--brand-deep);
  font-size: 0.92rem;
}

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

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

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

.compact-grid {
  gap: 12px;
}

.compact-field input[type="number"],
.compact-field select {
  min-height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
}

.fallback-size {
  display: none;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.checkbox span {
  margin: 0;
}

.actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.batch-controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.batch-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.download-panel {
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
  align-items: end;
  margin-top: 12px;
}

.btn-download-batch {
  width: 100%;
}

.import-panel {
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.file-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.file-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: 62px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 242, 235, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.file-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  width: 100%;
  padding: 0 16px;
  border-radius: 12px;
  background: rgba(23, 32, 51, 0.08);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.file-name {
  min-width: 0;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.import-summary {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.btn {
  border: 0;
  border-radius: 14px;
  min-height: 48px;
  padding: 12px 16px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}

.btn-secondary {
  color: var(--ink);
  background: rgba(23, 32, 51, 0.08);
}

.btn:hover {
  transform: translateY(-1px);
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.btn-primary:hover {
  box-shadow: 0 12px 24px rgba(178, 68, 27, 0.2);
}

.btn-secondary:hover,
.file-trigger:hover {
  background: rgba(23, 32, 51, 0.12);
}

.status {
  min-height: 24px;
  margin-top: 14px;
  color: var(--brand-deep);
  font-weight: 600;
}

.preview-panel {
  display: flex;
  flex-direction: column;
}

.preview-frame {
  display: grid;
  place-items: center;
  min-height: 360px;
  padding: 26px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 247, 242, 0.92));
  border: 1px solid rgba(23, 32, 51, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
  overflow: auto;
}

#barcodeCanvas {
  width: 100%;
  max-width: 780px;
  height: auto;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(23, 32, 51, 0.1);
  box-shadow: 0 18px 34px rgba(23, 32, 51, 0.08);
}

.meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.meta > div {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
}

.meta-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

.help article {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
}

.help h3 {
  margin-bottom: 8px;
}

.batch-panel {
  margin-top: 24px;
}

.batch-summary {
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 600;
}

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  max-height: 760px;
  overflow: auto;
  padding: 4px 6px 4px 2px;
}

.batch-card {
  overflow: hidden;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 244, 238, 0.92));
  box-shadow: 0 14px 30px rgba(23, 32, 51, 0.07);
}

.batch-card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.82rem;
  line-height: 1.1;
  text-align: center;
}

.batch-card.has-reference {
  padding-top: 8px;
}

.batch-card svg {
  width: 100%;
  height: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(23, 32, 51, 0.09);
}

@media (max-width: 900px) {
  .hero,
  .workspace,
  .help-grid,
  .actions,
  .grid-2,
  .grid-3,
  .grid-4,
  .meta,
  .batch-controls,
  .batch-actions,
  .download-panel,
  .import-panel {
    grid-template-columns: 1fr;
  }

  .app {
    width: min(100% - 20px, 1120px);
    padding-top: 20px;
  }

  .hero > div:first-child,
  .hero-card,
  .panel {
    padding: 20px;
  }

  .preview-frame {
    min-height: 280px;
    padding: 12px;
  }

  .settings-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
