/* [TFH-607:TFH_ENVELOPE_PRINTING:CSS-START] */
.tfh-envelope-screen {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto;
  overflow: hidden;
  background:
    radial-gradient(circle at 90% 10%,rgba(216,181,110,.13),transparent 26%),
    linear-gradient(135deg,#edf3f8,#f9fbfc);
}

.tfh-envelope-header {
  min-height: 108px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 16px 24px;
  color: #fff;
  background:
    radial-gradient(circle at 100% 0%,rgba(216,181,110,.18),transparent 30%),
    linear-gradient(145deg,#071a31,#153f68);
  box-shadow: 0 8px 24px rgba(5,22,43,.2);
}

.tfh-envelope-header > div:nth-child(2) > span,
.tfh-envelope-preview-head span,
.tfh-envelope-control-head > span {
  color: #d8b56e;
  font-size: .67rem;
  font-weight: 900;
  letter-spacing: .16em;
}

.tfh-envelope-header h1 {
  margin: 3px 0 2px;
  font-size: 1.6rem;
}

.tfh-envelope-header p {
  margin: 0;
  color: rgba(255,255,255,.72);
  font-size: .82rem;
}

.tfh-envelope-company-chip {
  min-width: 235px;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  text-align: right;
  background: rgba(255,255,255,.07);
}

.tfh-envelope-company-chip small {
  display: block;
  color: rgba(255,255,255,.62);
  font-size: .66rem;
}

.tfh-envelope-company-chip strong {
  display: block;
  margin-top: 3px;
  color: #fff;
}

.tfh-envelope-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px,360px) minmax(0,1fr);
  gap: 16px;
  padding: 16px 20px;
  overflow: hidden;
}

.tfh-envelope-control-card,
.tfh-envelope-preview-card {
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(17,49,84,.15);
  border-radius: 17px;
  background: rgba(255,255,255,.97);
  box-shadow: 0 14px 34px rgba(10,35,61,.12);
}

.tfh-envelope-control-card {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 18px;
  overflow-y: auto;
}

.tfh-envelope-control-head h2,
.tfh-envelope-preview-head h2 {
  margin: 3px 0 4px;
  color: #102b4d;
  font-size: 1.17rem;
}

.tfh-envelope-control-head p {
  margin: 0;
  color: #647386;
  font-size: .8rem;
  line-height: 1.45;
}

.tfh-envelope-field {
  display: grid;
  gap: 6px;
}

.tfh-envelope-field > span {
  color: #334a61;
  font-size: .73rem;
  font-weight: 800;
}

.tfh-envelope-field input,
.tfh-envelope-field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #bac6d1;
  border-radius: 10px;
  color: #132236;
  background: #fff;
}

.tfh-envelope-client-shell {
  position: relative;
}

.tfh-envelope-client-suggestions {
  position: absolute;
  z-index: 25000;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 300px;
  overflow: auto;
  border: 1px solid #aebdcb;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 20px 48px rgba(4,16,31,.26);
}

.tfh-envelope-client-suggestions button {
  width: 100%;
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border: 0;
  border-bottom: 1px solid #e4e9ee;
  text-align: left;
  background: #fff;
  cursor: pointer;
}

.tfh-envelope-client-suggestions button:hover {
  background: #edf5fb;
}

.tfh-envelope-client-suggestions strong {
  color: #172b41;
}

.tfh-envelope-client-suggestions span {
  color: #68798a;
  font-size: .72rem;
}

.tfh-envelope-guide {
  margin-top: auto;
  padding: 13px;
  border: 1px solid #d7c69f;
  border-radius: 12px;
  background: #fff9e9;
}

.tfh-envelope-guide strong {
  color: #74520f;
  font-size: .78rem;
}

.tfh-envelope-guide p {
  margin: 5px 0 0;
  color: #765f31;
  font-size: .74rem;
  line-height: 1.42;
}

.tfh-envelope-preview-card {
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
}

