/* Caja chica renovada (Configuración → Tests → «Caja chica renovada»).
   Editor de factura: imagen con el recuadro del dato activo + formulario.
   Solo clases pcn-*; lo escribe PettyCashReceiptEditor.js. */
.pcn-editor {
    --pcn-bg: #0b1320; --pcn-panel: #131d2e; --pcn-line: #2a3a56; --pcn-text: #f4f6fa; --pcn-dim: #a4b1c7;
    --pcn-accent: #06b6d4; --pcn-good: #10b981; --pcn-warn: #f59e0b; --pcn-bad: #ef4444;
    container-type: inline-size;
    display: flex; flex-direction: column; min-height: 0;
    background: var(--pcn-panel); color: var(--pcn-text);
    border: 1px solid var(--pcn-accent); border-radius: 14px; margin-bottom: 14px; overflow: hidden;
    font-family: inherit;
}
.pcn-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--pcn-line); }
.pcn-head-main { flex: 1; min-width: 0; }
.pcn-title { font-size: 1rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcn-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: .75rem; color: var(--pcn-dim); }
.pcn-sub[data-state="uploaded"] { color: var(--pcn-good); }
.pcn-sub[data-state="pending"] { color: var(--pcn-warn); }
.pcn-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

.pcn-body { display: flex; flex-direction: column; min-height: 0; }
.pcn-view { display: flex; flex-direction: column; background: var(--pcn-bg); min-width: 0; }
.pcn-winwrap { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.pcn-view > :not(.pcn-winwrap) { flex: 0 0 auto; }
/* La foto se mueve con transform (PettyCashPhotoViewer): el navegador no desplaza ni hace zoom a la página. */
.pcn-win { position: relative; overflow: hidden; flex: 1 1 auto; min-height: 140px; height: clamp(240px, 44vh, 460px); background: #080e18;
    touch-action: none; overscroll-behavior: contain; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pcn-win:active { cursor: grabbing; }
.pcn-fbar { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; z-index: 3; }
.pcn-zbar { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 6px; z-index: 3; }
.pcn-zpct { min-width: 54px; text-align: center; font-size: .75rem; font-weight: 600; color: var(--pcn-text); background: rgba(11, 19, 32, .85); border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: 8px 10px; }
.pcn-fb { width: 44px; height: 44px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .2); background: rgba(11, 19, 32, .85); color: var(--pcn-text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; touch-action: manipulation; }
.pcn-win--empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: var(--pcn-dim); cursor: default; height: auto; min-height: 160px; }
.pcn-win--empty p { margin: 0; font-size: .9rem; }
.pcn-empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.pcn-stage { position: relative; width: 100%; transform-origin: 0 0; overflow: hidden; }
.pcn-stage.is-anim { transition: transform .24s ease; }
@media (prefers-reduced-motion: reduce) { .pcn-stage.is-anim { transition: none; } }
.pcn-img { display: block; width: 100%; height: auto; -webkit-user-drag: none; }
/* Divisor foto / formulario: solo en la hoja del teléfono. */
.pcn-split { display: none; flex: 0 0 auto; height: 22px; align-items: center; justify-content: center; cursor: row-resize; touch-action: none; background: var(--pcn-panel); border-top: 1px solid var(--pcn-line); border-bottom: 1px solid var(--pcn-line); }
.pcn-split i { width: 44px; height: 4px; border-radius: 2px; background: var(--pcn-dim); opacity: .7; }
.pcn-split:focus-visible { outline: 2px solid var(--pcn-accent); outline-offset: -2px; }
.pcn-box { position: absolute; border: calc(2px * var(--inv, 1)) solid #22d3ee; border-radius: calc(4px * var(--inv, 1)); box-shadow: 0 0 0 9999px rgba(8, 14, 24, .55); pointer-events: none; }
.pcn-tag { position: absolute; left: calc(-2px * var(--inv, 1)); bottom: 100%; margin-bottom: calc(2px * var(--inv, 1)); transform: scale(var(--inv, 1)); transform-origin: left bottom; background: #22d3ee; color: #081a24; font-family: inherit; font-weight: 600; font-size: 11px; line-height: 1; padding: 3px 7px; border-radius: 5px 5px 5px 0; white-space: nowrap; }
.pcn-msg { margin: 0; padding: 28px 16px; text-align: center; font-size: .85rem; color: var(--pcn-dim); }
.pcn-msg--pdf { padding: 8px 16px 14px; }
.pcn-view > .pcn-fold { margin: 0 12px 12px; }
.pcn-note { margin: 0 12px 10px; font-size: .75rem; line-height: 1.4; color: var(--pcn-dim); }
.pcn-note[data-pcn-rescan] { border-left: 3px solid var(--pcn-dim); padding: 6px 10px; border-radius: 6px; background: rgba(109, 125, 153, .12); }
.pcn-note[data-tone="busy"] { border-color: var(--pcn-accent); color: var(--pcn-text); }
.pcn-note[data-tone="ok"] { border-color: #34d399; color: var(--pcn-text); }
.pcn-note[data-tone="warn"] { border-color: var(--pcn-warn); color: var(--pcn-text); }
.pcn-note[data-tone="error"] { border-color: #f87171; color: var(--pcn-text); }
.pcn-linkbtn { border: 0; background: none; padding: 0 2px; color: var(--pcn-accent); font: inherit; text-decoration: underline; cursor: pointer; }
.pcn-tool[disabled] { opacity: .55; cursor: progress; }
.pcn-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 12px 4px; scrollbar-width: none; }
.pcn-chip { flex: 0 0 auto; min-height: 36px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--pcn-line); background: var(--pcn-panel); color: var(--pcn-dim); font-family: inherit; font-weight: 500; font-size: .8rem; cursor: pointer; }
.pcn-chip[aria-pressed="true"] { background: var(--pcn-accent); border-color: var(--pcn-accent); color: #081a24; font-weight: 600; }
.pcn-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px 12px 10px; }
.pcn-tools > * { flex: 0 0 auto; white-space: nowrap; }
/* Botones de acción de la foto (Reescanear, Enderezar, Marcar…): con borde y fondo para que se vean como botones. */
.pcn-tool { min-height: 40px; padding: 0 10px; border: 1px solid var(--pcn-line); border-radius: 999px; background: var(--pcn-panel); color: var(--pcn-text); font-family: inherit; font-weight: 500; font-size: .78rem; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; touch-action: manipulation; transition: background-color .15s, border-color .15s; }
.pcn-tool:hover { border-color: var(--pcn-accent); background: rgba(6, 182, 212, .12); }
.pcn-tool:active { background: rgba(6, 182, 212, .24); }
.pcn-tool:focus-visible { outline: 2px solid var(--pcn-accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .pcn-tool { transition: none; } }

.pcn-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 0; min-width: 0; }
.pcn-issue { border: 1px solid rgba(245, 158, 11, .55); background: rgba(245, 158, 11, .1); border-radius: 12px; padding: 9px 12px; font-size: .8rem; line-height: 1.4; }
.pcn-issue[data-tone="red"] { border-color: rgba(239, 68, 68, .55); background: rgba(239, 68, 68, .1); }
.pcn-issue b { color: var(--pcn-warn); }
.pcn-issue[data-tone="red"] b { color: var(--pcn-bad); }
.pcn-issue-detail { margin-top: 2px; color: var(--pcn-dim); }
.pcn-fixes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pcn-fix { flex: 1 1 140px; min-height: 40px; padding: 6px 12px; border-radius: 12px; border: 1px solid var(--pcn-line); background: var(--pcn-panel); color: var(--pcn-text); font-family: inherit; font-weight: 500; font-size: .8rem; line-height: 1.2; cursor: pointer; text-align: left; }
.pcn-notes { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--pcn-line); background: rgba(109, 125, 153, .12); border-radius: 12px; padding: 8px 12px; font-size: .8rem; line-height: 1.4; color: var(--pcn-dim); }

.pcn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pcn-c2, .pcn-c3 { grid-column: 1 / -1; }
.pcn-field { min-width: 0; }
.pcn-label { display: block; margin-bottom: 6px; font-size: .75rem; font-weight: 500; color: var(--pcn-dim); }
.pcn-input { box-sizing: border-box; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--pcn-line); background: var(--pcn-bg); color: var(--pcn-text); font-family: inherit; font-weight: 500; font-size: .95rem; outline: none; }
textarea.pcn-input { padding: 10px 12px; resize: vertical; }
.pcn-input:focus { border-color: var(--pcn-accent); box-shadow: 0 0 0 3px rgba(6, 182, 212, .22); }
.pcn-input.is-warn { border-color: var(--pcn-warn); }
.pcn-input:disabled { opacity: .7; }
.pcn-low { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--pcn-warn); vertical-align: middle; }
.pcn-hint { display: block; margin-top: 4px; font-size: .7rem; color: var(--pcn-warn); }
.pcn-check { display: flex; align-items: flex-end; gap: 8px; min-height: 44px; font-size: .8rem; color: var(--pcn-text); cursor: pointer; }

