* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(circle at top left, rgba(var(--color-primary-rgb), 0.3), transparent 55%),
    radial-gradient(circle at top right, rgba(var(--color-primary-dark-rgb), 0.24), transparent 50%),
    radial-gradient(circle at bottom left, rgba(var(--color-accent-rgb), 0.18), transparent 45%),
    var(--color-background);
  color: var(--color-text);
  min-height: 100%;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(1rem, 3vw, 2rem);
  padding: clamp(1.25rem, 2vw, 2rem) clamp(1.5rem, 6vw, 4rem);
  background: linear-gradient(120deg, rgba(var(--color-primary-dark-rgb), 0.95), rgba(var(--color-primary-rgb), 0.92));
  color: var(--color-white);
  box-shadow: 0 24px 48px rgba(var(--color-shadow-rgb), 0.18);
  border-bottom: 1px solid rgba(var(--color-white-rgb), 0.12);
}
.app-header__primary {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1rem, 2.5vw, 2rem);
}
.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.app-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  text-decoration: none;
  color: rgba(var(--color-white-rgb), 0.85);
  font-weight: 500;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.app-nav__link:hover,
.app-nav__link:focus-visible {
  background: rgba(var(--color-white-rgb), 0.16);
  color: var(--color-white);
  box-shadow: 0 12px 28px rgba(var(--color-shadow-rgb), 0.22);
}
.app-nav__link--active {
  background: rgba(var(--color-white-rgb), 0.22);
  color: var(--color-white);
  box-shadow: 0 16px 34px rgba(var(--color-shadow-rgb), 0.24);
}
.app-nav__link--active:hover,
.app-nav__link--active:focus-visible {
  background: rgba(var(--color-white-rgb), 0.28);
}
.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand__logo {
  width: 60px;
  height: 60px;
  padding: 0.45rem;
  border-radius: 20%;
  background: rgba(var(--color-white-rgb), 0.16);
  box-shadow: 0 16px 26px rgba(var(--color-shadow-rgb), 0.22);
  object-fit: contain;
}


.brand__title {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
}

.brand__subtitle {
  margin: 0.25rem 0 0;
  color: rgba(var(--color-white-rgb), 0.75);
  font-size: 0.95rem;
}

.app-content {
  flex: 1;
  padding: clamp(1rem, 3vw, 3rem) clamp(1rem, 6vw, 5rem) 3rem;
  display: flex;
  justify-content: center;
}
.app-content--centered {
  align-items: center;
}


.card {
  position: relative;
  background: linear-gradient(180deg, rgba(var(--color-white-rgb), 0.96), rgba(var(--color-surface-soft-rgb), 0.98));
  border-radius: 18px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(var(--color-primary-rgb), 0.18);
  overflow: hidden;
}

.card::after {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  opacity: 0.9;
  border-radius: inherit;
  pointer-events: none;
}
.login-card {
  display: flex;
  flex-direction: column;
  gap: clamp(2rem, 4vw, 3rem);
  padding: clamp(1.75rem, 4.5vw, 3.5rem);
  align-items: center;
  max-width: min(1040px, 100%);
}
.home-card {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding: clamp(2rem, 4vw, 3rem);
  max-width: min(760px, 100%);
  text-align: left;
}
.home-card__intro {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.home-card__intro h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--color-primary-dark);
}
.home-card__intro p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}
.home-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.login-card__visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 480px);
  max-height: 420px;
  padding: 1.5rem;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(var(--color-white-rgb), 0.96), rgba(var(--color-surface-soft-rgb), 0.98));
  border: 1px solid rgba(var(--color-primary-rgb), 0.18);
  box-shadow: 0 24px 42px rgba(var(--color-shadow-rgb), 0.12);
  margin-top: clamp(1.5rem, 3vw, 2rem);
}

.login-card__image {
  display: block;
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  background: linear-gradient(180deg, rgba(var(--color-white-rgb), 0.96), rgba(var(--color-surface-soft-rgb), 0.98));
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(var(--color-primary-rgb), 0.08);
}

.login-card__content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(2rem, 3vw, 2.75rem) clamp(2.25rem, 3vw, 3rem);
  align-items: start;
}

.login-card__layout {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 520px);
  gap: clamp(1.5rem, 2.5vw, 2.75rem);
  align-items: stretch;
}

@media (max-width: 960px) {
  .login-card__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-card__actions {
    max-width: 100%;
  }

  .login-card__visual {
    margin-inline: auto;
  }
}

.login-card__intro {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
}

.login-card__intro h2 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--color-primary-dark);
}

.login-card__intro p {
  margin: 0;
  color: var(--color-text-muted);
}

.login-card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  max-width: 420px;
  width: 100%;
}

.login-card__form {
  margin: 0;
  padding: clamp(1.5rem, 2.5vw, 2rem);
  border-radius: 18px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.18);
  background: linear-gradient(180deg, rgba(var(--color-white-rgb), 0.96), rgba(var(--color-surface-soft-rgb), 0.98));
  box-shadow: 0 24px 42px rgba(var(--color-shadow-rgb), 0.12);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 520px;
  width: 100%;
}

