/* The visual entry screen is isolated from the home/stats layout. */
body.entry-page-active { background: #fdf8f0; overflow: hidden; }
body.entry-page-active #appShell {
  width: min(100%, 520px);
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom));
  overflow: hidden;
  background: #fdf8f0;
}
body.entry-page-active #appShell > .topbar,
body.entry-page-active #appShell > .nav-dock,
body.entry-page-active #appShell > .chat-overview-strip { display: none; }
#entryPage {
  --entry-orange: #ed900c;
  --entry-line: #f6ede1;
  --entry-icon-size: clamp(48px, calc((100dvh - 400px) / 5.6), 76px);
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 10px clamp(14px, 4.7vw, 24px) 14px;
  color: #34322e;
  background: #fffdfa;
  border: 0;
  border-radius: 26px;
  box-shadow: 0 6px 28px #a7834510;
  overflow: hidden;
}
#entryPage svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#entryPage button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#entryPage button:focus-visible, #entryPage input:focus-visible { outline: 2px solid #d7840a; outline-offset: 2px; }
#entryPage .entry-header { flex: 0 0 40px; position: relative; display: grid; place-items: center; margin: 0; }
#entryPage .entry-header h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: .02em; }
#entryPage .entry-back { position: absolute; left: -8px; top: 0; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: none; border: 0; color: #484742; }
#entryPage .entry-back svg { width: 26px; height: 26px; }
#entryPage .visual-entry-card { flex: 1; min-height: 0; display: grid; grid-template-rows: 44px 62px minmax(0, 1fr) auto; gap: 4px; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; }
#entryPage .entry-type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0 30px; background: none; border: 0; border-bottom: 1px solid var(--entry-line); border-radius: 0; }
#entryPage .entry-type-button { position: relative; min-height: 44px; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; color: #93928d; font-size: 18px; font-weight: 550; }
#entryPage .entry-type-button.is-active { color: var(--entry-orange); font-weight: 700; }
#entryPage .entry-type-button.is-active::after { content: ""; position: absolute; width: 30px; height: 3px; bottom: -2px; left: 50%; transform: translateX(-50%); background: var(--entry-orange); border-radius: 3px; }
#entryPage .entry-amount-field { position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; margin: 0 5px; padding: 3px 0 0; }
#entryPage .entry-amount-field > b { font-size: 24px; font-weight: 500; }
#entryPage #entryAmount { width: 100%; min-width: 0; height: 60px; padding: 0; color: #39332b; background: none; border: 0; border-radius: 0; box-shadow: none; font-size: clamp(40px, 11vw, 54px); font-weight: 500; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: -.025em; caret-color: transparent; }
#entryPage #entryAmount::placeholder { color: #a69580; opacity: 1; }
#entryPage #entryAmount.is-long { font-size: 30px; }
#entryPage .entry-calculation { position: absolute; top: -3px; right: 0; margin: 0; color: #82776a; font-size: 12px; font-weight: 400; }
#entryPage .entry-category-block { container-type: size; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 3px 2px 5px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #e9dccc transparent; }
#entryPage .entry-section-label { min-height: 30px; gap: 8px; margin: 0 0 8px; font-size: 13px; }
#entryPage .entry-section-label > span { color: #82776a; font-size: 13px; }
#entryPage .entry-category-back { min-height: 36px; padding: 0 4px; font-size: 13px; color: #b56c08; }
#entryPage .entry-category-grid { --entry-icon-size: clamp(44px, calc((100cqh - 100px) / 3), 76px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 10px; align-content: start; }
#entryPage .entry-category-button { position: relative; display: flex; align-items: center; justify-content: start; flex-direction: column; gap: 5px; min-width: 0; min-height: 0; padding: 0 0 2px; background: none; border: 0; border-radius: 0; color: #565650; font-size: 15px; font-weight: 550; box-shadow: none; transform: none; transition: none; }
#entryPage .entry-category-icon { display: grid; place-items: center; width: min(100%, var(--entry-icon-size)); height: auto; aspect-ratio: 1; flex: 0 0 auto; background: #fcf8f1; border: 1px solid var(--entry-line); border-radius: 29%; font-size: 27px; line-height: 1; }
#entryPage .entry-category-icon img { display: block; width: 84%; height: 84%; object-fit: contain; }
#entryPage .entry-category-icon svg { width: 30px; height: 30px; color: #64615c; }
#entryPage .entry-category-button.is-selected { color: #302a22; }
#entryPage .entry-category-button.is-selected .entry-category-icon { background: #fff5e3; border-color: #ffad49; outline: 1px solid #ffad49; box-shadow: inset 0 0 0 3px #fffdf8, 0 3px 6px #e99b1821; }
#entryPage .entry-category-name { display: block; max-width: 100%; min-height: 21px; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.4; }
#entryPage .entry-category-arrow { position: absolute; top: 3px; right: 1px; color: #ac7b35; font-size: 16px; }
#entryPage .entry-category-parent { display: none; }
#entryPage .entry-bottom { min-width: 0; padding-top: 2px; }
#entryPage .entry-note { display: flex; align-items: center; height: 42px; padding: 0 14px; background: #fcf9f3; border: 1px solid var(--entry-line); border-radius: 24px; }
#entryPage #entryDetail { flex: 1; min-width: 0; width: 100%; height: 40px; padding: 0; color: #39332b; background: none; border: 0; box-shadow: none; font-size: 16px; outline: none; }
#entryPage #entryDetail::placeholder { color: #aaa69d; }
#entryPage .entry-note:focus-within { border-color: #e8b76e; }
#entryPage .entry-date-control { position: relative; display: flex; align-items: center; gap: 14px; width: fit-content; max-width: 100%; height: 40px; padding: 0 14px; overflow: hidden; font-size: 14px; }
#entryPage #entryDateRelative { color: #37352f; font-weight: 600; }
#entryPage #entryDateDisplay { color: #94928c; }
#entryPage .entry-date-control svg { width: 18px; height: 18px; color: #94928c; }
#entryPage #entryDate { position: absolute; inset: 0; display: block; width: 100%; min-width: 0; max-width: 100%; height: 40px; min-height: 40px; padding: 0; border: 0; opacity: 0; font-size: 16px; cursor: pointer; }
#entryPage .entry-date-control:focus-within { outline: 2px solid #d7840a; outline-offset: -2px; border-radius: 8px; }
#entryPage .entry-keypad { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px 12px; }
#entryPage .entry-keypad button { display: grid; place-items: center; min-width: 0; height: clamp(44px, 5.4dvh, 54px); margin: 0; padding: 0; color: #2e2d29; background: #fffcf7; border: 1px solid var(--entry-line); border-radius: 14px; box-shadow: none; font-size: 25px; font-weight: 450; line-height: 1; }
#entryPage .entry-keypad button:active { background: #f5ecdd; }
#entryPage .entry-keypad [data-entry-key="+"], #entryPage .entry-keypad [data-entry-key="-"] { font-size: 30px; color: #65635d; }
#entryPage .entry-keypad .entry-complete { grid-column: span 2; color: #fff; background: #ffa51e; border-color: #ee9817; border-radius: 19px; font-size: 22px; font-weight: 700; }
#entryPage .entry-keypad .entry-complete:active { background: #ed920a; }
#entryPage .entry-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
/* Keep the native keyboard from zooming or pushing the page sideways. */
body.entry-note-focused #entryPage .entry-keypad { display: none; }
body.entry-note-focused #appShell { height: var(--modal-viewport-height, 100dvh); }
@media (max-height: 680px) {
  #entryPage { --entry-icon-size: 48px; padding-top: 4px; padding-bottom: 10px; }
  #entryPage .entry-header { flex-basis: 36px; }
  #entryPage .visual-entry-card { grid-template-rows: 44px 50px minmax(0, 1fr) auto; gap: 4px; }
  #entryPage .entry-category-grid { --entry-icon-size: clamp(44px, calc((100cqh - 82px) / 3), 60px); row-gap: 8px; }
  #entryPage .entry-category-button { gap: 3px; padding-bottom: 0; font-size: 14px; }
  #entryPage .entry-category-name { min-height: 19px; line-height: 19px; }
  #entryPage .entry-date-control { height: 36px; }
  #entryPage .entry-keypad { row-gap: 5px; }
}
