:root {
  --canvas: #fff8f2;
  --canvas-strong: #f7eee6;
  --surface: #fffdfb;
  --surface-soft: #fff4eb;
  --surface-yellow: #fff6c7;
  --ink: #2f2925;
  --ink-soft: #665d56;
  --muted: #786f68;
  --line: #e4d7cd;
  --line-strong: #cdbcb0;
  --brand: #75514e;
  --brand-strong: #5a3938;
  --banana: #ffd85d;
  --positive: #15785c;
  --positive-soft: #e6f6ef;
  --negative: #a73e44;
  --negative-soft: #fdeced;
  --warning: #8a5a00;
  --warning-soft: #fff2ce;
  --shadow-sm: 0 8px 24px rgba(73, 48, 38, 0.07);
  --shadow-lg: 0 24px 70px rgba(73, 48, 38, 0.16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --sidebar: 252px;
  --content: 1180px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 88% 4%, rgba(255, 216, 93, 0.22), transparent 26rem),
    var(--canvas);
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

img {
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
.brand-word,
.money {
  letter-spacing: -0.035em;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 12px;
  left: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid #1d72d8;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.boot-shell,
.noscript {
  display: grid;
  min-height: 100vh;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

.boot-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 14px 22px rgba(83, 48, 29, 0.18));
}

.button,
.icon-button,
.nav-item,
.tab,
.profile-chip,
.group-row,
.action-tile,
.avatar-button {
  min-height: 44px;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 750;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(47, 41, 37, 0.12);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 24px rgba(47, 41, 37, 0.16);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: none;
}

.button-quiet {
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
}

.button-danger {
  background: var(--negative);
}

.button-block {
  width: 100%;
}

.button-sm {
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.9rem;
}

.icon,
[data-lucide] {
  width: 20px;
  height: 20px;
  stroke-width: 1.9;
}

.icon-button,
.avatar-button {
  display: inline-grid;
  width: 46px;
  min-width: 46px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.brand-lockup img {
  width: 43px;
  height: 43px;
  object-fit: contain;
  filter: drop-shadow(0 5px 8px rgba(83, 48, 29, 0.14));
}

.brand-word {
  font-size: 1.2rem;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.subtle {
  color: var(--muted);
  line-height: 1.6;
}

.auth-page {
  min-height: 100vh;
  padding: 28px;
}

.auth-header {
  display: flex;
  max-width: 1240px;
  margin: 0 auto 28px;
  align-items: center;
  justify-content: space-between;
}

.trust-pill,
.sync-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 251, 0.88);
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 0 4px var(--positive-soft);
}

.status-dot.offline,
.status-dot.error {
  background: var(--negative);
  box-shadow: 0 0 0 4px var(--negative-soft);
}

.auth-layout {
  display: grid;
  max-width: 1240px;
  min-height: calc(100vh - 130px);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.7fr);
  gap: 28px;
}

.auth-story,
.auth-card {
  border: 1px solid var(--line);
  border-radius: 34px;
  background: rgba(255, 253, 251, 0.9);
  box-shadow: var(--shadow-sm);
}

.auth-story {
  position: relative;
  display: flex;
  overflow: hidden;
  padding: clamp(36px, 7vw, 86px);
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 216, 93, 0.58), transparent 22rem),
    linear-gradient(145deg, #fff6ea 0%, #f9e8e1 100%);
}

.auth-story::after {
  position: absolute;
  right: -96px;
  bottom: -130px;
  width: 390px;
  height: 390px;
  border: 1px solid rgba(117, 81, 78, 0.22);
  border-radius: 50%;
  content: "";
}

.auth-story h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: clamp(2.7rem, 6vw, 5.4rem);
  line-height: 0.98;
}

.auth-story h1 em {
  display: block;
  color: var(--brand);
  font-family: Georgia, serif;
  font-weight: 500;
}

.auth-story > div > p {
  max-width: 640px;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.65;
}

.auth-benefits {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.auth-benefit {
  padding: 18px;
  border: 1px solid rgba(117, 81, 78, 0.18);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 251, 0.72);
}

.auth-benefit svg {
  color: var(--brand);
}

