/* ================================================
   TWOJA-FIRMA — Generator oferty (UI aplikacji)
   Brand: Archivo · accent #ffd200 · ink #11100d · paper #f7f4e4
   ================================================ */

.ofg {
  --ofg-bg: #f7f4e4;
  --ofg-ink: #11100d;
  --ofg-ink-soft: #3a3833;
  --ofg-accent: #ffd200;
  --ofg-accent-soft: #fff4a3;
  --ofg-gray: #6f6f6f;
  --ofg-line: #ddd6ba;
  --ofg-line-2: #ece7d2;
  --ofg-card: #ffffff;
  --ofg-error: #c0392b;
  --ofg-ok: #2e7d32;
  --ofg-font: "Archivo", system-ui, sans-serif;

  margin: 0;
  background: var(--ofg-bg);
  color: var(--ofg-ink);
  font-family: var(--ofg-font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.ofg *,
.ofg *::before,
.ofg *::after { box-sizing: border-box; }

.ofg ::selection { background: var(--ofg-ink); color: var(--ofg-accent); }

/* Wariant osadzony przez shortcode [generator_oferty] —
   generator jest elementem strony, nie pełnym widokiem. */
.ofg--embed { min-height: 0; }
.ofg--embed .ofg-topbar { position: static; }
.ofg--embed .ofg-gate { min-height: 0; padding: 56px 20px; }

/* ---------- topbar ---------- */
.ofg-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 28px;
  background: var(--ofg-ink);
  color: #fff;
  border-bottom: 3px solid var(--ofg-accent);
}
.ofg-brand { display: flex; align-items: center; gap: 16px; }
.ofg-wordmark {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #fff;
  white-space: nowrap;
}
.ofg-wordmark-dash { color: var(--ofg-accent); }
.ofg-brand-sep { width: 1px; height: 26px; background: rgba(255, 255, 255, 0.22); }
.ofg-brand-tool {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
}
.ofg-logout {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
  color: #cfcabb;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 8px 14px;
  border-radius: 2px;
  transition: all 0.16s ease;
}
.ofg-logout:hover { color: var(--ofg-ink); background: var(--ofg-accent); border-color: var(--ofg-accent); }

/* ---------- eyebrow / labels ---------- */
.ofg-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ofg-ink);
  background: var(--ofg-accent);
  display: inline-block;
  padding: 4px 9px;
}
.ofg-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ofg-ink-soft);
  margin-bottom: 6px;
}
.ofg-req { color: var(--ofg-error); font-style: normal; }