.pcn-fold { border: 1px solid var(--pcn-line); border-radius: 12px; overflow: hidden; }
.pcn-fold-head { width: 100%; min-height: 44px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 0; background: transparent; color: var(--pcn-text); font-family: inherit; font-weight: 600; font-size: .85rem; cursor: pointer; text-align: left; }
.pcn-fold-head small, .pcn-fold-head [data-pcn-items-status] { font-weight: 500; font-size: .72rem; color: var(--pcn-dim); }
.pcn-fold-head [data-ok="true"] { color: var(--pcn-good); }
.pcn-fold-head [data-ok="false"] { color: var(--pcn-warn); }
.pcn-fold-body { padding: 0 12px 12px; }
.pcn-fold-body[hidden] { display: none; }
.pcn-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--pcn-line); font-family: inherit; font-weight: 600; font-size: .7rem; line-height: 1; font-style: normal; box-sizing: border-box; }
.pcn-badge.is-red { background: var(--pcn-bad); }
.pcn-items { list-style: none; margin: 0; padding: 0 12px 10px; display: flex; flex-direction: column; gap: 6px; font-size: .8rem; color: var(--pcn-dim); }
.pcn-items li { display: flex; justify-content: space-between; gap: 10px; }
.pcn-items b { color: var(--pcn-text); flex: 0 0 auto; }
.pcn-bar { display: block; height: 6px; border-radius: 3px; background: var(--pcn-bg); overflow: hidden; }
.pcn-bar > span { display: block; height: 100%; }
.pcn-conf-row { display: grid; grid-template-columns: 84px minmax(0, 1fr) 44px; gap: 8px; align-items: center; margin-top: 7px; font-size: .75rem; color: var(--pcn-dim); }
.pcn-conf-row b { text-align: right; }