.auth-benefit strong {
  display: block;
  margin: 14px 0 6px;
}

.auth-benefit span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.auth-card {
  display: flex;
  padding: clamp(28px, 5vw, 54px);
  flex-direction: column;
  justify-content: center;
}

.auth-logo {
  width: 92px;
  height: 92px;
  margin-bottom: 26px;
  object-fit: contain;
}

.auth-card h2 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.auth-card .subtle {
  margin-bottom: 28px;
}

.onboarding-card {
  gap: 26px;
  justify-content: flex-start;
}

.onboarding-story {
  background:
    radial-gradient(circle at 92% 8%, rgba(255, 216, 93, 0.66), transparent 20rem),
    linear-gradient(150deg, #fff8ed 0%, #f5e3df 100%);
}

.profile-editor-compact {
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
}

.profile-editor-compact h2,
.profile-editor-compact .eyebrow {
  margin-bottom: 4px;
}

.onboarding-fields {
  width: 100%;
}

.consent-row {
  display: grid;
  padding: 14px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.5;
  cursor: pointer;
}

.consent-row input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}

.consent-row a {
  color: var(--brand-strong);
  font-weight: 800;
}

.google-button {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.google-button img {
  width: 21px;
  height: 21px;
}

.auth-fineprint {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  text-align: center;
}

.auth-fineprint a {
  color: var(--ink);
}

.setup-card {
  width: min(720px, calc(100% - 32px));
  max-width: 720px;
  margin: 7vh auto;
  padding: clamp(28px, 6vw, 56px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.setup-card h1 {
  margin: 22px 0 12px;
  font-size: clamp(2rem, 5vw, 3.6rem);
  overflow-wrap: anywhere;
}

.setup-card p,
.setup-card code {
  overflow-wrap: anywhere;
}

.setup-list {
  display: grid;
  margin: 26px 0;
  padding: 0;
  gap: 12px;
  list-style: none;
}

.setup-list li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
}

.setup-list span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-yellow);
  font-weight: 850;
}

.app-shell {
  min-height: 100vh;
  padding-left: var(--sidebar);
}

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar);
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  background: rgba(255, 250, 246, 0.95);
  backdrop-filter: blur(18px);
  flex-direction: column;
}

.sidebar .brand-lockup {
  padding: 0 12px 18px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: flex;
  width: 100%;
  padding: 0 14px;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--ink-soft);
  font-weight: 720;
  text-align: left;
}

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.nav-item.active {
  background: #f7dacc;
  color: var(--ink);
}

.sidebar-footer {
  margin-top: auto;
}

.profile-chip {
  display: flex;
  width: 100%;
  padding: 8px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
}

.profile-chip-copy {
  min-width: 0;
  flex: 1;
}

.profile-chip-copy strong,
.profile-chip-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chip-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.avatar {
  display: inline-grid;
  width: 42px;
  height: 42px;
  overflow: hidden;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--brand);
  color: white;
  font-size: 0.8rem;
  font-weight: 850;
  box-shadow: 0 0 0 1px var(--line);
  flex: 0 0 auto;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 34px;
  height: 34px;
}

.avatar-lg {
  width: 74px;
  height: 74px;
  font-size: 1.2rem;
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  height: 76px;
  padding: 0 clamp(20px, 4vw, 48px);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(228, 215, 205, 0.75);
  background: rgba(255, 248, 242, 0.86);
  backdrop-filter: blur(18px);
}

.topbar-brand {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page {
  width: min(100%, calc(var(--content) + 80px));
  margin: 0 auto;
  padding: 34px 40px 104px;
}

.page-header {
  display: flex;
  margin-bottom: 26px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.page-title {
  margin-bottom: 6px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.04;
}

.page-copy {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(2, minmax(190px, 0.65fr));
  gap: 16px;
}

.summary-card,
.panel,
.group-row,
.action-tile {
  border: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.92);
  box-shadow: var(--shadow-sm);
}

.summary-card {
  min-height: 188px;
  padding: 24px;
  border-radius: var(--radius-lg);
}

.summary-card-primary {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 216, 93, 0.58), transparent 15rem),
    linear-gradient(140deg, #fff6e8, #fae7df);
}

