﻿:root {
  --ink: #0b121f;
  --muted: #5b6677;
  --brand-a: #006185;
  --brand-b: #9481ed;
  --brand-c: #4eb1a9;
  --accent: var(--brand-a);
  --accent-dark: #004a67;
  --panel: #ffffff;
  --canvas: #f2efe9;
  --stroke: #e4ded5;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 10% 20%, rgba(148, 129, 237, 0.18) 0%, rgba(78, 177, 169, 0.14) 40%, rgba(0, 97, 133, 0.08) 100%);
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: 'Unbounded', sans-serif;
  margin: 0;
}

.topbar {
  padding: 32px 7vw 16px;
  display: flex;
  gap: 32px;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  font-family: 'Unbounded', sans-serif;
  font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  border-radius: 12px;
  padding: 10px 12px;
}

.brand-title {
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.hero h1 {
  font-size: clamp(28px, 3vw, 40px);
}

.hero p {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 520px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 28px;
  padding: 0 2vw 48px;
}

.panel {
  background: var(--panel);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-left {
  padding: 24px;
}

.panel-right {
  padding: 14px;
  background: #fff;
}

.wizard-steps {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.step {
  border: 1px solid var(--stroke);
  background: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}

.step.active {
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  color: #fff;
  border-color: var(--ink);
}

.wizard-panel {
  display: none;
  animation: fadeIn 0.4s ease;
}

.wizard-panel.active {
  display: block;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 43, 0.15);
}

.inline {
  display: flex;
  gap: 10px;
}

.inline input {
  flex: 1;
}

.items-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.item-row {
  border: 1px dashed var(--stroke);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 1fr 90px 110px 80px;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

.item-row input {
  width: 100%;
}

.item-row .remove {
  grid-column: 4 / 5;
  justify-self: end;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.qr-block {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px dashed var(--stroke);
  border-radius: 16px;
  background: #fff7ef;
}

.qr-preview {
  width: 160px;
  height: 160px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: #fff;
  display: grid;
  place-items: center;
}

.qr-preview img {
  width: 140px;
  height: 140px;
  object-fit: contain;
}

.qr-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.qr-text {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.primary {
  background: linear-gradient(135deg, var(--brand-a), var(--brand-b));
  color: #fff;
}

button.primary:hover {
  filter: brightness(0.95);
}

button.ghost {
  background: #f9f6f2;
  color: var(--ink);
  border: 1px solid var(--stroke);
}

a.ghost {
  display: inline-block;
  background: #f9f6f2;
  color: var(--ink);
  border: 1px solid var(--stroke);
  border-radius: 999px;
  padding: 10px 18px;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

a.ghost:hover,
button.ghost:hover {
  background: #eeebe6;
  transform: translateY(-1px);
}

.preview {
  background: #fff;
  border-radius: 18px;
  border: 1px solid var(--stroke);
  padding: 14px;
  animation: fadeIn 0.4s ease;
  position: relative;
  overflow: hidden;
}

.preview::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--brand-a), var(--brand-b), var(--brand-c));
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--stroke);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

.logo-wrap {
  width: 120px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.logo {
  max-width: 120px;
  max-height: 90px;
}

.logo.hidden {
  display: none;
}

.company {
  font-size: 18px;
  font-weight: 600;
}

.meta {
  font-size: 13px;
  color: var(--muted);
}

.preview-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: 14px;
  margin-bottom: 18px;
  background: #f9f6f2;
}

.party-block {
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 12px;
}

.party-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.preview-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--stroke);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-items {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  margin-bottom: 16px;
}

.table-head,
.item-line {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.table-head {
  background: linear-gradient(135deg, rgba(0, 97, 133, 0.08), rgba(148, 129, 237, 0.08));
  font-weight: 600;
}

.item-line {
  border-top: 1px solid var(--stroke);
}

.totals {
  border-top: 1px solid var(--stroke);
  padding-top: 16px;
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.totals .row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.totals .total {
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-a);
}

.preview-notes h4 {
  font-size: 14px;
  margin-bottom: 10px;
}

.preview-notes p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.preview-notes {
  margin-top: 14px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .inline {
    flex-direction: column;
  }

  .item-row {
    grid-template-columns: 1fr 1fr;
  }

  .item-row .remove {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .preview-header {
    flex-direction: column;
  }

  .preview-parties {
    grid-template-columns: 1fr;
  }

  .qr-block {
    grid-template-columns: 1fr;
  }
}


.preview-header h2 {
  color: var(--brand-a);
}


/* Better PDF export (html2canvas) */
.pdf-mode body {
  background: #fff !important;
}

.pdf-mode * {
  /* Fix for "white shadow" / washed out look */
  opacity: 1 !important;
  filter: none !important;
  -webkit-print-color-adjust: exact !important;
  color-adjust: exact !important;
}

.pdf-mode .panel,
.pdf-mode .preview {
  box-shadow: none !important;
  background: #fff !important; /* Ensure solid white background */
}

.pdf-mode .preview {
  border: none;
  padding: 25px !important; /* Restored padding for document look */
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}

.pdf-mode .preview-header {
  margin-bottom: 20px;
}

.pdf-mode .preview-header h2 {
  font-size: 28px; /* Compact title */
  margin-bottom: 5px;
  font-weight: 800; /* Bolder */
  color: var(--primary);
}

.pdf-mode .meta {
  font-size: 12px;
  line-height: 1.4;
  color: #444 !important; /* Darker for readability */
}

.pdf-mode .company {
  font-size: 16px;
  margin-bottom: 3px;
  font-weight: 700;
  color: #000 !important;
}

.pdf-mode .party-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 3px;
  text-transform: uppercase;
  color: #666 !important;
}

.pdf-mode .preview-parties {
  margin-bottom: 12px;
  padding: 10px;
  grid-template-columns: 1fr 1fr !important;
  display: grid !important;
  gap: 15px;
  border: 1px solid #eee; /* Lighter border for clean look */
  background: #fafafa !important; /* Slight contrast for boxes */
}

.pdf-mode .party-block {
  padding: 0;
}

.pdf-mode .table-head,
.pdf-mode .item-line {
  font-size: 12px;
  padding: 6px 10px;
  line-height: 1.3;
}

.pdf-mode .table-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: #f4f4f4 !important;
  color: #333 !important;
}

.pdf-mode .totals {
  margin-top: 10px;
  padding-top: 10px;
}

.pdf-mode .totals .row {
  font-size: 12px;
  padding: 2px 0;
  font-weight: 500;
}

.pdf-mode .totals .total {
  font-size: 20px;
  font-weight: 800;
  padding: 5px 0;
  color: var(--primary);
}

.pdf-mode .preview-notes {
  margin-top: 10px;
}

.pdf-mode .preview-notes h4 {
  font-size: 13px;
  margin-bottom: 3px;
  font-weight: 700;
}

.pdf-mode .preview-notes p {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink);
}

.pdf-mode .preview-footer {
  margin-top: 15px;
  font-size: 10px;
  color: #999;
}

.pdf-mode .logo-wrap {
  width: 100px;
  height: 70px;
}

.pdf-mode .logo {
  max-width: 100px;
  max-height: 70px;
}
