.notebook-launch{position:fixed;right:14px;bottom:18px;z-index:44;display:flex;align-items:center;gap:8px;padding:11px 14px;min-height:44px;background:var(--action);color:#fff;border:1px solid var(--focus);border-radius:12px;font-size:.875rem;font-weight:600;box-shadow:var(--lift-shadow)}
body:has(dialog[open]) .notebook-launch{display:none}.notebook-open body{overflow:hidden}
dialog.notebook-drawer{position:fixed;inset:8px 8px 8px auto;margin:0;width:min(416px,calc(100vw - 16px));height:min(740px,calc(100dvh - 16px));max-height:calc(100dvh - 16px);padding:0;border:1px solid var(--line);border-left:5px solid var(--accent);border-radius:12px 4px 4px 12px;background:var(--white);color:inherit;overflow:hidden;box-shadow:-8px 8px 40px #00000020}
.notebook-drawer[open]{display:flex;flex-direction:column}.notebook-drawer::backdrop{background:#14271d24;backdrop-filter:none}.notebook-drawer [hidden]{display:none!important}
.notebook-drawer button{font-family:inherit;color:inherit}.notebook-drawer .icon{width:17px;height:17px;flex-shrink:0}.notebook-drawer button:disabled{opacity:.4;cursor:default}
.nb-head{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:6px 8px 6px 12px;background:var(--action-soft);flex:none}.nb-head h2{display:flex;align-items:center;gap:7px;font-size:1.0625rem;line-height:1.3;margin:0;font-weight:650;letter-spacing:-.02em}.nb-head small{font-size:.75rem;line-height:1.4;color:var(--muted);display:block}
.notebook-drawer .nb-icon{display:grid;place-items:center;width:44px;min-width:44px;min-height:44px;background:transparent;border:0;border-radius:8px;padding:8px}.notebook-drawer [data-nb=prev] .icon,.notebook-drawer [data-nb=back] .icon{transform:rotate(180deg)}
.nb-date-nav{display:flex;align-items:center;justify-content:space-between;flex:none;border-bottom:1px solid var(--line)}.notebook-drawer .nb-date{min-height:44px;display:flex;align-items:center;justify-content:center;gap:8px;font-size:1rem;font-weight:600;padding:4px 0;background:transparent;border:0;min-width:0}.nb-date .icon{color:var(--muted);width:15px}
.nb-scroll{overflow:auto;overscroll-behavior:contain;min-height:0;flex:1}.nb-list-heading{display:flex;justify-content:space-between;gap:8px;padding:5px 12px;border-bottom:1px solid var(--line);color:var(--muted);font-size:.75rem;line-height:1.4}.nb-sales{list-style:none;padding:0 9px;margin:0}.nb-sales li{padding:0;margin:0}
.notebook-drawer .nb-row{width:100%;min-height:44px;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;align-items:center;padding:3px 2px;background:var(--white);border:0;border-bottom:1px solid var(--line);border-radius:0;text-align:left}.nb-row-main{min-width:0}.nb-row-main strong{display:block;font-size:.875rem;font-weight:600;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.nb-row-main small{display:block;font-size:.75rem;line-height:1.3;color:var(--muted);white-space:normal;overflow-wrap:anywhere}.nb-note-dot{color:var(--action-ink);font-size:.75rem}.nb-money{text-align:right;min-width:60px;align-self:start}.nb-money b{display:block;font-size:.875rem;font-weight:600;line-height:1.2;font-variant-numeric:tabular-nums}.nb-money small{display:block;font-size:.75rem;line-height:1.3;color:var(--muted)}.nb-money .nb-credit{color:var(--action-ink)}.nb-empty{padding:30px 12px!important;text-align:center;color:var(--muted);font-size:.875rem}
.nb-totals{padding:8px 12px;border-bottom:1px solid var(--line)}.nb-totals>div{display:flex;justify-content:space-between;align-items:baseline;gap:8px;font-size:.875rem;line-height:1.4}.nb-totals strong{font-size:1rem;font-weight:650;white-space:nowrap}.nb-totals .nb-secondary{font-size:.75rem;color:var(--muted);margin-top:2px}.nb-secondary b{font-weight:500;white-space:nowrap;color:inherit}.nb-extra{font-size:.75rem;color:var(--muted);margin-top:6px}.nb-extra summary{min-height:32px;padding:7px 0;cursor:pointer}.nb-extra p{margin:6px 0;line-height:1.5}
.notebook-drawer .nb-day-note{display:flex;align-items:center;gap:8px;min-height:44px;width:100%;padding:8px 12px;background:transparent;border:0;border-bottom:1px solid var(--line);text-align:left;font-size:.875rem}.nb-day-note small{margin-left:auto;color:var(--muted);font-size:.75rem}.nb-day-note .icon{width:15px}.nb-sync{padding:6px 12px;font-size:.75rem;line-height:1.4;color:var(--muted)}
.nb-calendar{padding:10px 12px;background:var(--action-soft);flex:none}.nb-calendar label,.nb-editor label{display:block;font-size:.875rem;font-weight:600;margin-bottom:6px}.nb-calendar>div{display:flex;gap:7px;flex-wrap:wrap}.nb-calendar input{font-family:inherit;min-width:0;flex:1 1 140px;font-size:1rem;min-height:44px;border:1px solid var(--line);border-radius:7px;padding:6px;background:var(--white);color:inherit}.nb-calendar .btn{padding:8px 10px;min-height:44px}
.nb-editor{padding:4px 12px 12px}.nb-edit-heading{display:flex;align-items:center;gap:4px;margin-left:-6px;margin-bottom:10px}.nb-edit-heading h3{font-size:.9375rem;line-height:1.4}.nb-detail,.nb-comparison{padding:12px;background:var(--action-soft);border-radius:8px;margin-bottom:16px;font-size:.875rem}.nb-detail>strong{font-size:1rem}.nb-detail p,.nb-comparison p{margin:6px 0;line-height:1.5;overflow-wrap:anywhere;white-space:pre-wrap}.nb-detail>div{display:flex;justify-content:space-between;gap:8px;margin-top:10px}.nb-editor textarea{font-family:inherit;display:block;width:100%;min-width:0;resize:vertical;background:var(--white);color:inherit;border:1px solid var(--line);border-radius:8px;padding:8px;font-size:1rem;line-height:1.5}.nb-muted{font-size:.8125rem;color:var(--muted);line-height:1.5;margin:10px 0}.nb-error{font-size:.875rem;color:var(--danger,#a94a39);line-height:1.5;white-space:pre-wrap}.nb-error:empty{display:none}.nb-edit-actions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap;margin-top:16px}.nb-editor .btn{min-height:44px;white-space:normal}.nb-editor .btn.primary,.nb-calendar .btn.primary{color:#fff}
@media(max-width:360px){.nb-head{padding-left:8px}.notebook-drawer .nb-date{font-size:.9375rem}.nb-row-main strong{font-size:.875rem}.nb-totals{padding-left:10px;padding-right:10px}.nb-totals .nb-secondary{gap:6px}}
@media(prefers-reduced-motion:no-preference){.notebook-drawer[open]{animation:nb-arrive 320ms cubic-bezier(.22,1,.36,1)}@keyframes nb-arrive{from{opacity:.6;transform:translateX(36px)}to{opacity:1;transform:translateX(0)}}}
@media print{.notebook-launch,.notebook-drawer{display:none!important}}

.notebook-drawer{--nb-unpaid-bg:#fff4db;--nb-unpaid-ink:#794500;--nb-unpaid-edge:#c17a0d;--nb-returned-ink:#ba2222;--nb-exchanged-ink:#185dba}
[data-theme=dark] .notebook-drawer{--nb-unpaid-bg:#3b2b12;--nb-unpaid-ink:#ffd38a;--nb-unpaid-edge:#e9ad43;--nb-returned-ink:#ff7777;--nb-exchanged-ink:#8abbff}
.notebook-drawer .nb-row.nb-unpaid{background:var(--nb-unpaid-bg);border-left:3px solid var(--nb-unpaid-edge);padding-left:7px;color:var(--nb-unpaid-ink)}
.nb-row.nb-unpaid .nb-row-main small,.nb-row.nb-unpaid .nb-money small{color:var(--nb-unpaid-ink)}
.notebook-drawer .nb-detail.nb-unpaid{background:var(--nb-unpaid-bg);border-left:3px solid var(--nb-unpaid-edge);color:var(--nb-unpaid-ink)}

.nb-sales .nb-sale-entry{display:grid;grid-template-columns:minmax(0,1fr) 52px;align-items:stretch}.notebook-drawer .nb-sale-note{border-bottom:1px solid var(--line);border-radius:0;color:var(--action-ink)}

.nb-sales .nb-sale-entry{border-bottom:1px solid var(--line)}
.notebook-drawer .nb-sale-entry>.nb-row,.notebook-drawer .nb-sale-entry>.nb-sale-note{border-bottom:0}
.nb-sale-entry>.sale-attribution{grid-column:1/-1;padding:0 2px;margin:0}
.nb-sale-entry>.sale-attribution>summary{min-height:28px;padding:3px 0}
.nb-sale-entry>.sale-attribution>ol>li{padding:7px 2px}
.nb-detail .sale-attribution{margin-top:4px}

/* Dates and operators live in Historial; daily rows keep only sale essentials. */
.notebook-drawer .nb-date{font-size:.875rem;gap:6px}
.notebook-drawer .date-stamp,.notebook-drawer .date-item{font-size:.75rem;line-height:1.3}
.notebook-drawer .nb-row{padding-top:2px;padding-bottom:2px}
.notebook-drawer .nb-detail{padding:10px;margin-bottom:10px}
.notebook-drawer .nb-detail>.record-dates{margin:3px 0;gap:0 8px}
.notebook-drawer .nb-detail p{margin:4px 0}

.nb-top-tools{display:flex;flex:none}.notebook-drawer .nb-top-tools .nb-icon{width:36px;min-width:36px;padding:8px}.nb-top-tools .icon{width:18px;height:18px}.nb-head>div:first-child{min-width:0}.nb-head h2{overflow-wrap:anywhere}

/* Highlight only the returned status label. */
.notebook-drawer .nb-return-status{color:var(--nb-returned-ink);font-weight:700}
.notebook-drawer .nb-product-marks{display:inline-flex;align-items:baseline;flex-wrap:wrap;gap:2px 5px;margin-left:5px;vertical-align:baseline;font-size:.6875rem;font-weight:650}
.notebook-drawer .nb-product-marks>*{display:inline-flex;align-items:center;gap:3px;margin:0;font-size:inherit;line-height:inherit}
.notebook-drawer .nb-product-marks .nb-product-returned{color:var(--nb-returned-ink)}
.notebook-drawer .nb-product-marks .nb-product-exchanged{color:var(--nb-exchanged-ink)}

.nb-clients{padding:4px 12px;border-bottom:1px solid var(--line);flex:none}.notebook-drawer .nb-clients .btn{font-size:.8125rem;min-height:36px;padding:5px 9px}.notebook-drawer .nb-history-link{margin-left:auto;background:transparent;border:0;color:var(--action-ink);font-size:.75rem;text-decoration:underline;min-height:28px;padding:3px 4px;cursor:pointer}

/* Note and history share the side column instead of adding a metadata row. */
.nb-sale-actions{display:flex;flex-direction:column;align-items:center;justify-content:center;min-width:0}
.notebook-drawer .nb-sale-actions .nb-sale-note{min-height:32px;padding:6px;border-bottom:0}
.notebook-drawer .nb-sale-actions .nb-history-link{margin:0;min-height:24px;padding:3px 2px;font-size:.6875rem;line-height:1.3}

/* Horizontal gestures leave the normal vertical list and pinch zoom available. */
.nb-day,.nb-date-nav{touch-action:pan-y pinch-zoom}
.nb-dragging,.nb-dragging *{user-select:none;-webkit-user-select:none}
.nb-clients{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.nb-swipe-hint{font-size:.6875rem;color:var(--muted);line-height:1.3}
.nb-debt-payments{font-size:.75rem;line-height:1.4;color:var(--muted);margin:2px 0}
.nb-debt-payments>summary{display:flex;align-items:center;gap:6px;min-height:36px;padding:4px 0;cursor:pointer;list-style:none}
.nb-debt-payments>summary::-webkit-details-marker{display:none}
.nb-debt-payments>summary::before{content:'';width:5px;height:5px;border-right:1px solid currentColor;border-bottom:1px solid currentColor;transform:rotate(-45deg);flex:none;margin-right:2px}
.nb-debt-payments[open]>summary::before{transform:rotate(45deg)}
.nb-debt-payments>summary>span{min-width:0;flex:1}
.nb-debt-payments b{font-weight:500;white-space:nowrap;font-variant-numeric:tabular-nums}
.nb-debt-payments>p{margin:0 0 5px;font-size:.6875rem}
.nb-debt-payments>ol{list-style:none;margin:0 0 6px;padding:0;max-height:230px;overflow:auto;overscroll-behavior:contain}
.nb-debt-payments li+li{border-top:1px solid var(--line)}
.notebook-drawer .nb-debt-payments button{display:flex;align-items:flex-start;justify-content:space-between;gap:8px;width:100%;min-height:44px;padding:7px 2px;text-align:left;background:transparent;border:0;font-size:.75rem;cursor:pointer}
.nb-debt-payments button>span{min-width:0;overflow-wrap:anywhere}
.nb-debt-payments button strong{display:block;font-size:.75rem;font-weight:600;white-space:normal}
.nb-debt-payments button small{display:block;font-size:.6875rem}
.notebook-drawer .nb-debt-payments .date-item,.notebook-drawer .nb-debt-payments .date-stamp{font-size:.6875rem}
@media(prefers-reduced-motion:no-preference){.notebook-drawer .nb-icon,.notebook-drawer .nb-row{transition:background-color 160ms ease}.notebook-drawer .nb-icon:active:not(:disabled){background:var(--action-soft);transform:scale(.94)}}

/* Compact partial receipt: paid first, remainder directly below. */
.nb-money .partial-payment-mark{display:grid;gap:1px;font-size:.6875rem;font-weight:400;line-height:1.2;font-variant-numeric:tabular-nums}
.nb-money .partial-payment-mark>span{display:block;white-space:nowrap}

/* Daily account filters retain the day totals and keep the list compact. */
.nb-query{padding:7px 12px 0;flex:none}.nb-query input{display:block;width:100%;min-width:0;min-height:44px;padding:8px 10px;border:1px solid var(--line);border-radius:8px;background:var(--white);color:inherit;font:inherit;font-size:1rem}
.nb-filters{display:flex;gap:4px;padding:6px 12px;border-bottom:1px solid var(--line);flex:none}.nb-filters button{min-height:44px;padding:7px 10px;border:1px solid transparent;border-radius:8px;background:transparent;font-size:.75rem;line-height:1.3;white-space:nowrap}.nb-filters button[aria-pressed=true]{background:var(--action-soft);border-color:var(--line);color:var(--action-ink);font-weight:650}.nb-filter-note{display:block;color:var(--muted);font-size:.6875rem;line-height:1.4;margin-bottom:4px}

/* Existing notes get a gentle signal; the ordinary edit controls stay still. */
.notebook-drawer{--nb-note-signal-ink:#194f37;--nb-note-signal-bg:#e3f0df;--nb-note-signal-highlight:#765000;--nb-note-signal-glow:#ffdea2}
[data-theme=dark] .notebook-drawer{--nb-note-signal-ink:#d3f4dc;--nb-note-signal-bg:#244d37;--nb-note-signal-highlight:#ffe3ad;--nb-note-signal-glow:#664719}
.notebook-drawer .nb-note-dot,.notebook-drawer .nb-day-note .nb-note-indicator{display:inline-block;padding:0 2px;color:var(--nb-note-signal-ink);font-size:.65rem;font-weight:650}
.notebook-drawer .nb-note-dot{display:block;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.35}
@media(prefers-reduced-motion:no-preference){.notebook-drawer .nb-note-dot,.notebook-drawer .nb-day-note .nb-note-indicator{animation:nb-note-signal 3.6s ease-in-out infinite}@keyframes nb-note-signal{0%,100%{opacity:1}50%{opacity:.75}}}
