
    :root {
      --bg: #f6f7f8;
      --card: #fff;
      --ink: #1f2328;
      --muted: #6b7280;
      --line: #e5e7eb;
      --primary: #F2644A;
      --owe: #dc2626;
      --owed: #16a34a;
      --chip: #f6f7f8;
      --shadow: 0 1px 3px rgba(20, 32, 30, 0.08);
      --radius: 12px;
      --tap: 44px;
      --safe-bottom: env(safe-area-inset-bottom, 0px);
    }
    * { box-sizing: border-box; }
    html { -webkit-text-size-adjust: 100%; }
    body {
      margin: 0;
      min-height: 100vh;
      min-height: 100svh;
      display: flex;
      flex-direction: column;
      font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
      color: var(--ink);
      background: var(--bg);
      line-height: 1.4;
      padding-bottom: calc(1.25rem + var(--safe-bottom));
    }
    html:not([data-i18n-ready]) .app,
    html:not([data-i18n-ready]) .expense-footer,
    html:not([data-i18n-ready]) .page-footer,
    html:not([data-i18n-ready]) .expense-overlay,
    html:not([data-i18n-ready]) .correction-overlay,
    html:not([data-i18n-ready]) .toast { visibility: hidden; }
    .app { flex: 1; width: 100%; max-width: 28rem; margin: 0 auto; padding: 0 0.75rem 1rem; }
    .topbar {
      position: sticky; top: 0; z-index: 20;
      background: rgba(246, 247, 248, 0.96);
      backdrop-filter: blur(8px);
      border-bottom: 1px solid var(--line);
      margin: 0 -0.75rem;
      padding: calc(0.65rem + env(safe-area-inset-top, 0px)) 0.75rem 0.75rem;
    }
    .brand { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.45rem; }
    .trip-switch { display: flex; gap: 0.4rem; align-items: stretch; }
    section.card {
      background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
      box-shadow: var(--shadow); padding: 0.85rem 0.9rem; margin: 0.75rem 0;
    }
    section.card h2 { margin: 0 0 0.55rem; font-size: 1rem; }
    section.card p.lead { margin: -0.25rem 0 0.65rem; font-size: 0.82rem; color: var(--muted); }
    label.field { display: block; margin: 0.45rem 0 0.15rem; font-size: 0.8rem; color: var(--muted); font-weight: 600; }
    input, select, textarea, button { font: inherit; }
    input[type="text"], input[type="number"], select, textarea {
      width: 100%; min-height: var(--tap); padding: 0.55rem 0.65rem;
      border: 1px solid var(--line); border-radius: 10px; background: #fff;
    }
    .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    @media (max-width: 360px) { .row { grid-template-columns: 1fr; } }
    .checks { display: flex; flex-wrap: wrap; gap: 0.35rem; }
    .checks label {
      display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.25rem;
      padding: 0.25rem 0.6rem; background: var(--chip); border: 1px solid var(--line); border-radius: 10px; font-size: 0.9rem;
    }
    .checks input { width: 1rem; height: 1rem; }
    button {
      min-height: var(--tap); padding: 0.55rem 0.9rem; border-radius: 10px;
      border: 1px solid transparent; cursor: pointer; font-weight: 600;
    }
    button.primary { background: var(--primary); color: #fff; width: 100%; margin-top: 0.65rem; }
    button.primary:active { filter: brightness(.95); }
    button.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
    button.small { min-height: 2.25rem; padding: 0.35rem 0.65rem; font-size: 0.85rem; }
    button:disabled { opacity: 0.45; cursor: not-allowed; }
    .settle-empty { color: var(--muted); padding: 20px 0; text-align: center; }
    .pay-form { margin-top: 12px; }
    .toast {
      position: fixed; left: 50%; bottom: calc(1rem + var(--safe-bottom)); transform: translateX(-50%);
      background: var(--ink); color: #fff; padding: 0.55rem 0.9rem; border-radius: 999px;
      font-size: 0.85rem; max-width: calc(100% - 2rem); z-index: 50; opacity: 0;
      pointer-events: none; transition: opacity 0.2s;
    }
    .toast.show { opacity: 1; }
    pre.debug-out {
      background: #f6f7f8; padding: 0.5rem; overflow: auto; white-space: pre-wrap;
      font-size: 0.72rem; max-height: 18rem;
    }
    .trip-notice {
      margin: 0.5rem 0 0; padding: 0.5rem 0.65rem; border-radius: 10px;
      background: var(--chip); border: 1px solid var(--line); color: var(--ink); font-size: 0.85rem;
    }
    .trip-notice-error { background: #fef2f2; color: #dc2626; }
    .status { font-size: 0.8rem; color: var(--muted); min-height: 1.2em; margin: 0.35rem 0 0; }
    .status.err { color: var(--owe); }
    .history { margin-top: 1rem; color: var(--muted); font-size: 0.85rem; }
    .history summary { cursor: pointer; padding: 0.5rem 0; }
    .history-row { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
    .history-row small { display: block; font-size: 0.75rem; margin-top: 0.2rem; }

[hidden] { display: none !important; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid #6b7280; outline-offset: 3px; }
.app { max-width: 430px; padding: 0 22px 24px; }
.topbar { position: static; margin: 0 -22px; padding: calc(30px + env(safe-area-inset-top, 0px)) 22px 18px; border: 0; }
.brand { align-items: center; justify-content: flex-start; gap: 8px; margin-bottom: 8px; }
.page-footer { flex-shrink: 0; width: 100%; max-width: 430px; margin: 0 auto; padding: 0 22px; }
.about-version { margin: 0; min-height: 1em; font-size: 11px; }
.brand img { width: 28px; height: 28px; }
.wordmark { font-size: 23px; letter-spacing: -1.2px; font-weight: 750; }
.wordmark span { color: #F2644A; }
.trip-heading { flex: 1; min-width: 0; }
.trip-switch { align-items: center; }
.trip-switch h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.8px; margin: 0 0 9px; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 13px; }
.trip-heading p { margin: 0; }
.icon-button { flex-shrink: 0; width: 44px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); background: white; border-radius: 13px; }
.link-button { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--muted); text-decoration: underline; font-weight: 400; }
.picker { padding: 18px; background: white; border: 1px solid var(--line); border-radius: 18px; margin: 8px 0 20px; }
.eyebrow { font-size: 12px; color: var(--muted); font-weight: 600; margin: 0 0 14px; }
.people { display: flex; flex-wrap: wrap; gap: 18px; justify-content: space-around; }
.person { border: 0; background: none; padding: 2px; display: grid; justify-items: center; gap: 7px; font-size: 12px; color: var(--muted); font-weight: 400; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 650; color: var(--ink); background: #e8e5f2; }
.person:nth-child(4n+2) .avatar { background: #e3ece5; }
.person:nth-child(4n+3) .avatar { background: #e5ebf2; }
.person:nth-child(4n+4) .avatar { background: #f0e9db; }
.your { margin: 0 0 18px; border-radius: 12px; padding: 14px; background: #ecfdf3; color: #16a34a; font-variant-numeric: tabular-nums; }
.your small { display: block; font-size: 11px; margin-bottom: 5px; }
.your strong { font-size: 20px; letter-spacing: -.4px; }
.your.negative { background: #fef2f2; color: #dc2626; }
.your.square { background: #f6f7f8; color: #6b7280; }
.tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.tabs button { width: 33.333%; border: 0; background: none; padding: 13px 0; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; border-radius: 0; }
.tabs button[aria-selected=true] { color: var(--ink); font-weight: 650; border-bottom-color: var(--ink); }
section.card { border-radius: 15px; box-shadow: none; }
button.primary { border-radius: 14px; }

.money { font-variant-numeric: tabular-nums; }
.creditor { border-left: 3px solid #F2644A; }

body:has(#expenseFooter:not([hidden])) { padding-bottom: calc(100px + var(--safe-bottom)); }
.expense-heading { font-size: 15px; margin: 0 0 13px; }
#expenseList { color: var(--muted); font-size: 13px; }
.expense-card { display: flex; align-items: center; gap: 12px; padding: 17px 14px; background: white; border: 1px solid var(--line); border-radius: 15px; margin-bottom: 10px; color: var(--ink); }
.expense-card .avatar { width: 38px; height: 38px; flex-shrink: 0; }
.expense-details { flex: 1; min-width: 0; }
.expense-title { font-size: 14px; font-weight: 650; margin-bottom: 5px; overflow-wrap: anywhere; }
.expense-details .muted { font-size: 11px; }
.expense-money { font-size: 15px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.expense-footer { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 430px; padding: 12px 22px calc(16px + var(--safe-bottom)); background: var(--bg); z-index: 25; }
.expense-footer button.primary { margin: 0; }
.toast { bottom: calc(90px + var(--safe-bottom)); }
.expense-overlay { position: fixed; inset: 0; background: #1f232866; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.expense-sheet { width: 100%; max-width: 430px; background: white; border-radius: 25px 25px 0 0; padding: 12px 24px calc(24px + var(--safe-bottom)); max-height: 95dvh; overflow: auto; }
.sheet-handle { width: 36px; height: 4px; border-radius: 3px; background: var(--line); margin: 0 auto 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { font-size: 20px; margin: 0; }
#sheetClose { border: 0; background: var(--bg); border-radius: 50%; font-size: 24px; width: 44px; padding: 0; }
.sheet-segments { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin-top: 18px; }
.sheet-segments button { flex: 1; background: transparent; font-size: 12px; padding: 8px; }
.sheet-segments button[aria-pressed=true] { background: white; box-shadow: var(--shadow); }
.sheet-amount { display: flex; align-items: center; gap: 8px; font-size: 42px; margin: 24px 0; }
.sheet-amount input[type=text] { font-size: 42px; border: 0; padding: 0; min-width: 0; font-variant-numeric: tabular-nums; }
#sheetWhen { width: 100%; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font: inherit; }
.expense-sheet .field { display: block; font-size: 12px; font-weight: 600; margin: 18px 0 10px; }
.sheet-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.sheet-chip { flex: 1; border: 1px solid var(--line); background: white; font-size: 12px; padding: 10px; }
.sheet-chip[aria-pressed=true] { background: var(--ink); border-color: var(--ink); color: white; }
.sheet-check { display: flex; align-items: center; gap: 12px; min-height: 44px; border-bottom: 1px solid var(--line); font-size: 14px; }
.sheet-check input { width: 18px; height: 18px; accent-color: var(--ink); }
body.sheet-open { overflow: hidden; }
html.clardeal-scroll-lock { overflow: hidden; }

.balance-heading, .history-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.balance-heading h2, .history-heading h2, .settle-heading { font-size: 15px; color: var(--ink); margin: 0; }
.balance-card { display: flex; align-items: center; gap: 12px; padding: 17px 14px; background: white; border: 1px solid var(--line); border-radius: 15px; margin-bottom: 10px; }
.balance-card.creditor { border-left: 3px solid var(--primary); }
.balance-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 650; }
.balance-card .avatar { flex-shrink: 0; }
.balance-card .money { font-size: 15px; font-weight: 650; white-space: nowrap; }
.balance-card .positive { color: #16a34a; background: #ecfdf3; border-radius: 8px; padding: 5px 8px; }
.balance-card .negative { color: #dc2626; }
.settle-heading { margin: 26px 0 10px; }
.pending-ops { margin: 12px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.pending-ops h2 { font-size: 15px; margin: 0 0 8px; }
.pending-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; }
.settle-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; border-bottom: 1px solid var(--line); padding: 14px 0; font-size: 13px; }
.settle-names { flex: 1; overflow-wrap: anywhere; }
.settle-actions { display: flex; gap: 8px; }
.settle-actions button.primary { margin: 0; width: auto; }
.settle-question, .settle-row .status { width: 100%; overflow-wrap: anywhere; }
#otherPayment { margin-top: 24px; font-size: 13px; color: var(--muted); }
#otherPayment summary { cursor: pointer; padding: 10px 0; }
#btnPay { width: 100%; margin-top: 12px; }
.export-placeholder { display: flex; align-items: center; gap: 7px; color: var(--muted); }
#btnExport { color: var(--muted); background: var(--bg); font-size: 12px; font-weight: 400; }

button.brand, a.brand { background: transparent; border: 0; padding: 0; color: inherit; text-decoration: none; }
.trip-load-error { margin: 16px 0 8px; }
#tripLoadRetry { min-height: var(--tap); }
a.trip-row, a.trip-open { color: inherit; text-decoration: none; }
a.trip-open { flex: 1; min-width: 0; display: grid; gap: 7px; }
button.trip-forget, button.trip-retry { width: auto; margin: 0; flex: 0 0 auto; background: #fff; border: 1px solid var(--line); }
button.trip-forget:disabled { opacity: 0.45; }
.forget-dialog { position: fixed; inset: 0; z-index: 60; background: #1f232866; display: flex; align-items: center; justify-content: center; padding: 22px; }
.forget-card { width: min(100%, 360px); max-height: calc(100vh - 44px); overflow: auto; background: #fff; border-radius: 16px; padding: 22px; }
.forget-card h2 { font-size: 22px; line-height: 1.3; margin: 0 0 8px; overflow-wrap: anywhere; }
.forget-card p { margin: 0; }
#forgetTripOpen { display: inline-block; margin-top: 12px; }
#forgetTripCopy { width: 100%; margin-top: 16px; }
#forgetTripCopyStatus { margin: 8px 0 0; overflow-wrap: anywhere; }
#forgetTripCopyStatus:empty { display: none; }
#forgetTripCopyFallback { margin-top: 12px; min-width: 0; }
#forgetTripCopyFallback label,
#forgetTripCopyFallback p { display: block; margin: 0 0 6px; overflow-wrap: anywhere; }
#forgetTripCopyUrl { width: 100%; min-width: 0; max-width: 100%; box-sizing: border-box; }
.forget-actions { display: flex; gap: 8px; margin-top: 16px; }
.forget-actions button { width: auto; margin: 0; flex: 1; }
body.forget-open { overflow: hidden; }
#overviewStatus:empty { display: none; }
#tripPeople { padding: 0; min-height: 44px; text-decoration: none; }
.screen { min-height: 65vh; padding: 0 0 24px; }
.screen-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.screen-heading h2 { font-size: 25px; letter-spacing: -.7px; margin: 0; }
#tripsScreen h2[tabindex="-1"]:focus { outline: none; }
.screen-back { font-size: 25px; padding: 0; width: 44px; }
.trip-row { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; background: white; border: 1px solid var(--line); padding: 18px; margin-bottom: 10px; border-radius: 15px; overflow-wrap: anywhere; }
.people-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.new-person-row { display: flex; gap: 8px; margin: 10px 0; }
#btnAddPerson { margin-top: 12px; }
.share-note { margin: 6px 0 0; font-size: 12px; line-height: 1.4; }
.toast.toast-multi { border-radius: 14px; text-align: center; width: max-content; max-width: min(340px, calc(100% - 2rem)); }
.screen-subtitle { margin: 3px 0 0; font-size: 13px; }
.identity-confirm { color: inherit; padding-left: 0; }
/* Account controls remain distinct from the selected financial participant. */
.account-bar { display:flex; align-items:center; gap:.7rem; flex-wrap:wrap; margin-top:.65rem; }
#accountReminder { font-size:.82rem; margin:.4rem 0 0; }
#authDialog { border:1px solid #d6d8d4; border-radius:18px; padding:1.5rem; max-width:420px; width:calc(100% - 2rem); color:inherit; background:var(--paper, #fff); }
#authDialog::backdrop { background:rgba(15,30,26,.45); }
#authDialog input { width:100%; box-sizing:border-box; }
.auth-actions { display:flex; flex-wrap:wrap; gap:.6rem; margin-top:1rem; }

/* Global account controls and group context occupy separate rows. */
.topbar { position:sticky; top:0; display:flex; align-items:center; justify-content:space-between; gap:12px; padding-top:calc(18px + env(safe-area-inset-top, 0px)); padding-bottom:8px; }
.topbar .brand { margin:0; min-height:44px; flex-shrink:0; }
.menu-trigger { display:flex; align-items:center; gap:8px; min-width:0; }
#accountStatus { font-size:12px; color:#515d69; white-space:nowrap; }
#btnMenu { white-space:nowrap; min-width:44px; min-height:44px; padding:8px 12px; background:white; border:1px solid var(--line); }
#groupContext { margin-top:0; }
.all-groups { display:inline-flex; align-items:center; min-height:44px; font-size:14px; color:#515d69; }
.group-summary { display:flex; flex-wrap:wrap; align-items:center; column-gap:8px; }
.participant-section { margin:14px 0; }
#identityHint { display:flex; align-items:center; gap:4px; min-width:0; max-width:100%; }
#identityName { color:var(--ink); font-weight:600; overflow-wrap:anywhere; min-width:0; }
.identity-change { display:inline-flex; align-items:center; white-space:nowrap; flex-shrink:0; }
.identity-change .link-button { padding:0 2px; }
#btnConfirmMe { min-width:0; overflow-wrap:anywhere; }
#identityPicker { border:0; padding:0; margin:0; border-radius:0; }
#identityPickerHeading { margin:6px 0 12px; }
#btnChangeMe, #btnConfirmMe { min-height:44px; }
#menuDialog { position:fixed; inset:auto; top:calc(74px + env(safe-area-inset-top, 0px)); left:auto; right:max(12px, calc((100vw - 406px) / 2)); margin:0; width:min(360px, calc(100vw - 24px)); max-height:calc(100dvh - 90px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); overflow:auto; overscroll-behavior:contain; padding:16px; border:1px solid #d7dce1; border-radius:14px; background:white; color:var(--ink); box-shadow:0 10px 30px #14201e38; }
#menuDialog::backdrop { background:#15202766; }
.menu-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; }
.menu-heading h2 { margin:0; font-size:20px; }
#menuClose { min-height:44px; min-width:44px; background:white; border:1px solid var(--line); }
#menuDialog .eyebrow { margin:8px 0; }
#accountLabel { margin:4px 0; }
#accountEmail { overflow-wrap:anywhere; font-weight:600; margin:4px 0 12px; }
#accountReminder { font-size:14px; margin:8px 0 16px; }
#accountMessage:empty, #menuError:empty { display:none; }
.menu-action { display:block; width:100%; min-height:44px; text-align:left; border:0; border-top:1px solid var(--line); border-radius:0; background:white; padding:12px 0; margin-top:6px; }
a:focus-visible { outline:3px solid #6b7280; outline-offset:3px; }
@media(max-width:390px) { .topbar { gap:8px; } .topbar .brand img { display:none; } .menu-trigger { gap:6px; } #btnMenu { font-size:14px; padding:8px; } .topbar .wordmark { font-size:20px; } }
.expense-card { flex-wrap: wrap; }
.correction-actions { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.history-row .correction-actions { margin-top: 8px; }
.correction-overlay { position: fixed; inset: 0; background: #1f232866; z-index: 70; display: flex; align-items: flex-end; justify-content: center; }
.correction-dialog { width: 100%; max-width: 430px; max-height: 95dvh; overflow: auto; background: #fff; border-radius: 25px 25px 0 0; padding: 12px 24px calc(24px + var(--safe-bottom)); }
.correction-dialog .field { display: block; }
.correction-dialog textarea { width: 100%; min-height: 88px; }
.correction-actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.correction-actions-row button { width: auto; margin: 0; flex: 1; }
.correction-direction { font-weight: 650; overflow-wrap: anywhere; }
.correction-warning:empty { display: none; }
.correction-reason, .correction-note { overflow-wrap: anywhere; }
body.correction-open { overflow: hidden; }
@media (max-width: 390px) {
  .correction-dialog { padding: 12px 16px calc(16px + var(--safe-bottom)); }
  .correction-actions-row { align-items: stretch; }
}

.entry-details-overlay { position: fixed; inset: 0; background: #1f232866; z-index: 65; display: flex; align-items: flex-end; justify-content: center; }
.entry-details-dialog { width: min(100%, 430px); max-height: min(95dvh, 760px); overflow: auto; background: var(--bg); border-radius: 25px 25px 0 0; padding: 12px 24px calc(24px + var(--safe-bottom)); overflow-wrap: anywhere; }
.entry-details-dialog h2, .entry-details-dialog h3 { overflow-wrap: anywhere; }
.entry-details-dialog h2 { font-size: 22px; letter-spacing: -0.4px; }
.entry-details-dialog h3 { margin: 1.15rem 0 0.7rem; font-size: 18px; }
#entryDetailsSummary { margin: 4px 0 8px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 15px; }
#entryDetailsSummary p, #entryDetailsTimeline p, .entry-activity p { margin: 0.28rem 0; }
.entry-details-status-label { display: inline-block; margin: 0 0 8px; padding: 3px 8px; border-radius: 6px; background: #fff0eb; color: #b63f2d; font-size: 12px; font-weight: 700; }
.entry-details-identity { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
#entryDetailsSummary .entry-details-amount { font-size: 34px; font-weight: 750; letter-spacing: -1px; line-height: 1.1; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
#entryDetailsSummary .entry-details-count,
#entryDetailsSummary p:not(.entry-details-amount):not(.entry-details-identity):not(.entry-details-status-label) { color: var(--muted); font-size: 14px; }
.entry-activity-headline { font-size: 16px; font-weight: 700; line-height: 1.35; color: var(--ink); }
.entry-activity-change, .entry-activity-actor, .entry-activity-time { color: var(--muted); font-size: 13px; }
.entry-activity-time, .entry-details-created-at { font-size: 12px; }
.correction-reason { font-size: 14px; margin: 6px 0; }
.entry-details-link { max-width: 100%; white-space: normal; text-align: left; color: #b63f2d; font-weight: 650; text-decoration: none; }
.expense-card > .entry-details-link { flex: 1 0 100%; margin-top: 4px; }
#entryDetailsTimeline { margin-left: 4px; }
.entry-details-change, .entry-details-creation { position: relative; margin: 0; padding: 0 0 18px 22px; border-top: 0; border-left: 1px solid var(--line); }
.entry-details-change::before, .entry-details-creation::before { content: ""; position: absolute; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); border: 2px solid var(--bg); left: -6px; top: 4px; }
#entryDetailsTimeline > :first-child::before { background: var(--primary); }
#entryDetailsTimeline > :last-child { border-left-color: transparent; padding-bottom: 0; }
.entry-details-before, .entry-details-after { padding-left: 0.75rem; border-left: 2px solid var(--line); margin: 0.35rem 0 0.6rem; color: var(--muted); font-size: 14px; }
#entryDetailsActions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
#entryDetailsActions:empty { display: none; }
#entryDetailsActions button, #entryDetailsMore, #entryDetailsClose { min-height: 44px; }
#entryDetailsMore { margin-top: 8px; }
body.entry-details-open { overflow: hidden; }
@media (min-width: 800px) {
  .entry-details-overlay { align-items: center; padding: 24px; }
  .entry-details-dialog { border-radius: 20px; }
}
@media (max-width: 390px) {
  .entry-details-dialog { padding: 12px 16px calc(16px + var(--safe-bottom)); }
}

.correction-detail p, .correction-dialog p { margin: 0.4rem 0; }
.correction-detail .correction-original, .correction-detail .correction-proposed {
  padding-left: 0.75rem; border-left: 2px solid var(--line); margin: 0.6rem 0;
}
#correctionOriginal, #correctionProposed { margin: 0.75rem 0; }

#expenseOverlay { flex-direction: column; align-items: center; justify-content: flex-start; }
#expenseOverlay > .topbar {
  position: relative; top: auto; z-index: auto; flex: 0 0 auto;
  width: min(100%, 430px); max-width: 430px; margin: 0; background: var(--bg);
}
#btnTrips[inert] { pointer-events: none; }
#expenseOverlay > .expense-sheet {
  flex: 1 1 auto; min-height: 0; max-height: none; width: min(100%, 430px); overflow: auto;
}
@media (max-height: 420px) {
  #expenseOverlay > .topbar { padding-top: 8px; padding-bottom: 4px; }
  #expenseOverlay > .expense-sheet { padding-top: 8px; padding-bottom: 12px; }
  .sheet-amount { margin: 12px 0; font-size: 32px; }
  .sheet-amount input[type=text] { font-size: 32px; }
}
.menu-separator { height: 0; margin: 12px 0 0; border: 0; border-top: 1px solid var(--line); }
#helpDialog {
  color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 0;
  width: min(560px, calc(100% - 24px)); max-width: 560px;
  max-height: min(80dvh, calc(100dvh - 48px)); margin: auto; background: #fff; overflow: hidden;
}
#helpDialog::backdrop { background: rgba(24, 30, 36, 0.38); }
.help-layout { display: flex; flex-direction: column; max-height: min(80dvh, calc(100dvh - 48px)); }
.help-head { flex: 0 0 auto; padding: 22px 24px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.help-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#helpTitle { margin: 0; font-size: 24px; letter-spacing: -0.6px; }
#helpIntro { margin: 8px 0 0; }
#helpClose { flex: 0 0 auto; min-height: 44px; min-width: 44px; background: #fff; border: 1px solid var(--line); }
#helpScroll { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 0 24px 16px; }
.help-topic { border-bottom: 1px solid var(--line); }
.help-topic summary {
  list-style: none; cursor: pointer; min-height: 44px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 12px 0; font-weight: 650; text-align: left;
}
.help-topic summary::-webkit-details-marker { display: none; }
.help-topic summary::after { content: "+"; flex: 0 0 auto; font-weight: 400; }
.help-topic[open] summary::after { content: "−"; }
.help-topic p, #helpReturn { margin: 0 0 12px; overflow-wrap: anywhere; }
.help-example { background: var(--bg); border-left: 3px solid var(--primary); padding: 10px 12px; }
@media (max-height: 500px) {
  .help-head { padding: 12px 16px 8px; }
  #helpTitle { font-size: 20px; }
  #helpDialog, .help-layout { max-height: calc(100dvh - 24px); }
  #helpDialog { width: calc(100% - 16px); }
  #helpScroll { padding: 0 16px 12px; }
}
#feedbackDialog {
  color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 0;
  width: min(560px, calc(100% - 24px)); max-width: 560px;
  max-height: min(80dvh, calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)));
  margin: auto; background: #fff; overflow: hidden;
}
#feedbackDialog::backdrop { background: rgba(24, 30, 36, 0.38); }
.feedback-layout { display: flex; flex-direction: column; max-height: min(80dvh, calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))); }
.feedback-head { flex: 0 0 auto; padding: 18px 22px; border-bottom: 1px solid var(--line); background: #fff; }
.feedback-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
#feedbackTitle { margin: 0; font-size: 24px; letter-spacing: -0.6px; }
#feedbackClose { flex: 0 0 auto; min-height: 44px; min-width: 44px; background: #fff; border: 1px solid var(--line); }
#feedbackScroll { overflow: auto; overscroll-behavior: contain; min-height: 0; padding: 0 22px calc(22px + env(safe-area-inset-bottom, 0px)); }
#feedbackDialog .field { margin: 18px 0; }
#feedbackDialog .field > label { display: block; font-weight: 650; margin-bottom: 7px; }
#feedbackDialog input, #feedbackDialog select, #feedbackDialog textarea {
  width: 100%; min-height: 44px; background: #fff; border: 1px solid #a7afb9; border-radius: 9px; padding: 10px 12px;
}
#feedbackDialog textarea { resize: vertical; min-height: 105px; line-height: 1.5; }
#feedbackDialog input:read-only, #feedbackDialog textarea:read-only { background: var(--bg); }
#feedbackDialog [aria-invalid=true] { border: 2px solid #a62323; }
.feedback-privacy, #feedbackDialog .hint { font-size: 13px; color: var(--muted); margin: 6px 0; }
.feedback-error { color: #a62323; font-size: 14px; margin: 5px 0; }
.feedback-notice { padding: 12px 14px; background: var(--bg); border-radius: 10px; margin: 15px 0; }
.feedback-notice.feedback-error { background: #fff0ef; }
.feedback-actions { margin-top: 18px; }
.feedback-actions .primary { width: 100%; min-height: 44px; }
.feedback-receipt { padding: 28px 0 16px; text-align: center; }
.feedback-receipt code { font-size: 17px; display: block; margin: 18px 0; overflow-wrap: anywhere; }
#feedbackReceiptHeading { margin: 0 0 8px; }
@media (max-width: 360px) {
  .feedback-head { padding: 14px; }
  #feedbackTitle { font-size: 20px; }
  #feedbackScroll { padding: 0 14px calc(16px + env(safe-area-inset-bottom, 0px)); }
  #feedbackDialog { width: calc(100% - 16px); }
}
#peopleDialog, #shareDialog {
  color: var(--ink); border: 1px solid var(--line); border-radius: 20px; padding: 0;
  width: min(28rem, calc(100vw - 16px)); max-width: calc(100vw - 16px);
  max-height: min(90dvh, calc(100dvh - 16px)); margin: auto; background: #fff; overflow: auto;
}
#peopleDialog::backdrop, #shareDialog::backdrop { background: rgba(24, 30, 36, 0.38); }
#peopleDialog .dialog-head, #shareDialog .dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 16px 8px; position: sticky; top: 0; background: #fff;
}
#peopleDialog .dialog-head h2, #shareDialog .dialog-head h2 {
  margin: 0; font-size: 1.35rem; letter-spacing: -0.4px; min-width: 0; overflow-wrap: anywhere;
}
#peopleDialog .dialog-head button, #shareDialog .dialog-head button {
  background: #fff; border: 1px solid var(--line); flex: 0 0 auto;
}
#peopleDialog .dialog-body, #shareDialog .dialog-body { padding: 0 16px 16px; }
#addMemberForm label.field { margin-bottom: 8px; }
#peopleDialog .intro, #shareDialog .intro { margin: 0 0 8px; color: var(--muted); overflow-wrap: anywhere; }
#peopleDialog fieldset.identity-options { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
#peopleDialog legend { font-weight: 650; padding: 0; }
#peopleDialog .note, #shareDialog .note { color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
#peopleDialog .member {
  display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line);
}
#peopleDialog .member .avatar { width: 34px; height: 34px; font-size: 13px; flex: 0 0 auto; }
#peopleDialog .member span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#peopleDialog .member input { flex: 0 0 auto; width: 1.25rem; height: 1.25rem; }
#peopleDialog .error { color: var(--owe); min-height: 1.2em; margin: 0.35rem 0; overflow-wrap: anywhere; }
#peopleDialog .explain p, #shareDialog p { overflow-wrap: anywhere; }
#peopleDialog .explain p { margin: 0.35rem 0; }
#peopleDialog #btnOpenAddPerson {
  width: 100%; margin-top: 8px; background: #fff; border: 1px solid var(--line); color: var(--ink);
}
#peopleDialog .dialog-actions, #shareDialog .dialog-actions { display: flex; gap: 8px; margin-top: 12px; }
#peopleDialog .dialog-actions button, #shareDialog .dialog-actions button { flex: 1 1 0; width: auto; margin-top: 0; }
#shareDialog .link-preview {
  display: block; overflow-wrap: anywhere; background: var(--bg); border-radius: 10px; padding: 10px 12px; margin: 8px 0 12px;
}
#shareLink:focus-visible { outline: 3px solid #6b7280; outline-offset: 3px; }
#peopleDialog [aria-invalid=true] { border: 2px solid #a62323; }
