@font-face {
  font-family: "Montserrat";
  src: url("fonts/Montserrat-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("fonts/Montserrat-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("fonts/Montserrat-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #20326c;
  --navy-deep: #17244f;
  --ink: #1a1f33;
  --muted: #6d6e70;
  --line: #d8dbe3;
  --paper: #f4f5f8;
  --white: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: var(--navy);
  color: var(--white);
}

.top-logo {
  height: 22px;
  width: auto;
  filter: brightness(0) invert(1);
}

.top-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.top-text strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.top-text span {
  font-size: 12px;
  opacity: 0.72;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 36px;
  padding: 28px;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}

.lead {
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}

input {
  font: 400 14px/1.4 "Montserrat", Arial, sans-serif;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}

input:focus {
  outline: 2px solid var(--navy);
  outline-offset: 1px;
}

.extra {
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.extra summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 12px;
}

.extra[open] summary { margin-bottom: 14px; }

.extra label { margin-bottom: 10px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

button {
  font: 600 13px/1 "Montserrat", Arial, sans-serif;
  padding: 12px 16px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid transparent;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-primary {
  background: var(--navy);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) { background: var(--navy-deep); }

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}

.btn-ghost:hover:not(:disabled) { background: #e8ebf3; }

.hint {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 6px;
}

.stage {
  background:
    linear-gradient(45deg, #eceff4 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, #eceff4 75%) 8px 8px / 16px 16px,
    #fafbfc;
  padding: 18px;
  display: flex;
  justify-content: center;
  border: 1px solid var(--line);
}

.card {
  width: 90mm;
  height: 50mm;
  position: relative;
  overflow: hidden;
  background: var(--white);
  box-shadow: 0 10px 28px rgba(23, 36, 79, 0.16);
  flex-shrink: 0;
}

.card-front {
  background-color: var(--white);
  background-image: url("assets/watermark.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 6.3mm 5.5mm 5mm 6.1mm;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.person-name {
  font-size: 3.55mm;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.18;
  letter-spacing: -0.01em;
  max-width: 78mm;
}

.person-title {
  margin-top: 1.7mm;
  font-size: 2.15mm;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.25;
  max-width: 78mm;
}

.person-dept {
  margin-top: 0.6mm;
  font-size: 2.05mm;
  font-weight: 400;
  color: var(--navy);
  line-height: 1.25;
  max-width: 78mm;
}

.person-dept[hidden] {
  display: none;
}

.front-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 4mm;
}

.contacts {
  display: flex;
  flex-direction: column;
  gap: 1.1mm;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 1.5mm;
  font-size: 2.15mm;
  font-weight: 400;
  color: var(--navy);
  line-height: 1;
}

.ico {
  width: 2.3mm;
  height: 2.3mm;
  fill: var(--muted);
  flex-shrink: 0;
}

.card-logo {
  position: absolute;
  right: 5.5mm;
  bottom: 5mm;
  width: 13.4mm;
  height: 4.5mm;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.card-back {
  display: flex;
}

.back-left {
  width: 50%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
}

.qr {
  width: 32mm;
  height: 32mm;
}

.qr canvas,
.qr img,
.qr table {
  width: 32mm !important;
  height: 32mm !important;
}

.back-right {
  width: 50%;
  height: 100%;
  background: var(--navy);
  color: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 11.4mm 4mm 8mm;
}

.back-company {
  font-size: 3.05mm;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
  line-height: 1.15;
}

.back-contacts {
  margin-top: 4.4mm;
  text-align: center;
  font-size: 2.15mm;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

.foot {
  padding: 14px 28px 22px;
  font-size: 12px;
  color: var(--muted);
}

.foot code {
  font-size: 11px;
  background: #e8ebf3;
  padding: 1px 5px;
  color: var(--navy);
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 18px;
  }
}

@media print {
  body { background: white; }
  .top, .panel, .foot, .preview-label { display: none !important; }
  .layout { display: block; padding: 0; max-width: none; }
  .stage {
    background: none;
    border: 0;
    padding: 0;
    box-shadow: none;
  }
  .card { box-shadow: none; page-break-after: always; }
}
