:root{--blue:#144b8b;--blue2:#0b376b;--gold:#d9a42e;--bg:#f3f6fa;--line:#d8e0ea;--text:#1d2939;--muted:#667085;--green:#17825b;--red:#b42318;--white:#fff}
*{box-sizing:border-box}html,body{margin:0;padding:0}body{background:var(--bg);color:var(--text);font-family:"Microsoft JhengHei","Noto Sans TC",Arial,sans-serif}button,input,select,textarea{font:inherit}.hidden{display:none!important}
.setup-warning{position:fixed;top:0;left:0;right:0;z-index:100;background:#fff0c2;color:#5a4300;border-bottom:1px solid #e5c566;padding:10px 14px;text-align:center;font-weight:700}
.login-shell{min-height:100vh;display:grid;place-items:center;padding:28px;background:linear-gradient(135deg,#092e58,#185b9e)}.login-card{width:min(430px,100%);background:#fff;border-radius:18px;padding:28px;box-shadow:0 24px 60px #0005}.brand-mark{font-weight:900;color:var(--blue);letter-spacing:2px;font-size:14px}.login-brand h1{margin:6px 0 2px;font-size:25px;color:#123f74}.login-brand p{margin:0 0 22px;color:var(--muted);font-size:13px}.login-form{display:grid;gap:14px}.login-note{margin-top:16px;font-size:12px;line-height:1.65;color:#667085;background:#f7f9fc;border-radius:9px;padding:10px 12px}.form-msg{min-height:20px;color:var(--red);font-size:13px}
.topbar{background:linear-gradient(135deg,var(--blue2),var(--blue));color:white;padding:16px 22px;position:sticky;top:0;z-index:20;box-shadow:0 3px 12px #0002}.toprow{max-width:1500px;margin:auto;display:flex;align-items:center;justify-content:space-between;gap:18px}.brand h1{font-size:21px;margin:0 0 3px}.brand p{margin:0;color:#dbe8f6;font-size:12px}.userbox{display:flex;align-items:center;gap:18px}.userbox>div:first-child{display:flex;flex-direction:column;align-items:flex-end}.userbox span{font-size:12px;color:#dbe8f6}.topactions{display:flex;gap:8px;flex-wrap:wrap}
.btn{border:0;border-radius:9px;padding:10px 14px;cursor:pointer;font-weight:800;transition:.15s}.btn:hover{filter:brightness(.98)}.btn:disabled{opacity:.45;cursor:not-allowed}.btn.primary{background:var(--gold);color:#302300}.btn.gold{background:var(--gold);color:#302300}.btn.light{background:#fff;color:var(--blue)}.btn.light2{background:#eef4fb;color:var(--blue);border:1px solid #c6d5e5}.btn.ghost{background:transparent;color:white;border:1px solid #ffffff66}.btn.blue{background:var(--blue);color:white}.btn.outline{background:#fff;color:var(--blue);border:1px solid #a8bfd8}.btn.small{padding:9px 11px;white-space:nowrap}.btn.wide{width:100%}
.container{max-width:1500px;margin:22px auto;padding:0 18px 50px}.card{background:#fff;border:1px solid var(--line);border-radius:14px;padding:18px;margin-bottom:16px;box-shadow:0 2px 10px #1018280a}.section-title{display:flex;align-items:center;gap:9px;margin-bottom:14px}.section-title>span,.section-title>div>span{display:inline-grid;place-items:center;width:29px;height:29px;background:var(--blue);color:#fff;border-radius:50%;font-weight:900}.section-title h2{font-size:17px;margin:0;color:var(--blue)}.section-title.with-action{justify-content:space-between}.section-title.with-action>div{display:flex;align-items:center;gap:9px}.helper{font-size:12px;color:var(--muted);margin:-5px 0 12px}.grid{display:grid;gap:13px}.g4{grid-template-columns:repeat(4,minmax(0,1fr))}.g3{grid-template-columns:repeat(3,minmax(0,1fr))}.span2{grid-column:span 2}.span3{grid-column:span 3}label{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:700;color:#344054}.req{color:#d92d20;margin-left:3px}input,select,textarea{width:100%;border:1px solid #cbd5e1;border-radius:8px;padding:10px;background:#fff;color:#101828}input:focus,select:focus,textarea:focus{outline:2px solid #bdd5f2;border-color:#5b8fc9}input[readonly]{background:#f6f8fb;color:#475467}textarea{min-height:80px;resize:vertical}.inline-input{display:grid;grid-template-columns:1fr auto;gap:7px}.match-box{margin-top:12px;padding:12px;border-radius:9px;background:#eef7f3;border:1px solid #b8ddcc;font-size:13px}.match-title{font-weight:900;color:#145c45;margin:5px 0 3px}.match-title:not(:first-child){margin-top:14px;padding-top:10px;border-top:1px solid #cfe2d8}.match-item{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:8px 0;border-bottom:1px solid #dcebe4}.match-item:last-child{border-bottom:0}
.tablebox{overflow:auto;border:1px solid var(--line);border-radius:10px}.items-table{border-collapse:collapse;width:100%;min-width:1080px}.items-table th{background:#edf4fb;color:#234b76;font-size:12px;text-align:left;padding:10px;border-bottom:1px solid var(--line);white-space:nowrap}.items-table td{padding:8px;border-bottom:1px solid #edf0f4;vertical-align:middle}.items-table td input,.items-table td select{min-width:98px;padding:8px}.items-table td.num{text-align:right;font-weight:800;white-space:nowrap}.rowbtns{display:flex;gap:5px}.mini{border:1px solid #ccd6e1;background:white;border-radius:7px;padding:6px 8px;cursor:pointer}.mini.del{color:var(--red)}.link-btn{margin-top:10px;border:0;background:transparent;color:var(--blue);font-weight:800;cursor:pointer;padding:5px 0}.internal-panel{margin-top:8px;background:#fffaf0;border:1px solid #efd6a0;border-radius:10px;padding:12px;overflow:auto}.internal-panel table{width:100%;border-collapse:collapse;min-width:760px;font-size:12px}.internal-panel th,.internal-panel td{padding:8px;border-bottom:1px solid #eadfc8;text-align:right}.internal-panel th:first-child,.internal-panel td:first-child{text-align:left}
.calcarea{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(330px,.8fr);gap:16px}.summary{border:1px solid var(--line);border-radius:11px;overflow:hidden;align-self:start}.summary>div{display:flex;justify-content:space-between;padding:11px 14px;border-bottom:1px solid #edf0f4}.summary>div:last-child{border:0}.summary .total{background:#123f74;color:white;font-size:19px}.summary .balance{background:#eef7f3;font-size:17px}.summary b{font-variant-numeric:tabular-nums}.action-card{display:flex;justify-content:space-between;align-items:center;gap:16px}.action-card h2{margin:0 0 4px;font-size:17px;color:var(--blue)}.action-card p{margin:0;color:var(--muted);font-size:12px}.save-state{margin-top:7px;font-size:12px;color:#667085}.save-state.ok{color:var(--green);font-weight:700}.actionsBottom{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap}
dialog{border:0;border-radius:14px;padding:0;max-width:1050px;width:calc(100% - 28px);box-shadow:0 24px 70px #0005}dialog::backdrop{background:#0f172a88}.modal{padding:20px}.modalHead{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;margin-bottom:16px}.modalHead h2{margin:0;color:var(--blue)}.modalHead p{margin:4px 0 0;color:var(--muted);font-size:13px}.x{border:0;background:#eef2f6;border-radius:50%;width:34px;height:34px;font-size:20px;cursor:pointer}.search-action{display:flex;align-items:end}.search-action .btn{width:100%}.search-results{margin-top:16px;border:1px solid var(--line);border-radius:10px;overflow:auto;max-height:55vh}.search-row{display:grid;grid-template-columns:1.1fr 1fr 1.2fr 1fr .8fr .9fr auto;gap:8px;align-items:center;padding:10px 12px;border-bottom:1px solid #edf0f4;font-size:12px}.search-row.header{background:#edf4fb;color:#234b76;font-weight:800;position:sticky;top:0}.search-row:last-child{border-bottom:0}.empty{padding:24px;text-align:center;color:#667085}.tag{display:inline-block;border-radius:999px;padding:3px 8px;font-size:11px;font-weight:800}.tag.active{background:#e7f6ef;color:#117654}.tag.dead{background:#f3f4f6;color:#6b7280}.tag.status{background:#edf4fb;color:#174b82}
.pdf-dialog{max-width:1120px;width:calc(100% - 24px);height:calc(100vh - 28px);max-height:980px}.pdfModal{height:100%;display:flex;flex-direction:column;padding:16px}.pdfPages{flex:1;overflow:auto;background:#5f6875;border-radius:10px;padding:18px;min-height:0}.pdfPageImg{display:block;width:min(100%,794px);height:auto;margin:0 auto 18px;background:#fff;box-shadow:0 4px 18px #0005}.pdfPageImg:last-child{margin-bottom:0}.pdfFilename{font-size:12px;color:var(--muted);word-break:break-all;margin-top:4px}.pdfActions{display:flex;justify-content:flex-end;gap:9px;flex-wrap:wrap;padding-top:12px}.pdfStatus{font-size:12px;color:var(--muted);padding-top:8px}.print-area{display:none}
@media(max-width:1050px){.g4{grid-template-columns:repeat(2,1fr)}.g3{grid-template-columns:repeat(2,1fr)}.calcarea{grid-template-columns:1fr}.span3{grid-column:1/-1}.userbox{align-items:flex-end;flex-direction:column;gap:8px}}
@media(max-width:650px){.topbar{position:static;padding:14px 12px}.toprow{align-items:flex-start;flex-direction:column}.userbox{width:100%;align-items:stretch}.userbox>div:first-child{align-items:flex-start}.topactions{width:100%}.topactions .btn{flex:1;min-width:100px}.container{padding:0 9px 30px;margin-top:10px}.card{padding:13px;border-radius:11px}.g4,.g3{grid-template-columns:1fr}.span2,.span3{grid-column:auto}.action-card{align-items:stretch;flex-direction:column}.actionsBottom{display:grid;grid-template-columns:1fr 1fr}.actionsBottom .btn{width:100%}.section-title.with-action{align-items:center}.section-title.with-action .btn{padding:8px 10px}.tablebox{overflow:visible;border:0}.items-table{display:block;min-width:0}.items-table thead{display:none}.items-table tbody{display:block}.items-table tr{display:block;margin:0 0 14px;padding:10px 12px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 2px 8px #1018280a}.items-table td{display:grid;grid-template-columns:92px minmax(0,1fr);gap:10px;align-items:center;width:100%;padding:8px 0;border-bottom:1px solid #edf0f4}.items-table td:last-child{border:0}.items-table td::before{font-size:13px;font-weight:700;color:#475467}.items-table td:nth-child(1)::before{content:"項次"}.items-table td:nth-child(2)::before{content:"空間位置"}.items-table td:nth-child(3)::before{content:"產品"}.items-table td:nth-child(4)::before{content:"窗型"}.items-table td:nth-child(5)::before{content:"實際寬 cm"}.items-table td:nth-child(6)::before{content:"實際高 cm"}.items-table td:nth-child(7)::before{content:"數量"}.items-table td:nth-child(8)::before{content:"小計"}.items-table td:nth-child(9)::before{content:"備註"}.items-table td:nth-child(10)::before{content:"操作"}.items-table td input,.items-table td select{min-width:0;width:100%;font-size:16px;padding:10px}.items-table td.num{text-align:left;font-size:17px;color:var(--blue)}.items-table td:first-child{background:#edf4fb;margin:-10px -12px 4px;padding:10px 12px;width:calc(100% + 24px);border-radius:12px 12px 0 0;color:var(--blue);font-weight:800}.items-table .rowbtns{display:grid;grid-template-columns:1fr 1fr}.items-table .mini{width:100%;padding:10px}.search-grid{grid-template-columns:1fr}.search-row.header{display:none}.search-row{grid-template-columns:1fr;gap:4px}.search-row>div::before{font-weight:800;color:#475467;margin-right:5px}.search-row>div:nth-child(1)::before{content:"單號："}.search-row>div:nth-child(2)::before{content:"日期："}.search-row>div:nth-child(3)::before{content:"客戶："}.search-row>div:nth-child(4)::before{content:"業務："}.search-row>div:nth-child(5)::before{content:"狀態："}.search-row>div:nth-child(6)::before{content:"總額："}.pdf-dialog{width:100%;height:100%;max-height:none;border-radius:0}.pdfModal{padding:10px}.pdfPages{padding:8px}.pdfActions{display:grid;grid-template-columns:1fr 1fr}.pdfActions .btn{width:100%}.pdfActions #pdfBack{grid-column:1/-1}.pdfActions #pdfPrint{display:none}.login-card{padding:22px}}
@media print{@page{size:A4;margin:0}body{background:#fff}.topbar,.container,.login-shell,dialog,.setup-warning{display:none!important}.print-area{display:block!important}.print-page{page-break-after:always;width:210mm;height:297mm;display:flex;align-items:center;justify-content:center;background:#fff}.print-page:last-child{page-break-after:auto}.print-page img{width:210mm;height:297mm;object-fit:contain;display:block}}
