#cw-customer-register{--cr-bg:#f7f9f5;--cr-panel:#fff;--cr-soft:#f1f5ee;--cr-line:#dce5d8;--cr-text:#253228;--cr-muted:#6a786e;--cr-green:#2f7d24;--cr-green-soft:#e7f2e1;--cr-edit:#eaf4fb;--cr-edit-line:#b7d7e9;--cr-calc:#f1f3f0;--cr-source:#edf5e9;--cr-warning:#fff7dc;color:var(--cr-text)}#cw-customer-register *{box-sizing:border-box}#cw-customer-register button,#cw-customer-register input,#cw-customer-register select{font:inherit;color:inherit}.cr-page{position:relative}.cr-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:var(--cr-panel);border:1px solid var(--cr-line);border-radius:9px;margin-bottom:12px}.cr-summary>div{padding:12px 15px;border-right:1px solid var(--cr-line)}.cr-summary>div:last-child{border-right:0}.cr-summary small,.cr-summary span{display:block;color:var(--cr-muted);font-size:11px}.cr-summary strong{display:block;font-size:18px;font-weight:600;margin:3px 0;font-variant-numeric:tabular-nums}.cr-shell{border:1px solid var(--cr-line);border-radius:9px;background:var(--cr-panel);overflow:hidden}.cr-toolbar{min-height:50px;display:flex;align-items:center;gap:8px;padding:8px 10px;border-bottom:1px solid var(--cr-line);flex-wrap:wrap}.cr-toolbar>button,.cr-panel button,.cr-modal button{min-height:34px;padding:0 11px;border:1px solid var(--cr-line);border-radius:6px;background:var(--cr-panel);display:inline-flex;align-items:center;gap:6px;justify-content:center}.cr-toolbar>button:hover,.cr-panel button:hover,.cr-modal button:hover{background:var(--cr-soft)}.cr-toolbar svg,.cr-panel svg,.cr-modal svg{width:15px;height:15px}.cr-toolbar>button.selected{background:var(--cr-green-soft);color:var(--cr-green)}.cr-search{position:relative;display:block;flex:1 1 260px;min-width:220px;max-width:440px}.cr-search svg,.cr-modal-search svg{position:absolute;left:10px;top:9px;width:15px;height:15px;color:var(--cr-muted)}.cr-search input,.cr-modal-search input{width:100%;min-height:34px;border:1px solid var(--cr-line);border-radius:6px;padding:0 10px 0 33px;background:var(--cr-panel);outline:0}.cr-search input:focus,.cr-modal-search input:focus{border-color:var(--cr-green);box-shadow:0 0 0 2px rgba(47,125,36,.12)}.cr-legend{display:flex;align-items:center;gap:12px;margin-left:auto;color:var(--cr-muted);font-size:11px}.cr-legend span{display:flex;align-items:center;gap:5px;white-space:nowrap}.cr-legend i{width:10px;height:10px;border-radius:2px;border:1px solid var(--cr-line)}.cr-legend .edit{background:var(--cr-edit);border-color:var(--cr-edit-line)}.cr-legend .calc{background:var(--cr-calc)}.cr-legend .source{background:var(--cr-source)}.cr-grid-wrap{overflow:auto;max-width:100%;max-height:calc(100vh - 310px);min-height:360px}.cr-grid-wrap table{border-collapse:separate;border-spacing:0;width:max-content;min-width:100%;table-layout:fixed;font-size:12px}.cr-grid-wrap th,.cr-grid-wrap td{height:46px;padding:8px 9px;border-right:1px solid var(--cr-line);border-bottom:1px solid var(--cr-line);vertical-align:middle;overflow:hidden}.cr-grid-wrap th{position:sticky;top:0;z-index:12;height:48px;background:var(--cr-soft);color:var(--cr-muted);font-size:11px;font-weight:600;text-align:left;white-space:nowrap}.cr-grid-wrap th svg{width:11px;height:11px;margin-left:4px;vertical-align:-2px}.cr-grid-wrap .cr-frozen{position:sticky;left:0;z-index:8;background:var(--cr-panel);box-shadow:2px 0 0 rgba(166,180,161,.38)}.cr-grid-wrap th.cr-frozen{z-index:16;background:var(--cr-soft)}.cr-customer-row td{background:var(--cr-green-soft);font-weight:500}.cr-customer-row .cr-frozen{background:var(--cr-green-soft)}.cr-customer-cell{display:flex;align-items:center;gap:8px;min-width:0}.cr-customer-cell>span{min-width:0}.cr-customer-cell strong,.cr-customer-cell small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cr-customer-cell small{color:var(--cr-muted);font-size:10px;font-weight:400;margin-top:2px}.cr-toggle{width:25px;height:25px;border:0;background:transparent;color:var(--cr-green);padding:0;display:grid;place-items:center;flex:0 0 auto}.cr-toggle svg{width:15px;height:15px}.cr-add-inline{margin-left:auto;border:0;background:transparent;color:var(--cr-green);padding:4px;font-size:11px;white-space:nowrap}.cr-deal-row:hover td{filter:brightness(.985)}.cr-deal-name{padding-left:40px!important}.cr-deal-name button{border:0;background:transparent;text-align:left;padding:0;width:100%;color:var(--cr-green)}.cr-deal-name strong,.cr-deal-name small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cr-deal-name strong{font-weight:600}.cr-deal-name small{color:var(--cr-muted);font-size:10px;margin-top:2px}.cr-editable{background:var(--cr-edit)}.cr-source{background:var(--cr-source)}.cr-calculated{background:var(--cr-calc)}.cr-number{text-align:right;font-variant-numeric:tabular-nums}.cr-cell-control{width:100%;height:30px;border:0;background:transparent;outline:0;padding:0 2px;min-width:0}.cr-cell-control:focus{box-shadow:inset 0 -2px 0 var(--cr-green)}.cr-cell-control:disabled{color:var(--cr-muted);cursor:not-allowed}.cr-mixed{border:0;background:transparent;color:var(--cr-green);padding:0;text-align:left}.cr-pill{display:inline-flex;align-items:center;border-radius:999px;padding:3px 8px;background:var(--cr-green-soft);color:var(--cr-green);font-size:10px;text-transform:capitalize;white-space:nowrap}.cr-pill.neutral{background:var(--cr-calc);color:var(--cr-muted)}.cr-pill.draft{background:var(--cr-warning);color:var(--cr-text)}.cr-action{text-align:center}.cr-action>button{width:30px;height:30px;border:1px solid var(--cr-line);border-radius:6px;background:var(--cr-panel);display:grid;place-items:center;margin:auto}.cr-action svg{width:14px;height:14px}.cr-draft-row td{background:var(--cr-edit)}.cr-draft-row .cr-frozen{background:var(--cr-edit);padding-left:14px!important}.cr-draft-row small{display:block;color:var(--cr-muted);font-size:10px}.cr-save-draft{background:var(--cr-green)!important;color:#fff!important;border-color:var(--cr-green)!important;width:auto!important;padding:0 9px!important}.cr-empty{text-align:center;color:var(--cr-muted);height:180px!important}.cr-shell>footer{min-height:36px;padding:8px 12px;display:flex;justify-content:space-between;gap:12px;color:var(--cr-muted);font-size:11px;background:var(--cr-panel)}.cr-scrim{position:fixed;inset:0;z-index:80;background:rgba(20,31,22,.28);display:none}.cr-scrim.open{display:block}.cr-panel{position:fixed;right:0;top:0;bottom:0;z-index:81;width:min(430px,92vw);background:var(--cr-panel);border-left:1px solid var(--cr-line);box-shadow:-12px 0 34px rgba(25,44,27,.16);transform:translateX(102%);transition:transform .18s ease;display:flex;flex-direction:column}.cr-panel.open{transform:translateX(0)}.cr-panel header,.cr-modal header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:17px 18px;border-bottom:1px solid var(--cr-line)}.cr-panel h2,.cr-modal h2{font-size:18px;margin:0 0 4px}.cr-panel p,.cr-modal p{font-size:12px;color:var(--cr-muted);margin:0;line-height:1.45}.cr-panel header button,.cr-modal header button{width:34px;height:34px;padding:0}.cr-panel-body{padding:16px 18px;overflow:auto;flex:1}.cr-column-list{display:grid;grid-template-columns:1fr 1fr;gap:4px 12px}.cr-column-list label{display:flex;align-items:center;gap:8px;min-height:32px;font-size:12px}.cr-column-list input{accent-color:var(--cr-green)}.cr-panel>footer,.cr-modal>footer,.cr-modal form>footer{display:flex;justify-content:flex-end;gap:8px;padding:13px 18px;border-top:1px solid var(--cr-line)}.cr-modal{display:none;position:fixed;left:50%;top:50%;transform:translate(-50%,-48%);z-index:82;width:min(560px,92vw);max-height:86vh;background:var(--cr-panel);border:1px solid var(--cr-line);border-radius:10px;box-shadow:0 20px 70px rgba(20,35,22,.25);overflow:auto}.cr-modal.open{display:block}.cr-modal-body{padding:16px 18px}.cr-modal-search{position:relative;display:block;margin-bottom:12px}.cr-customer-list{display:grid;gap:7px;max-height:300px;overflow:auto}.cr-customer-list>button{width:100%;min-height:52px;justify-content:space-between;text-align:left}.cr-customer-list>button span{min-width:0}.cr-customer-list strong,.cr-customer-list small{display:block}.cr-customer-list strong{font-weight:600}.cr-customer-list small{font-size:11px;color:var(--cr-muted);margin-top:2px}.cr-new-customer{width:100%;margin-top:12px;border-style:dashed!important;color:var(--cr-green)!important}.cr-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:13px}.cr-form-grid label{display:grid;gap:5px;color:var(--cr-muted);font-size:11px}.cr-form-grid label.wide,.cr-form-grid .wide{grid-column:1/-1}.cr-form-grid input{width:100%;min-height:36px;border:1px solid var(--cr-line);border-radius:6px;padding:0 9px;background:var(--cr-panel);outline:0;color:var(--cr-text)}.cr-form-grid input:focus{border-color:var(--cr-green);box-shadow:0 0 0 2px rgba(47,125,36,.12)}.cr-form-error{color:#a33c32!important;min-height:16px}.cr-modal .primary{background:var(--cr-green)!important;color:#fff!important;border-color:var(--cr-green)!important}.cr-toast{position:fixed;right:24px;bottom:24px;z-index:100;background:var(--cr-text);color:#fff;border-radius:7px;padding:10px 14px;box-shadow:0 8px 24px rgba(0,0,0,.18);font-size:13px}.cr-toast.error{background:#a33c32}@media(max-width:820px){.cr-summary{grid-template-columns:repeat(2,minmax(0,1fr))}.cr-summary>div:nth-child(2){border-right:0}.cr-summary>div:nth-child(-n+2){border-bottom:1px solid var(--cr-line)}.cr-legend{width:100%;margin-left:0}.cr-column-list{grid-template-columns:1fr}.cr-grid-wrap{max-height:calc(100vh - 390px)}}
/* The reference register freezes its hierarchy controls and name as two
   separate columns. Important declarations keep the sticky header below the
   application drawer while preserving horizontal spreadsheet navigation. */