.summary-card-primary::after {
  position: absolute;
  right: -40px;
  bottom: -76px;
  width: 210px;
  height: 210px;
  border: 1px solid rgba(117, 81, 78, 0.2);
  border-radius: 50%;
  content: "";
}

.summary-label {
  display: flex;
  margin-bottom: 18px;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 750;
}

.money {
  display: block;
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.money-xl {
  font-size: clamp(2.4rem, 5vw, 4.4rem);
}

.money-lg {
  font-size: clamp(1.9rem, 3.5vw, 3rem);
}

.positive {
  color: var(--positive);
}

.negative {
  color: var(--negative);
}

.summary-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.summary-breakdown {
  display: flex;
  margin-top: 18px;
  gap: 22px;
  flex-wrap: wrap;
}

.summary-breakdown span,
.summary-breakdown small,
.summary-breakdown strong {
  display: block;
}

.summary-breakdown small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.74rem;
}

.summary-breakdown strong {
  font-variant-numeric: tabular-nums;
}

.multi-currency-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.multi-currency-grid .summary-card-primary {
  grid-column: auto;
}

.currency-banner {
  margin-bottom: 16px;
}

.section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  margin-bottom: 14px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.25rem;
}

.text-button {
  min-height: 44px;
  padding: 0 6px;
  background: transparent;
  color: var(--brand-strong);
  font-weight: 800;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(270px, 0.68fr);
  gap: 18px;
}

.invitation-panel {
  display: grid;
  margin-bottom: 20px;
  padding: 22px;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 22px;
  border: 1px solid #e2b65b;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--warning-soft), var(--surface));
}

.invitation-panel h2 {
  margin-bottom: 7px;
}

.invitation-panel p:last-child {
  margin-bottom: 0;
}

.invitation-list {
  display: grid;
  gap: 8px;
}

.invitation-row {
  display: grid;
  min-height: 72px;
  padding: 10px 12px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(138, 90, 0, 0.18);
  border-radius: 16px;
  background: rgba(255, 253, 251, 0.82);
}

.panel {
  border-radius: var(--radius-lg);
}

.panel-pad {
  padding: 22px;
}

.group-list,
.activity-list,
.member-list,
.balance-list {
  display: grid;
  gap: 10px;
}

.group-row {
  display: grid;
  width: 100%;
  padding: 16px;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius-md);
  text-align: left;
}

.group-row:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.group-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  background: var(--surface-yellow);
  color: var(--brand-strong);
}

.group-row-copy {
  min-width: 0;
}

.group-row-copy strong,
.group-row-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-row-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.group-position {
  text-align: right;
}

.group-position span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.76rem;
}

.shortcut-grid {
  display: grid;
  gap: 10px;
}

.action-tile {
  display: grid;
  width: 100%;
  padding: 16px;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-md);
  text-align: left;
}

.action-tile svg {
  color: var(--brand);
}

.action-tile strong,
.action-tile span {
  display: block;
}

.action-tile span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.empty-state {
  display: grid;
  min-height: 270px;
  padding: 42px 24px;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  text-align: center;
}

.empty-state img {
  width: 86px;
  height: 86px;
  margin-bottom: 16px;
  object-fit: contain;
}

.empty-state-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-yellow);
  color: var(--brand);
}

.empty-state h3 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}

