
  html { overscroll-behavior-y: none; } 
  * { font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important; }
  #invoice-modal { z-index: 85000 !important; }
  @media (max-width:760px) {   
  #invoice-modal .custom-modal-box {
      max-width: 920px !important;
      width: 96vw !important;
      height: 94vh !important; max-height: 94vh !important;
      display: flex; flex-direction: column;
      padding: 14px 14px 12px !important;
      border-radius: 20px; background: #ffffff;
      box-shadow: 0 10px 40px rgba(0,0,0,0.15);
      overflow: hidden !important;
    }
  }
  .inv-scroll-area {
    flex: 1; overflow-y: auto; padding-right: 6px; margin-right: -6px;
    text-align: left; font-size: 14px; color: #1f2937;
  }
  .inv-scroll-area::-webkit-scrollbar { width: 5px; }
  .inv-scroll-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
  .inv-scroll-area::-webkit-scrollbar-track { background: transparent; }
  .inv-info-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 12px;
    background: #f8fafc; padding: 18px; border-radius: 14px; border: none; margin-bottom: 16px;
  }
  .inv-info-item { display: flex; flex-direction: column; gap: 4px; }
  .inv-info-item.full-width { grid-column: 1 / -1; }
  .inv-label { font-size: 10px; color: #64748b; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
  .inv-value { font-size: 13.5px; font-weight: 700; color: #1e293b; word-break: break-word; }
  .inv-mod-sn-wrap { 
    display: inline-flex; align-items: center; background: #f1f5f9; border: 1px solid #cbd5e1; 
    border-radius: 8px; padding: 4px 10px; margin-right: 8px; margin-bottom: 8px; 
  }
  .inv-mod-sn-label { font-size: 0.7em; font-weight: 900; color: #64748b; margin-right: 6px; letter-spacing: 0.5px; }
  .inv-mod-sn-val { font-size: 0.95em; font-weight: 900; color: #0284c7; }
  .inv-box { margin-top: 12px; padding: 16px; border-radius: 12px; border: none; }
  .inv-box-sym { background: #f0f9ff; border-left: 4px solid #38bdf8; }
  .inv-box-sym .inv-box-title { color: #0284c7; }
  .inv-box-sym .inv-box-content { color: #0c4a6e; }
  .inv-box-note { background: #f1f5f9; border-left: 4px solid #94a3b8; }
  .inv-box-note .inv-box-title { color: #475569; }
  .inv-box-note .inv-box-content { color: #1e293b; }
  .inv-box-title { font-size: 11px; font-weight: 900; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
  .inv-box-content { white-space: pre-wrap; font-weight: 700; font-size: 14px; line-height: 1.6; }
  .inv-visit-header {
    display: flex; align-items: center; gap: 8px;
    margin: 16px 0 8px 0; padding: 8px 12px;
    border-radius: 8px; font-size: 11px; font-weight: 900;
    text-transform: uppercase; letter-spacing: 0.5px;
  }
  .inv-visit-header.visit-1 { background: #fef3c7; color: #92400e; border-left: 3px solid #f59e0b; }
  .inv-visit-header.visit-2 { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
  .inv-visit-header.visit-paid { background: #dcfce7; color: #14532d; border-left: 3px solid #22c55e; }
  .invoice-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-family: 'Inter', sans-serif; }
  .invoice-table th { padding: 10px 5px; border-bottom: 2px solid #1e293b; color: #0f172a; font-size: 11px; font-weight: 900; text-transform: uppercase; text-align: right; }
  .invoice-table th.col-desc { text-align: left; }
  .invoice-table th.col-qty { text-align: center; }
  .invoice-table td { padding: 12px 5px; border-bottom: 1px solid #e2e8f0; color: #475569; font-size: 13px; font-weight: 600; text-align: right; }
  .invoice-table td.col-desc { text-align: left; color: #0f172a; font-weight: 700; line-height: 1.4; }
  .invoice-table td.col-qty { text-align: center; }
  .invoice-table td.grayed { color: #94a3b8 !important; font-style: italic; }
  .invoice-summary { width: 100%; max-width: 250px; margin-left: auto; margin-top: 15px; }
  .summary-row { display: flex; justify-content: space-between; padding: 6px 5px; font-size: 13px; color: #475569; font-weight: 700; }
  .summary-row.total { font-size: 18px; font-weight: 900; color: #10b981; border-top: 2px solid #10b981; padding-top: 12px; margin-top: 6px; }
  .summary-row.prior-paid { font-size: 12px; color: #059669; font-weight: 800; background: #d1fae5; padding: 4px 8px; border-radius: 6px; margin-top: 5px; }
  .summary-row.balance-due { font-size: 15px; font-weight: 900; color: #e11d48; border-top: 2px solid #e11d48; padding-top: 10px; margin-top: 6px; }
  .inv-warranty-box { margin-top: 20px; padding: 16px; border-top: 2px dashed #cbd5e1; text-align: center; font-size: 1.15em; font-weight: 900; color: #0284c7; background: #f0f9ff; border-radius: 10px; }
  .inv-photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
  .inv-thumb { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; border: 1px solid #e2e8f0; cursor: pointer; transition: transform 0.2s; }
  .inv-thumb:active { transform: scale(0.95); }
  #inv-prev-note { font-size:11.5px; font-weight:700; color:#b45309; }
  .inv-frame-wrap { flex:1; min-height:0; position:relative; border:1px solid #e2e8f0; border-radius:12px; overflow:hidden; background:#f1f5f9; display:flex; flex-direction:column; }
  #inv-frame { flex:1; width:100%; border:none; background:#f1f5f9; display:none; }
  #inv-frame-loading { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#64748b; font-weight:800; font-size:14px; }
  .inv-frame-wrap #invoice-content { padding:14px; background:#fff; }
  #pdf-review { display:none; position:fixed; inset:0; z-index:86500; background:rgba(15,23,42,0.88); align-items:center; justify-content:center; padding:12px; }
  #pdf-review .pr-box { background:#0f172a; width:100%; max-width:1600px; height:100%; border-radius:18px; display:flex; flex-direction:column; overflow:hidden; box-shadow:0 30px 80px rgba(0,0,0,0.5); }
  #pdf-review .pr-head { display:flex; align-items:center; gap:10px; padding:12px 16px; color:#e2e8f0; font-size:14px; border-bottom:1px solid rgba(255,255,255,0.08); }
  #pdf-review .pr-head span { color:#94a3b8; font-size:12px; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #pdf-review .pr-x { background:none; border:none; color:#94a3b8; font-size:26px; cursor:pointer; line-height:1; }
  #pdf-review .pr-stage { flex:1; min-height:0; overflow:auto; display:block; text-align:center; padding:20px; background:#1e293b; position:relative; -webkit-overflow-scrolling:touch; }
  #pdf-review .pr-page { display:none; margin:0 auto; background:#fff; box-shadow:0 10px 30px rgba(0,0,0,0.45); border-radius:2px; overflow:hidden; position:relative; }
  #pdf-review #pr-frame { border:0; width:816px; height:1056px; transform-origin:0 0; display:block; background:#fff; pointer-events:none; }   
  #pdf-review .pr-stage { scrollbar-color:rgba(255,255,255,0.28) transparent; }
  #pdf-review .pr-stage::-webkit-scrollbar-thumb { background:rgba(255,255,255,0.28); background-clip:content-box; }
  #pdf-review .pr-zoom { display:flex; align-items:center; gap:4px; background:rgba(255,255,255,0.06); border-radius:20px; padding:3px; }
  #pdf-review .pr-zoom button { height:32px; min-width:32px; padding:0 12px; border:none; border-radius:16px; background:transparent; color:#e2e8f0; font-size:13px; font-weight:700; cursor:pointer; }
  #pdf-review .pr-zoom button:hover { background:rgba(255,255,255,0.12); }
  #pdf-review .pr-zoom button.on { background:#e2e8f0; color:#0f172a; }
  #pdf-review .pr-zoom .pct { min-width:52px; text-align:center; font-size:12.5px; font-weight:700; color:#cbd5e1; font-variant-numeric:tabular-nums; }
  #pdf-review .pr-loading { position:absolute; inset:0; display:flex; flex-direction:column; gap:12px; align-items:center; justify-content:center; color:#cbd5e1; font-weight:800; font-size:14px; }
  #pdf-review .pr-spin { width:34px; height:34px; border:3px solid rgba(255,255,255,0.15); border-top-color:#38bdf8; border-radius:50%; animation:prspin 0.9s linear infinite; }
  @keyframes prspin { to { transform:rotate(360deg); } }
  #pdf-review .pr-foot { display:flex; gap:8px; padding:12px 16px; border-top:1px solid rgba(255,255,255,0.08); }
  #pdf-review .pr-btn { flex:1; padding:12px 8px; border-radius:10px; border:none; font-weight:800; font-size:13.5px; cursor:pointer; background:#334155; color:#fff; }
  #pdf-review .pr-btn.pri { background:#dc2626; }
  #pdf-review .pr-btn:disabled { opacity:0.5; cursor:default; }
  @media (max-width:640px) { #pdf-review { padding:0; } #pdf-review .pr-box { width:100vw; height:100vh; height: 100dvh; border-radius:0; } #pdf-review .pr-stage { padding:8px; } #pdf-review .pr-btn { font-size:12px; } #pdf-review .pr-zoom .hide-m { display:none; } }
  @media (max-width: 640px) {
    #invoice-modal.custom-modal-overlay { padding:0 !important; }
    #invoice-modal .custom-modal-box { width:100vw !important; height:100vh !important; height: 100dvh !important; max-height:100vh !important; max-height: 100dvh !important; border-radius:0 !important; padding:10px 8px max(10px, env(safe-area-inset-bottom)) !important; }
  }
  .custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center;
    padding: 20px; overflow-y: auto; z-index: 85000;
  }
  .custom-modal-overlay.active { display: flex; }