.login-card__form-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}

.login-card__content > .feedback {
  grid-column: 1 / -1;
}

.login-card__form-actions {
  display: flex;
  align-items: stretch;
}

.login-card__form-actions .button {
  width: 100%;
}

.invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.invite-actions[hidden] {
  display: none !important;
}

.invite-actions .button {
  flex: 1 1 auto;
  text-align: center;
  min-width: 160px;
}

.button {
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button--small {
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
}

.button--primary {
  background: linear-gradient(135deg, var(--color-primary-bright), var(--color-primary-dark));
  color: var(--color-white);
  box-shadow: 0 18px 32px rgba(var(--color-shadow-rgb), 0.25);
}
.button--facebook {
  background: #1877f2;
  color: var(--color-white);
  box-shadow: 0 18px 32px rgba(24, 119, 242, 0.32);
}
.button--apple {
  background: #000;
  color: var(--color-white);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.35);
}
.button--surface {
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary-dark);
  border: 1px solid rgba(var(--color-primary-rgb), 0.25);
  box-shadow: 0 14px 26px rgba(var(--color-shadow-rgb), 0.18);
}
.button--full-width {
  width: 100%;
  justify-content: center;
}
.button--primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 26px 40px rgba(var(--color-shadow-rgb), 0.3);
  background: linear-gradient(135deg, var(--color-primary-bright), var(--color-primary));
}
.button--facebook:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 24px 40px rgba(24, 119, 242, 0.38);
  background: #166fe0;
}
.button--apple:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 26px 44px rgba(0, 0, 0, 0.4);
  background: #111;
}
.button--surface:hover:not(:disabled) {
  background: rgba(var(--color-primary-rgb), 0.2);
  box-shadow: 0 20px 34px rgba(var(--color-shadow-rgb), 0.2);
}
.button--danger {
  background: linear-gradient(135deg, var(--color-danger), var(--color-danger-dark));
  color: var(--color-white);
  box-shadow: 0 16px 30px rgba(var(--color-danger-rgb), 0.3);
}

.button--danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 24px 36px rgba(var(--color-danger-rgb), 0.35);
}

.button--ghost {
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
  padding-inline: 1.25rem;
  box-shadow: 0 12px 20px rgba(var(--color-shadow-rgb), 0.14);
}

.button--ghost:hover {
  background: rgba(var(--color-primary-rgb), 0.22);
}

.dashboard {
  display: grid;
  gap: clamp(1.75rem, 3vw, 2.75rem);
  width: min(1120px, 100%);
}

.dashboard__intro {
  padding: clamp(2rem, 4vw, 3rem);
  display: grid;
  gap: 0.75rem;
  background: linear-gradient(
    160deg,
    rgba(var(--color-primary-rgb), 0.12),
    rgba(var(--color-accent-rgb), 0.18)
  );
}

.dashboard__greeting {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(var(--color-primary-rgb), 0.9);
}

.dashboard__intro h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3.8vw, 2.4rem);
  color: var(--color-primary-dark);
}

.dashboard__intro p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 1.02rem;
}

.dashboard__stats {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.summary-card {
  padding: clamp(1.5rem, 2.5vw, 2rem);
  display: grid;
  gap: 0.35rem;
}

.summary-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(var(--color-primary-dark-rgb), 0.75);
}

.summary-card__value {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  color: var(--color-primary-dark);
}

.summary-card__detail {
  margin: 0;
  color: rgba(var(--color-text-muted), 0.9);
}

.summary-card--positive {
  background: linear-gradient(160deg, rgba(var(--color-success-rgb), 0.38), rgba(var(--color-white-rgb), 0.92));
  border-color: rgba(var(--color-success-rgb), 0.6);
}

.summary-card--warning {
  background: linear-gradient(160deg, rgba(var(--color-accent-rgb), 0.3), rgba(var(--color-white-rgb), 0.92));
  border-color: rgba(var(--color-accent-rgb), 0.55);
}

.summary-card--negative {
  background: linear-gradient(160deg, rgba(var(--color-danger-rgb), 0.32), rgba(var(--color-white-rgb), 0.92));
  border-color: rgba(var(--color-danger-rgb), 0.55);
}

.summary-card--negative .summary-card__value {
  color: var(--color-danger-dark);
}