.empty-state p {
  max-width: 480px;
  margin-bottom: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  padding: 0 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.tab.active {
  color: var(--ink);
}

.tab.active::after {
  position: absolute;
  right: 16px;
  bottom: -1px;
  left: 16px;
  height: 3px;
  border-radius: 999px 999px 0 0;
  background: var(--brand);
  content: "";
}

.expense-row,
.activity-row,
.member-row,
.balance-row,
.settlement-row {
  display: grid;
  min-height: 68px;
  padding: 12px 4px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.expense-row:last-child,
.activity-row:last-child,
.member-row:last-child,
.balance-row:last-child,
.settlement-row:last-child {
  border-bottom: 0;
}

.settlement-suggestion {
  display: grid;
  margin-bottom: 10px;
  padding: 14px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #98ccb8;
  border-radius: var(--radius-sm);
  background: var(--positive-soft);
  color: #105c47;
}

.settlement-suggestion span,
.settlement-suggestion small {
  display: block;
}

.settlement-suggestion small {
  margin-top: 3px;
  font-size: 0.9rem;
  font-weight: 800;
}

.settlement-history {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.settlement-actions {
  display: flex;
  gap: 8px;
}

.payment-parties {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 26px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.payment-parties > span {
  display: flex;
  min-width: 0;
  padding: 12px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.payment-parties > svg {
  color: var(--brand);
}

.warning-banner {
  border-color: #e2b65b;
  background: var(--warning-soft);
  color: #6d4700;
}

.recovery-card {
  text-align: left;
}

.recovery-card .brand-lockup {
  margin-bottom: 28px;
}

.recovery-actions {
  display: flex;
  margin-top: 24px;
  gap: 10px;
  flex-wrap: wrap;
}

.row-copy {
  min-width: 0;
}

.row-copy strong,
.row-copy span {
  display: block;
}

.row-copy span {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
}

.member-stack {
  display: flex;
}

.member-stack .avatar + .avatar {
  margin-left: -10px;
}

.offline-banner,
.error-banner,
.notice-banner {
  display: flex;
  margin-bottom: 18px;
  padding: 14px 16px;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid #e2b65b;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: #6d4700;
  line-height: 1.5;
}

.error-banner {
  border-color: #e3a4a8;
  background: var(--negative-soft);
  color: #7b262c;
}

.notice-banner {
  border-color: #98ccb8;
  background: var(--positive-soft);
  color: #105c47;
}

.dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(840px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.dialog::backdrop {
  background: rgba(47, 41, 37, 0.5);
  backdrop-filter: blur(4px);
}

.dialog-header,
.dialog-footer {
  display: flex;
  padding: 20px 24px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 251, 0.96);
}

.dialog-header h2 {
  margin: 0;
  font-size: 1.55rem;
}

.dialog-header p {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dialog-content {
  max-height: calc(100dvh - 210px);
  padding: 24px;
  overflow-y: auto;
}

.dialog-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label,
.field-label {
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 780;
}

.field input,
.field select,
.field textarea,
.field-control {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: white;
}

.field textarea {
  min-height: 92px;
  padding-top: 13px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
}

.field-help {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.money-input {
  position: relative;
}

.money-input span {
  position: absolute;
  top: 50%;
  left: 14px;
  color: var(--ink-soft);
  font-weight: 800;
  transform: translateY(-50%);
}

.money-input input {
  padding-left: 35px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.person-choice {
  display: grid;
  min-height: 60px;
  padding: 10px;
  grid-template-columns: 22px 36px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}

.person-choice:has(input:checked) {
  border-color: var(--brand);
  background: var(--surface-soft);
}

.person-choice input {
  width: 19px;
  height: 19px;
  accent-color: var(--brand);
}

.person-choice strong,
.person-choice small {
  display: block;
}

.person-choice small {
  margin-top: 2px;
  color: var(--muted);
}

.allocation-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.allocation-head {
  display: flex;
  padding: 13px 15px;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-soft);
  gap: 10px;
}

.allocation-row {
  display: grid;
  min-height: 52px;
  padding: 9px 14px;
  grid-template-columns: minmax(0, 1fr) 140px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.allocation-row input {
  min-height: 42px;
}

.profile-editor {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.avatar-upload {
  position: relative;
  display: grid;
  width: 108px;
  height: 108px;
  place-items: center;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  border-radius: 30px;
  background: var(--surface-soft);
  cursor: pointer;
}

.avatar-upload img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.toast-region {
  position: fixed;
  z-index: 120;
  right: 20px;
  bottom: calc(20px + var(--safe-bottom));
  display: grid;
  max-width: min(390px, calc(100vw - 32px));
  gap: 10px;
}

.toast {
  display: flex;
  padding: 14px 16px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow-lg);
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: #efe4dc;
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.mobile-nav {
  display: none;
}

@media (max-width: 980px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .auth-story {
    min-height: 540px;
  }

  .app-shell {
    padding-left: 0;
  }

  .sidebar {
    display: none;
  }

  .topbar-brand {
    display: inline-flex;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary-card-primary {
    grid-column: 1 / -1;
  }

  .mobile-nav {
    position: fixed;
    z-index: 45;
    right: 12px;
    bottom: calc(10px + var(--safe-bottom));
    left: 12px;
    display: grid;
    min-height: 68px;
    padding: 7px 8px;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    border: 1px solid var(--line-strong);
    border-radius: 24px;
    background: rgba(255, 253, 251, 0.96);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
  }

  .mobile-nav .nav-item {
    display: grid;
    min-height: 54px;
    padding: 4px;
    place-items: center;
    gap: 2px;
    font-size: 0.67rem;
    text-align: center;
  }

  .mobile-nav .nav-item svg {
    width: 21px;
    height: 21px;
  }

  .mobile-add {
    display: grid;
    width: 52px;
    height: 52px;
    margin: -18px auto 0;
    place-items: center;
    border-radius: 18px;
    background: var(--ink);
    color: white;
    box-shadow: 0 12px 28px rgba(47, 41, 37, 0.26);
  }
}

@media (max-width: 720px) {
  .auth-page {
    padding: 16px;
  }

  .auth-header {
    margin-bottom: 14px;
  }

  .trust-pill span:last-child {
    display: none;
  }

  .auth-story {
    min-height: auto;
    padding: 34px 24px;
  }

  .auth-story h1 {
    font-size: clamp(2.5rem, 13vw, 4rem);
  }

  .auth-benefits {
    grid-template-columns: 1fr;
  }

  .auth-benefit {
    display: grid;
    grid-template-columns: 28px 1fr;
    column-gap: 10px;
  }

  .auth-benefit strong {
    margin: 1px 0 3px;
  }

  .auth-benefit span {
    grid-column: 2;
  }

  .auth-card {
    padding: 34px 24px;
  }

  .topbar {
    height: 68px;
    padding: 0 16px;
  }

  .topbar .brand-word {
    display: none;
  }

  .sync-pill span:last-child {
    display: none;
  }

  .page {
    padding: 24px 16px 118px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .button {
    width: 100%;
  }

  .summary-grid,
  .content-grid,
  .form-row,
  .profile-editor,
  .invitation-panel {
    grid-template-columns: 1fr;
  }

  .invitation-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .invitation-row .button {
    grid-column: 2;
    width: 100%;
  }

  .summary-card-primary {
    grid-column: auto;
  }

  .summary-card {
    min-height: 156px;
  }

  .summary-grid .summary-card:not(.summary-card-primary) {
    min-height: 132px;
  }

  .group-row {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .group-position {
    grid-column: 2;
    text-align: left;
  }

  .group-position span,
  .group-position strong {
    display: inline;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100dvh - 12px);
    margin: auto 0 0;
    border-radius: 26px 26px 0 0;
  }

  .dialog-content {
    max-height: calc(100dvh - 196px);
    padding: 20px 18px;
  }

  .dialog-header,
  .dialog-footer {
    padding: 16px 18px;
  }

  .dialog-footer {
    padding-bottom: calc(16px + var(--safe-bottom));
  }

  .dialog-footer .button {
    flex: 1;
  }

  .profile-editor {
    justify-items: center;
  }

  .profile-editor .form-grid {
    width: 100%;
  }

  .allocation-row {
    grid-template-columns: 1fr 118px;
  }

  .settlement-suggestion {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .settlement-suggestion .button {
    grid-column: 2;
    width: 100%;
  }

  .settlement-row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .settlement-row > .status-pill,
  .settlement-actions {
    grid-column: 2;
  }

  .settlement-actions .button {
    flex: 1;
  }

  .payment-parties {
    grid-template-columns: 1fr;
  }

  .payment-parties > svg {
    margin: 0 auto;
    transform: rotate(90deg);
  }

  .toast-region {
    right: 16px;
    bottom: calc(92px + var(--safe-bottom));
    left: 16px;
  }
}

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