:root {
  color-scheme: light;
  --background: #f6f6ee;
  --paper: #fffef9;
  --ink: #1b2822;
  --secondary: #536059;
  --line: #dfe3d9;
  --green: #1c503f;
  --green-hover: #143d30;
  --mint: #e3eddd;
  --lime: #ddefa5;
  --red: #892e28;
  font-family: Inter, 'Aptos', 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: var(--background);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, p, ul { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .7; }
:focus-visible { outline: 3px solid #5c8657; outline-offset: 3px; }
.frame { width: min(1120px, calc(100% - 64px)); margin: 0 auto; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar-inner { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.02rem; font-weight: 760; text-decoration: none; white-space: nowrap; }
.brand-icon { width: 32px; height: 32px; display: grid; grid-template-columns: repeat(3, 3px); align-items: center; justify-content: center; gap: 3px; border-radius: 10px; background: var(--green); }
.brand-icon i { height: 13px; background: var(--lime); border-radius: 3px; }
.brand-icon i:first-child { height: 7px; }
.brand-icon i:last-child { height: 18px; }
.main { padding: 52px 0 72px; }
.hero { display: grid; grid-template-columns: 1.15fr minmax(320px, .85fr); gap: clamp(30px, 7vw, 104px); align-items: center; padding: clamp(20px, 6vh, 80px) 0; }
.hero h1 { font-size: clamp(3.2rem, 7.2vw, 6.35rem); line-height: .98; letter-spacing: -.087em; font-weight: 780; }
.hero-dot { color: #477e53; }
.hero-intro p { margin-top: 25px; max-width: 395px; color: var(--secondary); font-size: clamp(1.05rem, 1.9vw, 1.23rem); line-height: 1.55; }
.hero-divider { display: flex; align-items: center; gap: 9px; margin-top: 40px; height: 20px; }
.hero-divider i { width: 10px; height: 14px; background: #a9c69e; border-radius: 10px; }
.hero-divider i:nth-child(n+4) { background: #c2d8b9; }
.hero-divider i:nth-child(n+7) { background: #d8e4cf; }
.hero-divider i:nth-child(3n+2) { height: 20px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; }
.form-card { padding: clamp(22px, 4.5vw, 38px); box-shadow: 0 16px 46px #273d2f09; }
h2 { font-size: 1.45rem; font-weight: 740; line-height: 1.15; letter-spacing: -.045em; }
.form-card h1, .center-card h1 { font-size: clamp(1.9rem, 5vw, 2.75rem); line-height: 1.03; letter-spacing: -.055em; overflow-wrap: anywhere; }
.form-card p, .center-card p, dialog p { line-height: 1.5; }
.form-card form { margin: 24px 0 15px; }
.form-card h1 + p { margin-top: 14px; }
label { display: block; margin: 15px 0 7px; font-size: .92rem; font-weight: 650; }
input:not(:is([type='checkbox'], [type='radio'])), select { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid #cfd8cc; background: #fff; color: var(--ink); }
input::placeholder { color: #67746b; }
.button { display: inline-flex; min-height: 44px; justify-content: center; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 9px 15px; font-weight: 690; text-decoration: none; line-height: 1.2; }
.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-hover); }
.primary span { font-size: 1.25em; }
.secondary { background: var(--paper); color: var(--green); border-color: #cfd8cc; }
.secondary:hover { background: var(--mint); }
.full { width: 100%; margin-top: 19px; }
.form-card .full { justify-content: space-between; }
.subtle { color: var(--secondary); font-size: .9rem; }
.center-card { max-width: 420px; margin: 10vh auto 0; padding: 28px; }
.center-card .button-row { margin-top: 20px; }
.button-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.recent { padding: 24px 30px; width: min(460px, 100%); }
.plain-list { list-style: none; padding: 0; }
.recent li { margin-top: 12px; }
.recent a { color: var(--green); font-weight: 650; text-underline-offset: 4px; }
.notice { position: fixed; z-index: 2; right: max(16px, calc((100vw - 1120px) / 2)); bottom: 16px; max-width: min(390px, calc(100vw - 32px)); padding: 12px 17px; background: var(--ink); color: white; border-radius: 12px; box-shadow: 0 8px 26px #1b282233; }
.trip-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 15px; margin-bottom: 24px; }
.trip-header h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); line-height: 1; letter-spacing: -.067em; overflow-wrap: anywhere; }
.eyebrow { color: var(--secondary); font-weight: 630; font-size: .88rem; margin-bottom: 8px; }
#add-expense { flex-shrink: 0; }
.overview { display: grid; grid-template-columns: 1.15fr 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.metric { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; min-height: 135px; padding: 20px 22px; background: var(--paper); border: 1px solid var(--line); border-radius: 19px; overflow-wrap: anywhere; }
.metric span { color: var(--secondary); font-size: .91rem; font-weight: 640; }
.metric strong { font-size: clamp(1.6rem, 3.2vw, 2.7rem); font-weight: 780; letter-spacing: -.057em; line-height: 1.1; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.metric-total { background: var(--green); color: white; border-color: var(--green); }
.metric-total span { color: #e0eddb; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: 16px; align-items: start; }
.ledger-panel { padding: 21px; min-height: 210px; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.text-button { color: var(--green); border: 0; background: transparent; border-radius: 6px; padding: 5px 2px; font-size: .88rem; font-weight: 690; text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--ink); }
.line-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.line-item strong { font-size: .98rem; overflow-wrap: anywhere; }
.line-item small { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.line-item .amount { font-variant-numeric: tabular-nums; text-align: right; }
.line-item .row-action { grid-column: 1 / -1; justify-self: start; }
.transfer-details { border-top: 1px solid var(--line); }
.transfer-details summary { padding: 12px 0; color: var(--green); font-size: .92rem; font-weight: 690; cursor: pointer; }
.transfer-mark-status { grid-column: 1 / -1; }
.empty { padding: 21px 0; color: var(--secondary); line-height: 1.45; border-top: 1px solid var(--line); }
dialog { position: fixed; margin: auto; width: min(480px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 24px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); color: var(--ink); box-shadow: 0 18px 80px #172d2440; }
dialog::backdrop { background: #172d2466; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.icon-button { width: 36px; height: 36px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--mint); color: var(--ink); font-size: 1.35rem; }
.field-row { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: 10px; }
fieldset { border: 0; padding: 0; margin: 15px 0 10px; min-width: 0; }
legend { padding: 0; font-weight: 680; }
.split-actions { margin: 4px 0; display: flex; gap: 12px; }
.split-modes { display: flex; flex-wrap: wrap; column-gap: 16px; }
.split-modes label { display: flex; align-items: center; gap: 6px; }
.split-modes input { accent-color: var(--green); }
.people-options { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; max-height: 175px; overflow: auto; }
.people-options.weighted { grid-template-columns: 1fr; max-height: 225px; }
.person-option { min-width: 0; }
.weighted .person-option { display: grid; grid-template-columns: minmax(0, 1fr) 3.5rem 7rem; align-items: center; gap: 6px; }
.people-options label { display: flex; align-items: center; gap: 6px; border-radius: 8px; background: var(--mint); min-height: 37px; margin: 0; padding: 6px; overflow-wrap: anywhere; }
.people-options label input { flex: none; }
.people-options input { accent-color: var(--green); }
.people-options .person-weight { grid-column: 2; padding: 6px; min-height: 37px; text-align: center; font-variant-numeric: tabular-nums; }
.person-weight:focus-visible { outline-offset: -3px; }
.person-share { grid-column: 3; font-size: .85rem; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.form-error { color: var(--red); margin: 9px 0; }
#confirm-form, #share-url { margin-top: 14px; }
@media (max-width: 740px) {
  .frame { width: calc(100% - 36px); }
  .main { padding-top: 29px; }
  .hero { grid-template-columns: 1fr; gap: 23px; padding: 10px 0 26px; }
  .hero h1 { font-size: clamp(3rem, 12vw, 5.1rem); }
  .hero-intro p { margin-top: 16px; }
  .hero-divider { margin-top: 18px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .settlements { grid-row: 1; }
  .overview { grid-template-columns: 1fr 1fr; gap: 7px; }
  .metric-total { grid-column: 1 / -1; }
  .metric { min-height: 100px; padding: 13px; }
  .trip-header { flex-wrap: wrap; }
  #add-expense { width: 100%; }
}
@media (max-width: 390px) {
  .frame { width: calc(100% - 24px); }
  .brand { font-size: .92rem; gap: 6px; }
  .topbar .button { font-size: .82rem; padding-inline: 9px; }
  .ledger-panel, dialog { padding: 16px; }
}
.access-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; border: 1px solid #cbdcc7; border-radius: 14px; background: #eaf0e2; padding: 9px 14px; color: #2e4a39; }
.access-strip p { font-size: .88rem; line-height: 1.35; }
.access-strip button { flex: 0 0 auto; min-height: 34px; }
.dashboard-aside { display: grid; gap: 16px; min-width: 0; }
.history-list { padding-top: 4px; }
.history-link { margin-top: 14px; }
.trip-history { max-width: 760px; margin-inline: auto; }
.trip-history .trip-header { margin-top: 14px; }
.history-day + .history-day { margin-top: 22px; }
.history-day-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 10px 16px; }
.history-day-title h3 { margin: 0; font-size: .92rem; font-weight: 740; line-height: 1.2; }
.history-day-title span { color: var(--secondary); font-size: .84rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history-pages { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 5px; margin-top: 18px; }
.page-button { min-width: 34px; min-height: 34px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--green); }
.page-button[aria-current="page"] { border-color: var(--green); background: var(--mint); font-weight: 750; }
.member-status { display: block; }
.timeline { list-style: none; padding: 0 0 0 14px; border-left: 1px solid #cbdacb; margin-left: 2px; }
.timeline-item { position: relative; border: 1px solid #e2e8de; border-radius: 13px; padding: 12px; background: #fafbf5; }
.timeline-item + .timeline-item { margin-top: 8px; }
.timeline-item::before { position: absolute; content: ''; width: 9px; height: 9px; border: 2px solid var(--paper); border-radius: 50%; background: #5b8865; left: -20px; top: 16px; }
.timeline-item.transfer { background: #f7f7f0; }
.timeline-item.transfer::before { background: #7f8876; }
.timeline-item time { color: var(--secondary); font-size: .79rem; font-variant-numeric: tabular-nums; }
.timeline-entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.timeline-entry-head strong:first-child { min-width: 0; overflow-wrap: anywhere; }
.timeline-entry-head .amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.timeline-detail { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 8px; margin: 8px 0 0; align-items: baseline; font-size: .86rem; }
.timeline-detail dt { color: var(--secondary); }
.timeline-detail dd { margin: 0; overflow-wrap: anywhere; }
.timeline-people { display: flex; flex-wrap: wrap; list-style: none; gap: 3px; padding: 0; }
.timeline-people li { border-radius: 5px; padding: 2px 6px; background: #e9f1e5; overflow-wrap: anywhere; }
.timeline-actions { display: flex; gap: 12px; margin-top: 7px; }
.timeline-actions .text-button { font-size: .8rem; }
.totals table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .86rem; }
.totals th, .totals td { padding: 9px 3px; border-bottom: 1px solid var(--line); text-align: right; overflow-wrap: anywhere; }
.totals th:first-child { text-align: left; padding-left: 0; }
.totals thead th { color: var(--secondary); font-size: .81rem; font-weight: 680; }
.totals tbody th { font-weight: 620; }
.totals td { font-variant-numeric: tabular-nums; }
.totals tfoot th, .totals tfoot td { font-weight: 740; border-bottom: 0; }
.totals-note { margin-top: 9px; font-size: .79rem; line-height: 1.45; }
#access-status { margin-top: 8px; }
@media (max-width: 740px) {
  .dashboard-aside { gap: 12px; }
}
@media (max-width: 390px) {
  .timeline-item { padding: 9px; }
  .timeline-detail { gap: 4px 6px; }
  .totals table { font-size: .8rem; }
}
.header-actions, .trip-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.trip-actions { flex-shrink: 0; }
.start-actions .button { margin-top: 12px; }
.password-hint { margin-top: 9px; }
#auth-switch { margin-top: 12px; }
.trip-list-panel { padding: clamp(18px, 4vw, 32px); }
#home.signed-in { display: flex; flex-direction: column; }
#home.signed-in .trip-list-panel { order: -1; }
.trip-list-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.trip-list-columns > div, #legacy-trips { padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; }
#legacy-trips { margin-top: 12px; }
.trip-list-panel h3 { margin: 0 0 4px; font-size: 1rem; }
.trip-list li { line-height: 1.4; padding: 8px 0; overflow-wrap: anywhere; }
.trip-list li + li { border-top: 1px solid var(--line); }
.trip-list a { color: var(--green); font-weight: 650; text-underline-offset: 3px; }
.trip-status { display: inline-block; margin-top: 8px; padding: 4px 8px; border-radius: 6px; font-size: .82rem; color: var(--green); background: var(--mint); }
#settings-dialog { width: min(575px, calc(100% - 24px)); }
.settings-status, .co-admin-controls { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.settings-status { border-bottom: 1px solid var(--line); padding: 10px 0; flex-wrap: wrap; }
.co-admin-controls .button { flex-shrink: 0; }
.settings-heading { margin: 18px 0 6px; font-size: 1rem; }
.settings-members li { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.settings-members li strong { overflow-wrap: anywhere; }
.settings-members li span { display: block; }
.member-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0 10px; }
.member-actions button { min-height: 34px; }
.return-link { display: block; margin-top: 14px; padding: 12px; border-radius: 11px; background: var(--mint); }
.return-link h3 { margin: 0 0 4px; font-size: 1rem; }
#return-copy-status { margin-top: 6px; }
@media (max-width: 740px) {
  .trip-actions { width: 100%; justify-content: stretch; }
  .trip-actions .button { flex: 1; }
  .trip-actions #add-expense { flex: 2; width: auto; }
}
@media (max-width: 470px) {
  .trip-list-columns { grid-template-columns: 1fr; }
  .header-actions { gap: 6px; }
  .header-actions .text-button { font-size: .82rem; }
  .settings-members li { flex-direction: column; align-items: stretch; gap: 0; padding-top: 7px; }
  .member-actions { justify-content: flex-start; }
}