.dashboard__grid {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.dashboard-panel {
  padding: clamp(1.75rem, 3vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dashboard-panel--wide {
  grid-column: span 2;
}

@media (max-width: 960px) {
  .dashboard-panel--wide {
    grid-column: span 1;
  }
}

.dashboard-panel__header {
  display: grid;
  gap: 0.35rem;
}

.dashboard-panel__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.dashboard-panel__subtitle {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.item-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid rgba(var(--color-primary-rgb), 0.12);
}

.item-list__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.item-list__info {
  display: grid;
  gap: 0.25rem;
}

.item-list__title {
  margin: 0;
  font-weight: 600;
  color: var(--color-text-strong);
}

.item-list__meta {
  margin: 0;
  color: rgba(var(--color-text-muted), 0.85);
  font-size: 0.9rem;
}

.item-list__amount {
  font-weight: 700;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

.item-list__amount--positive {
  color: var(--color-accent-dark);
}

.item-list__amount--negative {
  color: var(--color-danger-dark);
}

.dashboard-panel__footer {
  margin-top: auto;
}

.dashboard-panel__empty {
  margin: 0.5rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.dashboard-panel__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.dashboard-panel__link::after {
  content: '→';
  font-size: 1rem;
  transition: transform 0.2s ease;
}

.dashboard-panel__link:hover::after,
.dashboard-panel__link:focus-visible::after {
  transform: translateX(4px);
}

.app-header .button--ghost {
  background: rgba(var(--color-white-rgb), 0.12);
  color: var(--color-white);
  border-color: rgba(var(--color-white-rgb), 0.35);
  box-shadow: none;
}

.app-header .button--ghost:hover {
  background: rgba(var(--color-white-rgb), 0.2);
  box-shadow: 0 18px 32px rgba(var(--color-shadow-rgb), 0.22);
  color: var(--color-white);
}
.app-header__actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-left: auto;
}

.user-summary__details {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.user-summary__profile-link {
  font-size: 0.9rem;
  color: rgba(var(--color-white-rgb), 0.88);
  text-decoration: underline;
  text-decoration-color: rgba(var(--color-white-rgb), 0.4);
  text-underline-offset: 0.2em;
  align-self: flex-end;
}

.user-summary__profile-link:focus-visible,
.user-summary__profile-link:hover {
  color: var(--color-white);
  text-decoration-color: currentColor;
}

.user-summary__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.user-summary--header {
  padding: 0;
  background: transparent;
  color: var(--color-white);
}

.user-summary--header .user-summary__details {
  align-items: flex-end;
  text-align: right;
}

.user-summary--header .user-summary__avatar {
  width: 48px;
  height: 48px;
  background: rgba(var(--color-white-rgb), 0.18);
  color: var(--color-white);
  border: 2px solid rgba(var(--color-white-rgb), 0.28);
}

.user-summary--header .user-summary__email {
  color: rgba(var(--color-white-rgb), 0.75);
  font-size: 0.9rem;
}

.icon {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.icon--filled {
  fill: currentColor;
  stroke: none;
  stroke-width: 0;
}

.content {
  width: min(960px, 100%);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.content__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0 1.5rem;
}

.content__actions:empty {
  display: none;
}

.user-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}

.user-summary__avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.25rem;
  overflow: hidden;
}

.user-summary__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.user-summary__email {
  margin: 0.25rem 0 0;
  color: var(--color-text-muted);
}


.feedback {
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(var(--color-primary-rgb), 0.2), rgba(var(--color-accent-rgb), 0.1));
  color: var(--color-text-muted);
  border: 1px solid rgba(var(--color-primary-rgb), 0.3);
  box-shadow: 0 12px 24px rgba(var(--color-shadow-rgb), 0.16);
}

.feedback[hidden] {
  display: none !important;
}

.feedback--error {
  background: rgba(var(--color-danger-rgb), 0.08);
  color: var(--color-danger);
  border-color: rgba(var(--color-danger-rgb), 0.16);
}

.feedback--success {
  background: rgba(var(--color-success-rgb), 0.22);
  color: var(--color-success);
  border-color: rgba(var(--color-success-rgb), 0.35);
}

.groups {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.groups__views {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.groups-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 2.2rem 1.5rem 1.25rem;
}

.groups-tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}


.groups-tabs__button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid rgba(var(--color-primary-rgb), 0.25);
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.18), rgba(var(--color-accent-rgb), 0.1));
  color: var(--color-primary);
  border-radius: 999px;
  padding: 0.55rem 1.6rem 0.55rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.groups-tabs__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(var(--color-shadow-rgb), 0.22);
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.28), rgba(var(--color-accent-rgb), 0.16));
}

.groups-tabs__button--active {
  background: linear-gradient(135deg, var(--color-primary-bright), var(--color-primary));
  color: var(--color-white);
  border-color: rgba(var(--color-primary-rgb), 0.4);
  box-shadow: 0 18px 32px rgba(var(--color-shadow-rgb), 0.32);
}

.groups-tabs__button--create {
  padding-inline: 1.1rem;
  font-size: 0.9rem;
}

.groups-tabs__button-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.groups-tabs__badge {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-text-strong);
  font-size: 0.7rem;
  font-weight: 600;
  box-shadow: 0 8px 16px rgba(var(--color-shadow-rgb), 0.25);
}

.groups-tabs__debt-indicator {
  position: absolute;
  top: -0.7rem;
  right: 0.2rem;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-danger), var(--color-danger-dark));
  color: var(--color-white);
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(var(--color-danger-rgb), 0.25);
  pointer-events: none;
}

.group-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.75rem 1.5rem;
}

.group-view__header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  align-items: center;
}
.group-view__actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-left: auto;
}

.group-view__action {
  padding-inline: 1.25rem;
  font-size: 0.95rem;
  box-shadow: 0 16px 30px rgba(var(--color-shadow-rgb), 0.22);
}


