/* Personal ledger receipt. The existing dialog owns focus, Escape and closing. */
.lg-view-receipt {
  flex: none;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line, #32323f);
  border-radius: 6px;
  background: transparent;
  color: var(--txt, #F3F2EE);
  font: 500 14px/1.4 var(--font-body, "Inter", sans-serif);
  cursor: pointer;
}
.lg-view-receipt:hover { background: var(--raised, #1B1B24); }
.lg-view-receipt:focus-visible { outline: 2px solid var(--acc, #8C6BFF); outline-offset: 3px; }
#dialog:has(.lg-receipt-preview) {
  width: min(560px, calc(100% - 24px));
  border: 1px solid var(--line, #32323f);
  border-radius: 16px;
  background: var(--card, #14141B);
  color: var(--txt, #F3F2EE);
  color-scheme: dark;
  font-family: "Inter", Arial, sans-serif;
}
#dialog:has(.lg-receipt-preview) .b-dialog-header { padding: 20px 24px; background: var(--card, #14141B); border-color: var(--line, #32323f); }
#dialog:has(.lg-receipt-preview) .b-dialog-header h2 { font: 600 20px/1.35 "Inter", Arial, sans-serif; color: var(--txt, #F3F2EE); }
#dialog:has(.lg-receipt-preview) .b-dialog-header button { color: var(--txt, #F3F2EE); }
.lg-receipt-preview { padding: 24px; }
.lg-receipt {
  padding: 28px;
  border: 1px solid var(--line, #32323f);
  border-radius: 10px;
  background: var(--raised, #1B1B24);
  color: var(--txt, #F3F2EE);
  overflow-wrap: anywhere;
}
.lg-receipt-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 22px; border-bottom: 1px dashed var(--line, #32323f); }
.lg-receipt-brand { font: 600 26px/1 Geologica, "Inter", sans-serif; letter-spacing: -.06em; }
.lg-receipt-head p, .lg-receipt-kind { margin: 0; color: var(--muted2, #9C9CAA); font-size: 14px; line-height: 1.5; }
.lg-receipt-kind { margin-top: 24px; }
.lg-receipt-amount { margin: 6px 0 20px; font: 500 clamp(24px, 6vw, 36px)/1.3 "JetBrains Mono", "Inter", monospace; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.lg-receipt-title { margin: 0 0 24px; font: 600 20px/1.5 "Inter", Arial, sans-serif; white-space: pre-wrap; }
.lg-receipt-details { display: grid; gap: 16px; margin: 0; }
.lg-receipt-details > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 12px; font-size: 14px; line-height: 1.6; }
.lg-receipt-details dt { color: var(--muted2, #9C9CAA); }
.lg-receipt-details dd { min-width: 0; margin: 0; text-align: right; }
.lg-receipt-details time { font-variant-numeric: tabular-nums; }
.lg-receipt-record { padding-top: 16px; border-top: 1px dashed var(--line, #32323f); }
.lg-receipt-record dd { font-family: "JetBrains Mono", "Inter", monospace; font-size: 13px; }
.lg-receipt-note { margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--line, #32323f); color: var(--muted2, #9C9CAA); font-size: 14px; line-height: 1.5; text-align: center; }
.lg-receipt-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.lg-receipt-actions .b-btn { min-height: 44px; border-radius: 7px; }
.lg-receipt-actions .secondary { border: 1px solid var(--line, #32323f); background: transparent; color: var(--txt, #F3F2EE); }
.lg-receipt-actions .primary { border: 1px solid var(--acc, #8C6BFF); background: var(--acc, #8C6BFF); color: var(--txt, #F3F2EE); }
.lg-receipt-actions .b-btn:focus-visible { outline: 2px solid var(--mint, #C8F56A); outline-offset: 3px; }
@media (max-width: 440px) {
  .lg-receipt-preview { padding: 16px; }
  .lg-receipt { padding: 20px 16px; }
  .lg-receipt-details > div { grid-template-columns: 1fr; gap: 2px; }
  .lg-receipt-details dd { text-align: left; }
}
@media print {
  /* Scope to an open receipt: ordinary browser printing is unaffected. */
  html:has(#dialog[open] .lg-receipt) { background: white !important; color-scheme: light; }
  body:has(#dialog[open] .lg-receipt) { display: block !important; overflow: visible !important; margin: 0 !important; background: white !important; color: black !important; }
  body:has(#dialog[open] .lg-receipt) > :not(#dialog) { display: none !important; }
  #dialog[open]:has(.lg-receipt) {
    display: block !important;
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: white !important;
    color: black !important;
    transform: none !important;
    animation: none !important;
    color-scheme: light;
  }
  #dialog[open]:has(.lg-receipt)::backdrop { display: none !important; background: transparent !important; }
  #dialog[open]:has(.lg-receipt) > :not(.lg-receipt-preview),
  #dialog[open] .lg-receipt-actions { display: none !important; }
  #dialog[open] .lg-receipt-preview { padding: 0 !important; }
  #dialog[open] .lg-receipt { width: 100%; max-width: 100mm; margin: 0 auto; padding: 8mm; border: 0; border-radius: 0; background: white !important; color: black !important; break-inside: avoid; }
  #dialog[open] .lg-receipt * { color: black !important; border-color: #777 !important; text-shadow: none !important; }
}
