.bill-create-sheet { position: fixed; inset: auto 0 0; margin: 0 auto; padding: 0; width: min(720px,100%); max-width: 100%; height: min(94dvh,980px); max-height: 94dvh; border: 0; border-radius: 30px 30px 0 0; background: var(--background); overflow: hidden; box-shadow: 0 -18px 60px rgb(15 23 42 / 22%); }
.bill-create-sheet[open] { animation: bill-rise 280ms cubic-bezier(.2,.8,.2,1); }
.bill-create-sheet.is-closing { animation: bill-drop 240ms ease-in forwards; }
.bill-create-sheet::backdrop { background: rgb(15 23 42 / 52%); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.bill-create-sheet iframe { display: block; width: 100%; height: 100%; border: 0; }
.bill-sheet-close { position: absolute; right: 20px; top: 22px; z-index: 5; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid rgb(255 255 255 / 45%); border-radius: 50%; background: rgb(255 255 255 / 14%); color: white; font-size: 28px; line-height: 1; cursor: pointer; }
.bill-sheet-close:hover { background: rgb(255 255 255 / 24%); }
html.bill-sheet-open { overflow: hidden; }
@keyframes bill-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes bill-drop { from { transform: translateY(0); } to { transform: translateY(100%); } }
@media(prefers-reduced-motion:reduce) { .bill-create-sheet[open],.bill-create-sheet.is-closing { animation: none; } }

.bill-sheet-page { margin: 0; background: var(--background); color: var(--text); }
.bill-sheet-page .bill-form-header { position: sticky; top: 0; z-index: 4; margin: 0; padding: 24px 76px 22px 24px; min-height: 104px; background: linear-gradient(135deg,#245cc8,#18499f); color: white; }
.bill-sheet-page .bill-form-header h1 { margin: 0; font-size: 25px; line-height: 1.3; color: white; }
.bill-sheet-page [data-close-bill] { display: none; }
.bill-form-content { display: grid; gap: 18px; width: min(100%,680px); margin: 0 auto; padding: 20px 16px max(28px,env(safe-area-inset-bottom)); }
.bill-form-section { display: grid; gap: 18px; min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: 0 5px 18px rgb(31 83 174 / 7%); }
.bill-form-section > h2,.bill-section-heading h2 { margin: 0; font-size: 18px; line-height: 1.4; }
.bill-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bill-section-heading small { display: block; margin-top: 4px; color: var(--text-secondary); font-size: 13px; }
.bill-field { display: grid; gap: 8px; min-width: 0; color: var(--text); font-size: 14px; font-weight: 600; }
.bill-field > small,.bill-receipt-picker strong small { color: var(--text-secondary); font-weight: 400; }
.bill-field input,.bill-field select,.bill-advanced-fields input { width: 100%; min-width: 0; min-height: 52px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--background); color: var(--text); font: inherit; }
.bill-field input:focus,.bill-field select:focus,.bill-advanced-fields input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: var(--primary); }
.bill-category-field,.bill-method-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.bill-category-field legend,.bill-method-field legend { margin-bottom: 12px; color: var(--text); font-size: 14px; font-weight: 600; }
.bill-category-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.bill-category-options button { display: inline-flex; align-items: center; justify-content: flex-start; gap: 11px; min-width: 0; min-height: 50px; padding: 8px 14px 8px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-secondary); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; box-shadow: 0 3px 12px rgb(31 83 174 / 6%); transition: border-color .18s ease,background-color .18s ease,color .18s ease,transform .18s ease; }
.bill-category-options button:hover { border-color: var(--primary); transform: translateY(-1px); }
.bill-category-icon { display: grid; place-items: center; flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; background: var(--category-soft,#eaf2ff); color: var(--category-color,#245cc8); }
.bill-category-food { --category-soft:#fff0db;--category-color:#d97706; }.bill-category-transport { --category-soft:#e3efff;--category-color:#2563eb; }.bill-category-stay { --category-soft:#f2e8ff;--category-color:#7c3aed; }.bill-category-shopping { --category-soft:#ffe7f2;--category-color:#db2777; }.bill-category-entertainment { --category-soft:#fff4cc;--category-color:#b77900; }.bill-category-other { --category-soft:#edf1f6;--category-color:#536178; }
.bill-category-options button[aria-pressed="true"] { background: #245cc8; border-color: #245cc8; color: #fff; box-shadow: 0 6px 14px rgb(36 92 200 / 18%); }
.bill-category-options button[aria-pressed="true"] .bill-category-icon { background: rgb(255 255 255 / 18%); color: #fff; }
.bill-title-suggestions > span { color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.bill-title-suggestions > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.bill-title-suggestions button { min-height: 38px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--background); color: var(--text-secondary); font: inherit; font-size: 13px; cursor: pointer; animation: bill-suggestion-in .18s ease both; }
.bill-title-suggestions button:nth-child(2n) { animation-delay: .025s; }
.bill-title-suggestions button:hover { border-color: var(--primary); color: var(--primary); }
@keyframes bill-suggestion-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.bill-amount-panel { margin: 0; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--background); color: var(--text); box-shadow: none; }
.bill-amount-panel > label { color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.bill-amount-panel .amount-input { margin: 6px 0 2px; }
.bill-amount-panel .amount-input input { min-width: 0; color: var(--text); text-align: right; font-size: clamp(30px,7vw,40px); background: transparent; }
.bill-amount-panel .amount-input span { flex: 0 0 auto; color: var(--text-secondary); font-size: 18px; }
.bill-amount-panel > small { display: block; text-align: right; color: var(--text-secondary); font-size: 12px; }
.bill-two-columns { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.bill-method-tabs { display: grid; grid-template-columns: repeat(5,minmax(86px,1fr)); gap: 5px; overflow-x: auto; padding: 5px; border-radius: 15px; background: var(--background); scrollbar-width: thin; }
.bill-method-tabs label { min-width: 86px; }
.bill-method-tabs span { display: grid; place-items: center; min-height: 42px; padding: 8px; border-radius: 11px; text-align: center; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.bill-method-tabs input:checked + span { background: var(--surface); color: var(--primary); box-shadow: 0 3px 10px rgb(31 83 174 / 12%); }
.bill-toggle-all { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 58px; padding: 12px 15px; border: 1px solid var(--primary); border-radius: 16px; background: var(--blue-soft); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.bill-toggle-all span { font-weight: 600; }
.bill-toggle-all b { flex: 0 0 auto; color: var(--primary); font-size: 12px; }
.bill-member-list { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; }
.bill-member-list .member-choice { display: flex!important; flex-direction: row; align-items: center; justify-content: flex-start; gap: 13px!important; min-height: 66px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 16px; background: var(--background); color: var(--text); font-size: 14px!important; text-align: left; }
.bill-member-list .member-choice:has(input:checked) { border-color: var(--primary); background: var(--blue-soft); }
.bill-member-list .member-choice::after { content: '○'; margin-left: auto; color: var(--text-secondary); font-size: 22px; }
.bill-member-list .member-choice:has(input:checked)::after { content: '✓'; color: var(--primary); font-weight: 700; }
.bill-member-list .member-avatar { background: var(--avatar)!important; color: white!important; box-shadow: none!important; filter: none!important; opacity: 1!important; }
.bill-advanced-fields { display: grid; gap: 12px; padding: 14px; border-radius: 16px; background: var(--background); }
.bill-advanced-fields label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.bill-item-row { display: grid; gap: 10px; margin-bottom: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; }
.bill-multiple-payers { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 14px; font-weight: 600; }
.bill-multiple-payers input { width: 20px; height: 20px; accent-color: var(--primary); }
.bill-form-content .split-preview { min-height: 50px; padding: 13px; border-radius: 14px; background: var(--background); color: var(--text-secondary); font-size: 13px; line-height: 1.7; }
.bill-form-content #expense-error { margin: 0; color: var(--error); font-size: 13px; line-height: 1.6; }
.bill-receipt-picker { display: grid; justify-items: center; gap: 10px; min-height: 170px; padding: 22px; border: 2px dashed var(--border); border-radius: 18px; background: var(--background); text-align: center; cursor: pointer; }
.bill-receipt-picker strong { font-size: 15px; }
.bill-receipt-picker input { width: min(100%,300px); font-size: 13px; }
.bill-receipt-picker > span { color: var(--text); font-weight: 600; }
.bill-receipt-picker > small { color: var(--text-secondary); font-size: 12px; }
.bill-save-button { position: sticky; bottom: max(12px,env(safe-area-inset-bottom)); z-index: 3; min-height: 56px; margin: 0; border-radius: 18px; box-shadow: 0 10px 28px rgb(36 92 200 / 28%); }
html[data-theme="dark"] .bill-form-section { box-shadow: none; }
html[data-theme="dark"] .bill-category-options button { background: var(--background); box-shadow: none; }
html[data-theme="dark"] .bill-category-options button[aria-pressed="true"] { background: #245cc8; color: white; }
html[data-theme="dark"] .bill-toggle-all { background: #233d62; border-color: #6d9df0; }
html[data-theme="dark"] .bill-member-list .member-choice:has(input:checked) { background: #233d62; border-color: #6d9df0; }

@media(max-width:520px) {
  .bill-create-sheet { height: 95dvh; max-height: 95dvh; border-radius: 26px 26px 0 0; }
  .bill-sheet-page .bill-form-header { min-height: 96px; padding: 20px 72px 18px 18px; }
  .bill-form-content { gap: 14px; padding: 14px 12px max(22px,env(safe-area-inset-bottom)); }
  .bill-form-section { gap: 16px; padding: 16px; border-radius: 20px; }
  .bill-category-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .bill-two-columns { grid-template-columns: minmax(0,1fr); }
  .bill-toggle-all { align-items: flex-start; flex-direction: column; gap: 4px; }
}