.group-view__action svg {
  width: 1.1rem;
  height: 1.1rem;
}

.group-view__menu {
  position: relative;
}

.group-view__menu-toggle {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--color-shadow-rgb), 0.08);
  color: var(--color-primary-dark);
  box-shadow: 0 12px 26px rgba(var(--color-shadow-rgb), 0.18);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.group-view__menu-toggle:hover,
.group-view__menu-toggle:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(var(--color-shadow-rgb), 0.22);
}

.group-view__menu-toggle:active {
  transform: translateY(0);
  box-shadow: 0 10px 22px rgba(var(--color-shadow-rgb), 0.16);
}

.group-view__menu-toggle:focus-visible {
  outline: 2px solid rgba(var(--color-primary-rgb), 0.45);
  outline-offset: 2px;
}

.group-view__menu-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
}

.group-view__menu-popover {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 220px;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(var(--color-white-rgb), 0.98);
  border: 1px solid rgba(var(--color-shadow-rgb), 0.12);
  box-shadow: 0 20px 40px rgba(var(--color-shadow-rgb), 0.22);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 10;
}

.group-view__menu-popover[hidden] {
  display: none;
}

.group-view__menu-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.group-view__menu-info {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.group-view__menu-info-label {
  color: var(--color-primary-dark);
  font-weight: 600;
}

.group-view__menu-item {
  appearance: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: rgba(var(--color-shadow-rgb), 0.08);
  color: var(--color-primary-dark);
  font-weight: 600;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.group-view__menu-item:hover,
.group-view__menu-item:focus-visible {
  background: rgba(var(--color-primary-rgb), 0.16);
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(var(--color-shadow-rgb), 0.18);
}

.group-view__menu-item:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(var(--color-shadow-rgb), 0.14);
}

.group-view__menu-item:focus-visible {
  outline: 2px solid rgba(var(--color-primary-rgb), 0.4);
  outline-offset: 2px;
}

.button.button--secondary.group-view__action {
  background: var(--color-surface-alt);
  color: var(--color-primary-dark);
  border: 1px solid rgba(var(--color-shadow-rgb), 0.08);
  box-shadow: 0 12px 24px rgba(var(--color-shadow-rgb), 0.15);
}

.group-view__title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.group-view__title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

.group-view__badge {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.28), rgba(var(--color-accent-rgb), 0.22));
  color: var(--color-primary-dark);
  font-size: 0.8rem;
  font-weight: 600;
}


.group-view__balance {
  font-weight: 600;
  font-size: 1.1rem;
}

.group-view__balance--positive {
  color: var(--color-success);
}

.group-view__balance--negative {
  color: var(--color-danger);
}

.group-view__description {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.group-view__section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 16px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.16);
  background: rgba(var(--color-white-rgb), 0.94);
  box-shadow: 0 16px 36px rgba(var(--color-shadow-rgb), 0.12);
}
.member-actions {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.member-actions__section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: 1rem;
  border: 1px solid rgba(var(--color-shadow-rgb), 0.06);
  background: linear-gradient(180deg, rgba(var(--color-shadow-rgb), 0.04), rgba(var(--color-shadow-rgb), 0.08));
  box-shadow: 0 18px 32px rgba(var(--color-shadow-rgb), 0.12);
}
.member-actions__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary-dark);
}
.member-actions__description {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.5;
}
.member-actions__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.member-actions__controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.member-actions__feedback {
  font-size: 0.9rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary-dark);
}
.member-actions__feedback--error {
  background: rgba(var(--color-danger-rgb), 0.12);
  color: var(--color-danger);
}
.member-actions__feedback--success {
  background: rgba(var(--color-success-rgb), 0.12);
  color: var(--color-success);
}
.member-actions__link-result {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.member-actions__link-input {
  flex: 1 1 18rem;
  min-width: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(var(--color-shadow-rgb), 0.16);
  font-size: 0.95rem;
  background: var(--color-white);
  color: var(--color-text);
}
.member-actions__copy {
  white-space: nowrap;
}
.member-actions__select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: 0.65rem;
  border: 1px solid rgba(var(--color-shadow-rgb), 0.16);
  background: var(--color-white);
  font-size: 0.95rem;
}

.category-manager {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  min-width: min(540px, 100%);
}

.category-manager__description {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.category-manager__section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-manager__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.category-manager__section-title {
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-text-strong);
}

.category-manager__section-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.category-manager__action svg {
  width: 20px;
  height: 20px;
}

.category-manager__action--disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.category-manager__status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.category-manager__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.category-manager__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.16);
  background: linear-gradient(135deg, rgba(var(--color-white-rgb), 0.96), rgba(var(--color-surface-soft-rgb), 0.9));
}

.category-manager__item-info {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.category-manager__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
}

.category-manager__badge-icon {
  font-size: 1rem;
}

.category-manager__badge-label {
  line-height: 1;
}

