:root{
  --ink:#111827;--muted:#64748b;--line:#dbe3ee;--panel:#ffffff;
  --brand:#0f2747;--brand2:#1e4f82;--soft:#eef4fa;--danger:#b42318;
}
*{box-sizing:border-box}
html,body{margin:0;background:#f4f7fb;color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans TC","PingFang TC","Microsoft JhengHei",sans-serif}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
.topbar{position:sticky;top:0;z-index:20;background:#fff;border-bottom:1px solid var(--line);
  display:flex;align-items:center;justify-content:space-between;padding:14px 24px}
.brand{display:flex;gap:12px;align-items:center;font-weight:800;font-size:20px}
.brand-badge{width:38px;height:38px;border-radius:12px;background:var(--brand);color:#fff;display:grid;place-items:center}
.status{font-size:13px;color:var(--muted)}
.wrap{max-width:1600px;margin:auto;padding:22px}
.grid{display:grid;grid-template-columns:minmax(400px,520px) minmax(560px,1fr);gap:22px;align-items:start}
.panel{background:#fff;border:1px solid var(--line);border-radius:18px;box-shadow:0 8px 30px rgba(15,39,71,.06)}
.panel-head{padding:18px 20px;border-bottom:1px solid var(--line)}
.panel-head h2{margin:0 0 5px;font-size:21px}
.panel-head p{margin:0;color:var(--muted);font-size:14px}
.form-body{padding:18px 20px}
.section{border:1px solid var(--line);border-radius:14px;margin-bottom:14px;overflow:hidden}
.section summary{list-style:none;font-weight:800;padding:14px 16px;background:#f8fafc;cursor:pointer}
.section summary::-webkit-details-marker{display:none}
.section .inside{padding:15px}
.row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.field{margin-bottom:12px}
label{display:block;font-size:13px;font-weight:700;margin-bottom:6px}
input,textarea,select{width:100%;border:1px solid #cbd5e1;border-radius:10px;padding:10px 11px;background:#fff;color:#111827}
textarea{min-height:110px;resize:vertical;line-height:1.65}
.hint{font-size:12px;color:var(--muted);line-height:1.55}
.actions{display:flex;gap:9px;flex-wrap:wrap}
.btn{border:1px solid #b8c5d4;background:#fff;color:var(--ink);padding:10px 14px;border-radius:10px;font-weight:750}
.btn:hover{background:#f8fafc}
.btn.primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn.soft{background:var(--soft);border-color:#c9d9ea;color:#15385d}
.btn.danger{color:var(--danger);border-color:#efc2bd}
.recipient{border:1px solid var(--line);border-radius:12px;padding:12px;margin-bottom:10px;background:#fbfdff}
.recipient-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:9px}
.recipient-title{font-weight:800}
.badge{font-size:12px;background:#e8f0f8;border-radius:999px;padding:4px 8px;color:#20466d}
.notice{border-left:4px solid #2563eb;background:#eff6ff;padding:11px 12px;border-radius:8px;font-size:13px;line-height:1.55}
.preview-tools{display:flex;gap:10px;flex-wrap:wrap;padding:14px 18px;border-bottom:1px solid var(--line);align-items:center}
.preview-tools select{width:auto;min-width:170px}
.preview-stage{padding:22px;background:#eaf0f7;max-height:calc(100vh - 195px);overflow:auto}
.sheet-wrap{display:flex;justify-content:center;margin:0 auto 22px}
.sheet{
  position:relative;width:210mm;height:297mm;background:#fff;box-shadow:0 12px 35px rgba(15,23,42,.18);
  overflow:hidden;flex:0 0 auto;
}
.sheet-bg{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:0}
.overlay{position:absolute;z-index:2;color:#000}
.meta-box{left:10.6%;top:11.2%;width:20.5%;height:11.5%;display:flex;flex-direction:column;justify-content:center;align-items:center;
  font-family:"Noto Serif TC","PMingLiU","Songti TC",serif;font-size:12pt;line-height:1.7;text-align:center}
.copy-mark{font-weight:800;font-size:15pt;letter-spacing:.15em}
.header-value{font-family:"Noto Serif TC","PMingLiU","Songti TC",serif;font-size:11.5pt;white-space:nowrap;overflow:hidden;text-overflow:clip}
.sender-name{left:56.7%;top:10.4%;width:30%}
.sender-address{left:56.7%;top:13.2%;width:30%}
.recipient-name{left:56.7%;top:15.9%;width:30%}
.recipient-address{left:56.7%;top:18.7%;width:30%}
.page-note{left:12%;top:70.6%;font-size:9.5pt;background:#fff;padding:1px 3px}
.char-cell{
  position:absolute;z-index:3;display:flex;align-items:center;justify-content:center;
  font-family:"Noto Serif TC","PMingLiU","Songti TC",serif;font-size:18pt;line-height:1;
}
.screen-page-label{position:absolute;right:10px;top:8px;z-index:5;background:rgba(15,39,71,.9);color:#fff;
  border-radius:999px;padding:5px 9px;font-size:12px}
.empty{padding:50px;text-align:center;color:var(--muted)}
.footer-note{padding:14px 18px;color:var(--muted);font-size:12px;border-top:1px solid var(--line)}
.modal{position:fixed;inset:0;background:rgba(15,23,42,.55);display:none;align-items:center;justify-content:center;z-index:50;padding:20px}
.modal.open{display:flex}.modal-card{max-width:680px;background:#fff;border-radius:16px;padding:22px;box-shadow:0 20px 60px rgba(0,0,0,.25)}
.modal-card h3{margin-top:0}.modal-card ol{line-height:1.8}
@media (max-width:1080px){
  .grid{grid-template-columns:1fr}
  .preview-stage{max-height:none}
}
@media print{
  @page{size:A4 portrait;margin:0}
  html,body{background:#fff!important}
  .topbar,.form-panel,.preview-tools,.footer-note,.screen-page-label,.modal{display:none!important}
  .wrap,.grid,.panel,.preview-stage{display:block!important;margin:0!important;padding:0!important;border:0!important;box-shadow:none!important;background:#fff!important;max-width:none!important;overflow:visible!important}
  .preview-panel{border:0!important}
  .sheet-wrap{display:block!important;margin:0!important;padding:0!important;page-break-after:always;break-after:page}
  .sheet-wrap:last-child{page-break-after:auto;break-after:auto}
  .sheet{width:210mm!important;height:297mm!important;box-shadow:none!important;margin:0!important}
}

/* 好房新視界® 品牌與安全強化版 */
.brand-lockup{display:flex;align-items:center;gap:12px;min-width:0}
.brand-mark{width:54px;height:48px;object-fit:contain;flex:0 0 auto}
.brand-copy{display:flex;flex-direction:column;line-height:1.15;min-width:0}
.brand-copy strong{font-size:20px;letter-spacing:.02em}
.brand-copy small{font-size:12px;color:#53657a;margin-top:4px;font-weight:750}
.security-summary{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.security-pill{display:inline-flex;align-items:center;gap:6px;padding:6px 9px;border:1px solid #c8d7e7;border-radius:999px;background:#f7fbff;color:#244866;font-size:12px;font-weight:750}
.security-pill::before{content:"✓";display:inline-grid;place-items:center;width:17px;height:17px;border-radius:50%;background:#16834a;color:#fff;font-size:11px}
.brand-banner{margin:0 0 18px;border:1px solid #d6e2ee;border-radius:16px;background:linear-gradient(135deg,#fff 0%,#f5faff 100%);padding:14px 18px;display:flex;align-items:center;justify-content:space-between;gap:16px}
.brand-banner-text strong{display:block;font-size:16px;margin-bottom:5px}
.brand-banner-text span{font-size:13px;color:var(--muted);line-height:1.55}
.site-footer{max-width:1600px;margin:0 auto 30px;padding:18px 22px}
.footer-card{border:1px solid var(--line);border-radius:16px;background:#fff;padding:18px;display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:18px;box-shadow:0 8px 30px rgba(15,39,71,.05)}
.footer-logo{width:112px;height:auto}
.footer-copy strong{display:block;font-size:16px;margin-bottom:6px}
.footer-copy p{margin:0;color:var(--muted);font-size:12px;line-height:1.6}
.footer-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.security-list{padding-left:20px;line-height:1.85}
.security-list code{background:#f1f5f9;padding:2px 5px;border-radius:5px}
.privacy-warning{border:1px solid #f0d38b;background:#fff9e8;border-radius:10px;padding:11px 12px;font-size:13px;line-height:1.6;margin-top:12px}
.btn.security{border-color:#94b5d3;color:#173d62;background:#f4f9fd}
.btn.security:hover{background:#eaf4fb}
@media(max-width:760px){
  .topbar{align-items:flex-start;gap:12px}
  .security-summary{justify-content:flex-start}
  .brand-mark{width:46px;height:42px}
  .brand-copy strong{font-size:17px}
  .footer-card{grid-template-columns:1fr;text-align:center}
  .footer-logo{margin:auto}
  .footer-actions{justify-content:center}
  .brand-banner{align-items:flex-start;flex-direction:column}
}
@media print{
  .site-footer,.brand-banner{display:none!important}
}