.pcn-footer { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: auto -16px 0; padding: 10px 16px 14px; background: var(--pcn-panel); }
.pcn-btn { flex: 1 1 auto; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--pcn-line); background: var(--pcn-panel); color: var(--pcn-text); font-family: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.pcn-btn--primary { background: var(--pcn-accent); border-color: var(--pcn-accent); color: #081a24; }

@container (min-width: 640px) {
    .pcn-body { flex-direction: row; align-items: stretch; }
    .pcn-view { flex: 0 0 46%; max-width: 46%; border-right: 1px solid var(--pcn-line); position: sticky; top: 0; align-self: flex-start; }
    .pcn-win { height: clamp(320px, 66vh, 760px); }
    .pcn-split { display: none !important; }
    .pcn-form { flex: 1; padding: 12px 14px 0; }
    .pcn-footer { margin: auto -14px 0; padding: 10px 14px 12px; }
    .pcn-btn { flex: 0 0 auto; }
    .pcn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
    .pcn-c2 { grid-column: span 2; } .pcn-c3 { grid-column: span 3; }
    .pcn-input { min-height: 40px; padding: 0 10px; font-size: .88rem; }
    .pcn-label { margin-bottom: 3px; }
}

@container (min-width: 900px) {
    .pcn-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── Pantalla: saldo, acciones, filtros y tarjetas ───────────────────────── */
.pcn-screen { --pcn-bg: #0b1320; --pcn-panel: #131d2e; --pcn-line: #2a3a56; --pcn-text: #f4f6fa; --pcn-dim: #a4b1c7;
    --pcn-accent: #06b6d4; --pcn-good: #10b981; --pcn-warn: #f59e0b; --pcn-bad: #ef4444;
    display: block; color: var(--pcn-text); }
.pcn-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pcn-balance { background: var(--pcn-panel); border: 1px solid var(--pcn-line); border-radius: 18px; padding: 18px; }
.pcn-balance-label { font-size: .8rem; color: var(--pcn-dim); }
.pcn-balance-value { font-size: 2rem; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; }
.pcn-balance-value[data-negative="true"] { color: var(--pcn-bad); }
.pcn-track { height: 8px; border-radius: 4px; background: var(--pcn-bg); margin: 14px 0 12px; overflow: hidden; }
.pcn-track > span { display: block; height: 100%; background: var(--pcn-accent); border-radius: 4px; }
.pcn-balance-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .75rem; color: var(--pcn-dim); }
.pcn-balance-refund { margin-top: 8px; font-size: .8rem; font-weight: 700; color: var(--pcn-warn); }
.pcn-cta { width: 100%; box-sizing: border-box; min-height: 60px; border: 0; border-radius: 16px; background: var(--pcn-accent); color: #081a24;
    font-family: inherit; font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer;
    box-shadow: 0 10px 30px -12px rgba(6, 182, 212, .7); }
.pcn-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.pcn-ghost { flex: 1 1 120px; min-height: 46px; border-radius: 12px; border: 1px solid var(--pcn-line); background: var(--pcn-panel); color: var(--pcn-text);
    font-family: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.pcn-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 4px; border: 0; background: transparent; color: var(--pcn-text);
    font-family: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; text-align: left; }
.pcn-switch-track { position: relative; width: 42px; height: 24px; border-radius: 12px; background: var(--pcn-line); flex: 0 0 auto; transition: background .15s; }
.pcn-switch-track i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--pcn-text); transition: left .15s; }
.pcn-switch[aria-checked="true"] .pcn-switch-track { background: var(--pcn-accent); }
.pcn-switch[aria-checked="true"] .pcn-switch-track i { left: 21px; background: #081a24; }
.pcn-filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0; }
.pcn-filter { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--pcn-line); background: var(--pcn-panel); color: var(--pcn-dim);
    font-family: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.pcn-filter[aria-pressed="true"] { background: var(--pcn-accent); border-color: var(--pcn-accent); color: #081a24; font-weight: 600; }
.pcn-sec { display: flex; align-items: center; gap: 8px; padding: 6px 2px 0; font-size: .68rem; font-weight: 600; letter-spacing: .08em; color: #6d7d99; }
.pcn-sec b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--pcn-warn); color: #2a1a00; font-size: .68rem; display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; }
.pcn-cards { display: flex; flex-direction: column; gap: 8px; }
.pcn-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 72px; padding: 10px 40px 10px 14px;
    box-sizing: border-box; background: var(--pcn-panel); border: 1px solid var(--pcn-line); border-radius: 16px; cursor: pointer; }