/* ---------- inputs ---------- */
.ofg-input {
  width: 100%;
  font-family: var(--ofg-font);
  font-size: 14.5px;
  color: var(--ofg-ink);
  background: #fff;
  border: 1px solid var(--ofg-line);
  border-radius: 3px;
  padding: 10px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ofg-input::placeholder { color: #b4ad94; }
.ofg-input:focus {
  outline: none;
  border-color: var(--ofg-ink);
  box-shadow: 0 0 0 3px var(--ofg-accent-soft);
}
.ofg-input:disabled {
  background: #f4f0dc;
  color: #9f987f;
  cursor: not-allowed;
}
.ofg-input--mini { width: 80px; text-align: right; }
.ofg-field { display: block; margin-bottom: 14px; }
.ofg-field:last-child { margin-bottom: 0; }
.ofg-field.is-disabled .ofg-label { color: #9f987f; }

/* ---------- buttons ---------- */
.ofg-btn {
  font-family: var(--ofg-font);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  border: 1px solid var(--ofg-ink);
  background: #fff;
  color: var(--ofg-ink);
  border-radius: 3px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.ofg-btn:hover { transform: translateY(-1px); }
.ofg-btn:active { transform: translateY(0); }
.ofg-btn--primary {
  background: var(--ofg-accent);
  border-color: var(--ofg-ink);
  box-shadow: 4px 4px 0 var(--ofg-ink);
}
.ofg-btn--primary:hover { box-shadow: 6px 6px 0 var(--ofg-ink); }
.ofg-btn--lg {
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 15px 28px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.ofg-btn--ghost {
  background: transparent;
  border: 1px dashed var(--ofg-line);
  color: var(--ofg-ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.ofg-btn--ghost:hover { border-color: var(--ofg-ink); color: var(--ofg-ink); background: #fff; }
.ofg-btn--tool {
  background: #fffdf2;
  border-color: var(--ofg-line);
  color: var(--ofg-ink-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ofg-btn--tool:hover {
  color: var(--ofg-ink);
  border-color: var(--ofg-ink);
  box-shadow: 3px 3px 0 var(--ofg-accent);
}
.ofg-btn:disabled { opacity: 0.6; cursor: progress; transform: none; }

.ofg-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(17, 16, 13, 0.25);
  border-top-color: var(--ofg-ink);
  border-radius: 50%;
  display: none;
  animation: ofg-spin 0.7s linear infinite;
}
.ofg-btn.is-loading .ofg-spinner { display: inline-block; }
@keyframes ofg-spin { to { transform: rotate(360deg); } }

/* ================================================
   BRAMKA HASŁA
   ================================================ */
.ofg-gate {
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background-image: radial-gradient(circle at 1px 1px, rgba(17, 16, 13, 0.05) 1px, transparent 0);
  background-size: 22px 22px;
}
.ofg-gate-card {
  width: 100%;
  max-width: 420px;
  background: var(--ofg-card);
  border: 1px solid var(--ofg-line);
  border-top: 4px solid var(--ofg-accent);
  border-radius: 4px;
  padding: 36px 34px;
  box-shadow: 0 24px 60px -28px rgba(17, 16, 13, 0.45);
}
.ofg-gate-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 14px 0 10px;
}
.ofg-gate-lead { color: var(--ofg-gray); font-size: 14px; margin-bottom: 22px; }
.ofg-gate-form { margin-top: 6px; }
.ofg-gate-form .ofg-btn { width: 100%; margin-top: 6px; }
.ofg-gate-foot {
  margin-top: 26px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ofg-gray);
  text-align: center;
}
.ofg-alert {
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 3px;
  margin-bottom: 16px;
}
.ofg-alert--error { background: #fcebe9; color: var(--ofg-error); border: 1px solid #f1c9c4; }

/* ================================================
   APLIKACJA
   ================================================ */
.ofg-app { padding: 28px; }
.ofg-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 480px;
  gap: 28px;
  align-items: start;
  max-width: 1380px;
  margin: 0 auto;
}

/* ---------- karty formularza ---------- */
.ofg-form { display: flex; flex-direction: column; gap: 20px; }
.ofg-card {
  background: var(--ofg-card);
  border: 1px solid var(--ofg-line);
  border-radius: 4px;
  padding: 22px 22px 24px;
  margin: 0;
  animation: ofg-rise 0.5s ease both;
}
.ofg-card:nth-child(1) { animation-delay: 0.02s; }
.ofg-card:nth-child(2) { animation-delay: 0.08s; }
.ofg-card:nth-child(3) { animation-delay: 0.14s; }
.ofg-card:nth-child(4) { animation-delay: 0.2s; }
@keyframes ofg-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.ofg-card-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  padding: 0;
  margin-bottom: 18px;
  width: 100%;
}
.ofg-step {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--ofg-ink);
  background: var(--ofg-accent);
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
}
.ofg-card-note { font-size: 12.5px; color: var(--ofg-gray); margin: -6px 0 16px; }

.ofg-calc-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  align-items: stretch;
  margin: 0 0 18px;
  padding: 14px;
  background: #fffdf2;
  border: 1px solid var(--ofg-line);
  border-left: 4px solid var(--ofg-accent);
  border-radius: 4px;
}
.ofg-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  cursor: pointer;
  user-select: none;
}
.ofg-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ofg-switch-ui {
  position: relative;
  width: 48px;
  height: 26px;
  flex: 0 0 48px;
  background: #ded8bd;
  border: 1px solid #cfc6a3;
  border-radius: 999px;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.ofg-switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 1px solid #bcb392;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(17, 16, 13, 0.16);
  transition: transform 0.16s ease, border-color 0.16s ease;
}
.ofg-switch input:checked + .ofg-switch-ui {
  background: var(--ofg-accent);
  border-color: var(--ofg-ink);
}
.ofg-switch input:checked + .ofg-switch-ui::after {
  transform: translateX(22px);
  border-color: var(--ofg-ink);
}
.ofg-switch input:focus-visible + .ofg-switch-ui {
  box-shadow: 0 0 0 3px var(--ofg-accent-soft);
}
.ofg-switch-copy { display: flex; flex-direction: column; gap: 2px; }
.ofg-switch-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.ofg-switch-note { font-size: 12px; color: var(--ofg-gray); line-height: 1.35; }
.ofg-field--money { margin: 0; align-self: center; }

.ofg-row { display: grid; gap: 14px; }
.ofg-row--2 { grid-template-columns: 1fr 1fr; }
.ofg-row .ofg-field { margin-bottom: 14px; }

/* ---------- tabele repeaterów ---------- */
.ofg-tablewrap { overflow-x: auto; margin: 4px -4px 0; padding: 0 4px; }
.ofg-rep { width: 100%; border-collapse: collapse; }
.ofg-rep thead th {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ofg-gray);
  text-align: left;
  padding: 0 6px 8px;
  border-bottom: 1px solid var(--ofg-line);
  white-space: nowrap;
}
.ofg-rep thead th.c-num,
.ofg-rep thead th.c-val { text-align: right; }
.ofg-rep td { padding: 5px 6px; vertical-align: middle; }
.ofg-rep .ofg-input { padding: 7px 9px; font-size: 13.5px; }
.ofg-rep td.c-num .ofg-input,
.ofg-rep td.c-val { text-align: right; }
.c-handle { width: 30px; text-align: center; }
.c-num { width: 84px; }
.c-jm { width: 70px; }
.c-val { width: 92px; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; color: var(--ofg-ink-soft); }
.c-del { width: 30px; }

.ofg-lp { font-size: 12px; font-weight: 600; color: var(--ofg-gray); }
.ofg-grp-ico { color: var(--ofg-accent); font-weight: 800; }
.ofg-rep-row--group td { padding-top: 10px; }
.ofg-input--group { font-weight: 700; letter-spacing: 0.04em; background: #fffdf2; }

.ofg-del {
  width: 24px; height: 24px;
  line-height: 1;
  font-size: 18px;
  border: 1px solid var(--ofg-line);
  background: #fff;
  color: var(--ofg-gray);
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.ofg-del:hover { background: var(--ofg-error); border-color: var(--ofg-error); color: #fff; }

.ofg-rep-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--ofg-line);
}
.ofg-vatfield { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ofg-vatfield .ofg-label { margin-bottom: 0; }
.ofg-rep-total {
  font-size: 13px;
  color: var(--ofg-ink-soft);
  width: 100%;
  text-align: right;
  padding-top: 4px;
}
.ofg-rep-total strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.ofg-rep-total--inline { width: auto; margin-left: auto; padding-top: 0; }

/* ---------- pasek akcji ---------- */
.ofg-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, var(--ofg-bg) 70%, transparent);
  padding: 16px 4px 6px;
}
.ofg-actions-note {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 80;
  max-width: min(380px, calc(100vw - 32px));
  padding: 12px 15px;
  border: 1px solid var(--ofg-line);
  border-left: 4px solid var(--ofg-ink);
  border-radius: 4px;
  background: #fff;
  color: var(--ofg-ink-soft);
  box-shadow: 0 18px 42px -24px rgba(17, 16, 13, 0.55);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.ofg-actions-note.is-visible { opacity: 1; transform: translateY(0); }
.ofg-actions-note.is-error { border-left-color: var(--ofg-error); color: var(--ofg-error); }
.ofg-actions-note.is-success { border-left-color: var(--ofg-ok); color: var(--ofg-ok); }
.ofg-actions-note.is-info { border-left-color: var(--ofg-accent); color: var(--ofg-ink-soft); }

@media (max-width: 640px) {
  .ofg-actions-note {
    right: 16px;
    bottom: 16px;
    left: 16px;
    max-width: none;
  }
}

/* ================================================
   PODGLĄD A4
   ================================================ */
.ofg-preview-col { position: sticky; top: 92px; }
.ofg-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ofg-preview-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.ofg-preview-hint { font-size: 11px; color: var(--ofg-gray); letter-spacing: 0.06em; }
.ofg-preview-stage {
  background: #d9d4c0;
  border: 1px solid var(--ofg-line);
  border-radius: 4px;
  padding: 16px;
  max-height: calc(100vh - 130px);
  overflow: auto;
  box-shadow: inset 0 2px 14px -8px rgba(0, 0, 0, 0.4);
}
.ofg-preview-scaler {
  zoom: 0.56;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 210mm;
  margin: 0 auto;
}
.ofg-preview-scaler .offer-document { display: flex; flex-direction: column; gap: 12px; }
.ofg-preview-scaler .sheet {
  box-shadow: 0 10px 30px -16px rgba(0, 0, 0, 0.6);
  border: 0;
}

/* element renderowany do PDF — stała wysokość A4 dla czystej paginacji */
.ofg-pdf-render,
.ofg-pdf-render .offer-document,
.ofg-pdf-render .sheet {
  margin: 0 !important;
  padding: 0 !important;
}
.ofg-pdf-render {
  overflow: hidden;
  line-height: 0;
}
.ofg-pdf-render .offer-document {
  display: block !important;
  gap: 0 !important;
  width: 210mm !important;
  background: #fff;
}
.ofg-pdf-render .sheet {
  width: 210mm !important;
  height: 297mm;
  min-height: 297mm;
}

/* ---------- responsywność ---------- */
@media (max-width: 1180px) {
  .ofg-grid { grid-template-columns: 1fr; }
  .ofg-preview-col { position: static; order: -1; }
  .ofg-preview-stage { max-height: 70vh; }
  .ofg-preview-scaler { zoom: 0.62; }
}
@media (max-width: 560px) {
  .ofg-app { padding: 16px; }
  .ofg-card { padding: 18px 14px 20px; }
  .ofg-row--2 { grid-template-columns: 1fr; }
  .ofg-calc-panel { grid-template-columns: 1fr; }
  .ofg-topbar { padding: 0 14px; }
  .ofg-brand-tool { font-size: 11px; letter-spacing: 0.12em; }
  .ofg-preview-scaler { zoom: 0.4; }
}
