:root{--bg:#f5f7fb;--panel:#ffffff;--ink:#172033;--muted:#697386;--line:#dfe5ef;--blue:#1e63d6;--blue-soft:#eaf1ff;--green:#0f8f68;--amber:#b26b00;--red:#c0392b;--shadow:0 18px 55px rgba(25,39,75,0.1)}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);overflow:hidden;font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Noto Sans TC,sans-serif}button,input,select,textarea{font:inherit}button{border:0;border-radius:7px;background:var(--blue);color:white;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:38px;padding:0 14px;white-space:nowrap}button:disabled{cursor:not-allowed;opacity:.62}.secondary{background:#edf2fa;color:#1e3358}input,select,textarea{border:1px solid var(--line);border-radius:6px;color:var(--ink);background:white;min-height:34px;padding:7px 9px}textarea{min-height:82px;resize:vertical}.spin{animation:spin .9s linear infinite}@keyframes spin{to{transform:rotate(1turn)}}.login-screen{min-height:100vh;display:grid;place-items:center;padding:24px}.login-card{width:min(420px,100%);background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow);padding:32px;display:grid;grid-gap:16px;gap:16px}.login-card h1,.panel-title h3,.sidebar h1,.topbar h2{margin:0}.login-card p,.modal-header p,.panel-title p,.template-panel p,.topbar .eyebrow,.upload-zone p{margin:0;color:var(--muted);font-size:12px;line-height:1.45}.login-icon{width:48px;height:48px;border-radius:8px;background:var(--blue-soft);color:var(--blue);display:grid;place-items:center}.line-login-button{min-height:44px;border-radius:7px;background:#06c755;color:white;display:inline-flex;align-items:center;justify-content:center;font-weight:800;text-decoration:none}.line-login-button.disabled{opacity:.5;pointer-events:none}.login-note{color:var(--muted)}.text-button{min-height:0;padding:0;background:transparent;color:var(--blue);justify-content:flex-start}.recovery-login{display:grid;grid-gap:10px;gap:10px}.app-shell{display:grid;grid-template-columns:clamp(248px,16vw,300px) minmax(0,1fr) clamp(360px,27vw,520px)}.app-shell,.sidebar{height:100dvh;overflow:hidden}.sidebar{background:#111827;color:white;padding:22px 20px;display:flex;flex-direction:column;gap:20px;min-height:0}.sidebar h1{font-size:clamp(19px,1.28vw,24px);line-height:1.16;letter-spacing:0}.sidebar .eyebrow,.sidebar label,.sidebar p,.sidebar small{color:#a9b5c7}.user-card{border:1px solid rgba(255,255,255,.16);border-radius:8px;padding:10px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;grid-gap:10px;gap:10px}.user-avatar,.user-card img{width:34px;height:34px;border-radius:999px}.user-card img{object-fit:cover}.user-avatar{display:grid;place-items:center;background:rgba(255,255,255,.14);color:white;font-weight:800}.user-card small,.user-card strong{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-button{width:100%;background:rgba(37,99,235,.18);color:white;border:1px solid rgba(147,197,253,.28)}.eyebrow{margin:0 0 5px;color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.08em}.month-create{display:grid;grid-gap:8px;gap:8px}.inline-row{display:flex;gap:8px}.inline-row input{min-width:0;width:100%}.session-list{display:grid;grid-auto-rows:max-content;align-content:start;grid-gap:8px;gap:8px;overflow:auto;min-height:0;max-height:min(260px,32dvh);flex:0 1 auto}.session{width:100%;min-height:64px;padding:8px;background:rgba(255,255,255,.07);color:white;border-radius:8px;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;grid-gap:6px;gap:6px}.session.active{background:#2563eb}.session-main{min-height:48px;padding:4px 6px;background:transparent;color:white;display:grid;justify-items:start;align-content:center;grid-gap:2px;gap:2px;white-space:normal}.session-main em{color:#dbe7ff;font-size:11px;font-style:normal}.session-delete{width:30px;min-height:30px;padding:0;border-radius:6px;background:rgba(255,255,255,.12);color:white}.session-delete:hover{background:rgba(255,255,255,.22)}.template-panel{margin-top:auto;border:1px solid rgba(255,255,255,.16);border-radius:8px;padding:14px;display:grid;grid-gap:12px;gap:12px}.main-panel{height:100dvh;padding:20px 18px;display:grid;grid-template-rows:auto auto auto auto minmax(0,1fr);grid-gap:12px;gap:12px;min-width:0;overflow:hidden}.main-panel>*,.stats-grid,.table-panel,.topbar,.upload-panel,.work-grid{width:100%;min-width:0;max-width:100%}.topbar{display:flex;justify-content:space-between;gap:16px;align-items:flex-start}.topbar>div{min-width:0}.topbar h2{white-space:nowrap}.topbar .eyebrow{margin:4px 0 0;text-transform:none;letter-spacing:0}.top-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;padding-right:12px}.global-status-area{display:grid;grid-gap:8px;gap:8px;min-height:0}.stats-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-gap:10px;gap:10px}.context-card,.download-panel,.preview-panel,.stats-grid>div,.table-panel,.upload-zone{background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 25px rgba(25,39,75,.05)}.upload-panel{display:grid;grid-gap:8px;gap:8px}.stats-grid>div{padding:12px;display:grid;grid-gap:6px;gap:6px;min-height:120px;min-width:0}.detail-list span,.stats-grid span{color:var(--muted);font-size:12px}.stats-grid strong{font-size:22px}.subtotal-list{display:grid;grid-gap:4px;gap:4px;margin-top:2px}.settings-list small,.subtotal-list small{display:flex;justify-content:space-between;gap:10px;color:var(--muted)}.settings-list b,.subtotal-list b{color:var(--ink);font-weight:700}.settings-list{display:grid;grid-gap:9px;gap:9px;align-content:center}.settings-list b{font-size:18px}.context-card{border-left:4px solid var(--blue)!important;padding:16px;display:grid;grid-gap:10px;gap:10px}.context-card small{color:var(--muted)}.month-card{background:#f7fbff!important}.tax-card{background:#f5fff9!important;border-left-color:var(--green)!important}.upload-zone{min-height:64px;border-style:dashed;display:flex;align-items:center;flex-wrap:wrap;gap:12px;padding:10px 12px}.upload-zone>div:not(.upload-actions){flex:1 1 320px;min-width:220px;max-width:440px}.upload-zone.dragging{background:var(--blue-soft);border-color:var(--blue)}.upload-actions{display:flex;flex:0 0 auto;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px;margin-left:auto}.upload-title-row{display:inline-flex;align-items:center;gap:8px;min-width:0}.pending-files{display:grid;grid-gap:6px;gap:6px;max-height:120px;overflow:auto}.pending-file{background:var(--panel);border:1px solid var(--line);border-radius:7px;min-height:38px;display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;grid-gap:10px;gap:10px;padding:6px 8px}.pending-file span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pending-file small{color:var(--muted)}.pending-file button{width:30px;min-height:30px;padding:0;background:#edf2fa;color:#1e3358}.work-grid{min-height:0;display:block}.preview-panel,.table-panel{min-width:0;overflow:visible}.table-panel{height:100%;display:flex;flex-direction:column}.panel-title{padding:12px 16px;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:14px}.panel-title h3{white-space:nowrap}.panel-title p{min-width:0}.title-with-help{display:flex;align-items:center;gap:8px}.help-button{width:28px;min-height:28px;padding:0;background:#edf2fa;color:#41516b}.help-tip{position:relative;display:inline-flex;align-items:center;flex:0 0 auto}.help-tooltip{z-index:80;top:calc(100% + 8px);left:50%;width:min(300px,72vw);transform:translateX(-50%) translateY(-3px);padding:9px 10px;border-radius:7px;color:white;font-size:12px;line-height:1.45;box-shadow:0 14px 35px rgba(17,24,39,.22);opacity:0;pointer-events:none;text-align:left;transition:opacity .14s ease,transform .14s ease;white-space:normal}.help-tooltip,.help-tooltip:before{position:absolute;background:#172033}.help-tooltip:before{content:"";top:-5px;left:calc(50% - 5px);width:10px;height:10px;transform:rotate(45deg)}.help-tip:focus-within .help-tooltip,.help-tip:hover .help-tooltip{opacity:1;transform:translateX(-50%) translateY(0)}.icon-button{width:34px;min-height:34px;padding:0}.table-wrap{overflow:auto;min-height:0;flex:1 1;width:100%}table{border-collapse:collapse;width:100%;min-width:940px}td,th{border-bottom:1px solid var(--line);padding:6px 8px;text-align:left;vertical-align:middle;font-size:13px;height:52px}th{position:-webkit-sticky;position:sticky;top:0;z-index:1;background:#f8fafd;color:#41516b}.sort-button{min-height:0;padding:0;background:transparent;color:inherit;justify-content:flex-start;gap:5px;font-weight:700}tr.selected{background:#f0f6ff}td input,td select{width:100%;min-width:0;min-height:36px;font-size:13px;padding:6px 8px}td select{height:36px}.source-cell,.warning-cell{min-width:190px}.source-cell{max-width:230px}.source-stack{display:grid;grid-gap:3px;gap:3px;min-width:0}.source-stack span{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.source-stack small{color:var(--muted)}.type-cell{width:116px}.amount-cell{width:86px}.amount-cell input{width:76px}td:first-child,th:first-child{width:58px;text-align:center}td:nth-child(2),th:nth-child(2){width:44px;text-align:center}td:nth-child(4),th:nth-child(4){width:132px}td:nth-child(7),td:nth-child(8),th:nth-child(7),th:nth-child(8){width:72px}td:nth-child(9),th:nth-child(9){width:136px}.chip{display:inline-flex;border-radius:999px;padding:3px 7px;margin:0 4px 4px 0;font-size:11px;line-height:1.2;background:#eef2f7}.chip.warn{background:#fff3d6;color:var(--amber)}.chip.tax{background:#eaf1ff;color:var(--blue)}.chip.danger{background:#ffe8e6;color:var(--red)}.icon-status{width:32px;min-height:32px;padding:0;background:transparent}.icon-status.ok{color:var(--green)}.icon-status.attention{color:var(--amber)}.icon-status.error{color:var(--red)}.preview-column{height:100dvh;min-width:0;min-height:0;overflow:hidden;padding:20px 18px 20px 0;display:flex;flex-direction:column}.preview-panel{flex:1 1;min-height:0;display:flex;flex-direction:column}.preview-toolbar{display:flex;gap:8px;padding:10px 12px;border-bottom:1px solid var(--line)}.preview-toggle{min-height:32px;padding:6px 10px;background:#edf3fb;color:#42526a}.preview-toggle.active{background:var(--blue);color:white}.preview-image-frame{position:relative;flex:1 1;min-height:0;display:grid;place-items:center;background:#f9fbff;border-bottom:1px solid var(--line);overflow:hidden}.preview-image-frame img{position:absolute;inset:12px;width:calc(100% - 24px);height:calc(100% - 24px);object-fit:contain;display:block}.boundary-stage{position:absolute;inset:12px;display:grid;place-items:center}.boundary-stage img,.boundary-stage svg{grid-area:1/1;width:100%;height:100%;object-fit:contain}.boundary-stage img{z-index:1}.boundary-stage svg{pointer-events:none;z-index:2}.boundary-stage polygon{fill:rgba(37,99,235,.18);stroke:none}.detail-list{padding:9px 12px;display:grid;grid-gap:8px;gap:8px;flex:0 0 auto}.detail-list div,.detail-list label{display:grid;grid-gap:4px;gap:4px}.detail-full strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.confidence-grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr));grid-gap:6px!important;gap:6px!important}.confidence-grid div{min-width:0;gap:2px;padding:7px 8px;border:1px solid var(--line);border-radius:7px;background:#f8fbff}.confidence-grid span{font-size:11px}.confidence-grid strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:13px}.download-panel{display:flex;align-items:center;gap:12px;padding:12px 14px;color:var(--green)}.download-panel a{color:var(--blue);font-weight:700}.error{background:#fff0ee;color:var(--red);border:1px solid #ffd1cc;border-radius:7px}.error,.status{padding:10px 12px}.status{background:#eef8f3;color:var(--green);border:1px solid #bfe8d3;border-radius:7px}.progress-status{display:grid;grid-gap:8px;gap:8px}.progress-track{height:6px;overflow:hidden;border-radius:999px;background:rgba(15,143,104,.14)}.progress-track span{display:block;width:38%;height:100%;border-radius:inherit;background:linear-gradient(90deg,rgba(15,143,104,.25),var(--green),rgba(15,143,104,.25));animation:progressSweep 1.1s ease-in-out infinite}@keyframes progressSweep{0%{transform:translateX(-110%)}to{transform:translateX(280%)}}.error.wide,.status.wide{width:100%}.empty-preview,.empty-state{min-height:220px;display:grid;place-items:center;color:var(--muted);grid-gap:8px;gap:8px;text-align:center}.modal-backdrop{position:fixed;inset:0;z-index:20;background:rgba(17,24,39,.44);display:grid;place-items:center;padding:24px}.modal-backdrop.top{z-index:30}.modal-card{width:min(560px,100%);background:var(--panel);border:1px solid var(--line);border-radius:8px;box-shadow:var(--shadow);display:grid;grid-gap:16px;gap:16px;padding:18px}.modal-card.admin-modal{width:min(1320px,calc(100vw - 48px));max-height:calc(100dvh - 48px);grid-template-rows:auto auto auto;overflow:visible}.modal-card.permission-modal{width:min(1040px,calc(100vw - 56px));max-height:calc(100dvh - 56px);grid-template-rows:auto minmax(0,1fr) auto}.modal-card.self-status-modal{width:min(860px,calc(100vw - 56px))}.modal-header p{margin-top:4px}.admin-table-wrap{overflow:visible;max-height:calc(52px + 10 * 58px);border:1px solid var(--line);border-radius:8px}.admin-table{width:100%;min-width:0;table-layout:fixed}.admin-table td,.admin-table th{height:58px;vertical-align:middle;white-space:nowrap}.admin-table th{line-height:1.15}.admin-table input,.admin-table select{min-height:34px;font-size:13px}.admin-col-user{width:13%}.admin-col-line{width:14%}.admin-col-identity{width:13%}.admin-col-role{width:9%}.admin-col-status{width:8%}.admin-col-quota{width:10%}.admin-col-login-at{width:11%}.admin-col-count{width:5%}.admin-col-count.wide{width:7%}.admin-table td:nth-child(n+8),.admin-table th:nth-child(n+8){text-align:center}.admin-identity-input,.role-select,.status-select{width:100%}.line-id-cell{max-width:none;overflow:visible;font-size:12px;color:#40506a}.line-id-wrap{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;grid-gap:6px;gap:6px;min-width:0}.line-id-wrap>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.copy-line-id-button{width:28px;min-height:28px;padding:0;border-radius:7px;background:#edf2fa;color:#41516b}.copy-line-id-button:hover{background:#dfe8f7;color:var(--blue)}.quota-cell{text-align:left!important}.quota-cell small,.quota-cell strong{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.quota-cell small{color:var(--muted);font-size:11px}.quota-cell.exceeded strong{color:var(--red)}.admin-user-cell{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;grid-gap:10px;gap:10px}.line-profile-anchor{position:relative;display:inline-grid;place-items:center;width:34px;height:34px;overflow:visible}.admin-user-cell .avatar-fallback,.admin-user-cell img{width:34px;height:34px;border-radius:999px}.admin-user-cell img{object-fit:cover}.admin-user-cell .avatar-fallback{display:grid;place-items:center;background:var(--blue-soft);color:var(--blue);font-weight:800}.line-profile-tooltip{position:absolute;z-index:110;top:calc(100% + 9px);left:0;width:min(360px,72vw);padding:10px 12px;border-radius:8px;background:#172033;color:white;font-size:12px;line-height:1.55;text-align:left;white-space:pre-line;box-shadow:0 14px 35px rgba(17,24,39,.24);opacity:0;pointer-events:none;transform:translateY(-4px);transition:opacity .14s ease,transform .14s ease}.line-profile-tooltip:before{content:"";position:absolute;top:-5px;left:13px;width:10px;height:10px;background:#172033;transform:rotate(45deg)}.line-profile-anchor:focus-within .line-profile-tooltip,.line-profile-anchor:hover .line-profile-tooltip{opacity:1;transform:translateY(0)}.admin-user-cell small,.admin-user-cell strong{display:block;max-width:128px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.admin-user-cell small{color:var(--muted)}.modal-actions,.modal-header{display:flex;align-items:center;justify-content:space-between;gap:12px}.modal-header-actions{display:flex;align-items:center;gap:8px}.modal-header h3{margin:0}.modal-actions{justify-content:flex-end}.permission-table-wrap{overflow:visible;border:1px solid var(--line);border-radius:8px}.permission-table{width:100%;min-width:0;table-layout:fixed}.permission-col-feature,.permission-col-role{width:calc(100% / 6)}.permission-table td,.permission-table th{height:42px;text-align:center;vertical-align:middle;white-space:nowrap;line-height:1.15}.permission-table td:first-child,.permission-table th:first-child{text-align:left}.permission-table input[type=checkbox]{width:18px;height:18px;min-height:18px}.permission-table input[type=number]{width:76px;text-align:center}.quota-row td{background:#fbfcff;font-weight:700}.quota-row td:first-child{white-space:nowrap}.self-status-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));grid-gap:10px;gap:10px}.self-status-card{border:1px solid var(--line);border-radius:8px;padding:12px;display:grid;grid-gap:6px;gap:6px;background:#fbfcff;min-width:0}.self-status-card small,.self-status-card span{color:var(--muted);font-size:12px}.self-status-card strong{font-size:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.self-status-card.warning{border-color:#ffd7a1;background:#fff8eb}.role-status-value{display:flex;align-items:center;gap:8px;min-width:0}.role-status-value strong{overflow:visible;text-overflow:clip}.status-pill{flex:0 0 auto;border-radius:999px;padding:5px 8px;font-size:11px;line-height:1;font-style:normal;font-weight:800}.status-pill.active{background:#dcfce7;color:#087f5b}.status-pill.disabled{background:#e5e7eb;color:#64748b}.self-status-card.quota-card{grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:12px}.self-status-card.quota-card>span{grid-column:1}.quota-mini-list{grid-column:2;grid-row:1/span 2;display:grid;grid-gap:2px;gap:2px;justify-items:end;align-self:center}.quota-mini-list strong{font-size:13px;line-height:1.25;overflow:visible;text-overflow:clip;white-space:nowrap}.quota-note{padding:8px 10px;border:1px solid #ffd7a1;border-radius:7px;color:var(--amber);background:#fff8eb;font-size:13px}.resplit-options{display:grid;grid-gap:10px;gap:10px}.resplit-option{border:1px solid var(--line);border-radius:8px;padding:12px;display:grid;grid-template-columns:auto minmax(0,1fr);grid-gap:10px;gap:10px;align-items:start;cursor:pointer}.resplit-option.active{border-color:var(--blue);background:var(--blue-soft)}.resplit-option input{min-height:18px;margin-top:2px}.resplit-option span{display:grid;grid-gap:3px;gap:3px}.resplit-option small{color:var(--muted);line-height:1.4}.resplit-index-input{width:100%}@media (max-width:1050px){body{overflow:auto}.app-shell{grid-template-columns:1fr;min-height:100vh}.app-shell,.sidebar{height:auto;overflow:visible}.sidebar{min-height:auto}.session-list{flex:initial;max-height:none;overflow:visible}.main-panel{height:auto;overflow:visible}.stats-grid,.work-grid{grid-template-columns:1fr}.preview-column{height:auto;padding:0 24px 24px;overflow:visible}.preview-panel{min-height:640px}}