.tfh-envelope-preview-head {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 15px;
  color: #fff;
  background: linear-gradient(#6f879b,#334d63);
}

.tfh-envelope-preview-head h2 {
  color: #fff;
}

.tfh-envelope-preview-head em {
  color: rgba(255,255,255,.72);
  font-size: .72rem;
}

.tfh-envelope-stage {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background:
    linear-gradient(45deg,#e9edf1 25%,transparent 25%),
    linear-gradient(-45deg,#e9edf1 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#e9edf1 75%),
    linear-gradient(-45deg,transparent 75%,#e9edf1 75%);
  background-size: 24px 24px;
  background-position: 0 0,0 12px,12px -12px,-12px 0;
}

.tfh-envelope-paper {
  position: relative;
  width: min(950px,100%);
  aspect-ratio: 9.5 / 4.125;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid #c6c6c6;
  background: #fff;
  box-shadow: 0 18px 45px rgba(0,0,0,.22);
}

.tfh-envelope-paper[data-envelope-size="dl"] {
  aspect-ratio: 220 / 110;
}

.tfh-envelope-return-address {
  position: absolute;
  top: 8%;
  left: 5%;
  width: 39%;
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: 11px;
  align-items: start;
  color: #111;
  font-size: clamp(8px,1vw,13px);
  line-height: 1.25;
}

.tfh-envelope-return-address img {
  width: clamp(55px,8vw,105px);
  height: clamp(38px,5.5vw,68px);
  object-fit: contain;
  object-position: left top;
}

.tfh-envelope-return-address strong {
  display: block;
  margin-bottom: 2px;
  font-size: 1.12em;
}

.tfh-envelope-return-address p,
.tfh-envelope-recipient p {
  margin: 0;
  white-space: pre-line;
}

.tfh-envelope-return-address small {
  display: block;
  margin-top: 2px;
  font-size: .86em;
}

.tfh-envelope-recipient {
  position: absolute;
  left: 39%;
  top: 42%;
  width: 53%;
  color: #111;
  font-family: "Times New Roman",serif;
  font-size: clamp(12px,1.55vw,22px);
  line-height: 1.3;
}

.tfh-envelope-recipient strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1.15em;
}

.tfh-envelope-recipient em:empty,
.tfh-envelope-recipient small:empty {
  display: none;
}

.tfh-envelope-recipient em {
  display: block;
  margin-bottom: 3px;
}

.tfh-envelope-recipient small {
  display: block;
  margin-top: 4px;
  font-size: .78em;
}

.tfh-envelope-footer {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 10px 22px;
  border-top: 1px solid rgba(17,49,84,.16);
  background: linear-gradient(#fbfcfd,#e7edf2);
}

.tfh-envelope-footer > div {
  display: flex;
  gap: 10px;
}

.tfh-envelope-print-frame {
  position: fixed;
  left: -10000px;
  top: -10000px;
  width: 1px;
  height: 1px;
  border: 0;
}

@media (max-width: 950px) {
  .tfh-envelope-screen {
    overflow: auto;
  }

  .tfh-envelope-header {
    grid-template-columns: auto minmax(0,1fr);
  }

  .tfh-envelope-company-chip {
    grid-column: 1 / -1;
    text-align: left;
  }

  .tfh-envelope-body {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .tfh-envelope-preview-card {
    min-height: 520px;
  }
}

@media (max-width: 620px) {
  .tfh-envelope-header {
    padding: 14px;
  }

  .tfh-envelope-body {
    padding: 12px;
  }

  .tfh-envelope-paper {
    min-width: 720px;
  }

  .tfh-envelope-stage {
    place-items: start;
  }

  .tfh-envelope-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .tfh-envelope-footer > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
/* [TFH-607:TFH_ENVELOPE_PRINTING:CSS-END] */
/* [TFH-607:TFH_ENVELOPE_PRINTING:CSS-EDITABLE-FIELDS-START] */
/*
  2026-09-25: editable envelope fields.
  Recipient and Return Address groups, "Print return address" / "Print logo" switches,
  slightly wider control panel (it scrolls on short screens).
*/
#tfhEnvelopePrintingScreen .tfh-envelope-body {
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
}

#tfhEnvelopePrintingScreen .tfh-envelope-control-card {
  gap: 12px;
}

#tfhEnvelopePrintingScreen .tfh-envelope-field > span small,
#tfhEnvelopePrintingScreen .tfh-envelope-group legend small {
  color: #6b7c8d;
  font-weight: 600;
}

#tfhEnvelopePrintingScreen .tfh-envelope-field input,
#tfhEnvelopePrintingScreen .tfh-envelope-field select {
  min-height: 38px;
  padding: 7px 10px;
  font-size: .9rem;
}

#tfhEnvelopePrintingScreen .tfh-envelope-field textarea {
  width: 100%;
  min-height: 64px;
  padding: 8px 10px;
  border: 1px solid #bac6d1;
  border-radius: 10px;
  color: #132236;
  font-family: inherit;
  font-size: .9rem;
  line-height: 1.35;
  background: #fff;
  resize: vertical;
}

#tfhEnvelopePrintingScreen .tfh-envelope-field input:focus,
#tfhEnvelopePrintingScreen .tfh-envelope-field select:focus,
#tfhEnvelopePrintingScreen .tfh-envelope-field textarea:focus {
  outline: none;
  border-color: #2f6a9a;
  box-shadow: 0 0 0 3px rgba(47,106,154,.16);
}

#tfhEnvelopePrintingScreen .tfh-envelope-group {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px 12px 13px;
  border: 1px solid #d3dde6;
  border-radius: 12px;
  background: #f8fafc;
}

#tfhEnvelopePrintingScreen .tfh-envelope-group legend {
  padding: 0 6px;
  color: #0f2c47;
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

#tfhEnvelopePrintingScreen .tfh-envelope-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

#tfhEnvelopePrintingScreen .tfh-envelope-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #1f3448;
  font-size: .84rem;
  font-weight: 700;
  cursor: pointer;
}

#tfhEnvelopePrintingScreen .tfh-envelope-switch input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #1d5f9f;
  cursor: pointer;
}

#tfhEnvelopePrintingScreen .tfh-envelope-switch.is-disabled {
  opacity: .5;
  cursor: not-allowed;
}

#tfhEnvelopePrintingScreen .tfh-envelope-return-fields {
  display: grid;
  gap: 10px;
  transition: opacity .15s ease;
}

/* Return address switched off: fields stay editable but are shown as not printing */
#tfhEnvelopePrintingScreen .tfh-envelope-return-fields.is-off {
  opacity: .45;
}

#tfhEnvelopePrintingScreen .tfh-envelope-reload {
  justify-self: start;
  min-height: 32px;
  padding: 0 12px;
  font-size: .8rem;
}

/* Preview: empty recipient name shown as a grey hint (never printed) */
#tfhEnvelopePrintingScreen #tfhEnvelopeRecipientTitle.is-placeholder {
  color: #9aa7b4;
}

#tfhEnvelopePrintingScreen .tfh-envelope-return-address.is-hidden {
  display: none;
}

@media (max-width: 950px) {
  #tfhEnvelopePrintingScreen .tfh-envelope-body {
    grid-template-columns: 1fr;
  }
}
/* [TFH-607:TFH_ENVELOPE_PRINTING:CSS-EDITABLE-FIELDS-END] */