.category-manager__subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.category-manager__empty {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.category-manager__note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.category-manager__edit {
  white-space: nowrap;
}

.category-manager__form-section {
  border-top: 1px solid rgba(var(--color-primary-rgb), 0.12);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-manager__form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-manager__form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.expense-form__category-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.3);
  background: rgba(var(--color-white-rgb), 0.95);
  font-size: 1rem;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.expense-form__category-select:focus {
  outline: none;
  border-color: rgba(var(--color-primary-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.18);
}
.group-view__members {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.group-view__expenses-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.group-view__debts {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.group-view__recurring {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recurring-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.recurring-item {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(
    135deg,
    rgba(var(--color-accent-rgb), 0.18),
    rgba(var(--color-primary-rgb), 0.12)
  );
  border: 1px solid rgba(var(--color-accent-rgb), 0.35);
  box-shadow: 0 16px 28px rgba(var(--color-shadow-rgb), 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.recurring-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 36px rgba(var(--color-shadow-rgb), 0.2);
  border-color: rgba(var(--color-accent-rgb), 0.5);
}

.recurring-item--inactive {
  opacity: 0.78;
  background: linear-gradient(
    135deg,
    rgba(var(--color-shadow-rgb), 0.08),
    rgba(var(--color-primary-rgb), 0.08)
  );
  border-color: rgba(var(--color-shadow-rgb), 0.18);
}

.recurring-item__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.recurring-item__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}

.recurring-item__amount-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
}

.recurring-item__amount {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-accent-dark);
}

.recurring-item__note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.recurring-item__meta-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recurring-item__meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.recurring-item__payers,
.recurring-item__creator {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text);
}

.recurring-item__payers {
  font-weight: 500;
}

.recurring-item__participants {
  justify-content: flex-start;
}

.recurring-item__participants .expense-participant {
  box-shadow: 0 8px 16px rgba(var(--color-shadow-rgb), 0.2);
}
.debt-bubble-chart {
  --debt-bubble-chart-background: rgba(var(--color-white-rgb), 0.9);
  --debt-bubble-chart-border-color: rgba(var(--color-primary-rgb), 0.2);
  --debt-bubble-chart-text-color: var(--color-text);
  --debt-bubble-chart-hint-color: var(--color-text-muted);
  --debt-bubble-chart-label-color: var(--color-text);
  --debt-bubble-chart-background-size: auto;
  --debt-bubble-chart-background-position: initial;
  --debt-bubble-chart-background-repeat: repeat;

  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--debt-bubble-chart-border-color);
  background: var(--debt-bubble-chart-background);
  background-size: var(--debt-bubble-chart-background-size);
  background-position: var(--debt-bubble-chart-background-position);
  background-repeat: var(--debt-bubble-chart-background-repeat);
  box-shadow: 0 12px 28px rgba(var(--color-shadow-rgb), 0.08);
  align-items: center;
  text-align: center;
  color: var(--debt-bubble-chart-text-color);
  margin-bottom: 1.5rem;
}

.debt-bubble-chart__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: inherit;
}

.debt-bubble-chart__hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--debt-bubble-chart-hint-color);
}

.debt-bubble-chart__svg {
  width: 100%;
  max-width: 520px;
  height: auto;
  display: block;
  margin-inline: auto;
}

.debt-bubble-chart--combined {
  padding: 1.25rem 1.5rem;
}

.debt-bubble-chart--combined .debt-bubble-chart__svg {
  max-width: min(640px, 100%);
}

.debt-bubble-chart__bubble {
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.4s ease;
}

.debt-bubble-chart--positive .debt-bubble-chart__bubble,
.debt-bubble-chart__bubble--positive {
  filter: drop-shadow(0 0 0 rgba(var(--color-white-rgb), 0.35));
}

.debt-bubble-chart__bubble--positive {
  opacity: 0.95;
}

.debt-bubble-chart__bubble--highlight {
  animation: debt-bubble-glow 3.2s ease-in-out infinite;
}

.debt-bubble-chart__bubble--highlight:hover {
  animation-play-state: paused;
}

@keyframes debt-bubble-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 0 rgba(var(--color-white-rgb), 0.35));
  }
  50% {
    filter: drop-shadow(0 0 18px rgba(var(--color-white-rgb), 0.7));
  }
}

@media (prefers-reduced-motion: reduce) {
  .debt-bubble-chart__bubble--highlight {
    animation: none;
  }
}

.debt-bubble-chart__bubble:hover {
  transform: translateY(-4px);
  opacity: 1;
}

.debt-bubble-chart__value {
  fill: var(--color-white);
  font-weight: 600;
  font-size: 0.9rem;
  text-shadow: 0 1px 4px rgba(var(--color-text-shadow-rgb), 0.35);
}

.debt-bubble-chart__value--positive {
  fill: rgba(var(--color-white-rgb), 0.95);
}

.debt-bubble-chart__label {
  fill: var(--debt-bubble-chart-label-color);
  font-size: 0.75rem;
  font-weight: 500;
}

.debt-bubble-chart__label--positive {
  fill: rgba(var(--color-primary-dark-rgb), 0.92);
  font-weight: 600;
}

