:root{--ink:#203d39;--ink2:#4b625e;--muted:#758780;--paper:#f4f2ed;--card:#fffefa;--line:#d9ddd6;--mint:#e2efe8;--accent:#d96f46;--accent-dark:#b95837;--warn:#fff0e6;--shadow:0 14px 44px rgba(29,58,52,.08)}
*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;background:var(--paper);color:var(--ink);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Noto Sans TC",sans-serif;line-height:1.5}button,input,select,textarea{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.45}h1,h2,h3,p{margin-top:0}.shell{width:min(1240px,calc(100% - 40px));margin:auto}[hidden]{display:none!important}
.topbar{background:var(--ink);color:white}.topbar-inner{min-height:72px;display:flex;justify-content:space-between;align-items:center;gap:16px}.brand{display:flex;align-items:center;gap:12px}.brand-icon{width:38px;height:38px;display:grid;place-items:center;background:#345b52;color:#bce0cb;border-radius:10px;font-size:24px;line-height:1}.brand strong,.brand small{display:block}.brand strong{font-size:16px;letter-spacing:.02em}.brand small{color:#b6c8c0;font-size:10px;letter-spacing:.17em}.prototype-badge{padding:7px 10px;border:1px solid #71958b;color:#d9e8e0;border-radius:99px;font-size:11px;white-space:nowrap}
.page-heading{padding:44px 0 26px;display:flex;justify-content:space-between;align-items:end;gap:30px}.eyebrow{margin-bottom:10px;color:var(--accent-dark);font-size:11px;font-weight:800;letter-spacing:.18em}.page-heading h1{margin:0 0 14px;font-size:clamp(38px,5vw,65px);line-height:1.04;letter-spacing:-.055em}.page-heading p:last-child{margin:0;color:var(--ink2)}.heading-accent{display:flex;gap:8px;align-items:end}.heading-accent span{width:48px;height:48px;display:grid;place-items:center;border:1px solid var(--line);border-radius:13px;color:var(--muted);font:700 12px monospace}.heading-accent span:last-child{height:70px;background:var(--mint);border-color:var(--mint);color:var(--ink)}
.main-nav{display:flex;gap:6px;border-bottom:1px solid #cbd3ca;margin-bottom:24px}.nav-button,.sub-button{border:0;background:transparent;color:var(--ink2);font-weight:750;padding:13px 19px}.nav-button.active{color:var(--ink);border-bottom:3px solid var(--accent)}.nav-button:hover,.sub-button:hover{color:var(--accent-dark)}.page{padding-bottom:80px}.quote-grid{display:grid;grid-template-columns:minmax(0,1fr) 350px;gap:22px;align-items:start}.form-column{min-width:0}.card{margin-bottom:18px;padding:25px;background:var(--card);border:1px solid var(--line);border-radius:19px;box-shadow:0 3px 15px rgba(29,58,52,.025)}.card-title{display:flex;align-items:start;gap:13px;margin-bottom:22px}.card-title h2{margin:0;font-size:21px;letter-spacing:-.025em}.card-title p{margin:3px 0 0;color:var(--ink2);font-size:13px}.step{flex:none;width:32px;height:32px;display:grid;place-items:center;background:var(--mint);border-radius:9px;font:800 12px monospace}.action-title,.title-left{display:flex;align-items:start;gap:13px}.action-title{justify-content:space-between}.fields{display:grid;gap:15px}.fields.two{grid-template-columns:repeat(2,minmax(0,1fr))}.fields.three{grid-template-columns:repeat(3,minmax(0,1fr))}.fields.four{grid-template-columns:repeat(4,minmax(0,1fr))}.span-two{grid-column:span 2}.field{display:flex;flex-direction:column;gap:6px;min-width:0;color:var(--ink);font-size:13px;font-weight:730}.field>span:not(.unit):not(.optional){font-weight:730}.field .optional,.field .unit{color:var(--muted);font-weight:500}input,select,textarea{width:100%;min-height:43px;padding:9px 11px;border:1px solid var(--line);border-radius:9px;background:white;color:var(--ink);font-weight:500;outline:none}input:focus,select:focus,textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px rgba(217,111,70,.13)}input::placeholder,textarea::placeholder{color:#9aa7a0}textarea{resize:vertical}.field small{color:var(--muted);font-weight:450;font-size:11px;line-height:1.45}.text-action{padding:4px 0;border:0;background:transparent;color:var(--accent-dark);font-size:13px;font-weight:800;white-space:nowrap}.text-action:hover{text-decoration:underline}.hint{display:flex;gap:14px;margin-top:18px;padding:14px;background:#eef3ee;border-radius:11px;color:var(--ink2);font-size:12px}.hint strong{white-space:nowrap;color:var(--ink)}
.item-list{display:grid;gap:15px}.item-card{padding:18px;border:1px solid #d2dad2;border-radius:15px;background:#fbfbf7}.item-head{display:flex;justify-content:space-between;align-items:start;margin-bottom:15px}.item-label,.item-title{display:block}.item-label{font:800 11px monospace;letter-spacing:.08em;color:var(--accent-dark)}.item-title{font-size:16px}.icon-button{width:30px;height:30px;padding:0;border:1px solid var(--line);border-radius:8px;background:white;color:var(--ink2);font-size:19px;line-height:1}.icon-button:hover{border-color:var(--accent);color:var(--accent-dark)}.time-pair{display:grid;grid-template-columns:1fr 1fr;gap:5px}.time-pair label{position:relative}.time-pair input{padding-right:27px}.time-pair small{position:absolute;right:9px;top:12px;color:var(--muted);pointer-events:none}.materials-head{display:flex;justify-content:space-between;align-items:center;margin:18px 0 11px;padding-top:15px;border-top:1px dashed var(--line)}.materials-head strong{font-size:13px}.usage-list{display:grid;gap:8px}.usage-row{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) 30px;gap:10px;align-items:end}.usage-row .icon-button{margin-bottom:6px}.item-foot{display:flex;justify-content:space-between;margin-top:16px;padding-top:12px;border-top:1px solid var(--line);font-size:12px;color:var(--ink2)}.item-foot strong{font-variant-numeric:tabular-nums;color:var(--ink)}.check-status{margin:15px 0 0;font-size:12px;color:var(--ink2)}.check-status.bad{color:#a6472b;font-weight:700}.preset-row{display:flex;align-items:center;gap:8px}.preset{min-height:42px;padding:0 15px;background:white;border:1px solid var(--line);border-radius:9px;color:var(--ink2);font-size:12px;font-weight:700}.preset.active{border-color:var(--ink);background:var(--mint);color:var(--ink)}.inline-number{display:flex;align-items:center;gap:7px}.inline-number input{width:90px}.inline-number span{white-space:nowrap;font-size:12px;color:var(--muted)}.segmented{display:flex;gap:16px;min-height:42px;align-items:center}.segmented label{display:flex;gap:6px;align-items:center;font-weight:550}.segmented input{width:16px;min-height:16px;accent-color:var(--accent)}
.result-column{position:sticky;top:18px}.result-card{padding:24px;border-radius:20px;background:var(--ink);color:white;box-shadow:var(--shadow)}.result-heading{display:flex;justify-content:space-between;align-items:center;font-size:12px;font-weight:800;letter-spacing:.06em}.state{padding:5px 9px;border-radius:99px;background:#fce3d8;color:#914225;font-size:10px;letter-spacing:0}.state.ready{background:#c9ead5;color:#204b36}.result-kicker{margin:28px 0 2px;color:#b6c8c0;font-size:12px}.result-total{margin:0;font-size:49px;letter-spacing:-.05em;font-weight:840;line-height:1.15;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.result-subtitle{margin:6px 0 0;color:#cfe1d8;font-size:12px}.result-missing{margin-top:17px;color:#ffd9c8;font-size:11px}.result-missing strong{display:block;color:white}.result-divider{height:1px;background:#4b625e;margin:21px 0}.result-stats{display:grid;gap:8px}.result-stats>div{display:flex;justify-content:space-between;font-size:12px}.result-stats span{color:#bbd0c5}.result-stats strong{font-variant-numeric:tabular-nums}.result-actions{display:grid;gap:8px;margin-top:25px}.result-note{margin:18px 0 0;color:#a9c1b6;font-size:10px}.button{min-height:43px;padding:0 17px;border:1px solid transparent;border-radius:9px;font-weight:770;font-size:13px}.button.primary{background:var(--accent);color:white}.button.primary:hover:not(:disabled){background:var(--accent-dark)}.button.outline{border-color:#829d90;background:transparent;color:inherit}.button.outline:hover:not(:disabled){background:rgba(255,255,255,.1)}.button.subtle{border-color:var(--line);background:white;color:var(--ink)}.cost-card{margin-top:12px;padding:0 18px;border:1px solid var(--line);border-radius:15px;background:var(--card)}.cost-card summary{display:flex;justify-content:space-between;gap:6px;padding:15px 0;cursor:pointer;font-weight:750;font-size:13px}.cost-card summary span{font-size:11px;font-weight:500;color:var(--muted)}.cost-rows{padding:0 0 17px}.cost-row{display:flex;justify-content:space-between;gap:12px;padding:6px 0;border-bottom:1px solid #edf0eb;font-size:12px;color:var(--ink2)}.cost-row strong{color:var(--ink);font-variant-numeric:tabular-nums}.cost-row.em{font-weight:800;color:var(--ink)}
.admin-intro{display:flex;justify-content:space-between;align-items:end;gap:20px;margin:10px 0 20px}.admin-intro h2{margin:0;font-size:34px;letter-spacing:-.04em}.admin-intro p:last-child{margin:4px 0 0;color:var(--ink2);font-size:13px}.sub-nav{display:flex;gap:6px;margin-bottom:17px;overflow-x:auto}.sub-button{white-space:nowrap;border-radius:9px;background:#e9eee7;font-size:13px}.sub-button.active{background:var(--ink);color:#fff}.admin-split{display:grid;grid-template-columns:1.1fr .9fr;gap:18px;align-items:start}.filament-list,.history-list{display:grid;gap:9px}.empty-note{padding:18px;border:1px dashed var(--line);border-radius:12px;color:var(--muted);font-size:13px}.filament-card,.history-card{display:flex;justify-content:space-between;gap:12px;padding:13px;border:1px solid var(--line);border-radius:11px;background:#fbfbf8}.filament-card strong,.filament-card small,.history-card strong,.history-card small{display:block}.filament-card strong,.history-card strong{font-size:14px}.filament-card small,.history-card small{color:var(--muted);font-size:11px}.filament-card .cost{margin-top:5px;color:var(--ink2);font-size:12px}.tiny-actions{display:flex;align-items:start;gap:5px}.tiny-actions button{border:0;background:transparent;color:var(--accent-dark);font-size:12px;font-weight:700}.form-actions,.backup-actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:10px}.settings-card{max-width:980px}.settings-groups{display:grid;gap:18px}.settings-groups fieldset{margin:0;padding:17px;border:1px solid var(--line);border-radius:13px}.settings-groups legend{padding:0 7px;font-weight:800;font-size:14px}.history-card{align-items:center}.history-card .history-price{font-size:17px;font-weight:850;font-variant-numeric:tabular-nums}.backup-card{max-width:780px}.backup-actions{margin:5px 0 18px}.backup-actions .outline{color:var(--ink);border-color:var(--line)}.file-button{display:inline-grid;place-items:center;cursor:pointer}.file-button input{display:none}.backup-warning{color:#8b492c;background:var(--warn);padding:14px;border-radius:9px;font-size:12px}
.preview-overlay{position:fixed;inset:0;z-index:20;overflow:auto;background:#e7e9e4;padding-bottom:40px}.preview-toolbar{position:sticky;top:0;z-index:2;display:flex;justify-content:space-between;gap:15px;align-items:center;padding:12px max(20px,calc((100vw - 900px)/2));background:var(--ink);color:#fff}.preview-toolbar strong,.preview-toolbar span{display:block}.preview-toolbar span{color:#b7c9c0;font-size:11px}.toolbar-actions{display:flex;gap:7px}.customer-sheet{width:min(820px,calc(100% - 28px));min-height:950px;margin:25px auto;padding:54px 56px;background:#fff;box-shadow:0 10px 35px rgba(0,0,0,.1);color:#202a28}.sheet-top{display:flex;justify-content:space-between;gap:20px;border-bottom:3px solid var(--ink);padding-bottom:25px}.sheet-title{margin:0 0 5px;font-size:30px;letter-spacing:-.05em}.sheet-kicker{font-size:11px;color:#7b8680;letter-spacing:.14em}.sheet-meta{text-align:right;font-size:12px;line-height:1.9}.sheet-project{padding:27px 0}.sheet-project h3{margin:0 0 5px;font-size:20px}.sheet-project p{margin:0;color:#6b7972;font-size:12px}.sheet-table{width:100%;border-collapse:collapse;font-size:12px}.sheet-table th{text-align:left;background:#e8f0e9;color:#365449;padding:11px 10px}.sheet-table th:last-child,.sheet-table td:last-child{text-align:right}.sheet-table td{padding:13px 10px;border-bottom:1px solid #dfe5df;vertical-align:top}.sheet-table .item-primary{font-weight:750;font-size:13px}.sheet-table .item-secondary{color:#687770;font-size:11px}.sheet-total{display:flex;justify-content:flex-end;gap:45px;align-items:center;margin-top:30px;padding-top:19px;border-top:2px solid var(--ink)}.sheet-total span{font-size:14px}.sheet-total strong{font-size:25px;letter-spacing:-.04em}.sheet-notes{margin-top:55px;padding-top:18px;border-top:1px solid #dfe5df;font-size:12px;white-space:pre-wrap}.sheet-notes strong{display:block;margin-bottom:7px}.sheet-footer{margin-top:85px;text-align:center;color:#9aa49f;font-size:10px;letter-spacing:.12em}.toast{position:fixed;z-index:30;bottom:20px;left:50%;transform:translate(-50%,25px);padding:10px 16px;border-radius:99px;background:#1d2825;color:white;box-shadow:var(--shadow);font-size:12px;opacity:0;pointer-events:none;transition:.2s}.toast.show{transform:translate(-50%,0);opacity:1}
.reset-section{margin-top:26px;padding-top:18px;border-top:1px solid var(--line)}.reset-section strong{font-size:14px}.reset-section p{margin:5px 0 13px;color:var(--ink2);font-size:12px}.danger-button{border-color:#d7a995;background:#fff7f3;color:#a34a2b}.danger-button:hover{background:#ffede4}.cost-dialog{width:min(640px,calc(100% - 28px));max-height:min(85vh,850px);padding:0;border:1px solid var(--line);border-radius:16px;box-shadow:0 24px 80px rgba(0,0,0,.25);color:var(--ink);background:var(--card)}.cost-dialog::backdrop{background:rgba(15,29,27,.55)}.dialog-head{position:sticky;top:0;display:flex;justify-content:space-between;align-items:center;gap:15px;padding:20px 24px;border-bottom:1px solid var(--line);background:var(--card)}.dialog-head span{display:block;color:var(--accent-dark);font-size:10px;letter-spacing:.16em;font-weight:800}.dialog-head h2{margin:3px 0 0;font-size:20px}#cost-dialog-body{padding:20px 24px 26px}.dialog-subtitle{margin:0 0 15px;color:var(--ink2);font-size:12px}.dialog-cost-rows{display:grid;gap:0}.dialog-cost-rows .cost-row{padding:9px 0}
button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:3px solid rgba(217,111,70,.35);outline-offset:2px}
@media(max-width:1050px){.quote-grid{grid-template-columns:1fr}.result-column{position:static;display:grid;grid-template-columns:1fr 1fr;gap:14px}.cost-card{margin:0;align-self:start}.admin-split{grid-template-columns:1fr}}
@media(max-width:720px){.shell{width:calc(100% - 24px)}.topbar-inner{min-height:65px}.prototype-badge{max-width:130px;white-space:normal;text-align:center;line-height:1.25}.page-heading{padding:30px 0 22px}.heading-accent{display:none}.page-heading h1{font-size:43px}.quote-grid,.result-column{display:block}.cost-card{margin-top:12px}.card{padding:18px 15px}.fields.three,.fields.four{grid-template-columns:repeat(2,minmax(0,1fr))}.fields.four .span-two{grid-column:span 2}.action-title{align-items:start}.action-title .text-action{padding-top:9px}.usage-row{grid-template-columns:minmax(0,1fr) 100px 28px}.admin-intro{align-items:start}.preview-toolbar{flex-wrap:wrap;padding:10px 14px}.toolbar-actions{width:100%;overflow-x:auto}.toolbar-actions .button{white-space:nowrap}.customer-sheet{padding:32px 25px;min-height:700px}.sheet-title{font-size:24px}}
@media(max-width:480px){.brand strong{font-size:13px}.brand small{font-size:9px}.brand-icon{width:32px;height:32px}.page-heading h1{font-size:38px}.fields.two,.fields.three,.fields.four{grid-template-columns:1fr}.span-two,.fields.four .span-two{grid-column:1}.usage-row{grid-template-columns:1fr 95px 27px;gap:6px}.usage-row .field{font-size:11px}.usage-row input,.usage-row select{padding:7px}.preset-row{flex-wrap:wrap}.hint{display:block}.hint strong{display:block;margin-bottom:5px}.card-title h2{font-size:19px}.card-title p{font-size:12px}.action-title{flex-wrap:wrap}.action-title .text-action{margin-left:45px;padding:0}.sheet-meta{font-size:10px}.sheet-table{font-size:10px}.sheet-table th,.sheet-table td{padding:9px 5px}.sheet-top{gap:8px}.sheet-title{font-size:21px}.customer-sheet{padding:25px 17px}}
@media print{body{background:white}.topbar,main,.preview-toolbar,.toast{display:none!important}.preview-overlay{position:static;overflow:visible;padding:0;background:white}.customer-sheet{width:100%;min-height:0;margin:0;padding:0;box-shadow:none}.sheet-footer{margin-top:55px}@page{size:A4;margin:18mm}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;transition:none!important}}
.page-heading{padding:31px 0 21px;display:block}.page-heading h1{margin:0 0 7px;font-size:clamp(31px,3.4vw,45px);line-height:1.2;letter-spacing:-.04em}.page-heading p:last-child{font-size:14px}
@media(max-width:720px){.page-heading{padding:25px 0 18px}.page-heading h1{font-size:34px}}
@media(max-width:480px){.page-heading h1{font-size:31px}.page-heading p:last-child{font-size:13px}}
.auth-screen{position:fixed;z-index:200;inset:0;display:grid;place-items:center;overflow:auto;padding:24px;background:#eff0e9}.auth-screen[hidden]{display:none}.auth-card{width:min(100%,430px);padding:34px;border:1px solid var(--line);border-radius:20px;background:#fffefa;box-shadow:var(--shadow)}.auth-symbol{display:grid;place-items:center;width:42px;height:42px;border-radius:10px;background:var(--mint);color:var(--ink);font-size:25px}.auth-card .eyebrow{margin:22px 0 8px}.auth-card h1{margin:0;font-size:29px;line-height:1.2}.auth-card>p:not(.eyebrow){font-size:13px;color:var(--ink2)}.auth-form{display:grid;gap:16px;margin-top:26px}.auth-form .button{width:100%}.auth-error{min-height:20px;color:#a6472b!important;font-weight:700}.auth-help{margin-top:22px}.auth-card .text-action{margin-right:15px}.main-nav #logout{margin-left:auto}.sync-failed{background:#fce3d8!important;color:#914225!important}.sync-pending{background:#fff2ce!important;color:#684c06!important}
@media(max-width:480px){.auth-screen{padding:14px}.auth-card{padding:25px 20px}.auth-card h1{font-size:25px}.main-nav #logout{margin-left:0}}
@media print{.auth-screen{display:none!important}}

/* Keep editing and quote previews readable on narrow phones without horizontal page scrolling. */
@media screen and (max-width:600px){
  .shell,.page,.quote-grid,.form-column,.card,.item-card,.admin-panel,.admin-split,.settings-groups,.settings-groups fieldset{min-width:0}
  .card-title>div,.title-left>div,.admin-intro>div,.filament-card>div,.history-card>div{min-width:0}
  .card-title p,.admin-intro p,.filament-card strong,.filament-card small,.history-card strong,.history-card small{overflow-wrap:anywhere}
  .admin-intro{align-items:flex-start;flex-direction:column;gap:12px}
  .admin-intro .button{align-self:flex-start;white-space:nowrap}
  .sub-nav{flex-wrap:wrap;overflow:visible}
  .sub-button{flex:1 1 calc(33.333% - 6px);padding:11px 8px}
  .usage-row{grid-template-columns:minmax(0,1fr) 30px;gap:8px}
  .usage-row .field:first-child{grid-column:1;grid-row:1}
  .usage-row .field:nth-child(2){grid-column:1;grid-row:2}
  .usage-row .icon-button{grid-column:2;grid-row:1;align-self:end;margin-bottom:6px}
  .preview-toolbar{align-items:stretch}
  .toolbar-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible}
  .toolbar-actions .button{min-width:0;padding-inline:8px;white-space:normal}
  .toolbar-actions .button:last-child{grid-column:1/-1}
  .customer-sheet{width:calc(100% - 20px);margin:10px auto;padding:24px 18px;min-height:0}
  .sheet-top{flex-direction:column;gap:10px}
  .sheet-meta{text-align:left;overflow-wrap:anywhere}
  .sheet-project h3,.sheet-notes{overflow-wrap:anywhere}
  .sheet-table,.sheet-table tbody,.sheet-table tr,.sheet-table td{display:block;width:100%}
  .sheet-table thead{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  .sheet-table tr{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 10px;padding:13px 0;border-bottom:1px solid #dfe5df}
  .sheet-table td{min-width:0;padding:0;border:0;overflow-wrap:anywhere}
  .sheet-table td:first-child,.sheet-table td:nth-child(2){grid-column:1/-1}
  .sheet-table td:nth-child(2){color:#687770}
  .sheet-table td:nth-child(3){grid-column:1;grid-row:3}
  .sheet-table td:nth-child(3)::before{content:"數量："}
  .sheet-table td:last-child{grid-column:2;grid-row:3;text-align:right;font-weight:750}
  .sheet-total{justify-content:space-between;gap:10px}
  .sheet-total strong{font-size:22px;text-align:right;overflow-wrap:anywhere}
  .sheet-footer{margin-top:48px;overflow-wrap:anywhere}
}
