/* TanyaIzin document workspace V3.2 — Vandara-style editor + live A4 preview */
#invoices,#quotations{
  --doc-purple:#6f2be8;--doc-purple-dark:#5420bf;--doc-purple-soft:#f3edff;
  --doc-border:#e3e6ef;--doc-bg:#f5f7fb;--doc-text:#171c2b;--doc-muted:#65718a;
}
#invoices input,#invoices select,#invoices textarea,#quotations input,#quotations select,#quotations textarea{
  box-sizing:border-box;width:100%;border:1px solid #d8ddea;border-radius:10px;background:#fff;
  padding:9px 11px;font:inherit;color:var(--doc-text);outline:none;transition:border-color .16s,box-shadow .16s;background:.16s;
}
#invoices input,#invoices select,#quotations input,#quotations select{min-height:40px}
#invoices textarea,#quotations textarea{resize:vertical;line-height:1.4}
#invoices input:focus,#invoices select:focus,#invoices textarea:focus,#quotations input:focus,#quotations select:focus,#quotations textarea:focus{
  border-color:#8c65ed;box-shadow:0 0 0 3px rgba(111,43,232,.10)
}
#invoices label,#quotations label{display:flex;flex-direction:column;gap:6px;font-size:11px;font-weight:800;color:#5f6d87;letter-spacing:.025em}

.ti-vbs-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin:0 0 12px}
.ti-vbs-heading h2{margin:2px 0 4px;font-size:22px;line-height:1.1}.ti-vbs-heading p{margin:0;color:var(--doc-muted);font-size:12px}
.ti-vbs-kicker{font-size:9px;font-weight:900;letter-spacing:.18em;color:var(--doc-purple)}
.ti-head-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}

