
.expense-page { max-width: 1200px; margin-inline: auto; }
.expense-page .notice { display: block; width: 100%; }
.expense-page .expense-close { display: flex; }
.expense-page .expense-hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(120deg, #f0edff, #e9f8f3); }
.expense-hero .btn { flex-shrink: 0; }
.expense-page .btn { min-height: 44px; }
.expense-page .btn:focus-visible, .expense-thumb:focus-visible { outline: 3px solid #5f4cff; outline-offset: 3px; }
.expense-steps { list-style: none; display: flex; gap: 14px; padding: 16px 0; border-bottom: 1px solid #e6e4ef; margin: 0; }
.expense-steps li { display: flex; align-items: center; gap: 7px; font-size: .85rem; color: #69657e; }
.expense-steps li span { display: grid; place-items: center; height: 26px; width: 26px; border-radius: 50%; background: #f0eef7; }
.expense-steps .is-current { color: #42349d; font-weight: 700; }
.expense-steps .is-current span { color: white; background: #5f4cff; }
.expense-steps .is-complete span { color: #12634f; background: #e2f6ef; }
.expense-hero h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 8px 0; }
.expense-form { margin-top: 20px; }
.expense-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.expense-upload { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border: 1px dashed #bab3de; border-radius: 14px; padding: 20px; background: #faf9ff; }
.expense-upload-title { display: grid; gap: 6px; flex-basis: 100%; margin-bottom: 8px; }
.expense-upload-title span { color: #69657e; font-size: .85rem; }
.expense-upload p { flex-basis: 100%; }
.expense-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.expense-upload:focus-within { outline: 2px solid #635bff; outline-offset: 4px; }
.expense-preview { display: block; max-height: 280px; max-width: 100%; margin: 16px auto; object-fit: contain; border-radius: 10px; }
.expense-ocr-status { color: #3a3570; min-height: 1.5em; }
.expense-confirm { display: flex; align-items: flex-start; gap: 8px; margin: 18px 0; }
.expense-confirm input { width: 20px; height: 20px; flex-shrink: 0; }
.expense-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.expense-period { max-width: 300px; margin: 16px 0; }
.expense-filters { padding: 12px 0; border-block: 1px solid #e6e4ef; }
.expense-filters > summary { margin-bottom: 0; min-height: 24px; }
.expense-filters[open] > summary { margin-bottom: 16px; }
.expense-totals > div { display: grid; gap: 6px; padding: 18px; border-radius: 14px; background: #f5f4fc; }
.expense-totals strong { font-size: clamp(1.15rem, 2.6vw, 1.8rem); color: #17135d; overflow-wrap: anywhere; }
.expense-totals small, .expense-card small { color: #69657e; }
.expense-breakdowns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 20px 0; }
.expense-breakdowns details { border: 1px solid #e6e4ef; border-radius: 12px; padding: 14px; }
.expense-page summary { cursor: pointer; font-weight: 650; margin-bottom: 10px; }
.expense-breakdowns details > div { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; }
.expense-close { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.expense-close p { flex: 1 1 300px; }
.expense-list { display: grid; gap: 12px; margin: 20px 0; }
.expense-card { display: flex; justify-content: space-between; gap: 18px; padding: 20px; border: 1px solid #e6e4ef; border-radius: 14px; }
.expense-card > div { min-width: 0; }
.expense-card-content { flex: 1; }
.expense-thumb { border: 1px solid #e6e4ef; border-radius: 9px; background: #faf9ff; padding: 6px; width: 64px; height: 84px; flex-shrink: 0; cursor: pointer; }
.expense-thumb img { width: 100%; height: 100%; object-fit: contain; }
.expense-card h3 { margin: 10px 0 6px; }
.expense-card p, .expense-detail p { white-space: pre-wrap; overflow-wrap: anywhere; }
.expense-card-side { display: grid; justify-items: end; gap: 10px; align-content: start; flex-shrink: 0; }
.expense-card-side > strong { font-size: 1.6rem; color: #17135d; }
.expense-category, .expense-status { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: .8rem; background: #eeebff; color: #42349d; margin-right: 8px; }
.expense-status { color: #805418; background: #fff3d7; }
.expense-status.is-paid { color: #12634f; background: #e2f6ef; }
.expense-receipt { display: block; width: auto; max-width: 100%; max-height: 650px; object-fit: contain; margin: 16px auto; }
.expense-comments article, .expense-history { border-bottom: 1px solid #e6e4ef; padding: 14px 0; }
.expense-detail time { display: block; color: #69657e; font-size: .8rem; margin-top: 4px; }
.expense-detail textarea { display: block; width: 100%; margin: 10px 0; min-height: 84px; }
.expense-detail details { margin-top: 22px; }
@media (max-width: 680px) {
  .expense-page .expense-hero { padding: 20px; }
  .expense-period { max-width: none; }
  .expense-hero .btn { width: 100%; }
  .expense-steps { gap: 8px; justify-content: space-between; }
  .expense-steps li { flex-direction: column; text-align: center; font-size: .75rem; }
  .expense-totals, .expense-breakdowns { grid-template-columns: 1fr; }
  .expense-totals > div { grid-template-columns: 1fr auto; }
  .expense-totals small { grid-column: 1 / -1; }
  .expense-card { display: grid; grid-template-columns: 54px 1fr; gap: 12px; padding: 16px; }
  .expense-thumb { width: 54px; height: 76px; }
  .expense-card-side { grid-column: 1 / -1; justify-items: start; grid-template-columns: 1fr; width: 100%; }
  .expense-upload .btn { flex: 1; }
  .expense-page .row-actions { flex-wrap: wrap; }
}

/* iPhone: readable fields prevent focus zoom, controls fit one thumb. */
.expense-manual { width: 100%; margin-bottom: 16px; }
.expense-page .panel { min-width: 0; }
.expense-form-panel { scroll-margin-top: 16px; }
@media (max-width: 680px) {
  .expense-page { width: 100%; min-width: 0; }
  .expense-page .panel { padding: 18px 14px; }
  .expense-page .form-grid { grid-template-columns: minmax(0, 1fr); }
  .expense-page input:not([type="checkbox"]):not([type="file"]),
  .expense-page select, .expense-page textarea { font-size: 16px; min-height: 48px; width: 100%; min-width: 0; max-width: 100%; }
  .expense-page textarea { min-height: 112px; }
  .expense-page .btn { min-height: 48px; touch-action: manipulation; white-space: normal; }
  .expense-upload { padding: 16px; }
  .expense-upload .btn { flex: 1 1 100%; }
  .expense-submit-actions { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .expense-submit-actions .btn, .expense-close .btn { width: 100%; }
  .expense-confirm { min-height: 48px; line-height: 1.6; align-items: center; }
  .expense-ocr-status { overflow-wrap: anywhere; line-height: 1.6; }
}

.expense-photo { margin-block: 16px; padding: 12px; border: 1px solid #dedbea; border-radius: 12px; }
.expense-photo .expense-preview { max-height: 650px; }
.expense-status.is-approved { color: #12634f; background: #e2f6ef; }
.expense-status.is-returned { color: #933348; background: #fff0f2; }
.expense-status.is-cancelled { color: #5d596b; background: #eeeef2; }
.expense-review-form, .expense-month-form { padding: 18px; margin-block: 18px; background: #f7f5ff; border: 1px solid #dedbea; border-radius: 12px; }
.expense-review-form label, .expense-month-form label, .expense-duplicate label { display: block; margin-block: 12px 6px; font-weight: 650; }
.expense-month-form input { margin-bottom: 14px; }
.expense-draft-status { font-size: .85rem; }
.expense-review-actions { gap: 10px; margin-block: 16px; }
@media (max-width:680px) {
  .expense-review-actions, .expense-month-form, .expense-review-form { display: grid; gap: 10px; }
  .expense-review-actions .btn { width: 100%; }
  .expense-page input, .expense-page select, .expense-page textarea { box-sizing: border-box; }
  .expense-detail, .expense-form-panel { scroll-margin-top: 100px; }
}

.expense-prediction-reset { margin-top: 8px; justify-self: start; }
.expense-prediction-reset[hidden] { display: none; }
