/* Self-hosted cursive fallback for the electronic signature.
   Primary is the system font 'Brush Script MT' (unchanged from the original);
   this only renders on devices that lack it, so signatures look consistent
   cross-platform without any third-party font origin. See fonts/samg-signature-OFL.txt. */
@font-face {
  font-family: 'SAMG Signature';
  src: url('../fonts/samg-signature.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', sans-serif; background: #F5F2ED; color: #333; }
.app-header { background: #3A3A3A; color: white; padding: 20px 32px; }
.app-header h1 { font-size: 20px; letter-spacing: 0.5px; }
.app-header .sub { font-size: 11px; opacity: 0.5; margin-top: 2px; }
.form-wrap { max-width: 780px; margin: 24px auto; padding: 0 20px; }
.sec { background: white; border-radius: 8px; padding: 22px; margin-bottom: 16px; border: 1px solid #e8e5df; }
.sec-title { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.sec-title .bar { width: 4px; height: 18px; background: #B5A17C; border-radius: 2px; flex-shrink: 0; }
.sec-title h2 { font-size: 15px; font-weight: 700; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field label { display: block; font-size: 11px; font-weight: 600; color: #666; margin-bottom: 4px; }
.field input, .field select { width: 100%; padding: 9px 10px; border: 1px solid #ddd; border-radius: 5px; font-size: 13px; outline: none; }
.field input:focus, .field select:focus { border-color: #B5A17C; box-shadow: 0 0 0 2px rgba(181,161,124,0.15); }
.prop-btns { display: flex; gap: 10px; margin-bottom: 6px; }
.prop-btn { flex: 1; padding: 14px 8px; border: 2px solid #ddd; border-radius: 8px; background: white; cursor: pointer; text-align: center; font-size: 13px; font-weight: 500; color: #3A3A3A; transition: all 0.15s; }
.prop-btn.active { border-color: #B5A17C; background: #F5F1EB; font-weight: 700; }
.prop-btn img { display: block; width: 100%; height: 55px; object-fit: cover; border-radius: 4px; margin-bottom: 6px; }
.calc-box { margin-top: 16px; padding: 14px 16px; background: #F5F1EB; border-radius: 6px; border-left: 4px solid #B5A17C; }
.calc-box .cl { font-size: 11px; font-weight: 700; color: #3A3A3A; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.calc-vals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; font-size: 13px; }
.calc-vals .s { color: #888; }
.calc-psf { font-size: 12px; color: #888; margin-top: 4px; }
.gen-btn { width: 100%; padding: 16px; background: #3A3A3A; color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: 700; cursor: pointer; letter-spacing: 0.5px; margin-top: 8px; }
.gen-btn:hover { background: #4A4A4A; }
#custom-fields { display: none; }
#custom-fields.show { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
#custom-unit-field { display: none; }
#custom-unit-field.show { display: block; }
#template-unit-field { display: block; }
#template-unit-field.hide { display: none; }

/* PREVIEW */
.pv-bar { position: sticky; top: 0; z-index: 100; background: #3A3A3A; padding: 12px 24px; display: flex; gap: 12px; align-items: center; }
.pv-bar button { padding: 8px 20px; border-radius: 6px; cursor: pointer; font-size: 13px; border: none; }
.pv-bar .back { background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); }
.pv-bar .print { background: #B5A17C; color: white; font-weight: 700; }
.pv-bar .hint { color: rgba(255,255,255,0.4); font-size: 12px; margin-left: auto; }
.page { width: 8.5in; min-height: 11in; margin: 20px auto; background: white; box-shadow: 0 2px 20px rgba(0,0,0,0.1); position: relative; overflow: hidden; }

@media (max-width: 600px) {
  .page { width: 100% !important; min-height: auto !important; padding-bottom: 20px !important; box-shadow: none !important; margin: 8px auto !important; }
  .page div[style*="48px"] { padding-left: 16px !important; padding-right: 16px !important; }
  .page div[style*="240px"] { height: 180px !important; }
  .page div[style*="34px"] { font-size: 22px !important; }
  .page div[style*="14px;color:#B5A17C"] { font-size: 11px !important; }
  .pv-bar { flex-wrap: wrap; padding: 10px 12px !important; gap: 8px !important; }
  .pv-bar .hint { display: none; }
  .pv-bar button { font-size: 12px !important; padding: 8px 14px !important; flex: 1; min-width: 0; }
  .sig-section { flex-direction: column !important; gap: 20px !important; }
  .sig-section > div { width: 100% !important; }
  .page table { font-size: 7px !important; }
  .page table th, .page table td { padding: 4px 5px !important; }
  .page div[style*="display:flex;gap:40px"] { flex-direction: column !important; gap: 12px !important; }
  .page div[style*="position:absolute;bottom"] { position: relative !important; margin-top: 20px !important; }
  .page div[style*="display:flex;padding:7px 12px"] { flex-direction: column !important; }
  .page div[style*="width:130px"] { width: auto !important; }
  .page div[style*="float:right;width:180px"] { float: none !important; width: 100% !important; height: auto !important; margin: 0 0 12px 0 !important; }
  .grid { grid-template-columns: 1fr !important; }
  .form-wrap { padding: 0 10px !important; }
  .sec { padding: 16px !important; }
  .tenant-sign-card { padding: 20px 16px !important; }
  .tenant-sign-card button { width: 100% !important; padding: 16px !important; font-size: 16px !important; }
}
@media print {
  .no-print { display: none !important; }
  body { background: white; }
  .page { margin: 0 !important; box-shadow: none !important; page-break-after: always; }
  .page:last-child { page-break-after: avoid; }
  #tenant-print-name, #tenant-title { border: none !important; padding: 0 !important; }
  #tenant-sig-check { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #sig-check-label { border: none !important; padding: 0 !important; background: transparent !important; }
}
@page { margin: 0; size: letter; }
