/* PIN-Gate Overlay */
.pin-gate {
  position: fixed;
  inset: 0;
  background: #393536;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.pin-gate.unlocked {
  display: none;
}
.pin-card {
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: pin-fade-in 0.25s ease-out;
}
@keyframes pin-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pin-card.shake {
  animation: pin-shake 0.45s;
}
@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}
.pin-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 18px;
  background: #FCD31D;
  clip-path: polygon(40% 0, 60% 0, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0 60%, 0 40%, 40% 40%);
}
.pin-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.2px;
  color: #1a1a1a;
}
.pin-card p {
  margin: 0 0 20px;
  color: #6b6b6b;
  font-size: 14px;
}
.pin-card input {
  width: 100%;
  padding: 16px 12px;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  font-size: 28px;
  letter-spacing: 16px;
  text-align: center;
  font-family: inherit;
  background: #fafafa;
  margin-bottom: 14px;
  font-weight: 700;
  color: #1a1a1a;
}
.pin-card input:focus {
  outline: none;
  border-color: #FCD31D;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(252, 211, 29, 0.25);
}
.pin-card button {
  width: 100%;
  background: #FCD31D;
  color: #393536;
  font-weight: 800;
  padding: 14px 18px;
  font-size: 15px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 0 #d8b510;
  transition: transform 0.05s, background 0.15s;
}
.pin-card button:hover { background: #ffd827; }
.pin-card button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #d8b510;
}
.pin-status {
  margin: 14px 0 0 !important;
  font-size: 13px;
  min-height: 18px;
  color: #d2342b !important;
}
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

:root {
  --pima-yellow: #FCD31D;
  --pima-dark: #393536;
  --pima-dark-2: #2c292a;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --border: #e5e5ea;
  --error: #d2342b;
  --success: #1c8b3b;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-strong: 0 8px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto,
    Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.topbar {
  background: var(--pima-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 0 var(--pima-yellow);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--pima-yellow);
  clip-path: polygon(40% 0, 60% 0, 60% 40%, 100% 40%, 100% 60%, 60% 60%, 60% 100%, 40% 100%, 40% 60%, 0 60%, 0 40%, 40% 40%);
}
.brand-text {
  font-size: 16px;
}
.brand-sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1.1fr);
  gap: 24px;
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 24px;
}
@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 32px;
}
.panel h1 {
  margin: 0 0 4px;
  font-size: 24px;
  letter-spacing: -0.3px;
}
.panel h2 {
  margin: 0 0 4px;
  font-size: 20px;
}
.lede {
  color: var(--text-muted);
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
}

/* Form */
fieldset {
  border: none;
  padding: 0;
  margin: 0 0 18px;
}
legend {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
label {
  display: block;
  margin-bottom: 12px;
}
label > span {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 600;
}
input[type="text"],
input[type="tel"],
input[type="email"],
input[type="url"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fafafa;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--pima-yellow);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(252, 211, 29, 0.25);
}
input:invalid:not(:placeholder-shown) {
  border-color: #f4b4b0;
}

.row {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr;
  gap: 10px;
}
.row label {
  margin-bottom: 0;
}
@media (max-width: 520px) {
  .row {
    grid-template-columns: 1fr;
  }
}

/* Dropzone */
.dropzone {
  display: block;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
  background: #fafafa;
}
.dropzone.dragover {
  border-color: var(--pima-yellow);
  background: #fffdee;
}
.dropzone.has-file {
  border-style: solid;
  border-color: var(--pima-yellow);
  background: #fffdee;
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.dropzone-icon {
  font-size: 32px;
}
.dropzone-text strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}
.dropzone-text small {
  color: var(--text-muted);
  font-size: 12px;
}

/* Buttons */
button {
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: 10px;
  padding: 12px 18px;
  border: none;
  font-size: 15px;
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s;
}
button.primary {
  width: 100%;
  background: var(--pima-yellow);
  color: var(--pima-dark);
  font-weight: 800;
  letter-spacing: 0.2px;
  margin-top: 4px;
  padding: 14px 18px;
  font-size: 15px;
  box-shadow: 0 4px 0 #d8b510;
}
button.primary:hover {
  background: #ffd827;
}
button.primary:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #d8b510;
}
button.primary:disabled {
  background: #e0e0e0;
  color: #999;
  box-shadow: none;
  cursor: not-allowed;
}
button.ghost {
  background: transparent;
  color: var(--pima-dark);
  border: 1px solid var(--border);
}
button.ghost:hover {
  background: #fafafa;
  border-color: var(--pima-dark);
}

/* Status */
.status {
  margin: 14px 0 0;
  font-size: 14px;
  min-height: 20px;
}
.status.error {
  color: var(--error);
}
.status.success {
  color: var(--success);
}
.status.busy {
  color: var(--text-muted);
}

/* Preview */
.cards {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 14px;
}
.card-wrap {
  text-align: center;
}
.card-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
canvas {
  width: 100%;
  height: auto;
  max-width: 540px;
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
  display: block;
  margin: 0 auto;
  background: var(--pima-dark);
  aspect-ratio: 90 / 58;
}

.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 28px 12px 36px;
}