.pcn-card:hover { background: #1a2740; }
.pcn-card[data-selected="true"] { border-color: var(--pcn-accent); }
.pcn-card-title { font-size: .95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcn-card-num { font-size: .68rem; font-weight: 500; color: #38bdf8; font-variant-numeric: tabular-nums; margin-right: 4px; }
.pcn-card-meta { margin-top: 3px; font-size: .75rem; color: var(--pcn-dim); }
.pcn-unsent { color: var(--pcn-warn); }
.pcn-twodates { color: var(--pcn-warn); font-weight: 600; }
.pcn-card-side { text-align: right; }
.pcn-card-amount { font-size: .95rem; font-weight: 700; white-space: nowrap; }
.pcn-card-amount[data-kind="gasto"] { color: #f87171; }
.pcn-card-amount[data-kind="reposicion"] { color: #34d399; }
.pcn-state { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: .75rem; color: var(--pcn-dim); }
.pcn-dup { margin-top: 6px; border: 0; border-radius: 999px; padding: 4px 8px; background: #ea580c; color: #fff; font-family: inherit; font-size: .66rem; font-weight: 700; cursor: pointer; }
.pcn-del { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border: 0; background: transparent; color: #64748b; cursor: pointer; font-size: .95rem; }
.pcn-empty { padding: 24px 12px; text-align: center; font-size: .85rem; color: var(--pcn-dim); border: 1px dashed var(--pcn-line); border-radius: 12px; }
.pcn-more { display: flex; justify-content: center; }
.pcn-more .pcn-ghost { flex: 0 0 auto; padding: 0 18px; }
.pcn-queue { display: flex; align-items: center; gap: 2px; font-size: .75rem; color: var(--pcn-dim); }
.pcn-queue span { min-width: 52px; text-align: center; }
.pcn-icon-btn { width: 44px; height: 44px; border: 0; background: transparent; color: var(--pcn-dim); font-size: 1.3rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pcn-icon-btn:hover { color: var(--pcn-text); }

/* Teléfono: el editor sube como hoja desde abajo. */
.pcn-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 24, .62); z-index: 1100; }
.pcn-side { position: fixed; left: 0; right: 0; bottom: 0; height: 92vh; height: 92dvh; z-index: 1101; display: flex; flex-direction: column;
    background: #131d2e; border-radius: 20px 20px 0 0; overflow: hidden; box-shadow: 0 -20px 60px rgba(0, 0, 0, .6); }
.pcn-side .pcn-editor { flex: 1; min-height: 0; margin: 0; border: 0; border-radius: 0; }
/* La foto queda fija arriba y solo el formulario se desplaza: al revisar un dato no se pierde la foto. */
@media (max-width: 959px) {
    .pcn-side .pcn-body { flex: 1; min-height: 0; overflow: hidden; }
    .pcn-side .pcn-view { flex: 0 0 var(--pcn-split, 54%); min-height: 0; position: static; }
    .pcn-side .pcn-winwrap { flex: 1 1 0; }
    .pcn-side .pcn-win { flex: 1 1 0; height: auto; min-height: 0; }
    .pcn-side .pcn-split { display: flex; }
    /* Encabezado de una línea para dejar sitio a la foto. */
    .pcn-side .pcn-head { padding: 8px 8px 8px 14px; gap: 4px; }
    .pcn-side .pcn-sub { margin-top: 1px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .pcn-side .pcn-sub[data-pcn-backup] { display: none; }
    .pcn-side .pcn-queue span { min-width: 40px; }
    .pcn-side .pcn-icon-btn { width: 40px; height: 40px; }
    .pcn-side .pcn-form { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}
@container (min-width: 640px) {
    @media (max-width: 959px) {
        /* Teléfono en horizontal: foto a la izquierda, formulario a la derecha, cada uno a su altura. */
        .pcn-side .pcn-view { flex: 0 0 46%; align-self: stretch; position: static; }
        .pcn-side .pcn-split { display: none; }
    }
}

/* PC: lista a la izquierda y editor a la derecha. */
@media (min-width: 960px) {
    .pcn-screen[data-editing="true"] { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr); gap: 16px; align-items: start; }
    .pcn-backdrop { display: none; }
    .pcn-side { position: sticky; top: 8px; left: auto; right: auto; bottom: auto; z-index: auto; height: auto; max-height: calc(100vh - 16px);
        border-radius: 14px; box-shadow: none; overflow: auto; background: transparent; }
    .pcn-side .pcn-editor { flex: none; border: 1px solid var(--pcn-accent); border-radius: 14px; }
    .pcn-side .pcn-body { overflow: visible; }
}
/* Pantalla ancha con el editor angosto (una sola columna): la foto se queda fija arriba al desplazar. */
@media (min-width: 960px) {
    .pcn-view { position: sticky; top: 0; z-index: 2; }
}

/* ── Barra superior de una línea ─────────────────────────────────────────── */
.pcn-topbar { --pcn-panel: #131d2e; --pcn-line: #2a3a56; --pcn-text: #f4f6fa; --pcn-dim: #a4b1c7;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: .8rem; color: var(--pcn-dim); }
.pcn-select { flex: 1 1 180px; min-width: 0; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--pcn-line);
    background: var(--pcn-panel); color: var(--pcn-text); font-family: inherit; font-size: .88rem; }
.pcn-select--period { flex: 0 1 150px; }
.pcn-link { min-height: 36px; padding: 0 6px; border: 0; background: none; color: #38bdf8; font-family: inherit; font-size: .8rem; cursor: pointer; }
.pcn-icon-btn--sm { width: 36px; height: 36px; font-size: .9rem; }
.pcn-topbar .r07-recon-hint, .pcn-topbar .r07-recon-section-head { flex-basis: 100%; margin: 0; font-size: .75rem; }
.pcn-balance-project { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--pcn-line); font-size: .78rem; color: var(--pcn-dim); }
.pcn-balance-project b { color: #34d399; }
.pcn-balance-project[data-negative="true"] b { color: #f87171; }
.pcn-view > .pcn-fold + .pcn-fold { margin-top: 0; }

/* PC con el editor abierto: la lista y el detalle se desplazan por separado. */
@media (min-width: 960px) {
    .pcn-screen[data-editing="true"] { overflow: hidden; }
    .pcn-screen[data-editing="true"] > .pcn-main { height: 100%; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; overscroll-behavior: contain; }
    .pcn-screen[data-editing="true"] > .pcn-side { position: static; height: 100%; max-height: none; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; }
}

/* ── Marcar la posición de un dato ───────────────────────────────────────── */
.pcn-stage[data-edit] { cursor: crosshair; }
.pcn-stage[data-edit="adjust"] .pcn-box { pointer-events: auto; cursor: move; }
.pcn-box--draft { border-style: dashed; box-shadow: 0 0 0 9999px rgba(8, 14, 24, .35); }
.pcn-box[data-source="manual"] { border-color: #a78bfa; }
.pcn-box[data-source="manual"] .pcn-tag { background: #a78bfa; }
.pcn-handle { position: absolute; right: calc(-18px * var(--inv, 1)); bottom: calc(-18px * var(--inv, 1)); width: calc(36px * var(--inv, 1)); height: calc(36px * var(--inv, 1)); border-radius: calc(10px * var(--inv, 1)); background: #22d3ee; border: calc(2px * var(--inv, 1)) solid #081a24; cursor: nwse-resize; touch-action: none; pointer-events: auto; }

/* ── Encabezado dentro de la columna de la lista ─────────────────────────── */
.pcn-page-title { display: flex; align-items: center; gap: 8px; font-size: 1.15rem; font-weight: 700; color: #f4f6fa; }
.pcn-main > .pcn-topbar { margin-bottom: 0; }
.pcn-period-head { margin-top: -2px; }
@media (min-width: 960px) {
    /* Con el editor abierto, la columna de la lista es angosta: caja arriba y periodo debajo. */
    .pcn-screen[data-editing="true"] .pcn-select { flex: 1 1 100%; }
    .pcn-screen[data-editing="true"] .pcn-select--period { flex: 1 1 120px; }
}

/* Editor de esquinas (PettyCashCornerEditor.js): capa a pantalla completa para enderezar la factura. */
.pcc { position: fixed; inset: 0; z-index: 3100; display: flex; flex-direction: column; background: #070d17; color: #f4f6fa;
    font-family: inherit; padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); gap: 10px; }
.pcc-head { display: flex; flex-direction: column; gap: 2px; }
.pcc-head strong { font-size: 1rem; font-weight: 600; }
.pcc-head span { font-size: .8rem; color: #a4b1c7; line-height: 1.35; }
.pcc-stage { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pcc-frame { position: relative; display: inline-block; line-height: 0; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pcc-canvas { display: block; width: auto; height: auto; max-width: calc(100vw - 24px); max-height: calc(100vh - 190px); max-height: calc(100dvh - 190px); }
.pcc-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pcc-dim { fill: rgba(3, 8, 16, .55); }
.pcc-poly { fill: rgba(6, 182, 212, .08); stroke: #06b6d4; stroke-width: 2px; }
.pcc[data-invalid="true"] .pcc-poly { stroke: #ef4444; fill: rgba(239, 68, 68, .1); }
/* Área táctil de 44 px; el punto que se ve es más chico para no tapar la esquina. */
.pcc-handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: grab; touch-action: none; }
.pcc-handle::before { content: ""; position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: #06b6d4; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .45); }
.pcc[data-invalid="true"] .pcc-handle::before { background: #ef4444; }
.pcc-handle:focus-visible { outline: 3px solid #f59e0b; outline-offset: -3px; }
.pcc-loupe { position: absolute; top: 8px; width: 104px; height: 104px; border-radius: 50%; border: 3px solid #fff; background: #000; box-shadow: 0 2px 10px rgba(0, 0, 0, .6); pointer-events: none; }
.pcc-loupe[data-side="right"] { right: 8px; }
.pcc-loupe[data-side="left"] { left: 8px; }
.pcc-loupe::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid #06b6d4; border-radius: 50%; }
.pcc-error { margin: 0; padding: 8px 12px; border: 1px solid rgba(239, 68, 68, .55); background: rgba(239, 68, 68, .1); border-radius: 12px; font-size: .8rem; }
.pcc-actions { display: flex; gap: 8px; }
.pcc-btn { flex: 1 1 0; min-height: 48px; border-radius: 12px; border: 1px solid #2a3a56; background: #131d2e; color: #f4f6fa; font-family: inherit; font-weight: 500; font-size: .9rem; cursor: pointer; touch-action: manipulation; }
.pcc-btn--primary { background: #06b6d4; border-color: #06b6d4; color: #081a24; font-weight: 600; }
.pcc-btn[disabled] { opacity: .5; cursor: not-allowed; }
.pcc[aria-busy="true"] .pcc-btn--primary { cursor: progress; }

/* Missing receipt is distinct from a local attachment waiting for upload. */
.pc-search-bar { margin-bottom: 10px; }
.pc-missing-receipt-filter {
    display: inline-flex; align-items: center; gap: 7px; min-height: 44px;
    padding: 8px 12px; border: 1px solid #b45309; border-radius: 9px;
    color: #fcd34d; background: #29211a; font: inherit; font-size: .8rem;
    cursor: pointer;
}
.pc-missing-receipt-filter[aria-pressed="true"] { background: #fbbf24; color: #29211a; }
.pc-missing-receipt-filter:focus-visible { outline: 2px solid #38bdf8; outline-offset: 2px; }
.pc-missing-receipt-badge {
    display: inline-block; color: #fcd34d; background: #29211a;
    border: 1px solid #b45309; border-radius: 6px;
    padding: 2px 6px; font-size: .68rem; font-weight: 700;
}
.pcn-state[data-pcn-state="respaldo"] { color: #fcd34d; }
.pcn-filter[data-arg="respaldo"] { min-height: 44px; }

/* Keep the supplier, receipt badge and amount on separate, readable rows
   on narrow screens, rather than squeezing the metadata into one column. */
@media (max-width: 480px) {
    .pc-wrap .pc-legacy-movement {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 6px 8px !important;
    }
    .pc-wrap .pc-legacy-movement-main { grid-column: 1 / -1; overflow-wrap: anywhere; }
    .pc-wrap .pc-legacy-movement-title { min-width: 0; overflow-wrap: anywhere; }
    .pc-wrap .pc-legacy-movement-amount { grid-column: 1; }
    .pc-wrap .pc-legacy-movement > [data-app-fn="pcDeleteMovement"] {
        grid-column: 2; min-width: 44px; min-height: 44px;
    }
    .pcn-card {
        grid-template-columns: minmax(0, 1fr);
        gap: 5px;
        padding: 10px 52px 10px 12px;
    }
    .pcn-card-title { white-space: normal; overflow-wrap: anywhere; }
    .pcn-card-side { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; text-align: left; }
    .pcn-state { margin-top: 0; }
    .pcn-del { width: 44px; height: 44px; top: 2px; right: 2px; }
}