.debt-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.debt-item {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.15rem;
  border-radius: 14px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.2);
  background: linear-gradient(
    135deg,
    rgba(var(--color-white-rgb), 0.96) 0%,
    rgba(var(--color-white-rgb), 0.82) 100%
  );
  box-shadow: 0 18px 32px rgba(var(--color-shadow-rgb), 0.08);
}

.debt-item__summary {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
}

.debt-item__participants {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.debt-item__avatars {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.debt-item__avatar {
  --debt-avatar-color: rgba(var(--color-primary-rgb), 0.85);
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background: var(--debt-avatar-color);
  box-shadow: 0 10px 24px rgba(var(--color-shadow-rgb), 0.22);
  overflow: hidden;
}

.debt-item__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.debt-item__arrow {
  font-size: 1.1rem;
  color: rgba(var(--color-text-rgb), 0.65);
}

.debt-item__names {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.debt-item__person {
  white-space: nowrap;
}

.debt-item__person--creditor {
  color: var(--color-primary);
}

.debt-item__direction {
  font-size: 0.85rem;
  font-weight: 500;
  color: rgba(var(--color-text-rgb), 0.7);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.debt-item__amount-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  margin-left: auto;
}

.debt-item__amount-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(var(--color-text-rgb), 0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.debt-item__amount {
  font-weight: 700;
  color: var(--color-danger);
  font-size: 1.05rem;
}

.debt-item__settle {
  padding-inline: 1.25rem;
  box-shadow: 0 12px 26px rgba(var(--color-shadow-rgb), 0.14);
}

.group-view__expenses {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.expense-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.18);
  background: rgba(var(--color-white-rgb), 0.96);
  box-shadow: 0 12px 28px rgba(var(--color-shadow-rgb), 0.08);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.expense-search:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 16px 36px rgba(var(--color-primary-rgb), 0.22);
}

.expense-search__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.expense-search__icon svg {
  width: 1.1rem;
  height: 1.1rem;
}

.expense-search__input {
  flex: 1;
  border: none;
  background: transparent;
  font: inherit;
  color: var(--color-text);
  outline: none;
  min-width: 0;
}

.expense-search__input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.75;
}

.group-view__subtitle {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.group-view__status {
  margin: 0;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background: rgba(var(--color-shadow-rgb), 0.05);
  color: var(--color-text-muted);
}

.group-view__status--error {
  background: rgba(var(--color-danger-rgb), 0.12);
  color: var(--color-danger);
}

.group-view__empty {
  margin: 0;
  text-align: center;
  color: var(--color-text-muted);
}
.group-members__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.group-members__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(var(--color-white-rgb), 0.96);
  border: 1px solid rgba(var(--color-primary-rgb), 0.18);
  box-shadow: 0 12px 28px rgba(var(--color-shadow-rgb), 0.08);
}
.group-members__summary {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.group-members__avatar {
  --member-avatar-color: var(--color-primary-bright);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1rem;
  color: var(--color-white);
  background: linear-gradient(135deg, var(--member-avatar-color), rgba(var(--color-primary-rgb), 0.65));
  box-shadow: 0 12px 24px rgba(var(--color-shadow-rgb), 0.2);
}

.group-members__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.group-members__identity {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.group-members__name {
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
}
.group-members__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.28), rgba(var(--color-accent-rgb), 0.22));
  color: var(--color-primary-dark);
  font-size: 0.7rem;
  font-weight: 600;
}
.group-members__email {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.group-members__balance {
  font-weight: 600;
  font-size: 0.95rem;
}
.group-members__balance--positive {
  color: var(--color-success);
}
.group-members__balance--negative {
  color: var(--color-danger);
}

.group-members-modal {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.group-members-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.group-members-modal__description {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.group-members-modal__empty {
  margin: 0;
  text-align: center;
  color: var(--color-text-muted);
  font-weight: 500;
}
.group-expenses__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.group-expenses__item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(var(--color-white-rgb), 0.96);
  border: 1px solid rgba(var(--color-primary-rgb), 0.16);
  box-shadow: 0 12px 24px rgba(var(--color-shadow-rgb), 0.08);
}
.group-expenses__details {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.group-expenses__title {
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
}
.group-expenses__meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}
.group-expenses__amount {
  font-weight: 600;
  color: var(--color-text);
}
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  z-index: 1000;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--color-shadow-rgb), 0.45);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  background: var(--color-surface);
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(var(--color-shadow-rgb), 0.08);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  width: min(760px, 100%);
  max-height: min(92vh, 840px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal__scroll {
  overflow-y: auto;
  padding-right: clamp(0rem, 1vw, 0.5rem);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}

.modal__close {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.modal__close:hover {
  background: rgba(var(--color-primary-rgb), 0.2);
  color: var(--color-text);
}


.modal__section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.group-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.group-form__grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.group-form__color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
  gap: 0.75rem;
}

.group-form__color-option {
  border: 2px solid transparent;
  border-radius: 14px;
  height: 48px;
  width: 100%;
  background: var(--color-white);
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 18px rgba(var(--color-shadow-rgb), 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  color: var(--color-text-muted);
  font-weight: 600;
  padding: 0;
}

.group-form__color-option:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(var(--color-shadow-rgb), 0.18);
}

.group-form__color-option--selected {
  border-color: rgba(var(--color-primary-rgb), 0.7);
  box-shadow: 0 16px 32px rgba(var(--color-shadow-rgb), 0.26);
}

.group-form__color-option--auto {
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.22), rgba(var(--color-accent-rgb), 0.16));
}

