/* 44-v2-capture.css — تسجيل عملية, the sheet the logo opens (body.ui-v2.v2-capture-open; features/ledger/capture.js).
   Matches docs/design/redesign-2026-11/prototype.html#Capture: quick buttons, type switch, big amount,
   account / date / note chips, category grid or account picker (the amount on the phone's number keyboard), save button naming type and amount.
   A bottom sheet on phones, a centred window on desktop. Uses the shared v2 components (40-v2-base.css). */

.v2-cap { display: none; }
.ui-v2.v2-capture-open .v2-cap:not([hidden]) {
    position: fixed; inset: 0; z-index: 1150;
    display: flex; align-items: flex-end; justify-content: center;
    background: var(--c-overlay);
}
/* The classic sheet's dim layer is not needed under this one. */
.ui-v2.v2-capture-open::before { display: none !important; }

.ui-v2 .v2-cap__sheet {
    width: 100%; max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain;
    border-radius: 28px 28px 0 0; padding: 10px 16px 0; color: var(--c-text);
}
/* Slides up when it opens only (not on each redraw); the type switch's motion is in 50-v2-motion.css. */
.ui-v2 .v2-cap__sheet.is-enter { animation: v2CapUp var(--mo-slow) var(--ease-out); }
@keyframes v2CapUp { from { transform: translateY(30vh); opacity: .5; } to { transform: none; opacity: 1; } }
.ui-v2 .v2-cap__grab { width: 40px; height: 5px; border-radius: var(--radius-pill); background: var(--c-border-strong); margin: 0 auto 8px; }

.ui-v2 .v2-cap__head { display: flex; align-items: center; gap: 8px; }
.ui-v2 .v2-cap__title { flex: 1; min-width: 0; margin: 0; font-size: var(--v2-fs-title); font-weight: 700; line-height: 1.3; }
.ui-v2 .v2-cap__close { background: var(--c-surface-2); }

/* Quick buttons: receipt photo, bank SMS */
.ui-v2 .v2-cap__quick { display: flex; gap: 8px; margin-top: 10px; }
.ui-v2 .v2-cap__quick > button {
    flex: 1; min-width: 0; min-height: 44px; padding: 0 8px; border: 0; border-radius: 14px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--c-primary-soft); color: var(--c-primary); font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer;
}

.ui-v2 .v2-cap__types { margin-top: 12px; }
.ui-v2 .v2-cap__types > button { font-size: 13.5px; white-space: nowrap; }

/* The amount: a real field (phone keyboard, paste) drawn as the big number, with the riyal sign after it. */
.ui-v2 .v2-cap__amount { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 12px 0 6px; }
.ui-v2 .v2-cap__amount input {
    field-sizing: content; width: 7ch; min-width: 2ch; max-width: 100%;
    border: 0; background: none; padding: 0; margin: 0; text-align: center;
    font: inherit; font-size: 40px; font-weight: 700; line-height: 1.15; letter-spacing: -.3px;
    border-radius: var(--radius-sm);
}
/* 01-base.css pins phone inputs to 16px with !important (iOS zoom); the big amount is far above that. */
.ui-v2 #v2-capture #v2cap-amount { font-size: 40px !important; }
.ui-v2 .v2-cap__amount input::placeholder { color: var(--c-text-muted); opacity: .6; }
.ui-v2 .v2-cap__amount input:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.ui-v2 .v2-cap__sar { font-size: 16px; color: var(--c-text-muted); }

/* Chips: account, date and time, note */
.ui-v2 .v2-cap__chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.ui-v2 .v2-cap__chip {
    position: relative; display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
    min-height: 44px; padding: 0 14px; border: 1px solid var(--c-border); border-radius: var(--radius-pill);
    background: var(--c-surface); color: var(--c-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ui-v2 .v2-cap__chip.is-on { background: var(--c-primary-soft); border-color: var(--c-primary-line); color: var(--c-primary); }
.ui-v2 .v2-cap__chip-text { min-width: 0; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The date chip uses the app's date field (ui/date-field.js): its native input covers the whole chip. */
.ui-v2 .v2-cap__date .date-field { position: static; display: contents; }
.ui-v2 .v2-cap__date .date-field__text,
.ui-v2 .v2-cap__date .date-field__icon { display: none; }
.ui-v2 .v2-cap__date input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; cursor: pointer; }
.ui-v2 .v2-cap__date:focus-within { outline: 2px solid var(--c-primary); outline-offset: 1px; }

/* Under the chips: category grid, account picker or an open chip's panel */
.ui-v2 .v2-cap__label { font-size: 13px; font-weight: 700; color: var(--c-text-muted); margin: 14px 4px 8px; }
.ui-v2 .v2-cap__cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ui-v2 .v2-cap__cat {
    min-width: 0; min-height: 62px; padding: 8px 4px; border: 2px solid transparent; border-radius: 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    background: var(--c-surface-2); color: var(--c-text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.ui-v2 .v2-cap__cat > i { font-size: 18px; }
.ui-v2 .v2-cap__accs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ui-v2 .v2-cap__acc {
    min-width: 0; min-height: 56px; padding: 0 12px; border: 2px solid transparent; border-radius: 16px;
    display: flex; align-items: center; gap: 8px; text-align: start;
    background: var(--c-surface-2); color: var(--c-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.ui-v2 .v2-cap__acc > i { flex: none; color: var(--c-text-muted); }
.ui-v2 .v2-cap__cat.is-on,
.ui-v2 .v2-cap__acc.is-on { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }
.ui-v2 .v2-cap__acc.is-on > i { color: var(--c-primary); }
.ui-v2 .v2-cap__name { display: block; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-v2 .v2-cap__empty {
    display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px;
    border: 1px dashed var(--c-border-strong); border-radius: 16px; color: var(--c-text-muted); font-size: 13.5px; text-align: center;
}
.ui-v2 .v2-cap__pick .v2-field { margin-bottom: 10px; }
.ui-v2 .v2-cap__done { width: 100%; min-height: 44px; }

/* Error and save, kept in reach at the bottom while the sheet scrolls */
.ui-v2 .v2-cap__foot {
    position: sticky; bottom: 0; background: var(--c-surface);
    padding: 10px 0 calc(16px + env(safe-area-inset-bottom, 0px));
}
.ui-v2 .v2-cap__error {
    margin: 0 0 8px; padding: 8px 12px; border-radius: 12px;
    background: var(--c-danger-soft); color: var(--c-danger); font-size: 13.5px; font-weight: 600;
}
.ui-v2 .v2-cap__error[hidden] { display: none; }
.ui-v2 .v2-cap__save { width: 100%; min-height: 52px; font-size: 15.5px; }

/* Phone keyboard up: the sheet takes the room above it. */
.ui-v2.kb-open .v2-cap__sheet { max-height: 100dvh; }

/* Desktop: a centred window */
@media (min-width: 769px) {
    .ui-v2.v2-capture-open .v2-cap:not([hidden]) { align-items: center; padding: 24px; }
    .ui-v2 .v2-cap__sheet { max-width: 440px; max-height: calc(100vh - 48px); border-radius: 22px; padding-top: 16px; }
    .ui-v2 .v2-cap__grab { display: none; }
    .ui-v2 .v2-cap__foot { padding-bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .ui-v2 .v2-cap__sheet { animation: none; } }