#cw-customer-register .cr-shell,#cw-customer-register .cr-grid-wrap{position:relative!important;z-index:0!important}
#cw-customer-register .cr-grid-wrap .cr-frozen-a{position:sticky!important;left:0!important;z-index:18!important;background:var(--cr-panel)!important}
#cw-customer-register .cr-grid-wrap .cr-frozen-b{position:sticky!important;left:52px!important;z-index:18!important;background:var(--cr-panel)!important;box-shadow:2px 0 0 rgba(166,180,161,.38)}
#cw-customer-register .cr-grid-wrap th.cr-frozen-a,#cw-customer-register .cr-grid-wrap th.cr-frozen-b{z-index:22!important;background:var(--cr-soft)!important}
#cw-customer-register .cr-customer-row .cr-frozen-a,#cw-customer-register .cr-customer-row .cr-frozen-b{background:var(--cr-green-soft)!important}
#cw-customer-register .cr-draft-row .cr-frozen-a,#cw-customer-register .cr-draft-row .cr-frozen-b{background:var(--cr-edit)!important}
#cw-customer-register .cr-row-open button{width:28px;height:28px;border:0;background:transparent;color:var(--cr-green);display:grid;place-items:center;padding:0}
#cw-customer-register .cr-row-open svg{width:14px;height:14px}
#cw-customer-register .cr-draft-row .cr-save-draft{font-size:10px;padding:0 5px!important;min-width:42px}
#cw-customer-register .cr-column-list{grid-template-columns:repeat(2,minmax(0,1fr))!important}
#cw-customer-register .cr-column-list label{min-width:0}
@media(max-width:820px){#cw-customer-register .cr-column-list{grid-template-columns:1fr!important}}
#cw-customer-register .cr-mixed{width:100%;display:flex;align-items:center;justify-content:space-between;gap:6px;color:var(--cr-green);cursor:pointer}
#cw-customer-register .cr-mixed svg{width:13px;height:13px;flex:0 0 auto}
#cw-customer-register .cr-delivery-modal{width:min(620px,92vw)}
#cw-customer-register .cr-delivery-edit-list{display:grid;gap:10px;max-height:55vh;overflow:auto}
#cw-customer-register .cr-delivery-edit-row{display:grid;grid-template-columns:minmax(180px,1fr) minmax(180px,1fr);align-items:center;gap:16px;padding:12px;border:1px solid var(--cr-line);border-radius:7px;background:var(--cr-soft)}
#cw-customer-register .cr-delivery-edit-row span,#cw-customer-register .cr-delivery-edit-row strong,#cw-customer-register .cr-delivery-edit-row small{display:block;min-width:0}
#cw-customer-register .cr-delivery-edit-row strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#cw-customer-register .cr-delivery-edit-row small{color:var(--cr-muted);font-size:10px;margin-top:3px}
#cw-customer-register .cr-delivery-edit-row .cr-cell-control{height:36px;border:1px solid var(--cr-line);border-radius:6px;background:#fff;padding:0 9px}
@media(max-width:620px){#cw-customer-register .cr-delivery-edit-row{grid-template-columns:1fr}}

/* Quiet spreadsheet treatment: hierarchy carries the structure while cells
   remain white. Editability is signalled by a fine underline and focus state,
   not permanent colour blocks. */
#cw-customer-register .cr-customer-row td{background:#f3f7f0!important;font-weight:500}
#cw-customer-register .cr-customer-row .cr-frozen-a,
#cw-customer-register .cr-customer-row .cr-frozen-b{background:#f3f7f0!important}
#cw-customer-register .cr-deal-row td,
#cw-customer-register .cr-delivery-row td,
#cw-customer-register .cr-deal-row .cr-frozen-a,
#cw-customer-register .cr-deal-row .cr-frozen-b,
#cw-customer-register .cr-delivery-row .cr-frozen-a,
#cw-customer-register .cr-delivery-row .cr-frozen-b,
#cw-customer-register .cr-editable,
#cw-customer-register .cr-source,
#cw-customer-register .cr-calculated{background:#fff!important}
#cw-customer-register .cr-deal-row td{border-top:1px solid #eef1ec}
#cw-customer-register .cr-delivery-row td{height:42px;color:#455149}
#cw-customer-register .cr-source,
#cw-customer-register .cr-calculated,
#cw-customer-register .cr-inherited{color:var(--cr-muted)}
#cw-customer-register .cr-editable{position:relative}
#cw-customer-register .cr-editable .cr-cell-control{border:0;border-bottom:1px dotted #aeb9af;border-radius:0;background:transparent;padding:0 3px;transition:border-color .12s,background .12s,box-shadow .12s}
#cw-customer-register .cr-editable:hover{background:#fafbf9!important}
#cw-customer-register .cr-editable:has(.cr-cell-control:not(:disabled)):hover::after{content:'✎';position:absolute;right:4px;top:3px;font-size:10px;color:#8a978d;pointer-events:none}
#cw-customer-register .cr-editable .cr-cell-control:focus{border-bottom-color:transparent;border-radius:4px;background:#fff;box-shadow:0 0 0 2px var(--cr-green)}
#cw-customer-register .cr-editable .cr-cell-control:disabled{border-bottom-color:transparent}
#cw-customer-register .cr-number .cr-cell-control{text-align:right;font-variant-numeric:tabular-nums}
#cw-customer-register input[type=number]{appearance:textfield;-moz-appearance:textfield}
#cw-customer-register input[type=number]::-webkit-inner-spin-button,
#cw-customer-register input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
#cw-customer-register .cr-deal-name{padding-left:22px!important}
#cw-customer-register .cr-delivery-name{padding-left:48px!important;position:relative}
#cw-customer-register .cr-delivery-name::before{content:'';position:absolute;left:29px;top:0;bottom:50%;width:12px;border-left:1px solid #cfd8ce;border-bottom:1px solid #cfd8ce;border-bottom-left-radius:5px}
#cw-customer-register .cr-name-editor{display:flex;align-items:center;gap:5px;min-width:0}
#cw-customer-register .cr-name-editor>span{display:block;min-width:0;flex:1}
#cw-customer-register .cr-name-editor small{display:flex;align-items:center;gap:7px;color:var(--cr-muted);font-size:10px;margin-top:1px;white-space:nowrap;overflow:hidden}
#cw-customer-register .cr-name-editor small>span{overflow:hidden;text-overflow:ellipsis}
#cw-customer-register .cr-open-record{width:23px;height:23px;border:0;background:transparent;color:var(--cr-muted);padding:0;display:grid;place-items:center;opacity:0;transition:opacity .12s}
#cw-customer-register .cr-name-editor:hover .cr-open-record,
#cw-customer-register .cr-open-record:focus{opacity:1}
#cw-customer-register .cr-open-record svg{width:13px;height:13px}
#cw-customer-register .cr-deal-toggle{margin-left:8px}
#cw-customer-register .cr-delivery-open button{margin-left:18px;color:var(--cr-muted)}
#cw-customer-register .cr-deal-summary{color:var(--cr-muted)}
#cw-customer-register .cr-period{margin-left:auto;display:flex;align-items:flex-end;gap:6px}
#cw-customer-register .cr-period>span{align-self:center;color:var(--cr-muted);font-size:10px;white-space:nowrap}
#cw-customer-register .cr-period label{display:grid;gap:2px;color:var(--cr-muted);font-size:10px}
#cw-customer-register .cr-period input,
#cw-customer-register .cr-period select{height:34px;border:1px solid var(--cr-line);border-radius:6px;background:#fff;padding:0 8px;outline:0}
#cw-customer-register .cr-period input:focus,
#cw-customer-register .cr-period select:focus{border-color:var(--cr-green);box-shadow:0 0 0 2px rgba(47,125,36,.12)}
#cw-customer-register .cr-draft-row td,
#cw-customer-register .cr-draft-row .cr-frozen-a,
#cw-customer-register .cr-draft-row .cr-frozen-b{background:#fffdf5!important}
#cw-customer-register .cr-add-delivery{border:0;background:transparent;color:var(--cr-green);padding:3px 4px;font-size:10px;line-height:1.2;white-space:nowrap;opacity:.72}
#cw-customer-register .cr-add-delivery:hover,
#cw-customer-register .cr-add-delivery:focus{opacity:1;text-decoration:underline;text-underline-offset:2px}
#cw-customer-register .cr-delivery-draft-row td,
#cw-customer-register .cr-delivery-draft-row .cr-frozen-a,
#cw-customer-register .cr-delivery-draft-row .cr-frozen-b{background:#fffdf5!important}
#cw-customer-register .cr-new-delivery-branch{display:grid;place-items:center;width:22px;height:22px;margin-left:18px;border:1px dashed #9dac9c;border-radius:50%;color:var(--cr-green);font-weight:600}
#cw-customer-register .cr-delivery-draft-name{display:grid;gap:5px}
#cw-customer-register .cr-delivery-draft-actions{display:flex;gap:5px;align-items:center}
#cw-customer-register .cr-delivery-draft-actions button{min-height:24px;padding:0 7px;border:1px solid var(--cr-line);border-radius:5px;background:#fff;font-size:10px}
#cw-customer-register .cr-delivery-draft-actions button.primary{border-color:var(--cr-green);background:var(--cr-green);color:#fff}
@media(max-width:980px){#cw-customer-register .cr-period{width:100%;margin-left:0;justify-content:flex-end}}

/* User-arranged columns and invoice detail rows. */
#cw-customer-register th.cr-draggable{cursor:grab;user-select:none}
#cw-customer-register th.cr-draggable>svg{width:12px;height:12px;margin:0 5px 0 0;color:#9aa69c;vertical-align:-2px}
#cw-customer-register th.cr-draggable.dragging{opacity:.45}
#cw-customer-register th.cr-draggable.drag-target{box-shadow:inset 3px 0 0 var(--cr-green)}
#cw-customer-register th.cr-draggable:focus-visible{outline:2px solid var(--cr-green);outline-offset:-2px}
#cw-customer-register .cr-invoice-row td{height:38px!important;background:#fbfcfa!important;color:var(--cr-muted);font-size:11px}
#cw-customer-register .cr-invoice-row .cr-frozen-a,
#cw-customer-register .cr-invoice-row .cr-frozen-b{background:#fbfcfa!important}
#cw-customer-register .cr-invoice-name{padding-left:68px!important;position:relative}
#cw-customer-register .cr-invoice-name:before{content:'';position:absolute;left:47px;top:0;bottom:50%;width:12px;border-left:1px solid #d7ded5;border-bottom:1px solid #d7ded5;border-bottom-left-radius:5px}
#cw-customer-register .cr-invoice-name span,
#cw-customer-register .cr-invoice-name small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#cw-customer-register .cr-invoice-name small{font-size:9px;color:#879289;margin-top:1px}
#cw-customer-register .cr-invoice-modal{width:min(620px,94vw)}
#cw-customer-register .cr-invoice-customers{max-height:210px;padding-bottom:12px;border-bottom:1px solid var(--cr-line)}
#cw-customer-register .cr-invoice-customers>button.selected{border-color:#9fc093;background:var(--cr-green-soft)}
#cw-customer-register .cr-invoice-selection{margin-top:14px}
#cw-customer-register .cr-invoice-selection select{width:100%;min-height:36px;border:1px solid var(--cr-line);border-radius:6px;background:#fff;padding:0 9px}
#cw-customer-register .cr-change-request-modal{width:min(680px,94vw)}
#cw-customer-register .cr-change-request-list{display:grid;gap:10px;max-height:62vh;overflow:auto}
#cw-customer-register .cr-change-request{display:grid;gap:10px;padding:14px;border:1px solid var(--cr-line);border-radius:8px;background:#fff}
#cw-customer-register .cr-change-request strong,#cw-customer-register .cr-change-request small{display:block}
#cw-customer-register .cr-change-request small{margin-top:3px;color:var(--cr-muted);font-size:10px}
#cw-customer-register .cr-change-request ul{display:flex;gap:6px;flex-wrap:wrap;margin:0;padding:0;list-style:none}
#cw-customer-register .cr-change-request li{padding:3px 7px;border-radius:999px;background:var(--cr-warning);font-size:10px}
#cw-customer-register .cr-change-request>div:last-child{display:flex;justify-content:flex-end;gap:7px}