.group-form__color-option:focus-visible {
  outline: 3px solid rgba(var(--color-primary-rgb), 0.4);
  outline-offset: 2px;
}

.group-form__feedback {
  font-size: 0.9rem;
  color: var(--color-danger);
  margin-top: 0.25rem;
}

.group-form__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  cursor: pointer;
}

.group-form__checkbox input[type='checkbox'] {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.35);
  background-color: rgba(var(--color-primary-rgb), 0.12);
  accent-color: var(--color-primary-dark);
  transition: background-color 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.group-form__checkbox input[type='checkbox']:hover {
  border-color: rgba(var(--color-primary-rgb), 0.55);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.18);
}

.group-form__checkbox input[type='checkbox']:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.26);
}

.group-form__checkbox input[type='checkbox']:checked {
  background-color: rgba(var(--color-primary-rgb), 0.22);
  border-color: rgba(var(--color-primary-rgb), 0.7);
}

.expense-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.expense-form__grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.expense-form__section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-field__label {
  font-weight: 600;
  font-size: 0.95rem;
}

.form-field__note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.form-field__helper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.form-field__helper-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: rgba(var(--color-primary-rgb), 0.95);
  cursor: pointer;
  text-decoration: underline;
}

.form-field__helper-button:hover {
  color: rgba(var(--color-primary-rgb), 1);
}

.form-field__helper-button:focus-visible {
  outline: 2px solid rgba(var(--color-primary-rgb), 0.4);
  outline-offset: 2px;
  border-radius: 4px;
}

.form-field__helper-button:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

input[type='text'],
input[type='email'],
input[type='number'],
input[type='date'],
input[type='password'],
select,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  padding: 0.8rem 1rem;
  font: inherit;
  background: var(--color-white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea {
  min-height: 88px;
  resize: vertical;
}
input[type='text']:focus,
input[type='email']:focus,
input[type='number']:focus,
input[type='date']:focus,
input[type='password']:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(var(--color-primary-rgb), 0.45);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
}


.division-toggle {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgba(var(--color-primary-rgb), 0.28);
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.12), rgba(var(--color-accent-rgb), 0.12));
  padding: 0.25rem;
  gap: 0.25rem;
}
.division-toggle__option {
  border: none;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}


.division-toggle__option--active {
  background: var(--color-white);
  color: var(--color-primary-dark);
  box-shadow: 0 8px 18px rgba(var(--color-shadow-rgb), 0.2);
}

.participant-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.participant-row {
  display: grid;
  grid-template-columns: auto 1fr minmax(120px, 160px);
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(var(--color-shadow-rgb), 0.06);
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.08), rgba(var(--color-accent-rgb), 0.08));
}
.participant-row__label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 500;
}

