:root {
  color-scheme: light;
  --rose: #e85f8a;
  --rose-dark: #a82f59;
  --rose-soft: #fff0f5;
  --ink: #302832;
  --muted: #716872;
  --line: #eee1e6;
  --paper: #fffefd;
  --canvas: #fff9f2;
  --green: #148b72;
  --green-soft: #e7fbf4;
  --amber: #8a5900;
  --amber-soft: #fff5cf;
  --red: #b72d24;
  --shadow: 0 14px 38px rgba(168, 47, 89, .11);
  --radius: 20px;
  --control-height: 50px;
  --field-gap: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }
html { max-width: 100%; overflow-x: hidden; background: var(--canvas); }
body { max-width: 100%; min-height: 100vh; margin: 0; overflow-x: hidden; color: var(--ink); background: linear-gradient(180deg, #fffef8 0, #fff8ef 360px, var(--canvas) 100%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.hidden { display: none !important; }
.skip-link { position: fixed; left: 12px; top: -80px; z-index: 100; background: var(--ink); color: #fff; padding: 12px; border-radius: 8px; }
.skip-link:focus { top: 12px; }

.app-header { position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 72px; padding: max(10px, env(safe-area-inset-top)) 18px 10px; background: rgba(255,255,253,.92); border-bottom: 1px solid rgba(238,225,230,.82); backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; min-width: 0; padding: 0; border: 0; gap: 10px; color: inherit; text-align: left; background: transparent; text-decoration: none; }
.brand:focus-visible { border-radius: 16px; outline: 3px solid rgba(232,95,138,.32); outline-offset: 3px; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 16px; background: linear-gradient(145deg, #fff5f8, #ffe0ea); font-size: 27px; box-shadow: inset 0 0 0 1px #ffcbd9, 0 5px 14px rgba(232,95,138,.10); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.header-logout { flex: 0 0 auto; white-space: nowrap; }
.header-actions { display: flex; flex: 0 0 auto; gap: 7px; align-items: center; }
.header-actions .button { white-space: nowrap; }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 14px; background: #fff; color: var(--ink); font-size: 24px; box-shadow: inset 0 0 0 1px var(--line); }

.shell { width: min(100%, 760px); margin: 0 auto; padding: 22px 16px calc(110px + env(safe-area-inset-bottom)); }
.center-state { display: grid; place-items: center; min-height: 55vh; color: var(--muted); }
.pig-loader { font-size: 44px; animation: bounce 1s ease-in-out infinite; }
@keyframes bounce { 50% { transform: translateY(-8px) rotate(-4deg); } }

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 7vw, 40px); line-height: 1.15; }
h2 { margin-bottom: 14px; font-size: 22px; }
h3 { margin-bottom: 8px; font-size: 17px; }
.eyebrow { margin-bottom: 6px; color: var(--rose-dark); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hero { padding: 12px 4px 22px; }
.hero p { max-width: 38rem; color: var(--muted); line-height: 1.7; }
.hero-badge { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 15px; padding: 7px 11px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: 12px; font-weight: 750; }

.card { margin-bottom: 14px; padding: 18px; border: 1px solid rgba(238,225,230,.94); border-radius: var(--radius); background: rgba(255,255,255,.94); box-shadow: 0 5px 18px rgba(91,64,76,.045); }
.card.emphasis { border-color: #ffd1de; background: linear-gradient(145deg, #fff, #fff3f7); box-shadow: var(--shadow); }
.danger-zone { border-color: #f3c5c1; background: #fff9f8; }
.card-head, .row, .toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head { margin-bottom: 14px; }
.stack { display: grid; gap: 12px; }
.section-gap { margin-top: 24px; }
.form-stack { display: grid; min-width: 0; gap: var(--field-gap); }
.form-stack > label, .form-stack > fieldset { margin-bottom: 0; }
.form-stack > label > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-stack > label > select,
.form-stack > .form-grid > label > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.form-stack > .form-grid > label > select { width: 100%; height: var(--control-height); min-height: var(--control-height); max-height: var(--control-height); margin: 0; }
.trip-create-form { width: min(100%, 620px); margin-inline: auto; }
.form-grid { display: grid; min-width: 0; gap: 12px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

label, fieldset { display: grid; min-width: 0; gap: 7px; margin-bottom: 14px; color: #4b424a; font-size: 13px; font-weight: 700; }
.form-grid > *, .row > *, .card-head > * { min-width: 0; }
fieldset { padding: 0; border: 0; }
legend { margin-bottom: 8px; }
input, select, textarea { width: 100%; max-width: 100%; min-width: 0; min-height: var(--control-height); padding: 11px 13px; border: 1px solid #dfd3d8; border-radius: 13px; outline: none; color: var(--ink); background: #fff; transition: border-color .16s, box-shadow .16s; }
input[type="date"] { display: block; inline-size: 100%; max-inline-size: 100%; min-inline-size: 0; }
input[type="date"]::-webkit-date-and-time-value { display: block; width: 100%; min-width: 0; overflow: hidden; text-align: left; text-overflow: ellipsis; }
input[type="date"]::-webkit-datetime-edit { display: block; min-width: 0; padding: 0; overflow: hidden; }
.date-field { width: 100%; min-width: 0; overflow: hidden; }
.date-control { position: relative; display: grid; align-items: center; width: 100%; max-width: 100%; min-width: 0; min-height: var(--control-height); overflow: hidden; border: 1px solid #dfd3d8; border-radius: 13px; background: #fff; }
.date-control:focus-within { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(232,95,138,.14); }
.date-display { display: block; min-width: 0; padding: 11px 42px 11px 13px; overflow: hidden; color: var(--ink); font-size: 16px; font-weight: 650; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.date-control::after { position: absolute; right: 13px; color: var(--muted); content: "📅"; font-size: 15px; pointer-events: none; }
.date-control input[type="date"] { position: absolute; inset: 0; z-index: 1; width: 100% !important; max-width: 100% !important; min-width: 0 !important; min-height: 100%; margin: 0; padding: 0; opacity: 0; border: 0; border-radius: 0; cursor: pointer; }
.date-control input[type="date"]:focus { box-shadow: none; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 4px rgba(232,95,138,.14); }

.button { min-height: 46px; padding: 11px 16px; border: 0; border-radius: 14px; font-weight: 800; transition: transform .12s, opacity .12s; }
.button:active { transform: scale(.98); }
.button:disabled { cursor: not-allowed; opacity: .55; }
.button.primary { color: #fff; background: linear-gradient(135deg, #dc4b7a, #ef7598); box-shadow: 0 9px 23px rgba(216,63,113,.24); }
.button.secondary { color: var(--rose-dark); background: var(--rose-soft); }
.button.ghost { color: var(--ink); background: #f7f1f3; }
.button.danger { color: var(--red); background: #fff0ef; }
.button.full { width: 100%; }
.button.small { min-height: 38px; padding: 8px 12px; border-radius: 11px; font-size: 13px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.segmented { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 4px; margin-bottom: 16px; padding: 4px; border-radius: 14px; background: #f5ebef; }
.segmented button { min-height: 42px; padding: 6px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 750; }
.segmented button.active { color: var(--rose-dark); background: #fff; box-shadow: 0 3px 10px rgba(168,47,89,.10); }

.trip-compact-header { position: relative; display: flex; overflow: hidden; align-items: center; justify-content: space-between; min-height: 84px; margin-bottom: 12px; padding: 14px 15px; border-radius: 20px; gap: 12px; color: #fff; background: linear-gradient(135deg, #139b91, #55c9ad); box-shadow: 0 9px 24px rgba(19,155,145,.16); }
.trip-compact-header::after { content: "🐷"; position: absolute; right: -4px; bottom: -18px; opacity: .13; font-size: 72px; transform: rotate(-10deg); pointer-events: none; }
.trip-compact-copy { position: relative; z-index: 1; min-width: 0; }
.trip-compact-copy h1 { margin: 0 0 4px; overflow: hidden; font-size: clamp(22px, 6vw, 30px); text-overflow: ellipsis; white-space: nowrap; }
.trip-compact-copy p { margin: 0; overflow: hidden; opacity: .86; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.trip-compact-header.status-reviewing { background: linear-gradient(135deg, #a96712, #d99a36); box-shadow: 0 9px 24px rgba(169,103,18,.15); }
.trip-compact-header.status-closed { background: linear-gradient(135deg, #46566b, #71839a); box-shadow: 0 9px 24px rgba(50,65,84,.14); }
.trip-compact-header.status-archived { background: linear-gradient(135deg, #666169, #8b858d); box-shadow: 0 9px 24px rgba(75,69,78,.13); }
.trip-compact-status { position: relative; z-index: 1; flex: 0 0 auto; max-width: 44%; min-height: 34px; padding: 7px 10px; overflow: hidden; border: 0; border-radius: 999px; color: #31564f; background: rgba(255,255,255,.90); text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 800; }
button.trip-compact-status { cursor: pointer; }
button.trip-compact-status:focus-visible { outline: 3px solid rgba(255,255,255,.48); outline-offset: 2px; }
.status-reviewing .trip-compact-status { color: #74440b; }
.status-closed .trip-compact-status, .status-archived .trip-compact-status { color: #394554; }
.status-pill, .chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 760; }
.status-pill { margin-bottom: 10px; color: #08756d; background: rgba(255,255,255,.88); }
.status-reviewing .status-pill { color: #7b4708; }
.status-closed .status-pill, .status-archived .status-pill { color: #394554; }
.chip { color: var(--muted); background: #f7f1f3; }
.readonly-chip { display: inline-flex; align-items: center; min-height: 38px; padding: 7px 10px; border-radius: 11px; color: #4b5665; background: #edf1f5; font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-guide { display: grid; gap: 6px; margin: -4px 0 16px; padding: 10px 12px; border-radius: 13px; background: #f7f4f5; }
.status-guide div { display: grid; grid-template-columns: minmax(112px,auto) 1fr; gap: 8px; font-size: 12px; }
.status-guide span { color: var(--muted); }
.archive-action { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.archive-action p { margin: 0; }
.archive-state { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; margin-bottom: 12px; padding: 11px 12px; border-radius: 13px; gap: 10px; background: #f2f1f3; }
.archive-state > span { font-size: 23px; }
.archive-state p { margin: 3px 0 0; }

.balance-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(145px, 1fr); gap: 10px; overflow-x: auto; margin: 0 -16px 18px; padding: 0 16px 8px; scrollbar-width: none; }
.balance-card { padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.balance-card .name { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.balance-card strong { font-size: 20px; }
.trip-balance-summary { display: flex; align-items: center; justify-content: space-between; min-height: 42px; margin-bottom: 14px; padding: 9px 12px; border: 1px solid #cceade; border-radius: 13px; gap: 12px; color: var(--green); background: var(--green-soft); font-size: 13px; font-weight: 800; }
.trip-balance-summary small { color: inherit; font-size: 11px; font-weight: 650; opacity: .78; }
.trip-balance-disclosure { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.92); }
.trip-balance-disclosure summary { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; min-height: 46px; padding: 9px 12px; gap: 9px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 750; }
.trip-balance-disclosure summary::-webkit-details-marker { display: none; }
.trip-balance-disclosure summary strong { font-size: 13px; }
.trip-balance-disclosure summary small { color: var(--rose-dark); white-space: nowrap; }
.balance-grid-disclosed { margin: 0; padding: 0 10px 10px; }
.tab-balance-section { margin-bottom: 14px; }
.compact-section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 7px; color: var(--muted); font-size: 12px; }
.compact-section-head small { font-size: 10px; }
.tab-balance-grid { margin-bottom: 0; }
.settlement-balance-summary { margin-bottom: 14px; }
.positive { color: var(--green); }
.negative { color: var(--red); }

.expense-list, .member-list, .audit-list { display: grid; gap: 10px; }
.expense-date-group { display: grid; min-width: 0; gap: 5px; }
.expense-date-items { display: grid; min-width: 0; gap: 8px; }
.expense-date-divider { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; min-height: 20px; margin: 0 4px; color: var(--muted); font-size: 12px; font-weight: 750; }
.expense-date-divider::before { content: ""; grid-column: 2; grid-row: 1; height: 1px; background: var(--line); }
.expense-date-divider time { grid-column: 1; grid-row: 1; }
.expense-date-divider span { grid-column: 3; grid-row: 1; font-size: 11px; font-weight: 650; }
.expense-item { display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 11px; align-items: center; width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 17px; text-align: left; background: #fff; }
.expense-item.void { opacity: .58; }
.expense-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: var(--rose-soft); font-size: 23px; }
.expense-item h3 { overflow: hidden; margin: 0 0 4px; text-overflow: ellipsis; white-space: nowrap; }
.expense-item p { margin: 0; color: var(--muted); font-size: 12px; }
.expense-amount { text-align: right; font-weight: 850; }
.expense-amount small { display: block; margin-top: 3px; color: var(--muted); font-weight: 500; }

.empty { padding: 28px 16px; border: 1px dashed #e3d3d9; border-radius: 18px; text-align: center; color: var(--muted); background: rgba(255,255,255,.68); }
.empty span { display: block; margin-bottom: 8px; font-size: 34px; }
.notice { padding: 12px 14px; border-radius: 13px; font-size: 13px; line-height: 1.55; }
.notice.warning { color: var(--amber); background: var(--amber-soft); }
.notice.success { color: var(--green); background: var(--green-soft); }
.notice.error { color: var(--red); background: #fff0ef; }
.notice.info { color: #75500f; background: #fff6df; }
.job-list { display: grid; gap: 10px; }
.job-card { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.job-card.status-failed { border-color: #efb1ad; background: #fffafa; }
.job-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.job-card-head > div { min-width: 0; display: grid; gap: 2px; }
.job-card-head small { display: block; overflow-wrap: anywhere; }
.job-message { display: grid; gap: 3px; overflow-wrap: anywhere; }
.job-recovery { display: grid; gap: 8px; }
.job-recovery p { margin: 0; }
.job-recovery .button { justify-self: end; }
.maintenance-banner { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 11px; align-items: center; margin-bottom: 16px; padding: 13px 14px; border: 1px solid #e2b761; border-radius: 16px; color: #6f470e; background: #fff7df; box-shadow: 0 5px 18px rgba(128,83,5,.08); }
.maintenance-banner > span:first-child { font-size: 22px; }
.maintenance-banner strong, .maintenance-banner small { display: block; }
.maintenance-banner small { margin-top: 2px; line-height: 1.35; opacity: .82; }
.invite-card { scroll-margin-top: 92px; }
.current-session-card { border-color: #b9e5d7; background: linear-gradient(145deg, #fff, #edf9f5); }
.current-session-card .card-head { margin-bottom: 0; }
.current-session-card .button { flex: 0 0 auto; }
.invite-share { display: grid; min-width: 0; gap: 10px; }
.invite-share p, .invite-share label { margin-bottom: 0; }
.invite-share input { direction: ltr; overflow: hidden; text-overflow: ellipsis; font-size: 12px; font-weight: 500; }
.settlement-suggestion-list { display: grid; gap: 8px; }
.settlement-suggestion { padding: 14px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.96); box-shadow: 0 4px 14px rgba(91,64,76,.04); }
.settlement-suggestion.is-pending { border-color: #edd49e; background: #fffbf2; }
.settlement-instruction { display: grid; grid-template-columns: minmax(0,1fr) minmax(116px,auto) minmax(0,1fr); gap: 12px; align-items: center; }
.settlement-party { display: grid; grid-template-columns: 56px minmax(0,1fr); gap: 8px; align-items: center; min-width: 0; }
.settlement-party strong { min-width: 0; overflow: hidden; font-size: 16px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.settlement-role { display: inline-flex; justify-content: center; padding: 5px 7px; border-radius: 8px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.settlement-role.payer { color: var(--rose-dark); background: var(--rose-soft); }
.settlement-role.receiver { color: var(--green); background: var(--green-soft); }
.settlement-transfer { display: grid; grid-template-columns: auto; justify-items: center; gap: 1px; min-width: 0; color: var(--muted); text-align: center; }
.settlement-transfer > span { color: var(--green); font-size: 15px; font-weight: 900; line-height: 1; }
.settlement-transfer strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.settlement-state { margin-top: 10px; padding: 8px 10px; border-radius: 10px; color: #74520f; background: #fff4d4; font-size: 12px; font-weight: 750; }
.settlement-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.settlement-actions .button { width: auto; min-height: 36px; padding: 7px 10px; white-space: nowrap; font-size: 12px; box-shadow: none; }
.settlement-action.receive { color: var(--green); background: var(--green-soft); }
.settlement-suggestion > .notice { margin-top: 10px; padding: 8px 10px; }
.report-number { margin: 4px 0; font-size: 28px; font-weight: 900; }
.bar-row { display: grid; grid-template-columns: 80px 1fr auto; gap: 9px; align-items: center; margin: 10px 0; font-size: 13px; }
.bar { width: 100%; height: 9px; overflow: hidden; border: 0; border-radius: 999px; background: #e8f3ef; appearance: none; }
.bar::-webkit-progress-bar { background: #e8f3ef; border-radius: 999px; }
.bar::-webkit-progress-value { background: linear-gradient(90deg, #149b90, #6dd8bd); border-radius: 999px; }
.bar::-moz-progress-bar { background: linear-gradient(90deg, #149b90, #6dd8bd); border-radius: 999px; }

.bottom-nav { position: fixed; z-index: 30; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); width: min(calc(100% - 20px), 560px); padding: 7px; border: 1px solid rgba(238,225,230,.92); border-radius: 22px; background: rgba(255,255,255,.95); box-shadow: 0 12px 40px rgba(91,64,76,.14); backdrop-filter: blur(18px); transform: translateX(-50%); }
.bottom-nav button { min-height: 54px; border: 0; border-radius: 16px; color: var(--muted); background: transparent; font-size: 11px; font-weight: 750; }
.bottom-nav button span { display: block; margin-bottom: 3px; font-size: 20px; }
.bottom-nav button.active { color: var(--rose-dark); background: var(--rose-soft); }

.toast-stack { position: fixed; z-index: 100; top: calc(78px + env(safe-area-inset-top)); left: 50%; display: grid; gap: 8px; width: min(calc(100% - 28px), 520px); pointer-events: none; transform: translateX(-50%); }
.toast { padding: 13px 16px; border-radius: 14px; color: #fff; background: #312c29; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { background: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.sheet-dialog { width: min(calc(100% - 18px), 600px); max-width: calc(100% - 18px); max-height: calc(100dvh - 24px); margin: auto auto 8px; padding: 0; overflow: hidden; border: 0; border-radius: 26px; background: var(--paper); box-shadow: 0 24px 80px rgba(36,24,18,.28); }
.sheet-dialog::backdrop { background: rgba(39,35,33,.42); backdrop-filter: blur(3px); }
.sheet-dialog form { width: 100%; max-width: 100%; max-height: calc(100dvh - 24px); padding: 20px; overflow-x: clip; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; }
.dialog-head { position: sticky; z-index: 2; top: -20px; display: flex; justify-content: space-between; align-items: center; margin: -20px -20px 18px; padding: 18px 20px 12px; background: rgba(255,253,251,.96); backdrop-filter: blur(12px); }
.dialog-head h2, .dialog-head p { margin-bottom: 0; }
.dialog-error { position: sticky; z-index: 3; top: 70px; margin-bottom: 14px; border: 1px solid #f2b8b4; box-shadow: 0 7px 18px rgba(185,54,47,.12); }
.dialog-actions { position: sticky; bottom: -20px; display: flex; flex-wrap: wrap; gap: 10px; margin: 8px -20px -20px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: rgba(255,253,251,.96); border-top: 1px solid var(--line); backdrop-filter: blur(12px); }
.dialog-actions .button { flex: 1 1 90px; }
.dialog-actions .primary { flex-grow: 2; }
.expense-form-section { display: grid; width: 100%; min-width: 0; gap: 11px; margin-bottom: 18px; }
.expense-form-section + .expense-form-section { padding-top: 16px; border-top: 1px solid var(--line); }
.expense-form-section > label, .expense-form-section > fieldset, .expense-form-section .form-grid > label { margin-bottom: 0; }
.expense-primary-section { margin-right: -8px; margin-left: -8px; padding: 16px 12px 14px; border: 1px solid #b9e5d7; border-radius: 18px; background: linear-gradient(145deg, #f7fffc, #e8f9f3); box-shadow: 0 8px 22px rgba(20,139,114,.08); }
.form-section-title { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; color: var(--ink); font-size: 18px; font-weight: 900; line-height: 1.25; letter-spacing: 0; }
.form-section-title::before { width: 4px; height: 18px; border-radius: 999px; background: var(--rose); content: ""; }
.expense-primary-section .form-section-title { color: #0d725f; }
.expense-primary-section .form-section-title::before { background: #1aa184; }
.expense-primary-section input, .expense-primary-section select { border-color: #b9ddd3; }
.expense-primary-section input:focus, .expense-primary-section select:focus { border-color: #1aa184; box-shadow: 0 0 0 4px rgba(20,139,114,.13); }
.expense-form-section label, .expense-form-section legend { font-size: 14px; }
.expense-meta-grid { width: 100%; max-width: 100%; min-width: 0; gap: 10px; }
.expense-meta-grid > label { width: 100%; max-width: 100%; min-width: 0; margin-bottom: 0; }
.expense-standard-field { width: 100%; max-width: 100%; min-width: 0; }
.expense-title-label input { font-size: 17px; font-weight: 700; }
.expense-money-grid { display: grid; grid-template-columns: minmax(0, 1fr) 112px; min-width: 0; gap: 10px; }
.expense-money-grid > * { min-width: 0; }
.expense-amount-label input { font-size: 22px; font-weight: 850; font-variant-numeric: tabular-nums; }
.participant-list { display: grid; gap: 8px; }
.participant-row { display: grid; grid-template-columns: auto minmax(0,1fr) minmax(104px,132px); gap: 9px; align-items: center; min-width: 0; min-height: 50px; padding: 7px 10px; border-radius: 13px; background: #faf2f5; }
.participant-row input[type="checkbox"] { width: 22px; min-height: 22px; accent-color: var(--rose); }
.participant-row input[type="number"] { min-height: 38px; padding: 7px 9px; }
.participant-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participant-allocation { min-width: 0; overflow: hidden; color: var(--ink); text-align: right; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }
.participant-control { display: grid; min-width: 0; gap: 2px; text-align: right; }
.participant-control small { min-width: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-variant-numeric: tabular-nums; }
.participant-input { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; min-width: 0; overflow: hidden; border: 1px solid #dfd3d8; border-radius: 12px; background: #fff; }
.participant-input:focus-within { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(232,95,138,.12); }
.participant-input input { width: 100%; min-width: 0; border: 0; border-radius: 0; box-shadow: none; text-align: right; }
.participant-input input:focus { box-shadow: none; }
.participant-input input:disabled { color: var(--muted); background: #f5f1f3; }
.participant-input span { padding-right: 8px; color: var(--muted); font-size: 11px; font-weight: 750; }
.split-summary { margin-bottom: 10px; padding: 9px 10px; border-radius: 12px; background: #f8f3f5; color: var(--muted); }
.split-summary-line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; }
.split-summary-line strong { min-width: 0; text-align: right; font-size: 12px; }
.split-summary p { margin: 4px 0 0; font-size: 11px; }
.split-summary.complete { color: var(--green); background: var(--green-soft); }
.split-summary.error { color: var(--red); background: #fff0ef; }
.split-progress { display: block; width: 100%; height: 4px; margin-top: 7px; overflow: hidden; border: 0; border-radius: 999px; background: #eadfe3; appearance: none; }
.split-progress::-webkit-progress-bar { background: #eadfe3; border-radius: 999px; }
.split-progress::-webkit-progress-value { background: var(--rose); border-radius: 999px; }
.split-progress::-moz-progress-bar { background: var(--rose); border-radius: 999px; }
.split-summary.complete .split-progress::-webkit-progress-value { background: var(--green); }
.split-summary.complete .split-progress::-moz-progress-bar { background: var(--green); }
.split-summary.error .split-progress::-webkit-progress-value { background: var(--red); }
.split-summary.error .split-progress::-moz-progress-bar { background: var(--red); }
.toggle-list { display: grid; gap: 6px; margin-bottom: 16px; }
.toggle-list label { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; padding: 8px 10px; border-radius: 12px; background: #faf2f5; }
.toggle-list input[type="checkbox"] { width: 22px; min-height: 22px; margin: 0; accent-color: var(--rose); }
.receipt-link { display: flex; justify-content: space-between; gap: 10px; padding: 11px 13px; border-radius: 12px; color: var(--rose-dark); background: var(--rose-soft); text-decoration: none; font-size: 13px; font-weight: 750; }
.receipt-link small { color: var(--muted); font-weight: 500; }
.settings-form { display: grid; gap: 14px; margin-bottom: 14px; }
.settings-form > .card { margin-bottom: 0; }
.settings-section { padding-top: 16px; }
.settings-section > h3 { margin-bottom: 14px; }
.settings-field { width: 100%; max-width: 100%; min-width: 0; }
.settings-field > input, .settings-field > select { width: 100%; height: var(--control-height); min-height: var(--control-height); max-height: var(--control-height); margin: 0; }
.device-card { background: #fbfaf9; }
.admin-setting-status { margin: 0; }
.admin-trip-card { display: grid; gap: 11px; }
.admin-trip-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.admin-trip-summary > div { min-width: 0; }
.admin-trip-summary h3 { overflow-wrap: anywhere; }
.admin-trip-summary h3, .admin-trip-summary p { margin-bottom: 4px; }
.admin-trip-summary .chip { flex: 0 0 auto; }
.admin-trip-open { min-height: 44px; }
.admin-trip-more { padding-top: 10px; border-top: 1px solid var(--line); }
.admin-trip-more summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 38px; color: var(--muted); cursor: pointer; font-size: 13px; font-weight: 800; list-style: none; }
.admin-trip-more summary::-webkit-details-marker { display: none; }
.admin-trip-more summary::after { content: "展開"; color: var(--rose-dark); font-size: 12px; }
.admin-trip-more[open] summary::after { content: "收合"; }
.admin-trip-danger-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-top: 8px; }
.admin-trip-danger-actions .button { width: 100%; min-height: 42px; white-space: normal; }
.admin-archive-list { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.admin-archive-list > summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 10px; padding: 0 4px; gap: 12px; cursor: pointer; list-style: none; font-size: 17px; font-weight: 850; }
.admin-archive-list > summary::-webkit-details-marker { display: none; }
.recent-invite-card .button { display: grid; place-items: center; text-decoration: none; }
.danger-text { color: var(--red); }

.confirm-dialog { width: min(calc(100% - 28px), 470px); max-width: calc(100% - 28px); padding: 0; border: 0; border-radius: 22px; background: var(--paper); box-shadow: 0 24px 80px rgba(36,24,18,.3); }
.confirm-dialog::backdrop { background: rgba(39,35,33,.48); backdrop-filter: blur(3px); }
.confirm-dialog form { display: grid; gap: 12px; padding: 22px; }
.confirm-dialog h2, .confirm-dialog p, .confirm-dialog label { margin-bottom: 0; }
.confirm-message { line-height: 1.65; }
.confirm-details { padding: 11px 12px; border-radius: 12px; background: #f7f2f4; font-weight: 800; white-space: pre-line; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1.35fr; gap: 10px; margin-top: 6px; }

@media (min-width: 700px) {
  .shell { padding-top: 34px; }
  .sheet-dialog { margin-bottom: auto; }
}

@media (max-width: 560px) {
  .brand small { display: none; }
  .form-grid.two, .action-grid { grid-template-columns: 1fr; }
  .current-session-card .card-head { flex-wrap: wrap; }
  .current-session-card .button { width: 100%; }
  .admin-trip-danger-actions { grid-template-columns: 1fr; }
  .date-range-grid { grid-template-columns: 1fr; }
  .maintenance-banner { grid-template-columns: auto minmax(0,1fr); }
  .maintenance-banner .button { grid-column: 1 / -1; width: 100%; }
  .settlement-instruction { grid-template-columns: minmax(0,1fr) auto; gap: 8px 10px; }
  .settlement-party { grid-template-columns: 54px minmax(0,1fr); }
  .settlement-party:last-child { grid-column: 1; grid-row: 2; }
  .settlement-transfer { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; align-content: center; justify-items: end; text-align: right; }
  .settlement-transfer > span { transform: rotate(90deg); }
  .settlement-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .settlement-actions .button { width: 100%; }
}

@media (max-width: 700px) {
  .expense-meta-grid { grid-template-columns: 1fr; }
}

@media (max-width: 380px) {
  .brand small { display: none; }
  .sheet-dialog form { padding-right: 16px; padding-left: 16px; }
  .dialog-head { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
  .dialog-actions { margin-right: -16px; margin-left: -16px; padding-right: 16px; padding-left: 16px; }
  .expense-primary-section { margin-right: -4px; margin-left: -4px; padding-right: 10px; padding-left: 10px; }
  .expense-money-grid { grid-template-columns: minmax(0, 1fr) 96px; }
  .participant-row { grid-template-columns: auto minmax(0,1fr) minmax(98px,116px); padding-right: 8px; padding-left: 8px; }
  .split-summary-line { align-items: flex-start; flex-direction: column; gap: 2px; }
  .split-summary-line strong { text-align: left; }
  .settlement-party { grid-template-columns: 50px minmax(0,1fr); gap: 7px; }
  .settlement-party strong { font-size: 15px; }
  .settlement-transfer strong { font-size: 18px; }
  .status-guide div { grid-template-columns: 1fr; gap: 1px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
