.scanner-module, .client-capture-bar { --capture-warning-background: #FFF3DF; --capture-warning-accent: #B5741B; }
.capture-workspace { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.capture-toolbar { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.reference-form { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.reference-field { position: relative; flex: 1; min-width: 230px; }
.reference-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px; color: #64748b; background: currentColor; -webkit-mask: url("../../assets/icons/barcode-lines.svg") center / contain no-repeat; mask: url("../../assets/icons/barcode-lines.svg") center / contain no-repeat; pointer-events: none; }
#reference-input { height: 52px; min-height: 52px; padding: 12px 48px 12px 14px; font-family: Consolas, monospace; font-size: 16px; color: #1e293b; background: white; border: 1px solid #cbd5e1; border-radius: 10px; box-shadow: 0 1px 2px #0000000d; }
.reference-field:has(.reference-clear:not([hidden])) #reference-input { padding-right: 94px; }
.reference-clear { position: absolute; right: 44px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #64748b; }
.reference-clear:hover { color: #00685b; background: #ecfdf5; }
.reference-clear:disabled { opacity: .5; }
.reference-clear > span { width: 20px; height: 20px; background: currentColor; -webkit-mask: url("../../assets/icons/x.svg") center / contain no-repeat; mask: url("../../assets/icons/x.svg") center / contain no-repeat; }
#reference-input::placeholder { color: #64748b; font-family: Inter, Arial, sans-serif; font-size: 14px; }
#reference-input:focus { border-color: #00685b; }
#reference-input:focus-visible { outline: 1px solid #00685b; outline-offset: 1px; box-shadow: 0 0 0 3px #00685b18; }
#reference-input.capture-warning { border-color: var(--capture-warning-accent); background: var(--capture-warning-background); }
#reference-input.capture-warning:focus-visible { outline: 2px solid var(--capture-warning-accent); outline-offset: 1px; box-shadow: none; }
.scanner-module .button { min-height: 36px; padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 12px; font-weight: 600; line-height: 18px; color: #475569; white-space: nowrap; background: white; box-shadow: none; }
.scanner-module .button:hover { background: #f8fafc; color: #047857; border-color: #6ee7b7; }
.scanner-module .button.primary { background: #059669; border-color: #059669; color: white; box-shadow: 0 1px 2px #0000000d; }
.scanner-module .button.primary:hover { background: #047857; border-color: #047857; color: white; }
.scanner-module .button.review, .scanner-module .button.review:hover { background: var(--capture-warning-background); border-color: var(--capture-warning-accent); color: #92400e; }
.scanner-module .button.danger { color: #dc2626; border-color: #fecaca; }
.scanner-module .button.danger:hover { color: #b91c1c; background: #fef2f2; border-color: #fca5a5; }
.scanner-module .button:disabled { opacity: .5; }
.capture-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.scanner-module .capture-global-trigger { width: 44px; min-width: 44px; height: 52px; min-height: 52px; padding: 0; font-size: 24px; }
.scanner-module #save-capture { min-height: 52px; padding: 12px 20px; border-radius: 10px; font-size: 14px; }
.capture-table-scroll { flex: 1; min-height: 0; overflow: auto; }
.capture-table-scroll:focus-visible { outline: 2px solid #10b981; outline-offset: -2px; }
.capture-table-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.capture-table-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.capture-table { width: 100%; min-width: 760px; border-collapse: collapse; text-align: left; }
.capture-table thead { position: sticky; top: 0; z-index: 1; background: #f1f5f9; }
.capture-table th { padding: 12px 16px; border-bottom: 1px solid #e2e8f0; color: #475569; font-size: 11px; font-weight: 600; letter-spacing: .05em; line-height: 16.5px; text-transform: uppercase; white-space: nowrap; }
.capture-table td { padding: 12px 16px; height: 56px; border-bottom: 1px solid #e2e8f0; color: #334155; font-size: 12px; line-height: 16px; white-space: nowrap; }
.capture-table .entry-number { width: 42px; color: #64748b; }
.capture-table .selection-column { width: 52px; padding: 4px; text-align: center; }
.capture-checkbox { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; cursor: pointer; vertical-align: middle; }
.capture-checkbox input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; margin: 0; padding: 0; accent-color: #00685b; cursor: pointer; }
.capture-checkbox:has(input:disabled) { cursor: default; opacity: .5; }
.capture-table .reference-value { font-family: Consolas, monospace; font-size: 12px; letter-spacing: 0; line-height: 1.5; }
.capture-table .entry-rpu, .capture-table .entry-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.capture-table .amount-column, .capture-table .entry-amount { text-align: right; }
.capture-table .actions-column { text-align: center; }
.capture-entry { cursor: pointer; touch-action: manipulation; }
.capture-entry:focus-visible { outline: 2px solid #00685b; outline-offset: -2px; }
.capture-entry:hover { background: #ecfdf566; }
.capture-entry.conflict { background: #fff1f2; }
.capture-entry.conflict td:first-child { box-shadow: inset 3px 0 #e11d48; }
.capture-entry.selected { background: #e0f2fe; }
.capture-entry.selected td { border-bottom-color: #bae6fd; }
.capture-entry.duplicate-highlight { background: var(--capture-warning-background); }
.capture-entry.duplicate-highlight td { border-top: 2px solid var(--capture-warning-accent); border-bottom: 2px solid var(--capture-warning-accent); }
.capture-entry.duplicate-highlight.selected .selection-column { background: #e0f2fe; }
.entry-state { display: inline-block; border: 1px solid #e2e8f0; border-radius: 6px; padding: 3px 7px; color: #64748b; background: #f8fafc; font-size: 11px; font-weight: 500; }
.conflict-label { color: #be123c; border-color: #fecdd3; background: #ffe4e6; }
.correct-label { color: #065f46; border-color: #a7f3d0; background: #d1fae5; }
.review-label { color: #92400e; border-color: #fcd34d; background: #fef3c7; }
.entry-actions { display: flex; justify-content: center; gap: 4px; }
.scanner-module .entry-action { width: 32px; min-height: 32px; height: 32px; padding: 0; display: inline-grid; place-items: center; border: 1px solid #e2e8f0cc; background: #f1f5f9bf; border-radius: 8px; color: #64748b; font-size: 14px; }
.scanner-module .entry-action:hover, .scanner-module .entry-action[aria-expanded="true"] { background: #d1fae5; color: #047857; }
.entry-menu { position: fixed; inset: auto; margin: 0; min-width: 144px; max-width: calc(100vw - 16px); padding: 4px; border: 1px solid #e2e8f0; border-radius: 8px; background: white; color: #334155; box-shadow: 0 8px 24px #0f172a26; }
.entry-menu button { display: block; width: 100%; min-height: 36px; padding: 8px 12px; border: 0; border-radius: 4px; background: transparent; color: inherit; text-align: left; font: 500 12px/20px Inter, Arial, sans-serif; }
.entry-menu button:hover, .entry-menu button:focus-visible { background: #ecfdf5; color: #065f46; }
.entry-menu .entry-remove { color: #be123c; }
.entry-menu .entry-remove:hover, .entry-menu .entry-remove:focus-visible { background: #fff1f2; color: #9f1239; }
.entry-menu button:disabled, .entry-menu button:disabled:hover { color: #94a3b8; background: transparent; cursor: default; }
.entry-action:disabled { opacity: .4; }
.capture-empty { display: flex; align-items: flex-start; gap: 12px; padding: 24px 16px; color: #94a3b8; }
.capture-empty > i { font-size: 22px; }
.capture-empty h2 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: #475569; }
.capture-empty p { margin: 0; max-width: 400px; font-size: 12px; color: #64748b; line-height: 1.6; }
.capture-footer p { margin: 0; max-width: 440px; font-size: 11px; color: #64748b; line-height: 1.5; }
.capture-footer .capture-footer-state { display: flex; align-items: baseline; gap: 6px; min-width: 0; color: #00685b; font-weight: 600; overflow-wrap: anywhere; }
.capture-footer-state > [aria-hidden] { flex: none; }
.capture-footer .capture-footer-state.warning { color: var(--capture-warning-accent); }
.capture-footer .capture-footer-state.error { color: #be123c; }
.scanner-module dialog { border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; font-family: Inter, Arial, sans-serif; color: #334155; box-shadow: 0 25px 50px -12px #0f172a40; }
.scanner-module dialog::backdrop { background: #0f172a66; }
.scanner-module dialog h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
.scanner-module dialog .eyebrow { font-size: 10px; letter-spacing: .08em; color: #047857; margin-bottom: 6px; }
.scanner-module dialog .muted { font-size: 12px; line-height: 1.6; }
.details-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #e2e8f0; margin: -20px -20px 16px; padding: 16px 20px 4px; background: #f8fafc; }
.details-dismiss { display: grid; place-items: center; flex: none; align-self: flex-start; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #64748b; }
.details-dismiss:hover { color: #00685b; background: #ecfdf5; }
.details-dismiss > span { width: 24px; height: 24px; background: currentColor; -webkit-mask: url("../../assets/icons/x.svg") center / contain no-repeat; mask: url("../../assets/icons/x.svg") center / contain no-repeat; }
.details-entry-actions { display: none; }
.scanner-module dialog .reference-value { font-family: Consolas, monospace; overflow-wrap: anywhere; border: 1px solid #e2e8f0; background: #f8fafc; padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.7; }
.details-data { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 16px; padding: 12px 0; margin: 0; }
.details-data dt { color: #64748b; font-size: 11px; margin-bottom: 6px; }
.details-data dd { margin: 0; font-size: 13px; font-weight: 600; }
.scanner-module .dialog-actions { border-top: 1px solid #e2e8f0; padding-top: 16px; margin-top: 16px; gap: 8px; }
@media (max-width: 900px) {
  .client-compact-bar.client-capture-bar { gap: 0; background: white; }
  .client-capture-bar .client-sidebar-open { width: 52px; height: 52px; background: white; color: #00685b; border: 1px solid #cbd5e1; border-right: 0; border-radius: 10px 0 0 10px; }
  .client-capture-bar .client-sidebar-open:hover { background: #ecfdf5; }
  .client-capture-bar #reference-input { border-left: 0; border-radius: 0 10px 10px 0; box-shadow: none; }
  .client-capture-bar #reference-input:focus-visible { outline: 0; box-shadow: none; }
  .client-capture-bar:has(#reference-input:focus-visible) .client-sidebar-open { border-color: #00685b; }
  .client-capture-bar:has(#reference-input.capture-warning) .client-sidebar-open { border-color: var(--capture-warning-accent); }
  .client-capture-bar .client-compact-context { display: none; }
  .client-capture-bar .client-compact-capture { display: flex; flex: 1; min-width: 0; }
  .client-capture-bar .reference-form { width: 100%; }
  .capture-toolbar { order: 0; padding: 12px; }
  .reference-field { min-width: 0; }
  #reference-input { height: 52px; min-height: 52px; }
  #reference-input::placeholder { font-size: 14px; }
  .capture-toolbar-actions { width: 100%; }
  .scanner-module #save-capture { flex: 1; min-width: 0; }
  .capture-table-scroll { order: 2; overflow-x: hidden; overscroll-behavior: contain; }
  .capture-table { display: block; min-width: 0; }
  .capture-table thead { display: none; }
  .selection-mode .capture-table thead { display: block; }
  .capture-table thead tr { display: block; }
  .capture-table thead th:not(.selection-column) { display: none; }
  .capture-table thead .selection-column { display: flex; align-items: center; width: 100%; padding: 4px 10px; text-transform: none; letter-spacing: 0; }
  .capture-table thead .selection-column::after { content: 'Seleccionar todo'; }
  .capture-table tbody { display: block; }
  .capture-table .capture-entry { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 6px; padding: 14px 12px; border-bottom: 1px solid #e2e8f0; }
  .capture-table .capture-entry td { min-width: 0; height: auto; width: auto; padding: 0; border: 0; white-space: normal; }
  .capture-table .entry-number { grid-column: 1; grid-row: 1; align-self: center; color: #64748b; font-size: 11px; }
  .capture-table .entry-rpu { grid-column: 2; grid-row: 1; color: #1e293b; font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }
  .capture-table .entry-amount { grid-column: -2 / -1; grid-row: 1; color: #1e293b; font-size: 15px; line-height: 22px; white-space: nowrap; }
  .capture-table .reference-value { grid-column: 2 / -1; grid-row: 2; color: #64748b; font-size: 11px; overflow-wrap: anywhere; }
  .capture-table .entry-status { grid-column: 2 / -1; grid-row: 3; }
  .capture-table .entry-actions-cell { display: none; }
  .selection-mode .capture-entry { grid-template-columns: 44px 20px minmax(0, 1fr) auto; }
  .selection-mode .capture-entry .selection-column { grid-column: 1; grid-row: 1 / 4; align-self: stretch; display: grid; place-items: center; }
  .selection-mode .capture-entry .entry-number { grid-column: 2; }
  .selection-mode .capture-entry .entry-rpu { grid-column: 3; }
  .selection-mode .capture-entry .reference-value, .selection-mode .capture-entry .entry-status { grid-column: 3 / -1; }
  .capture-entry.conflict { box-shadow: inset 3px 0 #e11d48; }
  .capture-entry.conflict td:first-child { box-shadow: none; }
  .capture-entry.selected { box-shadow: inset 3px 0 #00685b; }
  .capture-entry.duplicate-highlight { outline: 2px solid var(--capture-warning-accent); outline-offset: -2px; }
  .capture-empty { min-height: 180px; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
  .capture-empty > i { display: none; }
  .entry-menu button { min-height: 44px; }
  .capture-workspace { position: relative; }
  .capture-footer { order: 3; padding: 4px 12px calc(4px + env(safe-area-inset-bottom)); }
  .capture-footer .capture-footer-state { position: absolute; z-index: 3; bottom: calc(36px + env(safe-area-inset-bottom)); left: 12px; right: 12px; display: none; max-width: none; margin: 0; padding: 12px 14px; border: 1px solid #a7f3d0; border-radius: 10px; background: #ecfdf5; box-shadow: 0 4px 16px #0f172a26; font-size: 13px; pointer-events: auto; }
  .capture-footer .capture-footer-state.feedback-visible { display: flex; }
  .capture-footer .capture-footer-state.warning { border-color: var(--capture-warning-accent); background: var(--capture-warning-background); }
  .capture-footer .capture-footer-state.error { border-color: #fecdd3; background: #fff1f2; }
  .scanner-module #details-dialog { position: fixed; inset: auto 0 0; width: 100%; max-width: none; max-height: calc(100dvh - 24px); margin: 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; border-bottom: 0; background: white; overflow-y: auto; overscroll-behavior: contain; }
  #details-dialog .details-heading { padding: 12px 20px; background: white; }
  #details-dialog .details-heading .eyebrow { display: none; }
  #details-dialog .details-heading h2 { margin: 0; }
  #details-dialog .details-dismiss { align-self: center; }
  .details-data { grid-template-columns: 1fr; gap: 12px; }
  .details-entry-actions { display: flex; flex: 1; gap: 8px; }
  .scanner-module .dialog-actions .button { flex: 1; min-height: 44px; white-space: normal; }
}
@media (pointer: coarse) {
  .capture-entry { user-select: none; -webkit-touch-callout: none; }
}

.scanner-module .capture-result {
  --capture-result-color: #00685B;
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #e9edf2;
  color: white;
  box-shadow: none;
}
.scanner-module .capture-result[open] { display: flex; }
.scanner-module .capture-result::backdrop { background: #003D35; }
.scanner-module .capture-result[data-state="error"] { --capture-result-color: #BD3C24; }
.scanner-module .capture-result[data-state="error"]::backdrop { background: #BD3C24; }
.capture-result::before { content: ''; position: absolute; inset: 0; background: var(--capture-result-color); transform-origin: bottom; animation: capture-result-fill .55s ease-out both; }
.capture-result-surface { position: relative; display: flex; flex: 1; flex-direction: column; min-width: 0; min-height: 0; padding: calc(20px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(20px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
.capture-result-body { display: flex; flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.capture-result-main { display: flex; flex: none; flex-direction: column; align-items: center; gap: clamp(16px, 3dvh, 28px); width: 100%; margin-block: auto; padding-block: 8px; text-align: center; }
.capture-result-icon { display: grid; place-items: center; flex: none; width: clamp(88px, 25vw, 128px); aspect-ratio: 1; border-radius: 50%; background: white; color: var(--capture-result-color); animation: capture-result-icon .25s .35s ease-out both; }
.capture-result-icon svg { width: 58%; height: 58%; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.capture-result-icon svg[hidden] { display: none; }
.capture-result-copy { width: 100%; min-width: 0; animation: capture-result-content .25s .5s ease-out both; }
.scanner-module .capture-result h2 { margin: 0; font-size: clamp(1.3rem, 6vw, 2rem); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.capture-result-copy p { width: min(100%, 48ch); margin: 16px auto 0; font-size: clamp(1rem, 4.5vw, 1.2rem); line-height: 1.4; overflow-wrap: anywhere; white-space: pre-line; }
.capture-result-actions { display: grid; flex: none; width: min(100%, 520px); margin-inline: auto; padding-top: 20px; animation: capture-result-content .25s .6s ease-out both; }
.capture-result-actions button { min-width: 0; min-height: 56px; padding: 12px; border: 2px solid white; border-radius: 16px; background: white; color: var(--capture-result-color); font: 800 1rem/1.3 Inter, Arial, sans-serif; touch-action: manipulation; }
.capture-result-actions button:active { filter: brightness(.92); }
.capture-result-actions button:focus-visible { outline: 3px solid white; outline-offset: 4px; }
@keyframes capture-result-fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes capture-result-icon { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: scale(1); } }
@keyframes capture-result-content { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  .capture-result::before, .capture-result-icon, .capture-result-copy, .capture-result-actions { animation: none; }
}
