* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: #020617;
  border-bottom: 1px solid #1e293b;
}

.tool-header > div {
  min-width: 0;
}

.tool-header h1 {
  margin: 8px 0 4px;
  font-size: clamp(23px, 7vw, 32px);
  white-space: nowrap;
}

.tool-header p {
  margin: 0;
  color: #94a3b8;
}

@media (max-width: 430px) {
  .tool-header h1 {
    font-size: 27px;
  }

  .tool-header p {
    font-size: 13px;
    line-height: 1.35;
  }
}

.back-link {
  color: #38bdf8;
  text-decoration: none;
  font-size: 14px;
  font-weight: bold;
}

.back-link:hover {
  text-decoration: underline;
}

.version-pill {
  background: #082f49;
  color: #67e8f9;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: bold;
}

.tool-layout {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.panel {
  min-width: 0;
  background: #111827;
  border: 1px solid #263244;
  border-radius: 22px;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.eyebrow {
  color: #38bdf8;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}

.panel h2 {
  margin: 10px 0;
  font-size: 26px;
}

.helper-text {
  color: #94a3b8;
  line-height: 1.5;
}

.credential-privacy-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid #0e7490;
  border-radius: 12px;
  background: rgba(8, 47, 73, 0.45);
  color: #bae6fd;
  font-size: 14px;
  line-height: 1.45;
}

.credential-privacy-note strong {
  color: #67e8f9;
}

.credential-privacy-banner {
  grid-column: 1 / -1;
  margin: 0;
}

.form-group {
  margin-top: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #cbd5e1;
  font-weight: bold;
}

input {
  width: 100%;
  padding: 14px 16px;
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #334155;
  border-radius: 12px;
  font-size: 16px;
}

input:focus {
  outline: none;
  border-color: #38bdf8;
}

.button-row {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.button-row.center {
  justify-content: center;
}

button {
  padding: 12px 18px;
  background: #0284c7;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  background: #0369a1;
}

.secondary-btn {
  background: #334155;
}

.secondary-btn:hover {
  background: #475569;
}

.badge-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 26px auto;
  max-width: 100%;
  overflow: hidden;
}

.badge-measurement-frame {
  display: grid;
  grid-template-columns: 28px minmax(0, 3.375in);
  grid-template-rows: 24px auto;
  width: min(calc(3.375in + 28px), 100%);
  align-items: stretch;
}

.ruler-corner {
  border-right: 1px solid #38bdf8;
  border-bottom: 1px solid #38bdf8;
}

.badge-ruler {
  position: relative;
  color: #67e8f9;
  font-size: 11px;
  font-weight: bold;
}

.badge-ruler span {
  text-transform: uppercase;
}

.horizontal-ruler {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  border-bottom: 1px solid #38bdf8;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0,
      transparent calc(25% - 1px),
      rgba(56, 189, 248, 0.9) calc(25% - 1px),
      rgba(56, 189, 248, 0.9) 25%
    );
}

.horizontal-ruler::before,
.horizontal-ruler::after {
  content: "";
  position: absolute;
  bottom: -6px;
  width: 1px;
  height: 12px;
  background: #38bdf8;
}

.horizontal-ruler::before {
  left: 0;
}

.horizontal-ruler::after {
  right: 0;
}

.vertical-ruler {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  border-right: 1px solid #38bdf8;
  background:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent calc(25% - 1px),
      rgba(56, 189, 248, 0.9) calc(25% - 1px),
      rgba(56, 189, 248, 0.9) 25%
    );
}

.vertical-ruler::before,
.vertical-ruler::after {
  content: "";
  position: absolute;
  right: -6px;
  width: 12px;
  height: 1px;
  background: #38bdf8;
}

.vertical-ruler::before {
  top: 0;
}

.vertical-ruler::after {
  bottom: 0;
}

.horizontal-ruler span {
  margin-top: 2px;
  padding: 0 6px;
  background: #111827;
}

.vertical-ruler span {
  position: absolute;
  left: -28px;
  top: 50%;
  width: 78px;
  text-align: center;
  transform: translateY(-50%) rotate(-90deg);
  transform-origin: center;
  background: #111827;
}

.badge {
  width: 100%;
  aspect-ratio: 3.375 / 2.125;
  height: auto;
  background-color: white;
  color: black;
  border: 3px solid #000;
  border-radius: 10px;
  padding: 10px 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.badge-section {
  text-align: center;
  padding-top: 5px;
}

canvas {
  margin: 5px 0 12px;
  max-width: 100%;
  height: 58px;
}

h5 {
  margin: 0;
  padding: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: #cbd5e1;
  font-weight: bold;
}

.checkbox-row input {
  width: auto;
}


.qr-badge {
  justify-content: center;
}

.qr-badge-grid {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
  text-align: center;
}

.qr-badge canvas {
  width: 100px;
  height: 100px;
  margin-top: 8px;
}

@media (max-width: 850px) {
  .tool-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
  }

  .tool-layout {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
  }

  .panel,
  input,
  button,
  .button-row,
  .bottom-back-container,
  .bottom-back-button {
    max-width: 100%;
    min-width: 0;
  }
}

footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  color: #64748b;
}

.bottom-back-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.bottom-back-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: min(340px, 100%);
  background: #111827;
  border: 1px solid #263244;
  color: #38bdf8;
  text-decoration: none;
  padding: 18px 24px;
  border-radius: 18px;
  font-size: 18px;
  font-weight: bold;
  transition: 0.2s ease;
}

.bottom-back-button:hover {
  border-color: #38bdf8;
  background: #1e293b;
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.12);
}