.ti-vbs-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px;padding:0}
.ti-vbs-toolbar-left,.ti-vbs-toolbar-right{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.ti-tab,.ti-export-btn{border:1px solid #dddfe8;background:#fff;color:#1f2433;border-radius:10px;padding:9px 13px;font-weight:800;font-size:12px;cursor:pointer}
.ti-tab.active{background:#282235;border-color:#282235;color:#fff}.ti-tab.danger-soft{border-color:#ef9ca7;color:#b42332;background:#fff7f8}.ti-tab:hover,.ti-export-btn:hover{transform:translateY(-1px)}
.ti-export-btn.pdf{border-color:#ef8b96;color:#d61f36;background:#fff}

#invoices .ti-doc-layout,#quotations .ti-doc-layout{display:grid;grid-template-columns:minmax(0,1.42fr) minmax(500px,1fr);gap:15px;align-items:start}
#invoices .ti-doc-editor,#quotations .ti-doc-editor{min-width:0}
#invoices .ti-editor-card,#quotations .ti-editor-card{padding:15px 16px;margin:0 0 12px;border-radius:14px;box-shadow:0 5px 18px rgba(34,44,74,.045);border:1px solid #e3e6ef;background:#fff}
#invoices .ti-editor-card h3,#quotations .ti-editor-card h3{margin:0 0 12px;font-size:15px;color:#191f2d}
.ti-editor-card .card-headline{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:12px}.ti-editor-card .card-headline h3{margin:0}.ti-editor-card .card-headline p{margin:5px 0 0}
.ti-compact-card{display:flex!important;align-items:flex-end!important;gap:10px!important;flex-wrap:wrap}.ti-history-main{flex:1;min-width:260px}.ti-history-main label{width:100%}.ti-history-main .small{display:block;margin-top:5px}
.ti-card-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:10px}.ti-card-row h3{margin-bottom:3px!important}.ti-card-row p{margin:0}
.ti-helpbox{display:block;margin:0;background:var(--doc-purple-soft);color:#4e3d72;border-radius:9px;padding:9px 11px;font-size:11px;font-weight:600;line-height:1.45}
.ti-inline-hint{margin:10px 0 0}
.ti-doc-build{font-size:9px;font-weight:900;letter-spacing:.08em;color:#fff;background:var(--doc-purple);padding:5px 8px;border-radius:999px;white-space:nowrap}
#invoices .form-grid,#quotations .form-grid{gap:10px 12px}

.inv-table-scroll{overflow:auto;border:1px solid #e3e6ef;border-radius:10px;background:#fff}
.inv-edit-table{min-width:790px!important;width:100%!important;border-collapse:collapse!important;table-layout:fixed!important;margin:0!important}
.inv-edit-table thead th{background:#faf9fd;border-bottom:1px solid #e2e5ee;padding:9px 8px!important;font-size:9px!important;letter-spacing:.04em;color:#5f6c82;text-transform:uppercase;text-align:left}
.inv-edit-table tbody td{padding:8px!important;border-bottom:1px solid #edf0f5;vertical-align:top}.inv-edit-table tbody tr:last-child td{border-bottom:0}
#invoices .inv-edit-table input,#invoices .inv-edit-table textarea,#quotations .inv-edit-table input,#quotations .inv-edit-table textarea{border-radius:8px;padding:8px 9px;font-size:12px;color:#172038;font-weight:500;background:#fff}
.inv-edit-table th:first-child{width:35%!important}.inv-edit-table th:nth-child(2){width:13%!important}.inv-edit-table th:nth-child(3){width:9%!important}.inv-edit-table th:nth-child(4){width:18%!important}.inv-edit-table th:nth-child(5){width:16%!important}.inv-edit-table th:nth-child(6){width:9%!important}
.inv-totals{display:flex;justify-content:flex-end;gap:20px;flex-wrap:wrap;margin:14px 0 0;padding-top:12px;border-top:1px solid #edf0f5}.inv-totals span{display:flex;flex-direction:column;gap:4px;font-size:12px;color:#47536a}.inv-totals b{font-size:14px;color:#151a28}.inv-due b,.inv-due{color:#334fd6!important}
#inv-summary p,#qtn-summary p{margin:12px 0 0;font-size:12px}
.ti-save-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding:2px 0 18px}.ti-save-big{padding:11px 16px!important}

#invoices .ti-preview-wrap,#quotations .ti-preview-wrap{min-width:0;position:sticky;top:84px;align-self:start;border:1px solid #dfe3ec;border-radius:14px;overflow:hidden;background:#fff;box-shadow:0 10px 26px rgba(32,42,70,.08)}
.ti-preview-head{display:flex;align-items:center;gap:10px;justify-content:space-between;padding:11px 12px;background:#fff;border-bottom:1px solid #e4e7ee;min-height:52px}
.ti-preview-head b{font-size:11px;letter-spacing:.055em}.ti-preview-head .small{margin-top:3px}.ti-preview-head-actions{display:flex;gap:7px;flex-wrap:wrap;justify-content:flex-end}
.ti-template-link{text-decoration:none!important;color:#4e3d72!important;border-color:#d7c9fb!important;background:#fbf9ff!important}
.ti-preview-note{margin:8px 10px 0;padding:8px 10px;border:1px solid #d8c6ff;border-radius:8px;background:#f4edff;color:#654aa0;font-size:9px;letter-spacing:.02em}
.ti-live-stage{background:#eef1f6;overflow:auto;max-height:calc(100vh - 210px);min-height:600px;padding:10px;text-align:center;scrollbar-gutter:stable}
.ti-live-pages{width:max-content;min-width:0;margin:0 auto;transform-origin:top center}
.ti-live-empty,.ti-live-error{display:flex;align-items:center;justify-content:center;min-height:500px;text-align:center;padding:26px;color:#64748b;font-size:13px}.ti-live-error{color:#a61b1b}
.ti-preview-hidden .ti-preview-wrap{display:none!important}.ti-preview-hidden{grid-template-columns:minmax(0,1fr)!important}

/* Penawaran A4 */
.ti-quote-sheet{width:210mm;min-height:297mm;box-sizing:border-box;padding:13mm 14mm 14mm;margin:0 auto 16px;background:#fff;color:#111;position:relative;box-shadow:0 2px 12px #0002;font-family:Calibri,Arial,sans-serif;font-size:11px;line-height:1.35;text-align:left}
.ti-quote-header{display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:start}.ti-quote-logo{width:90px;height:auto;display:block;margin-bottom:8px}.ti-quote-brand{font-size:9px;line-height:1.35}.ti-quote-meta{text-align:right;font-size:10px;line-height:1.45}.ti-quote-title{text-align:center;font-size:16px;font-weight:800;text-decoration:underline;margin:22px 0 14px}.ti-quote-recipient{border:1px solid #111;padding:8px 10px;margin-bottom:12px}.ti-quote-recipient-grid{display:grid;grid-template-columns:90px 8px 1fr;gap:2px 5px}.ti-quote-intro{margin:10px 0 12px}.ti-quote-table{width:100%;border-collapse:collapse;font-size:10px;table-layout:fixed}.ti-quote-table th,.ti-quote-table td{border:1px solid #111;padding:5px 6px;vertical-align:top;overflow-wrap:anywhere}.ti-quote-table th{text-align:center;font-weight:700;background:#f7f7f7}.ti-quote-table .num{text-align:right;white-space:nowrap}.ti-quote-table .center{text-align:center}.ti-quote-total{width:46%;margin-left:auto;border-collapse:collapse;font-size:10px}.ti-quote-total td{border:1px solid #111;padding:5px 6px}.ti-quote-total td:last-child{text-align:right;font-weight:700}.ti-quote-grand td{font-weight:800;background:#fff7a6}.ti-quote-words{margin:12px 0;font-size:10px}.ti-quote-section{margin-top:12px}.ti-quote-section b{display:block;margin-bottom:4px}.ti-quote-notes{white-space:pre-wrap}.ti-quote-sign{width:240px;margin:24px 0 0 auto;text-align:center;min-height:100px}.ti-quote-sign .space{height:54px}.ti-quote-page-no{position:absolute;right:14mm;bottom:6mm;font-size:8px;color:#777}.ti-quote-cont-title{font-size:11px;font-weight:700;margin-bottom:10px}.ti-quote-watermark{position:absolute;left:14mm;bottom:6mm;font-size:8px;color:#aaa}

/* Full screen preview */
.ti-doc-fullscreen{width:min(1180px,calc(100% - 22px));height:94vh;max-height:94vh;border:0;border-radius:14px;padding:0;background:#eef1f6;overflow:hidden}
.ti-doc-fullscreen::backdrop{background:#172037b8}.ti-full-head{display:flex;align-items:center;gap:10px;padding:11px 14px;background:#fff;border-bottom:1px solid #ddd;position:sticky;top:0;z-index:5}.ti-full-head b{flex:1}.ti-full-body{height:calc(94vh - 56px);overflow:auto;padding:14px 18px 28px;display:block;text-align:center;scrollbar-gutter:stable}.ti-full-body #inv-pages,.ti-full-body #qtn-pages{width:max-content;min-width:0;margin:0 auto;text-align:left}.ti-full-body .ti-invoice-sheet,.ti-full-body .ti-quote-sheet{margin:0 auto 18px!important}

@media(max-width:1100px) and (min-width:901px){
  #invoices .ti-doc-layout,#quotations .ti-doc-layout{grid-template-columns:minmax(0,1.35fr) minmax(430px,.95fr)}
  .ti-live-stage{padding:8px}
}
@media(max-width:900px){
  .ti-vbs-heading{align-items:flex-start;flex-direction:column}.ti-head-actions{width:100%;justify-content:flex-start}
  .ti-vbs-toolbar{align-items:flex-start;flex-direction:column}.ti-vbs-toolbar-right{width:100%}
  #invoices .ti-doc-layout,#quotations .ti-doc-layout{grid-template-columns:1fr}.ti-preview-wrap{position:relative!important;top:auto!important}.ti-live-stage{max-height:none;min-height:520px}
}
@media(max-width:640px){
  .ti-preview-head{align-items:flex-start;flex-direction:column}.ti-preview-head-actions{width:100%;justify-content:flex-start}.ti-live-stage{padding:7px;min-height:420px}
  .ti-doc-fullscreen{width:100%;height:100vh;max-height:100vh;border-radius:0}.ti-full-body{height:calc(100vh - 56px);padding:8px}.ti-quote-sheet{margin-bottom:10px}
}
@page{size:A4 portrait;margin:0}
@media print{
 body.ti-print-quote>*:not(#qtn-dialog){display:none!important}body.ti-print-quote,body.ti-print-quote #qtn-dialog{margin:0!important;padding:0!important;overflow:visible!important;height:auto!important;max-height:none!important;width:auto!important;position:static!important;background:#fff!important}body.ti-print-quote #qtn-dialog{display:block!important;border:0!important;border-radius:0!important}body.ti-print-quote .ti-full-head{display:none!important}body.ti-print-quote .ti-full-body{height:auto!important;overflow:visible!important;padding:0!important}body.ti-print-quote .ti-quote-sheet{margin:0!important;box-shadow:none!important;break-after:page;break-inside:avoid;print-color-adjust:exact;-webkit-print-color-adjust:exact}body.ti-print-quote .ti-quote-sheet:last-child{break-after:auto}
}
