:root {
  --page: #f3f5f8;
  --surface: #ffffff;
  --surface-soft: #f8f9fb;
  --ink: #17202a;
  --muted: #6e7783;
  --line: #e5e8ed;
  --primary: #17202a;
  --brand-blue: #0b57a3;
  --brand-blue-dark: #073d75;
  --brand-blue-soft: #eaf3fc;
  --positive: #16825d;
  --negative: #d64b5f;
  --shadow: 0 18px 40px rgba(30, 38, 49, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
  display: flex;
  width: 248px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 24px 14px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 8px 32px;
  font-size: 18px;
  font-weight: 800;
}
.sidebar-top { display: flex; align-items: flex-start; justify-content: space-between; }

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 7px;
  background: white;
  border: 1px solid var(--line);
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }

.all-groups, .group-nav button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.all-groups.active, .group-nav button.active { background: #e9edf2; }
.all-groups:hover, .group-nav button:hover { background: #eef1f5; }
.all-groups span:nth-child(2), .group-nav button span:nth-child(2), .sidebar-footer span { min-width: 0; }
.all-groups strong, .group-nav strong, .sidebar-footer strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.all-groups small, .group-nav small, .sidebar-footer small { display: block; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }

.nav-icon {
  display: grid;
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--icon-color, var(--ink));
  font-size: 12px;
  font-weight: 800;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 27px 7px 9px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.group-nav { display: grid; gap: 3px; overflow-y: auto; }

.sidebar-footer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 15px 5px 1px;
}

.sidebar-backdrop, .mobile-bottom-nav, .mobile-context-actions { display: none; }

.avatar {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--avatar-color) 15%, white);
  color: var(--avatar-color);
  font-size: 11px;
  font-weight: 800;
}

.avatar.small { width: 29px; height: 29px; font-size: 9px; }