.participant-row__value {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.participant-row__input {
  width: 100%;
}

.participant-row__note {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.participant-row--inactive {
  opacity: 0.5;
  background: transparent;
}

.modal__actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.feedback-inline {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  background: rgba(var(--color-danger-rgb), 0.12);
  color: var(--color-danger);
}

.feedback-inline--success {
  background: rgba(var(--color-success-rgb), 0.16);
  color: var(--color-success);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.expense-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.expense-item {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(var(--color-primary-rgb), 0.18), rgba(var(--color-primary-dark-rgb), 0.12));
  border: 1px solid rgba(var(--color-primary-rgb), 0.26);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.expense-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(var(--color-shadow-rgb), 0.22);
  border-color: rgba(var(--color-primary-rgb), 0.42);
}

.expense-item:focus {
  outline: 2px solid rgba(var(--color-primary-rgb), 0.6);
  outline-offset: 3px;
}


.expense-item__header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.expense-item__details {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.expense-item__amount-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.expense-item__description {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}

.expense-item__category {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.expense-item__category:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(var(--color-shadow-rgb), 0.12);
}

.expense-item__category-icon {
  font-size: 1rem;
  line-height: 1;
}

.expense-item__category-label {
  line-height: 1;
}

.expense-item__amount {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 1.05rem;
}

.expense-item__meta {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.expense-item__participants {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.expense-participant {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 8px 16px rgba(var(--color-shadow-rgb), 0.18);
  border: 2px solid var(--color-surface);
  overflow: hidden;
}

.expense-participant--image {
  padding: 0;
  background: transparent !important;
}

.expense-participant img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.app-footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  background: linear-gradient(120deg, rgba(var(--color-primary-rgb), 0.1), rgba(var(--color-primary-dark-rgb), 0.1), rgba(var(--color-accent-rgb), 0.12));
}

@media (max-width: 900px) {
  .login-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .login-card__content {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: stretch;
  }

  .login-card__content--email-visible {
    grid-template-columns: 1fr;
  }

  .login-card__intro {
    text-align: center;
  }

  .login-card__visual {
    max-width: 320px;
    width: 100%;
    padding: 1.25rem;
  }

  .login-card__image {
    max-width: 260px;
  }

  .login-card__actions {
    max-width: none;
  }

  .login-card__form {
    max-width: none;
  }

  .groups-tabs {
    padding: 1.6rem 1rem 1rem;
  }

  .groups-tabs__button {
    flex: 1 1 100%;
  }

  .content__actions {
    justify-content: flex-start;
    padding: 0 1rem;
  }

  .group-view {
    padding: 1.25rem;
  }

  .group-view__header {
    align-items: flex-start;
  }
	.group-view__actions {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .group-view__balance {
    margin-left: 0;
  }
  .debt-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .debt-item__summary {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.9rem;
  }

  .debt-item__participants {
    width: 100%;
    justify-content: flex-start;
  }

  .debt-item__amount-group {
    width: 100%;
    align-items: flex-start;
  }

  .debt-item__settle {
    width: 100%;
    justify-content: center;
  }
 .debt-bubble-chart__label {
    font-size: 0.75rem;
  }

  .expense-item__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }

  .expense-item__amount-wrapper {
    width: 100%;
    align-items: flex-start;
  }

  .expense-item__amount {
    font-size: 1rem;
  }

  .expense-item__participants {
    justify-content: flex-start;
  }
   .modal__dialog {
    border-radius: 20px;
  }

  .modal__actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .participant-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .login-card__form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .login-card__form-actions .button {
    min-width: 0;
    width: 100%;
  }
}

.profile {
  width: min(860px, 100%);
  margin-inline: auto;
  padding: clamp(1.75rem, 4vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.75rem);
}

.profile__header {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.profile__title {
  margin: 0;
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  color: var(--color-primary-dark);
}

.profile__subtitle {
  margin: 0;
  color: var(--color-text-muted);
  max-width: 42ch;
}

.profile__email {
  margin: 0.25rem 0 0;
  color: var(--color-text-strong);
  font-weight: 600;
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.profile-identity {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  align-items: center;
}

.profile-avatar-preview {
  --profile-accent-color: var(--color-primary);
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 4px solid var(--profile-accent-color);
  background:
    linear-gradient(160deg, rgba(var(--color-white-rgb), 0.92), rgba(var(--color-white-rgb), 0.72)),
    var(--profile-accent-color, var(--color-surface-soft));
  box-shadow: 0 22px 34px rgba(var(--color-shadow-rgb), 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.profile-avatar-preview--large {
  width: clamp(108px, 18vw, 140px);
  height: clamp(108px, 18vw, 140px);
}

.profile-avatar-preview--neutral {
  border-color: rgba(var(--color-primary-rgb), 0.28);
  background:
    linear-gradient(160deg, rgba(var(--color-white-rgb), 0.96), rgba(var(--color-white-rgb), 0.84)),
    rgba(var(--color-white-rgb), 0.98);
}

.profile-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-preview span {
  letter-spacing: 0.05em;
}

.profile-image-picker__controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: min(260px, 100%);
}

.profile-image-picker__controls .button {
  align-self: flex-start;
}

.profile-image-picker__remove {
  color: var(--color-danger);
}

.profile-image-picker__hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.profile-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
  gap: 0.75rem;
}

.profile-color-option {
  position: relative;
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 0;
  background:
    linear-gradient(135deg, rgba(var(--color-white-rgb), 0.1), rgba(var(--color-shadow-rgb), 0.05)),
    var(--profile-color-value, var(--color-surface-soft));
  box-shadow: 0 12px 26px rgba(var(--color-shadow-rgb), 0.16);
  aspect-ratio: 1;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.profile-color-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 32px rgba(var(--color-shadow-rgb), 0.22);
}

.profile-color-option--selected {
  border-color: var(--color-primary);
  box-shadow: 0 20px 34px rgba(var(--color-shadow-rgb), 0.26);
}

.profile-color-option:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.profile-color-option--selected::after {
  content: '✓';
  position: absolute;
  inset: auto 0.55rem 0.5rem auto;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(var(--color-white-rgb), 0.92);
  color: var(--color-primary);
  font-weight: 700;
  box-shadow: 0 6px 12px rgba(var(--color-shadow-rgb), 0.2);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.profile-actions__primary {
  display: flex;
  gap: 0.75rem;
}

.profile-actions__back {
  font-weight: 600;
}

@media (max-width: 720px) {
  .profile {
    padding: clamp(1.5rem, 6vw, 2rem);
  }

  .profile-identity {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-image-picker__controls .button {
    width: 100%;
  }

  .profile-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-actions__primary {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .app-header__actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .user-summary--header {
    width: 100%;
    justify-content: flex-start;
  }

  .user-summary--header .user-summary__details {
    align-items: flex-start;
    text-align: left;
  }

  .user-summary__profile-link {
    align-self: flex-start;
  }

  .content {
    gap: 1.5rem;
  }

  .user-summary {
    flex-direction: column;
    align-items: flex-start;
  }
}