.main-content {
  grid-column: 2;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 30px 34px 50px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.title-block h1, .panel-heading h2, .people-heading h2, dialog h2 {
  margin: 2px 0 0;
  letter-spacing: 0;
}

.title-block h1 { font-size: clamp(25px, 3vw, 36px); }
.title-block p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-actions { display: flex; gap: 8px; }
.alert-button { display: flex; min-height: 40px; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--muted); padding: 0 9px; font-size: 10px; font-weight: 800; }
.alert-button strong { display: grid; min-width: 19px; height: 19px; place-items: center; border-radius: 10px; background: #edf0f4; color: var(--muted); font-size: 9px; }
.alert-button.has-alerts { border-color: #e8b3bb; background: #fff8f9; color: var(--negative); }
.alert-button.has-alerts strong { background: var(--negative); color: white; }
.alert-button.incoming-alert.has-alerts { border-color: #a9d9c8; background: #f4fbf8; color: var(--positive); }
.alert-button.incoming-alert.has-alerts strong { background: var(--positive); }
.currency-control { display: flex; height: 40px; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 6px; background: white; padding: 0 5px 0 9px; }
.currency-control span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.currency-control select { width: 62px; height: 30px; margin: 0; border: 0; padding: 0 3px; font-size: 11px; font-weight: 800; }

.primary-button, .secondary-button {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 15px;
  font-weight: 750;
}

.primary-button { border: 1px solid var(--primary); background: var(--primary); color: white; }
.secondary-button { border: 1px solid var(--line); background: white; color: var(--ink); }
.primary-button:hover { background: #323c47; }
.primary-button:disabled { cursor: wait; background: #68727d; border-color: #68727d; }
.secondary-button:hover { background: var(--surface-soft); }
.full-width { width: 100%; margin-top: 8px; }

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}
.icon-button:hover { border-color: var(--line); background: white; color: var(--ink); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.getting-started {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #2f6fed;
  border-radius: 8px;
  background: white;
  padding: 24px;
}
.getting-started h2 { margin: 5px 0 7px; font-size: 22px; letter-spacing: 0; }
.getting-started p { max-width: 680px; margin: 0 0 17px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.metric-card {
  min-height: 125px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 750; }
.metric-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--metric-color); }
.metric-value { margin-top: 22px; font-size: clamp(22px, 2.6vw, 31px); font-weight: 820; }
.metric-card small { color: var(--muted); font-size: 11px; }
.positive { color: var(--positive); }
.negative { color: var(--negative); }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(330px, 0.75fr);
  gap: 14px;
}

.activity-panel, .balance-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel-heading {
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
}
.panel-heading h2, .people-heading h2 { font-size: 16px; }

.segmented-control { display: flex; border: 1px solid var(--line); border-radius: 6px; padding: 2px; }
.segmented-control button { border: 0; border-radius: 4px; background: transparent; color: var(--muted); padding: 5px 8px; font-size: 10px; font-weight: 750; }
.segmented-control button.active { background: var(--ink); color: white; }

.activity-list { padding: 0 18px; }
.activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 75px;
  border-bottom: 1px solid var(--line);
}
.activity-row:last-child { border-bottom: 0; }
.activity-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 7px;
  background: color-mix(in srgb, var(--activity-color) 12%, white);
  color: var(--activity-color);
  font-size: 11px;
  font-weight: 850;
}
.activity-copy { min-width: 0; }
.activity-copy strong { display: block; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy small { color: var(--muted); font-size: 11px; }
.activity-amount { text-align: right; }
.activity-amount strong { display: block; font-size: 13px; }
.activity-amount small { color: var(--muted); font-size: 10px; }

.transfer-count { border-radius: 4px; background: var(--surface-soft); color: var(--muted); padding: 4px 6px; font-size: 10px; font-weight: 750; }
.transfer-list { display: grid; gap: 8px; padding: 14px 14px 17px; border-bottom: 1px solid var(--line); }
.transfer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
}
.transfer-people { display: flex; align-items: center; min-width: 0; }
.transfer-people .avatar + .avatar { margin-left: -7px; }
.transfer-copy { min-width: 0; margin-left: 8px; }
.transfer-copy strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.transfer-copy small { color: var(--muted); font-size: 10px; }
.settle-button { border: 0; border-radius: 5px; background: var(--ink); color: white; padding: 6px 8px; font-size: 10px; font-weight: 750; }
.request-button { border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); padding: 5px 7px; font-size: 10px; font-weight: 750; }
.overall-note { color: var(--muted); font-size: 9px; font-weight: 750; white-space: nowrap; }
.status-chip { border-radius: 4px; padding: 4px 6px; background: #edf0f4; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: capitalize; white-space: nowrap; }
.status-chip.paid { background: #fff4d9; color: #8a6017; }
.status-chip.accepted { background: #e5f5ef; color: var(--positive); }

.people-heading { padding: 17px 18px 9px; }
.people-list { padding: 0 18px 12px; }
.person-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 54px; border-bottom: 1px solid var(--line); }
.person-row:last-child { border-bottom: 0; }
.person-row strong { display: block; font-size: 11px; }
.person-row small { color: var(--muted); font-size: 9px; }
.person-balance { font-size: 11px; font-weight: 800; }

.empty-state { padding: 34px 20px; color: var(--muted); text-align: center; font-size: 12px; }
.login-modal { width: min(430px, calc(100vw - 24px)); }
.login-modal::backdrop { background: rgba(20, 26, 33, 0.72); }
.login-content { display: grid; gap: 18px; padding: 28px; text-align: center; }
.login-content .brand-mark { justify-self: center; width: 58px; height: 58px; border: 0; background: transparent; }
.login-content h2 { margin: 4px 0 7px; font-size: 22px; }
.login-content p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.login-content #google-login-button { display: flex; min-height: 40px; justify-content: center; }
.login-content > small { color: var(--muted); font-size: 9px; line-height: 1.4; }

dialog {
  width: min(540px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0;
}
dialog::backdrop { background: rgba(20, 26, 33, 0.48); }
dialog form { display: grid; gap: 15px; padding: 22px; }
.dialog-content { display: grid; gap: 15px; padding: 22px; }
.dialog-intro { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 3px; }
dialog h2 { font-size: 21px; }
label, legend { color: var(--muted); font-size: 11px; font-weight: 750; }
input, select {
  width: 100%;
  height: 40px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  padding: 0 10px;
  outline: none;
}
input:focus, select:focus { border-color: #8c98a7; box-shadow: 0 0 0 3px #edf0f4; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money-input { position: relative; }
.money-input span { position: absolute; z-index: 1; left: 10px; bottom: 12px; color: var(--muted); font-size: 9px; font-weight: 800; }
.money-input input { padding-left: 43px; }
fieldset { margin: 0; border: 1px solid var(--line); border-radius: 7px; padding: 11px; }
.participant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 7px; }
.participant-option { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: 7px; font-size: 10px; }
.participant-option input { width: 14px; height: 14px; margin: 0; accent-color: var(--ink); }
.fx-stamp { border-left: 3px solid #2f6fed; background: #f1f5fb; color: #536171; padding: 9px 10px; font-size: 9px; line-height: 1.5; }
.invite-note { border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--muted); padding: 12px; font-size: 11px; line-height: 1.55; }
.hidden { display: none !important; }

.payment-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.payment-summary div { border: 1px solid var(--line); border-radius: 7px; padding: 12px; }
.payment-summary strong { display: block; font-size: 22px; }
.payment-summary span { display: block; color: var(--muted); font-size: 9px; }
.payment-request-list { display: grid; gap: 7px; max-height: 430px; overflow: auto; }
.payment-request-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.payment-request-main { display: flex; min-width: 0; align-items: center; }
.payment-request-main .avatar + .avatar { margin-left: -7px; }
.payment-request-main span:last-child { min-width: 0; margin-left: 8px; }
.payment-request-main strong, .payment-request-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-request-main strong { font-size: 11px; }
.payment-request-main small { color: var(--muted); font-size: 9px; text-transform: capitalize; }
.payment-request-row > strong { font-size: 11px; }
.alerts-list { display: grid; gap: 7px; max-height: 430px; overflow-y: auto; }
.alert-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid #eed5d9; border-left: 3px solid var(--negative); border-radius: 7px; background: #fffafa; padding: 10px; }
.alert-main { display: flex; min-width: 0; align-items: center; }
.alert-main .avatar + .avatar { margin-left: -7px; }
.alert-main span:last-child { min-width: 0; margin-left: 8px; }
.alert-main strong, .alert-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-main strong { font-size: 11px; }
.alert-main small { color: var(--muted); font-size: 9px; }
.share-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.share-link-row input { margin: 0; }
.invite-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.invite-actions a { display: grid; place-items: center; text-decoration: none; }
.payment-link-card { display: grid; grid-template-columns: auto auto auto; place-content: center; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); padding: 24px; text-align: center; }
.payment-link-card strong, .payment-link-card p, .payment-link-card .status-chip { grid-column: 1 / -1; }
.payment-link-card strong { margin-top: 8px; font-size: 28px; }
.payment-link-card p { margin: 0; color: var(--muted); font-size: 11px; }
.payment-link-card .status-chip { justify-self: center; }
.payment-arrow { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }

.report-modal { width: min(1040px, calc(100vw - 24px)); max-height: calc(100vh - 30px); }
.report-content { padding: 0; gap: 0; }
.report-toolbar { position: sticky; top: 0; z-index: 2; margin: 0; border-bottom: 1px solid var(--line); background: white; padding: 18px 22px; }
.report-actions { display: flex; align-items: center; gap: 6px; }
#report-body { padding: 22px; background: #f7f8fa; }
.report-hero { display: flex; justify-content: space-between; gap: 20px; border-radius: 8px; background: var(--ink); color: white; padding: 24px; }
.report-hero h3 { margin: 4px 0; font-size: 28px; }
.report-hero p { margin: 0; color: #b8c0c9; font-size: 11px; }
.report-total { text-align: right; }
.report-total span, .report-total small { display: block; color: #b8c0c9; font-size: 10px; }
.report-total strong { display: block; margin: 5px 0; font-size: 30px; }
.report-stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0; }
.report-stat-grid div, .report-section { border: 1px solid var(--line); border-radius: 8px; background: white; }
.report-stat-grid div { padding: 14px; }
.report-stat-grid span { display: block; color: var(--muted); font-size: 9px; font-weight: 750; }
.report-stat-grid strong { display: block; margin-top: 8px; font-size: 18px; }
.report-section { margin-top: 10px; padding: 18px; }
.report-section h4 { margin: 0 0 14px; font-size: 13px; }
.category-report { display: grid; gap: 10px; }
.category-report > div { display: grid; grid-template-columns: 90px minmax(80px, 1fr) 85px 35px; align-items: center; gap: 10px; font-size: 10px; }
.category-report strong, .category-report small { text-align: right; }
.category-report small { color: var(--muted); }
.report-bar { height: 7px; border-radius: 3px; background: #eef0f3; overflow: hidden; }
.report-bar i { display: block; height: 100%; background: #2f6fed; }
.report-table-wrap { overflow-x: auto; }
.report-section table { width: 100%; border-collapse: collapse; font-size: 10px; }
.report-section th { color: var(--muted); text-align: left; font-size: 9px; text-transform: uppercase; }
.report-section th, .report-section td { border-bottom: 1px solid var(--line); padding: 9px 7px; }
.report-section td:first-child { white-space: nowrap; }
.report-section td .avatar { display: inline-grid; margin-right: 4px; vertical-align: middle; }
.report-section td small { display: block; color: var(--muted); font-size: 8px; }
.report-settlements { display: grid; gap: 6px; }
.report-settlements > div { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 10px; }

.toast {
  position: fixed;
  z-index: 20;
  right: 22px;
  bottom: 22px;
  transform: translateY(18px);
  border-radius: 6px;
  background: var(--ink);
  color: white;
  padding: 11px 14px;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: 180ms ease;
}
.toast.visible { transform: translateY(0); opacity: 1; }
.mobile-only { display: none; }

@media (max-width: 1050px) {
  .content-grid { grid-template-columns: 1fr; }
  .balance-panel { display: grid; grid-template-columns: 1fr 1fr; }
  .balance-panel .panel-heading { grid-column: 1; }
  .transfer-list { border-right: 1px solid var(--line); border-bottom: 0; }
  .people-heading { grid-column: 2; grid-row: 1; border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
  body { background: #eef3f8; }
  body.drawer-open { overflow: hidden; }
  .app-shell { display: block; }
  .sidebar {
    z-index: 31;
    width: min(86vw, 330px);
    transform: translateX(-100%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
    padding: max(20px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: block;
    visibility: hidden;
    border: 0;
    background: rgba(23, 32, 42, 0.48);
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
  }
  .sidebar-backdrop.visible { visibility: visible; opacity: 1; }
  .brand { margin-bottom: 24px; }
  .all-groups, .group-nav button { min-height: 52px; }
  .sidebar-footer { padding-bottom: 4px; }
  .main-content { padding: 0 12px 104px; }
  .mobile-only { display: grid; }
  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 8px 10px;
    margin: 0 -12px 14px;
    border-bottom: 0;
    background: var(--brand-blue);
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    box-shadow: 0 8px 24px rgba(7, 61, 117, 0.2);
  }
  .menu-button { width: 42px; height: 42px; border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.12); font-size: 0; }
  .menu-button::before { content: ""; width: 16px; height: 10px; border-top: 2px solid white; border-bottom: 2px solid white; }
  .title-block { min-width: 0; }
  .title-block h1 { overflow: hidden; color: white; font-size: 22px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
  .title-block p { display: none; }
  .title-block .eyebrow { display: block; margin-bottom: 2px; color: rgba(255, 255, 255, 0.7); }
  .topbar-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    width: 100%;
    gap: 7px;
  }
  .topbar-actions .secondary-button { display: none; }
  .topbar-actions #open-expense-modal, .topbar-actions #open-payment-center { display: none; }
  .currency-control span { display: none; }
  .currency-control { height: 44px; border-color: rgba(255, 255, 255, 0.32); background: rgba(255, 255, 255, 0.14); padding: 0 4px; }
  .currency-control select { height: 36px; background: transparent; color: white; }
  .alert-button { min-height: 44px; justify-content: space-between; border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.12); color: white; padding: 0 10px; font-size: 9px; }
  .alert-button strong { background: white; color: var(--brand-blue); }
  .alert-button.has-alerts, .alert-button.incoming-alert.has-alerts { border-color: white; background: white; }
  .alert-button span { display: block; text-align: left; }
  .primary-button, .secondary-button { min-height: 44px; padding: 0 13px; font-size: 12px; }
  .mobile-context-actions {
    display: flex;
    gap: 7px;
    margin: -2px 0 12px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .mobile-context-actions::-webkit-scrollbar { display: none; }
  .mobile-context-actions .secondary-button { flex: 1 0 auto; min-height: 40px; background: white; }
  .mobile-context-actions .secondary-button:first-child { border-color: #b8d8f3; background: var(--brand-blue-soft); color: var(--brand-blue); }
  .getting-started { border-left-color: var(--brand-blue); background: #f8fbff; padding: 18px; }
  .getting-started h2 { font-size: 19px; line-height: 1.2; }
  .getting-started .primary-button { width: 100%; }
  .metric-grid {
    display: flex;
    gap: 9px;
    margin: 0 -12px 12px;
    padding: 0 12px 3px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  .metric-grid::-webkit-scrollbar { display: none; }
  .metric-card { position: relative; flex: 0 0 min(72vw, 270px); min-height: 108px; scroll-snap-align: start; overflow: hidden; padding: 15px; }
  .metric-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--metric-accent); content: ""; }
  .metric-card:nth-child(1) { --metric-accent: var(--brand-blue); background: #f8fbff; }
  .metric-card:nth-child(2) { --metric-accent: var(--negative); background: #fffafb; }
  .metric-card:nth-child(3) { --metric-accent: var(--positive); background: #f8fcfa; }
  .metric-value { margin-top: 13px; font-size: 25px; }
  .metric-card small { font-size: 10px; }
  .content-grid { display: flex; flex-direction: column; gap: 10px; }
  .balance-panel { display: block; }
  .balance-panel { order: 1; }
  .activity-panel { order: 2; }
  .activity-panel, .balance-panel { border-radius: 7px; box-shadow: 0 8px 24px rgba(23, 32, 42, 0.04); }
  .balance-panel .panel-heading { border-bottom-color: #cfe2f4; background: var(--brand-blue-soft); }
  .balance-panel .panel-heading .eyebrow { color: var(--brand-blue); }
  .balance-panel .transfer-count { background: white; color: var(--brand-blue); }
  .transfer-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-heading { min-height: 66px; padding: 13px 14px; }
  .activity-panel .panel-heading { align-items: stretch; flex-direction: column; }
  .segmented-control { width: 100%; }
  .segmented-control button { flex: 1; min-height: 34px; padding: 5px; }
  .transfer-list { gap: 7px; padding: 10px; }
  .transfer-row { min-height: 62px; padding: 10px; }
  .transfer-row:has(.settle-button) { border-color: #b8d8f3; background: #f8fbff; }
  .transfer-row:has(.request-button) { border-color: #b7dfd0; background: #f8fcfa; }
  .transfer-row .settle-button, .transfer-row .request-button { min-height: 36px; }
  .transfer-copy strong { font-size: 12px; }
  .transfer-copy small { font-size: 11px; }
  .people-heading { padding: 14px 14px 7px; }
  .people-list { padding: 0 14px 10px; }
  .person-row { min-height: 59px; }
  .person-row strong { font-size: 12px; }
  .person-row small { display: block; max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .person-balance { font-size: 12px; text-align: right; }
  .activity-list { padding: 0 12px; }
  .activity-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 9px; min-height: 70px; }
  .activity-icon { width: 35px; height: 35px; }
  .activity-copy strong { display: -webkit-box; overflow: hidden; font-size: 12px; line-height: 1.3; white-space: normal; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .activity-copy small { display: block; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .activity-amount { max-width: 30vw; }
  .activity-amount strong { font-size: 12px; }
  .activity-amount small { display: block; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .form-grid, .participant-grid { grid-template-columns: 1fr; }
  .report-button { display: none; }
  .payment-summary, .report-stat-grid { grid-template-columns: 1fr 1fr; }
  .payment-request-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .payment-request-row > :last-child { grid-column: 1 / -1; min-height: 38px; }
  .alert-row { grid-template-columns: 1fr; }
  .alert-row .settle-button { min-height: 40px; }
  dialog, .report-modal, .login-modal {
    width: 100vw;
    max-width: none;
    max-height: min(92dvh, 820px);
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 14px 14px 0 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
  dialog::backdrop { background: rgba(20, 26, 33, 0.62); }
  dialog form, .dialog-content, .login-content { gap: 13px; padding: 18px 16px max(20px, env(safe-area-inset-bottom)); }
  .login-content { width: 100%; }
  .login-content > * { min-width: 0; max-width: 100%; }
  .login-content h2 { overflow-wrap: anywhere; font-size: 20px; line-height: 1.2; }
  .login-content p { overflow-wrap: anywhere; }
  .login-content #google-login-button,
  .login-content #google-login-button > div,
  .login-content #google-login-button iframe { width: 100% !important; max-width: 100% !important; }
  .login-content > small { overflow-wrap: anywhere; }
  .modal-heading { position: sticky; top: 0; z-index: 2; align-items: center; background: white; padding-bottom: 6px; }
  .modal-heading .icon-button { width: 40px; height: 40px; border-color: var(--line); background: var(--surface-soft); }
  dialog h2 { font-size: 20px; }
  input, select { height: 48px; font-size: 16px; }
  .money-input span { bottom: 16px; }
  .participant-option { min-height: 48px; font-size: 12px; }
  .share-link-row { grid-template-columns: 1fr; }
  .share-link-row .primary-button { width: 100%; }
  .invite-actions { grid-template-columns: 1fr; }
  .invite-actions a { min-height: 46px; }
  .payment-link-card { padding: 20px 14px; }
  .report-hero { display: block; }
  .report-total { margin-top: 20px; text-align: left; }
  .category-report > div { grid-template-columns: 70px minmax(70px, 1fr) 70px; }
  .category-report small { display: none; }
  #report-body { padding: 10px; }
  .report-toolbar { padding: 14px; }
  .report-section { padding: 13px; }
  .report-section table { min-width: 620px; }
  .report-settlements > div { align-items: flex-start; }
  .toast { right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 12px; text-align: center; }
  .mobile-bottom-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 24;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    min-height: calc(70px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.98);
    padding: 6px 5px env(safe-area-inset-bottom);
    box-shadow: 0 -12px 32px rgba(23, 32, 42, 0.08);
  }
  .mobile-bottom-nav button {
    display: grid;
    min-width: 0;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--muted);
    padding: 8px 2px;
  }
  .mobile-bottom-nav strong { overflow: hidden; max-width: 100%; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-bottom-nav button.active { color: var(--brand-blue); background: var(--brand-blue-soft); }
  .mobile-bottom-nav .mobile-add-action { align-self: start; transform: translateY(-17px); }
  .mobile-bottom-nav .mobile-add-action span {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 50%;
    background: var(--brand-blue);
    color: white;
    box-shadow: 0 8px 20px rgba(11, 87, 163, 0.3);
    font-size: 24px;
    font-weight: 500;
  }
  .mobile-bottom-nav .mobile-add-action strong { color: var(--brand-blue); }
}

@media (max-width: 380px) {
  .alert-button { padding: 0 7px; }
  .alert-button span { max-width: 64px; font-size: 8px; }
  .currency-control select { width: 57px; }
  .metric-card { flex-basis: 78vw; }
  .payment-summary { grid-template-columns: 1fr; }
  .login-content { padding-right: 12px; padding-left: 12px; }
  .login-content h2 { font-size: 18px; }
  .login-content p { font-size: 11px; }
  .login-content > small { font-size: 8px; }
}

@media print {
  body * { visibility: hidden; }
  #report-modal, #report-modal * { visibility: visible; }
  #report-modal { position: absolute; inset: 0; width: 100%; max-height: none; border: 0; }
  .report-toolbar, #report-modal::backdrop { display: none; }
  #report-body { padding: 0; background: white; }
}
